@wordpress/components 29.0.1-next.a9f418477.0 → 29.1.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 (944) hide show
  1. package/CHANGELOG.md +50 -10
  2. package/LICENSE.md +1 -1
  3. package/build/alignment-matrix-control/icon.js +1 -0
  4. package/build/alignment-matrix-control/icon.js.map +1 -1
  5. package/build/alignment-matrix-control/index.js +1 -0
  6. package/build/alignment-matrix-control/index.js.map +1 -1
  7. package/build/autocomplete/autocompleter-ui.js +1 -0
  8. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  9. package/build/autocomplete/autocompleter-ui.native.js +1 -0
  10. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  11. package/build/autocomplete/get-default-use-items.js +1 -0
  12. package/build/autocomplete/get-default-use-items.js.map +1 -1
  13. package/build/autocomplete/index.js +1 -0
  14. package/build/autocomplete/index.js.map +1 -1
  15. package/build/badge/index.js +64 -0
  16. package/build/badge/index.js.map +1 -0
  17. package/build/badge/types.js +6 -0
  18. package/build/badge/types.js.map +1 -0
  19. package/build/border-box-control/utils.js +1 -0
  20. package/build/border-box-control/utils.js.map +1 -1
  21. package/build/border-control/border-control-dropdown/component.js +1 -0
  22. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  23. package/build/border-control/border-control-style-picker/component.js +1 -0
  24. package/build/border-control/border-control-style-picker/component.js.map +1 -1
  25. package/build/box-control/index.js +18 -14
  26. package/build/box-control/index.js.map +1 -1
  27. package/build/box-control/input-control.js +222 -0
  28. package/build/box-control/input-control.js.map +1 -0
  29. package/build/box-control/types.js.map +1 -1
  30. package/build/box-control/utils.js +101 -48
  31. package/build/box-control/utils.js.map +1 -1
  32. package/build/button/index.native.js +1 -0
  33. package/build/button/index.native.js.map +1 -1
  34. package/build/button/types.js.map +1 -1
  35. package/build/button-group/index.js +10 -0
  36. package/build/button-group/index.js.map +1 -1
  37. package/build/button-group/types.js.map +1 -1
  38. package/build/color-indicator/index.native.js +1 -0
  39. package/build/color-indicator/index.native.js.map +1 -1
  40. package/build/color-palette/index.js +1 -0
  41. package/build/color-palette/index.js.map +1 -1
  42. package/build/color-palette/index.native.js +1 -0
  43. package/build/color-palette/index.native.js.map +1 -1
  44. package/build/color-palette/utils.js +1 -0
  45. package/build/color-palette/utils.js.map +1 -1
  46. package/build/combobox-control/index.js +1 -0
  47. package/build/combobox-control/index.js.map +1 -1
  48. package/build/composite/legacy/index.js +1 -0
  49. package/build/composite/legacy/index.js.map +1 -1
  50. package/build/context/context-connect.js +1 -0
  51. package/build/context/context-connect.js.map +1 -1
  52. package/build/custom-gradient-picker/gradient-bar/control-points.js +1 -0
  53. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  54. package/build/custom-gradient-picker/gradient-bar/index.js +1 -0
  55. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  56. package/build/custom-gradient-picker/gradient-bar/utils.js +1 -0
  57. package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  58. package/build/custom-gradient-picker/index.js +1 -0
  59. package/build/custom-gradient-picker/index.js.map +1 -1
  60. package/build/custom-gradient-picker/serializer.js +1 -0
  61. package/build/custom-gradient-picker/serializer.js.map +1 -1
  62. package/build/custom-gradient-picker/utils.js +1 -0
  63. package/build/custom-gradient-picker/utils.js.map +1 -1
  64. package/build/custom-select-control/index.js +2 -3
  65. package/build/custom-select-control/index.js.map +1 -1
  66. package/build/custom-select-control-v2/custom-select.js +2 -3
  67. package/build/custom-select-control-v2/custom-select.js.map +1 -1
  68. package/build/dashicon/index.js +1 -0
  69. package/build/dashicon/index.js.map +1 -1
  70. package/build/date-time/date/index.js +2 -0
  71. package/build/date-time/date/index.js.map +1 -1
  72. package/build/date-time/date/use-lilius/index.js +1 -0
  73. package/build/date-time/date/use-lilius/index.js.map +1 -1
  74. package/build/date-time/time/index.js +1 -0
  75. package/build/date-time/time/index.js.map +1 -1
  76. package/build/dimension-control/index.js +2 -0
  77. package/build/dimension-control/index.js.map +1 -1
  78. package/build/dimension-control/sizes.js +1 -0
  79. package/build/dimension-control/sizes.js.map +1 -1
  80. package/build/draggable/index.js +1 -0
  81. package/build/draggable/index.js.map +1 -1
  82. package/build/draggable/index.native.js +1 -0
  83. package/build/draggable/index.native.js.map +1 -1
  84. package/build/dropdown-menu/index.js +1 -0
  85. package/build/dropdown-menu/index.js.map +1 -1
  86. package/build/dropdown-menu/index.native.js +1 -0
  87. package/build/dropdown-menu/index.native.js.map +1 -1
  88. package/build/duotone-picker/color-list-picker/index.js +1 -0
  89. package/build/duotone-picker/color-list-picker/index.js.map +1 -1
  90. package/build/duotone-picker/duotone-picker.js +1 -0
  91. package/build/duotone-picker/duotone-picker.js.map +1 -1
  92. package/build/duotone-picker/utils.js +1 -0
  93. package/build/duotone-picker/utils.js.map +1 -1
  94. package/build/external-link/index.js +1 -0
  95. package/build/external-link/index.js.map +1 -1
  96. package/build/font-size-picker/font-size-picker-select.js +1 -0
  97. package/build/font-size-picker/font-size-picker-select.js.map +1 -1
  98. package/build/font-size-picker/font-size-picker-toggle-group.js +1 -0
  99. package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  100. package/build/font-size-picker/index.js +1 -0
  101. package/build/font-size-picker/index.js.map +1 -1
  102. package/build/font-size-picker/index.native.js +1 -0
  103. package/build/font-size-picker/index.native.js.map +1 -1
  104. package/build/font-size-picker/styles.js +9 -9
  105. package/build/font-size-picker/styles.js.map +1 -1
  106. package/build/font-size-picker/utils.js +1 -0
  107. package/build/font-size-picker/utils.js.map +1 -1
  108. package/build/form-token-field/index.js +1 -0
  109. package/build/form-token-field/index.js.map +1 -1
  110. package/build/form-token-field/suggestions-list.js +1 -0
  111. package/build/form-token-field/suggestions-list.js.map +1 -1
  112. package/build/gradient-picker/index.js +1 -0
  113. package/build/gradient-picker/index.js.map +1 -1
  114. package/build/guide/index.js +1 -0
  115. package/build/guide/index.js.map +1 -1
  116. package/build/guide/page-control.js +1 -0
  117. package/build/guide/page-control.js.map +1 -1
  118. package/build/h-stack/hook.js +1 -0
  119. package/build/h-stack/hook.js.map +1 -1
  120. package/build/heading/hook.js +1 -1
  121. package/build/heading/hook.js.map +1 -1
  122. package/build/higher-order/navigate-regions/index.js +1 -0
  123. package/build/higher-order/navigate-regions/index.js.map +1 -1
  124. package/build/higher-order/with-fallback-styles/index.js +1 -0
  125. package/build/higher-order/with-fallback-styles/index.js.map +1 -1
  126. package/build/higher-order/with-filters/index.js +1 -0
  127. package/build/higher-order/with-filters/index.js.map +1 -1
  128. package/build/higher-order/with-notices/index.js +1 -0
  129. package/build/higher-order/with-notices/index.js.map +1 -1
  130. package/build/input-control/index.js +9 -0
  131. package/build/input-control/index.js.map +1 -1
  132. package/build/input-control/types.js.map +1 -1
  133. package/build/keyboard-shortcuts/index.js +1 -0
  134. package/build/keyboard-shortcuts/index.js.map +1 -1
  135. package/build/menu/checkbox-item.js +2 -0
  136. package/build/menu/checkbox-item.js.map +1 -1
  137. package/build/menu/index.js +25 -94
  138. package/build/menu/index.js.map +1 -1
  139. package/build/menu/item.js +10 -1
  140. package/build/menu/item.js.map +1 -1
  141. package/build/menu/popover.js +89 -0
  142. package/build/menu/popover.js.map +1 -0
  143. package/build/menu/radio-item.js +2 -0
  144. package/build/menu/radio-item.js.map +1 -1
  145. package/build/menu/styles.js +16 -16
  146. package/build/menu/styles.js.map +1 -1
  147. package/build/menu/submenu-trigger-item.js +58 -0
  148. package/build/menu/submenu-trigger-item.js.map +1 -0
  149. package/build/menu/trigger-button.js +45 -0
  150. package/build/menu/trigger-button.js.map +1 -0
  151. package/build/menu/types.js.map +1 -1
  152. package/build/menu-items-choice/index.js +1 -0
  153. package/build/menu-items-choice/index.js.map +1 -1
  154. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
  155. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  156. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
  157. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  158. package/build/mobile/bottom-sheet/picker-cell.native.js +1 -0
  159. package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  160. package/build/mobile/bottom-sheet-select-control/index.native.js +1 -0
  161. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  162. package/build/mobile/color-settings/palette.screen.native.js +1 -0
  163. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  164. package/build/mobile/gradient/index.native.js +1 -0
  165. package/build/mobile/gradient/index.native.js.map +1 -1
  166. package/build/mobile/media-edit/index.native.js +1 -0
  167. package/build/mobile/media-edit/index.native.js.map +1 -1
  168. package/build/mobile/picker/index.android.js +1 -0
  169. package/build/mobile/picker/index.android.js.map +1 -1
  170. package/build/mobile/picker/index.ios.js +1 -0
  171. package/build/mobile/picker/index.ios.js.map +1 -1
  172. package/build/mobile/segmented-control/index.native.js +1 -0
  173. package/build/mobile/segmented-control/index.native.js.map +1 -1
  174. package/build/mobile/utils/get-px-from-css-unit.native.js +1 -0
  175. package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  176. package/build/navigable-container/container.js +1 -0
  177. package/build/navigable-container/container.js.map +1 -1
  178. package/build/navigation/back-button/index.js +1 -0
  179. package/build/navigation/back-button/index.js.map +1 -1
  180. package/build/navigation/group/index.js +1 -0
  181. package/build/navigation/group/index.js.map +1 -1
  182. package/build/navigation/index.js +6 -0
  183. package/build/navigation/index.js.map +1 -1
  184. package/build/navigation/item/index.js +1 -0
  185. package/build/navigation/item/index.js.map +1 -1
  186. package/build/navigation/menu/menu-title-search.js +1 -0
  187. package/build/navigation/menu/menu-title-search.js.map +1 -1
  188. package/build/navigation/menu/search-no-results-found.js +1 -0
  189. package/build/navigation/menu/search-no-results-found.js.map +1 -1
  190. package/build/navigation/styles/navigation-styles.js +12 -12
  191. package/build/navigation/styles/navigation-styles.js.map +1 -1
  192. package/build/navigator/navigator/component.js +1 -0
  193. package/build/navigator/navigator/component.js.map +1 -1
  194. package/build/navigator/navigator-screen/component.js +1 -0
  195. package/build/navigator/navigator-screen/component.js.map +1 -1
  196. package/build/navigator/utils/router.js +1 -0
  197. package/build/navigator/utils/router.js.map +1 -1
  198. package/build/notice/index.js +1 -0
  199. package/build/notice/index.js.map +1 -1
  200. package/build/notice/list.js +1 -0
  201. package/build/notice/list.js.map +1 -1
  202. package/build/notice/list.native.js +1 -0
  203. package/build/notice/list.native.js.map +1 -1
  204. package/build/number-control/index.js +1 -0
  205. package/build/number-control/index.js.map +1 -1
  206. package/build/palette-edit/index.js +2 -0
  207. package/build/palette-edit/index.js.map +1 -1
  208. package/build/panel/actions.native.js +1 -0
  209. package/build/panel/actions.native.js.map +1 -1
  210. package/build/private-apis.js +3 -1
  211. package/build/private-apis.js.map +1 -1
  212. package/build/query-controls/index.js +1 -0
  213. package/build/query-controls/index.js.map +1 -1
  214. package/build/query-controls/terms.js +1 -0
  215. package/build/query-controls/terms.js.map +1 -1
  216. package/build/radio-control/index.js +1 -0
  217. package/build/radio-control/index.js.map +1 -1
  218. package/build/radio-control/index.native.js +1 -0
  219. package/build/radio-control/index.native.js.map +1 -1
  220. package/build/radio-group/index.js +6 -0
  221. package/build/radio-group/index.js.map +1 -1
  222. package/build/radio-group/radio.js +2 -3
  223. package/build/radio-group/radio.js.map +1 -1
  224. package/build/range-control/rail.js +1 -0
  225. package/build/range-control/rail.js.map +1 -1
  226. package/build/range-control/styles/range-control-styles.js +28 -28
  227. package/build/range-control/styles/range-control-styles.js.map +1 -1
  228. package/build/resizable-box/index.js +1 -0
  229. package/build/resizable-box/index.js.map +1 -1
  230. package/build/sandbox/index.js +1 -0
  231. package/build/sandbox/index.js.map +1 -1
  232. package/build/sandbox/index.native.js +1 -0
  233. package/build/sandbox/index.native.js.map +1 -1
  234. package/build/search-control/index.native.js +1 -0
  235. package/build/search-control/index.native.js.map +1 -1
  236. package/build/select-control/index.js +10 -0
  237. package/build/select-control/index.js.map +1 -1
  238. package/build/select-control/types.js.map +1 -1
  239. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -0
  240. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  241. package/build/slot-fill/context.js +4 -3
  242. package/build/slot-fill/context.js.map +1 -1
  243. package/build/slot-fill/fill.js +10 -15
  244. package/build/slot-fill/fill.js.map +1 -1
  245. package/build/slot-fill/provider.js +42 -55
  246. package/build/slot-fill/provider.js.map +1 -1
  247. package/build/slot-fill/slot.js +32 -23
  248. package/build/slot-fill/slot.js.map +1 -1
  249. package/build/slot-fill/types.js.map +1 -1
  250. package/build/snackbar/index.js +1 -0
  251. package/build/snackbar/index.js.map +1 -1
  252. package/build/snackbar/list.js +1 -0
  253. package/build/snackbar/list.js.map +1 -1
  254. package/build/tab-panel/index.js +3 -3
  255. package/build/tab-panel/index.js.map +1 -1
  256. package/build/tabs/index.js +22 -4
  257. package/build/tabs/index.js.map +1 -1
  258. package/build/tabs/types.js.map +1 -1
  259. package/build/text/hook.js +6 -6
  260. package/build/text/hook.js.map +1 -1
  261. package/build/text/styles.js +7 -7
  262. package/build/text/styles.js.map +1 -1
  263. package/build/text/utils.js +1 -0
  264. package/build/text/utils.js.map +1 -1
  265. package/build/theme/color-algorithms.js +1 -0
  266. package/build/theme/color-algorithms.js.map +1 -1
  267. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +2 -3
  268. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  269. package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
  270. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  271. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
  272. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  273. package/build/toolbar/toolbar-group/index.js +1 -0
  274. package/build/toolbar/toolbar-group/index.js.map +1 -1
  275. package/build/tools-panel/tools-panel/hook.js +1 -0
  276. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  277. package/build/tools-panel/tools-panel-header/component.js +1 -0
  278. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  279. package/build/tooltip/index.js +2 -3
  280. package/build/tooltip/index.js.map +1 -1
  281. package/build/tree-grid/index.js +1 -0
  282. package/build/tree-grid/index.js.map +1 -1
  283. package/build/tree-select/index.js +11 -2
  284. package/build/tree-select/index.js.map +1 -1
  285. package/build/tree-select/types.js.map +1 -1
  286. package/build/unit-control/index.js +1 -0
  287. package/build/unit-control/index.js.map +1 -1
  288. package/build/unit-control/index.native.js +1 -0
  289. package/build/unit-control/index.native.js.map +1 -1
  290. package/build/unit-control/unit-select-control.js +1 -0
  291. package/build/unit-control/unit-select-control.js.map +1 -1
  292. package/build/unit-control/utils.js +1 -0
  293. package/build/unit-control/utils.js.map +1 -1
  294. package/build/utils/colors-values.js +3 -0
  295. package/build/utils/colors-values.js.map +1 -1
  296. package/build/utils/config-values.js +0 -1
  297. package/build/utils/config-values.js.map +1 -1
  298. package/build/utils/get-valid-children.js +1 -0
  299. package/build/utils/get-valid-children.js.map +1 -1
  300. package/build/utils/hooks/use-animated-offset-rect.js +1 -0
  301. package/build/utils/hooks/use-animated-offset-rect.js.map +1 -1
  302. package/build/utils/hooks/use-cx.js +1 -0
  303. package/build/utils/hooks/use-cx.js.map +1 -1
  304. package/build/utils/math.js +1 -0
  305. package/build/utils/math.js.map +1 -1
  306. package/build/utils/rtl.js +1 -0
  307. package/build/utils/rtl.js.map +1 -1
  308. package/build/utils/values.js +1 -0
  309. package/build/utils/values.js.map +1 -1
  310. package/build/z-stack/component.js +1 -0
  311. package/build/z-stack/component.js.map +1 -1
  312. package/build-module/alignment-matrix-control/icon.js +1 -0
  313. package/build-module/alignment-matrix-control/icon.js.map +1 -1
  314. package/build-module/alignment-matrix-control/index.js +1 -0
  315. package/build-module/alignment-matrix-control/index.js.map +1 -1
  316. package/build-module/autocomplete/autocompleter-ui.js +1 -0
  317. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  318. package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
  319. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  320. package/build-module/autocomplete/get-default-use-items.js +1 -0
  321. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  322. package/build-module/autocomplete/index.js +1 -0
  323. package/build-module/autocomplete/index.js.map +1 -1
  324. package/build-module/badge/index.js +57 -0
  325. package/build-module/badge/index.js.map +1 -0
  326. package/build-module/badge/types.js +2 -0
  327. package/build-module/badge/types.js.map +1 -0
  328. package/build-module/border-box-control/utils.js +1 -0
  329. package/build-module/border-box-control/utils.js.map +1 -1
  330. package/build-module/border-control/border-control-dropdown/component.js +1 -0
  331. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  332. package/build-module/border-control/border-control-style-picker/component.js +1 -0
  333. package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
  334. package/build-module/box-control/index.js +20 -16
  335. package/build-module/box-control/index.js.map +1 -1
  336. package/build-module/box-control/input-control.js +214 -0
  337. package/build-module/box-control/input-control.js.map +1 -0
  338. package/build-module/box-control/types.js.map +1 -1
  339. package/build-module/box-control/utils.js +95 -46
  340. package/build-module/box-control/utils.js.map +1 -1
  341. package/build-module/button/index.native.js +1 -0
  342. package/build-module/button/index.native.js.map +1 -1
  343. package/build-module/button/types.js.map +1 -1
  344. package/build-module/button-group/index.js +10 -0
  345. package/build-module/button-group/index.js.map +1 -1
  346. package/build-module/button-group/types.js.map +1 -1
  347. package/build-module/color-indicator/index.native.js +1 -0
  348. package/build-module/color-indicator/index.native.js.map +1 -1
  349. package/build-module/color-palette/index.js +1 -0
  350. package/build-module/color-palette/index.js.map +1 -1
  351. package/build-module/color-palette/index.native.js +1 -0
  352. package/build-module/color-palette/index.native.js.map +1 -1
  353. package/build-module/color-palette/utils.js +1 -0
  354. package/build-module/color-palette/utils.js.map +1 -1
  355. package/build-module/combobox-control/index.js +1 -0
  356. package/build-module/combobox-control/index.js.map +1 -1
  357. package/build-module/composite/legacy/index.js +1 -0
  358. package/build-module/composite/legacy/index.js.map +1 -1
  359. package/build-module/context/context-connect.js +1 -0
  360. package/build-module/context/context-connect.js.map +1 -1
  361. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -0
  362. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  363. package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -0
  364. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  365. package/build-module/custom-gradient-picker/gradient-bar/utils.js +1 -0
  366. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  367. package/build-module/custom-gradient-picker/index.js +1 -0
  368. package/build-module/custom-gradient-picker/index.js.map +1 -1
  369. package/build-module/custom-gradient-picker/serializer.js +1 -0
  370. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  371. package/build-module/custom-gradient-picker/utils.js +1 -0
  372. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  373. package/build-module/custom-select-control/index.js +2 -3
  374. package/build-module/custom-select-control/index.js.map +1 -1
  375. package/build-module/custom-select-control-v2/custom-select.js +1 -2
  376. package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
  377. package/build-module/dashicon/index.js +1 -0
  378. package/build-module/dashicon/index.js.map +1 -1
  379. package/build-module/date-time/date/index.js +2 -0
  380. package/build-module/date-time/date/index.js.map +1 -1
  381. package/build-module/date-time/date/use-lilius/index.js +1 -0
  382. package/build-module/date-time/date/use-lilius/index.js.map +1 -1
  383. package/build-module/date-time/time/index.js +1 -0
  384. package/build-module/date-time/time/index.js.map +1 -1
  385. package/build-module/dimension-control/index.js +2 -0
  386. package/build-module/dimension-control/index.js.map +1 -1
  387. package/build-module/dimension-control/sizes.js +1 -0
  388. package/build-module/dimension-control/sizes.js.map +1 -1
  389. package/build-module/draggable/index.js +1 -0
  390. package/build-module/draggable/index.js.map +1 -1
  391. package/build-module/draggable/index.native.js +1 -0
  392. package/build-module/draggable/index.native.js.map +1 -1
  393. package/build-module/dropdown-menu/index.js +1 -0
  394. package/build-module/dropdown-menu/index.js.map +1 -1
  395. package/build-module/dropdown-menu/index.native.js +1 -0
  396. package/build-module/dropdown-menu/index.native.js.map +1 -1
  397. package/build-module/duotone-picker/color-list-picker/index.js +1 -0
  398. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
  399. package/build-module/duotone-picker/duotone-picker.js +1 -0
  400. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  401. package/build-module/duotone-picker/utils.js +1 -0
  402. package/build-module/duotone-picker/utils.js.map +1 -1
  403. package/build-module/external-link/index.js +1 -0
  404. package/build-module/external-link/index.js.map +1 -1
  405. package/build-module/font-size-picker/font-size-picker-select.js +1 -0
  406. package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
  407. package/build-module/font-size-picker/font-size-picker-toggle-group.js +1 -0
  408. package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  409. package/build-module/font-size-picker/index.js +1 -0
  410. package/build-module/font-size-picker/index.js.map +1 -1
  411. package/build-module/font-size-picker/index.native.js +1 -0
  412. package/build-module/font-size-picker/index.native.js.map +1 -1
  413. package/build-module/font-size-picker/styles.js +9 -9
  414. package/build-module/font-size-picker/styles.js.map +1 -1
  415. package/build-module/font-size-picker/utils.js +1 -0
  416. package/build-module/font-size-picker/utils.js.map +1 -1
  417. package/build-module/form-token-field/index.js +1 -0
  418. package/build-module/form-token-field/index.js.map +1 -1
  419. package/build-module/form-token-field/suggestions-list.js +1 -0
  420. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  421. package/build-module/gradient-picker/index.js +1 -0
  422. package/build-module/gradient-picker/index.js.map +1 -1
  423. package/build-module/guide/index.js +1 -0
  424. package/build-module/guide/index.js.map +1 -1
  425. package/build-module/guide/page-control.js +1 -0
  426. package/build-module/guide/page-control.js.map +1 -1
  427. package/build-module/h-stack/hook.js +1 -0
  428. package/build-module/h-stack/hook.js.map +1 -1
  429. package/build-module/heading/hook.js +1 -1
  430. package/build-module/heading/hook.js.map +1 -1
  431. package/build-module/higher-order/navigate-regions/index.js +1 -0
  432. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  433. package/build-module/higher-order/with-fallback-styles/index.js +1 -0
  434. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  435. package/build-module/higher-order/with-filters/index.js +1 -0
  436. package/build-module/higher-order/with-filters/index.js.map +1 -1
  437. package/build-module/higher-order/with-notices/index.js +1 -0
  438. package/build-module/higher-order/with-notices/index.js.map +1 -1
  439. package/build-module/input-control/index.js +9 -0
  440. package/build-module/input-control/index.js.map +1 -1
  441. package/build-module/input-control/types.js.map +1 -1
  442. package/build-module/keyboard-shortcuts/index.js +1 -0
  443. package/build-module/keyboard-shortcuts/index.js.map +1 -1
  444. package/build-module/menu/checkbox-item.js +2 -0
  445. package/build-module/menu/checkbox-item.js.map +1 -1
  446. package/build-module/menu/index.js +28 -97
  447. package/build-module/menu/index.js.map +1 -1
  448. package/build-module/menu/item.js +10 -1
  449. package/build-module/menu/item.js.map +1 -1
  450. package/build-module/menu/popover.js +81 -0
  451. package/build-module/menu/popover.js.map +1 -0
  452. package/build-module/menu/radio-item.js +2 -0
  453. package/build-module/menu/radio-item.js.map +1 -1
  454. package/build-module/menu/styles.js +16 -16
  455. package/build-module/menu/styles.js.map +1 -1
  456. package/build-module/menu/submenu-trigger-item.js +50 -0
  457. package/build-module/menu/submenu-trigger-item.js.map +1 -0
  458. package/build-module/menu/trigger-button.js +37 -0
  459. package/build-module/menu/trigger-button.js.map +1 -0
  460. package/build-module/menu/types.js.map +1 -1
  461. package/build-module/menu-items-choice/index.js +1 -0
  462. package/build-module/menu-items-choice/index.js.map +1 -1
  463. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
  464. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  465. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
  466. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  467. package/build-module/mobile/bottom-sheet/picker-cell.native.js +1 -0
  468. package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  469. package/build-module/mobile/bottom-sheet-select-control/index.native.js +1 -0
  470. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  471. package/build-module/mobile/color-settings/palette.screen.native.js +1 -0
  472. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  473. package/build-module/mobile/gradient/index.native.js +1 -0
  474. package/build-module/mobile/gradient/index.native.js.map +1 -1
  475. package/build-module/mobile/media-edit/index.native.js +1 -0
  476. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  477. package/build-module/mobile/picker/index.android.js +1 -0
  478. package/build-module/mobile/picker/index.android.js.map +1 -1
  479. package/build-module/mobile/picker/index.ios.js +1 -0
  480. package/build-module/mobile/picker/index.ios.js.map +1 -1
  481. package/build-module/mobile/segmented-control/index.native.js +1 -0
  482. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  483. package/build-module/mobile/utils/get-px-from-css-unit.native.js +1 -0
  484. package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  485. package/build-module/navigable-container/container.js +1 -0
  486. package/build-module/navigable-container/container.js.map +1 -1
  487. package/build-module/navigation/back-button/index.js +1 -0
  488. package/build-module/navigation/back-button/index.js.map +1 -1
  489. package/build-module/navigation/group/index.js +1 -0
  490. package/build-module/navigation/group/index.js.map +1 -1
  491. package/build-module/navigation/index.js +6 -0
  492. package/build-module/navigation/index.js.map +1 -1
  493. package/build-module/navigation/item/index.js +1 -0
  494. package/build-module/navigation/item/index.js.map +1 -1
  495. package/build-module/navigation/menu/menu-title-search.js +1 -0
  496. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  497. package/build-module/navigation/menu/search-no-results-found.js +1 -0
  498. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  499. package/build-module/navigation/styles/navigation-styles.js +12 -12
  500. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  501. package/build-module/navigator/navigator/component.js +1 -0
  502. package/build-module/navigator/navigator/component.js.map +1 -1
  503. package/build-module/navigator/navigator-screen/component.js +1 -0
  504. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  505. package/build-module/navigator/utils/router.js +1 -0
  506. package/build-module/navigator/utils/router.js.map +1 -1
  507. package/build-module/notice/index.js +1 -0
  508. package/build-module/notice/index.js.map +1 -1
  509. package/build-module/notice/list.js +1 -0
  510. package/build-module/notice/list.js.map +1 -1
  511. package/build-module/notice/list.native.js +1 -0
  512. package/build-module/notice/list.native.js.map +1 -1
  513. package/build-module/number-control/index.js +1 -0
  514. package/build-module/number-control/index.js.map +1 -1
  515. package/build-module/palette-edit/index.js +2 -0
  516. package/build-module/palette-edit/index.js.map +1 -1
  517. package/build-module/panel/actions.native.js +1 -0
  518. package/build-module/panel/actions.native.js.map +1 -1
  519. package/build-module/private-apis.js +3 -1
  520. package/build-module/private-apis.js.map +1 -1
  521. package/build-module/query-controls/index.js +1 -0
  522. package/build-module/query-controls/index.js.map +1 -1
  523. package/build-module/query-controls/terms.js +1 -0
  524. package/build-module/query-controls/terms.js.map +1 -1
  525. package/build-module/radio-control/index.js +1 -0
  526. package/build-module/radio-control/index.js.map +1 -1
  527. package/build-module/radio-control/index.native.js +1 -0
  528. package/build-module/radio-control/index.native.js.map +1 -1
  529. package/build-module/radio-group/index.js +6 -0
  530. package/build-module/radio-group/index.js.map +1 -1
  531. package/build-module/radio-group/radio.js +1 -2
  532. package/build-module/radio-group/radio.js.map +1 -1
  533. package/build-module/range-control/rail.js +1 -0
  534. package/build-module/range-control/rail.js.map +1 -1
  535. package/build-module/range-control/styles/range-control-styles.js +28 -28
  536. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  537. package/build-module/resizable-box/index.js +1 -0
  538. package/build-module/resizable-box/index.js.map +1 -1
  539. package/build-module/sandbox/index.js +1 -0
  540. package/build-module/sandbox/index.js.map +1 -1
  541. package/build-module/sandbox/index.native.js +1 -0
  542. package/build-module/sandbox/index.native.js.map +1 -1
  543. package/build-module/search-control/index.native.js +1 -0
  544. package/build-module/search-control/index.native.js.map +1 -1
  545. package/build-module/select-control/index.js +10 -0
  546. package/build-module/select-control/index.js.map +1 -1
  547. package/build-module/select-control/types.js.map +1 -1
  548. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -0
  549. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  550. package/build-module/slot-fill/context.js +5 -3
  551. package/build-module/slot-fill/context.js.map +1 -1
  552. package/build-module/slot-fill/fill.js +10 -15
  553. package/build-module/slot-fill/fill.js.map +1 -1
  554. package/build-module/slot-fill/provider.js +42 -55
  555. package/build-module/slot-fill/provider.js.map +1 -1
  556. package/build-module/slot-fill/slot.js +33 -24
  557. package/build-module/slot-fill/slot.js.map +1 -1
  558. package/build-module/slot-fill/types.js.map +1 -1
  559. package/build-module/snackbar/index.js +1 -0
  560. package/build-module/snackbar/index.js.map +1 -1
  561. package/build-module/snackbar/list.js +1 -0
  562. package/build-module/snackbar/list.js.map +1 -1
  563. package/build-module/tab-panel/index.js +2 -2
  564. package/build-module/tab-panel/index.js.map +1 -1
  565. package/build-module/tabs/index.js +22 -4
  566. package/build-module/tabs/index.js.map +1 -1
  567. package/build-module/tabs/types.js.map +1 -1
  568. package/build-module/text/hook.js +6 -6
  569. package/build-module/text/hook.js.map +1 -1
  570. package/build-module/text/styles.js +7 -7
  571. package/build-module/text/styles.js.map +1 -1
  572. package/build-module/text/utils.js +1 -0
  573. package/build-module/text/utils.js.map +1 -1
  574. package/build-module/theme/color-algorithms.js +1 -0
  575. package/build-module/theme/color-algorithms.js.map +1 -1
  576. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +1 -2
  577. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  578. package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
  579. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  580. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
  581. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  582. package/build-module/toolbar/toolbar-group/index.js +1 -0
  583. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  584. package/build-module/tools-panel/tools-panel/hook.js +1 -0
  585. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  586. package/build-module/tools-panel/tools-panel-header/component.js +1 -0
  587. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  588. package/build-module/tooltip/index.js +1 -2
  589. package/build-module/tooltip/index.js.map +1 -1
  590. package/build-module/tree-grid/index.js +1 -0
  591. package/build-module/tree-grid/index.js.map +1 -1
  592. package/build-module/tree-select/index.js +11 -2
  593. package/build-module/tree-select/index.js.map +1 -1
  594. package/build-module/tree-select/types.js.map +1 -1
  595. package/build-module/unit-control/index.js +1 -0
  596. package/build-module/unit-control/index.js.map +1 -1
  597. package/build-module/unit-control/index.native.js +1 -0
  598. package/build-module/unit-control/index.native.js.map +1 -1
  599. package/build-module/unit-control/unit-select-control.js +1 -0
  600. package/build-module/unit-control/unit-select-control.js.map +1 -1
  601. package/build-module/unit-control/utils.js +1 -0
  602. package/build-module/unit-control/utils.js.map +1 -1
  603. package/build-module/utils/colors-values.js +3 -0
  604. package/build-module/utils/colors-values.js.map +1 -1
  605. package/build-module/utils/config-values.js +0 -1
  606. package/build-module/utils/config-values.js.map +1 -1
  607. package/build-module/utils/get-valid-children.js +1 -0
  608. package/build-module/utils/get-valid-children.js.map +1 -1
  609. package/build-module/utils/hooks/use-animated-offset-rect.js +1 -0
  610. package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -1
  611. package/build-module/utils/hooks/use-cx.js +1 -0
  612. package/build-module/utils/hooks/use-cx.js.map +1 -1
  613. package/build-module/utils/math.js +1 -0
  614. package/build-module/utils/math.js.map +1 -1
  615. package/build-module/utils/rtl.js +1 -0
  616. package/build-module/utils/rtl.js.map +1 -1
  617. package/build-module/utils/values.js +1 -0
  618. package/build-module/utils/values.js.map +1 -1
  619. package/build-module/z-stack/component.js +1 -0
  620. package/build-module/z-stack/component.js.map +1 -1
  621. package/build-style/style-rtl.css +60 -13
  622. package/build-style/style.css +60 -13
  623. package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
  624. package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
  625. package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
  626. package/build-types/animate/stories/index.story.d.ts +7 -7
  627. package/build-types/animate/stories/index.story.d.ts.map +1 -1
  628. package/build-types/badge/index.d.ts +8 -0
  629. package/build-types/badge/index.d.ts.map +1 -0
  630. package/build-types/badge/stories/index.story.d.ts +17 -0
  631. package/build-types/badge/stories/index.story.d.ts.map +1 -0
  632. package/build-types/badge/test/index.d.ts +2 -0
  633. package/build-types/badge/test/index.d.ts.map +1 -0
  634. package/build-types/badge/types.d.ts +13 -0
  635. package/build-types/badge/types.d.ts.map +1 -0
  636. package/build-types/base-control/stories/index.story.d.ts +1 -1
  637. package/build-types/border-box-control/stories/index.story.d.ts +1 -1
  638. package/build-types/border-control/stories/index.story.d.ts +5 -5
  639. package/build-types/box-control/index.d.ts +1 -1
  640. package/build-types/box-control/index.d.ts.map +1 -1
  641. package/build-types/box-control/input-control.d.ts +3 -0
  642. package/build-types/box-control/input-control.d.ts.map +1 -0
  643. package/build-types/box-control/stories/index.story.d.ts +356 -11
  644. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  645. package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
  646. package/build-types/box-control/types.d.ts +26 -1
  647. package/build-types/box-control/types.d.ts.map +1 -1
  648. package/build-types/box-control/utils.d.ts +49 -15
  649. package/build-types/box-control/utils.d.ts.map +1 -1
  650. package/build-types/button/stories/e2e/index.story.d.ts +1 -1
  651. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  652. package/build-types/button/stories/index.story.d.ts +25 -7
  653. package/build-types/button/stories/index.story.d.ts.map +1 -1
  654. package/build-types/button/types.d.ts +6 -4
  655. package/build-types/button/types.d.ts.map +1 -1
  656. package/build-types/button-group/index.d.ts +3 -1
  657. package/build-types/button-group/index.d.ts.map +1 -1
  658. package/build-types/button-group/stories/index.story.d.ts +6 -0
  659. package/build-types/button-group/stories/index.story.d.ts.map +1 -1
  660. package/build-types/button-group/types.d.ts +7 -0
  661. package/build-types/button-group/types.d.ts.map +1 -1
  662. package/build-types/circular-option-picker/stories/index.story.d.ts +5 -5
  663. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  664. package/build-types/color-palette/stories/index.story.d.ts +3 -3
  665. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  666. package/build-types/color-picker/styles.d.ts +2 -2
  667. package/build-types/color-picker/styles.d.ts.map +1 -1
  668. package/build-types/combobox-control/stories/index.story.d.ts +4 -4
  669. package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
  670. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  671. package/build-types/custom-gradient-picker/stories/index.story.d.ts +1 -1
  672. package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
  673. package/build-types/custom-select-control/stories/index.story.d.ts +3 -3
  674. package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
  675. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  676. package/build-types/custom-select-control-v2/stories/index.story.d.ts +3 -3
  677. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  678. package/build-types/date-time/date/index.d.ts.map +1 -1
  679. package/build-types/date-time/stories/time.story.d.ts +1 -1
  680. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  681. package/build-types/date-time/time/styles.d.ts +4 -4
  682. package/build-types/dimension-control/index.d.ts.map +1 -1
  683. package/build-types/dimension-control/stories/index.story.d.ts +1 -1
  684. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  685. package/build-types/drop-zone/stories/index.story.d.ts +1 -1
  686. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  687. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +1 -1
  688. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts.map +1 -1
  689. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts +3 -3
  690. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
  691. package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
  692. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  693. package/build-types/font-size-picker/styles.d.ts.map +1 -1
  694. package/build-types/form-file-upload/stories/index.story.d.ts +5 -5
  695. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  696. package/build-types/gradient-picker/stories/index.story.d.ts +3 -3
  697. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  698. package/build-types/guide/stories/index.story.d.ts +1 -1
  699. package/build-types/guide/stories/index.story.d.ts.map +1 -1
  700. package/build-types/icon/stories/index.story.d.ts +4 -4
  701. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  702. package/build-types/input-control/index.d.ts +1 -0
  703. package/build-types/input-control/index.d.ts.map +1 -1
  704. package/build-types/input-control/stories/index.story.d.ts +7 -7
  705. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  706. package/build-types/input-control/types.d.ts +11 -2
  707. package/build-types/input-control/types.d.ts.map +1 -1
  708. package/build-types/keyboard-shortcuts/stories/index.story.d.ts +1 -1
  709. package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
  710. package/build-types/menu/checkbox-item.d.ts.map +1 -1
  711. package/build-types/menu/index.d.ts +10 -1
  712. package/build-types/menu/index.d.ts.map +1 -1
  713. package/build-types/menu/item.d.ts.map +1 -1
  714. package/build-types/menu/popover.d.ts +3 -0
  715. package/build-types/menu/popover.d.ts.map +1 -0
  716. package/build-types/menu/radio-item.d.ts.map +1 -1
  717. package/build-types/menu/stories/index.story.d.ts +9 -9
  718. package/build-types/menu/stories/index.story.d.ts.map +1 -1
  719. package/build-types/menu/submenu-trigger-item.d.ts +3 -0
  720. package/build-types/menu/submenu-trigger-item.d.ts.map +1 -0
  721. package/build-types/menu/trigger-button.d.ts +3 -0
  722. package/build-types/menu/trigger-button.d.ts.map +1 -0
  723. package/build-types/menu/types.d.ts +208 -57
  724. package/build-types/menu/types.d.ts.map +1 -1
  725. package/build-types/menu-group/stories/index.story.d.ts +1 -1
  726. package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
  727. package/build-types/menu-item/stories/index.story.d.ts +4 -4
  728. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  729. package/build-types/navigation/back-button/index.d.ts.map +1 -1
  730. package/build-types/navigation/index.d.ts.map +1 -1
  731. package/build-types/navigation/item/index.d.ts.map +1 -1
  732. package/build-types/navigation/stories/index.story.d.ts +6 -6
  733. package/build-types/navigation/stories/index.story.d.ts.map +1 -1
  734. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
  735. package/build-types/notice/stories/index.story.d.ts +4 -4
  736. package/build-types/notice/stories/index.story.d.ts.map +1 -1
  737. package/build-types/number-control/index.d.ts +1 -1
  738. package/build-types/number-control/index.d.ts.map +1 -1
  739. package/build-types/number-control/stories/index.story.d.ts +2 -2
  740. package/build-types/palette-edit/index.d.ts.map +1 -1
  741. package/build-types/palette-edit/stories/index.story.d.ts +2 -2
  742. package/build-types/palette-edit/stories/index.story.d.ts.map +1 -1
  743. package/build-types/private-apis.d.ts.map +1 -1
  744. package/build-types/progress-bar/stories/index.story.d.ts +1 -1
  745. package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
  746. package/build-types/query-controls/stories/index.story.d.ts +1 -1
  747. package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
  748. package/build-types/radio-group/index.d.ts.map +1 -1
  749. package/build-types/radio-group/radio.d.ts.map +1 -1
  750. package/build-types/range-control/index.d.ts +1 -1
  751. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  752. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  753. package/build-types/resizable-box/stories/index.story.d.ts +2 -2
  754. package/build-types/responsive-wrapper/stories/index.story.d.ts +1 -1
  755. package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
  756. package/build-types/sandbox/stories/index.story.d.ts +1 -1
  757. package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
  758. package/build-types/search-control/stories/index.story.d.ts +1 -1
  759. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  760. package/build-types/select-control/index.d.ts +1 -0
  761. package/build-types/select-control/index.d.ts.map +1 -1
  762. package/build-types/select-control/stories/index.story.d.ts +5 -5
  763. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  764. package/build-types/select-control/types.d.ts +1 -1
  765. package/build-types/select-control/types.d.ts.map +1 -1
  766. package/build-types/shortcut/stories/index.story.d.ts +1 -1
  767. package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
  768. package/build-types/slot-fill/context.d.ts.map +1 -1
  769. package/build-types/slot-fill/fill.d.ts.map +1 -1
  770. package/build-types/slot-fill/provider.d.ts.map +1 -1
  771. package/build-types/slot-fill/slot.d.ts.map +1 -1
  772. package/build-types/slot-fill/types.d.ts +13 -11
  773. package/build-types/slot-fill/types.d.ts.map +1 -1
  774. package/build-types/tab-panel/index.d.ts.map +1 -1
  775. package/build-types/tab-panel/stories/index.story.d.ts +4 -4
  776. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  777. package/build-types/tabs/index.d.ts +21 -4
  778. package/build-types/tabs/index.d.ts.map +1 -1
  779. package/build-types/tabs/stories/index.story.d.ts +10 -10
  780. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  781. package/build-types/tabs/types.d.ts +13 -13
  782. package/build-types/tabs/types.d.ts.map +1 -1
  783. package/build-types/text/stories/index.story.d.ts +3 -3
  784. package/build-types/theme/stories/index.story.d.ts +1 -1
  785. package/build-types/toggle-control/stories/index.story.d.ts +2 -2
  786. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  787. package/build-types/toolbar/stories/index.story.d.ts +3 -3
  788. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  789. package/build-types/tooltip/index.d.ts.map +1 -1
  790. package/build-types/tooltip/stories/index.story.d.ts +1 -1
  791. package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
  792. package/build-types/tree-grid/stories/index.story.d.ts +1 -1
  793. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  794. package/build-types/tree-select/index.d.ts +3 -2
  795. package/build-types/tree-select/index.d.ts.map +1 -1
  796. package/build-types/tree-select/stories/index.story.d.ts +1 -1
  797. package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
  798. package/build-types/tree-select/types.d.ts +5 -1
  799. package/build-types/tree-select/types.d.ts.map +1 -1
  800. package/build-types/unit-control/index.d.ts +1 -1
  801. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  802. package/build-types/utils/colors-values.d.ts +3 -0
  803. package/build-types/utils/colors-values.d.ts.map +1 -1
  804. package/build-types/utils/config-values.d.ts +0 -1
  805. package/build-types/v-stack/stories/index.story.d.ts +1 -1
  806. package/package.json +19 -19
  807. package/src/alignment-matrix-control/README.md +16 -15
  808. package/src/angle-picker-control/README.md +10 -9
  809. package/src/badge/README.md +24 -0
  810. package/src/badge/docs-manifest.json +5 -0
  811. package/src/badge/index.tsx +67 -0
  812. package/src/badge/stories/index.story.tsx +54 -0
  813. package/src/badge/styles.scss +49 -0
  814. package/src/badge/test/index.tsx +45 -0
  815. package/src/badge/types.ts +12 -0
  816. package/src/base-control/README.md +22 -21
  817. package/src/box-control/README.md +41 -24
  818. package/src/box-control/index.tsx +28 -14
  819. package/src/box-control/input-control.tsx +299 -0
  820. package/src/box-control/stories/index.story.tsx +12 -0
  821. package/src/box-control/types.ts +27 -1
  822. package/src/box-control/utils.ts +122 -60
  823. package/src/button/README.md +110 -220
  824. package/src/button/docs-manifest.json +5 -0
  825. package/src/button/stories/best-practices.mdx +31 -0
  826. package/src/button/stories/index.story.tsx +18 -0
  827. package/src/button/style.scss +9 -10
  828. package/src/button/test/index.tsx +9 -2
  829. package/src/button/types.ts +6 -4
  830. package/src/button-group/README.md +4 -0
  831. package/src/button-group/index.tsx +11 -1
  832. package/src/button-group/stories/index.story.tsx +8 -1
  833. package/src/button-group/types.ts +7 -0
  834. package/src/custom-select-control/index.tsx +1 -1
  835. package/src/custom-select-control-v2/custom-select.tsx +1 -2
  836. package/src/custom-select-control-v2/stories/index.story.tsx +4 -0
  837. package/src/date-time/date/index.tsx +1 -0
  838. package/src/dimension-control/index.tsx +1 -0
  839. package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
  840. package/src/disabled/stories/index.story.tsx +1 -0
  841. package/src/drop-zone/stories/index.story.tsx +7 -1
  842. package/src/font-size-picker/styles.ts +1 -0
  843. package/src/form-file-upload/README.md +22 -21
  844. package/src/gradient-picker/README.md +36 -35
  845. package/src/heading/hook.ts +1 -1
  846. package/src/heading/test/__snapshots__/index.tsx.snap +4 -4
  847. package/src/icon/README.md +9 -8
  848. package/src/input-control/README.md +1 -0
  849. package/src/input-control/index.tsx +10 -0
  850. package/src/input-control/stories/index.story.tsx +6 -1
  851. package/src/input-control/test/index.js +9 -3
  852. package/src/input-control/types.ts +11 -2
  853. package/src/menu/checkbox-item.tsx +2 -1
  854. package/src/menu/index.tsx +61 -165
  855. package/src/menu/item.tsx +17 -2
  856. package/src/menu/popover.tsx +103 -0
  857. package/src/menu/radio-item.tsx +2 -1
  858. package/src/menu/stories/index.story.tsx +533 -381
  859. package/src/menu/styles.ts +1 -1
  860. package/src/menu/submenu-trigger-item.tsx +61 -0
  861. package/src/menu/test/index.tsx +266 -182
  862. package/src/menu/trigger-button.tsx +46 -0
  863. package/src/menu/types.ts +210 -63
  864. package/src/modal/stories/index.story.tsx +4 -1
  865. package/src/navigation/back-button/index.tsx +1 -0
  866. package/src/navigation/index.tsx +7 -0
  867. package/src/navigation/item/index.tsx +2 -0
  868. package/src/navigation/styles/navigation-styles.tsx +3 -2
  869. package/src/navigation/test/index.tsx +4 -0
  870. package/src/navigator/test/index.tsx +4 -0
  871. package/src/number-control/index.tsx +1 -0
  872. package/src/palette-edit/index.tsx +1 -0
  873. package/src/panel/stories/index.story.tsx +3 -3
  874. package/src/private-apis.ts +2 -0
  875. package/src/radio-group/index.tsx +12 -1
  876. package/src/radio-group/radio.tsx +1 -2
  877. package/src/range-control/styles/range-control-styles.ts +8 -4
  878. package/src/select-control/README.md +3 -0
  879. package/src/select-control/index.tsx +10 -0
  880. package/src/select-control/stories/index.story.tsx +2 -0
  881. package/src/select-control/test/select-control.tsx +7 -1
  882. package/src/select-control/types.ts +1 -0
  883. package/src/slot-fill/context.ts +5 -3
  884. package/src/slot-fill/fill.ts +10 -15
  885. package/src/slot-fill/provider.tsx +63 -64
  886. package/src/slot-fill/slot.tsx +40 -27
  887. package/src/slot-fill/types.ts +23 -11
  888. package/src/style.scss +1 -0
  889. package/src/tab-panel/index.tsx +1 -2
  890. package/src/tab-panel/stories/index.story.tsx +4 -0
  891. package/src/tabs/README.md +151 -187
  892. package/src/tabs/docs-manifest.json +22 -0
  893. package/src/tabs/index.tsx +21 -4
  894. package/src/tabs/stories/best-practices.mdx +99 -0
  895. package/src/tabs/stories/index.story.tsx +5 -0
  896. package/src/tabs/types.ts +13 -14
  897. package/src/text/hook.ts +2 -2
  898. package/src/text/styles.ts +1 -1
  899. package/src/text/test/__snapshots__/index.tsx.snap +3 -3
  900. package/src/text/test/index.tsx +1 -1
  901. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +24 -24
  902. package/src/toggle-group-control/test/index.tsx +7 -1
  903. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +1 -2
  904. package/src/toggle-group-control/toggle-group-control/styles.ts +1 -1
  905. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +6 -6
  906. package/src/tooltip/index.tsx +1 -2
  907. package/src/tree-grid/stories/index.story.tsx +2 -0
  908. package/src/tree-select/README.md +144 -28
  909. package/src/tree-select/docs-manifest.json +5 -0
  910. package/src/tree-select/index.tsx +11 -2
  911. package/src/tree-select/stories/index.story.tsx +1 -0
  912. package/src/tree-select/types.ts +8 -1
  913. package/src/utils/colors-values.js +3 -0
  914. package/src/utils/config-values.js +0 -1
  915. package/tsconfig.json +0 -3
  916. package/tsconfig.tsbuildinfo +1 -1
  917. package/build/box-control/all-input-control.js +0 -91
  918. package/build/box-control/all-input-control.js.map +0 -1
  919. package/build/box-control/axial-input-controls.js +0 -125
  920. package/build/box-control/axial-input-controls.js.map +0 -1
  921. package/build/box-control/input-controls.js +0 -133
  922. package/build/box-control/input-controls.js.map +0 -1
  923. package/build/slot-fill/use-slot.js +0 -32
  924. package/build/slot-fill/use-slot.js.map +0 -1
  925. package/build-module/box-control/all-input-control.js +0 -84
  926. package/build-module/box-control/all-input-control.js.map +0 -1
  927. package/build-module/box-control/axial-input-controls.js +0 -116
  928. package/build-module/box-control/axial-input-controls.js.map +0 -1
  929. package/build-module/box-control/input-controls.js +0 -124
  930. package/build-module/box-control/input-controls.js.map +0 -1
  931. package/build-module/slot-fill/use-slot.js +0 -24
  932. package/build-module/slot-fill/use-slot.js.map +0 -1
  933. package/build-types/box-control/all-input-control.d.ts +0 -3
  934. package/build-types/box-control/all-input-control.d.ts.map +0 -1
  935. package/build-types/box-control/axial-input-controls.d.ts +0 -3
  936. package/build-types/box-control/axial-input-controls.d.ts.map +0 -1
  937. package/build-types/box-control/input-controls.d.ts +0 -3
  938. package/build-types/box-control/input-controls.d.ts.map +0 -1
  939. package/build-types/slot-fill/use-slot.d.ts +0 -10
  940. package/build-types/slot-fill/use-slot.d.ts.map +0 -1
  941. package/src/box-control/all-input-control.tsx +0 -110
  942. package/src/box-control/axial-input-controls.tsx +0 -165
  943. package/src/box-control/input-controls.tsx +0 -167
  944. package/src/slot-fill/use-slot.ts +0 -27
@@ -1 +1 @@
1
- {"version":3,"names":["startOfMinute","format","set","setMonth","useState","useMemo","useEffect","__","BaseControl","VisuallyHidden","SelectControl","TimeZone","Wrapper","Fieldset","MonthSelectWrapper","DayInput","YearInput","HStack","Spacer","inputToDate","buildPadInputStateReducer","validateInputElementTarget","TIMEZONELESS_FORMAT","TimeInput","jsx","_jsx","jsxs","_jsxs","VALID_DATE_ORDERS","TimePicker","is12Hour","currentTime","onChange","dateOrder","dateOrderProp","hideLabelFromVision","date","setDate","Date","monthOptions","value","label","day","month","year","minutes","hours","am","buildNumberControlChangeCallback","method","callback","event","numberValue","Number","newDate","onTimeInputChangeCallback","newHours","newMinutes","dayField","className","__next40pxDefaultSize","step","min","max","required","spinControls","isPressEnterToChange","isDragEnabled","isShiftStepEnabled","monthField","children","__nextHasNoMarginBottom","options","yearField","__unstableStateReducer","defaultDateOrder","includes","fields","split","map","field","as","VisualLabel","Object","assign","displayName"],"sources":["@wordpress/components/src/date-time/time/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { startOfMinute, format, set, setMonth } from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../../base-control';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport SelectControl from '../../select-control';\nimport TimeZone from './timezone';\nimport type { TimeInputValue, TimePickerProps } from '../types';\nimport {\n\tWrapper,\n\tFieldset,\n\tMonthSelectWrapper,\n\tDayInput,\n\tYearInput,\n} from './styles';\nimport { HStack } from '../../h-stack';\nimport { Spacer } from '../../spacer';\nimport type { InputChangeCallback } from '../../input-control/types';\nimport {\n\tinputToDate,\n\tbuildPadInputStateReducer,\n\tvalidateInputElementTarget,\n} from '../utils';\nimport { TIMEZONELESS_FORMAT } from '../constants';\nimport { TimeInput } from './time-input';\n\nconst VALID_DATE_ORDERS = [ 'dmy', 'mdy', 'ymd' ];\n\n/**\n * TimePicker is a React component that renders a clock for time selection.\n *\n * ```jsx\n * import { TimePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTimePicker = () => {\n * const [ time, setTime ] = useState( new Date() );\n *\n * return (\n * <TimePicker\n * currentTime={ date }\n * onChange={ ( newTime ) => setTime( newTime ) }\n * is12Hour\n * />\n * );\n * };\n * ```\n */\nexport function TimePicker( {\n\tis12Hour,\n\tcurrentTime,\n\tonChange,\n\tdateOrder: dateOrderProp,\n\thideLabelFromVision = false,\n}: TimePickerProps ) {\n\tconst [ date, setDate ] = useState( () =>\n\t\t// Truncate the date at the minutes, see: #15495.\n\t\tcurrentTime ? startOfMinute( inputToDate( currentTime ) ) : new Date()\n\t);\n\n\t// Reset the state when currentTime changed.\n\t// TODO: useEffect() shouldn't be used like this, causes an unnecessary render\n\tuseEffect( () => {\n\t\tsetDate(\n\t\t\tcurrentTime\n\t\t\t\t? startOfMinute( inputToDate( currentTime ) )\n\t\t\t\t: new Date()\n\t\t);\n\t}, [ currentTime ] );\n\n\tconst monthOptions = [\n\t\t{ value: '01', label: __( 'January' ) },\n\t\t{ value: '02', label: __( 'February' ) },\n\t\t{ value: '03', label: __( 'March' ) },\n\t\t{ value: '04', label: __( 'April' ) },\n\t\t{ value: '05', label: __( 'May' ) },\n\t\t{ value: '06', label: __( 'June' ) },\n\t\t{ value: '07', label: __( 'July' ) },\n\t\t{ value: '08', label: __( 'August' ) },\n\t\t{ value: '09', label: __( 'September' ) },\n\t\t{ value: '10', label: __( 'October' ) },\n\t\t{ value: '11', label: __( 'November' ) },\n\t\t{ value: '12', label: __( 'December' ) },\n\t] as const;\n\n\tconst { day, month, year, minutes, hours } = useMemo(\n\t\t() => ( {\n\t\t\tday: format( date, 'dd' ),\n\t\t\tmonth: format(\n\t\t\t\tdate,\n\t\t\t\t'MM'\n\t\t\t) as ( typeof monthOptions )[ number ][ 'value' ],\n\t\t\tyear: format( date, 'yyyy' ),\n\t\t\tminutes: format( date, 'mm' ),\n\t\t\thours: format( date, 'HH' ),\n\t\t\tam: format( date, 'a' ),\n\t\t} ),\n\t\t[ date ]\n\t);\n\n\tconst buildNumberControlChangeCallback = ( method: 'date' | 'year' ) => {\n\t\tconst callback: InputChangeCallback = ( value, { event } ) => {\n\t\t\tif ( ! validateInputElementTarget( event ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// We can safely assume value is a number if target is valid.\n\t\t\tconst numberValue = Number( value );\n\n\t\t\tconst newDate = set( date, { [ method ]: numberValue } );\n\t\t\tsetDate( newDate );\n\t\t\tonChange?.( format( newDate, TIMEZONELESS_FORMAT ) );\n\t\t};\n\t\treturn callback;\n\t};\n\n\tconst onTimeInputChangeCallback = ( {\n\t\thours: newHours,\n\t\tminutes: newMinutes,\n\t}: TimeInputValue ) => {\n\t\tconst newDate = set( date, {\n\t\t\thours: newHours,\n\t\t\tminutes: newMinutes,\n\t\t} );\n\t\tsetDate( newDate );\n\t\tonChange?.( format( newDate, TIMEZONELESS_FORMAT ) );\n\t};\n\n\tconst dayField = (\n\t\t<DayInput\n\t\t\tkey=\"day\"\n\t\t\tclassName=\"components-datetime__time-field components-datetime__time-field-day\" // Unused, for backwards compatibility.\n\t\t\tlabel={ __( 'Day' ) }\n\t\t\thideLabelFromVision\n\t\t\t__next40pxDefaultSize\n\t\t\tvalue={ day }\n\t\t\tstep={ 1 }\n\t\t\tmin={ 1 }\n\t\t\tmax={ 31 }\n\t\t\trequired\n\t\t\tspinControls=\"none\"\n\t\t\tisPressEnterToChange\n\t\t\tisDragEnabled={ false }\n\t\t\tisShiftStepEnabled={ false }\n\t\t\tonChange={ buildNumberControlChangeCallback( 'date' ) }\n\t\t/>\n\t);\n\n\tconst monthField = (\n\t\t<MonthSelectWrapper key=\"month\">\n\t\t\t<SelectControl\n\t\t\t\tclassName=\"components-datetime__time-field components-datetime__time-field-month\" // Unused, for backwards compatibility.\n\t\t\t\tlabel={ __( 'Month' ) }\n\t\t\t\thideLabelFromVision\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={ month }\n\t\t\t\toptions={ monthOptions }\n\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\tconst newDate = setMonth( date, Number( value ) - 1 );\n\t\t\t\t\tsetDate( newDate );\n\t\t\t\t\tonChange?.( format( newDate, TIMEZONELESS_FORMAT ) );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</MonthSelectWrapper>\n\t);\n\n\tconst yearField = (\n\t\t<YearInput\n\t\t\tkey=\"year\"\n\t\t\tclassName=\"components-datetime__time-field components-datetime__time-field-year\" // Unused, for backwards compatibility.\n\t\t\tlabel={ __( 'Year' ) }\n\t\t\thideLabelFromVision\n\t\t\t__next40pxDefaultSize\n\t\t\tvalue={ year }\n\t\t\tstep={ 1 }\n\t\t\tmin={ 1 }\n\t\t\tmax={ 9999 }\n\t\t\trequired\n\t\t\tspinControls=\"none\"\n\t\t\tisPressEnterToChange\n\t\t\tisDragEnabled={ false }\n\t\t\tisShiftStepEnabled={ false }\n\t\t\tonChange={ buildNumberControlChangeCallback( 'year' ) }\n\t\t\t__unstableStateReducer={ buildPadInputStateReducer( 4 ) }\n\t\t/>\n\t);\n\n\tconst defaultDateOrder = is12Hour ? 'mdy' : 'dmy';\n\tconst dateOrder =\n\t\tdateOrderProp && VALID_DATE_ORDERS.includes( dateOrderProp )\n\t\t\t? dateOrderProp\n\t\t\t: defaultDateOrder;\n\n\tconst fields = dateOrder.split( '' ).map( ( field ) => {\n\t\tswitch ( field ) {\n\t\t\tcase 'd':\n\t\t\t\treturn dayField;\n\t\t\tcase 'm':\n\t\t\t\treturn monthField;\n\t\t\tcase 'y':\n\t\t\t\treturn yearField;\n\t\t\tdefault:\n\t\t\t\treturn null;\n\t\t}\n\t} );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tclassName=\"components-datetime__time\" // Unused, for backwards compatibility.\n\t\t>\n\t\t\t<Fieldset>\n\t\t\t\t{ hideLabelFromVision ? (\n\t\t\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t\t\t{ __( 'Time' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) : (\n\t\t\t\t\t<BaseControl.VisualLabel\n\t\t\t\t\t\tas=\"legend\"\n\t\t\t\t\t\tclassName=\"components-datetime__time-legend\" // Unused, for backwards compatibility.\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Time' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t) }\n\t\t\t\t<HStack\n\t\t\t\t\tclassName=\"components-datetime__time-wrapper\" // Unused, for backwards compatibility.\n\t\t\t\t>\n\t\t\t\t\t<TimeInput\n\t\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t\thours: Number( hours ),\n\t\t\t\t\t\t\tminutes: Number( minutes ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tis12Hour={ is12Hour }\n\t\t\t\t\t\tonChange={ onTimeInputChangeCallback }\n\t\t\t\t\t/>\n\t\t\t\t\t<Spacer />\n\t\t\t\t\t<TimeZone />\n\t\t\t\t</HStack>\n\t\t\t</Fieldset>\n\t\t\t<Fieldset>\n\t\t\t\t{ hideLabelFromVision ? (\n\t\t\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t\t\t{ __( 'Date' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) : (\n\t\t\t\t\t<BaseControl.VisualLabel\n\t\t\t\t\t\tas=\"legend\"\n\t\t\t\t\t\tclassName=\"components-datetime__time-legend\" // Unused, for backwards compatibility.\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Date' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t) }\n\t\t\t\t<HStack\n\t\t\t\t\tclassName=\"components-datetime__time-wrapper\" // Unused, for backwards compatibility.\n\t\t\t\t>\n\t\t\t\t\t{ fields }\n\t\t\t\t</HStack>\n\t\t\t</Fieldset>\n\t\t</Wrapper>\n\t);\n}\n\n/**\n * A component to input a time.\n *\n * Values are passed as an object in 24-hour format (`{ hours: number, minutes: number }`).\n *\n * ```jsx\n * import { TimePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTimeInput = () => {\n * \tconst [ time, setTime ] = useState( { hours: 13, minutes: 30 } );\n *\n * \treturn (\n * \t\t<TimePicker.TimeInput\n * \t\t\tvalue={ time }\n * \t\t\tonChange={ setTime }\n * \t\t\tlabel=\"Time\"\n * \t\t/>\n * \t);\n * };\n * ```\n */\nTimePicker.TimeInput = TimeInput;\nObject.assign( TimePicker.TimeInput, { displayName: 'TimePicker.TimeInput' } );\n\nexport default TimePicker;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,MAAM,EAAEC,GAAG,EAAEC,QAAQ,QAAQ,UAAU;;AAE/D;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,WAAW,MAAM,oBAAoB;AAC5C,SAASC,cAAc,QAAQ,uBAAuB;AACtD,OAAOC,aAAa,MAAM,sBAAsB;AAChD,OAAOC,QAAQ,MAAM,YAAY;AAEjC,SACCC,OAAO,EACPC,QAAQ,EACRC,kBAAkB,EAClBC,QAAQ,EACRC,SAAS,QACH,UAAU;AACjB,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,MAAM,QAAQ,cAAc;AAErC,SACCC,WAAW,EACXC,yBAAyB,EACzBC,0BAA0B,QACpB,UAAU;AACjB,SAASC,mBAAmB,QAAQ,cAAc;AAClD,SAASC,SAAS,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEzC,MAAMC,iBAAiB,GAAG,CAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAE;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAE;EAC3BC,QA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAhD,UAAU,CAACN,SAAS,GAAGA,SAAS;AAChC4D,MAAM,CAACC,MAAM,CAAEvD,UAAU,CAACN,SAAS,EAAE;EAAE8D,WAAW,EAAE;AAAuB,CAAE,CAAC;AAE9E,eAAexD,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["startOfMinute","format","set","setMonth","useState","useMemo","useEffect","__","BaseControl","VisuallyHidden","SelectControl","TimeZone","Wrapper","Fieldset","MonthSelectWrapper","DayInput","YearInput","HStack","Spacer","inputToDate","buildPadInputStateReducer","validateInputElementTarget","TIMEZONELESS_FORMAT","TimeInput","jsx","_jsx","jsxs","_jsxs","VALID_DATE_ORDERS","TimePicker","is12Hour","currentTime","onChange","dateOrder","dateOrderProp","hideLabelFromVision","date","setDate","Date","monthOptions","value","label","day","month","year","minutes","hours","am","buildNumberControlChangeCallback","method","callback","event","numberValue","Number","newDate","onTimeInputChangeCallback","newHours","newMinutes","dayField","className","__next40pxDefaultSize","step","min","max","required","spinControls","isPressEnterToChange","isDragEnabled","isShiftStepEnabled","monthField","children","__nextHasNoMarginBottom","options","yearField","__unstableStateReducer","defaultDateOrder","includes","fields","split","map","field","as","VisualLabel","Object","assign","displayName"],"sources":["@wordpress/components/src/date-time/time/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { startOfMinute, format, set, setMonth } from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../../base-control';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport SelectControl from '../../select-control';\nimport TimeZone from './timezone';\nimport type { TimeInputValue, TimePickerProps } from '../types';\nimport {\n\tWrapper,\n\tFieldset,\n\tMonthSelectWrapper,\n\tDayInput,\n\tYearInput,\n} from './styles';\nimport { HStack } from '../../h-stack';\nimport { Spacer } from '../../spacer';\nimport type { InputChangeCallback } from '../../input-control/types';\nimport {\n\tinputToDate,\n\tbuildPadInputStateReducer,\n\tvalidateInputElementTarget,\n} from '../utils';\nimport { TIMEZONELESS_FORMAT } from '../constants';\nimport { TimeInput } from './time-input';\n\nconst VALID_DATE_ORDERS = [ 'dmy', 'mdy', 'ymd' ];\n\n/**\n * TimePicker is a React component that renders a clock for time selection.\n *\n * ```jsx\n * import { TimePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTimePicker = () => {\n * const [ time, setTime ] = useState( new Date() );\n *\n * return (\n * <TimePicker\n * currentTime={ date }\n * onChange={ ( newTime ) => setTime( newTime ) }\n * is12Hour\n * />\n * );\n * };\n * ```\n */\nexport function TimePicker( {\n\tis12Hour,\n\tcurrentTime,\n\tonChange,\n\tdateOrder: dateOrderProp,\n\thideLabelFromVision = false,\n}: TimePickerProps ) {\n\tconst [ date, setDate ] = useState( () =>\n\t\t// Truncate the date at the minutes, see: #15495.\n\t\tcurrentTime ? startOfMinute( inputToDate( currentTime ) ) : new Date()\n\t);\n\n\t// Reset the state when currentTime changed.\n\t// TODO: useEffect() shouldn't be used like this, causes an unnecessary render\n\tuseEffect( () => {\n\t\tsetDate(\n\t\t\tcurrentTime\n\t\t\t\t? startOfMinute( inputToDate( currentTime ) )\n\t\t\t\t: new Date()\n\t\t);\n\t}, [ currentTime ] );\n\n\tconst monthOptions = [\n\t\t{ value: '01', label: __( 'January' ) },\n\t\t{ value: '02', label: __( 'February' ) },\n\t\t{ value: '03', label: __( 'March' ) },\n\t\t{ value: '04', label: __( 'April' ) },\n\t\t{ value: '05', label: __( 'May' ) },\n\t\t{ value: '06', label: __( 'June' ) },\n\t\t{ value: '07', label: __( 'July' ) },\n\t\t{ value: '08', label: __( 'August' ) },\n\t\t{ value: '09', label: __( 'September' ) },\n\t\t{ value: '10', label: __( 'October' ) },\n\t\t{ value: '11', label: __( 'November' ) },\n\t\t{ value: '12', label: __( 'December' ) },\n\t] as const;\n\n\tconst { day, month, year, minutes, hours } = useMemo(\n\t\t() => ( {\n\t\t\tday: format( date, 'dd' ),\n\t\t\tmonth: format(\n\t\t\t\tdate,\n\t\t\t\t'MM'\n\t\t\t) as ( typeof monthOptions )[ number ][ 'value' ],\n\t\t\tyear: format( date, 'yyyy' ),\n\t\t\tminutes: format( date, 'mm' ),\n\t\t\thours: format( date, 'HH' ),\n\t\t\tam: format( date, 'a' ),\n\t\t} ),\n\t\t[ date ]\n\t);\n\n\tconst buildNumberControlChangeCallback = ( method: 'date' | 'year' ) => {\n\t\tconst callback: InputChangeCallback = ( value, { event } ) => {\n\t\t\tif ( ! validateInputElementTarget( event ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// We can safely assume value is a number if target is valid.\n\t\t\tconst numberValue = Number( value );\n\n\t\t\tconst newDate = set( date, { [ method ]: numberValue } );\n\t\t\tsetDate( newDate );\n\t\t\tonChange?.( format( newDate, TIMEZONELESS_FORMAT ) );\n\t\t};\n\t\treturn callback;\n\t};\n\n\tconst onTimeInputChangeCallback = ( {\n\t\thours: newHours,\n\t\tminutes: newMinutes,\n\t}: TimeInputValue ) => {\n\t\tconst newDate = set( date, {\n\t\t\thours: newHours,\n\t\t\tminutes: newMinutes,\n\t\t} );\n\t\tsetDate( newDate );\n\t\tonChange?.( format( newDate, TIMEZONELESS_FORMAT ) );\n\t};\n\n\tconst dayField = (\n\t\t<DayInput\n\t\t\tkey=\"day\"\n\t\t\tclassName=\"components-datetime__time-field components-datetime__time-field-day\" // Unused, for backwards compatibility.\n\t\t\tlabel={ __( 'Day' ) }\n\t\t\thideLabelFromVision\n\t\t\t__next40pxDefaultSize\n\t\t\tvalue={ day }\n\t\t\tstep={ 1 }\n\t\t\tmin={ 1 }\n\t\t\tmax={ 31 }\n\t\t\trequired\n\t\t\tspinControls=\"none\"\n\t\t\tisPressEnterToChange\n\t\t\tisDragEnabled={ false }\n\t\t\tisShiftStepEnabled={ false }\n\t\t\tonChange={ buildNumberControlChangeCallback( 'date' ) }\n\t\t/>\n\t);\n\n\tconst monthField = (\n\t\t<MonthSelectWrapper key=\"month\">\n\t\t\t<SelectControl\n\t\t\t\tclassName=\"components-datetime__time-field components-datetime__time-field-month\" // Unused, for backwards compatibility.\n\t\t\t\tlabel={ __( 'Month' ) }\n\t\t\t\thideLabelFromVision\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={ month }\n\t\t\t\toptions={ monthOptions }\n\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\tconst newDate = setMonth( date, Number( value ) - 1 );\n\t\t\t\t\tsetDate( newDate );\n\t\t\t\t\tonChange?.( format( newDate, TIMEZONELESS_FORMAT ) );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</MonthSelectWrapper>\n\t);\n\n\tconst yearField = (\n\t\t<YearInput\n\t\t\tkey=\"year\"\n\t\t\tclassName=\"components-datetime__time-field components-datetime__time-field-year\" // Unused, for backwards compatibility.\n\t\t\tlabel={ __( 'Year' ) }\n\t\t\thideLabelFromVision\n\t\t\t__next40pxDefaultSize\n\t\t\tvalue={ year }\n\t\t\tstep={ 1 }\n\t\t\tmin={ 1 }\n\t\t\tmax={ 9999 }\n\t\t\trequired\n\t\t\tspinControls=\"none\"\n\t\t\tisPressEnterToChange\n\t\t\tisDragEnabled={ false }\n\t\t\tisShiftStepEnabled={ false }\n\t\t\tonChange={ buildNumberControlChangeCallback( 'year' ) }\n\t\t\t__unstableStateReducer={ buildPadInputStateReducer( 4 ) }\n\t\t/>\n\t);\n\n\tconst defaultDateOrder = is12Hour ? 'mdy' : 'dmy';\n\tconst dateOrder =\n\t\tdateOrderProp && VALID_DATE_ORDERS.includes( dateOrderProp )\n\t\t\t? dateOrderProp\n\t\t\t: defaultDateOrder;\n\n\tconst fields = dateOrder.split( '' ).map( ( field ) => {\n\t\tswitch ( field ) {\n\t\t\tcase 'd':\n\t\t\t\treturn dayField;\n\t\t\tcase 'm':\n\t\t\t\treturn monthField;\n\t\t\tcase 'y':\n\t\t\t\treturn yearField;\n\t\t\tdefault:\n\t\t\t\treturn null;\n\t\t}\n\t} );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tclassName=\"components-datetime__time\" // Unused, for backwards compatibility.\n\t\t>\n\t\t\t<Fieldset>\n\t\t\t\t{ hideLabelFromVision ? (\n\t\t\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t\t\t{ __( 'Time' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) : (\n\t\t\t\t\t<BaseControl.VisualLabel\n\t\t\t\t\t\tas=\"legend\"\n\t\t\t\t\t\tclassName=\"components-datetime__time-legend\" // Unused, for backwards compatibility.\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Time' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t) }\n\t\t\t\t<HStack\n\t\t\t\t\tclassName=\"components-datetime__time-wrapper\" // Unused, for backwards compatibility.\n\t\t\t\t>\n\t\t\t\t\t<TimeInput\n\t\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t\thours: Number( hours ),\n\t\t\t\t\t\t\tminutes: Number( minutes ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tis12Hour={ is12Hour }\n\t\t\t\t\t\tonChange={ onTimeInputChangeCallback }\n\t\t\t\t\t/>\n\t\t\t\t\t<Spacer />\n\t\t\t\t\t<TimeZone />\n\t\t\t\t</HStack>\n\t\t\t</Fieldset>\n\t\t\t<Fieldset>\n\t\t\t\t{ hideLabelFromVision ? (\n\t\t\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t\t\t{ __( 'Date' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) : (\n\t\t\t\t\t<BaseControl.VisualLabel\n\t\t\t\t\t\tas=\"legend\"\n\t\t\t\t\t\tclassName=\"components-datetime__time-legend\" // Unused, for backwards compatibility.\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Date' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t) }\n\t\t\t\t<HStack\n\t\t\t\t\tclassName=\"components-datetime__time-wrapper\" // Unused, for backwards compatibility.\n\t\t\t\t>\n\t\t\t\t\t{ fields }\n\t\t\t\t</HStack>\n\t\t\t</Fieldset>\n\t\t</Wrapper>\n\t);\n}\n\n/**\n * A component to input a time.\n *\n * Values are passed as an object in 24-hour format (`{ hours: number, minutes: number }`).\n *\n * ```jsx\n * import { TimePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTimeInput = () => {\n * \tconst [ time, setTime ] = useState( { hours: 13, minutes: 30 } );\n *\n * \treturn (\n * \t\t<TimePicker.TimeInput\n * \t\t\tvalue={ time }\n * \t\t\tonChange={ setTime }\n * \t\t\tlabel=\"Time\"\n * \t\t/>\n * \t);\n * };\n * ```\n */\nTimePicker.TimeInput = TimeInput;\nObject.assign( TimePicker.TimeInput, { displayName: 'TimePicker.TimeInput' } );\n\nexport default TimePicker;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,MAAM,EAAEC,GAAG,EAAEC,QAAQ,QAAQ,UAAU;;AAE/D;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,WAAW,MAAM,oBAAoB;AAC5C,SAASC,cAAc,QAAQ,uBAAuB;AACtD,OAAOC,aAAa,MAAM,sBAAsB;AAChD,OAAOC,QAAQ,MAAM,YAAY;AAEjC,SACCC,OAAO,EACPC,QAAQ,EACRC,kBAAkB,EAClBC,QAAQ,EACRC,SAAS,QACH,UAAU;AACjB,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,MAAM,QAAQ,cAAc;AAErC,SACCC,WAAW,EACXC,yBAAyB,EACzBC,0BAA0B,QACpB,UAAU;AACjB,SAASC,mBAAmB,QAAQ,cAAc;AAClD,SAASC,SAAS,QA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,kCAAkC,CAAC;QAAA;QAAAW,QAAA,EAE3C/D,EAAE,CAAE,MAAO;MAAC,CACU,CACzB,eACDkB,IAAA,CAACR,MAAM;QACN0C,SAAS,EAAC,mCAAmC,CAAC;QAAA;QAAAW,QAAA,EAE5CO;MAAM,CACD,CAAC;IAAA,CACA,CAAC;EAAA,CACH,CAAC;AAEZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAhD,UAAU,CAACN,SAAS,GAAGA,SAAS;AAChC4D,MAAM,CAACC,MAAM,CAAEvD,UAAU,CAACN,SAAS,EAAE;EAAE8D,WAAW,EAAE;AAAuB,CAAE,CAAC;AAE9E,eAAexD,UAAU","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -103,6 +104,7 @@ export function DimensionControl(props) {
103
104
  value: CONTEXT_VALUE,
104
105
  children: /*#__PURE__*/_jsx(SelectControl, {
105
106
  __next40pxDefaultSize: __next40pxDefaultSize,
107
+ __shouldNotWarnDeprecated36pxSize: true,
106
108
  __nextHasNoMarginBottom: __nextHasNoMarginBottom,
107
109
  className: clsx(className, 'block-editor-dimension-control'),
108
110
  label: selectLabel,
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","__","Icon","SelectControl","sizesTable","findSizeBySlug","ContextSystemProvider","deprecated","maybeWarnDeprecated36pxSize","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CONTEXT_VALUE","BaseControl","_overrides","__associatedWPComponentName","DimensionControl","props","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","sizes","icon","onChange","className","since","version","componentName","size","undefined","onChangeSpacingSize","val","theSize","slug","formatSizesAsOptions","theSizes","options","map","name","selectLabel","children","hideLabelFromVision"],"sources":["@wordpress/components/src/dimension-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Icon from '../icon';\nimport SelectControl from '../select-control';\nimport sizesTable, { findSizeBySlug } from './sizes';\nimport type { DimensionControlProps, Size } from './types';\nimport type { SelectControlSingleSelectionProps } from '../select-control/types';\nimport { ContextSystemProvider } from '../context';\nimport deprecated from '@wordpress/deprecated';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nconst CONTEXT_VALUE = {\n\tBaseControl: {\n\t\t// Temporary during deprecation grace period: Overrides the underlying `__associatedWPComponentName`\n\t\t// via the context system to override the value set by SelectControl.\n\t\t_overrides: { __associatedWPComponentName: 'DimensionControl' },\n\t},\n};\n\n/**\n * `DimensionControl` is a component designed to provide a UI to control spacing and/or dimensions.\n *\n * @deprecated\n *\n * ```jsx\n * import { __experimentalDimensionControl as DimensionControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * export default function MyCustomDimensionControl() {\n * \tconst [ paddingSize, setPaddingSize ] = useState( '' );\n *\n * \treturn (\n * \t\t<DimensionControl\n * \t\t\t__next40pxDefaultSize\n * \t\t\t__nextHasNoMarginBottom\n * \t\t\tlabel={ 'Padding' }\n * \t\t\ticon={ 'desktop' }\n * \t\t\tonChange={ ( value ) => setPaddingSize( value ) }\n * \t\t\tvalue={ paddingSize }\n * \t\t/>\n * \t);\n * }\n * ```\n */\nexport function DimensionControl( props: DimensionControlProps ) {\n\tconst {\n\t\t__next40pxDefaultSize = false,\n\t\t__nextHasNoMarginBottom = false,\n\t\tlabel,\n\t\tvalue,\n\t\tsizes = sizesTable,\n\t\ticon,\n\t\tonChange,\n\t\tclassName = '',\n\t} = props;\n\n\tdeprecated( 'wp.components.DimensionControl', {\n\t\tsince: '6.7',\n\t\tversion: '7.0',\n\t} );\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'DimensionControl',\n\t\t__next40pxDefaultSize,\n\t\tsize: undefined,\n\t} );\n\n\tconst onChangeSpacingSize: SelectControlSingleSelectionProps[ 'onChange' ] =\n\t\t( val ) => {\n\t\t\tconst theSize = findSizeBySlug( sizes, val );\n\n\t\t\tif ( ! theSize || value === theSize.slug ) {\n\t\t\t\tonChange?.( undefined );\n\t\t\t} else if ( typeof onChange === 'function' ) {\n\t\t\t\tonChange( theSize.slug );\n\t\t\t}\n\t\t};\n\n\tconst formatSizesAsOptions = ( theSizes: Size[] ) => {\n\t\tconst options = theSizes.map( ( { name, slug } ) => ( {\n\t\t\tlabel: name,\n\t\t\tvalue: slug,\n\t\t} ) );\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: __( 'Default' ),\n\t\t\t\tvalue: '',\n\t\t\t},\n\t\t\t...options,\n\t\t];\n\t};\n\n\tconst selectLabel = (\n\t\t<>\n\t\t\t{ icon && <Icon icon={ icon } /> }\n\t\t\t{ label }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<ContextSystemProvider value={ CONTEXT_VALUE }>\n\t\t\t<SelectControl\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'block-editor-dimension-control'\n\t\t\t\t) }\n\t\t\t\tlabel={ selectLabel }\n\t\t\t\thideLabelFromVision={ false }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeSpacingSize }\n\t\t\t\toptions={ formatSizesAsOptions( sizes ) }\n\t\t\t/>\n\t\t</ContextSystemProvider>\n\t);\n}\n\nexport default DimensionControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,UAAU,IAA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,MAAMC,oBAAoB,GAAKC,QAAgB,IAAM;IACpD,MAAMC,OAAO,GAAGD,QAAQ,CAACE,GAAG,CAAE,CAAE;MAAEC,IAAI;MAAEL;IAAK,CAAC,MAAQ;MACrDd,KAAK,EAAEmB,IAAI;MACXlB,KAAK,EAAEa;IACR,CAAC,CAAG,CAAC;IAEL,OAAO,CACN;MACCd,KAAK,EAAEtB,EAAE,CAAE,SAAU,CAAC;MACtBuB,KAAK,EAAE;IACR,CAAC,EACD,GAAGgB,OAAO,CACV;EACF,CAAC;EAED,MAAMG,WAAW,gBAChB7B,KAAA,CAAAF,SAAA;IAAAgC,QAAA,GACGlB,IAAI,iBAAIhB,IAAA,CAACR,IAAI;MAACwB,IAAI,EAAGA;IAAM,CAAE,CAAC,EAC9BH,KAAK;EAAA,CACN,CACF;EAED,oBACCb,IAAA,CAACJ,qBAAqB;IAACkB,KAAK,EAAGT,aAAe;IAAA6B,QAAA,eAC7ClC,IAAA,CAACP,aAAa;MACbkB,qBAAqB,EAAGA,qBAAuB;MAC/CC,uBAAuB,EAAGA,uBAAyB;MACnDM,SAAS,EAAG5B,IAAI,CACf4B,SAAS,EACT,gCACD,CAAG;MACHL,KAAK,EAAGoB,WAAa;MACrBE,mBAAmB,EAAG,KAAO;MAC7BrB,KAAK,EAAGA,KAAO;MACfG,QAAQ,EAAGO,mBAAqB;MAChCM,OAAO,EAAGF,oBAAoB,CAAEb,KAAM;IAAG,CACzC;EAAC,CACoB,CAAC;AAE1B;AAEA,eAAeN,gBAAgB","ignoreList":[]}
1
+ {"version":3,"names":["clsx","__","Icon","SelectControl","sizesTable","findSizeBySlug","ContextSystemProvider","deprecated","maybeWarnDeprecated36pxSize","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CONTEXT_VALUE","BaseControl","_overrides","__associatedWPComponentName","DimensionControl","props","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","sizes","icon","onChange","className","since","version","componentName","size","undefined","onChangeSpacingSize","val","theSize","slug","formatSizesAsOptions","theSizes","options","map","name","selectLabel","children","__shouldNotWarnDeprecated36pxSize","hideLabelFromVision"],"sources":["@wordpress/components/src/dimension-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Icon from '../icon';\nimport SelectControl from '../select-control';\nimport sizesTable, { findSizeBySlug } from './sizes';\nimport type { DimensionControlProps, Size } from './types';\nimport type { SelectControlSingleSelectionProps } from '../select-control/types';\nimport { ContextSystemProvider } from '../context';\nimport deprecated from '@wordpress/deprecated';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nconst CONTEXT_VALUE = {\n\tBaseControl: {\n\t\t// Temporary during deprecation grace period: Overrides the underlying `__associatedWPComponentName`\n\t\t// via the context system to override the value set by SelectControl.\n\t\t_overrides: { __associatedWPComponentName: 'DimensionControl' },\n\t},\n};\n\n/**\n * `DimensionControl` is a component designed to provide a UI to control spacing and/or dimensions.\n *\n * @deprecated\n *\n * ```jsx\n * import { __experimentalDimensionControl as DimensionControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * export default function MyCustomDimensionControl() {\n * \tconst [ paddingSize, setPaddingSize ] = useState( '' );\n *\n * \treturn (\n * \t\t<DimensionControl\n * \t\t\t__next40pxDefaultSize\n * \t\t\t__nextHasNoMarginBottom\n * \t\t\tlabel={ 'Padding' }\n * \t\t\ticon={ 'desktop' }\n * \t\t\tonChange={ ( value ) => setPaddingSize( value ) }\n * \t\t\tvalue={ paddingSize }\n * \t\t/>\n * \t);\n * }\n * ```\n */\nexport function DimensionControl( props: DimensionControlProps ) {\n\tconst {\n\t\t__next40pxDefaultSize = false,\n\t\t__nextHasNoMarginBottom = false,\n\t\tlabel,\n\t\tvalue,\n\t\tsizes = sizesTable,\n\t\ticon,\n\t\tonChange,\n\t\tclassName = '',\n\t} = props;\n\n\tdeprecated( 'wp.components.DimensionControl', {\n\t\tsince: '6.7',\n\t\tversion: '7.0',\n\t} );\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'DimensionControl',\n\t\t__next40pxDefaultSize,\n\t\tsize: undefined,\n\t} );\n\n\tconst onChangeSpacingSize: SelectControlSingleSelectionProps[ 'onChange' ] =\n\t\t( val ) => {\n\t\t\tconst theSize = findSizeBySlug( sizes, val );\n\n\t\t\tif ( ! theSize || value === theSize.slug ) {\n\t\t\t\tonChange?.( undefined );\n\t\t\t} else if ( typeof onChange === 'function' ) {\n\t\t\t\tonChange( theSize.slug );\n\t\t\t}\n\t\t};\n\n\tconst formatSizesAsOptions = ( theSizes: Size[] ) => {\n\t\tconst options = theSizes.map( ( { name, slug } ) => ( {\n\t\t\tlabel: name,\n\t\t\tvalue: slug,\n\t\t} ) );\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: __( 'Default' ),\n\t\t\t\tvalue: '',\n\t\t\t},\n\t\t\t...options,\n\t\t];\n\t};\n\n\tconst selectLabel = (\n\t\t<>\n\t\t\t{ icon && <Icon icon={ icon } /> }\n\t\t\t{ label }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<ContextSystemProvider value={ CONTEXT_VALUE }>\n\t\t\t<SelectControl\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'block-editor-dimension-control'\n\t\t\t\t) }\n\t\t\t\tlabel={ selectLabel }\n\t\t\t\thideLabelFromVision={ false }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeSpacingSize }\n\t\t\t\toptions={ formatSizesAsOptions( sizes ) }\n\t\t\t/>\n\t\t</ContextSystemProvider>\n\t);\n}\n\nexport default DimensionControl;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAA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version":3,"names":["_x","findSizeBySlug","sizes","slug","find","size","name"],"sources":["@wordpress/components/src/dimension-control/sizes.ts"],"sourcesContent":["/**\n * Sizes\n *\n * defines the sizes used in dimension controls\n * all hardcoded `size` values are based on the value of\n * the Sass variable `$block-padding` from\n * `packages/block-editor/src/components/dimension-control/sizes.js`.\n */\n\n/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { Size } from './types';\n\n/**\n * Finds the correct size object from the provided sizes\n * table by size slug (eg: `medium`)\n *\n * @param sizes containing objects for each size definition.\n * @param slug a string representation of the size (eg: `medium`).\n */\nexport const findSizeBySlug = ( sizes: Size[], slug: string ) =>\n\tsizes.find( ( size ) => slug === size.slug );\n\nexport default [\n\t{\n\t\tname: _x( 'None', 'Size of a UI element' ),\n\t\tslug: 'none',\n\t},\n\t{\n\t\tname: _x( 'Small', 'Size of a UI element' ),\n\t\tslug: 'small',\n\t},\n\t{\n\t\tname: _x( 'Medium', 'Size of a UI element' ),\n\t\tslug: 'medium',\n\t},\n\t{\n\t\tname: _x( 'Large', 'Size of a UI element' ),\n\t\tslug: 'large',\n\t},\n\t{\n\t\tname: _x( 'Extra Large', 'Size of a UI element' ),\n\t\tslug: 'xlarge',\n\t},\n];\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAGA,CAAEC,KAAa,EAAEC,IAAY,KAC1DD,KAAK,CAACE,IAAI,CAAIC,IAAI,IAAMF,IAAI,KAAKE,IAAI,CAACF,IAAK,CAAC;AAE7C,eAAe,CACd;EACCG,IAAI,EAAEN,EAAE,CAAE,MAAM,EAAE,sBAAuB,CAAC;EAC1CG,IAAI,EAAE;AACP,CAAC,EACD;EACCG,IAAI,EAAEN,EAAE,CAAE,OAAO,EAAE,sBAAuB,CAAC;EAC3CG,IAAI,EAAE;AACP,CAAC,EACD;EACCG,IAAI,EAAEN,EAAE,CAAE,QAAQ,EAAE,sBAAuB,CAAC;EAC5CG,IAAI,EAAE;AACP,CAAC,EACD;EACCG,IAAI,EAAEN,EAAE,CAAE,OAAO,EAAE,sBAAuB,CAAC;EAC3CG,IAAI,EAAE;AACP,CAAC,EACD;EACCG,IAAI,EAAEN,EAAE,CAAE,aAAa,EAAE,sBAAuB,CAAC;EACjDG,IAAI,EAAE;AACP,CAAC,CACD","ignoreList":[]}
1
+ {"version":3,"names":["_x","findSizeBySlug","sizes","slug","find","size","name"],"sources":["@wordpress/components/src/dimension-control/sizes.ts"],"sourcesContent":["/**\n * Sizes\n *\n * defines the sizes used in dimension controls\n * all hardcoded `size` values are based on the value of\n * the Sass variable `$block-padding` from\n * `packages/block-editor/src/components/dimension-control/sizes.js`.\n */\n\n/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { Size } from './types';\n\n/**\n * Finds the correct size object from the provided sizes\n * table by size slug (eg: `medium`)\n *\n * @param sizes containing objects for each size definition.\n * @param slug a string representation of the size (eg: `medium`).\n */\nexport const findSizeBySlug = ( sizes: Size[], slug: string ) =>\n\tsizes.find( ( size ) => slug === size.slug );\n\nexport default [\n\t{\n\t\tname: _x( 'None', 'Size of a UI element' ),\n\t\tslug: 'none',\n\t},\n\t{\n\t\tname: _x( 'Small', 'Size of a UI element' ),\n\t\tslug: 'small',\n\t},\n\t{\n\t\tname: _x( 'Medium', 'Size of a UI element' ),\n\t\tslug: 'medium',\n\t},\n\t{\n\t\tname: _x( 'Large', 'Size of a UI element' ),\n\t\tslug: 'large',\n\t},\n\t{\n\t\tname: _x( 'Extra Large', 'Size of a UI element' ),\n\t\tslug: 'xlarge',\n\t},\n];\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAGA,CAAEC,KAAa,EAAEC,IAAY,KAC1DD,KAAK,CAACE,IAAI,CAAIC,IAAI,IAAMF,IAAI,KAAKE,IAAI,CAACF,IAAK,CAAC;AAE7C,eAAe,CACd;EACCG,IAAI,EAAEN,EAAE,CAAE,MAAM,EAAE,sBAAuB,CAAC;EAC1CG,IAAI,EAAE;AACP,CAAC,EACD;EACCG,IAAI,EAAEN,EAAE,CAAE,OAAO,EAAE,sBAAuB,CAAC;EAC3CG,IAAI,EAAE;AACP,CAAC,EACD;EACCG,IAAI,EAAEN,EAAE,CAAE,QAAQ,EAAE,sBAAuB,CAAC;EAC5CG,IAAI,EAAE;AACP,CAAC,EACD;EACCG,IAAI,EAAEN,EAAE,CAAE,OAAO,EAAE,sBAAuB,CAAC;EAC3CG,IAAI,EAAE;AACP,CAAC,EACD;EACCG,IAAI,EAAEN,EAAE,CAAE,aAAa,EAAE,sBAAuB,CAAC;EACjDG,IAAI,EAAE;AACP,CAAC,CACD","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["throttle","useEffect","useRef","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","dragImageClass","cloneWrapperClass","clonePadding","bodyClass","Draggable","children","onDragStart","onDragOver","onDragEnd","appendToOwnerDocument","cloneClassname","elementId","transferData","__experimentalTransferDataType","transferDataType","__experimentalDragComponent","dragComponent","dragComponentRef","cleanupRef","end","event","preventDefault","current","start","ownerDocument","target","dataTransfer","setData","JSON","stringify","cloneWrapper","createElement","style","top","left","dragImage","setDragImage","classList","add","body","appendChild","x","y","clientX","clientY","transform","clonedDragComponent","innerHTML","element","getElementById","elementRect","getBoundingClientRect","elementWrapper","parentNode","elementTopOffset","elementLeftOffset","width","clone","cloneNode","id","Array","from","querySelectorAll","forEach","child","removeChild","cursorLeft","cursorTop","over","e","nextX","nextY","throttledDragOver","addEventListener","remove","removeEventListener","onDraggableStart","onDraggableEnd","className","display","ref"],"sources":["@wordpress/components/src/draggable/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { DragEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { throttle } from '@wordpress/compose';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DraggableProps } from './types';\n\nconst dragImageClass = 'components-draggable__invisible-drag-image';\nconst cloneWrapperClass = 'components-draggable__clone';\nconst clonePadding = 0;\nconst bodyClass = 'is-dragging-components-draggable';\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\tchildren,\n\tonDragStart,\n\tonDragOver,\n\tonDragEnd,\n\tappendToOwnerDocument = false,\n\tcloneClassname,\n\telementId,\n\ttransferData,\n\t__experimentalTransferDataType: transferDataType = 'text',\n\t__experimentalDragComponent: dragComponent,\n}: DraggableProps ) {\n\tconst dragComponentRef = useRef< HTMLDivElement >( null );\n\tconst cleanupRef = useRef( () => {} );\n\n\t/**\n\t * Removes the element clone, resets cursor, and removes drag listener.\n\t *\n\t * @param event The non-custom DragEvent.\n\t */\n\tfunction end( event: DragEvent ) {\n\t\tevent.preventDefault();\n\t\tcleanupRef.current();\n\n\t\tif ( onDragEnd ) {\n\t\t\tonDragEnd( event );\n\t\t}\n\t}\n\n\t/**\n\t * This method does a couple of things:\n\t *\n\t * - Clones the current element and spawns clone over original element.\n\t * - Adds a fake temporary drag image to avoid browser defaults.\n\t * - Sets transfer data.\n\t * - Adds dragover listener.\n\t *\n\t * @param event The non-custom DragEvent.\n\t */\n\tfunction start( event: DragEvent ) {\n\t\tconst { ownerDocument } = event.target as HTMLElement;\n\n\t\tevent.dataTransfer.setData(\n\t\t\ttransferDataType,\n\t\t\tJSON.stringify( transferData )\n\t\t);\n\n\t\tconst cloneWrapper = ownerDocument.createElement( 'div' );\n\t\t// Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.\n\t\tcloneWrapper.style.top = '0';\n\t\tcloneWrapper.style.left = '0';\n\n\t\tconst dragImage = ownerDocument.createElement( 'div' );\n\n\t\t// Set a fake drag image to avoid browser defaults. Remove from DOM\n\t\t// right after. event.dataTransfer.setDragImage is not supported yet in\n\t\t// IE, we need to check for its existence first.\n\t\tif ( 'function' === typeof event.dataTransfer.setDragImage ) {\n\t\t\tdragImage.classList.add( dragImageClass );\n\t\t\townerDocument.body.appendChild( dragImage );\n\t\t\tevent.dataTransfer.setDragImage( dragImage, 0, 0 );\n\t\t}\n\n\t\tcloneWrapper.classList.add( cloneWrapperClass );\n\n\t\tif ( cloneClassname ) {\n\t\t\tcloneWrapper.classList.add( cloneClassname );\n\t\t}\n\n\t\tlet x = 0;\n\t\tlet y = 0;\n\t\t// If a dragComponent is defined, the following logic will clone the\n\t\t// HTML node and inject it into the cloneWrapper.\n\t\tif ( dragComponentRef.current ) {\n\t\t\t// Position dragComponent at the same position as the cursor.\n\t\t\tx = event.clientX;\n\t\t\ty = event.clientY;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\tconst clonedDragComponent = ownerDocument.createElement( 'div' );\n\t\t\tclonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;\n\t\t\tcloneWrapper.appendChild( clonedDragComponent );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\townerDocument.body.appendChild( cloneWrapper );\n\t\t} else {\n\t\t\tconst element = ownerDocument.getElementById(\n\t\t\t\telementId\n\t\t\t) as HTMLElement;\n\n\t\t\t// Prepare element clone and append to element wrapper.\n\t\t\tconst elementRect = element.getBoundingClientRect();\n\t\t\tconst elementWrapper = element.parentNode;\n\t\t\tconst elementTopOffset = elementRect.top;\n\t\t\tconst elementLeftOffset = elementRect.left;\n\n\t\t\tcloneWrapper.style.width = `${\n\t\t\t\telementRect.width + clonePadding * 2\n\t\t\t}px`;\n\n\t\t\tconst clone = element.cloneNode( true ) as HTMLElement;\n\t\t\tclone.id = `clone-${ elementId }`;\n\n\t\t\t// Position clone right over the original element (20px padding).\n\t\t\tx = elementLeftOffset - clonePadding;\n\t\t\ty = elementTopOffset - clonePadding;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\t// Hack: Remove iFrames as it's causing the embeds drag clone to freeze.\n\t\t\tArray.from< HTMLIFrameElement >(\n\t\t\t\tclone.querySelectorAll( 'iframe' )\n\t\t\t).forEach( ( child ) => child.parentNode?.removeChild( child ) );\n\n\t\t\tcloneWrapper.appendChild( clone );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\tif ( appendToOwnerDocument ) {\n\t\t\t\townerDocument.body.appendChild( cloneWrapper );\n\t\t\t} else {\n\t\t\t\telementWrapper?.appendChild( cloneWrapper );\n\t\t\t}\n\t\t}\n\n\t\t// Mark the current cursor coordinates.\n\t\tlet cursorLeft = event.clientX;\n\t\tlet cursorTop = event.clientY;\n\n\t\tfunction over( e: DragEvent ) {\n\t\t\t// Skip doing any work if mouse has not moved.\n\t\t\tif ( cursorLeft === e.clientX && cursorTop === e.clientY ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst nextX = x + e.clientX - cursorLeft;\n\t\t\tconst nextY = y + e.clientY - cursorTop;\n\t\t\tcloneWrapper.style.transform = `translate( ${ nextX }px, ${ nextY }px )`;\n\t\t\tcursorLeft = e.clientX;\n\t\t\tcursorTop = e.clientY;\n\t\t\tx = nextX;\n\t\t\ty = nextY;\n\t\t\tif ( onDragOver ) {\n\t\t\t\tonDragOver( e );\n\t\t\t}\n\t\t}\n\n\t\t// Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,\n\t\t// note that browsers may throttle raf below 60fps in certain conditions.\n\t\t// @ts-ignore\n\t\tconst throttledDragOver = throttle( over, 16 );\n\n\t\townerDocument.addEventListener( 'dragover', throttledDragOver );\n\n\t\t// Update cursor to 'grabbing', document wide.\n\t\townerDocument.body.classList.add( bodyClass );\n\n\t\tif ( onDragStart ) {\n\t\t\tonDragStart( event );\n\t\t}\n\n\t\tcleanupRef.current = () => {\n\t\t\t// Remove drag clone.\n\t\t\tif ( cloneWrapper && cloneWrapper.parentNode ) {\n\t\t\t\tcloneWrapper.parentNode.removeChild( cloneWrapper );\n\t\t\t}\n\n\t\t\tif ( dragImage && dragImage.parentNode ) {\n\t\t\t\tdragImage.parentNode.removeChild( dragImage );\n\t\t\t}\n\n\t\t\t// Reset cursor.\n\t\t\townerDocument.body.classList.remove( bodyClass );\n\n\t\t\townerDocument.removeEventListener( 'dragover', throttledDragOver );\n\t\t};\n\t}\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tcleanupRef.current();\n\t\t},\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ children( {\n\t\t\t\tonDraggableStart: start,\n\t\t\t\tonDraggableEnd: end,\n\t\t\t} ) }\n\t\t\t{ dragComponent && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-draggable-drag-component-root\"\n\t\t\t\t\tstyle={ { display: 'none' } }\n\t\t\t\t\tref={ dragComponentRef }\n\t\t\t\t>\n\t\t\t\t\t{ dragComponent }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Draggable;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAKA,MAAMC,cAAc,GAAG,4CAA4C;AACnE,MAAMC,iBAAiB,GAAG,6BAA6B;AACvD,MAAMC,YAAY,GAAG,CAAC;AACtB,MAAMC,SAAS,GAAG,kCAAkC;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAAE;EAC1BC,QAAQ;EACRC,WAAW;EACXC,UAAU;EACVC,SAAS;EACTC,qBAAqB,GAAG,KAAK;EAC7BC,cAAc;EACdC,SAAS;EACTC,YAAY;EACZC,8BAA8B,EAAEC,gBAAgB,GAAG,MAAM;EACzDC,2BAA2B,EAAEC;AACd,CAAC,EAAG;EACnB,MAAMC,gBAAgB,GAAGxB,MAAM,CAAoB,IAAK,CAAC;EACzD,MAAMyB,UAAU,GAAGzB,MAAM,CAAE,MAAM,CAAC,CAAE,CAAC;;EAErC;AACD;AACA;AACA;AACA;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AM,CAAC;IACrB;IAEAF,UAAU,CAACI,OAAO,GAAG,MAAM;MAC1B;MACA,IAAKQ,YAAY,IAAIA,YAAY,CAACuB,UAAU,EAAG;QAC9CvB,YAAY,CAACuB,UAAU,CAACY,WAAW,CAAEnC,YAAa,CAAC;MACpD;MAEA,IAAKK,SAAS,IAAIA,SAAS,CAACkB,UAAU,EAAG;QACxClB,SAAS,CAACkB,UAAU,CAACY,WAAW,CAAE9B,SAAU,CAAC;MAC9C;;MAEA;MACAX,aAAa,CAACe,IAAI,CAACF,SAAS,CAACqC,MAAM,CAAEvE,SAAU,CAAC;MAEhDqB,aAAa,CAACmD,mBAAmB,CAAE,UAAU,EAAEH,iBAAkB,CAAC;IACnE,CAAC;EACF;EAEAhF,SAAS,CACR,MAAM,MAAM;IACX0B,UAAU,CAACI,OAAO,CAAC,CAAC;EACrB,CAAC,EACD,EACD,CAAC;EAED,oBACCvB,KAAA,CAAAF,SAAA;IAAAQ,QAAA,GACGA,QAAQ,CAAE;MACXuE,gBAAgB,EAAErD,KAAK;MACvBsD,cAAc,EAAE1D;IACjB,CAAE,CAAC,EACDH,aAAa,iBACdrB,IAAA;MACCmF,SAAS,EAAC,0CAA0C;MACpD9C,KAAK,EAAG;QAAE+C,OAAO,EAAE;MAAO,CAAG;MAC7BC,GAAG,EAAG/D,gBAAkB;MAAAZ,QAAA,EAEtBW;IAAa,CACX,CACL;EAAA,CACA,CAAC;AAEL;AAEA,eAAeZ,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["throttle","useEffect","useRef","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","dragImageClass","cloneWrapperClass","clonePadding","bodyClass","Draggable","children","onDragStart","onDragOver","onDragEnd","appendToOwnerDocument","cloneClassname","elementId","transferData","__experimentalTransferDataType","transferDataType","__experimentalDragComponent","dragComponent","dragComponentRef","cleanupRef","end","event","preventDefault","current","start","ownerDocument","target","dataTransfer","setData","JSON","stringify","cloneWrapper","createElement","style","top","left","dragImage","setDragImage","classList","add","body","appendChild","x","y","clientX","clientY","transform","clonedDragComponent","innerHTML","element","getElementById","elementRect","getBoundingClientRect","elementWrapper","parentNode","elementTopOffset","elementLeftOffset","width","clone","cloneNode","id","Array","from","querySelectorAll","forEach","child","removeChild","cursorLeft","cursorTop","over","e","nextX","nextY","throttledDragOver","addEventListener","remove","removeEventListener","onDraggableStart","onDraggableEnd","className","display","ref"],"sources":["@wordpress/components/src/draggable/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { DragEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { throttle } from '@wordpress/compose';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DraggableProps } from './types';\n\nconst dragImageClass = 'components-draggable__invisible-drag-image';\nconst cloneWrapperClass = 'components-draggable__clone';\nconst clonePadding = 0;\nconst bodyClass = 'is-dragging-components-draggable';\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\tchildren,\n\tonDragStart,\n\tonDragOver,\n\tonDragEnd,\n\tappendToOwnerDocument = false,\n\tcloneClassname,\n\telementId,\n\ttransferData,\n\t__experimentalTransferDataType: transferDataType = 'text',\n\t__experimentalDragComponent: dragComponent,\n}: DraggableProps ) {\n\tconst dragComponentRef = useRef< HTMLDivElement >( null );\n\tconst cleanupRef = useRef( () => {} );\n\n\t/**\n\t * Removes the element clone, resets cursor, and removes drag listener.\n\t *\n\t * @param event The non-custom DragEvent.\n\t */\n\tfunction end( event: DragEvent ) {\n\t\tevent.preventDefault();\n\t\tcleanupRef.current();\n\n\t\tif ( onDragEnd ) {\n\t\t\tonDragEnd( event );\n\t\t}\n\t}\n\n\t/**\n\t * This method does a couple of things:\n\t *\n\t * - Clones the current element and spawns clone over original element.\n\t * - Adds a fake temporary drag image to avoid browser defaults.\n\t * - Sets transfer data.\n\t * - Adds dragover listener.\n\t *\n\t * @param event The non-custom DragEvent.\n\t */\n\tfunction start( event: DragEvent ) {\n\t\tconst { ownerDocument } = event.target as HTMLElement;\n\n\t\tevent.dataTransfer.setData(\n\t\t\ttransferDataType,\n\t\t\tJSON.stringify( transferData )\n\t\t);\n\n\t\tconst cloneWrapper = ownerDocument.createElement( 'div' );\n\t\t// Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.\n\t\tcloneWrapper.style.top = '0';\n\t\tcloneWrapper.style.left = '0';\n\n\t\tconst dragImage = ownerDocument.createElement( 'div' );\n\n\t\t// Set a fake drag image to avoid browser defaults. Remove from DOM\n\t\t// right after. event.dataTransfer.setDragImage is not supported yet in\n\t\t// IE, we need to check for its existence first.\n\t\tif ( 'function' === typeof event.dataTransfer.setDragImage ) {\n\t\t\tdragImage.classList.add( dragImageClass );\n\t\t\townerDocument.body.appendChild( dragImage );\n\t\t\tevent.dataTransfer.setDragImage( dragImage, 0, 0 );\n\t\t}\n\n\t\tcloneWrapper.classList.add( cloneWrapperClass );\n\n\t\tif ( cloneClassname ) {\n\t\t\tcloneWrapper.classList.add( cloneClassname );\n\t\t}\n\n\t\tlet x = 0;\n\t\tlet y = 0;\n\t\t// If a dragComponent is defined, the following logic will clone the\n\t\t// HTML node and inject it into the cloneWrapper.\n\t\tif ( dragComponentRef.current ) {\n\t\t\t// Position dragComponent at the same position as the cursor.\n\t\t\tx = event.clientX;\n\t\t\ty = event.clientY;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\tconst clonedDragComponent = ownerDocument.createElement( 'div' );\n\t\t\tclonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;\n\t\t\tcloneWrapper.appendChild( clonedDragComponent );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\townerDocument.body.appendChild( cloneWrapper );\n\t\t} else {\n\t\t\tconst element = ownerDocument.getElementById(\n\t\t\t\telementId\n\t\t\t) as HTMLElement;\n\n\t\t\t// Prepare element clone and append to element wrapper.\n\t\t\tconst elementRect = element.getBoundingClientRect();\n\t\t\tconst elementWrapper = element.parentNode;\n\t\t\tconst elementTopOffset = elementRect.top;\n\t\t\tconst elementLeftOffset = elementRect.left;\n\n\t\t\tcloneWrapper.style.width = `${\n\t\t\t\telementRect.width + clonePadding * 2\n\t\t\t}px`;\n\n\t\t\tconst clone = element.cloneNode( true ) as HTMLElement;\n\t\t\tclone.id = `clone-${ elementId }`;\n\n\t\t\t// Position clone right over the original element (20px padding).\n\t\t\tx = elementLeftOffset - clonePadding;\n\t\t\ty = elementTopOffset - clonePadding;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\t// Hack: Remove iFrames as it's causing the embeds drag clone to freeze.\n\t\t\tArray.from< HTMLIFrameElement >(\n\t\t\t\tclone.querySelectorAll( 'iframe' )\n\t\t\t).forEach( ( child ) => child.parentNode?.removeChild( child ) );\n\n\t\t\tcloneWrapper.appendChild( clone );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\tif ( appendToOwnerDocument ) {\n\t\t\t\townerDocument.body.appendChild( cloneWrapper );\n\t\t\t} else {\n\t\t\t\telementWrapper?.appendChild( cloneWrapper );\n\t\t\t}\n\t\t}\n\n\t\t// Mark the current cursor coordinates.\n\t\tlet cursorLeft = event.clientX;\n\t\tlet cursorTop = event.clientY;\n\n\t\tfunction over( e: DragEvent ) {\n\t\t\t// Skip doing any work if mouse has not moved.\n\t\t\tif ( cursorLeft === e.clientX && cursorTop === e.clientY ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst nextX = x + e.clientX - cursorLeft;\n\t\t\tconst nextY = y + e.clientY - cursorTop;\n\t\t\tcloneWrapper.style.transform = `translate( ${ nextX }px, ${ nextY }px )`;\n\t\t\tcursorLeft = e.clientX;\n\t\t\tcursorTop = e.clientY;\n\t\t\tx = nextX;\n\t\t\ty = nextY;\n\t\t\tif ( onDragOver ) {\n\t\t\t\tonDragOver( e );\n\t\t\t}\n\t\t}\n\n\t\t// Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,\n\t\t// note that browsers may throttle raf below 60fps in certain conditions.\n\t\t// @ts-ignore\n\t\tconst throttledDragOver = throttle( over, 16 );\n\n\t\townerDocument.addEventListener( 'dragover', throttledDragOver );\n\n\t\t// Update cursor to 'grabbing', document wide.\n\t\townerDocument.body.classList.add( bodyClass );\n\n\t\tif ( onDragStart ) {\n\t\t\tonDragStart( event );\n\t\t}\n\n\t\tcleanupRef.current = () => {\n\t\t\t// Remove drag clone.\n\t\t\tif ( cloneWrapper && cloneWrapper.parentNode ) {\n\t\t\t\tcloneWrapper.parentNode.removeChild( cloneWrapper );\n\t\t\t}\n\n\t\t\tif ( dragImage && dragImage.parentNode ) {\n\t\t\t\tdragImage.parentNode.removeChild( dragImage );\n\t\t\t}\n\n\t\t\t// Reset cursor.\n\t\t\townerDocument.body.classList.remove( bodyClass );\n\n\t\t\townerDocument.removeEventListener( 'dragover', throttledDragOver );\n\t\t};\n\t}\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tcleanupRef.current();\n\t\t},\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ children( {\n\t\t\t\tonDraggableStart: start,\n\t\t\t\tonDraggableEnd: end,\n\t\t\t} ) }\n\t\t\t{ dragComponent && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-draggable-drag-component-root\"\n\t\t\t\t\tstyle={ { display: 'none' } }\n\t\t\t\t\tref={ dragComponentRef }\n\t\t\t\t>\n\t\t\t\t\t{ dragComponent }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Draggable;\n"],"mappings":";AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAKA,MAAMC,cAAc,GAAG,4CAA4C;AACnE,MAAMC,iBAAiB,GAAG,6BAA6B;AACvD,MAAMC,YAAY,GAAG,CAAC;AACtB,MAAMC,SAAS,GAAG,kCAAkC;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAAE;EAC1BC,QAAQ;EACRC,WAAW;EACXC,UAAU;EACVC,SAAS;EACTC,qBAAqB,GAAG,KAAK;EAC7BC,cAAc;EACdC,SAAS;EACTC,YAAY;EACZC,8BAA8B,EAAEC,gBAAgB,GAAG,MAAM;EACzDC,2BAA2B,EAAEC;AACd,CAAC,EAAG;EACnB,MAAMC,gBAAgB,GAAG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;IACAhD,aAAa,CAACe,IAAI,CAACF,SAAS,CAACC,GAAG,CAAEnC,SAAU,CAAC;IAE7C,IAAKG,WAAW,EAAG;MAClBA,WAAW,CAAEc,KAAM,CAAC;IACrB;IAEAF,UAAU,CAACI,OAAO,GAAG,MAAM;MAC1B;MACA,IAAKQ,YAAY,IAAIA,YAAY,CAACuB,UAAU,EAAG;QAC9CvB,YAAY,CAACuB,UAAU,CAACY,WAAW,CAAEnC,YAAa,CAAC;MACpD;MAEA,IAAKK,SAAS,IAAIA,SAAS,CAACkB,UAAU,EAAG;QACxClB,SAAS,CAACkB,UAAU,CAACY,WAAW,CAAE9B,SAAU,CAAC;MAC9C;;MAEA;MACAX,aAAa,CAACe,IAAI,CAACF,SAAS,CAACqC,MAAM,CAAEvE,SAAU,CAAC;MAEhDqB,aAAa,CAACmD,mBAAmB,CAAE,UAAU,EAAEH,iBAAkB,CAAC;IACnE,CAAC;EACF;EAEAhF,SAAS,CACR,MAAM,MAAM;IACX0B,UAAU,CAACI,OAAO,CAAC,CAAC;EACrB,CAAC,EACD,EACD,CAAC;EAED,oBACCvB,KAAA,CAAAF,SAAA;IAAAQ,QAAA,GACGA,QAAQ,CAAE;MACXuE,gBAAgB,EAAErD,KAAK;MACvBsD,cAAc,EAAE1D;IACjB,CAAE,CAAC,EACDH,aAAa,iBACdrB,IAAA;MACCmF,SAAS,EAAC,0CAA0C;MACpD9C,KAAK,EAAG;QAAE+C,OAAO,EAAE;MAAO,CAAG;MAC7BC,GAAG,EAAG/D,gBAAkB;MAAAZ,QAAA,EAEtBW;IAAa,CACX,CACL;EAAA,CACA,CAAC;AAEL;AAEA,eAAeZ,SAAS","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["Gesture","GestureDetector","LongPressGestureHandler","Animated","useSharedValue","runOnJS","useAnimatedReaction","useAnimatedGestureHandler","createContext","useContext","useRef","useMemo","styles","jsx","_jsx","Context","Provider","Draggable","children","onDragEnd","onDragOver","onDragStart","testID","isDragging","isPanActive","draggingId","panGestureRef","currentFirstTouchId","initialPosition","x","y","lastPosition","value","result","previous","id","getFirstTouchEvent","event","allTouches","find","touch","panGesture","Pan","manualActivation","onTouchesDown","firstEvent","onTouchesMove","state","activate","end","onTouchesCancelled","_event","onEnd","withRef","shouldCancelWhenOutside","withTestId","providerValue","gesture","View","style","draggable__container","DraggableTrigger","enabled","maxDistance","minDuration","onLongPress","onLongPressEnd","gestureHandler","onActive","minDurationMs","maxDist","simultaneousHandlers","onGestureEvent"],"sources":["@wordpress/components/src/draggable/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tGesture,\n\tGestureDetector,\n\tLongPressGestureHandler,\n} from 'react-native-gesture-handler';\nimport Animated, {\n\tuseSharedValue,\n\trunOnJS,\n\tuseAnimatedReaction,\n\tuseAnimatedGestureHandler,\n} from 'react-native-reanimated';\n\n/**\n * WordPress dependencies\n */\nimport { createContext, useContext, useRef, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst Context = createContext( {} );\nconst { Provider } = Context;\n\n/**\n * Draggable component.\n *\n * @param {Object} props Component props.\n * @param {JSX.Element} props.children Children to be rendered.\n * @param {Function} [props.onDragEnd] Callback when dragging ends.\n * @param {Function} [props.onDragOver] Callback when dragging happens over an element.\n * @param {Function} [props.onDragStart] Callback when dragging starts.\n * @param {string} [props.testID] Id used for querying the pan gesture in tests.\n *\n * @return {JSX.Element} The component to be rendered.\n */\nconst Draggable = ( {\n\tchildren,\n\tonDragEnd,\n\tonDragOver,\n\tonDragStart,\n\ttestID,\n} ) => {\n\tconst isDragging = useSharedValue( false );\n\tconst isPanActive = useSharedValue( false );\n\tconst draggingId = useSharedValue( '' );\n\tconst panGestureRef = useRef();\n\tconst currentFirstTouchId = useSharedValue( null );\n\n\tconst initialPosition = {\n\t\tx: useSharedValue( 0 ),\n\t\ty: useSharedValue( 0 ),\n\t};\n\tconst lastPosition = {\n\t\tx: useSharedValue( 0 ),\n\t\ty: useSharedValue( 0 ),\n\t};\n\n\tuseAnimatedReaction(\n\t\t() => isDragging.value,\n\t\t( result, previous ) => {\n\t\t\tif ( result === previous ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( result ) {\n\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\tonDragStart( {\n\t\t\t\t\t\tx: initialPosition.x.value,\n\t\t\t\t\t\ty: initialPosition.y.value,\n\t\t\t\t\t\tid: draggingId.value,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} else if ( previous !== null && onDragEnd ) {\n\t\t\t\tonDragEnd( {\n\t\t\t\t\tx: lastPosition.x.value,\n\t\t\t\t\ty: lastPosition.y.value,\n\t\t\t\t\tid: draggingId.value,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t);\n\n\tfunction getFirstTouchEvent( event ) {\n\t\t'worklet';\n\n\t\treturn event.allTouches.find(\n\t\t\t( touch ) => touch.id === currentFirstTouchId.value\n\t\t);\n\t}\n\n\tconst panGesture = Gesture.Pan()\n\t\t.manualActivation( true )\n\t\t.onTouchesDown( ( event ) => {\n\t\t\tif ( ! currentFirstTouchId.value ) {\n\t\t\t\tconst firstEvent = event.allTouches[ 0 ];\n\t\t\t\tconst { x = 0, y = 0 } = firstEvent;\n\n\t\t\t\tcurrentFirstTouchId.value = firstEvent.id;\n\n\t\t\t\tinitialPosition.x.value = x;\n\t\t\t\tinitialPosition.y.value = y;\n\t\t\t}\n\t\t} )\n\t\t.onTouchesMove( ( event, state ) => {\n\t\t\tif ( ! isPanActive.value && isDragging.value ) {\n\t\t\t\tisPanActive.value = true;\n\t\t\t\tstate.activate();\n\t\t\t}\n\n\t\t\tif ( isPanActive.value && isDragging.value ) {\n\t\t\t\tconst firstEvent = getFirstTouchEvent( event );\n\n\t\t\t\tif ( ! firstEvent ) {\n\t\t\t\t\tstate.end();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlastPosition.x.value = firstEvent.x;\n\t\t\t\tlastPosition.y.value = firstEvent.y;\n\n\t\t\t\tif ( onDragOver ) {\n\t\t\t\t\tonDragOver( firstEvent );\n\t\t\t\t}\n\t\t\t}\n\t\t} )\n\t\t.onTouchesCancelled( ( _event, state ) => {\n\t\t\tstate.end();\n\t\t} )\n\t\t.onEnd( () => {\n\t\t\tcurrentFirstTouchId.value = null;\n\t\t\tisPanActive.value = false;\n\t\t\tisDragging.value = false;\n\t\t} )\n\t\t.withRef( panGestureRef )\n\t\t.shouldCancelWhenOutside( false )\n\t\t.withTestId( testID );\n\n\tconst providerValue = useMemo( () => {\n\t\treturn { panGestureRef, isDragging, isPanActive, draggingId };\n\t}, [\n\t\t// `isDragging`, `isPanActive` and `draggingId` are created using the\n\t\t// `useSharedValue` hook provided by the `react-native-reanimated`, which in\n\t\t// theory should guarantee that the value of these variables remains stable.\n\t\t// ESLint can't pick this up, and that's why they have to be specified as\n\t\t// dependencies for this hook call.\n\t\tisDragging,\n\t\tisPanActive,\n\t\tdraggingId,\n\t] );\n\n\treturn (\n\t\t<GestureDetector gesture={ panGesture }>\n\t\t\t<Animated.View style={ styles.draggable__container }>\n\t\t\t\t<Provider value={ providerValue }>{ children }</Provider>\n\t\t\t</Animated.View>\n\t\t</GestureDetector>\n\t);\n};\n\n/**\n * Draggable trigger component.\n *\n * This component acts as the trigger for the dragging functionality.\n *\n * @param {Object} props Component props.\n * @param {JSX.Element} props.children Children to be rendered.\n * @param {*} props.id Identifier passed within the event callbacks.\n * @param {boolean} [props.enabled] Enables the long-press gesture.\n * @param {number} [props.maxDistance] Maximum distance, that defines how far the finger is allowed to travel during a long press gesture.\n * @param {number} [props.minDuration] Minimum time, that a finger must remain pressed on the corresponding view.\n * @param {Function} [props.onLongPress] Callback when long-press gesture is triggered over an element.\n * @param {Function} [props.onLongPressEnd] Callback when long-press gesture ends.\n * @param {string} [props.testID] Id used for querying the long-press gesture handler in tests.\n *\n * @return {JSX.Element} The component to be rendered.\n */\nconst DraggableTrigger = ( {\n\tchildren,\n\tenabled = true,\n\tid,\n\tmaxDistance = 1000,\n\tminDuration = 500,\n\tonLongPress,\n\tonLongPressEnd,\n\ttestID,\n} ) => {\n\tconst { panGestureRef, isDragging, isPanActive, draggingId } =\n\t\tuseContext( Context );\n\n\tconst gestureHandler = useAnimatedGestureHandler( {\n\t\tonActive: () => {\n\t\t\tif ( isDragging.value ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdraggingId.value = id;\n\t\t\tisDragging.value = true;\n\t\t\tif ( onLongPress ) {\n\t\t\t\trunOnJS( onLongPress )( id );\n\t\t\t}\n\t\t},\n\t\tonEnd: () => {\n\t\t\tif ( ! isPanActive.value ) {\n\t\t\t\tisDragging.value = false;\n\t\t\t}\n\n\t\t\tif ( onLongPressEnd ) {\n\t\t\t\trunOnJS( onLongPressEnd )( id );\n\t\t\t}\n\t\t},\n\t} );\n\n\treturn (\n\t\t<LongPressGestureHandler\n\t\t\tenabled={ enabled }\n\t\t\tminDurationMs={ minDuration }\n\t\t\tmaxDist={ maxDistance }\n\t\t\tsimultaneousHandlers={ panGestureRef }\n\t\t\tshouldCancelWhenOutside={ false }\n\t\t\tonGestureEvent={ gestureHandler }\n\t\t\ttestID={ testID }\n\t\t>\n\t\t\t{ children }\n\t\t</LongPressGestureHandler>\n\t);\n};\n\nexport { DraggableTrigger };\nexport default Draggable;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,OAAO,EACPC,eAAe,EACfC,uBAAuB,QACjB,8BAA8B;AACrC,OAAOC,QAAQ,IACdC,cAAc,EACdC,OAAO,EACPC,mBAAmB,EACnBC,yBAAyB,QACnB,yBAAyB;;AAEhC;AACA;AACA;AACA,SAASC,aAAa,EAAEC,UAAU,EAAEC,MAAM,EAAEC,OAAO,QAAQ,oBAAoB;;AAE/E;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AAAC,SAAAC,GAAA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B,GAAGA,CAAE;EAC1B3C,QAAQ;EACR4C,OAAO,GAAG,IAAI;EACd3B,EAAE;EACF4B,WAAW,GAAG,IAAI;EAClBC,WAAW,GAAG,GAAG;EACjBC,WAAW;EACXC,cAAc;EACd5C;AACD,CAAC,KAAM;EACN,MAAM;IAAEI,aAAa;IAAEH,UAAU;IAAEC,WAAW;IAAEC;EAAW,CAAC,GAC3DhB,UAAU,CAAEM,OAAQ,CAAC;EAEtB,MAAMoD,cAAc,GAAG5D,yBAAyB,CAAE;IACjD6D,QAAQ,EAAEA,CAAA,KAAM;MACf,IAAK7C,UAAU,CAACS,KAAK,EAAG;QACvB;MACD;MAEAP,UAAU,CAACO,KAAK,GAAGG,EAAE;MACrBZ,UAAU,CAACS,KAAK,GAAG,IAAI;MACvB,IAAKiC,WAAW,EAAG;QAClB5D,OAAO,CAAE4D,WAAY,CAAC,CAAE9B,EAAG,CAAC;MAC7B;IACD,CAAC;IACDiB,KAAK,EAAEA,CAAA,KAAM;MACZ,IAAK,CAAE5B,WAAW,CAACQ,KAAK,EAAG;QAC1BT,UAAU,CAACS,KAAK,GAAG,KAAK;MACzB;MAEA,IAAKkC,cAAc,EAAG;QACrB7D,OAAO,CAAE6D,cAAe,CAAC,CAAE/B,EAAG,CAAC;MAChC;IACD;EACD,CAAE,CAAC;EAEH,oBACCrB,IAAA,CAACZ,uBAAuB;IACvB4D,OAAO,EAAGA,OAAS;IACnBO,aAAa,EAAGL,WAAa;IAC7BM,OAAO,EAAGP,WAAa;IACvBQ,oBAAoB,EAAG7C,aAAe;IACtC4B,uBAAuB,EAAG,KAAO;IACjCkB,cAAc,EAAGL,cAAgB;IACjC7C,MAAM,EAAGA,MAAQ;IAAAJ,QAAA,EAEfA;EAAQ,CACc,CAAC;AAE5B,CAAC;AAED,SAAS2C,gBAAgB;AACzB,eAAe5C,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["Gesture","GestureDetector","LongPressGestureHandler","Animated","useSharedValue","runOnJS","useAnimatedReaction","useAnimatedGestureHandler","createContext","useContext","useRef","useMemo","styles","jsx","_jsx","Context","Provider","Draggable","children","onDragEnd","onDragOver","onDragStart","testID","isDragging","isPanActive","draggingId","panGestureRef","currentFirstTouchId","initialPosition","x","y","lastPosition","value","result","previous","id","getFirstTouchEvent","event","allTouches","find","touch","panGesture","Pan","manualActivation","onTouchesDown","firstEvent","onTouchesMove","state","activate","end","onTouchesCancelled","_event","onEnd","withRef","shouldCancelWhenOutside","withTestId","providerValue","gesture","View","style","draggable__container","DraggableTrigger","enabled","maxDistance","minDuration","onLongPress","onLongPressEnd","gestureHandler","onActive","minDurationMs","maxDist","simultaneousHandlers","onGestureEvent"],"sources":["@wordpress/components/src/draggable/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tGesture,\n\tGestureDetector,\n\tLongPressGestureHandler,\n} from 'react-native-gesture-handler';\nimport Animated, {\n\tuseSharedValue,\n\trunOnJS,\n\tuseAnimatedReaction,\n\tuseAnimatedGestureHandler,\n} from 'react-native-reanimated';\n\n/**\n * WordPress dependencies\n */\nimport { createContext, useContext, useRef, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst Context = createContext( {} );\nconst { Provider } = Context;\n\n/**\n * Draggable component.\n *\n * @param {Object} props Component props.\n * @param {JSX.Element} props.children Children to be rendered.\n * @param {Function} [props.onDragEnd] Callback when dragging ends.\n * @param {Function} [props.onDragOver] Callback when dragging happens over an element.\n * @param {Function} [props.onDragStart] Callback when dragging starts.\n * @param {string} [props.testID] Id used for querying the pan gesture in tests.\n *\n * @return {JSX.Element} The component to be rendered.\n */\nconst Draggable = ( {\n\tchildren,\n\tonDragEnd,\n\tonDragOver,\n\tonDragStart,\n\ttestID,\n} ) => {\n\tconst isDragging = useSharedValue( false );\n\tconst isPanActive = useSharedValue( false );\n\tconst draggingId = useSharedValue( '' );\n\tconst panGestureRef = useRef();\n\tconst currentFirstTouchId = useSharedValue( null );\n\n\tconst initialPosition = {\n\t\tx: useSharedValue( 0 ),\n\t\ty: useSharedValue( 0 ),\n\t};\n\tconst lastPosition = {\n\t\tx: useSharedValue( 0 ),\n\t\ty: useSharedValue( 0 ),\n\t};\n\n\tuseAnimatedReaction(\n\t\t() => isDragging.value,\n\t\t( result, previous ) => {\n\t\t\tif ( result === previous ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( result ) {\n\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\tonDragStart( {\n\t\t\t\t\t\tx: initialPosition.x.value,\n\t\t\t\t\t\ty: initialPosition.y.value,\n\t\t\t\t\t\tid: draggingId.value,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} else if ( previous !== null && onDragEnd ) {\n\t\t\t\tonDragEnd( {\n\t\t\t\t\tx: lastPosition.x.value,\n\t\t\t\t\ty: lastPosition.y.value,\n\t\t\t\t\tid: draggingId.value,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t);\n\n\tfunction getFirstTouchEvent( event ) {\n\t\t'worklet';\n\n\t\treturn event.allTouches.find(\n\t\t\t( touch ) => touch.id === currentFirstTouchId.value\n\t\t);\n\t}\n\n\tconst panGesture = Gesture.Pan()\n\t\t.manualActivation( true )\n\t\t.onTouchesDown( ( event ) => {\n\t\t\tif ( ! currentFirstTouchId.value ) {\n\t\t\t\tconst firstEvent = event.allTouches[ 0 ];\n\t\t\t\tconst { x = 0, y = 0 } = firstEvent;\n\n\t\t\t\tcurrentFirstTouchId.value = firstEvent.id;\n\n\t\t\t\tinitialPosition.x.value = x;\n\t\t\t\tinitialPosition.y.value = y;\n\t\t\t}\n\t\t} )\n\t\t.onTouchesMove( ( event, state ) => {\n\t\t\tif ( ! isPanActive.value && isDragging.value ) {\n\t\t\t\tisPanActive.value = true;\n\t\t\t\tstate.activate();\n\t\t\t}\n\n\t\t\tif ( isPanActive.value && isDragging.value ) {\n\t\t\t\tconst firstEvent = getFirstTouchEvent( event );\n\n\t\t\t\tif ( ! firstEvent ) {\n\t\t\t\t\tstate.end();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlastPosition.x.value = firstEvent.x;\n\t\t\t\tlastPosition.y.value = firstEvent.y;\n\n\t\t\t\tif ( onDragOver ) {\n\t\t\t\t\tonDragOver( firstEvent );\n\t\t\t\t}\n\t\t\t}\n\t\t} )\n\t\t.onTouchesCancelled( ( _event, state ) => {\n\t\t\tstate.end();\n\t\t} )\n\t\t.onEnd( () => {\n\t\t\tcurrentFirstTouchId.value = null;\n\t\t\tisPanActive.value = false;\n\t\t\tisDragging.value = false;\n\t\t} )\n\t\t.withRef( panGestureRef )\n\t\t.shouldCancelWhenOutside( false )\n\t\t.withTestId( testID );\n\n\tconst providerValue = useMemo( () => {\n\t\treturn { panGestureRef, isDragging, isPanActive, draggingId };\n\t}, [\n\t\t// `isDragging`, `isPanActive` and `draggingId` are created using the\n\t\t// `useSharedValue` hook provided by the `react-native-reanimated`, which in\n\t\t// theory should guarantee that the value of these variables remains stable.\n\t\t// ESLint can't pick this up, and that's why they have to be specified as\n\t\t// dependencies for this hook call.\n\t\tisDragging,\n\t\tisPanActive,\n\t\tdraggingId,\n\t] );\n\n\treturn (\n\t\t<GestureDetector gesture={ panGesture }>\n\t\t\t<Animated.View style={ styles.draggable__container }>\n\t\t\t\t<Provider value={ providerValue }>{ children }</Provider>\n\t\t\t</Animated.View>\n\t\t</GestureDetector>\n\t);\n};\n\n/**\n * Draggable trigger component.\n *\n * This component acts as the trigger for the dragging functionality.\n *\n * @param {Object} props Component props.\n * @param {JSX.Element} props.children Children to be rendered.\n * @param {*} props.id Identifier passed within the event callbacks.\n * @param {boolean} [props.enabled] Enables the long-press gesture.\n * @param {number} [props.maxDistance] Maximum distance, that defines how far the finger is allowed to travel during a long press gesture.\n * @param {number} [props.minDuration] Minimum time, that a finger must remain pressed on the corresponding view.\n * @param {Function} [props.onLongPress] Callback when long-press gesture is triggered over an element.\n * @param {Function} [props.onLongPressEnd] Callback when long-press gesture ends.\n * @param {string} [props.testID] Id used for querying the long-press gesture handler in tests.\n *\n * @return {JSX.Element} The component to be rendered.\n */\nconst DraggableTrigger = ( {\n\tchildren,\n\tenabled = true,\n\tid,\n\tmaxDistance = 1000,\n\tminDuration = 500,\n\tonLongPress,\n\tonLongPressEnd,\n\ttestID,\n} ) => {\n\tconst { panGestureRef, isDragging, isPanActive, draggingId } =\n\t\tuseContext( Context );\n\n\tconst gestureHandler = useAnimatedGestureHandler( {\n\t\tonActive: () => {\n\t\t\tif ( isDragging.value ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdraggingId.value = id;\n\t\t\tisDragging.value = true;\n\t\t\tif ( onLongPress ) {\n\t\t\t\trunOnJS( onLongPress )( id );\n\t\t\t}\n\t\t},\n\t\tonEnd: () => {\n\t\t\tif ( ! isPanActive.value ) {\n\t\t\t\tisDragging.value = false;\n\t\t\t}\n\n\t\t\tif ( onLongPressEnd ) {\n\t\t\t\trunOnJS( onLongPressEnd )( id );\n\t\t\t}\n\t\t},\n\t} );\n\n\treturn (\n\t\t<LongPressGestureHandler\n\t\t\tenabled={ enabled }\n\t\t\tminDurationMs={ minDuration }\n\t\t\tmaxDist={ maxDistance }\n\t\t\tsimultaneousHandlers={ panGestureRef }\n\t\t\tshouldCancelWhenOutside={ false }\n\t\t\tonGestureEvent={ gestureHandler }\n\t\t\ttestID={ testID }\n\t\t>\n\t\t\t{ children }\n\t\t</LongPressGestureHandler>\n\t);\n};\n\nexport { DraggableTrigger };\nexport default Draggable;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,OAAO,EACPC,eAAe,EACfC,uBAAuB,QACjB,8BAA8B;AACrC,OAAOC,QAAQ,IACdC,cAAc,EACdC,OAAO,EACPC,mBAAmB,EACnBC,yBAAyB,QACnB,yBAAyB;;AAEhC;AACA;AACA;AACA,SAASC,aAAa,EAAEC,UAAU,EAAEC,MAAM,EAAEC,OAAO,QAAQ,oBAAoB;;AAE/E;AACA;AACA;AACA,OAAOC,MAA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/**
2
3
  * External dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","menu","contextConnectWithoutRef","useContextSystem","Button","Dropdown","NavigableMenu","jsx","_jsx","jsxs","_jsxs","mergeProps","defaultProps","props","mergedProps","className","isFunction","maybeFunc","UnconnectedDropdownMenu","dropdownMenuProps","children","controls","icon","label","popoverProps","toggleProps","menuProps","disableOpenOnArrowDown","text","noIcons","open","defaultOpen","onToggle","onToggleProp","variant","length","controlSets","Array","isArray","mergedPopoverProps","renderToggle","isOpen","_toggleProps$showTool","openOnArrowDown","event","code","preventDefault","as","Toggle","restToggleProps","mergedToggleProps","onClick","onKeyDown","showTooltip","renderContent","mergedMenuProps","role","flatMap","controlSet","indexOfSet","map","control","indexOfControl","__next40pxDefaultSize","stopPropagation","onClose","isActive","title","undefined","accessibleWhenDisabled","disabled","isDisabled","join","DropdownMenu"],"sources":["@wordpress/components/src/dropdown-menu/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { menu } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { contextConnectWithoutRef, useContextSystem } from '../context';\nimport Button from '../button';\nimport Dropdown from '../dropdown';\nimport { NavigableMenu } from '../navigable-container';\nimport type {\n\tDropdownMenuProps,\n\tDropdownOption,\n\tDropdownMenuInternalContext,\n} from './types';\n\nfunction mergeProps<\n\tT extends { className?: string; [ key: string ]: unknown },\n>( defaultProps: Partial< T > = {}, props: T = {} as T ) {\n\tconst mergedProps: T = {\n\t\t...defaultProps,\n\t\t...props,\n\t};\n\n\tif ( props.className && defaultProps.className ) {\n\t\tmergedProps.className = clsx( props.className, defaultProps.className );\n\t}\n\n\treturn mergedProps;\n}\n\nfunction isFunction( maybeFunc: unknown ): maybeFunc is () => void {\n\treturn typeof maybeFunc === 'function';\n}\n\nfunction UnconnectedDropdownMenu( dropdownMenuProps: DropdownMenuProps ) {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tcontrols,\n\t\ticon = menu,\n\t\tlabel,\n\t\tpopoverProps,\n\t\ttoggleProps,\n\t\tmenuProps,\n\t\tdisableOpenOnArrowDown = false,\n\t\ttext,\n\t\tnoIcons,\n\n\t\topen,\n\t\tdefaultOpen,\n\t\tonToggle: onToggleProp,\n\n\t\t// Context\n\t\tvariant,\n\t} = useContextSystem< DropdownMenuProps & DropdownMenuInternalContext >(\n\t\tdropdownMenuProps,\n\t\t'DropdownMenu'\n\t);\n\n\tif ( ! controls?.length && ! isFunction( children ) ) {\n\t\treturn null;\n\t}\n\n\t// Normalize controls to nested array of objects (sets of controls)\n\tlet controlSets: DropdownOption[][];\n\tif ( controls?.length ) {\n\t\t// @ts-expect-error The check below is needed because `DropdownMenus`\n\t\t// rendered by `ToolBarGroup` receive controls as a nested array.\n\t\tcontrolSets = controls;\n\t\tif ( ! Array.isArray( controlSets[ 0 ] ) ) {\n\t\t\t// This is not ideal, but at this point we know that `controls` is\n\t\t\t// not a nested array, even if TypeScript doesn't.\n\t\t\tcontrolSets = [ controls as DropdownOption[] ];\n\t\t}\n\t}\n\n\tconst mergedPopoverProps = mergeProps(\n\t\t{\n\t\t\tclassName: 'components-dropdown-menu__popover',\n\t\t\tvariant,\n\t\t},\n\t\tpopoverProps\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tclassName={ className }\n\t\t\tpopoverProps={ mergedPopoverProps }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\tconst openOnArrowDown = ( event: React.KeyboardEvent ) => {\n\t\t\t\t\tif ( disableOpenOnArrowDown ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! isOpen && event.code === 'ArrowDown' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst { as: Toggle = Button, ...restToggleProps } =\n\t\t\t\t\ttoggleProps ?? {};\n\n\t\t\t\tconst mergedToggleProps = mergeProps(\n\t\t\t\t\t{\n\t\t\t\t\t\tclassName: clsx( 'components-dropdown-menu__toggle', {\n\t\t\t\t\t\t\t'is-opened': isOpen,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t},\n\t\t\t\t\trestToggleProps\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<Toggle\n\t\t\t\t\t\t{ ...mergedToggleProps }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t( ( event ) => {\n\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\tif ( mergedToggleProps.onClick ) {\n\t\t\t\t\t\t\t\t\tmergedToggleProps.onClick( event );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} ) as React.MouseEventHandler< HTMLButtonElement >\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonKeyDown={\n\t\t\t\t\t\t\t( ( event ) => {\n\t\t\t\t\t\t\t\topenOnArrowDown( event );\n\t\t\t\t\t\t\t\tif ( mergedToggleProps.onKeyDown ) {\n\t\t\t\t\t\t\t\t\tmergedToggleProps.onKeyDown( event );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} ) as React.KeyboardEventHandler< HTMLButtonElement >\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\ttext={ text }\n\t\t\t\t\t\tshowTooltip={ toggleProps?.showTooltip ?? true }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ mergedToggleProps.children }\n\t\t\t\t\t</Toggle>\n\t\t\t\t);\n\t\t\t} }\n\t\t\trenderContent={ ( props ) => {\n\t\t\t\tconst mergedMenuProps = mergeProps(\n\t\t\t\t\t{\n\t\t\t\t\t\t'aria-label': label,\n\t\t\t\t\t\tclassName: clsx( 'components-dropdown-menu__menu', {\n\t\t\t\t\t\t\t'no-icons': noIcons,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t},\n\t\t\t\t\tmenuProps\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<NavigableMenu { ...mergedMenuProps } role=\"menu\">\n\t\t\t\t\t\t{ isFunction( children ) ? children( props ) : null }\n\t\t\t\t\t\t{ controlSets?.flatMap( ( controlSet, indexOfSet ) =>\n\t\t\t\t\t\t\tcontrolSet.map( ( control, indexOfControl ) => (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tkey={ [\n\t\t\t\t\t\t\t\t\t\tindexOfSet,\n\t\t\t\t\t\t\t\t\t\tindexOfControl,\n\t\t\t\t\t\t\t\t\t].join() }\n\t\t\t\t\t\t\t\t\tonClick={ (\n\t\t\t\t\t\t\t\t\t\tevent: React.MouseEvent< HTMLButtonElement >\n\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\tprops.onClose();\n\t\t\t\t\t\t\t\t\t\tif ( control.onClick ) {\n\t\t\t\t\t\t\t\t\t\t\tcontrol.onClick();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'components-dropdown-menu__menu-item',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'has-separator':\n\t\t\t\t\t\t\t\t\t\t\t\tindexOfSet > 0 &&\n\t\t\t\t\t\t\t\t\t\t\t\tindexOfControl === 0,\n\t\t\t\t\t\t\t\t\t\t\t'is-active': control.isActive,\n\t\t\t\t\t\t\t\t\t\t\t'is-icon-only': ! control.title,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\ticon={ control.icon }\n\t\t\t\t\t\t\t\t\tlabel={ control.label }\n\t\t\t\t\t\t\t\t\taria-checked={\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemcheckbox' ||\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemradio'\n\t\t\t\t\t\t\t\t\t\t\t? control.isActive\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\trole={\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemcheckbox' ||\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemradio'\n\t\t\t\t\t\t\t\t\t\t\t? control.role\n\t\t\t\t\t\t\t\t\t\t\t: 'menuitem'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\tdisabled={ control.isDisabled }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ control.title }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableMenu>\n\t\t\t\t);\n\t\t\t} }\n\t\t\topen={ open }\n\t\t\tdefaultOpen={ defaultOpen }\n\t\t\tonToggle={ onToggleProp }\n\t\t/>\n\t);\n}\n\n/**\n *\n * The DropdownMenu displays a list of actions (each contained in a MenuItem,\n * MenuItemsChoice, or MenuGroup) in a compact way. It appears in a Popover\n * after the user has interacted with an element (a button or icon) or when\n * they perform a specific action.\n *\n * Render a Dropdown Menu with a set of controls:\n *\n * ```jsx\n * import { DropdownMenu } from '@wordpress/components';\n * import {\n * \tmore,\n * \tarrowLeft,\n * \tarrowRight,\n * \tarrowUp,\n * \tarrowDown,\n * } from '@wordpress/icons';\n *\n * const MyDropdownMenu = () => (\n * \t<DropdownMenu\n * \t\ticon={ more }\n * \t\tlabel=\"Select a direction\"\n * \t\tcontrols={ [\n * \t\t\t{\n * \t\t\t\ttitle: 'Up',\n * \t\t\t\ticon: arrowUp,\n * \t\t\t\tonClick: () => console.log( 'up' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Right',\n * \t\t\t\ticon: arrowRight,\n * \t\t\t\tonClick: () => console.log( 'right' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Down',\n * \t\t\t\ticon: arrowDown,\n * \t\t\t\tonClick: () => console.log( 'down' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Left',\n * \t\t\t\ticon: arrowLeft,\n * \t\t\t\tonClick: () => console.log( 'left' ),\n * \t\t\t},\n * \t\t] }\n * \t/>\n * );\n * ```\n *\n * Alternatively, specify a `children` function which returns elements valid for\n * use in a DropdownMenu: `MenuItem`, `MenuItemsChoice`, or `MenuGroup`.\n *\n * ```jsx\n * import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\n * import { more, arrowUp, arrowDown, trash } from '@wordpress/icons';\n *\n * const MyDropdownMenu = () => (\n * \t<DropdownMenu icon={ more } label=\"Select a direction\">\n * \t\t{ ( { onClose } ) => (\n * \t\t\t<>\n * \t\t\t\t<MenuGroup>\n * \t\t\t\t\t<MenuItem icon={ arrowUp } onClick={ onClose }>\n * \t\t\t\t\t\tMove Up\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t\t<MenuItem icon={ arrowDown } onClick={ onClose }>\n * \t\t\t\t\t\tMove Down\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t</MenuGroup>\n * \t\t\t\t<MenuGroup>\n * \t\t\t\t\t<MenuItem icon={ trash } onClick={ onClose }>\n * \t\t\t\t\t\tRemove\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t</MenuGroup>\n * \t\t\t</>\n * \t\t) }\n * \t</DropdownMenu>\n * );\n * ```\n *\n */\nexport const DropdownMenu = contextConnectWithoutRef(\n\tUnconnectedDropdownMenu,\n\t'DropdownMenu'\n);\n\nexport default DropdownMenu;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAA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AAe,EACd2D,UAAU,GAAG,CAAC,IACdG,cAAc,KAAK,CAAC;YACrB,WAAW,EAAED,OAAO,CAACK,QAAQ;YAC7B,cAAc,EAAE,CAAEL,OAAO,CAACM;UAC3B,CACD,CAAG;UACH7C,IAAI,EAAGuC,OAAO,CAACvC,IAAM;UACrBC,KAAK,EAAGsC,OAAO,CAACtC,KAAO;UACvB,gBACCsC,OAAO,CAACL,IAAI,KAAK,kBAAkB,IACnCK,OAAO,CAACL,IAAI,KAAK,eAAe,GAC7BK,OAAO,CAACK,QAAQ,GAChBE,SACH;UACDZ,IAAI,EACHK,OAAO,CAACL,IAAI,KAAK,kBAAkB,IACnCK,OAAO,CAACL,IAAI,KAAK,eAAe,GAC7BK,OAAO,CAACL,IAAI,GACZ,UACH;UACDa,sBAAsB;UACtBC,QAAQ,EAAGT,OAAO,CAACU,UAAY;UAAAnD,QAAA,EAE7ByC,OAAO,CAACM;QAAK,GAxCT,CACLR,UAAU,EACVG,cAAc,CACd,CAACU,IAAI,CAAC,CAsCA,CACP,CACH,CAAC;MAAA,CACa,CAAC;IAElB,CAAG;IACH1C,IAAI,EAAGA,IAAM;IACbC,WAAW,EAAGA,WAAa;IAC3BC,QAAQ,EAAGC;EAAc,CACzB,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMwC,YAAY,GAAGvE,wBAAwB,CACnDgB,uBAAuB,EACvB,cACD,CAAC;AAED,eAAeuD,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["clsx","menu","contextConnectWithoutRef","useContextSystem","Button","Dropdown","NavigableMenu","jsx","_jsx","jsxs","_jsxs","mergeProps","defaultProps","props","mergedProps","className","isFunction","maybeFunc","UnconnectedDropdownMenu","dropdownMenuProps","children","controls","icon","label","popoverProps","toggleProps","menuProps","disableOpenOnArrowDown","text","noIcons","open","defaultOpen","onToggle","onToggleProp","variant","length","controlSets","Array","isArray","mergedPopoverProps","renderToggle","isOpen","_toggleProps$showTool","openOnArrowDown","event","code","preventDefault","as","Toggle","restToggleProps","mergedToggleProps","onClick","onKeyDown","showTooltip","renderContent","mergedMenuProps","role","flatMap","controlSet","indexOfSet","map","control","indexOfControl","__next40pxDefaultSize","stopPropagation","onClose","isActive","title","undefined","accessibleWhenDisabled","disabled","isDisabled","join","DropdownMenu"],"sources":["@wordpress/components/src/dropdown-menu/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { menu } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { contextConnectWithoutRef, useContextSystem } from '../context';\nimport Button from '../button';\nimport Dropdown from '../dropdown';\nimport { NavigableMenu } from '../navigable-container';\nimport type {\n\tDropdownMenuProps,\n\tDropdownOption,\n\tDropdownMenuInternalContext,\n} from './types';\n\nfunction mergeProps<\n\tT extends { className?: string; [ key: string ]: unknown },\n>( defaultProps: Partial< T > = {}, props: T = {} as T ) {\n\tconst mergedProps: T = {\n\t\t...defaultProps,\n\t\t...props,\n\t};\n\n\tif ( props.className && defaultProps.className ) {\n\t\tmergedProps.className = clsx( props.className, defaultProps.className );\n\t}\n\n\treturn mergedProps;\n}\n\nfunction isFunction( maybeFunc: unknown ): maybeFunc is () => void {\n\treturn typeof maybeFunc === 'function';\n}\n\nfunction UnconnectedDropdownMenu( dropdownMenuProps: DropdownMenuProps ) {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tcontrols,\n\t\ticon = menu,\n\t\tlabel,\n\t\tpopoverProps,\n\t\ttoggleProps,\n\t\tmenuProps,\n\t\tdisableOpenOnArrowDown = false,\n\t\ttext,\n\t\tnoIcons,\n\n\t\topen,\n\t\tdefaultOpen,\n\t\tonToggle: onToggleProp,\n\n\t\t// Context\n\t\tvariant,\n\t} = useContextSystem< DropdownMenuProps & DropdownMenuInternalContext >(\n\t\tdropdownMenuProps,\n\t\t'DropdownMenu'\n\t);\n\n\tif ( ! controls?.length && ! isFunction( children ) ) {\n\t\treturn null;\n\t}\n\n\t// Normalize controls to nested array of objects (sets of controls)\n\tlet controlSets: DropdownOption[][];\n\tif ( controls?.length ) {\n\t\t// @ts-expect-error The check below is needed because `DropdownMenus`\n\t\t// rendered by `ToolBarGroup` receive controls as a nested array.\n\t\tcontrolSets = controls;\n\t\tif ( ! Array.isArray( controlSets[ 0 ] ) ) {\n\t\t\t// This is not ideal, but at this point we know that `controls` is\n\t\t\t// not a nested array, even if TypeScript doesn't.\n\t\t\tcontrolSets = [ controls as DropdownOption[] ];\n\t\t}\n\t}\n\n\tconst mergedPopoverProps = mergeProps(\n\t\t{\n\t\t\tclassName: 'components-dropdown-menu__popover',\n\t\t\tvariant,\n\t\t},\n\t\tpopoverProps\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tclassName={ className }\n\t\t\tpopoverProps={ mergedPopoverProps }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\tconst openOnArrowDown = ( event: React.KeyboardEvent ) => {\n\t\t\t\t\tif ( disableOpenOnArrowDown ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! isOpen && event.code === 'ArrowDown' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst { as: Toggle = Button, ...restToggleProps } =\n\t\t\t\t\ttoggleProps ?? {};\n\n\t\t\t\tconst mergedToggleProps = mergeProps(\n\t\t\t\t\t{\n\t\t\t\t\t\tclassName: clsx( 'components-dropdown-menu__toggle', {\n\t\t\t\t\t\t\t'is-opened': isOpen,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t},\n\t\t\t\t\trestToggleProps\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<Toggle\n\t\t\t\t\t\t{ ...mergedToggleProps }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t( ( event ) => {\n\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\tif ( mergedToggleProps.onClick ) {\n\t\t\t\t\t\t\t\t\tmergedToggleProps.onClick( event );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} ) as React.MouseEventHandler< HTMLButtonElement >\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonKeyDown={\n\t\t\t\t\t\t\t( ( event ) => {\n\t\t\t\t\t\t\t\topenOnArrowDown( event );\n\t\t\t\t\t\t\t\tif ( mergedToggleProps.onKeyDown ) {\n\t\t\t\t\t\t\t\t\tmergedToggleProps.onKeyDown( event );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} ) as React.KeyboardEventHandler< HTMLButtonElement >\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\ttext={ text }\n\t\t\t\t\t\tshowTooltip={ toggleProps?.showTooltip ?? true }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ mergedToggleProps.children }\n\t\t\t\t\t</Toggle>\n\t\t\t\t);\n\t\t\t} }\n\t\t\trenderContent={ ( props ) => {\n\t\t\t\tconst mergedMenuProps = mergeProps(\n\t\t\t\t\t{\n\t\t\t\t\t\t'aria-label': label,\n\t\t\t\t\t\tclassName: clsx( 'components-dropdown-menu__menu', {\n\t\t\t\t\t\t\t'no-icons': noIcons,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t},\n\t\t\t\t\tmenuProps\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<NavigableMenu { ...mergedMenuProps } role=\"menu\">\n\t\t\t\t\t\t{ isFunction( children ) ? children( props ) : null }\n\t\t\t\t\t\t{ controlSets?.flatMap( ( controlSet, indexOfSet ) =>\n\t\t\t\t\t\t\tcontrolSet.map( ( control, indexOfControl ) => (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tkey={ [\n\t\t\t\t\t\t\t\t\t\tindexOfSet,\n\t\t\t\t\t\t\t\t\t\tindexOfControl,\n\t\t\t\t\t\t\t\t\t].join() }\n\t\t\t\t\t\t\t\t\tonClick={ (\n\t\t\t\t\t\t\t\t\t\tevent: React.MouseEvent< HTMLButtonElement >\n\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\tprops.onClose();\n\t\t\t\t\t\t\t\t\t\tif ( control.onClick ) {\n\t\t\t\t\t\t\t\t\t\t\tcontrol.onClick();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'components-dropdown-menu__menu-item',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'has-separator':\n\t\t\t\t\t\t\t\t\t\t\t\tindexOfSet > 0 &&\n\t\t\t\t\t\t\t\t\t\t\t\tindexOfControl === 0,\n\t\t\t\t\t\t\t\t\t\t\t'is-active': control.isActive,\n\t\t\t\t\t\t\t\t\t\t\t'is-icon-only': ! control.title,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\ticon={ control.icon }\n\t\t\t\t\t\t\t\t\tlabel={ control.label }\n\t\t\t\t\t\t\t\t\taria-checked={\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemcheckbox' ||\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemradio'\n\t\t\t\t\t\t\t\t\t\t\t? control.isActive\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\trole={\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemcheckbox' ||\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemradio'\n\t\t\t\t\t\t\t\t\t\t\t? control.role\n\t\t\t\t\t\t\t\t\t\t\t: 'menuitem'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\tdisabled={ control.isDisabled }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ control.title }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableMenu>\n\t\t\t\t);\n\t\t\t} }\n\t\t\topen={ open }\n\t\t\tdefaultOpen={ defaultOpen }\n\t\t\tonToggle={ onToggleProp }\n\t\t/>\n\t);\n}\n\n/**\n *\n * The DropdownMenu displays a list of actions (each contained in a MenuItem,\n * MenuItemsChoice, or MenuGroup) in a compact way. It appears in a Popover\n * after the user has interacted with an element (a button or icon) or when\n * they perform a specific action.\n *\n * Render a Dropdown Menu with a set of controls:\n *\n * ```jsx\n * import { DropdownMenu } from '@wordpress/components';\n * import {\n * \tmore,\n * \tarrowLeft,\n * \tarrowRight,\n * \tarrowUp,\n * \tarrowDown,\n * } from '@wordpress/icons';\n *\n * const MyDropdownMenu = () => (\n * \t<DropdownMenu\n * \t\ticon={ more }\n * \t\tlabel=\"Select a direction\"\n * \t\tcontrols={ [\n * \t\t\t{\n * \t\t\t\ttitle: 'Up',\n * \t\t\t\ticon: arrowUp,\n * \t\t\t\tonClick: () => console.log( 'up' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Right',\n * \t\t\t\ticon: arrowRight,\n * \t\t\t\tonClick: () => console.log( 'right' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Down',\n * \t\t\t\ticon: arrowDown,\n * \t\t\t\tonClick: () => console.log( 'down' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Left',\n * \t\t\t\ticon: arrowLeft,\n * \t\t\t\tonClick: () => console.log( 'left' ),\n * \t\t\t},\n * \t\t] }\n * \t/>\n * );\n * ```\n *\n * Alternatively, specify a `children` function which returns elements valid for\n * use in a DropdownMenu: `MenuItem`, `MenuItemsChoice`, or `MenuGroup`.\n *\n * ```jsx\n * import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\n * import { more, arrowUp, arrowDown, trash } from '@wordpress/icons';\n *\n * const MyDropdownMenu = () => (\n * \t<DropdownMenu icon={ more } label=\"Select a direction\">\n * \t\t{ ( { onClose } ) => (\n * \t\t\t<>\n * \t\t\t\t<MenuGroup>\n * \t\t\t\t\t<MenuItem icon={ arrowUp } onClick={ onClose }>\n * \t\t\t\t\t\tMove Up\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t\t<MenuItem icon={ arrowDown } onClick={ onClose }>\n * \t\t\t\t\t\tMove Down\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t</MenuGroup>\n * \t\t\t\t<MenuGroup>\n * \t\t\t\t\t<MenuItem icon={ trash } onClick={ onClose }>\n * \t\t\t\t\t\tRemove\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t</MenuGroup>\n * \t\t\t</>\n * \t\t) }\n * \t</DropdownMenu>\n * );\n * ```\n *\n */\nexport const DropdownMenu = contextConnectWithoutRef(\n\tUnconnectedDropdownMenu,\n\t'DropdownMenu'\n);\n\nexport default DropdownMenu;\n"],"mappings":";AAAA;AACA;AACA;AACA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ACC,eAAe,EACd2D,UAAU,GAAG,CAAC,IACdG,cAAc,KAAK,CAAC;YACrB,WAAW,EAAED,OAAO,CAACK,QAAQ;YAC7B,cAAc,EAAE,CAAEL,OAAO,CAACM;UAC3B,CACD,CAAG;UACH7C,IAAI,EAAGuC,OAAO,CAACvC,IAAM;UACrBC,KAAK,EAAGsC,OAAO,CAACtC,KAAO;UACvB,gBACCsC,OAAO,CAACL,IAAI,KAAK,kBAAkB,IACnCK,OAAO,CAACL,IAAI,KAAK,eAAe,GAC7BK,OAAO,CAACK,QAAQ,GAChBE,SACH;UACDZ,IAAI,EACHK,OAAO,CAACL,IAAI,KAAK,kBAAkB,IACnCK,OAAO,CAACL,IAAI,KAAK,eAAe,GAC7BK,OAAO,CAACL,IAAI,GACZ,UACH;UACDa,sBAAsB;UACtBC,QAAQ,EAAGT,OAAO,CAACU,UAAY;UAAAnD,QAAA,EAE7ByC,OAAO,CAACM;QAAK,GAxCT,CACLR,UAAU,EACVG,cAAc,CACd,CAACU,IAAI,CAAC,CAsCA,CACP,CACH,CAAC;MAAA,CACa,CAAC;IAElB,CAAG;IACH1C,IAAI,EAAGA,IAAM;IACbC,WAAW,EAAGA,WAAa;IAC3BC,QAAQ,EAAGC;EAAc,CACzB,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMwC,YAAY,GAAGvE,wBAAwB,CACnDgB,uBAAuB,EACvB,cACD,CAAC;AAED,eAAeuD,YAAY","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","Platform","withPreferredColorScheme","menu","Button","Dropdown","BottomSheet","PanelBody","jsx","_jsx","jsxs","_jsxs","mergeProps","defaultProps","props","mergedProps","className","isFunction","maybeFunc","DropdownMenu","children","controls","icon","label","popoverProps","toggleProps","length","controlSets","Array","isArray","mergedPopoverProps","renderToggle","isOpen","onToggle","mergedToggleProps","onClick","event","renderContent","onClose","hideHeader","isVisible","title","style","paddingLeft","paddingRight","flatMap","controlSet","indexOfSet","map","control","indexOfControl","Cell","onPress","editable","leftAlign","isSelected","isActive","separatorType","OS","join"],"sources":["@wordpress/components/src/dropdown-menu/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { Platform } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { menu } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport Dropdown from '../dropdown';\nimport BottomSheet from '../mobile/bottom-sheet';\nimport PanelBody from '../panel/body';\n\nfunction mergeProps( defaultProps = {}, props = {} ) {\n\tconst mergedProps = {\n\t\t...defaultProps,\n\t\t...props,\n\t};\n\n\tif ( props.className && defaultProps.className ) {\n\t\tmergedProps.className = clsx( props.className, defaultProps.className );\n\t}\n\n\treturn mergedProps;\n}\n\n/**\n * Whether the argument is a function.\n *\n * @param {*} maybeFunc The argument to check.\n * @return {boolean} True if the argument is a function, false otherwise.\n */\nfunction isFunction( maybeFunc ) {\n\treturn typeof maybeFunc === 'function';\n}\n\nfunction DropdownMenu( {\n\tchildren,\n\tclassName,\n\tcontrols,\n\ticon = menu,\n\tlabel,\n\tpopoverProps,\n\ttoggleProps,\n} ) {\n\tif ( ! controls?.length && ! isFunction( children ) ) {\n\t\treturn null;\n\t}\n\n\t// Normalize controls to nested array of objects (sets of controls)\n\tlet controlSets;\n\tif ( controls?.length ) {\n\t\tcontrolSets = controls;\n\t\tif ( ! Array.isArray( controlSets[ 0 ] ) ) {\n\t\t\tcontrolSets = [ controlSets ];\n\t\t}\n\t}\n\tconst mergedPopoverProps = mergeProps(\n\t\t{\n\t\t\tclassName: 'components-dropdown-menu__popover',\n\t\t},\n\t\tpopoverProps\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tclassName={ clsx( 'components-dropdown-menu', className ) }\n\t\t\tpopoverProps={ mergedPopoverProps }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\tconst mergedToggleProps = mergeProps(\n\t\t\t\t\t{\n\t\t\t\t\t\tclassName: clsx( 'components-dropdown-menu__toggle', {\n\t\t\t\t\t\t\t'is-opened': isOpen,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t},\n\t\t\t\t\ttoggleProps\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t{ ...mergedToggleProps }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tonToggle( event );\n\t\t\t\t\t\t\tif ( mergedToggleProps.onClick ) {\n\t\t\t\t\t\t\t\tmergedToggleProps.onClick( event );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ mergedToggleProps.children }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} }\n\t\t\trenderContent={ ( { isOpen, onClose, ...props } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<BottomSheet\n\t\t\t\t\t\thideHeader\n\t\t\t\t\t\tisVisible={ isOpen }\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isFunction( children ) ? children( props ) : null }\n\t\t\t\t\t\t<PanelBody\n\t\t\t\t\t\t\ttitle={ label }\n\t\t\t\t\t\t\tstyle={ { paddingLeft: 0, paddingRight: 0 } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ controlSets?.flatMap(\n\t\t\t\t\t\t\t\t( controlSet, indexOfSet ) =>\n\t\t\t\t\t\t\t\t\tcontrolSet.map(\n\t\t\t\t\t\t\t\t\t\t( control, indexOfControl ) => (\n\t\t\t\t\t\t\t\t\t\t\t<BottomSheet.Cell\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ [\n\t\t\t\t\t\t\t\t\t\t\t\t\tindexOfSet,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindexOfControl,\n\t\t\t\t\t\t\t\t\t\t\t\t].join() }\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ control.title }\n\t\t\t\t\t\t\t\t\t\t\t\tonPress={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\tif ( control.onClick ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrol.onClick();\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\teditable={ false }\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ control.icon }\n\t\t\t\t\t\t\t\t\t\t\t\tleftAlign\n\t\t\t\t\t\t\t\t\t\t\t\tisSelected={ control.isActive }\n\t\t\t\t\t\t\t\t\t\t\t\tseparatorType={\n\t\t\t\t\t\t\t\t\t\t\t\t\tPlatform.OS === 'android'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 'none'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'leftMargin'\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)\n\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A,OAAS;QAAAlB,QAAA,GAEjBH,UAAU,CAAEG,QAAS,CAAC,GAAGA,QAAQ,CAAEN,KAAM,CAAC,GAAG,IAAI,eACnDL,IAAA,CAACF,SAAS;UACTkC,KAAK,EAAGlB,KAAO;UACfmB,KAAK,EAAG;YAAEC,WAAW,EAAE,CAAC;YAAEC,YAAY,EAAE;UAAE,CAAG;UAAAxB,QAAA,EAE3CO,WAAW,EAAEkB,OAAO,CACrB,CAAEC,UAAU,EAAEC,UAAU,KACvBD,UAAU,CAACE,GAAG,CACb,CAAEC,OAAO,EAAEC,cAAc,kBACxBzC,IAAA,CAACH,WAAW,CAAC6C,IAAI;YAKhB5B,KAAK,EAAG0B,OAAO,CAACR,KAAO;YACvBW,OAAO,EAAGA,CAAA,KAAM;cACfd,OAAO,CAAC,CAAC;cACT,IAAKW,OAAO,CAACd,OAAO,EAAG;gBACtBc,OAAO,CAACd,OAAO,CAAC,CAAC;cAClB;YACD,CAAG;YACHkB,QAAQ,EAAG,KAAO;YAClB/B,IAAI,EAAG2B,OAAO,CAAC3B,IAAM;YACrBgC,SAAS;YACTC,UAAU,EAAGN,OAAO,CAACO,QAAU;YAC/BC,aAAa,EACZxD,QAAQ,CAACyD,EAAE,KAAK,SAAS,GACtB,MAAM,GACN;UACH,GAnBK,CACLX,UAAU,EACVG,cAAc,CACd,CAACS,IAAI,CAAC,CAiBP,CAEH,CACF;QAAC,CACS,CAAC;MAAA,CACA,CAAC;IAEhB;EAAG,CACH,CAAC;AAEJ;AAEA,eAAezD,wBAAwB,CAAEiB,YAAa,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["clsx","Platform","withPreferredColorScheme","menu","Button","Dropdown","BottomSheet","PanelBody","jsx","_jsx","jsxs","_jsxs","mergeProps","defaultProps","props","mergedProps","className","isFunction","maybeFunc","DropdownMenu","children","controls","icon","label","popoverProps","toggleProps","length","controlSets","Array","isArray","mergedPopoverProps","renderToggle","isOpen","onToggle","mergedToggleProps","onClick","event","renderContent","onClose","hideHeader","isVisible","title","style","paddingLeft","paddingRight","flatMap","controlSet","indexOfSet","map","control","indexOfControl","Cell","onPress","editable","leftAlign","isSelected","isActive","separatorType","OS","join"],"sources":["@wordpress/components/src/dropdown-menu/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { Platform } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { menu } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport Dropdown from '../dropdown';\nimport BottomSheet from '../mobile/bottom-sheet';\nimport PanelBody from '../panel/body';\n\nfunction mergeProps( defaultProps = {}, props = {} ) {\n\tconst mergedProps = {\n\t\t...defaultProps,\n\t\t...props,\n\t};\n\n\tif ( props.className && defaultProps.className ) {\n\t\tmergedProps.className = clsx( props.className, defaultProps.className );\n\t}\n\n\treturn mergedProps;\n}\n\n/**\n * Whether the argument is a function.\n *\n * @param {*} maybeFunc The argument to check.\n * @return {boolean} True if the argument is a function, false otherwise.\n */\nfunction isFunction( maybeFunc ) {\n\treturn typeof maybeFunc === 'function';\n}\n\nfunction DropdownMenu( {\n\tchildren,\n\tclassName,\n\tcontrols,\n\ticon = menu,\n\tlabel,\n\tpopoverProps,\n\ttoggleProps,\n} ) {\n\tif ( ! controls?.length && ! isFunction( children ) ) {\n\t\treturn null;\n\t}\n\n\t// Normalize controls to nested array of objects (sets of controls)\n\tlet controlSets;\n\tif ( controls?.length ) {\n\t\tcontrolSets = controls;\n\t\tif ( ! Array.isArray( controlSets[ 0 ] ) ) {\n\t\t\tcontrolSets = [ controlSets ];\n\t\t}\n\t}\n\tconst mergedPopoverProps = mergeProps(\n\t\t{\n\t\t\tclassName: 'components-dropdown-menu__popover',\n\t\t},\n\t\tpopoverProps\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tclassName={ clsx( 'components-dropdown-menu', className ) }\n\t\t\tpopoverProps={ mergedPopoverProps }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\tconst mergedToggleProps = mergeProps(\n\t\t\t\t\t{\n\t\t\t\t\t\tclassName: clsx( 'components-dropdown-menu__toggle', {\n\t\t\t\t\t\t\t'is-opened': isOpen,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t},\n\t\t\t\t\ttoggleProps\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t{ ...mergedToggleProps }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tonToggle( event );\n\t\t\t\t\t\t\tif ( mergedToggleProps.onClick ) {\n\t\t\t\t\t\t\t\tmergedToggleProps.onClick( event );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ mergedToggleProps.children }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} }\n\t\t\trenderContent={ ( { isOpen, onClose, ...props } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<BottomSheet\n\t\t\t\t\t\thideHeader\n\t\t\t\t\t\tisVisible={ isOpen }\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isFunction( children ) ? children( props ) : null }\n\t\t\t\t\t\t<PanelBody\n\t\t\t\t\t\t\ttitle={ label }\n\t\t\t\t\t\t\tstyle={ { paddingLeft: 0, paddingRight: 0 } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ controlSets?.flatMap(\n\t\t\t\t\t\t\t\t( controlSet, indexOfSet ) =>\n\t\t\t\t\t\t\t\t\tcontrolSet.map(\n\t\t\t\t\t\t\t\t\t\t( control, indexOfControl ) => (\n\t\t\t\t\t\t\t\t\t\t\t<BottomSheet.Cell\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ [\n\t\t\t\t\t\t\t\t\t\t\t\t\tindexOfSet,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindexOfControl,\n\t\t\t\t\t\t\t\t\t\t\t\t].join() }\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ control.title }\n\t\t\t\t\t\t\t\t\t\t\t\tonPress={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\tif ( control.onClick ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrol.onClick();\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\teditable={ false }\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ control.icon }\n\t\t\t\t\t\t\t\t\t\t\t\tleftAlign\n\t\t\t\t\t\t\t\t\t\t\t\tisSelected={ control.isActive }\n\t\t\t\t\t\t\t\t\t\t\t\tseparatorType={\n\t\t\t\t\t\t\t\t\t\t\t\t\tPlatform.OS === 'android'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 'none'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'leftMargin'\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t</BottomSheet>\n\t\t\t\t);\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default withPreferredColorScheme( DropdownMenu );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,QAAQ,QAAQ,cAAc;AACvC;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,OAAOC,MAAM,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AACH,WAAW,CAAC6C,IAAI;YAKhB5B,KAAK,EAAG0B,OAAO,CAACR,KAAO;YACvBW,OAAO,EAAGA,CAAA,KAAM;cACfd,OAAO,CAAC,CAAC;cACT,IAAKW,OAAO,CAACd,OAAO,EAAG;gBACtBc,OAAO,CAACd,OAAO,CAAC,CAAC;cAClB;YACD,CAAG;YACHkB,QAAQ,EAAG,KAAO;YAClB/B,IAAI,EAAG2B,OAAO,CAAC3B,IAAM;YACrBgC,SAAS;YACTC,UAAU,EAAGN,OAAO,CAACO,QAAU;YAC/BC,aAAa,EACZxD,QAAQ,CAACyD,EAAE,KAAK,SAAS,GACtB,MAAM,GACN;UACH,GAnBK,CACLX,UAAU,EACVG,cAAc,CACd,CAACS,IAAI,CAAC,CAiBP,CAEH,CACF;QAAC,CACS,CAAC;MAAA,CACA,CAAC;IAEhB;EAAG,CACH,CAAC;AAEJ;AAEA,eAAezD,wBAAwB,CAAEiB,YAAa,CAAC","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * WordPress dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["useState","swatch","__","Button","ColorPalette","ColorIndicator","Icon","useInstanceId","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ColorOption","label","value","colors","disableCustomColors","enableAlpha","onChange","isOpen","setIsOpen","idRoot","labelId","contentId","children","__next40pxDefaultSize","className","id","onClick","prev","icon","colorValue","text","role","clearable","ColorListPicker","labels","map","index","newColor","newColors","slice"],"sources":["@wordpress/components/src/duotone-picker/color-list-picker/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { swatch } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport ColorPalette from '../../color-palette';\nimport ColorIndicator from '../../color-indicator';\nimport Icon from '../../icon';\nimport type { ColorListPickerProps, ColorOptionProps } from './types';\nimport { useInstanceId } from '@wordpress/compose';\n\nfunction ColorOption( {\n\tlabel,\n\tvalue,\n\tcolors,\n\tdisableCustomColors,\n\tenableAlpha,\n\tonChange,\n}: ColorOptionProps ) {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\tconst idRoot = useInstanceId( ColorOption, 'color-list-picker-option' );\n\tconst labelId = `${ idRoot }__label`;\n\tconst contentId = `${ idRoot }__content`;\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"components-color-list-picker__swatch-button\"\n\t\t\t\tid={ labelId }\n\t\t\t\tonClick={ () => setIsOpen( ( prev ) => ! prev ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\taria-controls={ contentId }\n\t\t\t\ticon={\n\t\t\t\t\tvalue ? (\n\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\tcolorValue={ value }\n\t\t\t\t\t\t\tclassName=\"components-color-list-picker__swatch-color\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Icon icon={ swatch } />\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\ttext={ label }\n\t\t\t/>\n\t\t\t<div\n\t\t\t\trole=\"group\"\n\t\t\t\tid={ contentId }\n\t\t\t\taria-labelledby={ labelId }\n\t\t\t\taria-hidden={ ! isOpen }\n\t\t\t>\n\t\t\t\t{ isOpen && (\n\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\taria-label={ __( 'Color options' ) }\n\t\t\t\t\t\tclassName=\"components-color-list-picker__color-picker\"\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nfunction ColorListPicker( {\n\tcolors,\n\tlabels,\n\tvalue = [],\n\tdisableCustomColors,\n\tenableAlpha,\n\tonChange,\n}: ColorListPickerProps ) {\n\treturn (\n\t\t<div className=\"components-color-list-picker\">\n\t\t\t{ labels.map( ( label, index ) => (\n\t\t\t\t<ColorOption\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tvalue={ value[ index ] }\n\t\t\t\t\tcolors={ colors }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\tonChange={ ( newColor ) => {\n\t\t\t\t\t\tconst newColors: ( string | undefined )[] =\n\t\t\t\t\t\t\tvalue.slice();\n\t\t\t\t\t\tnewColors[ index ] = newColor;\n\t\t\t\t\t\tonChange( newColors );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n\nexport default ColorListPicker;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AACjC,OAAOC,YAAY,MAAM,qBAAqB;AAC9C,OAAOC,cAAc,MAAM,uBAAuB;AAClD,OAAOC,IAAI,MAAM,YAAY;AAE7B,SAASC,aAAa,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnD,SAASC,WAAWA,CAAE;EACrBC,KAAK;EACLC,KAAK;EACLC,MAAM;EACNC,mBAAmB;EACnBC,WAAW;EACXC;AACiB,CAAC,EAAG;EACrB,MAAM,CAAEC,MAAM,EAAEC,SAAS,CAAE,GAAGtB,QAAQ,CAAE,KAAM,CAAC;EAC/C,MAAMuB,MAAM,GAAGhB,aAAa,CAAEO,WAAW,EAAE,0BA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C1CY,MAAM,CAACC,GAAG,CAAE,CAAExB,KAAK,EAAEyB,KAAK,kBAC3B/B,IAAA,CAACK,WAAW;MAEXC,KAAK,EAAGA,KAAO;MACfC,KAAK,EAAGA,KAAK,CAAEwB,KAAK,CAAI;MACxBvB,MAAM,EAAGA,MAAQ;MACjBC,mBAAmB,EAAGA,mBAAqB;MAC3CC,WAAW,EAAGA,WAAa;MAC3BC,QAAQ,EAAKqB,QAAQ,IAAM;QAC1B,MAAMC,SAAmC,GACxC1B,KAAK,CAAC2B,KAAK,CAAC,CAAC;QACdD,SAAS,CAAEF,KAAK,CAAE,GAAGC,QAAQ;QAC7BrB,QAAQ,CAAEsB,SAAU,CAAC;MACtB;IAAG,GAXGF,KAYN,CACA;EAAC,CACC,CAAC;AAER;AAEA,eAAeH,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["useState","swatch","__","Button","ColorPalette","ColorIndicator","Icon","useInstanceId","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ColorOption","label","value","colors","disableCustomColors","enableAlpha","onChange","isOpen","setIsOpen","idRoot","labelId","contentId","children","__next40pxDefaultSize","className","id","onClick","prev","icon","colorValue","text","role","clearable","ColorListPicker","labels","map","index","newColor","newColors","slice"],"sources":["@wordpress/components/src/duotone-picker/color-list-picker/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { swatch } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport ColorPalette from '../../color-palette';\nimport ColorIndicator from '../../color-indicator';\nimport Icon from '../../icon';\nimport type { ColorListPickerProps, ColorOptionProps } from './types';\nimport { useInstanceId } from '@wordpress/compose';\n\nfunction ColorOption( {\n\tlabel,\n\tvalue,\n\tcolors,\n\tdisableCustomColors,\n\tenableAlpha,\n\tonChange,\n}: ColorOptionProps ) {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\tconst idRoot = useInstanceId( ColorOption, 'color-list-picker-option' );\n\tconst labelId = `${ idRoot }__label`;\n\tconst contentId = `${ idRoot }__content`;\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"components-color-list-picker__swatch-button\"\n\t\t\t\tid={ labelId }\n\t\t\t\tonClick={ () => setIsOpen( ( prev ) => ! prev ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\taria-controls={ contentId }\n\t\t\t\ticon={\n\t\t\t\t\tvalue ? (\n\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\tcolorValue={ value }\n\t\t\t\t\t\t\tclassName=\"components-color-list-picker__swatch-color\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Icon icon={ swatch } />\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\ttext={ label }\n\t\t\t/>\n\t\t\t<div\n\t\t\t\trole=\"group\"\n\t\t\t\tid={ contentId }\n\t\t\t\taria-labelledby={ labelId }\n\t\t\t\taria-hidden={ ! isOpen }\n\t\t\t>\n\t\t\t\t{ isOpen && (\n\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\taria-label={ __( 'Color options' ) }\n\t\t\t\t\t\tclassName=\"components-color-list-picker__color-picker\"\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nfunction ColorListPicker( {\n\tcolors,\n\tlabels,\n\tvalue = [],\n\tdisableCustomColors,\n\tenableAlpha,\n\tonChange,\n}: ColorListPickerProps ) {\n\treturn (\n\t\t<div className=\"components-color-list-picker\">\n\t\t\t{ labels.map( ( label, index ) => (\n\t\t\t\t<ColorOption\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tvalue={ value[ index ] }\n\t\t\t\t\tcolors={ colors }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\tonChange={ ( newColor ) => {\n\t\t\t\t\t\tconst newColors: ( string | undefined )[] =\n\t\t\t\t\t\t\tvalue.slice();\n\t\t\t\t\t\tnewColors[ index ] = newColor;\n\t\t\t\t\t\tonChange( newColors );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n\nexport default ColorListPicker;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AACjC,OAAOC,YAAY,MAAM,qBAAqB;AAC9C,OAAOC,cAAc,MAAM,uBAAuB;AAClD,OAAOC,IAAI,MAAM,YAAY;AAE7B,SAASC,aAAa,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnD,SAASC,WAAWA,CAAE;EACrBC,KAAK;EACLC,KAAK;EACLC,MAAM;EACNC,mBAAmB;EACnBC,WAAW;EACXC;AACiB,CAAC,EAAG;EACrB,MAAM,CAAEC,MAAM,EAAEC,SAAS,CAAE,GAAGtB,QAAQ,CAAE,KAAM,CAAC;EAC/C,MAAMuB,MAAM,GAAGhB,aAAa,CAAEO,WAAW,EAAE,0BAA2B,CAAC;EACvE,MAAMU,OAAO,GAAG,GAAID,MAAM,SAAU;EACpC,MAAME,SAAS,GAAG,GAAIF,MAAM,WAAY;EAExC,oBACCV,KAAA,CAAAF,SAAA;IAAAe,QAAA,gBACCjB,IAAA,CAACN,MAAM;MACNwB,q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A,MAAQ;MACjBC,mBAAmB,EAAGA,mBAAqB;MAC3CC,WAAW,EAAGA,WAAa;MAC3BC,QAAQ,EAAKqB,QAAQ,IAAM;QAC1B,MAAMC,SAAmC,GACxC1B,KAAK,CAAC2B,KAAK,CAAC,CAAC;QACdD,SAAS,CAAEF,KAAK,CAAE,GAAGC,QAAQ;QAC7BrB,QAAQ,CAAEsB,SAAU,CAAC;MACtB;IAAG,GAXGF,KAYN,CACA;EAAC,CACC,CAAC;AAER;AAEA,eAAeH,eAAe","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["fastDeepEqual","useMemo","__","sprintf","ColorListPicker","CircularOptionPicker","VStack","CustomDuotoneBar","getDefaultColors","getGradientFromCSSColors","Spacer","jsx","_jsx","jsxs","_jsxs","DuotonePicker","asButtons","loop","clearable","unsetable","colorPalette","duotonePalette","disableCustomColors","disableCustomDuotone","value","onChange","ariaLabel","ariaLabelledby","otherProps","defaultDark","defaultLight","isUnset","unsetOptionLabel","unsetOption","Option","isSelected","tooltipText","className","onClick","undefined","duotoneOptions","map","colors","slug","name","style","background","color","label","metaProps","_metaProps","options","actions","ButtonAction","accessibleWhenDisabled","disabled","children","paddingTop","length","spacing","labels","enableAlpha","newColors","newValue"],"sources":["@wordpress/components/src/duotone-picker/duotone-picker.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ColorListPicker from './color-list-picker';\nimport CircularOptionPicker from '../circular-option-picker';\nimport { VStack } from '../v-stack';\n\nimport CustomDuotoneBar from './custom-duotone-bar';\nimport { getDefaultColors, getGradientFromCSSColors } from './utils';\nimport { Spacer } from '../spacer';\nimport type { DuotonePickerProps } from './types';\n\n/**\n * ```jsx\n * import { DuotonePicker, DuotoneSwatch } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const DUOTONE_PALETTE = [\n * \t{ colors: [ '#8c00b7', '#fcff41' ], name: 'Purple and yellow', slug: 'purple-yellow' },\n * \t{ colors: [ '#000097', '#ff4747' ], name: 'Blue and red', slug: 'blue-red' },\n * ];\n *\n * const COLOR_PALETTE = [\n * \t{ color: '#ff4747', name: 'Red', slug: 'red' },\n * \t{ color: '#fcff41', name: 'Yellow', slug: 'yellow' },\n * \t{ color: '#000097', name: 'Blue', slug: 'blue' },\n * \t{ color: '#8c00b7', name: 'Purple', slug: 'purple' },\n * ];\n *\n * const Example = () => {\n * \tconst [ duotone, setDuotone ] = useState( [ '#000000', '#ffffff' ] );\n * \treturn (\n * \t\t<>\n * \t\t\t<DuotonePicker\n * \t\t\t\tduotonePalette={ DUOTONE_PALETTE }\n * \t\t\t\tcolorPalette={ COLOR_PALETTE }\n * \t\t\t\tvalue={ duotone }\n * \t\t\t\tonChange={ setDuotone }\n * \t\t\t/>\n * \t\t\t<DuotoneSwatch values={ duotone } />\n * \t\t</>\n * \t);\n * };\n * ```\n */\nfunction DuotonePicker( {\n\tasButtons,\n\tloop,\n\tclearable = true,\n\tunsetable = true,\n\tcolorPalette,\n\tduotonePalette,\n\tdisableCustomColors,\n\tdisableCustomDuotone,\n\tvalue,\n\tonChange,\n\t'aria-label': ariaLabel,\n\t'aria-labelledby': ariaLabelledby,\n\t...otherProps\n}: DuotonePickerProps ) {\n\tconst [ defaultDark, defaultLight ] = useMemo(\n\t\t() => getDefaultColors( colorPalette ),\n\t\t[ colorPalette ]\n\t);\n\n\tconst isUnset = value === 'unset';\n\tconst unsetOptionLabel = __( 'Unset' );\n\n\tconst unsetOption = (\n\t\t<CircularOptionPicker.Option\n\t\t\tkey=\"unset\"\n\t\t\tvalue=\"unset\"\n\t\t\tisSelected={ isUnset }\n\t\t\ttooltipText={ unsetOptionLabel }\n\t\t\taria-label={ unsetOptionLabel }\n\t\t\tclassName=\"components-duotone-picker__color-indicator\"\n\t\t\tonClick={ () => {\n\t\t\t\tonChange( isUnset ? undefined : 'unset' );\n\t\t\t} }\n\t\t/>\n\t);\n\n\tconst duotoneOptions = duotonePalette.map( ( { colors, slug, name } ) => {\n\t\tconst style = {\n\t\t\tbackground: getGradientFromCSSColors( colors, '135deg' ),\n\t\t\tcolor: 'transparent',\n\t\t};\n\t\tconst tooltipText =\n\t\t\tname ??\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: duotone code e.g: \"dark-grayscale\" or \"7f7f7f-ffffff\".\n\t\t\t\t__( 'Duotone code: %s' ),\n\t\t\t\tslug\n\t\t\t);\n\t\tconst label = name\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: The name of the option e.g: \"Dark grayscale\".\n\t\t\t\t\t__( 'Duotone: %s' ),\n\t\t\t\t\tname\n\t\t\t )\n\t\t\t: tooltipText;\n\t\tconst isSelected = fastDeepEqual( colors, value );\n\n\t\treturn (\n\t\t\t<CircularOptionPicker.Option\n\t\t\t\tkey={ slug }\n\t\t\t\tvalue={ colors }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\taria-label={ label }\n\t\t\t\ttooltipText={ tooltipText }\n\t\t\t\tstyle={ style }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tonChange( isSelected ? undefined : colors );\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} );\n\n\tlet metaProps:\n\t\t| { asButtons: false; loop?: boolean; 'aria-label': string }\n\t\t| { asButtons: false; loop?: boolean; 'aria-labelledby': string }\n\t\t| { asButtons: true };\n\n\tif ( asButtons ) {\n\t\tmetaProps = { asButtons: true };\n\t} else {\n\t\tconst _metaProps: { asButtons: false; loop?: boolean } = {\n\t\t\tasButtons: false,\n\t\t\tloop,\n\t\t};\n\n\t\tif ( ariaLabel ) {\n\t\t\tmetaProps = { ..._metaProps, 'aria-label': ariaLabel };\n\t\t} else if ( ariaLabelledby ) {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-labelledby': ariaLabelledby,\n\t\t\t};\n\t\t} else {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-label': __( 'Custom color picker.' ),\n\t\t\t};\n\t\t}\n\t}\n\n\tconst options = unsetable\n\t\t? [ unsetOption, ...duotoneOptions ]\n\t\t: duotoneOptions;\n\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\t{ ...otherProps }\n\t\t\t{ ...metaProps }\n\t\t\toptions={ options }\n\t\t\tactions={\n\t\t\t\t!! clearable && (\n\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\tonClick={ () => onChange( undefined ) }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<Spacer paddingTop={ options.length === 0 ? 0 : 4 }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t{ ! disableCustomColors && ! disableCustomDuotone && (\n\t\t\t\t\t\t<CustomDuotoneBar\n\t\t\t\t\t\t\tvalue={ isUnset ? undefined : value }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! disableCustomDuotone && (\n\t\t\t\t\t\t<ColorListPicker\n\t\t\t\t\t\t\tlabels={ [ __( 'Shadows' ), __( 'Highlights' ) ] }\n\t\t\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\t\t\tvalue={ isUnset ? undefined : value }\n\t\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t\tonChange={ ( newColors ) => {\n\t\t\t\t\t\t\t\tif ( ! newColors[ 0 ] ) {\n\t\t\t\t\t\t\t\t\tnewColors[ 0 ] = defaultDark;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( ! newColors[ 1 ] ) {\n\t\t\t\t\t\t\t\t\tnewColors[ 1 ] = defaultLight;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst newValue =\n\t\t\t\t\t\t\t\t\tnewColors.length >= 2\n\t\t\t\t\t\t\t\t\t\t? newColors\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\t// @ts-expect-error TODO: The color arrays for a DuotonePicker should be a tuple of two colors,\n\t\t\t\t\t\t\t\t// but it's currently typed as a string[].\n\t\t\t\t\t\t\t\t// See also https://github.com/WordPress/gutenberg/pull/49060#discussion_r1136951035\n\t\t\t\t\t\t\t\tonChange( newValue );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t</Spacer>\n\t\t</CircularOptionPicker>\n\t);\n}\n\nexport default DuotonePicker;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,SAASC,MAAM,QAAQ,YAAY;AAEnC,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,SAASC,gBAAgB,EAAEC,wBAAwB,QAAQ,SAAS;AACpE,SAASC,MAAM,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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EzB;AAEA,eAAehD,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["fastDeepEqual","useMemo","__","sprintf","ColorListPicker","CircularOptionPicker","VStack","CustomDuotoneBar","getDefaultColors","getGradientFromCSSColors","Spacer","jsx","_jsx","jsxs","_jsxs","DuotonePicker","asButtons","loop","clearable","unsetable","colorPalette","duotonePalette","disableCustomColors","disableCustomDuotone","value","onChange","ariaLabel","ariaLabelledby","otherProps","defaultDark","defaultLight","isUnset","unsetOptionLabel","unsetOption","Option","isSelected","tooltipText","className","onClick","undefined","duotoneOptions","map","colors","slug","name","style","background","color","label","metaProps","_metaProps","options","actions","ButtonAction","accessibleWhenDisabled","disabled","children","paddingTop","length","spacing","labels","enableAlpha","newColors","newValue"],"sources":["@wordpress/components/src/duotone-picker/duotone-picker.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ColorListPicker from './color-list-picker';\nimport CircularOptionPicker from '../circular-option-picker';\nimport { VStack } from '../v-stack';\n\nimport CustomDuotoneBar from './custom-duotone-bar';\nimport { getDefaultColors, getGradientFromCSSColors } from './utils';\nimport { Spacer } from '../spacer';\nimport type { DuotonePickerProps } from './types';\n\n/**\n * ```jsx\n * import { DuotonePicker, DuotoneSwatch } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const DUOTONE_PALETTE = [\n * \t{ colors: [ '#8c00b7', '#fcff41' ], name: 'Purple and yellow', slug: 'purple-yellow' },\n * \t{ colors: [ '#000097', '#ff4747' ], name: 'Blue and red', slug: 'blue-red' },\n * ];\n *\n * const COLOR_PALETTE = [\n * \t{ color: '#ff4747', name: 'Red', slug: 'red' },\n * \t{ color: '#fcff41', name: 'Yellow', slug: 'yellow' },\n * \t{ color: '#000097', name: 'Blue', slug: 'blue' },\n * \t{ color: '#8c00b7', name: 'Purple', slug: 'purple' },\n * ];\n *\n * const Example = () => {\n * \tconst [ duotone, setDuotone ] = useState( [ '#000000', '#ffffff' ] );\n * \treturn (\n * \t\t<>\n * \t\t\t<DuotonePicker\n * \t\t\t\tduotonePalette={ DUOTONE_PALETTE }\n * \t\t\t\tcolorPalette={ COLOR_PALETTE }\n * \t\t\t\tvalue={ duotone }\n * \t\t\t\tonChange={ setDuotone }\n * \t\t\t/>\n * \t\t\t<DuotoneSwatch values={ duotone } />\n * \t\t</>\n * \t);\n * };\n * ```\n */\nfunction DuotonePicker( {\n\tasButtons,\n\tloop,\n\tclearable = true,\n\tunsetable = true,\n\tcolorPalette,\n\tduotonePalette,\n\tdisableCustomColors,\n\tdisableCustomDuotone,\n\tvalue,\n\tonChange,\n\t'aria-label': ariaLabel,\n\t'aria-labelledby': ariaLabelledby,\n\t...otherProps\n}: DuotonePickerProps ) {\n\tconst [ defaultDark, defaultLight ] = useMemo(\n\t\t() => getDefaultColors( colorPalette ),\n\t\t[ colorPalette ]\n\t);\n\n\tconst isUnset = value === 'unset';\n\tconst unsetOptionLabel = __( 'Unset' );\n\n\tconst unsetOption = (\n\t\t<CircularOptionPicker.Option\n\t\t\tkey=\"unset\"\n\t\t\tvalue=\"unset\"\n\t\t\tisSelected={ isUnset }\n\t\t\ttooltipText={ unsetOptionLabel }\n\t\t\taria-label={ unsetOptionLabel }\n\t\t\tclassName=\"components-duotone-picker__color-indicator\"\n\t\t\tonClick={ () => {\n\t\t\t\tonChange( isUnset ? undefined : 'unset' );\n\t\t\t} }\n\t\t/>\n\t);\n\n\tconst duotoneOptions = duotonePalette.map( ( { colors, slug, name } ) => {\n\t\tconst style = {\n\t\t\tbackground: getGradientFromCSSColors( colors, '135deg' ),\n\t\t\tcolor: 'transparent',\n\t\t};\n\t\tconst tooltipText =\n\t\t\tname ??\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: duotone code e.g: \"dark-grayscale\" or \"7f7f7f-ffffff\".\n\t\t\t\t__( 'Duotone code: %s' ),\n\t\t\t\tslug\n\t\t\t);\n\t\tconst label = name\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: The name of the option e.g: \"Dark grayscale\".\n\t\t\t\t\t__( 'Duotone: %s' ),\n\t\t\t\t\tname\n\t\t\t )\n\t\t\t: tooltipText;\n\t\tconst isSelected = fastDeepEqual( colors, value );\n\n\t\treturn (\n\t\t\t<CircularOptionPicker.Option\n\t\t\t\tkey={ slug }\n\t\t\t\tvalue={ colors }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\taria-label={ label }\n\t\t\t\ttooltipText={ tooltipText }\n\t\t\t\tstyle={ style }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tonChange( isSelected ? undefined : colors );\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} );\n\n\tlet metaProps:\n\t\t| { asButtons: false; loop?: boolean; 'aria-label': string }\n\t\t| { asButtons: false; loop?: boolean; 'aria-labelledby': string }\n\t\t| { asButtons: true };\n\n\tif ( asButtons ) {\n\t\tmetaProps = { asButtons: true };\n\t} else {\n\t\tconst _metaProps: { asButtons: false; loop?: boolean } = {\n\t\t\tasButtons: false,\n\t\t\tloop,\n\t\t};\n\n\t\tif ( ariaLabel ) {\n\t\t\tmetaProps = { ..._metaProps, 'aria-label': ariaLabel };\n\t\t} else if ( ariaLabelledby ) {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-labelledby': ariaLabelledby,\n\t\t\t};\n\t\t} else {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-label': __( 'Custom color picker.' ),\n\t\t\t};\n\t\t}\n\t}\n\n\tconst options = unsetable\n\t\t? [ unsetOption, ...duotoneOptions ]\n\t\t: duotoneOptions;\n\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\t{ ...otherProps }\n\t\t\t{ ...metaProps }\n\t\t\toptions={ options }\n\t\t\tactions={\n\t\t\t\t!! clearable && (\n\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\tonClick={ () => onChange( undefined ) }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<Spacer paddingTop={ options.length === 0 ? 0 : 4 }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t{ ! disableCustomColors && ! disableCustomDuotone && (\n\t\t\t\t\t\t<CustomDuotoneBar\n\t\t\t\t\t\t\tvalue={ isUnset ? undefined : value }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! disableCustomDuotone && (\n\t\t\t\t\t\t<ColorListPicker\n\t\t\t\t\t\t\tlabels={ [ __( 'Shadows' ), __( 'Highlights' ) ] }\n\t\t\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\t\t\tvalue={ isUnset ? undefined : value }\n\t\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t\tonChange={ ( newColors ) => {\n\t\t\t\t\t\t\t\tif ( ! newColors[ 0 ] ) {\n\t\t\t\t\t\t\t\t\tnewColors[ 0 ] = defaultDark;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( ! newColors[ 1 ] ) {\n\t\t\t\t\t\t\t\t\tnewColors[ 1 ] = defaultLight;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst newValue =\n\t\t\t\t\t\t\t\t\tnewColors.length >= 2\n\t\t\t\t\t\t\t\t\t\t? newColors\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\t// @ts-expect-error TODO: The color arrays for a DuotonePicker should be a tuple of two colors,\n\t\t\t\t\t\t\t\t// but it's currently typed as a string[].\n\t\t\t\t\t\t\t\t// See also https://github.com/WordPress/gutenberg/pull/49060#discussion_r1136951035\n\t\t\t\t\t\t\t\tonChange( newValue );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t</Spacer>\n\t\t</CircularOptionPicker>\n\t);\n}\n\nexport default DuotonePicker;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,SAASC,MAAM,QAAQ,YAAY;AAEnC,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,SAASC,gBAAgB,EAAEC,wBAAwB,QAAQ,SAAS;AACpE,SAASC,MAAM,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,aAAaA,CAAE;EACvBC,SAAS;EACTC,IAAI;EACJC,SAAS,GAAG,IAAI;EAChBC,SAAS,GAAG,IAAI;EAChBC,YAAY;EACZC,cAAc;EACdC,mBAAmB;EACnBC,oBAAoB;EACpBC,KAAK;EACLC,QAAQ;EACR,YAAY,EAAEC,SAAS;EACvB,iBAAiB,EAAEC,cAAc;EACjC,GAAGC;AACgB,CAAC,EAAG;EACvB,MAAM,CAAEC,WAAW,EAAEC,YAAY,CAAE,GAAG7B,OAAO,CAC5C,MAAMO,gBAAgB,CAAEY,YAAa,CAAC,EACtC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AmB,IAAI,CAAEC,oBAAoB,iBAChDX,IAAA,CAACL,gBAAgB;UAChBiB,KAAK,EAAGO,OAAO,GAAGQ,SAAS,GAAGf,KAAO;UACrCC,QAAQ,EAAGA;QAAU,CACrB,CACD,EACC,CAAEF,oBAAoB,iBACvBX,IAAA,CAACR,eAAe;UACfwD,MAAM,EAAG,CAAE1D,EAAE,CAAE,SAAU,CAAC,EAAEA,EAAE,CAAE,YAAa,CAAC,CAAI;UAClDwC,MAAM,EAAGtB,YAAc;UACvBI,KAAK,EAAGO,OAAO,GAAGQ,SAAS,GAAGf,KAAO;UACrCF,mBAAmB,EAAGA,mBAAqB;UAC3CuC,WAAW;UACXpC,QAAQ,EAAKqC,SAAS,IAAM;YAC3B,IAAK,CAAEA,SAAS,CAAE,CAAC,CAAE,EAAG;cACvBA,SAAS,CAAE,CAAC,CAAE,GAAGjC,WAAW;YAC7B;YACA,IAAK,CAAEiC,SAAS,CAAE,CAAC,CAAE,EAAG;cACvBA,SAAS,CAAE,CAAC,CAAE,GAAGhC,YAAY;YAC9B;YACA,MAAMiC,QAAQ,GACbD,SAAS,CAACJ,MAAM,IAAI,CAAC,GAClBI,SAAS,GACTvB,SAAS;YACb;YACA;YACA;YACAd,QAAQ,CAAEsC,QAAS,CAAC;UACrB;QAAG,CACH,CACD;MAAA,CACM;IAAC,CACF;EAAC,CACY,CAAC;AAEzB;AAEA,eAAehD,aAAa","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["colord","extend","namesPlugin","getDefaultColors","palette","length","map","color","brightness","reduce","min","max","current","getGradientFromCSSColors","colors","angle","l","stops","c","i","join","getColorStopsFromColors","position","getColorsFromColorStops","colorStops"],"sources":["@wordpress/components/src/duotone-picker/utils.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * Internal dependencies\n */\nimport type { DuotonePickerProps } from './types';\n\nextend( [ namesPlugin ] );\n\n/**\n * Object representation for a color.\n *\n * @typedef {Object} RGBColor\n * @property {number} r Red component of the color in the range [0,1].\n * @property {number} g Green component of the color in the range [0,1].\n * @property {number} b Blue component of the color in the range [0,1].\n */\n\n/**\n * Calculate the brightest and darkest values from a color palette.\n *\n * @param palette Color palette for the theme.\n *\n * @return Tuple of the darkest color and brightest color.\n */\nexport function getDefaultColors(\n\tpalette: DuotonePickerProps[ 'colorPalette' ]\n) {\n\t// A default dark and light color are required.\n\tif ( ! palette || palette.length < 2 ) {\n\t\treturn [ '#000', '#fff' ];\n\t}\n\n\treturn palette\n\t\t.map( ( { color } ) => ( {\n\t\t\tcolor,\n\t\t\tbrightness: colord( color ).brightness(),\n\t\t} ) )\n\t\t.reduce(\n\t\t\t( [ min, max ], current ) => {\n\t\t\t\treturn [\n\t\t\t\t\tcurrent.brightness <= min.brightness ? current : min,\n\t\t\t\t\tcurrent.brightness >= max.brightness ? current : max,\n\t\t\t\t];\n\t\t\t},\n\t\t\t[\n\t\t\t\t{ brightness: 1, color: '' },\n\t\t\t\t{ brightness: 0, color: '' },\n\t\t\t]\n\t\t)\n\t\t.map( ( { color } ) => color );\n}\n\n/**\n * Generate a duotone gradient from a list of colors.\n *\n * @param colors CSS color strings.\n * @param angle CSS gradient angle.\n *\n * @return CSS gradient string for the duotone swatch.\n */\nexport function getGradientFromCSSColors(\n\tcolors: string[] = [],\n\tangle = '90deg'\n) {\n\tconst l = 100 / colors.length;\n\n\tconst stops = colors\n\t\t.map( ( c, i ) => `${ c } ${ i * l }%, ${ c } ${ ( i + 1 ) * l }%` )\n\t\t.join( ', ' );\n\n\treturn `linear-gradient( ${ angle }, ${ stops } )`;\n}\n\n/**\n * Convert a color array to an array of color stops.\n *\n * @param colors CSS colors array\n *\n * @return Color stop information.\n */\nexport function getColorStopsFromColors( colors: string[] ) {\n\treturn colors.map( ( color, i ) => ( {\n\t\tposition: ( i * 100 ) / ( colors.length - 1 ),\n\t\tcolor,\n\t} ) );\n}\n\n/**\n * Convert a color stop array to an array colors.\n *\n * @param colorStops Color stop information.\n *\n * @return CSS colors array.\n */\nexport function getColorsFromColorStops(\n\tcolorStops: { position: number; color: string }[] = []\n) {\n\treturn colorStops.map( ( { color } ) => color );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AACvC,OAAOC,WAAW,MAAM,sBAAsB;;AAE9C;AACA;AACA;;AAGAD,MAAM,CAAE,CAAEC,WAAW,CAAG,CAAC;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC/BC,OAA6C,EAC5C;EACD;EACA,IAAK,CAAEA,OAAO,IAAIA,OAAO,CAACC,MAAM,GAAG,CAAC,EAAG;IACtC,OAAO,CAAE,MAAM,EAAE,MAAM,CAAE;EAC1B;EAEA,OAAOD,OAAO,CACZE,GAAG,CAAE,CAAE;IAAEC;EAAM,CAAC,MAAQ;IACxBA,KAAK;IACLC,UAAU,EAAER,MAAM,CAAEO,KAAM,CAAC,CAACC,UAAU,CAAC;EACxC,CAAC,CAAG,CAAC,CACJC,MAAM,CACN,CAAE,CAAEC,GAAG,EAAEC,GAAG,CAAE,EAAEC,OAAO,KAAM;IAC5B,OAAO,CACNA,OAAO,CAACJ,UAAU,IAAIE,GAAG,CAACF,UAAU,GAAGI,OAAO,GAAGF,GAAG,EACpDE,OAAO,CAACJ,UAAU,IAAIG,GAAG,CAACH,UAAU,GAAGI,OAAO,GAAGD,GAAG,CACpD;EACF,CAAC,EACD,CACC;IAAEH,UAAU,EAAE,CAAC;IAAED,KAAK,EAAE;EAAG,CAAC,EAC5B;IAAEC,UAAU,EAAE,CAAC;IAAED,KAAK,EAAE;EAAG,CAAC,CAE9B,CAAC,CACAD,GAAG,CAAE,CAAE;IAAEC;EAAM,CAAC,KAAMA,KAAM,CAAC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,wBAAwBA,CACvCC,MAAgB,GAAG,EAAE,EACrBC,KAAK,GAAG,OAAO,EACd;EACD,MAAMC,CAAC,GAAG,GAAG,GAAGF,MAAM,CAACT,MAAM;EAE7B,MAAMY,KAAK,GAAGH,MAAM,CAClBR,GAAG,CAAE,CAAEY,CAAC,EAAEC,CAAC,KAAM,GAAID,CAAC,IAAMC,CAAC,GAAGH,CAAC,MAAQE,CAAC,IAAM,CAAEC,CAAC,GAAG,CAAC,IAAKH,CAAC,GAAK,CAAC,CACnEI,IAAI,CAAE,IAAK,CAAC;EAEd,OAAO,oBAAqBL,KAAK,KAAOE,KAAK,IAAK;AACnD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,uBAAuBA,CAAEP,MAAgB,EAAG;EAC3D,OAAOA,MAAM,CAACR,GAAG,CAAE,CAAEC,KAAK,EAAEY,CAAC,MAAQ;IACpCG,QAAQ,EAAIH,CAAC,GAAG,GAAG,IAAOL,MAAM,CAACT,MAAM,GAAG,CAAC,CAAE;IAC7CE;EACD,CAAC,CAAG,CAAC;AACN;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASgB,uBAAuBA,CACtCC,UAAiD,GAAG,EAAE,EACrD;EACD,OAAOA,UAAU,CAAClB,GAAG,CAAE,CAAE;IAAEC;EAAM,CAAC,KAAMA,KAAM,CAAC;AAChD","ignoreList":[]}
1
+ {"version":3,"names":["colord","extend","namesPlugin","getDefaultColors","palette","length","map","color","brightness","reduce","min","max","current","getGradientFromCSSColors","colors","angle","l","stops","c","i","join","getColorStopsFromColors","position","getColorsFromColorStops","colorStops"],"sources":["@wordpress/components/src/duotone-picker/utils.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * Internal dependencies\n */\nimport type { DuotonePickerProps } from './types';\n\nextend( [ namesPlugin ] );\n\n/**\n * Object representation for a color.\n *\n * @typedef {Object} RGBColor\n * @property {number} r Red component of the color in the range [0,1].\n * @property {number} g Green component of the color in the range [0,1].\n * @property {number} b Blue component of the color in the range [0,1].\n */\n\n/**\n * Calculate the brightest and darkest values from a color palette.\n *\n * @param palette Color palette for the theme.\n *\n * @return Tuple of the darkest color and brightest color.\n */\nexport function getDefaultColors(\n\tpalette: DuotonePickerProps[ 'colorPalette' ]\n) {\n\t// A default dark and light color are required.\n\tif ( ! palette || palette.length < 2 ) {\n\t\treturn [ '#000', '#fff' ];\n\t}\n\n\treturn palette\n\t\t.map( ( { color } ) => ( {\n\t\t\tcolor,\n\t\t\tbrightness: colord( color ).brightness(),\n\t\t} ) )\n\t\t.reduce(\n\t\t\t( [ min, max ], current ) => {\n\t\t\t\treturn [\n\t\t\t\t\tcurrent.brightness <= min.brightness ? current : min,\n\t\t\t\t\tcurrent.brightness >= max.brightness ? current : max,\n\t\t\t\t];\n\t\t\t},\n\t\t\t[\n\t\t\t\t{ brightness: 1, color: '' },\n\t\t\t\t{ brightness: 0, color: '' },\n\t\t\t]\n\t\t)\n\t\t.map( ( { color } ) => color );\n}\n\n/**\n * Generate a duotone gradient from a list of colors.\n *\n * @param colors CSS color strings.\n * @param angle CSS gradient angle.\n *\n * @return CSS gradient string for the duotone swatch.\n */\nexport function getGradientFromCSSColors(\n\tcolors: string[] = [],\n\tangle = '90deg'\n) {\n\tconst l = 100 / colors.length;\n\n\tconst stops = colors\n\t\t.map( ( c, i ) => `${ c } ${ i * l }%, ${ c } ${ ( i + 1 ) * l }%` )\n\t\t.join( ', ' );\n\n\treturn `linear-gradient( ${ angle }, ${ stops } )`;\n}\n\n/**\n * Convert a color array to an array of color stops.\n *\n * @param colors CSS colors array\n *\n * @return Color stop information.\n */\nexport function getColorStopsFromColors( colors: string[] ) {\n\treturn colors.map( ( color, i ) => ( {\n\t\tposition: ( i * 100 ) / ( colors.length - 1 ),\n\t\tcolor,\n\t} ) );\n}\n\n/**\n * Convert a color stop array to an array colors.\n *\n * @param colorStops Color stop information.\n *\n * @return CSS colors array.\n */\nexport function getColorsFromColorStops(\n\tcolorStops: { position: number; color: string }[] = []\n) {\n\treturn colorStops.map( ( { color } ) => color );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AACvC,OAAOC,WAAW,MAAM,sBAAsB;;AAE9C;AACA;AACA;;AAGAD,MAAM,CAAE,CAAEC,WAAW,CAAG,CAAC;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC/BC,OAA6C,EAC5C;EACD;EACA,IAAK,CAAEA,OAAO,IAAIA,OAAO,CAACC,MAAM,GAAG,CAAC,EAAG;IACtC,OAAO,CAAE,MAAM,EAAE,MAAM,CAAE;EAC1B;EAEA,OAAOD,OAAO,CACZE,GAAG,CAAE,CAAE;IAAEC;EAAM,CAAC,MAAQ;IACxBA,KAAK;IACLC,UAAU,EAAER,MAAM,CAAEO,KAAM,CAAC,CAACC,UAAU,CAAC;EACxC,CAAC,CAAG,CAAC,CACJC,MAAM,CACN,CAAE,CAAEC,GAAG,EAAEC,GAAG,CAAE,EAAEC,OAAO,KAAM;IAC5B,OAAO,CACNA,OAAO,CAACJ,UAAU,IAAIE,GAAG,CAACF,UAAU,GAAGI,OAAO,GAAGF,GAAG,EACpDE,OAAO,CAACJ,UAAU,IAAIG,GAAG,CAACH,UAAU,GAAGI,OAAO,GAAGD,GAAG,CACpD;EACF,CAAC,EACD,CACC;IAAEH,UAAU,EAAE,CAAC;IAAED,KAAK,EAAE;EAAG,CAAC,EAC5B;IAAEC,UAAU,EAAE,CAAC;IAAED,KAAK,EAAE;EAAG,CAAC,CAE9B,CAAC,CACAD,GAAG,CAAE,CAAE;IAAEC;EAAM,CAAC,KAAMA,KAAM,CAAC;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