@wordpress/components 25.6.1 → 26.0.1-next.5a1d1283.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (526) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/CONTRIBUTING.md +1 -1
  3. package/README.md +3 -8
  4. package/build/color-picker/hsv-color-picker.native.js +92 -0
  5. package/build/color-picker/hsv-color-picker.native.js.map +1 -0
  6. package/build/color-picker/hue-picker.native.js +195 -0
  7. package/build/color-picker/hue-picker.native.js.map +1 -0
  8. package/build/color-picker/index.native.js +3 -2
  9. package/build/color-picker/index.native.js.map +1 -1
  10. package/build/color-picker/saturation-picker.native.js +178 -0
  11. package/build/color-picker/saturation-picker.native.js.map +1 -0
  12. package/build/item-group/item/component.js +0 -1
  13. package/build/item-group/item/component.js.map +1 -1
  14. package/build/item-group/item-group/component.js +0 -1
  15. package/build/item-group/item-group/component.js.map +1 -1
  16. package/build/menu-item/index.js +6 -4
  17. package/build/menu-item/index.js.map +1 -1
  18. package/build/menu-item/types.js.map +1 -1
  19. package/build/mobile/link-settings/link-settings-navigation.native.js +1 -1
  20. package/build/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
  21. package/build/navigation/index.js +0 -1
  22. package/build/navigation/index.js.map +1 -1
  23. package/build/navigator/navigator-provider/component.js +1 -2
  24. package/build/navigator/navigator-provider/component.js.map +1 -1
  25. package/build/palette-edit/styles.js +10 -10
  26. package/build/palette-edit/styles.js.map +1 -1
  27. package/build/popover/index.js +38 -75
  28. package/build/popover/index.js.map +1 -1
  29. package/build/popover/overlay-middlewares.js.map +1 -1
  30. package/build/popover/types.js.map +1 -1
  31. package/build/popover/utils.js +5 -50
  32. package/build/popover/utils.js.map +1 -1
  33. package/build/progress-bar/styles.js +6 -5
  34. package/build/progress-bar/styles.js.map +1 -1
  35. package/build/search-control/index.native.js +27 -24
  36. package/build/search-control/index.native.js.map +1 -1
  37. package/build/shortcut/index.js +13 -0
  38. package/build/shortcut/index.js.map +1 -1
  39. package/build/slot-fill/bubbles-virtually/slot-fill-context.js +3 -1
  40. package/build/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
  41. package/build/slot-fill/bubbles-virtually/slot.js +14 -8
  42. package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
  43. package/build/slot-fill/index.js +5 -0
  44. package/build/slot-fill/index.js.map +1 -1
  45. package/build/spinner/index.js +0 -1
  46. package/build/spinner/index.js.map +1 -1
  47. package/build/theme/index.js +0 -1
  48. package/build/theme/index.js.map +1 -1
  49. package/build/tools-panel/tools-panel/component.js +0 -1
  50. package/build/tools-panel/tools-panel/component.js.map +1 -1
  51. package/build/tools-panel/tools-panel-header/component.js +5 -1
  52. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  53. package/build/tree-select/index.js +0 -1
  54. package/build/tree-select/index.js.map +1 -1
  55. package/build/unit-control/index.js +0 -1
  56. package/build/unit-control/index.js.map +1 -1
  57. package/build/utils/hooks/use-cx.js +2 -1
  58. package/build/utils/hooks/use-cx.js.map +1 -1
  59. package/build/view/component.js +1 -2
  60. package/build/view/component.js.map +1 -1
  61. package/build-module/color-picker/hsv-color-picker.native.js +84 -0
  62. package/build-module/color-picker/hsv-color-picker.native.js.map +1 -0
  63. package/build-module/color-picker/hue-picker.native.js +185 -0
  64. package/build-module/color-picker/hue-picker.native.js.map +1 -0
  65. package/build-module/color-picker/index.native.js +2 -1
  66. package/build-module/color-picker/index.native.js.map +1 -1
  67. package/build-module/color-picker/saturation-picker.native.js +168 -0
  68. package/build-module/color-picker/saturation-picker.native.js.map +1 -0
  69. package/build-module/item-group/item/component.js +0 -1
  70. package/build-module/item-group/item/component.js.map +1 -1
  71. package/build-module/item-group/item-group/component.js +0 -1
  72. package/build-module/item-group/item-group/component.js.map +1 -1
  73. package/build-module/menu-item/index.js +4 -2
  74. package/build-module/menu-item/index.js.map +1 -1
  75. package/build-module/menu-item/types.js.map +1 -1
  76. package/build-module/mobile/link-settings/link-settings-navigation.native.js +1 -1
  77. package/build-module/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
  78. package/build-module/navigation/index.js +0 -1
  79. package/build-module/navigation/index.js.map +1 -1
  80. package/build-module/navigator/navigator-provider/component.js +1 -2
  81. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  82. package/build-module/palette-edit/styles.js +10 -10
  83. package/build-module/palette-edit/styles.js.map +1 -1
  84. package/build-module/popover/index.js +42 -79
  85. package/build-module/popover/index.js.map +1 -1
  86. package/build-module/popover/overlay-middlewares.js.map +1 -1
  87. package/build-module/popover/types.js.map +1 -1
  88. package/build-module/popover/utils.js +4 -47
  89. package/build-module/popover/utils.js.map +1 -1
  90. package/build-module/progress-bar/styles.js +6 -5
  91. package/build-module/progress-bar/styles.js.map +1 -1
  92. package/build-module/search-control/index.native.js +28 -25
  93. package/build-module/search-control/index.native.js.map +1 -1
  94. package/build-module/shortcut/index.js +13 -0
  95. package/build-module/shortcut/index.js.map +1 -1
  96. package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js +3 -1
  97. package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
  98. package/build-module/slot-fill/bubbles-virtually/slot.js +14 -8
  99. package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
  100. package/build-module/slot-fill/index.js +6 -1
  101. package/build-module/slot-fill/index.js.map +1 -1
  102. package/build-module/spinner/index.js +0 -1
  103. package/build-module/spinner/index.js.map +1 -1
  104. package/build-module/theme/index.js +0 -1
  105. package/build-module/theme/index.js.map +1 -1
  106. package/build-module/tools-panel/tools-panel/component.js +0 -1
  107. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  108. package/build-module/tools-panel/tools-panel-header/component.js +5 -1
  109. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  110. package/build-module/tree-select/index.js +0 -1
  111. package/build-module/tree-select/index.js.map +1 -1
  112. package/build-module/unit-control/index.js +0 -1
  113. package/build-module/unit-control/index.js.map +1 -1
  114. package/build-module/utils/hooks/use-cx.js +2 -1
  115. package/build-module/utils/hooks/use-cx.js.map +1 -1
  116. package/build-module/view/component.js +1 -2
  117. package/build-module/view/component.js.map +1 -1
  118. package/build-types/alignment-matrix-control/stories/index.story.d.ts +2 -2
  119. package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
  120. package/build-types/angle-picker-control/stories/index.story.d.ts +2 -2
  121. package/build-types/angle-picker-control/stories/index.story.d.ts.map +1 -1
  122. package/build-types/animate/stories/index.story.d.ts +9 -9
  123. package/build-types/animate/stories/index.story.d.ts.map +1 -1
  124. package/build-types/base-control/stories/index.story.d.ts +4 -4
  125. package/build-types/base-control/stories/index.story.d.ts.map +1 -1
  126. package/build-types/border-box-control/stories/index.story.d.ts +2 -2
  127. package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
  128. package/build-types/border-control/stories/index.story.d.ts +2 -2
  129. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  130. package/build-types/button/stories/e2e/index.story.d.ts +3 -3
  131. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  132. package/build-types/button/stories/index.story.d.ts +10 -9
  133. package/build-types/button/stories/index.story.d.ts.map +1 -1
  134. package/build-types/button-group/stories/index.story.d.ts +3 -3
  135. package/build-types/button-group/stories/index.story.d.ts.map +1 -1
  136. package/build-types/card/stories/index.story.d.ts +2 -2
  137. package/build-types/card/stories/index.story.d.ts.map +1 -1
  138. package/build-types/checkbox-control/stories/index.story.d.ts +4 -4
  139. package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
  140. package/build-types/circular-option-picker/stories/index.story.d.ts +2 -2
  141. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  142. package/build-types/color-indicator/stories/index.story.d.ts +3 -3
  143. package/build-types/color-indicator/stories/index.story.d.ts.map +1 -1
  144. package/build-types/color-palette/stories/index.story.d.ts +3 -3
  145. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  146. package/build-types/color-palette/styles.d.ts +1 -1
  147. package/build-types/color-picker/stories/index.story.d.ts +2 -2
  148. package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
  149. package/build-types/combobox-control/stories/index.story.d.ts +2 -2
  150. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  151. package/build-types/custom-gradient-picker/stories/index.story.d.ts +2 -2
  152. package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
  153. package/build-types/date-time/date/styles.d.ts +1 -1
  154. package/build-types/date-time/stories/date-time.story.d.ts +5 -5
  155. package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
  156. package/build-types/date-time/stories/date.story.d.ts +5 -5
  157. package/build-types/date-time/stories/date.story.d.ts.map +1 -1
  158. package/build-types/date-time/stories/time.story.d.ts +3 -3
  159. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  160. package/build-types/dimension-control/stories/index.story.d.ts.map +1 -1
  161. package/build-types/disabled/stories/index.story.d.ts +4 -4
  162. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  163. package/build-types/divider/stories/index.story.d.ts +5 -5
  164. package/build-types/divider/stories/index.story.d.ts.map +1 -1
  165. package/build-types/draggable/stories/index.story.d.ts +4 -4
  166. package/build-types/draggable/stories/index.story.d.ts.map +1 -1
  167. package/build-types/drop-zone/stories/index.story.d.ts +2 -2
  168. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  169. package/build-types/dropdown/stories/index.story.d.ts +6 -5
  170. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  171. package/build-types/dropdown-menu/stories/index.story.d.ts +2 -2
  172. package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
  173. package/build-types/dropdown-menu-v2/stories/index.story.d.ts +2 -2
  174. package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -1
  175. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +2 -2
  176. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts.map +1 -1
  177. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts +2 -2
  178. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
  179. package/build-types/elevation/stories/index.story.d.ts +5 -5
  180. package/build-types/elevation/stories/index.story.d.ts.map +1 -1
  181. package/build-types/external-link/stories/index.story.d.ts +3 -3
  182. package/build-types/external-link/stories/index.story.d.ts.map +1 -1
  183. package/build-types/flex/stories/index.story.d.ts +4 -4
  184. package/build-types/flex/stories/index.story.d.ts.map +1 -1
  185. package/build-types/focal-point-picker/stories/index.story.d.ts +2 -2
  186. package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
  187. package/build-types/font-size-picker/stories/e2e/index.story.d.ts +2 -2
  188. package/build-types/font-size-picker/stories/e2e/index.story.d.ts.map +1 -1
  189. package/build-types/font-size-picker/stories/index.story.d.ts +8 -8
  190. package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
  191. package/build-types/form-file-upload/stories/index.story.d.ts +2 -2
  192. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  193. package/build-types/form-toggle/stories/index.story.d.ts +3 -3
  194. package/build-types/form-toggle/stories/index.story.d.ts.map +1 -1
  195. package/build-types/form-token-field/stories/index.story.d.ts +7 -7
  196. package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
  197. package/build-types/gradient-picker/stories/index.story.d.ts +2 -2
  198. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  199. package/build-types/grid/stories/index.story.d.ts +3 -3
  200. package/build-types/grid/stories/index.story.d.ts.map +1 -1
  201. package/build-types/guide/stories/index.story.d.ts +2 -2
  202. package/build-types/guide/stories/index.story.d.ts.map +1 -1
  203. package/build-types/h-stack/stories/e2e/index.story.d.ts +3 -3
  204. package/build-types/h-stack/stories/e2e/index.story.d.ts.map +1 -1
  205. package/build-types/h-stack/stories/index.story.d.ts +3 -3
  206. package/build-types/h-stack/stories/index.story.d.ts.map +1 -1
  207. package/build-types/heading/stories/index.story.d.ts +3 -3
  208. package/build-types/heading/stories/index.story.d.ts.map +1 -1
  209. package/build-types/icon/stories/index.story.d.ts +4 -4
  210. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  211. package/build-types/input-control/stories/index.story.d.ts +2 -2
  212. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  213. package/build-types/item-group/item/component.d.ts +0 -1
  214. package/build-types/item-group/item/component.d.ts.map +1 -1
  215. package/build-types/item-group/item-group/component.d.ts +0 -1
  216. package/build-types/item-group/item-group/component.d.ts.map +1 -1
  217. package/build-types/item-group/stories/index.story.d.ts +6 -6
  218. package/build-types/item-group/stories/index.story.d.ts.map +1 -1
  219. package/build-types/keyboard-shortcuts/stories/index.story.d.ts +2 -2
  220. package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
  221. package/build-types/menu-group/stories/index.story.d.ts +3 -3
  222. package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
  223. package/build-types/menu-item/index.d.ts +5 -58
  224. package/build-types/menu-item/index.d.ts.map +1 -1
  225. package/build-types/menu-item/stories/index.story.d.ts +74 -0
  226. package/build-types/menu-item/stories/index.story.d.ts.map +1 -0
  227. package/build-types/menu-item/types.d.ts +3 -2
  228. package/build-types/menu-item/types.d.ts.map +1 -1
  229. package/build-types/menu-items-choice/stories/index.story.d.ts +3 -3
  230. package/build-types/menu-items-choice/stories/index.story.d.ts.map +1 -1
  231. package/build-types/modal/stories/index.story.d.ts +4 -4
  232. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  233. package/build-types/navigable-container/stories/navigable-menu.story.d.ts +3 -3
  234. package/build-types/navigable-container/stories/navigable-menu.story.d.ts.map +1 -1
  235. package/build-types/navigable-container/stories/tabbable-container.story.d.ts +3 -3
  236. package/build-types/navigable-container/stories/tabbable-container.story.d.ts.map +1 -1
  237. package/build-types/navigation/index.d.ts +0 -1
  238. package/build-types/navigation/index.d.ts.map +1 -1
  239. package/build-types/navigation/stories/index.story.d.ts +2 -2
  240. package/build-types/navigation/stories/index.story.d.ts.map +1 -1
  241. package/build-types/navigation/stories/utils/controlled-state.d.ts +2 -2
  242. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -1
  243. package/build-types/navigation/stories/utils/default.d.ts +2 -2
  244. package/build-types/navigation/stories/utils/default.d.ts.map +1 -1
  245. package/build-types/navigation/stories/utils/group.d.ts +2 -2
  246. package/build-types/navigation/stories/utils/group.d.ts.map +1 -1
  247. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +2 -2
  248. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -1
  249. package/build-types/navigation/stories/utils/more-examples.d.ts +2 -2
  250. package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -1
  251. package/build-types/navigation/stories/utils/search.d.ts +2 -2
  252. package/build-types/navigation/stories/utils/search.d.ts.map +1 -1
  253. package/build-types/navigation/styles/navigation-styles.d.ts +1 -1
  254. package/build-types/navigator/navigator-provider/component.d.ts +0 -1
  255. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  256. package/build-types/navigator/stories/index.story.d.ts +5 -5
  257. package/build-types/navigator/stories/index.story.d.ts.map +1 -1
  258. package/build-types/notice/stories/index.story.d.ts +3 -3
  259. package/build-types/notice/stories/index.story.d.ts.map +1 -1
  260. package/build-types/number-control/stories/index.story.d.ts +2 -2
  261. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  262. package/build-types/palette-edit/stories/index.story.d.ts +2 -2
  263. package/build-types/palette-edit/stories/index.story.d.ts.map +1 -1
  264. package/build-types/palette-edit/styles.d.ts +1 -1
  265. package/build-types/palette-edit/styles.d.ts.map +1 -1
  266. package/build-types/panel/stories/index.story.d.ts +6 -6
  267. package/build-types/panel/stories/index.story.d.ts.map +1 -1
  268. package/build-types/placeholder/stories/index.story.d.ts +3 -3
  269. package/build-types/placeholder/stories/index.story.d.ts.map +1 -1
  270. package/build-types/popover/index.d.ts.map +1 -1
  271. package/build-types/popover/overlay-middlewares.d.ts +2 -2
  272. package/build-types/popover/overlay-middlewares.d.ts.map +1 -1
  273. package/build-types/popover/stories/index.story.d.ts +7 -7
  274. package/build-types/popover/stories/index.story.d.ts.map +1 -1
  275. package/build-types/popover/types.d.ts +6 -0
  276. package/build-types/popover/types.d.ts.map +1 -1
  277. package/build-types/popover/utils.d.ts +1 -21
  278. package/build-types/popover/utils.d.ts.map +1 -1
  279. package/build-types/progress-bar/stories/index.story.d.ts +3 -3
  280. package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
  281. package/build-types/progress-bar/styles.d.ts.map +1 -1
  282. package/build-types/query-controls/stories/index.story.d.ts +4 -4
  283. package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
  284. package/build-types/radio-control/stories/index.story.d.ts +3 -3
  285. package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
  286. package/build-types/range-control/stories/index.story.d.ts +9 -9
  287. package/build-types/range-control/stories/index.story.d.ts.map +1 -1
  288. package/build-types/resizable-box/stories/index.story.d.ts +2 -2
  289. package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
  290. package/build-types/responsive-wrapper/stories/index.story.d.ts +3 -3
  291. package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
  292. package/build-types/sandbox/stories/index.story.d.ts +2 -2
  293. package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
  294. package/build-types/scroll-lock/stories/index.story.d.ts +3 -3
  295. package/build-types/scroll-lock/stories/index.story.d.ts.map +1 -1
  296. package/build-types/scrollable/stories/index.story.d.ts +3 -3
  297. package/build-types/scrollable/stories/index.story.d.ts.map +1 -1
  298. package/build-types/search-control/stories/index.story.d.ts +2 -2
  299. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  300. package/build-types/select-control/stories/index.story.d.ts +2 -2
  301. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  302. package/build-types/shortcut/index.d.ts +13 -0
  303. package/build-types/shortcut/index.d.ts.map +1 -1
  304. package/build-types/shortcut/stories/index.story.d.ts +13 -0
  305. package/build-types/shortcut/stories/index.story.d.ts.map +1 -0
  306. package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts +1 -0
  307. package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -1
  308. package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -6
  309. package/build-types/slot-fill/index.d.ts +1 -1
  310. package/build-types/slot-fill/index.d.ts.map +1 -1
  311. package/build-types/snackbar/stories/index.story.d.ts +7 -7
  312. package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
  313. package/build-types/snackbar/stories/list.story.d.ts +3 -3
  314. package/build-types/snackbar/stories/list.story.d.ts.map +1 -1
  315. package/build-types/spacer/stories/index.story.d.ts +3 -3
  316. package/build-types/spacer/stories/index.story.d.ts.map +1 -1
  317. package/build-types/spinner/index.d.ts +0 -1
  318. package/build-types/spinner/index.d.ts.map +1 -1
  319. package/build-types/spinner/stories/index.story.d.ts +4 -4
  320. package/build-types/spinner/stories/index.story.d.ts.map +1 -1
  321. package/build-types/surface/stories/index.story.d.ts +3 -3
  322. package/build-types/surface/stories/index.story.d.ts.map +1 -1
  323. package/build-types/tab-panel/stories/index.story.d.ts +2 -2
  324. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  325. package/build-types/text-control/stories/index.story.d.ts +4 -4
  326. package/build-types/text-control/stories/index.story.d.ts.map +1 -1
  327. package/build-types/text-highlight/stories/index.story.d.ts +3 -3
  328. package/build-types/text-highlight/stories/index.story.d.ts.map +1 -1
  329. package/build-types/textarea-control/stories/index.story.d.ts +3 -3
  330. package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
  331. package/build-types/theme/index.d.ts +0 -1
  332. package/build-types/theme/index.d.ts.map +1 -1
  333. package/build-types/theme/stories/index.story.d.ts +4 -4
  334. package/build-types/theme/stories/index.story.d.ts.map +1 -1
  335. package/build-types/tip/stories/index.story.d.ts +3 -3
  336. package/build-types/tip/stories/index.story.d.ts.map +1 -1
  337. package/build-types/toggle-control/stories/index.story.d.ts +2 -2
  338. package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
  339. package/build-types/toggle-group-control/stories/index.story.d.ts +6 -6
  340. package/build-types/toggle-group-control/stories/index.story.d.ts.map +1 -1
  341. package/build-types/toolbar/stories/index.story.d.ts +2 -2
  342. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  343. package/build-types/tools-panel/stories/index.story.d.ts +8 -8
  344. package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
  345. package/build-types/tools-panel/tools-panel/component.d.ts +0 -1
  346. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  347. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  348. package/build-types/tree-grid/stories/index.story.d.ts +2 -2
  349. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  350. package/build-types/tree-select/index.d.ts +0 -1
  351. package/build-types/tree-select/index.d.ts.map +1 -1
  352. package/build-types/tree-select/stories/index.story.d.ts +2 -2
  353. package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
  354. package/build-types/truncate/stories/index.story.d.ts +4 -4
  355. package/build-types/truncate/stories/index.story.d.ts.map +1 -1
  356. package/build-types/unit-control/index.d.ts +0 -1
  357. package/build-types/unit-control/index.d.ts.map +1 -1
  358. package/build-types/unit-control/stories/index.story.d.ts +7 -7
  359. package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
  360. package/build-types/utils/hooks/use-cx.d.ts +2 -1
  361. package/build-types/utils/hooks/use-cx.d.ts.map +1 -1
  362. package/build-types/v-stack/stories/e2e/index.story.d.ts +3 -3
  363. package/build-types/v-stack/stories/e2e/index.story.d.ts.map +1 -1
  364. package/build-types/v-stack/stories/index.story.d.ts +2 -2
  365. package/build-types/v-stack/stories/index.story.d.ts.map +1 -1
  366. package/build-types/view/component.d.ts +0 -1
  367. package/build-types/view/component.d.ts.map +1 -1
  368. package/build-types/view/stories/index.story.d.ts +3 -3
  369. package/build-types/view/stories/index.story.d.ts.map +1 -1
  370. package/build-types/visually-hidden/stories/index.story.d.ts +5 -5
  371. package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
  372. package/build-types/z-stack/stories/index.story.d.ts +3 -3
  373. package/build-types/z-stack/stories/index.story.d.ts.map +1 -1
  374. package/package.json +20 -20
  375. package/src/alignment-matrix-control/stories/index.story.tsx +7 -3
  376. package/src/angle-picker-control/stories/index.story.tsx +3 -3
  377. package/src/animate/stories/index.story.tsx +12 -10
  378. package/src/base-control/stories/index.story.tsx +5 -9
  379. package/src/border-box-control/stories/index.story.tsx +5 -9
  380. package/src/border-control/stories/index.story.tsx +8 -14
  381. package/src/button/stories/e2e/index.story.tsx +3 -3
  382. package/src/button/stories/index.story.tsx +10 -10
  383. package/src/button-group/stories/index.story.tsx +4 -6
  384. package/src/card/stories/index.story.tsx +5 -5
  385. package/src/checkbox-control/stories/index.story.tsx +7 -6
  386. package/src/circular-option-picker/stories/index.story.tsx +16 -4
  387. package/src/color-indicator/stories/index.story.tsx +4 -6
  388. package/src/color-palette/stories/index.story.tsx +12 -21
  389. package/src/color-picker/hsv-color-picker.native.js +88 -0
  390. package/src/color-picker/hue-picker.native.js +194 -0
  391. package/src/color-picker/index.native.js +2 -1
  392. package/src/color-picker/saturation-picker.native.js +163 -0
  393. package/src/color-picker/stories/index.story.tsx +3 -3
  394. package/src/color-picker/style.native.scss +23 -0
  395. package/src/combobox-control/stories/index.story.tsx +3 -3
  396. package/src/custom-gradient-picker/stories/index.story.tsx +3 -3
  397. package/src/date-time/stories/date-time.story.tsx +8 -10
  398. package/src/date-time/stories/date.story.tsx +8 -9
  399. package/src/date-time/stories/time.story.tsx +4 -4
  400. package/src/dimension-control/stories/index.story.tsx +3 -3
  401. package/src/disabled/stories/index.story.tsx +4 -4
  402. package/src/divider/stories/index.story.tsx +6 -6
  403. package/src/draggable/stories/index.story.tsx +5 -7
  404. package/src/drop-zone/stories/index.story.tsx +3 -3
  405. package/src/dropdown/stories/index.story.tsx +8 -6
  406. package/src/dropdown-menu/stories/index.story.tsx +3 -3
  407. package/src/dropdown-menu-v2/stories/index.story.tsx +24 -10
  408. package/src/duotone-picker/stories/duotone-picker.story.tsx +3 -6
  409. package/src/duotone-picker/stories/duotone-swatch.story.tsx +3 -3
  410. package/src/elevation/stories/index.story.tsx +7 -7
  411. package/src/external-link/stories/index.story.tsx +4 -6
  412. package/src/flex/stories/index.story.tsx +6 -6
  413. package/src/focal-point-picker/stories/index.story.tsx +3 -3
  414. package/src/font-size-picker/stories/e2e/index.story.tsx +3 -3
  415. package/src/font-size-picker/stories/index.story.tsx +10 -10
  416. package/src/form-file-upload/stories/index.story.tsx +3 -3
  417. package/src/form-toggle/stories/index.story.tsx +4 -7
  418. package/src/form-token-field/stories/index.story.tsx +10 -11
  419. package/src/gradient-picker/stories/index.story.tsx +3 -3
  420. package/src/grid/stories/index.story.tsx +4 -4
  421. package/src/guide/stories/index.story.tsx +3 -3
  422. package/src/h-stack/stories/e2e/index.story.tsx +4 -4
  423. package/src/h-stack/stories/index.story.tsx +4 -4
  424. package/src/heading/stories/index.story.tsx +3 -3
  425. package/src/icon/stories/index.story.tsx +5 -5
  426. package/src/input-control/stories/index.story.tsx +5 -3
  427. package/src/item-group/item/component.tsx +0 -1
  428. package/src/item-group/item-group/component.tsx +0 -1
  429. package/src/item-group/stories/index.story.tsx +11 -12
  430. package/src/keyboard-shortcuts/stories/index.story.tsx +3 -3
  431. package/src/menu-group/stories/index.story.tsx +5 -5
  432. package/src/menu-item/README.md +1 -1
  433. package/src/menu-item/index.tsx +5 -2
  434. package/src/menu-item/stories/index.story.tsx +80 -0
  435. package/src/menu-item/types.ts +3 -2
  436. package/src/menu-items-choice/stories/index.story.tsx +4 -6
  437. package/src/mobile/link-settings/link-settings-navigation.native.js +1 -1
  438. package/src/modal/stories/index.story.tsx +5 -10
  439. package/src/navigable-container/stories/navigable-menu.story.tsx +3 -3
  440. package/src/navigable-container/stories/tabbable-container.story.tsx +3 -3
  441. package/src/navigation/index.tsx +0 -1
  442. package/src/navigation/stories/index.story.tsx +16 -2
  443. package/src/navigation/stories/utils/controlled-state.tsx +2 -2
  444. package/src/navigation/stories/utils/default.tsx +2 -2
  445. package/src/navigation/stories/utils/group.tsx +2 -2
  446. package/src/navigation/stories/utils/hide-if-empty.tsx +2 -2
  447. package/src/navigation/stories/utils/more-examples.tsx +2 -2
  448. package/src/navigation/stories/utils/search.tsx +2 -2
  449. package/src/navigator/navigator-provider/component.tsx +0 -1
  450. package/src/navigator/stories/index.story.tsx +9 -10
  451. package/src/notice/stories/index.story.tsx +6 -6
  452. package/src/number-control/stories/index.story.tsx +3 -3
  453. package/src/palette-edit/stories/index.story.tsx +3 -3
  454. package/src/palette-edit/styles.js +0 -1
  455. package/src/panel/stories/index.story.tsx +9 -11
  456. package/src/placeholder/stories/index.story.tsx +4 -6
  457. package/src/popover/README.md +2 -2
  458. package/src/popover/index.tsx +69 -103
  459. package/src/popover/overlay-middlewares.tsx +2 -2
  460. package/src/popover/stories/index.story.tsx +8 -10
  461. package/src/popover/test/index.tsx +15 -1
  462. package/src/popover/types.ts +6 -0
  463. package/src/popover/utils.ts +5 -56
  464. package/src/progress-bar/stories/index.story.tsx +4 -6
  465. package/src/progress-bar/styles.ts +4 -1
  466. package/src/query-controls/stories/index.story.tsx +5 -6
  467. package/src/radio-control/stories/index.story.tsx +4 -6
  468. package/src/radio-group/stories/index.story.js +1 -0
  469. package/src/range-control/stories/index.story.tsx +12 -18
  470. package/src/resizable-box/stories/index.story.tsx +3 -3
  471. package/src/responsive-wrapper/stories/index.story.tsx +4 -5
  472. package/src/sandbox/stories/index.story.tsx +3 -5
  473. package/src/scroll-lock/stories/index.story.tsx +3 -3
  474. package/src/scrollable/stories/index.story.tsx +4 -4
  475. package/src/search-control/index.native.js +39 -27
  476. package/src/search-control/stories/index.story.tsx +3 -3
  477. package/src/select-control/stories/index.story.tsx +3 -3
  478. package/src/shortcut/index.tsx +13 -0
  479. package/src/shortcut/stories/index.story.tsx +33 -0
  480. package/src/slot-fill/README.md +5 -5
  481. package/src/slot-fill/bubbles-virtually/slot-fill-context.js +3 -0
  482. package/src/slot-fill/bubbles-virtually/slot.js +17 -5
  483. package/src/slot-fill/index.js +6 -1
  484. package/src/slot-fill/stories/index.story.js +2 -0
  485. package/src/slot-fill/test/__snapshots__/slot.js.snap +12 -4
  486. package/src/snackbar/stories/index.story.tsx +10 -13
  487. package/src/snackbar/stories/list.story.tsx +3 -3
  488. package/src/spacer/stories/index.story.tsx +4 -4
  489. package/src/spinner/index.tsx +0 -1
  490. package/src/spinner/stories/index.story.tsx +5 -5
  491. package/src/surface/stories/index.story.tsx +4 -4
  492. package/src/tab-panel/stories/index.story.tsx +5 -13
  493. package/src/tab-panel/test/index.tsx +9 -25
  494. package/src/text-control/stories/index.story.tsx +7 -6
  495. package/src/text-highlight/stories/index.story.tsx +4 -6
  496. package/src/textarea-control/stories/index.story.tsx +4 -6
  497. package/src/theme/index.tsx +0 -1
  498. package/src/theme/stories/index.story.tsx +5 -5
  499. package/src/tip/stories/index.story.tsx +4 -4
  500. package/src/toggle-control/stories/index.story.tsx +3 -3
  501. package/src/toggle-group-control/stories/index.story.tsx +17 -11
  502. package/src/toolbar/stories/index.story.tsx +13 -3
  503. package/src/tools-panel/stories/index.story.tsx +17 -12
  504. package/src/tools-panel/tools-panel/component.tsx +0 -1
  505. package/src/tools-panel/tools-panel-header/component.tsx +3 -0
  506. package/src/tree-grid/stories/index.story.tsx +5 -3
  507. package/src/tree-select/index.tsx +0 -1
  508. package/src/tree-select/stories/index.story.tsx +3 -3
  509. package/src/truncate/stories/index.story.tsx +5 -7
  510. package/src/unit-control/index.tsx +0 -1
  511. package/src/unit-control/stories/index.story.tsx +10 -9
  512. package/src/utils/hooks/use-cx.ts +2 -1
  513. package/src/v-stack/stories/e2e/index.story.tsx +4 -4
  514. package/src/v-stack/stories/index.story.tsx +3 -3
  515. package/src/view/component.tsx +0 -1
  516. package/src/view/stories/index.story.tsx +4 -4
  517. package/src/visually-hidden/stories/index.story.tsx +7 -7
  518. package/src/z-stack/stories/index.story.tsx +4 -4
  519. package/tsconfig.tsbuildinfo +1 -1
  520. package/build/popover/limit-shift.js +0 -129
  521. package/build/popover/limit-shift.js.map +0 -1
  522. package/build-module/popover/limit-shift.js +0 -122
  523. package/build-module/popover/limit-shift.js.map +0 -1
  524. package/build-types/popover/limit-shift.d.ts +0 -87
  525. package/build-types/popover/limit-shift.d.ts.map +0 -1
  526. package/src/popover/limit-shift.ts +0 -205
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_reactNative","_i18n","_components","_icons","_style","_interopRequireDefault","_platformStyle","baseStyles","allStyles","selector","platformStyles","selectModifiedStyles","styles","modifier","modifierMatcher","RegExp","modifierSelectors","Object","keys","filter","match","reduce","modifiedStyles","modifierSelector","blockElementSelector","split","mergeStyles","updateStyles","selectors","forEach","SearchControl","value","onChange","placeholder","__","isActive","setIsActive","useState","currentStyles","setCurrentStyles","isDark","useColorScheme","inputRef","useRef","onCancelTimer","isIOS","Platform","OS","darkStyles","useMemo","activeStyles","activeDarkStyles","useEffect","futureStyles","mergeFutureStyles","shouldUseConditions","shouldUseModified","every","should","updatedStyles","keyboardHideSubscription","Keyboard","addListener","onCancel","clearTimeout","current","remove","containerStyle","innerContainerStyle","inputContainerStyle","formInputStyle","placeholderStyle","inputButtonStyle","inputButtonLeftStyle","inputButtonRightStyle","cancelButtonStyle","cancelButtonTextStyle","iconStyle","rightIconStyle","clearInput","setTimeout","blur","renderLeftButton","button","createElement","Button","label","icon","arrowLeftIcon","onClick","style","Icon","Gridicons","search","fill","color","View","renderRightButton","cancelCircleFilledIcon","closeIcon","renderCancel","Text","onPress","accessible","accessibilityRole","accessibilityLabel","accessibilityHint","TouchableOpacity","focus","activeOpacity","TextInput","ref","placeholderTextColor","onChangeText","onFocus","_default","exports","default"],"sources":["@wordpress/components/src/search-control/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tTextInput,\n\tText,\n\tView,\n\tTouchableOpacity,\n\tPlatform,\n\tuseColorScheme,\n\tKeyboard,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useMemo, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button, Gridicons } from '@wordpress/components';\nimport {\n\tIcon,\n\tcancelCircleFilled as cancelCircleFilledIcon,\n\tarrowLeft as arrowLeftIcon,\n\tclose as closeIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport allStyles from './style.scss';\nimport platformStyles from './platform-style.scss';\n\n// Merge platform specific styles with the default styles.\nconst baseStyles = { ...allStyles };\nfor ( const selector in platformStyles ) {\n\tbaseStyles[ selector ] = {\n\t\t...baseStyles[ selector ],\n\t\t...platformStyles[ selector ],\n\t};\n}\n\nfunction selectModifiedStyles( styles, modifier ) {\n\tconst modifierMatcher = new RegExp( `--${ modifier }$` );\n\tconst modifierSelectors = Object.keys( styles ).filter( ( selector ) =>\n\t\tselector.match( modifierMatcher )\n\t);\n\n\treturn modifierSelectors.reduce( ( modifiedStyles, modifierSelector ) => {\n\t\tconst blockElementSelector = modifierSelector.split( '--' )[ 0 ];\n\t\tmodifiedStyles[ blockElementSelector ] = styles[ modifierSelector ];\n\t\treturn modifiedStyles;\n\t}, {} );\n}\n\nfunction mergeStyles( styles, updateStyles, selectors ) {\n\tselectors.forEach( ( selector ) => {\n\t\tstyles[ selector ] = {\n\t\t\t...styles[ selector ],\n\t\t\t...updateStyles[ selector ],\n\t\t};\n\t} );\n\n\treturn styles;\n}\n\nfunction SearchControl( {\n\tvalue,\n\tonChange,\n\tplaceholder = __( 'Search blocks' ),\n} ) {\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst [ currentStyles, setCurrentStyles ] = useState( baseStyles );\n\n\tconst isDark = useColorScheme() === 'dark';\n\tconst inputRef = useRef();\n\tconst onCancelTimer = useRef();\n\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst darkStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'dark' );\n\t}, [] );\n\n\tconst activeStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'active' );\n\t}, [] );\n\n\tconst activeDarkStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'active-dark' );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tlet futureStyles = { ...baseStyles };\n\n\t\tfunction mergeFutureStyles( modifiedStyles, shouldUseConditions ) {\n\t\t\tconst shouldUseModified = shouldUseConditions.every(\n\t\t\t\t( should ) => should\n\t\t\t);\n\n\t\t\tconst updatedStyles = shouldUseModified\n\t\t\t\t? modifiedStyles\n\t\t\t\t: futureStyles;\n\n\t\t\tconst selectors = Object.keys( modifiedStyles );\n\n\t\t\tfutureStyles = mergeStyles(\n\t\t\t\tfutureStyles,\n\t\t\t\tupdatedStyles,\n\t\t\t\tselectors\n\t\t\t);\n\t\t}\n\n\t\tmergeFutureStyles( activeStyles, [ isActive ] );\n\t\tmergeFutureStyles( darkStyles, [ isDark ] );\n\t\tmergeFutureStyles( activeDarkStyles, [ isActive, isDark ] );\n\n\t\tsetCurrentStyles( futureStyles );\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ isActive, isDark ] );\n\n\tuseEffect( () => {\n\t\tconst keyboardHideSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidHide',\n\t\t\t() => {\n\t\t\t\tif ( ! isIOS ) {\n\t\t\t\t\tonCancel();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\treturn () => {\n\t\t\tclearTimeout( onCancelTimer.current );\n\t\t\tkeyboardHideSubscription.remove();\n\t\t};\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst {\n\t\t'search-control__container': containerStyle,\n\t\t'search-control__inner-container': innerContainerStyle,\n\t\t'search-control__input-container': inputContainerStyle,\n\t\t'search-control__form-input': formInputStyle,\n\t\t'search-control__form-input-placeholder': placeholderStyle,\n\t\t'search-control__input-button': inputButtonStyle,\n\t\t'search-control__input-button-left': inputButtonLeftStyle,\n\t\t'search-control__input-button-right': inputButtonRightStyle,\n\t\t'search-control__cancel-button': cancelButtonStyle,\n\t\t'search-control__cancel-button-text': cancelButtonTextStyle,\n\t\t'search-control__icon': iconStyle,\n\t\t'search-control__right-icon': rightIconStyle,\n\t} = currentStyles;\n\n\tfunction clearInput() {\n\t\tonChange( '' );\n\t}\n\n\tfunction onCancel() {\n\t\tonCancelTimer.current = setTimeout( () => {\n\t\t\tinputRef.current.blur();\n\t\t\tclearInput();\n\t\t\tsetIsActive( false );\n\t\t}, 0 );\n\t}\n\n\tfunction renderLeftButton() {\n\t\tconst button =\n\t\t\t! isIOS && isActive ? (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ __( 'Cancel search' ) }\n\t\t\t\t\ticon={ arrowLeftIcon }\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t\tstyle={ iconStyle }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Icon icon={ Gridicons.search } fill={ iconStyle?.color } />\n\t\t\t);\n\n\t\treturn (\n\t\t\t<View style={ [ inputButtonStyle, inputButtonLeftStyle ] }>\n\t\t\t\t{ button }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction renderRightButton() {\n\t\tlet button;\n\n\t\t// Add a View element to properly center the input placeholder via flexbox.\n\t\tif ( isIOS && ! isActive ) {\n\t\t\tbutton = <View />;\n\t\t}\n\n\t\tif ( !! value ) {\n\t\t\tbutton = (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ __( 'Clear search' ) }\n\t\t\t\t\ticon={ isIOS ? cancelCircleFilledIcon : closeIcon }\n\t\t\t\t\tonClick={ clearInput }\n\t\t\t\t\tstyle={ [ iconStyle, rightIconStyle ] }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<View style={ [ inputButtonStyle, inputButtonRightStyle ] }>\n\t\t\t\t{ button }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction renderCancel() {\n\t\tif ( ! isIOS ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<View style={ cancelButtonStyle }>\n\t\t\t\t<Text\n\t\t\t\t\tonPress={ onCancel }\n\t\t\t\t\tstyle={ cancelButtonTextStyle }\n\t\t\t\t\taccessible={ true }\n\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\taccessibilityLabel={ __( 'Cancel search' ) }\n\t\t\t\t\taccessibilityHint={ __( 'Cancel search' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Text>\n\t\t\t</View>\n\t\t);\n\t}\n\n\treturn (\n\t\t<TouchableOpacity\n\t\t\tstyle={ containerStyle }\n\t\t\tonPress={ () => {\n\t\t\t\tsetIsActive( true );\n\t\t\t\tinputRef.current.focus();\n\t\t\t} }\n\t\t\tactiveOpacity={ 1 }\n\t\t>\n\t\t\t<View style={ innerContainerStyle }>\n\t\t\t\t<View style={ inputContainerStyle }>\n\t\t\t\t\t{ renderLeftButton() }\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tref={ inputRef }\n\t\t\t\t\t\tstyle={ formInputStyle }\n\t\t\t\t\t\tplaceholderTextColor={ placeholderStyle?.color }\n\t\t\t\t\t\tonChangeText={ onChange }\n\t\t\t\t\t\tonFocus={ () => setIsActive( true ) }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t/>\n\t\t\t\t\t{ renderRightButton() }\n\t\t\t\t</View>\n\t\t\t\t{ isActive && renderCancel() }\n\t\t\t</View>\n\t\t</TouchableOpacity>\n\t);\n}\n\nexport default SearchControl;\n"],"mappings":";;;;;;;AAgBA,IAAAA,QAAA,GAAAC,OAAA;AAbA,IAAAC,YAAA,GAAAD,OAAA;AAcA,IAAA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GAClC,IAAAtE,QAAA,CAAAsF,aAAA,EAACpF,YAAA,CAAAgG,IAAI;IAACN,KAAK,EAAGrB;EAAqB,GAChCa,gBAAgB,CAAC,CAAC,EACpB,IAAApF,QAAA,CAAAsF,aAAA,EAACpF,YAAA,CAAA8G,SAAS;IACTC,GAAG,EAAGrE,QAAU;IAChBgD,KAAK,EAAGpB,cAAgB;IACxB0C,oBAAoB,EAAGzC,gBAAgB,EAAEwB,KAAO;IAChDkB,YAAY,EAAGjF,QAAU;IACzBkF,OAAO,EAAGA,CAAA,KAAM9E,WAAW,CAAE,IAAK,CAAG;IACrCL,KAAK,EAAGA,KAAO;IACfE,WAAW,EAAGA;EAAa,CAC3B,CAAC,EACAgE,iBAAiB,CAAC,CACf,CAAC,EACL9D,QAAQ,IAAIiE,YAAY,CAAC,CACtB,CACW,CAAC;AAErB;AAAC,IAAAe,QAAA,GAEcrF,aAAa;AAAAsF,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_element","require","_reactNative","_i18n","_components","_icons","_style","_interopRequireDefault","_platformStyle","baseStyles","allStyles","selector","platformStyles","selectModifiedStyles","styles","modifier","modifierMatcher","RegExp","modifierSelectors","Object","keys","filter","match","reduce","modifiedStyles","modifierSelector","blockElementSelector","split","mergeStyles","updateStyles","selectors","forEach","SearchControl","value","onChange","placeholder","__","isActive","setIsActive","useState","currentStyles","setCurrentStyles","isDark","useColorScheme","inputRef","useRef","onCancelTimer","isIOS","Platform","OS","darkStyles","useMemo","activeStyles","activeDarkStyles","useEffect","futureStyles","mergeFutureStyles","shouldUseConditions","shouldUseModified","every","should","updatedStyles","clearInput","useCallback","onPress","current","focus","onFocus","onCancel","clearTimeout","setTimeout","blur","onKeyboardDidHide","keyboardHideSubscription","Keyboard","addListener","remove","containerStyle","innerContainerStyle","inputContainerStyle","formInputStyle","placeholderStyle","inputButtonStyle","inputButtonLeftStyle","inputButtonRightStyle","cancelButtonStyle","cancelButtonTextStyle","iconStyle","rightIconStyle","renderLeftButton","button","createElement","Button","label","icon","arrowLeftIcon","onClick","style","Icon","Gridicons","search","fill","color","View","renderRightButton","cancelCircleFilledIcon","closeIcon","renderCancel","Text","accessible","accessibilityRole","accessibilityLabel","accessibilityHint","TouchableOpacity","activeOpacity","TextInput","ref","placeholderTextColor","onChangeText","_default","exports","default"],"sources":["@wordpress/components/src/search-control/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tTextInput,\n\tText,\n\tView,\n\tTouchableOpacity,\n\tPlatform,\n\tuseColorScheme,\n\tKeyboard,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseMemo,\n\tuseEffect,\n\tuseCallback,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button, Gridicons } from '@wordpress/components';\nimport {\n\tIcon,\n\tcancelCircleFilled as cancelCircleFilledIcon,\n\tarrowLeft as arrowLeftIcon,\n\tclose as closeIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport allStyles from './style.scss';\nimport platformStyles from './platform-style.scss';\n\n// Merge platform specific styles with the default styles.\nconst baseStyles = { ...allStyles };\nfor ( const selector in platformStyles ) {\n\tbaseStyles[ selector ] = {\n\t\t...baseStyles[ selector ],\n\t\t...platformStyles[ selector ],\n\t};\n}\n\nfunction selectModifiedStyles( styles, modifier ) {\n\tconst modifierMatcher = new RegExp( `--${ modifier }$` );\n\tconst modifierSelectors = Object.keys( styles ).filter( ( selector ) =>\n\t\tselector.match( modifierMatcher )\n\t);\n\n\treturn modifierSelectors.reduce( ( modifiedStyles, modifierSelector ) => {\n\t\tconst blockElementSelector = modifierSelector.split( '--' )[ 0 ];\n\t\tmodifiedStyles[ blockElementSelector ] = styles[ modifierSelector ];\n\t\treturn modifiedStyles;\n\t}, {} );\n}\n\nfunction mergeStyles( styles, updateStyles, selectors ) {\n\tselectors.forEach( ( selector ) => {\n\t\tstyles[ selector ] = {\n\t\t\t...styles[ selector ],\n\t\t\t...updateStyles[ selector ],\n\t\t};\n\t} );\n\n\treturn styles;\n}\n\nfunction SearchControl( {\n\tvalue,\n\tonChange,\n\tplaceholder = __( 'Search blocks' ),\n} ) {\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst [ currentStyles, setCurrentStyles ] = useState( baseStyles );\n\n\tconst isDark = useColorScheme() === 'dark';\n\tconst inputRef = useRef();\n\tconst onCancelTimer = useRef();\n\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst darkStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'dark' );\n\t}, [] );\n\n\tconst activeStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'active' );\n\t}, [] );\n\n\tconst activeDarkStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'active-dark' );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tlet futureStyles = { ...baseStyles };\n\n\t\tfunction mergeFutureStyles( modifiedStyles, shouldUseConditions ) {\n\t\t\tconst shouldUseModified = shouldUseConditions.every(\n\t\t\t\t( should ) => should\n\t\t\t);\n\n\t\t\tconst updatedStyles = shouldUseModified\n\t\t\t\t? modifiedStyles\n\t\t\t\t: futureStyles;\n\n\t\t\tconst selectors = Object.keys( modifiedStyles );\n\n\t\t\tfutureStyles = mergeStyles(\n\t\t\t\tfutureStyles,\n\t\t\t\tupdatedStyles,\n\t\t\t\tselectors\n\t\t\t);\n\t\t}\n\n\t\tmergeFutureStyles( activeStyles, [ isActive ] );\n\t\tmergeFutureStyles( darkStyles, [ isDark ] );\n\t\tmergeFutureStyles( activeDarkStyles, [ isActive, isDark ] );\n\n\t\tsetCurrentStyles( futureStyles );\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ isActive, isDark ] );\n\n\tconst clearInput = useCallback( () => {\n\t\tonChange( '' );\n\t}, [ onChange ] );\n\n\tconst onPress = useCallback( () => {\n\t\tsetIsActive( true );\n\t\tinputRef.current?.focus();\n\t}, [] );\n\n\tconst onFocus = useCallback( () => {\n\t\tsetIsActive( true );\n\t}, [] );\n\n\tconst onCancel = useCallback( () => {\n\t\tclearTimeout( onCancelTimer.current );\n\t\tonCancelTimer.current = setTimeout( () => {\n\t\t\tinputRef.current?.blur();\n\t\t\tclearInput();\n\t\t\tsetIsActive( false );\n\t\t}, 0 );\n\t}, [ clearInput ] );\n\n\tconst onKeyboardDidHide = useCallback( () => {\n\t\tif ( ! isIOS ) {\n\t\t\tonCancel();\n\t\t}\n\t}, [ isIOS, onCancel ] );\n\n\tuseEffect( () => {\n\t\tconst keyboardHideSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidHide',\n\t\t\tonKeyboardDidHide\n\t\t);\n\t\treturn () => {\n\t\t\tclearTimeout( onCancelTimer.current );\n\t\t\tkeyboardHideSubscription.remove();\n\t\t};\n\t}, [ onKeyboardDidHide ] );\n\n\tconst {\n\t\t'search-control__container': containerStyle,\n\t\t'search-control__inner-container': innerContainerStyle,\n\t\t'search-control__input-container': inputContainerStyle,\n\t\t'search-control__form-input': formInputStyle,\n\t\t'search-control__form-input-placeholder': placeholderStyle,\n\t\t'search-control__input-button': inputButtonStyle,\n\t\t'search-control__input-button-left': inputButtonLeftStyle,\n\t\t'search-control__input-button-right': inputButtonRightStyle,\n\t\t'search-control__cancel-button': cancelButtonStyle,\n\t\t'search-control__cancel-button-text': cancelButtonTextStyle,\n\t\t'search-control__icon': iconStyle,\n\t\t'search-control__right-icon': rightIconStyle,\n\t} = currentStyles;\n\n\tfunction renderLeftButton() {\n\t\tconst button =\n\t\t\t! isIOS && isActive ? (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ __( 'Cancel search' ) }\n\t\t\t\t\ticon={ arrowLeftIcon }\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t\tstyle={ iconStyle }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Icon icon={ Gridicons.search } fill={ iconStyle?.color } />\n\t\t\t);\n\n\t\treturn (\n\t\t\t<View style={ [ inputButtonStyle, inputButtonLeftStyle ] }>\n\t\t\t\t{ button }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction renderRightButton() {\n\t\tlet button;\n\n\t\t// Add a View element to properly center the input placeholder via flexbox.\n\t\tif ( isIOS && ! isActive ) {\n\t\t\tbutton = <View />;\n\t\t}\n\n\t\tif ( !! value ) {\n\t\t\tbutton = (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ __( 'Clear search' ) }\n\t\t\t\t\ticon={ isIOS ? cancelCircleFilledIcon : closeIcon }\n\t\t\t\t\tonClick={ clearInput }\n\t\t\t\t\tstyle={ [ iconStyle, rightIconStyle ] }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<View style={ [ inputButtonStyle, inputButtonRightStyle ] }>\n\t\t\t\t{ button }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction renderCancel() {\n\t\tif ( ! isIOS ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<View style={ cancelButtonStyle }>\n\t\t\t\t<Text\n\t\t\t\t\tonPress={ onCancel }\n\t\t\t\t\tstyle={ cancelButtonTextStyle }\n\t\t\t\t\taccessible={ true }\n\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\taccessibilityLabel={ __( 'Cancel search' ) }\n\t\t\t\t\taccessibilityHint={ __( 'Cancel search' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Text>\n\t\t\t</View>\n\t\t);\n\t}\n\n\treturn (\n\t\t<TouchableOpacity\n\t\t\tstyle={ containerStyle }\n\t\t\tonPress={ onPress }\n\t\t\tactiveOpacity={ 1 }\n\t\t>\n\t\t\t<View style={ innerContainerStyle }>\n\t\t\t\t<View style={ inputContainerStyle }>\n\t\t\t\t\t{ renderLeftButton() }\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tref={ inputRef }\n\t\t\t\t\t\tstyle={ formInputStyle }\n\t\t\t\t\t\tplaceholderTextColor={ placeholderStyle?.color }\n\t\t\t\t\t\tonChangeText={ onChange }\n\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t/>\n\t\t\t\t\t{ renderRightButton() }\n\t\t\t\t</View>\n\t\t\t\t{ isActive && renderCancel() }\n\t\t\t</View>\n\t\t</TouchableOpacity>\n\t);\n}\n\nexport default SearchControl;\n"],"mappings":";;;;;;;AAgBA,IAAAA,QAAA,GAAAC,OAAA;AAbA,IAAAC,YAAA,GAAAD,OAAA;AAoBA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAUA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,cAAA,GAAAD,sBAAA,CAAAN,OAAA;AApCA;AACA;AACA;;AAWA;AACA;AACA;;AAiBA;AACA;AACA;;AAIA;AACA,MAAMQ,UAAU,GAAG;EAAE,GAAGC;AAAU,CAAC;AACnC,KAAM,MAAMC,QAAQ,IAAIC,sBAAc,EAAG;EACxCH,UAAU,CAAEE,QAAQ,CAAE,GAAG;IACxB,GAAGF,UAAU,CAAEE,QAAQ,CAAE;IACzB,GAAGC,sBAAc,CAAED,QAAQ;EAC5B,CAAC;AACF;AAEA,SAASE,oBAAoBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EACjD,MAAMC,eAAe,GAAG,IAAIC,MAAM,CAAG,KAAKF,QAAU,GAAG,CAAC;EACxD,MAAMG,iBAAiB,GAAGC,MAAM,CAACC,IAAI,CAAEN,MAAO,CAAC,CAACO,MAAM,CAAIV,QAAQ,IACjEA,QAAQ,CAACW,KAAK,CAAEN,eAAgB,CACjC,CAAC;EAED,OAAOE,iBAAiB,CAACK,MA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Y,EAAGpF,QAAU;IACzBiC,OAAO,EAAGA,OAAS;IACnBlC,KAAK,EAAGA,KAAO;IACfE,WAAW,EAAGA;EAAa,CAC3B,CAAC,EACAqE,iBAAiB,CAAC,CACf,CAAC,EACLnE,QAAQ,IAAIsE,YAAY,CAAC,CACtB,CACW,CAAC;AAErB;AAAC,IAAAY,QAAA,GAEcvF,aAAa;AAAAwF,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -9,6 +9,19 @@ var _element = require("@wordpress/element");
9
9
  * Internal dependencies
10
10
  */
11
11
 
12
+ /**
13
+ * Shortcut component is used to display keyboard shortcuts, and it can be customized with a custom display and aria label if needed.
14
+ *
15
+ * ```jsx
16
+ * import { Shortcut } from '@wordpress/components';
17
+ *
18
+ * const MyShortcut = () => {
19
+ * return (
20
+ * <Shortcut shortcut={{ display: 'Ctrl + S', ariaLabel: 'Save' }} />
21
+ * );
22
+ * };
23
+ * ```
24
+ */
12
25
  function Shortcut(props) {
13
26
  const {
14
27
  shortcut,
@@ -1 +1 @@
1
- {"version":3,"names":["Shortcut","props","shortcut","className","displayText","ariaLabel","display","_element","createElement","_default","exports","default"],"sources":["@wordpress/components/src/shortcut/index.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { ShortcutProps } from './types';\n\nfunction Shortcut( props: ShortcutProps ) {\n\tconst { shortcut, className } = props;\n\n\tif ( ! shortcut ) {\n\t\treturn null;\n\t}\n\n\tlet displayText;\n\tlet ariaLabel;\n\n\tif ( typeof shortcut === 'string' ) {\n\t\tdisplayText = shortcut;\n\t}\n\n\tif ( shortcut !== null && typeof shortcut === 'object' ) {\n\t\tdisplayText = shortcut.display;\n\t\tariaLabel = shortcut.ariaLabel;\n\t}\n\n\treturn (\n\t\t<span className={ className } aria-label={ ariaLabel }>\n\t\t\t{ displayText }\n\t\t</span>\n\t);\n}\n\nexport default Shortcut;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;;AAGA,SAASA,QAAQA,CAAEC,KAAoB,EAAG;EACzC,MAAM;IAAEC,QAAQ;IAAEC;EAAU,CAAC,GAAGF,KAAK;EAErC,IAAK,CAAEC,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,IAAIE,WAAW;EACf,IAAIC,SAAS;EAEb,IAAK,OAAOH,QAAQ,KAAK,QAAQ,EAAG;IACnCE,WAAW,GAAGF,QAAQ;EACvB;EAEA,IAAKA,QAAQ,KAAK,IAAI,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAG;IACxDE,WAAW,GAAGF,QAAQ,CAACI,OAAO;IAC9BD,SAAS,GAAGH,QAAQ,CAACG,SAAS;EAC/B;EAEA,OACC,IAAAE,QAAA,CAAAC,aAAA;IAAML,SAAS,EAAGA,SAAW;IAAC,cAAaE;EAAW,GACnDD,WACG,CAAC;AAET;AAAC,IAAAK,QAAA,GAEcT,QAAQ;AAAAU,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["Shortcut","props","shortcut","className","displayText","ariaLabel","display","_element","createElement","_default","exports","default"],"sources":["@wordpress/components/src/shortcut/index.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { ShortcutProps } from './types';\n\n/**\n * Shortcut component is used to display keyboard shortcuts, and it can be customized with a custom display and aria label if needed.\n *\n * ```jsx\n * import { Shortcut } from '@wordpress/components';\n *\n * const MyShortcut = () => {\n * \treturn (\n * \t\t<Shortcut shortcut={{ display: 'Ctrl + S', ariaLabel: 'Save' }} />\n * \t);\n * };\n * ```\n */\nfunction Shortcut( props: ShortcutProps ) {\n\tconst { shortcut, className } = props;\n\n\tif ( ! shortcut ) {\n\t\treturn null;\n\t}\n\n\tlet displayText;\n\tlet ariaLabel;\n\n\tif ( typeof shortcut === 'string' ) {\n\t\tdisplayText = shortcut;\n\t}\n\n\tif ( shortcut !== null && typeof shortcut === 'object' ) {\n\t\tdisplayText = shortcut.display;\n\t\tariaLabel = shortcut.ariaLabel;\n\t}\n\n\treturn (\n\t\t<span className={ className } aria-label={ ariaLabel }>\n\t\t\t{ displayText }\n\t\t</span>\n\t);\n}\n\nexport default Shortcut;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQA,CAAEC,KAAoB,EAAG;EACzC,MAAM;IAAEC,QAAQ;IAAEC;EAAU,CAAC,GAAGF,KAAK;EAErC,IAAK,CAAEC,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,IAAIE,WAAW;EACf,IAAIC,SAAS;EAEb,IAAK,OAAOH,QAAQ,KAAK,QAAQ,EAAG;IACnCE,WAAW,GAAGF,QAAQ;EACvB;EAEA,IAAKA,QAAQ,KAAK,IAAI,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAG;IACxDE,WAAW,GAAGF,QAAQ,CAACI,OAAO;IAC9BD,SAAS,GAAGH,QAAQ,CAACG,SAAS;EAC/B;EAEA,OACC,IAAAE,QAAA,CAAAC,aAAA;IAAML,SAAS,EAAGA,SAAW;IAAC,cAAaE;EAAW,GACnDD,WACG,CAAC;AAET;AAAC,IAAAK,QAAA,GAEcT,QAAQ;AAAAU,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -26,7 +26,9 @@ const SlotFillContext = (0, _element.createContext)({
26
26
  updateSlot: () => {},
27
27
  unregisterSlot: () => {},
28
28
  registerFill: () => {},
29
- unregisterFill: () => {}
29
+ unregisterFill: () => {},
30
+ // This helps the provider know if it's using the default context value or not.
31
+ isDefault: true
30
32
  });
31
33
  var _default = SlotFillContext;
32
34
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require","_element","_warning","_interopRequireDefault","SlotFillContext","createContext","slots","proxyMap","fills","registerSlot","SCRIPT_DEBUG","warning","updateSlot","unregisterSlot","registerFill","unregisterFill","_default","exports","default"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot-fill-context.js"],"sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { proxyMap } from 'valtio/utils';\n/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\nimport warning from '@wordpress/warning';\n\nconst SlotFillContext = createContext( {\n\tslots: proxyMap(),\n\tfills: proxyMap(),\n\tregisterSlot: () => {\n\t\twarning(\n\t\t\t'Components must be wrapped within `SlotFillProvider`. ' +\n\t\t\t\t'See https://developer.wordpress.org/block-editor/components/slot-fill/'\n\t\t);\n\t},\n\tupdateSlot: () => {},\n\tunregisterSlot: () => {},\n\tregisterFill: () => {},\n\tunregisterFill: () => {},\n} );\n\nexport default SlotFillContext;\n"],"mappings":";;;;;;;AAIA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAIA,MAAMI,eAAe,GAAG,IAAAC,sBAAa,EAAE;EACtCC,KAAK,EAAE,IAAAC,eAAQ,EAAC,CAAC;EACjBC,KAAK,EAAE,IAAAD,eAAQ,EAAC,CAAC;EACjBE,YAAY,EAAEA,CAAA,KAAM;IACnB,OAAAC,YAAA,oBAAAA,YAAA,gBAAAC,gBAAO,EACN,wDAAwD,GACvD,wEACF,CAAC;EACF,CAAC;EACDC,UAAU,EAAEA,CAAA,KAAM,CAAC,CAAC;EACpBC,cAAc,EAAEA,CAAA,KAAM,CAAC,CAAC;EACxBC,YAAY,EAAEA,CAAA,KAAM,CAAC,CAAC;EACtBC,cAAc,EAAEA,CAAA,KAAM,CAAC;AACxB,CAAE,CAAC;AAAC,IAAAC,QAAA,GAEWZ,eAAe;AAAAa,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_utils","require","_element","_warning","_interopRequireDefault","SlotFillContext","createContext","slots","proxyMap","fills","registerSlot","SCRIPT_DEBUG","warning","updateSlot","unregisterSlot","registerFill","unregisterFill","isDefault","_default","exports","default"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot-fill-context.js"],"sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { proxyMap } from 'valtio/utils';\n/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\nimport warning from '@wordpress/warning';\n\nconst SlotFillContext = createContext( {\n\tslots: proxyMap(),\n\tfills: proxyMap(),\n\tregisterSlot: () => {\n\t\twarning(\n\t\t\t'Components must be wrapped within `SlotFillProvider`. ' +\n\t\t\t\t'See https://developer.wordpress.org/block-editor/components/slot-fill/'\n\t\t);\n\t},\n\tupdateSlot: () => {},\n\tunregisterSlot: () => {},\n\tregisterFill: () => {},\n\tunregisterFill: () => {},\n\n\t// This helps the provider know if it's using the default context value or not.\n\tisDefault: true,\n} );\n\nexport default SlotFillContext;\n"],"mappings":";;;;;;;AAIA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAIA,MAAMI,eAAe,GAAG,IAAAC,sBAAa,EAAE;EACtCC,KAAK,EAAE,IAAAC,eAAQ,EAAC,CAAC;EACjBC,KAAK,EAAE,IAAAD,eAAQ,EAAC,CAAC;EACjBE,YAAY,EAAEA,CAAA,KAAM;IACnB,OAAAC,YAAA,oBAAAA,YAAA,gBAAAC,gBAAO,EACN,wDAAwD,GACvD,wEACF,CAAC;EACF,CAAC;EACDC,UAAU,EAAEA,CAAA,KAAM,CAAC,CAAC;EACpBC,cAAc,EAAEA,CAAA,KAAM,CAAC,CAAC;EACxBC,YAAY,EAAEA,CAAA,KAAM,CAAC,CAAC;EACtBC,cAAc,EAAEA,CAAA,KAAM,CAAC,CAAC;EAExB;EACAC,SAAS,EAAE;AACZ,CAAE,CAAC;AAAC,IAAAC,QAAA,GAEWb,eAAe;AAAAc,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _element = require("@wordpress/element");
9
9
  var _compose = require("@wordpress/compose");
10
+ var _view = require("../../view");
10
11
  var _slotFillContext = _interopRequireDefault(require("./slot-fill-context"));
11
12
  // @ts-nocheck
12
13
  /**
@@ -17,12 +18,16 @@ var _slotFillContext = _interopRequireDefault(require("./slot-fill-context"));
17
18
  * Internal dependencies
18
19
  */
19
20
 
20
- function Slot({
21
- name,
22
- fillProps = {},
23
- as: Component = 'div',
24
- ...props
25
- }, forwardedRef) {
21
+ function Slot(props, forwardedRef) {
22
+ const {
23
+ name,
24
+ fillProps = {},
25
+ as,
26
+ // `children` is not allowed. However, if it is passed,
27
+ // it will be displayed as is, so remove `children`.
28
+ children,
29
+ ...restProps
30
+ } = props;
26
31
  const {
27
32
  registerSlot,
28
33
  unregisterSlot,
@@ -45,9 +50,10 @@ function Slot({
45
50
  (0, _element.useLayoutEffect)(() => {
46
51
  registry.updateSlot(name, fillProps);
47
52
  });
48
- return (0, _element.createElement)(Component, {
53
+ return (0, _element.createElement)(_view.View, {
54
+ as: as,
49
55
  ref: (0, _compose.useMergeRefs)([forwardedRef, ref]),
50
- ...props
56
+ ...restProps
51
57
  });
52
58
  }
53
59
  var _default = (0, _element.forwardRef)(Slot);
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_compose","_slotFillContext","_interopRequireDefault","Slot","name","fillProps","as","Component","props","forwardedRef","registerSlot","unregisterSlot","registry","useContext","SlotFillContext","ref","useRef","useLayoutEffect","updateSlot","createElement","useMergeRefs","_default","forwardRef","exports","default"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot.js"],"sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tuseContext,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\n\nfunction Slot(\n\t{ name, fillProps = {}, as: Component = 'div', ...props },\n\tforwardedRef\n) {\n\tconst { registerSlot, unregisterSlot, ...registry } =\n\t\tuseContext( SlotFillContext );\n\tconst ref = useRef();\n\n\tuseLayoutEffect( () => {\n\t\tregisterSlot( name, ref, fillProps );\n\t\treturn () => {\n\t\t\tunregisterSlot( name, ref );\n\t\t};\n\t\t// Ignore reason: We don't want to unregister and register the slot whenever\n\t\t// `fillProps` change, which would cause the fill to be re-mounted. Instead,\n\t\t// we can just update the slot (see hook below).\n\t\t// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ registerSlot, unregisterSlot, name ] );\n\t// fillProps may be an update that interacts with the layout, so we\n\t// useLayoutEffect.\n\tuseLayoutEffect( () => {\n\t\tregistry.updateSlot( name, fillProps );\n\t} );\n\n\treturn (\n\t\t<Component ref={ useMergeRefs( [ forwardedRef, ref ] ) } { ...props } />\n\t);\n}\n\nexport default forwardRef( Slot );\n"],"mappings":";;;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAfA;AACA;AACA;AACA;;AASA;AACA;AACA;;AAGA,SAASI,IAAIA,CACZ;EAAEC,IAAI;EAAEC,SAAS,GAAG,CAAC,CAAC;EAAEC,EAAE,EAAEC,SAAS,GAAG,KAAK;EAAE,GAAGC;AAAM,CAAC,EACzDC,YAAY,EACX;EACD,MAAM;IAAEC,YAAY;IAAEC,cAAc;IAAE,GAAGC;EAAS,CAAC,GAClD,IAAAC,mBAAU,EAAEC,wBAAgB,CAAC;EAC9B,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EAEpB,IAAAC,wBAAe,EAAE,MAAM;IACtBP,YAAY,CAAEN,IAAI,EAAEW,GAAG,EAAEV,SAAU,CAAC;IACpC,OAAO,MAAM;MACZM,cAAc,CAAEP,IAAI,EAAEW,GAAI,CAAC;IAC5B,CAAC;IACD;IACA;IACA;IACA;IACA;EACD,CAAC,EAAE,CAAEL,YAAY,EAAEC,cAAc,EAAEP,IAAI,CAAG,CAAC;EAC3C;EACA;EACA,IAAAa,wBAAe,EAAE,MAAM;IACtBL,QAAQ,CAACM,UAAU,CAAEd,IAAI,EAAEC,SAAU,CAAC;EACvC,CAAE,CAAC;EAEH,OACC,IAAAP,QAAA,CAAAqB,aAAA,EAACZ,SAAS;IAACQ,GAAG,EAAG,IAAAK,qBAAY,EAAE,CAAEX,YAAY,EAAEM,GAAG,CAAG,CAAG;IAAA,GAAMP;EAAK,CAAI,CAAC;AAE1E;AAAC,IAAAa,QAAA,GAEc,IAAAC,mBAAU,EAAEnB,IAAK,CAAC;AAAAoB,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
1
+ {"version":3,"names":["_element","require","_compose","_view","_slotFillContext","_interopRequireDefault","Slot","props","forwardedRef","name","fillProps","as","children","restProps","registerSlot","unregisterSlot","registry","useContext","SlotFillContext","ref","useRef","useLayoutEffect","updateSlot","createElement","View","useMergeRefs","_default","forwardRef","exports","default"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot.js"],"sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tuseContext,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { View } from '../../view';\nimport SlotFillContext from './slot-fill-context';\n\nfunction Slot( props, forwardedRef ) {\n\tconst {\n\t\tname,\n\t\tfillProps = {},\n\t\tas,\n\t\t// `children` is not allowed. However, if it is passed,\n\t\t// it will be displayed as is, so remove `children`.\n\t\tchildren,\n\t\t...restProps\n\t} = props;\n\n\tconst { registerSlot, unregisterSlot, ...registry } =\n\t\tuseContext( SlotFillContext );\n\tconst ref = useRef();\n\n\tuseLayoutEffect( () => {\n\t\tregisterSlot( name, ref, fillProps );\n\t\treturn () => {\n\t\t\tunregisterSlot( name, ref );\n\t\t};\n\t\t// Ignore reason: We don't want to unregister and register the slot whenever\n\t\t// `fillProps` change, which would cause the fill to be re-mounted. Instead,\n\t\t// we can just update the slot (see hook below).\n\t\t// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ registerSlot, unregisterSlot, name ] );\n\t// fillProps may be an update that interacts with the layout, so we\n\t// useLayoutEffect.\n\tuseLayoutEffect( () => {\n\t\tregistry.updateSlot( name, fillProps );\n\t} );\n\n\treturn (\n\t\t<View\n\t\t\tas={ as }\n\t\t\tref={ useMergeRefs( [ forwardedRef, ref ] ) }\n\t\t\t{ ...restProps }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( Slot );\n"],"mappings":";;;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAhBA;AACA;AACA;AACA;;AASA;AACA;AACA;;AAIA,SAASK,IAAIA,CAAEC,KAAK,EAAEC,YAAY,EAAG;EACpC,MAAM;IACLC,IAAI;IACJC,SAAS,GAAG,CAAC,CAAC;IACdC,EAAE;IACF;IACA;IACAC,QAAQ;IACR,GAAGC;EACJ,CAAC,GAAGN,KAAK;EAET,MAAM;IAAEO,YAAY;IAAEC,cAAc;IAAE,GAAGC;EAAS,CAAC,GAClD,IAAAC,mBAAU,EAAEC,wBAAgB,CAAC;EAC9B,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EAEpB,IAAAC,wBAAe,EAAE,MAAM;IACtBP,YAAY,CAAEL,IAAI,EAAEU,GAAG,EAAET,SAAU,CAAC;IACpC,OAAO,MAAM;MACZK,cAAc,CAAEN,IAAI,EAAEU,GAAI,CAAC;IAC5B,CAAC;IACD;IACA;IACA;IACA;IACA;EACD,CAAC,EAAE,CAAEL,YAAY,EAAEC,cAAc,EAAEN,IAAI,CAAG,CAAC;EAC3C;EACA;EACA,IAAAY,wBAAe,EAAE,MAAM;IACtBL,QAAQ,CAACM,UAAU,CAAEb,IAAI,EAAEC,SAAU,CAAC;EACvC,CAAE,CAAC;EAEH,OACC,IAAAV,QAAA,CAAAuB,aAAA,EAACpB,KAAA,CAAAqB,IAAI;IACJb,EAAE,EAAGA,EAAI;IACTQ,GAAG,EAAG,IAAAM,qBAAY,EAAE,CAAEjB,YAAY,EAAEW,GAAG,CAAG,CAAG;IAAA,GACxCN;EAAS,CACd,CAAC;AAEJ;AAAC,IAAAa,QAAA,GAEc,IAAAC,mBAAU,EAAErB,IAAK,CAAC;AAAAsB,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
@@ -27,6 +27,7 @@ var _fill2 = _interopRequireDefault(require("./bubbles-virtually/fill"));
27
27
  var _slot2 = _interopRequireDefault(require("./bubbles-virtually/slot"));
28
28
  var _slotFillProvider = _interopRequireDefault(require("./bubbles-virtually/slot-fill-provider"));
29
29
  var _provider = _interopRequireDefault(require("./provider"));
30
+ var _slotFillContext = _interopRequireDefault(require("./bubbles-virtually/slot-fill-context"));
30
31
  var _useSlot = _interopRequireDefault(require("./bubbles-virtually/use-slot"));
31
32
  var _useSlotFills = _interopRequireDefault(require("./bubbles-virtually/use-slot-fills"));
32
33
  // @ts-nocheck
@@ -67,6 +68,10 @@ function Provider({
67
68
  children,
68
69
  ...props
69
70
  }) {
71
+ const parent = (0, _element.useContext)(_slotFillContext.default);
72
+ if (!parent.isDefault) {
73
+ return children;
74
+ }
70
75
  return (0, _element.createElement)(_provider.default, {
71
76
  ...props
72
77
  }, (0, _element.createElement)(_slotFillProvider.default, null, children));
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_fill","_interopRequireDefault","_slot","_fill2","_slot2","_slotFillProvider","_provider","_useSlot","_useSlotFills","Fill","props","createElement","Fragment","default","Slot","forwardRef","bubblesVirtually","ref","exports","Provider","children","createSlotFill","key","baseName","description","FillComponent","name","displayName","SlotComponent","__unstableName","createPrivateSlotFill","privateKey","Symbol","privateSlotFill"],"sources":["@wordpress/components/src/slot-fill/index.js"],"sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseFill from './fill';\nimport BaseSlot from './slot';\nimport BubblesVirtuallyFill from './bubbles-virtually/fill';\nimport BubblesVirtuallySlot from './bubbles-virtually/slot';\nimport BubblesVirtuallySlotFillProvider from './bubbles-virtually/slot-fill-provider';\nimport SlotFillProvider from './provider';\nexport { default as useSlot } from './bubbles-virtually/use-slot';\nexport { default as useSlotFills } from './bubbles-virtually/use-slot-fills';\n\nexport function Fill( props ) {\n\t// We're adding both Fills here so they can register themselves before\n\t// their respective slot has been registered. Only the Fill that has a slot\n\t// will render. The other one will return null.\n\treturn (\n\t\t<>\n\t\t\t<BaseFill { ...props } />\n\t\t\t<BubblesVirtuallyFill { ...props } />\n\t\t</>\n\t);\n}\nexport const Slot = forwardRef( ( { bubblesVirtually, ...props }, ref ) => {\n\tif ( bubblesVirtually ) {\n\t\treturn <BubblesVirtuallySlot { ...props } ref={ ref } />;\n\t}\n\treturn <BaseSlot { ...props } />;\n} );\n\nexport function Provider( { children, ...props } ) {\n\treturn (\n\t\t<SlotFillProvider { ...props }>\n\t\t\t<BubblesVirtuallySlotFillProvider>\n\t\t\t\t{ children }\n\t\t\t</BubblesVirtuallySlotFillProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport function createSlotFill( key ) {\n\tconst baseName = typeof key === 'symbol' ? key.description : key;\n\tconst FillComponent = ( props ) => <Fill name={ key } { ...props } />;\n\tFillComponent.displayName = `${ baseName }Fill`;\n\n\tconst SlotComponent = ( props ) => <Slot name={ key } { ...props } />;\n\tSlotComponent.displayName = `${ baseName }Slot`;\n\tSlotComponent.__unstableName = key;\n\n\treturn {\n\t\tFill: FillComponent,\n\t\tSlot: SlotComponent,\n\t};\n}\n\nexport const createPrivateSlotFill = ( name ) => {\n\tconst privateKey = Symbol( name );\n\tconst privateSlotFill = createSlotFill( privateKey );\n\n\treturn { privateKey, ...privateSlotFill };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,MAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,iBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,SAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,QAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,aAAA,GAAAP,sBAAA,CAAAF,OAAA;AAhBA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAUO,SAASU,IAAIA,CAAEC,KAAK,EAAG;EAC7B;EACA;EACA;EACA,OACC,IAAAZ,QAAA,CAAAa,aAAA,EAAAb,QAAA,CAAAc,QAAA,QACC,IAAAd,QAAA,CAAAa,aAAA,EAACX,KAAA,CAAAa,OAAQ;IAAA,GAAMH;EAAK,CAAI,CAAC,EACzB,IAAAZ,QAAA,CAAAa,aAAA,EAACR,MAAA,CAAAU,OAAoB;IAAA,GAAMH;EAAK,CAAI,CACnC,CAAC;AAEL;AACO,MAAMI,IAAI,GAAG,IAAAC,mBAAU,EAAE,CAAE;EAAEC,gBAAgB;EAAE,GAAGN;AAAM,CAAC,EAAEO,GAAG,KAAM;EAC1E,IAAKD,gBAAgB,EAAG;IACvB,OAAO,IAAAlB,QAAA,CAAAa,aAAA,EAACP,MAAA,CAAAS,OAAoB;MAAA,GAAMH,KAAK;MAAGO,GAAG,EAAGA;IAAK,CAA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E;EAAgB,CAAC;AAC1C,CAAC;AAACf,OAAA,CAAAY,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"names":["_element","require","_fill","_interopRequireDefault","_slot","_fill2","_slot2","_slotFillProvider","_provider","_slotFillContext","_useSlot","_useSlotFills","Fill","props","createElement","Fragment","default","Slot","forwardRef","bubblesVirtually","ref","exports","Provider","children","parent","useContext","SlotFillContext","isDefault","createSlotFill","key","baseName","description","FillComponent","name","displayName","SlotComponent","__unstableName","createPrivateSlotFill","privateKey","Symbol","privateSlotFill"],"sources":["@wordpress/components/src/slot-fill/index.js"],"sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseFill from './fill';\nimport BaseSlot from './slot';\nimport BubblesVirtuallyFill from './bubbles-virtually/fill';\nimport BubblesVirtuallySlot from './bubbles-virtually/slot';\nimport BubblesVirtuallySlotFillProvider from './bubbles-virtually/slot-fill-provider';\nimport SlotFillProvider from './provider';\nimport SlotFillContext from './bubbles-virtually/slot-fill-context';\nexport { default as useSlot } from './bubbles-virtually/use-slot';\nexport { default as useSlotFills } from './bubbles-virtually/use-slot-fills';\n\nexport function Fill( props ) {\n\t// We're adding both Fills here so they can register themselves before\n\t// their respective slot has been registered. Only the Fill that has a slot\n\t// will render. The other one will return null.\n\treturn (\n\t\t<>\n\t\t\t<BaseFill { ...props } />\n\t\t\t<BubblesVirtuallyFill { ...props } />\n\t\t</>\n\t);\n}\nexport const Slot = forwardRef( ( { bubblesVirtually, ...props }, ref ) => {\n\tif ( bubblesVirtually ) {\n\t\treturn <BubblesVirtuallySlot { ...props } ref={ ref } />;\n\t}\n\treturn <BaseSlot { ...props } />;\n} );\n\nexport function Provider( { children, ...props } ) {\n\tconst parent = useContext( SlotFillContext );\n\tif ( ! parent.isDefault ) {\n\t\treturn children;\n\t}\n\treturn (\n\t\t<SlotFillProvider { ...props }>\n\t\t\t<BubblesVirtuallySlotFillProvider>\n\t\t\t\t{ children }\n\t\t\t</BubblesVirtuallySlotFillProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport function createSlotFill( key ) {\n\tconst baseName = typeof key === 'symbol' ? key.description : key;\n\tconst FillComponent = ( props ) => <Fill name={ key } { ...props } />;\n\tFillComponent.displayName = `${ baseName }Fill`;\n\n\tconst SlotComponent = ( props ) => <Slot name={ key } { ...props } />;\n\tSlotComponent.displayName = `${ baseName }Slot`;\n\tSlotComponent.__unstableName = key;\n\n\treturn {\n\t\tFill: FillComponent,\n\t\tSlot: SlotComponent,\n\t};\n}\n\nexport const createPrivateSlotFill = ( name ) => {\n\tconst privateKey = Symbol( name );\n\tconst privateSlotFill = createSlotFill( privateKey );\n\n\treturn { privateKey, ...privateSlotFill };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,MAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,iBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,SAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,gBAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,QAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,aAAA,GAAAR,sBAAA,CAAAF,OAAA;AAjBA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAWO,SAASW,IAAIA,CAAEC,KAAK,EAAG;EAC7B;EACA;EACA;EACA,OACC,IAAAb,QAAA,CAAAc,aAAA,EAAAd,QAAA,CAAAe,QAAA,QACC,IAAAf,QAAA,CAAAc,aAAA,EAACZ,KAAA,CAAAc,OAAQ;IAAA,GAAMH;EAAK,CAAI,CAAC,EACzB,I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AAMK,aAAa,GAAKtB,KAAK,IAAM,IAAAb,QAAA,CAAAc,aAAA,EAACG,IAAI;IAACgB,IAAI,EAAGJ,GAAK;IAAA,GAAMhB;EAAK,CAAI,CAAC;EACrEsB,aAAa,CAACD,WAAW,GAAI,GAAGJ,QAAU,MAAK;EAC/CK,aAAa,CAACC,cAAc,GAAGP,GAAG;EAElC,OAAO;IACNjB,IAAI,EAAEoB,aAAa;IACnBf,IAAI,EAAEkB;EACP,CAAC;AACF;AAEO,MAAME,qBAAqB,GAAKJ,IAAI,IAAM;EAChD,MAAMK,UAAU,GAAGC,MAAM,CAAEN,IAAK,CAAC;EACjC,MAAMO,eAAe,GAAGZ,cAAc,CAAEU,UAAW,CAAC;EAEpD,OAAO;IAAEA,UAAU;IAAE,GAAGE;EAAgB,CAAC;AAC1C,CAAC;AAACnB,OAAA,CAAAgB,qBAAA,GAAAA,qBAAA"}
@@ -49,7 +49,6 @@ function UnforwardedSpinner({
49
49
  /**
50
50
  * `Spinner` is a component used to notify users that their action is being processed.
51
51
  *
52
- * @example
53
52
  * ```js
54
53
  * import { Spinner } from '@wordpress/components';
55
54
  *
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_styles","UnforwardedSpinner","className","props","forwardedRef","createElement","StyledSpinner","classNames","viewBox","width","height","xmlns","role","focusable","ref","SpinnerTrack","cx","cy","r","vectorEffect","SpinnerIndicator","d","Spinner","forwardRef","exports","_default","default"],"sources":["@wordpress/components/src/spinner/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { StyledSpinner, SpinnerTrack, SpinnerIndicator } from './styles';\nimport type { WordPressComponentProps } from '../ui/context';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\nexport function UnforwardedSpinner(\n\t{ className, ...props }: WordPressComponentProps< {}, 'svg', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\treturn (\n\t\t<StyledSpinner\n\t\t\tclassName={ classNames( 'components-spinner', className ) }\n\t\t\tviewBox=\"0 0 100 100\"\n\t\t\twidth=\"16\"\n\t\t\theight=\"16\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\trole=\"presentation\"\n\t\t\tfocusable=\"false\"\n\t\t\t{ ...props }\n\t\t\tref={ forwardedRef }\n\t\t>\n\t\t\t{ /* Gray circular background */ }\n\t\t\t<SpinnerTrack\n\t\t\t\tcx=\"50\"\n\t\t\t\tcy=\"50\"\n\t\t\t\tr=\"50\"\n\t\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\t/>\n\n\t\t\t{ /* Theme-colored arc */ }\n\t\t\t<SpinnerIndicator\n\t\t\t\td=\"m 50 0 a 50 50 0 0 1 50 50\"\n\t\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\t/>\n\t\t</StyledSpinner>\n\t);\n}\n/**\n * `Spinner` is a component used to notify users that their action is being processed.\n *\n * @example\n * ```js\n * import { Spinner } from '@wordpress/components';\n *\n * function Example() {\n * return <Spinner />;\n * }\n * ```\n */\nexport const Spinner = forwardRef( UnforwardedSpinner );\nexport default Spinner;\n"],"mappings":";;;;;;;;;AAeA,IAAAA,QAAA,GAAAC,OAAA;AAZA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAMA,IAAAG,OAAA,GAAAH,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;;AAGO,SAASI,kBAAkBA,CACjC;EAAEC,SAAS;EAAE,GAAGC;AAAmD,CAAC,EACpEC,YAAiC,EAChC;EACD,OACC,IAAAR,QAAA,CAAAS,aAAA,EAACL,OAAA,CAAAM,aAAa;IACbJ,SAAS,EAAG,IAAAK,mBAAU,EAAE,oBAAoB,EAAEL,SAAU,CAAG;IAC3DM,OAAO,EAAC,aAAa;IACrBC,KAAK,EAAC,IAAI;IACVC,MAAM,EAAC,IAAI;IACXC,KAAK,EAAC,4BAA4B;IAClCC,IAAI,EAAC,cAAc;IACnBC,SAAS,EAAC,OAAO;IAAA,GACZV,KAAK;IACVW,GAAG,EAAGV;EAAc,GAGpB,IAAAR,QAAA,CAAAS,aAAA,EAACL,OAAA,CAAAe,YAAY;IACZC,EAAE,EAAC,IAAI;IACPC,EAAE,EAAC,IAAI;IACPC,CAAC,EAAC,IAAI;IACNC,YAAY,EAAC;EAAoB,CACjC,CAAC,EAGF,IAAAvB,QAAA,CAAAS,aAAA,EAACL,OAAA,CAAAoB,gBAAgB;IAChBC,CAAC,EAAC,4BAA4B;IAC9BF,YAAY,EAAC;EAAoB,CACjC,CACa,CAAC;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,OAAO,GAAG,IAAAC,mBAAU,EAAEtB,kBAAmB,CAAC;AAACuB,OAAA,CAAAF,OAAA,GAAAA,OAAA;AAAA,IAAAG,QAAA,GACzCH,OAAO;AAAAE,OAAA,CAAAE,OAAA,GAAAD,QAAA"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_styles","UnforwardedSpinner","className","props","forwardedRef","createElement","StyledSpinner","classNames","viewBox","width","height","xmlns","role","focusable","ref","SpinnerTrack","cx","cy","r","vectorEffect","SpinnerIndicator","d","Spinner","forwardRef","exports","_default","default"],"sources":["@wordpress/components/src/spinner/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { StyledSpinner, SpinnerTrack, SpinnerIndicator } from './styles';\nimport type { WordPressComponentProps } from '../ui/context';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\nexport function UnforwardedSpinner(\n\t{ className, ...props }: WordPressComponentProps< {}, 'svg', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\treturn (\n\t\t<StyledSpinner\n\t\t\tclassName={ classNames( 'components-spinner', className ) }\n\t\t\tviewBox=\"0 0 100 100\"\n\t\t\twidth=\"16\"\n\t\t\theight=\"16\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\trole=\"presentation\"\n\t\t\tfocusable=\"false\"\n\t\t\t{ ...props }\n\t\t\tref={ forwardedRef }\n\t\t>\n\t\t\t{ /* Gray circular background */ }\n\t\t\t<SpinnerTrack\n\t\t\t\tcx=\"50\"\n\t\t\t\tcy=\"50\"\n\t\t\t\tr=\"50\"\n\t\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\t/>\n\n\t\t\t{ /* Theme-colored arc */ }\n\t\t\t<SpinnerIndicator\n\t\t\t\td=\"m 50 0 a 50 50 0 0 1 50 50\"\n\t\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\t/>\n\t\t</StyledSpinner>\n\t);\n}\n/**\n * `Spinner` is a component used to notify users that their action is being processed.\n *\n * ```js\n * import { Spinner } from '@wordpress/components';\n *\n * function Example() {\n * return <Spinner />;\n * }\n * ```\n */\nexport const Spinner = forwardRef( UnforwardedSpinner );\nexport default Spinner;\n"],"mappings":";;;;;;;;;AAeA,IAAAA,QAAA,GAAAC,OAAA;AAZA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAMA,IAAAG,OAAA,GAAAH,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;;AAGO,SAASI,kBAAkBA,CACjC;EAAEC,SAAS;EAAE,GAAGC;AAAmD,CAAC,EACpEC,YAAiC,EAChC;EACD,OACC,IAAAR,QAAA,CAAAS,aAAA,EAACL,OAAA,CAAAM,aAAa;IACbJ,SAAS,EAAG,IAAAK,mBAAU,EAAE,oBAAoB,EAAEL,SAAU,CAAG;IAC3DM,OAAO,EAAC,aAAa;IACrBC,KAAK,EAAC,IAAI;IACVC,MAAM,EAAC,IAAI;IACXC,KAAK,EAAC,4BAA4B;IAClCC,IAAI,EAAC,cAAc;IACnBC,SAAS,EAAC,OAAO;IAAA,GACZV,KAAK;IACVW,GAAG,EAAGV;EAAc,GAGpB,IAAAR,QAAA,CAAAS,aAAA,EAACL,OAAA,CAAAe,YAAY;IACZC,EAAE,EAAC,IAAI;IACPC,EAAE,EAAC,IAAI;IACPC,CAAC,EAAC,IAAI;IACNC,YAAY,EAAC;EAAoB,CACjC,CAAC,EAGF,IAAAvB,QAAA,CAAAS,aAAA,EAACL,OAAA,CAAAoB,gBAAgB;IAChBC,CAAC,EAAC,4BAA4B;IAC9BF,YAAY,EAAC;EAAoB,CACjC,CACa,CAAC;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,OAAO,GAAG,IAAAC,mBAAU,EAAEtB,kBAAmB,CAAC;AAACuB,OAAA,CAAAF,OAAA,GAAAA,OAAA;AAAA,IAAAG,QAAA,GACzCH,OAAO;AAAAE,OAAA,CAAAE,OAAA,GAAAD,QAAA"}
@@ -18,7 +18,6 @@ var _utils = require("../utils");
18
18
  * Multiple `Theme` components can be nested in order to override specific theme variables.
19
19
  *
20
20
  *
21
- * @example
22
21
  * ```jsx
23
22
  * const Example = () => {
24
23
  * return (
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_styles","_colorAlgorithms","_utils","Theme","accent","background","className","props","cx","useCx","classes","useMemo","colorVariables","generateThemeVariables","createElement","Wrapper","_default","exports","default"],"sources":["@wordpress/components/src/theme/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ThemeProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\nimport { colorVariables, Wrapper } from './styles';\nimport { generateThemeVariables } from './color-algorithms';\nimport { useCx } from '../utils';\n\n/**\n * `Theme` allows defining theme variables for components in the `@wordpress/components` package.\n *\n * Multiple `Theme` components can be nested in order to override specific theme variables.\n *\n *\n * @example\n * ```jsx\n * const Example = () => {\n * return (\n * <Theme accent=\"red\">\n * <Button variant=\"primary\">I'm red</Button>\n * <Theme accent=\"blue\">\n * <Button variant=\"primary\">I'm blue</Button>\n * </Theme>\n * </Theme>\n * );\n * };\n * ```\n */\nfunction Theme( {\n\taccent,\n\tbackground,\n\tclassName,\n\t...props\n}: WordPressComponentProps< ThemeProps, 'div', true > ) {\n\tconst cx = useCx();\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\t...colorVariables(\n\t\t\t\t\tgenerateThemeVariables( { accent, background } )\n\t\t\t\t),\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ accent, background, className, cx ]\n\t);\n\n\treturn <Wrapper className={ classes } { ...props } />;\n}\n\nexport default Theme;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAZA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,KAAKA,CAAE;EACfC,MAAM;EACNC,UAAU;EACVC,SAAS;EACT,GAAGC;AACgD,CAAC,EAAG;EACvD,MAAMC,EAAE,GAAG,IAAAC,YAAK,EAAC,CAAC;EAClB,MAAMC,OAAO,GAAG,IAAAC,gBAAO,EACtB,MACCH,EAAE,CACD,GAAG,IAAAI,sBAAc,EAChB,IAAAC,uCAAsB,EAAE;IAAET,MAAM;IAAEC;EAAW,CAAE,CAChD,CAAC,EACDC,SACD,CAAC,EACF,CAAEF,MAAM,EAAEC,UAAU,EAAEC,SAAS,EAAEE,EAAE,CACpC,CAAC;EAED,OAAO,IAAAV,QAAA,CAAAgB,aAAA,EAACd,OAAA,CAAAe,OAAO;IAACT,SAAS,EAAGI,OAAS;IAAA,GAAMH;EAAK,CAAI,CAAC;AACtD;AAAC,IAAAS,QAAA,GAEcb,KAAK;AAAAc,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_element","require","_styles","_colorAlgorithms","_utils","Theme","accent","background","className","props","cx","useCx","classes","useMemo","colorVariables","generateThemeVariables","createElement","Wrapper","_default","exports","default"],"sources":["@wordpress/components/src/theme/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ThemeProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\nimport { colorVariables, Wrapper } from './styles';\nimport { generateThemeVariables } from './color-algorithms';\nimport { useCx } from '../utils';\n\n/**\n * `Theme` allows defining theme variables for components in the `@wordpress/components` package.\n *\n * Multiple `Theme` components can be nested in order to override specific theme variables.\n *\n *\n * ```jsx\n * const Example = () => {\n * return (\n * <Theme accent=\"red\">\n * <Button variant=\"primary\">I'm red</Button>\n * <Theme accent=\"blue\">\n * <Button variant=\"primary\">I'm blue</Button>\n * </Theme>\n * </Theme>\n * );\n * };\n * ```\n */\nfunction Theme( {\n\taccent,\n\tbackground,\n\tclassName,\n\t...props\n}: WordPressComponentProps< ThemeProps, 'div', true > ) {\n\tconst cx = useCx();\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\t...colorVariables(\n\t\t\t\t\tgenerateThemeVariables( { accent, background } )\n\t\t\t\t),\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ accent, background, className, cx ]\n\t);\n\n\treturn <Wrapper className={ classes } { ...props } />;\n}\n\nexport default Theme;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAZA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,KAAKA,CAAE;EACfC,MAAM;EACNC,UAAU;EACVC,SAAS;EACT,GAAGC;AACgD,CAAC,EAAG;EACvD,MAAMC,EAAE,GAAG,IAAAC,YAAK,EAAC,CAAC;EAClB,MAAMC,OAAO,GAAG,IAAAC,gBAAO,EACtB,MACCH,EAAE,CACD,GAAG,IAAAI,sBAAc,EAChB,IAAAC,uCAAsB,EAAE;IAAET,MAAM;IAAEC;EAAW,CAAE,CAChD,CAAC,EACDC,SACD,CAAC,EACF,CAAEF,MAAM,EAAEC,UAAU,EAAEC,SAAS,EAAEE,EAAE,CACpC,CAAC;EAED,OAAO,IAAAV,QAAA,CAAAgB,aAAA,EAACd,OAAA,CAAAe,OAAO;IAACT,SAAS,EAAGI,OAAS;IAAA,GAAMH;EAAK,CAAI,CAAC;AACtD;AAAC,IAAAS,QAAA,GAEcb,KAAK;AAAAc,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -48,7 +48,6 @@ const UnconnectedToolsPanel = (props, forwardedRef) => {
48
48
  * by a header. The header includes a dropdown menu which is automatically
49
49
  * generated from the panel's inner `ToolsPanelItems`.
50
50
  *
51
- * @example
52
51
  * ```jsx
53
52
  * import { __ } from '@wordpress/i18n';
54
53
  * import {
@@ -1 +1 @@
1
- {"version":3,"names":["_toolsPanelHeader","_interopRequireDefault","require","_context","_hook","_grid","_context2","UnconnectedToolsPanel","props","forwardedRef","children","label","panelContext","resetAllItems","toggleItem","headingLevel","toolsPanelProps","useToolsPanel","_element","createElement","Grid","columns","ref","ToolsPanelContext","Provider","value","default","resetAll","ToolsPanel","contextConnect","exports","_default"],"sources":["@wordpress/components/src/tools-panel/tools-panel/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport ToolsPanelHeader from '../tools-panel-header';\nimport { ToolsPanelContext } from '../context';\nimport { useToolsPanel } from './hook';\nimport { Grid } from '../../grid';\nimport type { WordPressComponentProps } from '../../ui/context';\nimport { contextConnect } from '../../ui/context';\nimport type { ToolsPanelProps } from '../types';\n\nconst UnconnectedToolsPanel = (\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tchildren,\n\t\tlabel,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\theadingLevel,\n\t\t...toolsPanelProps\n\t} = useToolsPanel( props );\n\n\treturn (\n\t\t<Grid { ...toolsPanelProps } columns={ 2 } ref={ forwardedRef }>\n\t\t\t<ToolsPanelContext.Provider value={ panelContext }>\n\t\t\t\t<ToolsPanelHeader\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tresetAll={ resetAllItems }\n\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</ToolsPanelContext.Provider>\n\t\t</Grid>\n\t);\n};\n\n/**\n * The `ToolsPanel` is a container component that displays its children preceded\n * by a header. The header includes a dropdown menu which is automatically\n * generated from the panel's inner `ToolsPanelItems`.\n *\n * @example\n * ```jsx\n * import { __ } from '@wordpress/i18n';\n * import {\n * __experimentalToolsPanel as ToolsPanel,\n * __experimentalToolsPanelItem as ToolsPanelItem,\n * __experimentalUnitControl as UnitControl\n * } from '@wordpress/components';\n *\n * function Example() {\n * const [ height, setHeight ] = useState();\n * const [ width, setWidth ] = useState();\n *\n * const resetAll = () => {\n * setHeight();\n * setWidth();\n * }\n *\n * return (\n * <ToolsPanel label={ __( 'Dimensions' ) } resetAll={ resetAll }>\n * <ToolsPanelItem\n * hasValue={ () => !! height }\n * label={ __( 'Height' ) }\n * onDeselect={ () => setHeight() }\n * >\n * <UnitControl\n * label={ __( 'Height' ) }\n * onChange={ setHeight }\n * value={ height }\n * />\n * </ToolsPanelItem>\n * <ToolsPanelItem\n * hasValue={ () => !! width }\n * label={ __( 'Width' ) }\n * onDeselect={ () => setWidth() }\n * >\n * <UnitControl\n * label={ __( 'Width' ) }\n * onChange={ setWidth }\n * value={ width }\n * />\n * </ToolsPanelItem>\n * </ToolsPanel>\n * );\n * }\n * ```\n */\nexport const ToolsPanel = contextConnect( UnconnectedToolsPanel, 'ToolsPanel' );\n\nexport default ToolsPanel;\n"],"mappings":";;;;;;;;AAQA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AASA,MAAMK,qBAAqB,GAAGA,CAC7BC,KAAwD,EACxDC,YAAiC,KAC7B;EACJ,MAAM;IACLC,QAAQ;IACRC,KAAK;IACLC,YAAY;IACZC,aAAa;IACbC,UAAU;IACVC,YAAY;IACZ,GAAGC;EACJ,CAAC,GAAG,IAAAC,mBAAa,EAAET,KAAM,CAAC;EAE1B,OACC,IAAAU,QAAA,CAAAC,aAAA,EAACd,KAAA,CAAAe,IAAI;IAAA,GAAMJ,eAAe;IAAGK,OAAO,EAAG,CAAG;IAACC,GAAG,EAAGb;EAAc,GAC9D,IAAAS,QAAA,CAAAC,aAAA,EAAChB,QAAA,CAAAoB,iBAAiB,CAACC,QAAQ;IAACC,KAAK,EAAGb;EAAc,GACjD,IAAAM,QAAA,CAAAC,aAAA,EAACnB,iBAAA,CAAA0B,OAAgB;IAChBf,KAAK,EAAGA,KAAO;IACfgB,QAAQ,EAAGd,aAAe;IAC1BC,UAAU,EAAGA,UAAY;IACzBC,YAAY,EAAGA;EAAc,CAC7B,CAAC,EACAL,QACyB,CACvB,CAAC;AAET,CAAC;;AAED;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;AACO,MAAMkB,UAAU,GAAG,IAAAC,wBAAc,EAAEtB,qBAAqB,EAAE,YAAa,CAAC;AAACuB,OAAA,CAAAF,UAAA,GAAAA,UAAA;AAAA,IAAAG,QAAA,GAEjEH,UAAU;AAAAE,OAAA,CAAAJ,OAAA,GAAAK,QAAA"}
1
+ {"version":3,"names":["_toolsPanelHeader","_interopRequireDefault","require","_context","_hook","_grid","_context2","UnconnectedToolsPanel","props","forwardedRef","children","label","panelContext","resetAllItems","toggleItem","headingLevel","toolsPanelProps","useToolsPanel","_element","createElement","Grid","columns","ref","ToolsPanelContext","Provider","value","default","resetAll","ToolsPanel","contextConnect","exports","_default"],"sources":["@wordpress/components/src/tools-panel/tools-panel/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport ToolsPanelHeader from '../tools-panel-header';\nimport { ToolsPanelContext } from '../context';\nimport { useToolsPanel } from './hook';\nimport { Grid } from '../../grid';\nimport type { WordPressComponentProps } from '../../ui/context';\nimport { contextConnect } from '../../ui/context';\nimport type { ToolsPanelProps } from '../types';\n\nconst UnconnectedToolsPanel = (\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tchildren,\n\t\tlabel,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\theadingLevel,\n\t\t...toolsPanelProps\n\t} = useToolsPanel( props );\n\n\treturn (\n\t\t<Grid { ...toolsPanelProps } columns={ 2 } ref={ forwardedRef }>\n\t\t\t<ToolsPanelContext.Provider value={ panelContext }>\n\t\t\t\t<ToolsPanelHeader\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tresetAll={ resetAllItems }\n\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</ToolsPanelContext.Provider>\n\t\t</Grid>\n\t);\n};\n\n/**\n * The `ToolsPanel` is a container component that displays its children preceded\n * by a header. The header includes a dropdown menu which is automatically\n * generated from the panel's inner `ToolsPanelItems`.\n *\n * ```jsx\n * import { __ } from '@wordpress/i18n';\n * import {\n * __experimentalToolsPanel as ToolsPanel,\n * __experimentalToolsPanelItem as ToolsPanelItem,\n * __experimentalUnitControl as UnitControl\n * } from '@wordpress/components';\n *\n * function Example() {\n * const [ height, setHeight ] = useState();\n * const [ width, setWidth ] = useState();\n *\n * const resetAll = () => {\n * setHeight();\n * setWidth();\n * }\n *\n * return (\n * <ToolsPanel label={ __( 'Dimensions' ) } resetAll={ resetAll }>\n * <ToolsPanelItem\n * hasValue={ () => !! height }\n * label={ __( 'Height' ) }\n * onDeselect={ () => setHeight() }\n * >\n * <UnitControl\n * label={ __( 'Height' ) }\n * onChange={ setHeight }\n * value={ height }\n * />\n * </ToolsPanelItem>\n * <ToolsPanelItem\n * hasValue={ () => !! width }\n * label={ __( 'Width' ) }\n * onDeselect={ () => setWidth() }\n * >\n * <UnitControl\n * label={ __( 'Width' ) }\n * onChange={ setWidth }\n * value={ width }\n * />\n * </ToolsPanelItem>\n * </ToolsPanel>\n * );\n * }\n * ```\n */\nexport const ToolsPanel = contextConnect( UnconnectedToolsPanel, 'ToolsPanel' );\n\nexport default ToolsPanel;\n"],"mappings":";;;;;;;;AAQA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AASA,MAAMK,qBAAqB,GAAGA,CAC7BC,KAAwD,EACxDC,YAAiC,KAC7B;EACJ,MAAM;IACLC,QAAQ;IACRC,KAAK;IACLC,YAAY;IACZC,aAAa;IACbC,UAAU;IACVC,YAAY;IACZ,GAAGC;EACJ,CAAC,GAAG,IAAAC,mBAAa,EAAET,KAAM,CAAC;EAE1B,OACC,IAAAU,QAAA,CAAAC,aAAA,EAACd,KAAA,CAAAe,IAAI;IAAA,GAAMJ,eAAe;IAAGK,OAAO,EAAG,CAAG;IAACC,GAAG,EAAGb;EAAc,GAC9D,IAAAS,QAAA,CAAAC,aAAA,EAAChB,QAAA,CAAAoB,iBAAiB,CAACC,QAAQ;IAACC,KAAK,EAAGb;EAAc,GACjD,IAAAM,QAAA,CAAAC,aAAA,EAACnB,iBAAA,CAAA0B,OAAgB;IAChBf,KAAK,EAAGA,KAAO;IACfgB,QAAQ,EAAGd,aAAe;IAC1BC,UAAU,EAAGA,UAAY;IACzBC,YAAY,EAAGA;EAAc,CAC7B,CAAC,EACAL,QACyB,CACvB,CAAC;AAET,CAAC;;AAED;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;AACO,MAAMkB,UAAU,GAAG,IAAAC,wBAAc,EAAEtB,qBAAqB,EAAE,YAAa,CAAC;AAACuB,OAAA,CAAAF,UAAA,GAAAA,UAAA;AAAA,IAAAG,QAAA,GAEjEH,UAAU;AAAAE,OAAA,CAAAJ,OAAA,GAAAK,QAAA"}
@@ -154,7 +154,11 @@ const ToolsPanelHeader = (props, forwardedRef) => {
154
154
  items: optionalItems,
155
155
  toggleItem: toggleItem
156
156
  }), (0, _element.createElement)(_menuGroup.default, null, (0, _element.createElement)(_menuItem.default, {
157
- "aria-disabled": !canResetAll,
157
+ "aria-disabled": !canResetAll
158
+ // @ts-expect-error - TODO: If this "tertiary" style is something we really want to allow on MenuItem,
159
+ // we should rename it and explicitly allow it as an official API. All the other Button variants
160
+ // don't make sense in a MenuItem context, and should be disallowed.
161
+ ,
158
162
  variant: 'tertiary',
159
163
  onClick: () => {
160
164
  if (canResetAll) {
@@ -1 +1 @@
1
- {"version":3,"names":["_a11y","require","_icons","_i18n","_dropdownMenu","_interopRequireDefault","_menuGroup","_menuItem","_hStack","_heading","_hook","_context","_styles","DefaultControlsGroup","itemClassName","items","toggleItem","length","resetSuffix","_element","createElement","ResetLabel","__","default","label","map","hasValue","key","className","role","sprintf","onClick","speak","suffix","isSelected","OptionalControlsGroup","itemLabel","icon","check","ToolsPanelHeader","props","forwardedRef","areAllOptionalControlsHidden","defaultControlsItemClassName","dropdownMenuClassName","hasMenuItems","headingClassName","headingLevel","labelText","menuItems","resetAll","headerProps","useToolsPanelHeader","defaultItems","Object","entries","optionalItems","optional","dropDownMenuIcon","plus","moreVertical","dropDownMenuLabelText","_x","dropdownMenuDescriptionText","undefined","canResetAll","some","HStack","ref","Heading","level","menuProps","toggleProps","isSmall","describedBy","Fragment","variant","ConnectedToolsPanelHeader","contextConnect","_default","exports"],"sources":["@wordpress/components/src/tools-panel/tools-panel-header/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { check, moreVertical, plus } from '@wordpress/icons';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DropdownMenu from '../../dropdown-menu';\nimport MenuGroup from '../../menu-group';\nimport MenuItem from '../../menu-item';\nimport { HStack } from '../../h-stack';\nimport { Heading } from '../../heading';\nimport { useToolsPanelHeader } from './hook';\nimport type { WordPressComponentProps } from '../../ui/context';\nimport { contextConnect } from '../../ui/context';\nimport { ResetLabel } from '../styles';\nimport type {\n\tToolsPanelControlsGroupProps,\n\tToolsPanelHeaderProps,\n} from '../types';\n\nconst DefaultControlsGroup = ( {\n\titemClassName,\n\titems,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\tconst resetSuffix = <ResetLabel aria-hidden>{ __( 'Reset' ) }</ResetLabel>;\n\n\treturn (\n\t\t<MenuGroup label={ __( 'Defaults' ) }>\n\t\t\t{ items.map( ( [ label, hasValue ] ) => {\n\t\t\t\tif ( hasValue ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\tclassName={ itemClassName }\n\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t__( 'Reset %s' ),\n\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t\t\t__( '%s reset to default' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsuffix={ resetSuffix }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\tclassName={ itemClassName }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\taria-disabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</MenuGroup>\n\t);\n};\n\nconst OptionalControlsGroup = ( {\n\titems,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t{ items.map( ( [ label, isSelected ] ) => {\n\t\t\t\tconst itemLabel = isSelected\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control being hidden and reset e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Hide and reset %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control to display e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Show %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t );\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ isSelected ? check : null }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tlabel={ itemLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( isSelected ) {\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t\t\t__( '%s hidden and reset to default' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t\t\t__( '%s is now visible' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</MenuGroup>\n\t);\n};\n\nconst ToolsPanelHeader = (\n\tprops: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tareAllOptionalControlsHidden,\n\t\tdefaultControlsItemClassName,\n\t\tdropdownMenuClassName,\n\t\thasMenuItems,\n\t\theadingClassName,\n\t\theadingLevel = 2,\n\t\tlabel: labelText,\n\t\tmenuItems,\n\t\tresetAll,\n\t\ttoggleItem,\n\t\t...headerProps\n\t} = useToolsPanelHeader( props );\n\n\tif ( ! labelText ) {\n\t\treturn null;\n\t}\n\n\tconst defaultItems = Object.entries( menuItems?.default || {} );\n\tconst optionalItems = Object.entries( menuItems?.optional || {} );\n\tconst dropDownMenuIcon = areAllOptionalControlsHidden ? plus : moreVertical;\n\tconst dropDownMenuLabelText = sprintf(\n\t\t// translators: %s: The name of the tool e.g. \"Color\" or \"Typography\".\n\t\t_x( '%s options', 'Button label to reveal tool panel options' ),\n\t\tlabelText\n\t);\n\tconst dropdownMenuDescriptionText = areAllOptionalControlsHidden\n\t\t? __( 'All options are currently hidden' )\n\t\t: undefined;\n\n\tconst canResetAll = [ ...defaultItems, ...optionalItems ].some(\n\t\t( [ , isSelected ] ) => isSelected\n\t);\n\n\treturn (\n\t\t<HStack { ...headerProps } ref={ forwardedRef }>\n\t\t\t<Heading level={ headingLevel } className={ headingClassName }>\n\t\t\t\t{ labelText }\n\t\t\t</Heading>\n\t\t\t{ hasMenuItems && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ dropDownMenuIcon }\n\t\t\t\t\tlabel={ dropDownMenuLabelText }\n\t\t\t\t\tmenuProps={ { className: dropdownMenuClassName } }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\tdescribedBy: dropdownMenuDescriptionText,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ () => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<DefaultControlsGroup\n\t\t\t\t\t\t\t\titems={ defaultItems }\n\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t\titemClassName={ defaultControlsItemClassName }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<OptionalControlsGroup\n\t\t\t\t\t\t\t\titems={ optionalItems }\n\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\taria-disabled={ ! canResetAll }\n\t\t\t\t\t\t\t\t\tvariant={ 'tertiary' }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif ( canResetAll ) {\n\t\t\t\t\t\t\t\t\t\t\tresetAll();\n\t\t\t\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'All options reset' ),\n\t\t\t\t\t\t\t\t\t\t\t\t'assertive'\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\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset all' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</HStack>\n\t);\n};\n\nconst ConnectedToolsPanelHeader = contextConnect(\n\tToolsPanelHeader,\n\t'ToolsPanelHeader'\n);\n\nexport default ConnectedToolsPanelHeader;\n"],"mappings":";;;;;;;;AAQA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,SAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AAEA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAeA,MAAMY,oBAAoB,GAAGA,CAAE;EAC9BC,aAAa;EACbC,KAAK;EACLC;AAC6B,CAAC,KAAM;EACpC,IAAK,CAAED,KAAK,CAACE,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,MAAMC,WAAW,GAAG,IAAAC,QAAA,CAAAC,aAAA,EAACR,OAAA,CAAAS,UAAU;IAAC;EAAW,GAAG,IAAAC,QAAE,EAAE,OAAQ,CAAe,CAAC;EAE1E,OACC,IAAAH,QAAA,CAAAC,aAAA,EAACd,UAAA,CAAAiB,OAAS;IAACC,KAAK,EAAG,IAAAF,QAAE,EAAE,UAAW;EAAG,GAClCP,KAAK,CAACU,GAAG,CAAE,CAAE,CAAED,KAAK,EAAEE,QAAQ,CAAE,KAAM;IACvC,IAAKA,QAAQ,EAAG;MACf,OACC,IAAAP,QAAA,CAAAC,aAAA,EAACb,SAAA,CAAAgB,OAAQ;QACRI,GAAG,EAAGH,KAAO;QACbI,SAAS,EAAGd,aAAe;QAC3Be,I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,OAAO,EAAG,UAAY;IACtB7C,OAAO,EAAGA,CAAA,KAAM;MACf,IAAKkC,WAAW,EAAG;QAClBf,QAAQ,CAAC,CAAC;QACV,IAAAlB,WAAK,EACJ,IAAAV,QAAE,EAAE,mBAAoB,CAAC,EACzB,WACD,CAAC;MACF;IACD;EAAG,GAED,IAAAA,QAAE,EAAE,WAAY,CACT,CACA,CACV,CAEU,CAER,CAAC;AAEX,CAAC;AAED,MAAMuD,yBAAyB,GAAG,IAAAC,uBAAc,EAC/CvC,gBAAgB,EAChB,kBACD,CAAC;AAAC,IAAAwC,QAAA,GAEaF,yBAAyB;AAAAG,OAAA,CAAAzD,OAAA,GAAAwD,QAAA"}
1
+ {"version":3,"names":["_a11y","require","_icons","_i18n","_dropdownMenu","_interopRequireDefault","_menuGroup","_menuItem","_hStack","_heading","_hook","_context","_styles","DefaultControlsGroup","itemClassName","items","toggleItem","length","resetSuffix","_element","createElement","ResetLabel","__","default","label","map","hasValue","key","className","role","sprintf","onClick","speak","suffix","isSelected","OptionalControlsGroup","itemLabel","icon","check","ToolsPanelHeader","props","forwardedRef","areAllOptionalControlsHidden","defaultControlsItemClassName","dropdownMenuClassName","hasMenuItems","headingClassName","headingLevel","labelText","menuItems","resetAll","headerProps","useToolsPanelHeader","defaultItems","Object","entries","optionalItems","optional","dropDownMenuIcon","plus","moreVertical","dropDownMenuLabelText","_x","dropdownMenuDescriptionText","undefined","canResetAll","some","HStack","ref","Heading","level","menuProps","toggleProps","isSmall","describedBy","Fragment","variant","ConnectedToolsPanelHeader","contextConnect","_default","exports"],"sources":["@wordpress/components/src/tools-panel/tools-panel-header/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { check, moreVertical, plus } from '@wordpress/icons';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DropdownMenu from '../../dropdown-menu';\nimport MenuGroup from '../../menu-group';\nimport MenuItem from '../../menu-item';\nimport { HStack } from '../../h-stack';\nimport { Heading } from '../../heading';\nimport { useToolsPanelHeader } from './hook';\nimport type { WordPressComponentProps } from '../../ui/context';\nimport { contextConnect } from '../../ui/context';\nimport { ResetLabel } from '../styles';\nimport type {\n\tToolsPanelControlsGroupProps,\n\tToolsPanelHeaderProps,\n} from '../types';\n\nconst DefaultControlsGroup = ( {\n\titemClassName,\n\titems,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\tconst resetSuffix = <ResetLabel aria-hidden>{ __( 'Reset' ) }</ResetLabel>;\n\n\treturn (\n\t\t<MenuGroup label={ __( 'Defaults' ) }>\n\t\t\t{ items.map( ( [ label, hasValue ] ) => {\n\t\t\t\tif ( hasValue ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\tclassName={ itemClassName }\n\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t__( 'Reset %s' ),\n\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t\t\t__( '%s reset to default' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsuffix={ resetSuffix }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\tclassName={ itemClassName }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\taria-disabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</MenuGroup>\n\t);\n};\n\nconst OptionalControlsGroup = ( {\n\titems,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t{ items.map( ( [ label, isSelected ] ) => {\n\t\t\t\tconst itemLabel = isSelected\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control being hidden and reset e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Hide and reset %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control to display e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Show %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t );\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ isSelected ? check : null }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tlabel={ itemLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( isSelected ) {\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t\t\t__( '%s hidden and reset to default' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t\t\t__( '%s is now visible' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</MenuGroup>\n\t);\n};\n\nconst ToolsPanelHeader = (\n\tprops: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tareAllOptionalControlsHidden,\n\t\tdefaultControlsItemClassName,\n\t\tdropdownMenuClassName,\n\t\thasMenuItems,\n\t\theadingClassName,\n\t\theadingLevel = 2,\n\t\tlabel: labelText,\n\t\tmenuItems,\n\t\tresetAll,\n\t\ttoggleItem,\n\t\t...headerProps\n\t} = useToolsPanelHeader( props );\n\n\tif ( ! labelText ) {\n\t\treturn null;\n\t}\n\n\tconst defaultItems = Object.entries( menuItems?.default || {} );\n\tconst optionalItems = Object.entries( menuItems?.optional || {} );\n\tconst dropDownMenuIcon = areAllOptionalControlsHidden ? plus : moreVertical;\n\tconst dropDownMenuLabelText = sprintf(\n\t\t// translators: %s: The name of the tool e.g. \"Color\" or \"Typography\".\n\t\t_x( '%s options', 'Button label to reveal tool panel options' ),\n\t\tlabelText\n\t);\n\tconst dropdownMenuDescriptionText = areAllOptionalControlsHidden\n\t\t? __( 'All options are currently hidden' )\n\t\t: undefined;\n\n\tconst canResetAll = [ ...defaultItems, ...optionalItems ].some(\n\t\t( [ , isSelected ] ) => isSelected\n\t);\n\n\treturn (\n\t\t<HStack { ...headerProps } ref={ forwardedRef }>\n\t\t\t<Heading level={ headingLevel } className={ headingClassName }>\n\t\t\t\t{ labelText }\n\t\t\t</Heading>\n\t\t\t{ hasMenuItems && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ dropDownMenuIcon }\n\t\t\t\t\tlabel={ dropDownMenuLabelText }\n\t\t\t\t\tmenuProps={ { className: dropdownMenuClassName } }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\tdescribedBy: dropdownMenuDescriptionText,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ () => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<DefaultControlsGroup\n\t\t\t\t\t\t\t\titems={ defaultItems }\n\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t\titemClassName={ defaultControlsItemClassName }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<OptionalControlsGroup\n\t\t\t\t\t\t\t\titems={ optionalItems }\n\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\taria-disabled={ ! canResetAll }\n\t\t\t\t\t\t\t\t\t// @ts-expect-error - TODO: If this \"tertiary\" style is something we really want to allow on MenuItem,\n\t\t\t\t\t\t\t\t\t// we should rename it and explicitly allow it as an official API. All the other Button variants\n\t\t\t\t\t\t\t\t\t// don't make sense in a MenuItem context, and should be disallowed.\n\t\t\t\t\t\t\t\t\tvariant={ 'tertiary' }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif ( canResetAll ) {\n\t\t\t\t\t\t\t\t\t\t\tresetAll();\n\t\t\t\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'All options reset' ),\n\t\t\t\t\t\t\t\t\t\t\t\t'assertive'\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\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset all' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</HStack>\n\t);\n};\n\nconst ConnectedToolsPanelHeader = contextConnect(\n\tToolsPanelHeader,\n\t'ToolsPanelHeader'\n);\n\nexport default ConnectedToolsPanelHeader;\n"],"mappings":";;;;;;;;AAQA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,SAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AAEA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAeA,MAAMY,oBAAoB,GAAGA,CAAE;EAC9BC,aAAa;EACbC,KAAK;EACLC;AAC6B,CAAC,KAAM;EACpC,IAAK,CAAED,KAAK,CAACE,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,MAAMC,WA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AAA,CAAAC,aAAA,EAAAD,QAAA,CAAAwD,QAAA,QACC,IAAAxD,QAAA,CAAAC,aAAA,EAACP,oBAAoB;IACpBE,KAAK,EAAGsC,YAAc;IACtBrC,UAAU,EAAGA,UAAY;IACzBF,aAAa,EAAG6B;EAA8B,CAC9C,CAAC,EACF,IAAAxB,QAAA,CAAAC,aAAA,EAACe,qBAAqB;IACrBpB,KAAK,EAAGyC,aAAe;IACvBxC,UAAU,EAAGA;EAAY,CACzB,CAAC,EACF,IAAAG,QAAA,CAAAC,aAAA,EAACd,UAAA,CAAAiB,OAAS,QACT,IAAAJ,QAAA,CAAAC,aAAA,EAACb,SAAA,CAAAgB,OAAQ;IACR,iBAAgB,CAAE0C;IAClB;IACA;IACA;IAAA;IACAW,OAAO,EAAG,UAAY;IACtB7C,OAAO,EAAGA,CAAA,KAAM;MACf,IAAKkC,WAAW,EAAG;QAClBf,QAAQ,CAAC,CAAC;QACV,IAAAlB,WAAK,EACJ,IAAAV,QAAE,EAAE,mBAAoB,CAAC,EACzB,WACD,CAAC;MACF;IACD;EAAG,GAED,IAAAA,QAAE,EAAE,WAAY,CACT,CACA,CACV,CAEU,CAER,CAAC;AAEX,CAAC;AAED,MAAMuD,yBAAyB,GAAG,IAAAC,uBAAc,EAC/CvC,gBAAgB,EAChB,kBACD,CAAC;AAAC,IAAAwC,QAAA,GAEaF,yBAAyB;AAAAG,OAAA,CAAAzD,OAAA,GAAAwD,QAAA"}
@@ -26,7 +26,6 @@ function getSelectOptions(tree, level = 0) {
26
26
  /**
27
27
  * TreeSelect component is used to generate select input fields.
28
28
  *
29
- * @example
30
29
  * ```jsx
31
30
  * import { TreeSelect } from '@wordpress/components';
32
31
  * import { useState } from '@wordpress/element';
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_htmlEntities","_selectControl","getSelectOptions","tree","level","flatMap","treeNode","value","id","label","repeat","decodeEntities","name","children","TreeSelect","noOptionLabel","onChange","selectedId","props","options","useMemo","filter","option","createElement","SelectControl","_default","exports","default"],"sources":["@wordpress/components/src/tree-select/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { SelectControl } from '../select-control';\nimport type { TreeSelectProps, Tree, Truthy } from './types';\n\nfunction getSelectOptions(\n\ttree: Tree[],\n\tlevel = 0\n): NonNullable< TreeSelectProps[ 'options' ] > {\n\treturn tree.flatMap( ( treeNode ) => [\n\t\t{\n\t\t\tvalue: treeNode.id,\n\t\t\tlabel:\n\t\t\t\t'\\u00A0'.repeat( level * 3 ) + decodeEntities( treeNode.name ),\n\t\t},\n\t\t...getSelectOptions( treeNode.children || [], level + 1 ),\n\t] );\n}\n\n/**\n * TreeSelect component is used to generate select input fields.\n *\n * @example\n * ```jsx\n * import { TreeSelect } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTreeSelect = () => {\n * \tconst [ page, setPage ] = useState( 'p21' );\n *\n * \treturn (\n * \t\t<TreeSelect\n * \t\t\tlabel=\"Parent page\"\n * \t\t\tnoOptionLabel=\"No parent page\"\n * \t\t\tonChange={ ( newPage ) => setPage( newPage ) }\n * \t\t\tselectedId={ page }\n * \t\t\ttree={ [\n * \t\t\t\t{\n * \t\t\t\t\tname: 'Page 1',\n * \t\t\t\t\tid: 'p1',\n * \t\t\t\t\tchildren: [\n * \t\t\t\t\t\t{ name: 'Descend 1 of page 1', id: 'p11' },\n * \t\t\t\t\t\t{ name: 'Descend 2 of page 1', id: 'p12' },\n * \t\t\t\t\t],\n * \t\t\t\t},\n * \t\t\t\t{\n * \t\t\t\t\tname: 'Page 2',\n * \t\t\t\t\tid: 'p2',\n * \t\t\t\t\tchildren: [\n * \t\t\t\t\t\t{\n * \t\t\t\t\t\t\tname: 'Descend 1 of page 2',\n * \t\t\t\t\t\t\tid: 'p21',\n * \t\t\t\t\t\t\tchildren: [\n * \t\t\t\t\t\t\t\t{\n * \t\t\t\t\t\t\t\t\tname: 'Descend 1 of Descend 1 of page 2',\n * \t\t\t\t\t\t\t\t\tid: 'p211',\n * \t\t\t\t\t\t\t\t},\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},\n * \t\t\t] }\n * \t\t/>\n * \t);\n * }\n * ```\n */\n\nexport function TreeSelect( {\n\tlabel,\n\tnoOptionLabel,\n\tonChange,\n\tselectedId,\n\ttree = [],\n\t...props\n}: TreeSelectProps ) {\n\tconst options = useMemo( () => {\n\t\treturn [\n\t\t\tnoOptionLabel && { value: '', label: noOptionLabel },\n\t\t\t...getSelectOptions( tree ),\n\t\t].filter( < T, >( option: T ): option is Truthy< T > => !! option );\n\t}, [ noOptionLabel, tree ] );\n\n\treturn (\n\t\t<SelectControl\n\t\t\t{ ...{ label, options, onChange } }\n\t\t\tvalue={ selectedId }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default TreeSelect;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAIA,SAASG,gBAAgBA,CACxBC,IAAY,EACZC,KAAK,GAAG,CAAC,EACqC;EAC9C,OAAOD,IAAI,CAACE,OAAO,CAAIC,QAAQ,IAAM,CACpC;IACCC,KAAK,EAAED,QAAQ,CAACE,EAAE;IAClBC,KAAK,EACJ,QAAQ,CAACC,MAAM,CAAEN,KAAK,GAAG,CAAE,CAAC,GAAG,IAAAO,4BAAc,EAAEL,QAAQ,CAACM,IAAK;EAC/D,CAAC,EACD,GAAGV,gBAAgB,CAAEI,QAAQ,CAACO,QAAQ,IAAI,EAAE,EAAET,KAAK,GAAG,CAAE,CAAC,CACxD,CAAC;AACJ;;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;;AAEO,SAASU,UAAUA,CAAE;EAC3BL,KAAK;EACLM,aAAa;EACbC,QAAQ;EACRC,UAAU;EACVd,IAAI,GAAG,EAAE;EACT,GAAGe;AACa,CAAC,EAAG;EACpB,MAAMC,OAAO,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAC9B,OAAO,CACNL,aAAa,IAAI;MAAER,KAAK,EAAE,EAAE;MAAEE,KAAK,EAAEM;IAAc,CAAC,EACpD,GAAGb,gBAAgB,CAAEC,IAAK,CAAC,CAC3B,CAACkB,MAAM,CAAUC,MAAS,IAA6B,CAAC,CAAEA,MAAO,CAAC;EACpE,CAAC,EAAE,CAAEP,aAAa,EAAEZ,IAAI,CAAG,CAAC;EAE5B,OACC,IAAAL,QAAA,CAAAyB,aAAA,EAACtB,cAAA,CAAAuB,aAAa;IACNf,KAAK;IAAEU,OAAO;IAAEH,QAAQ;IAC/BT,KAAK,EAAGU,UAAY;IAAA,GACfC;EAAK,CACV,CAAC;AAEJ;AAAC,IAAAO,QAAA,GAEcX,UAAU;AAAAY,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_element","require","_htmlEntities","_selectControl","getSelectOptions","tree","level","flatMap","treeNode","value","id","label","repeat","decodeEntities","name","children","TreeSelect","noOptionLabel","onChange","selectedId","props","options","useMemo","filter","option","createElement","SelectControl","_default","exports","default"],"sources":["@wordpress/components/src/tree-select/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { SelectControl } from '../select-control';\nimport type { TreeSelectProps, Tree, Truthy } from './types';\n\nfunction getSelectOptions(\n\ttree: Tree[],\n\tlevel = 0\n): NonNullable< TreeSelectProps[ 'options' ] > {\n\treturn tree.flatMap( ( treeNode ) => [\n\t\t{\n\t\t\tvalue: treeNode.id,\n\t\t\tlabel:\n\t\t\t\t'\\u00A0'.repeat( level * 3 ) + decodeEntities( treeNode.name ),\n\t\t},\n\t\t...getSelectOptions( treeNode.children || [], level + 1 ),\n\t] );\n}\n\n/**\n * TreeSelect component is used to generate select input fields.\n *\n * ```jsx\n * import { TreeSelect } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTreeSelect = () => {\n * \tconst [ page, setPage ] = useState( 'p21' );\n *\n * \treturn (\n * \t\t<TreeSelect\n * \t\t\tlabel=\"Parent page\"\n * \t\t\tnoOptionLabel=\"No parent page\"\n * \t\t\tonChange={ ( newPage ) => setPage( newPage ) }\n * \t\t\tselectedId={ page }\n * \t\t\ttree={ [\n * \t\t\t\t{\n * \t\t\t\t\tname: 'Page 1',\n * \t\t\t\t\tid: 'p1',\n * \t\t\t\t\tchildren: [\n * \t\t\t\t\t\t{ name: 'Descend 1 of page 1', id: 'p11' },\n * \t\t\t\t\t\t{ name: 'Descend 2 of page 1', id: 'p12' },\n * \t\t\t\t\t],\n * \t\t\t\t},\n * \t\t\t\t{\n * \t\t\t\t\tname: 'Page 2',\n * \t\t\t\t\tid: 'p2',\n * \t\t\t\t\tchildren: [\n * \t\t\t\t\t\t{\n * \t\t\t\t\t\t\tname: 'Descend 1 of page 2',\n * \t\t\t\t\t\t\tid: 'p21',\n * \t\t\t\t\t\t\tchildren: [\n * \t\t\t\t\t\t\t\t{\n * \t\t\t\t\t\t\t\t\tname: 'Descend 1 of Descend 1 of page 2',\n * \t\t\t\t\t\t\t\t\tid: 'p211',\n * \t\t\t\t\t\t\t\t},\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},\n * \t\t\t] }\n * \t\t/>\n * \t);\n * }\n * ```\n */\n\nexport function TreeSelect( {\n\tlabel,\n\tnoOptionLabel,\n\tonChange,\n\tselectedId,\n\ttree = [],\n\t...props\n}: TreeSelectProps ) {\n\tconst options = useMemo( () => {\n\t\treturn [\n\t\t\tnoOptionLabel && { value: '', label: noOptionLabel },\n\t\t\t...getSelectOptions( tree ),\n\t\t].filter( < T, >( option: T ): option is Truthy< T > => !! option );\n\t}, [ noOptionLabel, tree ] );\n\n\treturn (\n\t\t<SelectControl\n\t\t\t{ ...{ label, options, onChange } }\n\t\t\tvalue={ selectedId }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default TreeSelect;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAIA,SAASG,gBAAgBA,CACxBC,IAAY,EACZC,KAAK,GAAG,CAAC,EACqC;EAC9C,OAAOD,IAAI,CAACE,OAAO,CAAIC,QAAQ,IAAM,CACpC;IACCC,KAAK,EAAED,QAAQ,CAACE,EAAE;IAClBC,KAAK,EACJ,QAAQ,CAACC,MAAM,CAAEN,KAAK,GAAG,CAAE,CAAC,GAAG,IAAAO,4BAAc,EAAEL,QAAQ,CAACM,IAAK;EAC/D,CAAC,EACD,GAAGV,gBAAgB,CAAEI,QAAQ,CAACO,QAAQ,IAAI,EAAE,EAAET,KAAK,GAAG,CAAE,CAAC,CACxD,CAAC;AACJ;;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;;AAEO,SAASU,UAAUA,CAAE;EAC3BL,KAAK;EACLM,aAAa;EACbC,QAAQ;EACRC,UAAU;EACVd,IAAI,GAAG,EAAE;EACT,GAAGe;AACa,CAAC,EAAG;EACpB,MAAMC,OAAO,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAC9B,OAAO,CACNL,aAAa,IAAI;MAAER,KAAK,EAAE,EAAE;MAAEE,KAAK,EAAEM;IAAc,CAAC,EACpD,GAAGb,gBAAgB,CAAEC,IAAK,CAAC,CAC3B,CAACkB,MAAM,CAAUC,MAAS,IAA6B,CAAC,CAAEA,MAAO,CAAC;EACpE,CAAC,EAAE,CAAEP,aAAa,EAAEZ,IAAI,CAAG,CAAC;EAE5B,OACC,IAAAL,QAAA,CAAAyB,aAAA,EAACtB,cAAA,CAAAuB,aAAa;IACNf,KAAK;IAAEU,OAAO;IAAEH,QAAQ;IAC/BT,KAAK,EAAGU,UAAY;IAAA,GACfC;EAAK,CACV,CAAC;AAEJ;AAAC,IAAAO,QAAA,GAEcX,UAAU;AAAAY,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -179,7 +179,6 @@ function UnforwardedUnitControl(unitControlProps, forwardedRef) {
179
179
  * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).
180
180
  *
181
181
  *
182
- * @example
183
182
  * ```jsx
184
183
  * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';
185
184
  * import { useState } from '@wordpress/element';
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_deprecated","_i18n","_unitControlStyles","_unitSelectControl","_utils","_hooks","_strings","UnforwardedUnitControl","unitControlProps","forwardedRef","__unstableStateReducer","autoComplete","children","className","disabled","disableUnits","isPressEnterToChange","isResetValueOnUnitChange","isUnitSelectTabbable","label","onChange","onChangeProp","onUnitChange","size","unit","unitProp","units","unitsProp","CSS_UNITS","value","valueProp","onFocus","onFocusProp","props","deprecated","since","hint","version","nonNullValueProp","undefined","reFirstCharacterOfUnits","useMemo","list","getUnitsWithCurrentUnit","firstUnitValue","rest","firstCharacters","reduce","carry","first","escapeRegExp","substring","includes","RegExp","parsedQuantity","parsedUnit","getParsedQuantityAndUnit","setUnit","useControlledState","length","initial","fallback","useEffect","classes","classnames","handleOnQuantityChange","nextQuantityValue","changeProps","onChangeValue","getValidParsedQuantityAndUnit","join","handleOnUnitChange","nextUnitValue","data","nextValue","default","handleOnKeyDown","event","onKeyDown","metaKey","test","key","refInputSuffix","current","focus","useRef","inputSuffix","createElement","ref","__","onBlur","step","_activeUnit$step","activeUnit","find","option","ValueInput","spinControls","suffix","type","UnitControl","forwardRef","exports","_default"],"sources":["@wordpress/components/src/unit-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { KeyboardEvent, ForwardedRef, SyntheticEvent } from 'react';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef, useMemo, useRef, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport { ValueInput } from './styles/unit-control-styles';\nimport UnitSelectControl from './unit-select-control';\nimport {\n\tCSS_UNITS,\n\tgetParsedQuantityAndUnit,\n\tgetUnitsWithCurrentUnit,\n\tgetValidParsedQuantityAndUnit,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport { escapeRegExp } from '../utils/strings';\nimport type { UnitControlProps, UnitControlOnChangeCallback } from './types';\n\nfunction UnforwardedUnitControl(\n\tunitControlProps: WordPressComponentProps<\n\t\tUnitControlProps,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer,\n\t\tautoComplete = 'off',\n\t\t// @ts-expect-error Ensure that children is omitted from restProps\n\t\tchildren,\n\t\tclassName,\n\t\tdisabled = false,\n\t\tdisableUnits = false,\n\t\tisPressEnterToChange = false,\n\t\tisResetValueOnUnitChange = false,\n\t\tisUnitSelectTabbable = true,\n\t\tlabel,\n\t\tonChange: onChangeProp,\n\t\tonUnitChange,\n\t\tsize = 'default',\n\t\tunit: unitProp,\n\t\tunits: unitsProp = CSS_UNITS,\n\t\tvalue: valueProp,\n\t\tonFocus: onFocusProp,\n\t\t...props\n\t} = unitControlProps;\n\n\tif ( 'unit' in unitControlProps ) {\n\t\tdeprecated( 'UnitControl unit prop', {\n\t\t\tsince: '5.6',\n\t\t\thint: 'The unit should be provided within the `value` prop.',\n\t\t\tversion: '6.2',\n\t\t} );\n\t}\n\n\t// The `value` prop, in theory, should not be `null`, but the following line\n\t// ensures it fallback to `undefined` in case a consumer of `UnitControl`\n\t// still passes `null` as a `value`.\n\tconst nonNullValueProp = valueProp ?? undefined;\n\tconst [ units, reFirstCharacterOfUnits ] = useMemo( () => {\n\t\tconst list = getUnitsWithCurrentUnit(\n\t\t\tnonNullValueProp,\n\t\t\tunitProp,\n\t\t\tunitsProp\n\t\t);\n\t\tconst [ { value: firstUnitValue = '' } = {}, ...rest ] = list;\n\t\tconst firstCharacters = rest.reduce( ( carry, { value } ) => {\n\t\t\tconst first = escapeRegExp( value?.substring( 0, 1 ) || '' );\n\t\t\treturn carry.includes( first ) ? carry : `${ carry }|${ first }`;\n\t\t}, escapeRegExp( firstUnitValue.substring( 0, 1 ) ) );\n\t\treturn [ list, new RegExp( `^(?:${ firstCharacters })$`, 'i' ) ];\n\t}, [ nonNullValueProp, unitProp, unitsProp ] );\n\tconst [ parsedQuantity, parsedUnit ] = getParsedQuantityAndUnit(\n\t\tnonNullValueProp,\n\t\tunitProp,\n\t\tunits\n\t);\n\n\tconst [ unit, setUnit ] = useControlledState< string | undefined >(\n\t\tunits.length === 1 ? units[ 0 ].value : unitProp,\n\t\t{\n\t\t\tinitial: parsedUnit,\n\t\t\tfallback: '',\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tif ( parsedUnit !== undefined ) {\n\t\t\tsetUnit( parsedUnit );\n\t\t}\n\t}, [ parsedUnit, setUnit ] );\n\n\tconst classes = classnames(\n\t\t'components-unit-control',\n\t\t// This class is added for legacy purposes to maintain it on the outer\n\t\t// wrapper. See: https://github.com/WordPress/gutenberg/pull/45139\n\t\t'components-unit-control-wrapper',\n\t\tclassName\n\t);\n\n\tconst handleOnQuantityChange = (\n\t\tnextQuantityValue: number | string | undefined,\n\t\tchangeProps: {\n\t\t\tevent: SyntheticEvent;\n\t\t}\n\t) => {\n\t\tif (\n\t\t\tnextQuantityValue === '' ||\n\t\t\ttypeof nextQuantityValue === 'undefined' ||\n\t\t\tnextQuantityValue === null\n\t\t) {\n\t\t\tonChangeProp?.( '', changeProps );\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Customizing the onChange callback.\n\t\t * This allows as to broadcast a combined value+unit to onChange.\n\t\t */\n\t\tconst onChangeValue = getValidParsedQuantityAndUnit(\n\t\t\tnextQuantityValue,\n\t\t\tunits,\n\t\t\tparsedQuantity,\n\t\t\tunit\n\t\t).join( '' );\n\n\t\tonChangeProp?.( onChangeValue, changeProps );\n\t};\n\n\tconst handleOnUnitChange: UnitControlOnChangeCallback = (\n\t\tnextUnitValue,\n\t\tchangeProps\n\t) => {\n\t\tconst { data } = changeProps;\n\n\t\tlet nextValue = `${ parsedQuantity ?? '' }${ nextUnitValue }`;\n\n\t\tif ( isResetValueOnUnitChange && data?.default !== undefined ) {\n\t\t\tnextValue = `${ data.default }${ nextUnitValue }`;\n\t\t}\n\n\t\tonChangeProp?.( nextValue, changeProps );\n\t\tonUnitChange?.( nextUnitValue, changeProps );\n\n\t\tsetUnit( nextUnitValue );\n\t};\n\n\tlet handleOnKeyDown;\n\tif ( ! disableUnits && isUnitSelectTabbable && units.length ) {\n\t\thandleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\t\tprops.onKeyDown?.( event );\n\t\t\t// Unless the meta key was pressed (to avoid interfering with\n\t\t\t// shortcuts, e.g. pastes), moves focus to the unit select if a key\n\t\t\t// matches the first character of a unit.\n\t\t\tif ( ! event.metaKey && reFirstCharacterOfUnits.test( event.key ) )\n\t\t\t\trefInputSuffix.current?.focus();\n\t\t};\n\t}\n\n\tconst refInputSuffix = useRef< HTMLSelectElement >( null );\n\tconst inputSuffix = ! disableUnits ? (\n\t\t<UnitSelectControl\n\t\t\tref={ refInputSuffix }\n\t\t\taria-label={ __( 'Select unit' ) }\n\t\t\tdisabled={ disabled }\n\t\t\tisUnitSelectTabbable={ isUnitSelectTabbable }\n\t\t\tonChange={ handleOnUnitChange }\n\t\t\tsize={ size }\n\t\t\tunit={ unit }\n\t\t\tunits={ units }\n\t\t\tonFocus={ onFocusProp }\n\t\t\tonBlur={ unitControlProps.onBlur }\n\t\t/>\n\t) : null;\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\treturn (\n\t\t<ValueInput\n\t\t\t{ ...props }\n\t\t\tautoComplete={ autoComplete }\n\t\t\tclassName={ classes }\n\t\t\tdisabled={ disabled }\n\t\t\tspinControls=\"none\"\n\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\tlabel={ label }\n\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\tonChange={ handleOnQuantityChange }\n\t\t\tref={ forwardedRef }\n\t\t\tsize={ size }\n\t\t\tsuffix={ inputSuffix }\n\t\t\ttype={ isPressEnterToChange ? 'text' : 'number' }\n\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\tstep={ step }\n\t\t\tonFocus={ onFocusProp }\n\t\t\t__unstableStateReducer={ __unstableStateReducer }\n\t\t/>\n\t);\n}\n\n/**\n * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).\n *\n *\n * @example\n * ```jsx\n * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '10px' );\n *\n * return <UnitControl onChange={ setValue } value={ value } />;\n * };\n * ```\n */\nexport const UnitControl = forwardRef( UnforwardedUnitControl );\n\nexport { parseQuantityAndUnitFromRawValue, useCustomUnits } from './utils';\nexport default UnitControl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAMA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAMA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AA1BA;AACA;AACA;;AAIA;AACA;AACA;;AAqBA,SAASU,sBAAsBA,CAC9BC,gBAIC,EACDC,YAAiC,EAChC;EACD,MAAM;IACLC,sBAAsB;IACtBC,YAAY,GAAG,KAAK;IACpB;IACAC,QAAQ;IACRC,SAAS;IACTC,QAAQ,GAAG,KAAK;IAChBC,YAAY,GAAG,KAAK;IACpBC,oBAAoB,GAAG,KAAK;IAC5BC,wBAAwB,GAAG,KAAK;IAChCC,oBAAoB,GAAG,IAAI;IAC3BC,KAAK;IACLC,QAAQ,EAAEC,YAAY;IACtBC,YAAY;IACZC,IAAI,GAAG,SAAS;IAChBC,IAAI,EAAEC,QAAQ;IACdC,KAAK,EAAEC,SAAS,GAAGC,gBAAS;IAC5BC,KAAK,EAAEC,SAAS;IAChBC,OAAO,EAAEC,WAAW;IACpB,GAAGC;EACJ,CAAC,GAAGzB,gBAAgB;EAEpB,IAAK,MAAM,IAAIA,gBAAgB,EAAG;IACjC,IAAA0B,mBAAU,EAAE,uBAAuB,EAAE;MACpCC,KAAK,EAAE,KAAK;MACZC,IAAI,EAAE,sDAAsD;MAC5DC,OAAO,EAAE;IACV,CAAE,CAAC;EACJ;;EAEA;EACA;EACA;EACA,M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AAAhG,QAAA,CAAA2F,aAAA,EAACrF,kBAAA,CAAA8F,UAAU;IAAA,GACL/D,KAAK;IACVtB,YAAY,EAAGA,YAAc;IAC7BE,SAAS,EAAGkD,OAAS;IACrBjD,QAAQ,EAAGA,QAAU;IACrBmF,YAAY,EAAC,MAAM;IACnBjF,oBAAoB,EAAGA,oBAAsB;IAC7CG,KAAK,EAAGA,KAAO;IACf2D,SAAS,EAAGF,eAAiB;IAC7BxD,QAAQ,EAAG6C,sBAAwB;IACnCuB,GAAG,EAAG/E,YAAc;IACpBc,IAAI,EAAGA,IAAM;IACb2E,MAAM,EAAGZ,WAAa;IACtBa,IAAI,EAAGnF,oBAAoB,GAAG,MAAM,GAAG,QAAU;IACjDa,KAAK,EAAGyB,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,EAAI;IAC9BqC,IAAI,EAAGA,IAAM;IACb5D,OAAO,EAAGC,WAAa;IACvBtB,sBAAsB,EAAGA;EAAwB,CACjD,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM0F,WAAW,GAAG,IAAAC,mBAAU,EAAE9F,sBAAuB,CAAC;AAAC+F,OAAA,CAAAF,WAAA,GAAAA,WAAA;AAAA,IAAAG,QAAA,GAGjDH,WAAW;AAAAE,OAAA,CAAA3B,OAAA,GAAA4B,QAAA"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_deprecated","_i18n","_unitControlStyles","_unitSelectControl","_utils","_hooks","_strings","UnforwardedUnitControl","unitControlProps","forwardedRef","__unstableStateReducer","autoComplete","children","className","disabled","disableUnits","isPressEnterToChange","isResetValueOnUnitChange","isUnitSelectTabbable","label","onChange","onChangeProp","onUnitChange","size","unit","unitProp","units","unitsProp","CSS_UNITS","value","valueProp","onFocus","onFocusProp","props","deprecated","since","hint","version","nonNullValueProp","undefined","reFirstCharacterOfUnits","useMemo","list","getUnitsWithCurrentUnit","firstUnitValue","rest","firstCharacters","reduce","carry","first","escapeRegExp","substring","includes","RegExp","parsedQuantity","parsedUnit","getParsedQuantityAndUnit","setUnit","useControlledState","length","initial","fallback","useEffect","classes","classnames","handleOnQuantityChange","nextQuantityValue","changeProps","onChangeValue","getValidParsedQuantityAndUnit","join","handleOnUnitChange","nextUnitValue","data","nextValue","default","handleOnKeyDown","event","onKeyDown","metaKey","test","key","refInputSuffix","current","focus","useRef","inputSuffix","createElement","ref","__","onBlur","step","_activeUnit$step","activeUnit","find","option","ValueInput","spinControls","suffix","type","UnitControl","forwardRef","exports","_default"],"sources":["@wordpress/components/src/unit-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { KeyboardEvent, ForwardedRef, SyntheticEvent } from 'react';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef, useMemo, useRef, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport { ValueInput } from './styles/unit-control-styles';\nimport UnitSelectControl from './unit-select-control';\nimport {\n\tCSS_UNITS,\n\tgetParsedQuantityAndUnit,\n\tgetUnitsWithCurrentUnit,\n\tgetValidParsedQuantityAndUnit,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport { escapeRegExp } from '../utils/strings';\nimport type { UnitControlProps, UnitControlOnChangeCallback } from './types';\n\nfunction UnforwardedUnitControl(\n\tunitControlProps: WordPressComponentProps<\n\t\tUnitControlProps,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer,\n\t\tautoComplete = 'off',\n\t\t// @ts-expect-error Ensure that children is omitted from restProps\n\t\tchildren,\n\t\tclassName,\n\t\tdisabled = false,\n\t\tdisableUnits = false,\n\t\tisPressEnterToChange = false,\n\t\tisResetValueOnUnitChange = false,\n\t\tisUnitSelectTabbable = true,\n\t\tlabel,\n\t\tonChange: onChangeProp,\n\t\tonUnitChange,\n\t\tsize = 'default',\n\t\tunit: unitProp,\n\t\tunits: unitsProp = CSS_UNITS,\n\t\tvalue: valueProp,\n\t\tonFocus: onFocusProp,\n\t\t...props\n\t} = unitControlProps;\n\n\tif ( 'unit' in unitControlProps ) {\n\t\tdeprecated( 'UnitControl unit prop', {\n\t\t\tsince: '5.6',\n\t\t\thint: 'The unit should be provided within the `value` prop.',\n\t\t\tversion: '6.2',\n\t\t} );\n\t}\n\n\t// The `value` prop, in theory, should not be `null`, but the following line\n\t// ensures it fallback to `undefined` in case a consumer of `UnitControl`\n\t// still passes `null` as a `value`.\n\tconst nonNullValueProp = valueProp ?? undefined;\n\tconst [ units, reFirstCharacterOfUnits ] = useMemo( () => {\n\t\tconst list = getUnitsWithCurrentUnit(\n\t\t\tnonNullValueProp,\n\t\t\tunitProp,\n\t\t\tunitsProp\n\t\t);\n\t\tconst [ { value: firstUnitValue = '' } = {}, ...rest ] = list;\n\t\tconst firstCharacters = rest.reduce( ( carry, { value } ) => {\n\t\t\tconst first = escapeRegExp( value?.substring( 0, 1 ) || '' );\n\t\t\treturn carry.includes( first ) ? carry : `${ carry }|${ first }`;\n\t\t}, escapeRegExp( firstUnitValue.substring( 0, 1 ) ) );\n\t\treturn [ list, new RegExp( `^(?:${ firstCharacters })$`, 'i' ) ];\n\t}, [ nonNullValueProp, unitProp, unitsProp ] );\n\tconst [ parsedQuantity, parsedUnit ] = getParsedQuantityAndUnit(\n\t\tnonNullValueProp,\n\t\tunitProp,\n\t\tunits\n\t);\n\n\tconst [ unit, setUnit ] = useControlledState< string | undefined >(\n\t\tunits.length === 1 ? units[ 0 ].value : unitProp,\n\t\t{\n\t\t\tinitial: parsedUnit,\n\t\t\tfallback: '',\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tif ( parsedUnit !== undefined ) {\n\t\t\tsetUnit( parsedUnit );\n\t\t}\n\t}, [ parsedUnit, setUnit ] );\n\n\tconst classes = classnames(\n\t\t'components-unit-control',\n\t\t// This class is added for legacy purposes to maintain it on the outer\n\t\t// wrapper. See: https://github.com/WordPress/gutenberg/pull/45139\n\t\t'components-unit-control-wrapper',\n\t\tclassName\n\t);\n\n\tconst handleOnQuantityChange = (\n\t\tnextQuantityValue: number | string | undefined,\n\t\tchangeProps: {\n\t\t\tevent: SyntheticEvent;\n\t\t}\n\t) => {\n\t\tif (\n\t\t\tnextQuantityValue === '' ||\n\t\t\ttypeof nextQuantityValue === 'undefined' ||\n\t\t\tnextQuantityValue === null\n\t\t) {\n\t\t\tonChangeProp?.( '', changeProps );\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Customizing the onChange callback.\n\t\t * This allows as to broadcast a combined value+unit to onChange.\n\t\t */\n\t\tconst onChangeValue = getValidParsedQuantityAndUnit(\n\t\t\tnextQuantityValue,\n\t\t\tunits,\n\t\t\tparsedQuantity,\n\t\t\tunit\n\t\t).join( '' );\n\n\t\tonChangeProp?.( onChangeValue, changeProps );\n\t};\n\n\tconst handleOnUnitChange: UnitControlOnChangeCallback = (\n\t\tnextUnitValue,\n\t\tchangeProps\n\t) => {\n\t\tconst { data } = changeProps;\n\n\t\tlet nextValue = `${ parsedQuantity ?? '' }${ nextUnitValue }`;\n\n\t\tif ( isResetValueOnUnitChange && data?.default !== undefined ) {\n\t\t\tnextValue = `${ data.default }${ nextUnitValue }`;\n\t\t}\n\n\t\tonChangeProp?.( nextValue, changeProps );\n\t\tonUnitChange?.( nextUnitValue, changeProps );\n\n\t\tsetUnit( nextUnitValue );\n\t};\n\n\tlet handleOnKeyDown;\n\tif ( ! disableUnits && isUnitSelectTabbable && units.length ) {\n\t\thandleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\t\tprops.onKeyDown?.( event );\n\t\t\t// Unless the meta key was pressed (to avoid interfering with\n\t\t\t// shortcuts, e.g. pastes), moves focus to the unit select if a key\n\t\t\t// matches the first character of a unit.\n\t\t\tif ( ! event.metaKey && reFirstCharacterOfUnits.test( event.key ) )\n\t\t\t\trefInputSuffix.current?.focus();\n\t\t};\n\t}\n\n\tconst refInputSuffix = useRef< HTMLSelectElement >( null );\n\tconst inputSuffix = ! disableUnits ? (\n\t\t<UnitSelectControl\n\t\t\tref={ refInputSuffix }\n\t\t\taria-label={ __( 'Select unit' ) }\n\t\t\tdisabled={ disabled }\n\t\t\tisUnitSelectTabbable={ isUnitSelectTabbable }\n\t\t\tonChange={ handleOnUnitChange }\n\t\t\tsize={ size }\n\t\t\tunit={ unit }\n\t\t\tunits={ units }\n\t\t\tonFocus={ onFocusProp }\n\t\t\tonBlur={ unitControlProps.onBlur }\n\t\t/>\n\t) : null;\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\treturn (\n\t\t<ValueInput\n\t\t\t{ ...props }\n\t\t\tautoComplete={ autoComplete }\n\t\t\tclassName={ classes }\n\t\t\tdisabled={ disabled }\n\t\t\tspinControls=\"none\"\n\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\tlabel={ label }\n\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\tonChange={ handleOnQuantityChange }\n\t\t\tref={ forwardedRef }\n\t\t\tsize={ size }\n\t\t\tsuffix={ inputSuffix }\n\t\t\ttype={ isPressEnterToChange ? 'text' : 'number' }\n\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\tstep={ step }\n\t\t\tonFocus={ onFocusProp }\n\t\t\t__unstableStateReducer={ __unstableStateReducer }\n\t\t/>\n\t);\n}\n\n/**\n * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).\n *\n *\n * ```jsx\n * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '10px' );\n *\n * return <UnitControl onChange={ setValue } value={ value } />;\n * };\n * ```\n */\nexport const UnitControl = forwardRef( UnforwardedUnitControl );\n\nexport { parseQuantityAndUnitFromRawValue, useCustomUnits } from './utils';\nexport default UnitControl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAMA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAMA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AA1BA;AACA;AACA;;AAIA;AACA;AACA;;AAqBA,SAASU,sBAAsBA,CAC9BC,gBAIC,EACDC,YAAiC,EAChC;EACD,MAAM;IACLC,sBAAsB;IACtBC,YAAY,GAAG,KAAK;IACpB;IACAC,QAAQ;IACRC,SAAS;IACTC,QAAQ,GAAG,KAAK;IAChBC,YAAY,GAAG,KAAK;IACpBC,oBAAoB,GAAG,KAAK;IAC5BC,wBAAwB,GAAG,KAAK;IAChCC,oBAAoB,GAAG,IAAI;IAC3BC,KAAK;IACLC,QAAQ,EAAEC,YAAY;IACtBC,YAAY;IACZC,IAAI,GAAG,SAAS;IAChBC,IAAI,EAAEC,QAAQ;IACdC,KAAK,EAAEC,SAAS,GAAGC,gBAAS;IAC5BC,KAAK,EAAEC,SAAS;IAChBC,OAAO,EAAEC,WAAW;IACpB,GAAGC;EACJ,CAAC,GAAGzB,gBAAgB;EAEpB,IAAK,MAAM,IAAIA,gBAAgB,EAAG;IACjC,IAAA0B,mBAAU,EAAE,uBAAuB,EAAE;MACpCC,KAAK,EAAE,KAAK;MACZC,IAAI,EAAE,sDAAsD;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IAAI,cAAAC,gBAAA,cAAAA,gBAAA,GAAI,CAAC;EAC7B;EAEA,OACC,IAAAhG,QAAA,CAAA2F,aAAA,EAACrF,kBAAA,CAAA8F,UAAU;IAAA,GACL/D,KAAK;IACVtB,YAAY,EAAGA,YAAc;IAC7BE,SAAS,EAAGkD,OAAS;IACrBjD,QAAQ,EAAGA,QAAU;IACrBmF,YAAY,EAAC,MAAM;IACnBjF,oBAAoB,EAAGA,oBAAsB;IAC7CG,KAAK,EAAGA,KAAO;IACf2D,SAAS,EAAGF,eAAiB;IAC7BxD,QAAQ,EAAG6C,sBAAwB;IACnCuB,GAAG,EAAG/E,YAAc;IACpBc,IAAI,EAAGA,IAAM;IACb2E,MAAM,EAAGZ,WAAa;IACtBa,IAAI,EAAGnF,oBAAoB,GAAG,MAAM,GAAG,QAAU;IACjDa,KAAK,EAAGyB,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,EAAI;IAC9BqC,IAAI,EAAGA,IAAM;IACb5D,OAAO,EAAGC,WAAa;IACvBtB,sBAAsB,EAAGA;EAAwB,CACjD,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM0F,WAAW,GAAG,IAAAC,mBAAU,EAAE9F,sBAAuB,CAAC;AAAC+F,OAAA,CAAAF,WAAA,GAAAA,WAAA;AAAA,IAAAG,QAAA,GAGjDH,WAAW;AAAAE,OAAA,CAAA3B,OAAA,GAAA4B,QAAA"}
@@ -26,7 +26,7 @@ const isSerializedStyles = o => typeof o !== 'undefined' && o !== null && ['name
26
26
  * `cx` normally knows how to handle. It also hooks into the Emotion
27
27
  * Cache, allowing `css` calls to work inside iframes.
28
28
  *
29
- * @example
29
+ * ```jsx
30
30
  * import { css } from '@emotion/react';
31
31
  *
32
32
  * const styles = css`
@@ -40,6 +40,7 @@ const isSerializedStyles = o => typeof o !== 'undefined' && o !== null && ['name
40
40
  *
41
41
  * return <span className={classes} {...props} />;
42
42
  * }
43
+ * ```
43
44
  */
44
45
  const useCx = () => {
45
46
  const cache = (0, _react.__unsafe_useEmotionCache)();
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_utils","_css","_element","isSerializedStyles","o","every","p","useCx","cache","useEmotionCache","cx","useCallback","classNames","Error","innerCx","map","arg","insertStyles","key","name","exports"],"sources":["@wordpress/components/src/utils/hooks/use-cx.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { __unsafe_useEmotionCache as useEmotionCache } from '@emotion/react';\nimport type { SerializedStyles } from '@emotion/serialize';\nimport { insertStyles } from '@emotion/utils';\n// eslint-disable-next-line no-restricted-imports\nimport type { ClassNamesArg } from '@emotion/css';\n// eslint-disable-next-line no-restricted-imports\nimport { cx as innerCx } from '@emotion/css';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\n\nconst isSerializedStyles = ( o: any ): o is SerializedStyles =>\n\ttypeof o !== 'undefined' &&\n\to !== null &&\n\t[ 'name', 'styles' ].every( ( p ) => typeof o[ p ] !== 'undefined' );\n\n/**\n * Retrieve a `cx` function that knows how to handle `SerializedStyles`\n * returned by the `@emotion/react` `css` function in addition to what\n * `cx` normally knows how to handle. It also hooks into the Emotion\n * Cache, allowing `css` calls to work inside iframes.\n *\n * @example\n * import { css } from '@emotion/react';\n *\n * const styles = css`\n * \tcolor: red\n * `;\n *\n * function RedText( { className, ...props } ) {\n * \tconst cx = useCx();\n *\n * \tconst classes = cx(styles, className);\n *\n * \treturn <span className={classes} {...props} />;\n * }\n */\nexport const useCx = () => {\n\tconst cache = useEmotionCache();\n\n\tconst cx = useCallback(\n\t\t( ...classNames: ( ClassNamesArg | SerializedStyles )[] ) => {\n\t\t\tif ( cache === null ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'The `useCx` hook should be only used within a valid Emotion Cache Context'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn innerCx(\n\t\t\t\t...classNames.map( ( arg ) => {\n\t\t\t\t\tif ( isSerializedStyles( arg ) ) {\n\t\t\t\t\t\tinsertStyles( cache, arg, false );\n\t\t\t\t\t\treturn `${ cache.key }-${ arg.name }`;\n\t\t\t\t\t}\n\t\t\t\t\treturn arg;\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t\t[ cache ]\n\t);\n\n\treturn cx;\n};\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAIA,IAAAE,IAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AAdA;AACA;AACA;;AAMA;;AAGA;AACA;AACA;;AAGA,MAAMI,kBAAkB,GAAKC,CAAM,IAClC,OAAOA,CAAC,KAAK,WAAW,IACxBA,CAAC,KAAK,IAAI,IACV,CAAE,MAAM,EAAE,QAAQ,CAAE,CAACC,KAAK,CAAIC,CAAC,IAAM,OAAOF,CAAC,CAAEE,CAAC,CAAE,KAAK,WAAY,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,KAAK,GAAGA,CAAA,KAAM;EAC1B,MAAMC,KAAK,GAAG,IAAAC,+BAAe,EAAC,CAAC;EAE/B,MAAMC,EAAE,GAAG,IAAAC,oBAAW,EACrB,CAAE,GAAGC,UAAkD,KAAM;IAC5D,IAAKJ,KAAK,KAAK,IAAI,EAAG;MACrB,MAAM,IAAIK,KAAK,CACd,2EACD,CAAC;IACF;IAEA,OAAO,IAAAC,OAAO,EACb,GAAGF,UAAU,CAACG,GAAG,CAAIC,GAAG,IAAM;MAC7B,IAAKb,kBAAkB,CAAEa,GAAI,CAAC,EAAG;QAChC,IAAAC,mBAAY,EAAET,KAAK,EAAEQ,GAAG,EAAE,KAAM,CAAC;QACjC,OAAQ,GAAGR,KAAK,CAACU,GAAK,IAAIF,GAAG,CAACG,IAAM,EAAC;MACtC;MACA,OAAOH,GAAG;IACX,CAAE,CACH,CAAC;EACF,CAAC,EACD,CAAER,KAAK,CACR,CAAC;EAED,OAAOE,EAAE;AACV,CAAC;AAACU,OAAA,CAAAb,KAAA,GAAAA,KAAA"}
1
+ {"version":3,"names":["_react","require","_utils","_css","_element","isSerializedStyles","o","every","p","useCx","cache","useEmotionCache","cx","useCallback","classNames","Error","innerCx","map","arg","insertStyles","key","name","exports"],"sources":["@wordpress/components/src/utils/hooks/use-cx.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { __unsafe_useEmotionCache as useEmotionCache } from '@emotion/react';\nimport type { SerializedStyles } from '@emotion/serialize';\nimport { insertStyles } from '@emotion/utils';\n// eslint-disable-next-line no-restricted-imports\nimport type { ClassNamesArg } from '@emotion/css';\n// eslint-disable-next-line no-restricted-imports\nimport { cx as innerCx } from '@emotion/css';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\n\nconst isSerializedStyles = ( o: any ): o is SerializedStyles =>\n\ttypeof o !== 'undefined' &&\n\to !== null &&\n\t[ 'name', 'styles' ].every( ( p ) => typeof o[ p ] !== 'undefined' );\n\n/**\n * Retrieve a `cx` function that knows how to handle `SerializedStyles`\n * returned by the `@emotion/react` `css` function in addition to what\n * `cx` normally knows how to handle. It also hooks into the Emotion\n * Cache, allowing `css` calls to work inside iframes.\n *\n * ```jsx\n * import { css } from '@emotion/react';\n *\n * const styles = css`\n * \tcolor: red\n * `;\n *\n * function RedText( { className, ...props } ) {\n * \tconst cx = useCx();\n *\n * \tconst classes = cx(styles, className);\n *\n * \treturn <span className={classes} {...props} />;\n * }\n * ```\n */\nexport const useCx = () => {\n\tconst cache = useEmotionCache();\n\n\tconst cx = useCallback(\n\t\t( ...classNames: ( ClassNamesArg | SerializedStyles )[] ) => {\n\t\t\tif ( cache === null ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'The `useCx` hook should be only used within a valid Emotion Cache Context'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn innerCx(\n\t\t\t\t...classNames.map( ( arg ) => {\n\t\t\t\t\tif ( isSerializedStyles( arg ) ) {\n\t\t\t\t\t\tinsertStyles( cache, arg, false );\n\t\t\t\t\t\treturn `${ cache.key }-${ arg.name }`;\n\t\t\t\t\t}\n\t\t\t\t\treturn arg;\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t\t[ cache ]\n\t);\n\n\treturn cx;\n};\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAIA,IAAAE,IAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AAdA;AACA;AACA;;AAMA;;AAGA;AACA;AACA;;AAGA,MAAMI,kBAAkB,GAAKC,CAAM,IAClC,OAAOA,CAAC,KAAK,WAAW,IACxBA,CAAC,KAAK,IAAI,IACV,CAAE,MAAM,EAAE,QAAQ,CAAE,CAACC,KAAK,CAAIC,CAAC,IAAM,OAAOF,CAAC,CAAEE,CAAC,CAAE,KAAK,WAAY,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,KAAK,GAAGA,CAAA,KAAM;EAC1B,MAAMC,KAAK,GAAG,IAAAC,+BAAe,EAAC,CAAC;EAE/B,MAAMC,EAAE,GAAG,IAAAC,oBAAW,EACrB,CAAE,GAAGC,UAAkD,KAAM;IAC5D,IAAKJ,KAAK,KAAK,IAAI,EAAG;MACrB,MAAM,IAAIK,KAAK,CACd,2EACD,CAAC;IACF;IAEA,OAAO,IAAAC,OAAO,EACb,GAAGF,UAAU,CAACG,GAAG,CAAIC,GAAG,IAAM;MAC7B,IAAKb,kBAAkB,CAAEa,GAAI,CAAC,EAAG;QAChC,IAAAC,mBAAY,EAAET,KAAK,EAAEQ,GAAG,EAAE,KAAM,CAAC;QACjC,OAAQ,GAAGR,KAAK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