@wordpress/components 25.14.0 → 25.15.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 (479) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/CONTRIBUTING.md +57 -115
  3. package/LICENSE.md +1 -1
  4. package/build/base-control/index.js +17 -13
  5. package/build/base-control/index.js.map +1 -1
  6. package/build/border-box-control/border-box-control-linked-button/component.js +1 -1
  7. package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  8. package/build/border-control/border-control-style-picker/component.js +1 -1
  9. package/build/border-control/border-control-style-picker/component.js.map +1 -1
  10. package/build/box-control/index.js +1 -1
  11. package/build/box-control/index.js.map +1 -1
  12. package/build/box-control/linked-button.js +1 -1
  13. package/build/box-control/linked-button.js.map +1 -1
  14. package/build/button/index.js +1 -1
  15. package/build/button/index.js.map +1 -1
  16. package/build/color-picker/color-copy-button.js +1 -1
  17. package/build/color-picker/color-copy-button.js.map +1 -1
  18. package/build/context/wordpress-component.js.map +1 -1
  19. package/build/custom-select-control-v2/index.js +11 -10
  20. package/build/custom-select-control-v2/index.js.map +1 -1
  21. package/build/date-time/date/styles.js +8 -8
  22. package/build/date-time/date/styles.js.map +1 -1
  23. package/build/dropdown-menu-v2/index.js +205 -159
  24. package/build/dropdown-menu-v2/index.js.map +1 -1
  25. package/build/dropdown-menu-v2/styles.js +86 -77
  26. package/build/dropdown-menu-v2/styles.js.map +1 -1
  27. package/build/dropdown-menu-v2/types.js.map +1 -1
  28. package/build/duotone-picker/duotone-picker.js +4 -3
  29. package/build/duotone-picker/duotone-picker.js.map +1 -1
  30. package/build/font-size-picker/index.js +4 -2
  31. package/build/font-size-picker/index.js.map +1 -1
  32. package/build/font-size-picker/index.native.js +6 -3
  33. package/build/font-size-picker/index.native.js.map +1 -1
  34. package/build/form-token-field/index.js +10 -5
  35. package/build/form-token-field/index.js.map +1 -1
  36. package/build/form-token-field/token.js +1 -0
  37. package/build/form-token-field/token.js.map +1 -1
  38. package/build/gradient-picker/index.js +3 -2
  39. package/build/gradient-picker/index.js.map +1 -1
  40. package/build/index.native.js +20 -3
  41. package/build/index.native.js.map +1 -1
  42. package/build/input-control/styles/input-control-styles.js +32 -29
  43. package/build/input-control/styles/input-control-styles.js.map +1 -1
  44. package/build/input-control/types.js.map +1 -1
  45. package/build/lock-unlock.js +18 -0
  46. package/build/lock-unlock.js.map +1 -0
  47. package/build/mobile/bottom-sheet/index.native.js +8 -0
  48. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  49. package/build/mobile/global-styles-context/utils.native.js +26 -13
  50. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  51. package/build/mobile/image/constants.js +12 -0
  52. package/build/mobile/image/constants.js.map +1 -0
  53. package/build/mobile/image/index.native.js +26 -18
  54. package/build/mobile/image/index.native.js.map +1 -1
  55. package/build/mobile/keyboard-aware-flat-list/index.android.js +40 -8
  56. package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  57. package/build/mobile/keyboard-aware-flat-list/index.ios.js +44 -68
  58. package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  59. package/build/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +39 -0
  60. package/build/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js.map +1 -0
  61. package/build/mobile/keyboard-aware-flat-list/{use-scroll-to-text-input.native.js → use-scroll-to-section.native.js} +22 -29
  62. package/build/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js.map +1 -0
  63. package/build/mobile/keyboard-aware-flat-list/use-scroll.native.js +93 -0
  64. package/build/mobile/keyboard-aware-flat-list/use-scroll.native.js.map +1 -0
  65. package/build/mobile/utils/get-px-from-css-unit.native.js +302 -0
  66. package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -0
  67. package/build/modal/index.js +18 -13
  68. package/build/modal/index.js.map +1 -1
  69. package/build/navigation/menu/menu-title.js +1 -1
  70. package/build/navigation/menu/menu-title.js.map +1 -1
  71. package/build/navigator/navigator-provider/component.js +13 -15
  72. package/build/navigator/navigator-provider/component.js.map +1 -1
  73. package/build/navigator/navigator-screen/component.js +23 -63
  74. package/build/navigator/navigator-screen/component.js.map +1 -1
  75. package/build/navigator/styles.js +52 -0
  76. package/build/navigator/styles.js.map +1 -0
  77. package/build/number-control/index.js +4 -8
  78. package/build/number-control/index.js.map +1 -1
  79. package/build/number-control/types.js.map +1 -1
  80. package/build/palette-edit/index.js +15 -54
  81. package/build/palette-edit/index.js.map +1 -1
  82. package/build/private-apis.js +11 -26
  83. package/build/private-apis.js.map +1 -1
  84. package/build/private-apis.native.js +21 -0
  85. package/build/private-apis.native.js.map +1 -0
  86. package/build/radio-control/index.js +1 -0
  87. package/build/radio-control/index.js.map +1 -1
  88. package/build/range-control/index.js +1 -1
  89. package/build/range-control/index.js.map +1 -1
  90. package/build/select-control/styles/select-control-styles.js +15 -25
  91. package/build/select-control/styles/select-control-styles.js.map +1 -1
  92. package/build/slot-fill/index.js +3 -2
  93. package/build/slot-fill/index.js.map +1 -1
  94. package/build/slot-fill/types.js.map +1 -1
  95. package/build/snackbar/types.js.map +1 -1
  96. package/build/tabs/styles.js +3 -3
  97. package/build/tabs/styles.js.map +1 -1
  98. package/build/tabs/tabpanel.js +9 -7
  99. package/build/tabs/tabpanel.js.map +1 -1
  100. package/build/toggle-group-control/toggle-group-control/component.js +4 -4
  101. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  102. package/build/toggle-group-control/toggle-group-control/styles.js +29 -15
  103. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  104. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
  105. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  106. package/build/tools-panel/tools-panel/component.js +3 -1
  107. package/build/tools-panel/tools-panel/component.js.map +1 -1
  108. package/build/tools-panel/tools-panel-header/component.js +9 -8
  109. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  110. package/build/tools-panel/types.js.map +1 -1
  111. package/build/tooltip/index.js +1 -1
  112. package/build/tooltip/index.js.map +1 -1
  113. package/build/truncate/hook.js +10 -4
  114. package/build/truncate/hook.js.map +1 -1
  115. package/build/truncate/types.js.map +1 -1
  116. package/build/unit-control/index.js +1 -1
  117. package/build/unit-control/index.js.map +1 -1
  118. package/build/utils/strings.js +34 -3
  119. package/build/utils/strings.js.map +1 -1
  120. package/build-module/base-control/index.js +16 -12
  121. package/build-module/base-control/index.js.map +1 -1
  122. package/build-module/border-box-control/border-box-control-linked-button/component.js +1 -1
  123. package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  124. package/build-module/border-control/border-control-style-picker/component.js +1 -1
  125. package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
  126. package/build-module/box-control/index.js +1 -1
  127. package/build-module/box-control/index.js.map +1 -1
  128. package/build-module/box-control/linked-button.js +1 -1
  129. package/build-module/box-control/linked-button.js.map +1 -1
  130. package/build-module/button/index.js +1 -1
  131. package/build-module/button/index.js.map +1 -1
  132. package/build-module/color-picker/color-copy-button.js +1 -1
  133. package/build-module/color-picker/color-copy-button.js.map +1 -1
  134. package/build-module/context/wordpress-component.js.map +1 -1
  135. package/build-module/custom-select-control-v2/index.js +11 -10
  136. package/build-module/custom-select-control-v2/index.js.map +1 -1
  137. package/build-module/date-time/date/styles.js +8 -8
  138. package/build-module/date-time/date/styles.js.map +1 -1
  139. package/build-module/dropdown-menu-v2/index.js +201 -154
  140. package/build-module/dropdown-menu-v2/index.js.map +1 -1
  141. package/build-module/dropdown-menu-v2/styles.js +68 -61
  142. package/build-module/dropdown-menu-v2/styles.js.map +1 -1
  143. package/build-module/dropdown-menu-v2/types.js.map +1 -1
  144. package/build-module/duotone-picker/duotone-picker.js +4 -3
  145. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  146. package/build-module/font-size-picker/index.js +4 -2
  147. package/build-module/font-size-picker/index.js.map +1 -1
  148. package/build-module/font-size-picker/index.native.js +5 -2
  149. package/build-module/font-size-picker/index.native.js.map +1 -1
  150. package/build-module/form-token-field/index.js +10 -5
  151. package/build-module/form-token-field/index.js.map +1 -1
  152. package/build-module/form-token-field/token.js +1 -0
  153. package/build-module/form-token-field/token.js.map +1 -1
  154. package/build-module/gradient-picker/index.js +3 -2
  155. package/build-module/gradient-picker/index.js.map +1 -1
  156. package/build-module/index.native.js +6 -1
  157. package/build-module/index.native.js.map +1 -1
  158. package/build-module/input-control/styles/input-control-styles.js +31 -29
  159. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  160. package/build-module/input-control/types.js.map +1 -1
  161. package/build-module/lock-unlock.js +9 -0
  162. package/build-module/lock-unlock.js.map +1 -0
  163. package/build-module/mobile/bottom-sheet/index.native.js +9 -1
  164. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  165. package/build-module/mobile/global-styles-context/utils.native.js +25 -13
  166. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  167. package/build-module/mobile/image/constants.js +5 -0
  168. package/build-module/mobile/image/constants.js.map +1 -0
  169. package/build-module/mobile/image/index.native.js +25 -16
  170. package/build-module/mobile/image/index.native.js.map +1 -1
  171. package/build-module/mobile/keyboard-aware-flat-list/index.android.js +40 -6
  172. package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  173. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +46 -68
  174. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  175. package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +33 -0
  176. package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js.map +1 -0
  177. package/build-module/mobile/keyboard-aware-flat-list/{use-scroll-to-text-input.native.js → use-scroll-to-section.native.js} +21 -27
  178. package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js.map +1 -0
  179. package/build-module/mobile/keyboard-aware-flat-list/use-scroll.native.js +86 -0
  180. package/build-module/mobile/keyboard-aware-flat-list/use-scroll.native.js.map +1 -0
  181. package/build-module/mobile/utils/get-px-from-css-unit.native.js +294 -0
  182. package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -0
  183. package/build-module/modal/index.js +18 -13
  184. package/build-module/modal/index.js.map +1 -1
  185. package/build-module/navigation/menu/menu-title.js +1 -1
  186. package/build-module/navigation/menu/menu-title.js.map +1 -1
  187. package/build-module/navigator/navigator-provider/component.js +3 -16
  188. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  189. package/build-module/navigator/navigator-screen/component.js +16 -70
  190. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  191. package/build-module/navigator/styles.js +47 -0
  192. package/build-module/navigator/styles.js.map +1 -0
  193. package/build-module/number-control/index.js +4 -8
  194. package/build-module/number-control/index.js.map +1 -1
  195. package/build-module/number-control/types.js.map +1 -1
  196. package/build-module/palette-edit/index.js +15 -51
  197. package/build-module/palette-edit/index.js.map +1 -1
  198. package/build-module/private-apis.js +10 -23
  199. package/build-module/private-apis.js.map +1 -1
  200. package/build-module/private-apis.native.js +14 -0
  201. package/build-module/private-apis.native.js.map +1 -0
  202. package/build-module/radio-control/index.js +1 -0
  203. package/build-module/radio-control/index.js.map +1 -1
  204. package/build-module/range-control/index.js +1 -1
  205. package/build-module/range-control/index.js.map +1 -1
  206. package/build-module/select-control/styles/select-control-styles.js +15 -25
  207. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  208. package/build-module/slot-fill/index.js +3 -2
  209. package/build-module/slot-fill/index.js.map +1 -1
  210. package/build-module/slot-fill/types.js.map +1 -1
  211. package/build-module/snackbar/types.js.map +1 -1
  212. package/build-module/tabs/styles.js +3 -3
  213. package/build-module/tabs/styles.js.map +1 -1
  214. package/build-module/tabs/tabpanel.js +9 -7
  215. package/build-module/tabs/tabpanel.js.map +1 -1
  216. package/build-module/toggle-group-control/toggle-group-control/component.js +4 -4
  217. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  218. package/build-module/toggle-group-control/toggle-group-control/styles.js +29 -15
  219. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  220. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
  221. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  222. package/build-module/tools-panel/tools-panel/component.js +3 -1
  223. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  224. package/build-module/tools-panel/tools-panel-header/component.js +9 -8
  225. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  226. package/build-module/tools-panel/types.js.map +1 -1
  227. package/build-module/tooltip/index.js +1 -1
  228. package/build-module/tooltip/index.js.map +1 -1
  229. package/build-module/truncate/hook.js +10 -4
  230. package/build-module/truncate/hook.js.map +1 -1
  231. package/build-module/truncate/types.js.map +1 -1
  232. package/build-module/unit-control/index.js +1 -1
  233. package/build-module/unit-control/index.js.map +1 -1
  234. package/build-module/utils/strings.js +32 -2
  235. package/build-module/utils/strings.js.map +1 -1
  236. package/build-style/style-rtl.css +29 -5
  237. package/build-style/style.css +29 -5
  238. package/build-types/base-control/index.d.ts +3 -27
  239. package/build-types/base-control/index.d.ts.map +1 -1
  240. package/build-types/base-control/stories/index.story.d.ts +4 -1
  241. package/build-types/base-control/stories/index.story.d.ts.map +1 -1
  242. package/build-types/color-picker/component.d.ts +1 -1
  243. package/build-types/color-picker/stories/index.story.d.ts +1 -1
  244. package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
  245. package/build-types/composite/test/index.d.ts.map +1 -0
  246. package/build-types/context/wordpress-component.d.ts +3 -3
  247. package/build-types/context/wordpress-component.d.ts.map +1 -1
  248. package/build-types/custom-select-control-v2/index.d.ts +3 -2
  249. package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
  250. package/build-types/custom-select-control-v2/stories/index.story.d.ts +4 -3
  251. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  252. package/build-types/dropdown/index.d.ts +1 -1
  253. package/build-types/dropdown/index.d.ts.map +1 -1
  254. package/build-types/dropdown/stories/index.story.d.ts +3 -3
  255. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  256. package/build-types/dropdown-menu/index.d.ts +1 -1
  257. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  258. package/build-types/dropdown-menu/stories/index.story.d.ts +2 -2
  259. package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
  260. package/build-types/dropdown-menu-v2/index.d.ts +18 -15
  261. package/build-types/dropdown-menu-v2/index.d.ts.map +1 -1
  262. package/build-types/dropdown-menu-v2/stories/index.story.d.ts +7 -2
  263. package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -1
  264. package/build-types/dropdown-menu-v2/styles.d.ts +77 -23
  265. package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -1
  266. package/build-types/dropdown-menu-v2/types.d.ts +89 -173
  267. package/build-types/dropdown-menu-v2/types.d.ts.map +1 -1
  268. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
  269. package/build-types/font-size-picker/index.d.ts.map +1 -1
  270. package/build-types/form-token-field/index.d.ts.map +1 -1
  271. package/build-types/form-token-field/token.d.ts.map +1 -1
  272. package/build-types/input-control/styles/input-control-styles.d.ts +11 -0
  273. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  274. package/build-types/input-control/types.d.ts +1 -1
  275. package/build-types/input-control/types.d.ts.map +1 -1
  276. package/build-types/lock-unlock.d.ts +3 -0
  277. package/build-types/lock-unlock.d.ts.map +1 -0
  278. package/build-types/mobile/image/constants.d.ts +5 -0
  279. package/build-types/mobile/image/constants.d.ts.map +1 -0
  280. package/build-types/modal/index.d.ts.map +1 -1
  281. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  282. package/build-types/navigator/navigator-screen/component.d.ts +1 -7
  283. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  284. package/build-types/navigator/styles.d.ts +9 -0
  285. package/build-types/navigator/styles.d.ts.map +1 -0
  286. package/build-types/number-control/index.d.ts.map +1 -1
  287. package/build-types/number-control/types.d.ts +1 -1
  288. package/build-types/palette-edit/index.d.ts +3 -8
  289. package/build-types/palette-edit/index.d.ts.map +1 -1
  290. package/build-types/popover/index.d.ts +1 -1
  291. package/build-types/popover/index.d.ts.map +1 -1
  292. package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
  293. package/build-types/private-apis.d.ts +0 -1
  294. package/build-types/private-apis.d.ts.map +1 -1
  295. package/build-types/radio-control/index.d.ts.map +1 -1
  296. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  297. package/build-types/slot-fill/index.d.ts +1 -1
  298. package/build-types/slot-fill/index.d.ts.map +1 -1
  299. package/build-types/slot-fill/types.d.ts +4 -0
  300. package/build-types/slot-fill/types.d.ts.map +1 -1
  301. package/build-types/snackbar/index.d.ts +2 -2
  302. package/build-types/snackbar/stories/index.story.d.ts +0 -3
  303. package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
  304. package/build-types/snackbar/types.d.ts +1 -1
  305. package/build-types/snackbar/types.d.ts.map +1 -1
  306. package/build-types/tabs/styles.d.ts.map +1 -1
  307. package/build-types/tabs/tabpanel.d.ts +1 -1
  308. package/build-types/tabs/tabpanel.d.ts.map +1 -1
  309. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  310. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +2 -2
  311. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  312. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +1 -1
  313. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  314. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  315. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  316. package/build-types/tools-panel/tools-panel/hook.d.ts +1 -0
  317. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  318. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  319. package/build-types/tools-panel/tools-panel-header/hook.d.ts +1 -0
  320. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  321. package/build-types/tools-panel/types.d.ts +9 -0
  322. package/build-types/tools-panel/types.d.ts.map +1 -1
  323. package/build-types/truncate/hook.d.ts +1 -1
  324. package/build-types/truncate/hook.d.ts.map +1 -1
  325. package/build-types/truncate/types.d.ts +4 -0
  326. package/build-types/truncate/types.d.ts.map +1 -1
  327. package/build-types/utils/strings.d.ts +14 -2
  328. package/build-types/utils/strings.d.ts.map +1 -1
  329. package/package.json +20 -21
  330. package/src/alignment-matrix-control/test/index.tsx +10 -16
  331. package/src/base-control/index.tsx +21 -16
  332. package/src/border-box-control/border-box-control-linked-button/component.tsx +1 -1
  333. package/src/border-control/border-control-style-picker/component.tsx +1 -1
  334. package/src/box-control/index.tsx +1 -1
  335. package/src/box-control/linked-button.tsx +1 -1
  336. package/src/button/README.md +32 -6
  337. package/src/button/index.tsx +1 -1
  338. package/src/button-group/README.md +0 -6
  339. package/src/card/card/README.md +1 -1
  340. package/src/checkbox-control/README.md +1 -9
  341. package/src/color-picker/color-copy-button.tsx +1 -1
  342. package/src/combobox-control/README.md +0 -6
  343. package/src/composite/test/index.tsx +576 -0
  344. package/src/context/wordpress-component.ts +11 -6
  345. package/src/custom-select-control/README.md +0 -6
  346. package/src/custom-select-control-v2/index.tsx +13 -12
  347. package/src/date-time/date/styles.ts +3 -3
  348. package/src/dropdown-menu/README.md +0 -5
  349. package/src/dropdown-menu-v2/README.md +75 -136
  350. package/src/dropdown-menu-v2/index.tsx +321 -231
  351. package/src/dropdown-menu-v2/stories/index.story.tsx +522 -126
  352. package/src/dropdown-menu-v2/styles.ts +226 -151
  353. package/src/dropdown-menu-v2/test/index.tsx +480 -188
  354. package/src/dropdown-menu-v2/types.ts +98 -184
  355. package/src/duotone-picker/duotone-picker.tsx +7 -3
  356. package/src/font-size-picker/index.native.js +8 -2
  357. package/src/font-size-picker/index.tsx +4 -2
  358. package/src/form-toggle/README.md +0 -6
  359. package/src/form-token-field/index.tsx +11 -7
  360. package/src/form-token-field/test/index.tsx +97 -0
  361. package/src/form-token-field/token.tsx +1 -0
  362. package/src/gradient-picker/index.tsx +2 -2
  363. package/src/index.native.js +6 -1
  364. package/src/input-control/styles/input-control-styles.tsx +10 -8
  365. package/src/input-control/types.ts +1 -1
  366. package/src/lock-unlock.js +10 -0
  367. package/src/menu-group/README.md +0 -8
  368. package/src/menu-items-choice/README.md +0 -7
  369. package/src/mobile/bottom-sheet/index.native.js +15 -1
  370. package/src/mobile/global-styles-context/test/fixtures/theme.native.js +0 -20
  371. package/src/mobile/global-styles-context/utils.native.js +28 -19
  372. package/src/mobile/image/constants.js +1 -0
  373. package/src/mobile/image/index.native.js +55 -18
  374. package/src/mobile/image/style.native.scss +35 -9
  375. package/src/mobile/keyboard-aware-flat-list/index.android.js +50 -5
  376. package/src/mobile/keyboard-aware-flat-list/index.ios.js +65 -91
  377. package/src/mobile/keyboard-aware-flat-list/test/{use-scroll-to-text-input.native.js → use-scroll-to-section.native.js} +27 -25
  378. package/src/mobile/keyboard-aware-flat-list/test/use-scroll.native.js +71 -0
  379. package/src/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +41 -0
  380. package/src/mobile/keyboard-aware-flat-list/{use-scroll-to-text-input.native.js → use-scroll-to-section.native.js} +22 -27
  381. package/src/mobile/keyboard-aware-flat-list/use-scroll.native.js +100 -0
  382. package/src/mobile/utils/get-px-from-css-unit.native.js +329 -0
  383. package/src/mobile/utils/test/get-px-from-css-unit.native.js +172 -0
  384. package/src/modal/README.md +0 -6
  385. package/src/modal/index.tsx +18 -16
  386. package/src/modal/test/index.tsx +90 -1
  387. package/src/navigation/menu/menu-title.tsx +1 -1
  388. package/src/navigator/navigator-provider/component.tsx +3 -4
  389. package/src/navigator/navigator-screen/component.tsx +15 -93
  390. package/src/navigator/styles.ts +71 -0
  391. package/src/navigator/test/index.tsx +0 -64
  392. package/src/notice/README.md +0 -6
  393. package/src/number-control/README.md +2 -2
  394. package/src/number-control/index.tsx +4 -8
  395. package/src/number-control/types.ts +1 -1
  396. package/src/palette-edit/index.tsx +15 -58
  397. package/src/palette-edit/test/index.tsx +1 -75
  398. package/src/panel/README.md +0 -6
  399. package/src/private-apis.native.js +13 -0
  400. package/src/private-apis.ts +12 -37
  401. package/src/radio-control/README.md +0 -6
  402. package/src/radio-control/index.tsx +4 -1
  403. package/src/radio-control/style.scss +29 -2
  404. package/src/radio-group/README.md +0 -6
  405. package/src/range-control/README.md +1 -9
  406. package/src/range-control/index.tsx +1 -1
  407. package/src/search-control/README.md +0 -6
  408. package/src/select-control/README.md +0 -6
  409. package/src/select-control/styles/select-control-styles.ts +10 -28
  410. package/src/slot-fill/index.tsx +5 -2
  411. package/src/slot-fill/types.ts +5 -0
  412. package/src/snackbar/README.md +0 -6
  413. package/src/snackbar/stories/index.story.tsx +7 -5
  414. package/src/snackbar/style.scss +4 -3
  415. package/src/snackbar/types.ts +2 -1
  416. package/src/spacer/README.md +0 -2
  417. package/src/tab-panel/README.md +0 -5
  418. package/src/tab-panel/test/index.tsx +39 -56
  419. package/src/tabs/styles.ts +7 -1
  420. package/src/tabs/tabpanel.tsx +7 -6
  421. package/src/tabs/test/index.tsx +56 -0
  422. package/src/text-control/README.md +0 -6
  423. package/src/textarea-control/README.md +0 -6
  424. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +12 -16
  425. package/src/toggle-group-control/test/index.tsx +58 -45
  426. package/src/toggle-group-control/toggle-group-control/component.tsx +5 -4
  427. package/src/toggle-group-control/toggle-group-control/styles.ts +13 -19
  428. package/src/toggle-group-control/toggle-group-control-option/README.md +1 -1
  429. package/src/toggle-group-control/toggle-group-control-option-base/README.md +1 -1
  430. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +3 -2
  431. package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
  432. package/src/toolbar/toolbar/README.md +0 -6
  433. package/src/tools-panel/test/index.tsx +12 -20
  434. package/src/tools-panel/tools-panel/README.md +7 -0
  435. package/src/tools-panel/tools-panel/component.tsx +2 -0
  436. package/src/tools-panel/tools-panel-header/README.md +7 -0
  437. package/src/tools-panel/tools-panel-header/component.tsx +20 -13
  438. package/src/tools-panel/types.ts +9 -0
  439. package/src/tooltip/index.tsx +1 -1
  440. package/src/tooltip/test/index.tsx +360 -256
  441. package/src/tree-grid/README.md +0 -4
  442. package/src/truncate/README.md +8 -0
  443. package/src/truncate/hook.ts +17 -10
  444. package/src/truncate/test/index.tsx +54 -27
  445. package/src/truncate/types.ts +4 -0
  446. package/src/unit-control/index.tsx +1 -1
  447. package/src/utils/strings.ts +30 -2
  448. package/src/utils/test/strings.js +96 -1
  449. package/tsconfig.tsbuildinfo +1 -1
  450. package/build/dropdown-menu-v2-ariakit/index.js +0 -256
  451. package/build/dropdown-menu-v2-ariakit/index.js.map +0 -1
  452. package/build/dropdown-menu-v2-ariakit/styles.js +0 -180
  453. package/build/dropdown-menu-v2-ariakit/styles.js.map +0 -1
  454. package/build/dropdown-menu-v2-ariakit/types.js +0 -6
  455. package/build/dropdown-menu-v2-ariakit/types.js.map +0 -1
  456. package/build/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js.map +0 -1
  457. package/build-module/dropdown-menu-v2-ariakit/index.js +0 -237
  458. package/build-module/dropdown-menu-v2-ariakit/index.js.map +0 -1
  459. package/build-module/dropdown-menu-v2-ariakit/styles.js +0 -165
  460. package/build-module/dropdown-menu-v2-ariakit/styles.js.map +0 -1
  461. package/build-module/dropdown-menu-v2-ariakit/types.js +0 -2
  462. package/build-module/dropdown-menu-v2-ariakit/types.js.map +0 -1
  463. package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js.map +0 -1
  464. package/build-types/dropdown-menu-v2-ariakit/index.d.ts +0 -20
  465. package/build-types/dropdown-menu-v2-ariakit/index.d.ts.map +0 -1
  466. package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts +0 -16
  467. package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts.map +0 -1
  468. package/build-types/dropdown-menu-v2-ariakit/styles.d.ts +0 -96
  469. package/build-types/dropdown-menu-v2-ariakit/styles.d.ts.map +0 -1
  470. package/build-types/dropdown-menu-v2-ariakit/test/index.d.ts.map +0 -1
  471. package/build-types/dropdown-menu-v2-ariakit/types.d.ts +0 -168
  472. package/build-types/dropdown-menu-v2-ariakit/types.d.ts.map +0 -1
  473. package/src/dropdown-menu-v2-ariakit/README.md +0 -331
  474. package/src/dropdown-menu-v2-ariakit/index.tsx +0 -383
  475. package/src/dropdown-menu-v2-ariakit/stories/index.story.tsx +0 -617
  476. package/src/dropdown-menu-v2-ariakit/styles.ts +0 -345
  477. package/src/dropdown-menu-v2-ariakit/test/index.tsx +0 -1108
  478. package/src/dropdown-menu-v2-ariakit/types.ts +0 -179
  479. /package/build-types/{dropdown-menu-v2-ariakit → composite}/test/index.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_EMOTION_STRINGIFIED_CSS_ERROR__","navigatorProviderWrapper","process","env","NODE_ENV","name","styles","map","toString","exports","fadeInFromRight","keyframes","opacity","transform","fadeInFromLeft","navigatorScreenAnimation","isInitial","isBack","isRTL","animationName","css","navigatorScreen","props"],"sources":["@wordpress/components/src/navigator/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css, keyframes } from '@emotion/react';\n\nexport const navigatorProviderWrapper = css`\n\t/* Prevents horizontal overflow while animating screen transitions */\n\toverflow-x: hidden;\n\t/* Mark this subsection of the DOM as isolated, providing performance benefits\n\t * by limiting calculations of layout, style and paint to a DOM subtree rather\n\t * than the entire page.\n\t */\n\tcontain: content;\n`;\n\nconst fadeInFromRight = keyframes( {\n\t'0%': {\n\t\topacity: 0,\n\t\ttransform: `translateX( 50px )`,\n\t},\n\t'100%': { opacity: 1, transform: 'none' },\n} );\n\nconst fadeInFromLeft = keyframes( {\n\t'0%': {\n\t\topacity: 0,\n\t\ttransform: `translateX( -50px )`,\n\t},\n\t'100%': { opacity: 1, transform: 'none' },\n} );\n\ntype NavigatorScreenAnimationProps = {\n\tisInitial?: boolean;\n\tisBack?: boolean;\n\tisRTL: boolean;\n};\n\nconst navigatorScreenAnimation = ( {\n\tisInitial,\n\tisBack,\n\tisRTL,\n}: NavigatorScreenAnimationProps ) => {\n\tif ( isInitial && ! isBack ) {\n\t\treturn;\n\t}\n\n\tconst animationName =\n\t\t( isRTL && isBack ) || ( ! isRTL && ! isBack )\n\t\t\t? fadeInFromRight\n\t\t\t: fadeInFromLeft;\n\n\treturn css`\n\t\tanimation-duration: 0.14s;\n\t\tanimation-timing-function: ease-in-out;\n\t\twill-change: transform, opacity;\n\t\tanimation-name: ${ animationName };\n\n\t\t@media ( prefers-reduced-motion ) {\n\t\t\tanimation-duration: 0s;\n\t\t}\n\t`;\n};\n\nexport const navigatorScreen = ( props: NavigatorScreenAnimationProps ) => css`\n\t/* Ensures horizontal overflow is visually accessible */\n\toverflow-x: auto;\n\t/* In case the root has a height, it should not be exceeded */\n\tmax-height: 100%;\n\n\t${ navigatorScreenAnimation( props ) }\n`;\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAAgD,SAAAC,iCAAA;AAEzC,MAAMC,wBAAwB,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,GAAA;EAAAC,QAAA,EAAAR;AAAA,CAQpC;AAACS,OAAA,CAAAR,wBAAA,GAAAA,wBAAA;AAEF,MAAMS,eAAe,GAAG,IAAAC,gBAAS,EAAE;EAClC,IAAI,EAAE;IACLC,OAAO,EAAE,CAAC;IACVC,SAAS,EAAG;EACb,CAAC;EACD,MAAM,EAAE;IAAED,OAAO,EAAE,CAAC;IAAEC,SAAS,EAAE;EAAO;AACzC,CAAE,CAAC;AAEH,MAAMC,cAAc,GAAG,IAAAH,gBAAS,EAAE;EACjC,IAAI,EAAE;IACLC,OAAO,EAAE,CAAC;IACVC,SAAS,EAAG;EACb,CAAC;EACD,MAAM,EAAE;IAAED,OAAO,EAAE,CAAC;IAAEC,SAAS,EAAE;EAAO;AACzC,CAAE,CAAC;AAQH,MAAME,wBAAwB,GAAGA,CAAE;EAClCC,SAAS;EACTC,MAAM;EACNC;AAC8B,CAAC,KAAM;EACrC,IAAKF,SAAS,IAAI,CAAEC,MAAM,EAAG;IAC5B;EACD;EAEA,MAAME,aAAa,GAChBD,KAAK,IAAID,MAAM,IAAQ,CAAEC,KAAK,IAAI,CAAED,MAAQ,GAC3CP,eAAe,GACfI,cAAc;EAElB,wBAAOM,UAAG,kHAIUD,aAAa,kEAAAjB,OAAA,CAAAC,GAAA,CAAAC,QAAA,8DAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA;AAMlC,CAAC;AAEM,MAAMiB,eAAe,GAAKC,KAAoC,qBAAMF,UAAG,sCAM1EL,wBAAwB,CAAEO,KAAM,CAAC,SAAApB,OAAA,CAAAC,GAAA,CAAAC,QAAA,qDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,mnFACpC;AAACK,OAAA,CAAAY,eAAA,GAAAA,eAAA"}
@@ -205,18 +205,14 @@ function UnforwardedNumberControl(props, forwardedRef) {
205
205
  }, (0, _react.createElement)(_numberControlStyles.SpinButton, {
206
206
  className: spinButtonClasses,
207
207
  icon: _icons.plus,
208
- isSmall: true,
209
- "aria-hidden": "true",
210
- "aria-label": (0, _i18n.__)('Increment'),
211
- tabIndex: -1,
208
+ size: "small",
209
+ label: (0, _i18n.__)('Increment'),
212
210
  onClick: buildSpinButtonClickHandler('up')
213
211
  }), (0, _react.createElement)(_numberControlStyles.SpinButton, {
214
212
  className: spinButtonClasses,
215
213
  icon: _icons.reset,
216
- isSmall: true,
217
- "aria-hidden": "true",
218
- "aria-label": (0, _i18n.__)('Decrement'),
219
- tabIndex: -1,
214
+ size: "small",
215
+ label: (0, _i18n.__)('Decrement'),
220
216
  onClick: buildSpinButtonClickHandler('down')
221
217
  })))) : suffix,
222
218
  onChange: onChange
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_i18n","_icons","_compose","_deprecated","_numberControlStyles","inputControlActionTypes","_interopRequireWildcard","_math","_values","_hStack","_spacer","_utils","_useDeprecatedProps","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","noop","UnforwardedNumberControl","props","forwardedRef","__unstableStateReducer","stateReducerProp","className","dragDirection","hideHTMLArrows","spinControls","isDragEnabled","isShiftStepEnabled","label","max","Infinity","min","required","shiftStep","step","spinFactor","type","typeProp","value","valueProp","size","suffix","onChange","restProps","useDeprecated36pxDefaultSizeProp","deprecated","alternative","since","version","inputRef","useRef","mergedRef","useMergeRefs","isStepAny","baseStep","ensureNumber","baseSpin","baseValue","roundClamp","constrainValue","stepOverride","Math","autoComplete","undefined","classes","classNames","cx","useCx","spinButtonClasses","styles","smallSpinButtons","spinValue","direction","event","preventDefault","shift","shiftKey","delta","nextValue","isValueEmpty","add","subtract","numberControlStateReducer","state","action","nextState","payload","currentValue","PRESS_UP","PRESS_DOWN","DRAG","x","y","enableShift","modifier","directionModifier","isRTL","ceil","abs","sign","distance","PRESS_ENTER","COMMIT","applyEmptyValue","buildSpinButtonClickHandler","String","target","current","_react","createElement","Input","inputMode","ref","_stateReducerProp","baseState","Fragment","Spacer","marginBottom","marginRight","HStack","spacing","SpinButton","icon","plusIcon","isSmall","__","tabIndex","onClick","resetIcon","NumberControl","forwardRef","exports","_default"],"sources":["@wordpress/components/src/number-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\nimport type { ForwardedRef, KeyboardEvent, MouseEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, forwardRef } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { plus as plusIcon, reset as resetIcon } from '@wordpress/icons';\nimport { useMergeRefs } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { Input, SpinButton, styles } from './styles/number-control-styles';\nimport * as inputControlActionTypes from '../input-control/reducer/actions';\nimport { add, subtract, roundClamp } from '../utils/math';\nimport { ensureNumber, isValueEmpty } from '../utils/values';\nimport type { WordPressComponentProps } from '../context/wordpress-component';\nimport type { NumberControlProps } from './types';\nimport { HStack } from '../h-stack';\nimport { Spacer } from '../spacer';\nimport { useCx } from '../utils';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\n\nconst noop = () => {};\n\nfunction UnforwardedNumberControl(\n\tprops: WordPressComponentProps< NumberControlProps, 'input', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer: stateReducerProp,\n\t\tclassName,\n\t\tdragDirection = 'n',\n\t\thideHTMLArrows = false,\n\t\tspinControls = hideHTMLArrows ? 'none' : 'native',\n\t\tisDragEnabled = true,\n\t\tisShiftStepEnabled = true,\n\t\tlabel,\n\t\tmax = Infinity,\n\t\tmin = -Infinity,\n\t\trequired = false,\n\t\tshiftStep = 10,\n\t\tstep = 1,\n\t\tspinFactor = 1,\n\t\ttype: typeProp = 'number',\n\t\tvalue: valueProp,\n\t\tsize = 'default',\n\t\tsuffix,\n\t\tonChange = noop,\n\t\t...restProps\n\t} = useDeprecated36pxDefaultSizeProp< NumberControlProps >(\n\t\tprops,\n\t\t'wp.components.NumberControl',\n\t\t'6.4'\n\t);\n\n\tif ( hideHTMLArrows ) {\n\t\tdeprecated( 'wp.components.NumberControl hideHTMLArrows prop ', {\n\t\t\talternative: 'spinControls=\"none\"',\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.3',\n\t\t} );\n\t}\n\tconst inputRef = useRef< HTMLInputElement >();\n\tconst mergedRef = useMergeRefs( [ inputRef, forwardedRef ] );\n\n\tconst isStepAny = step === 'any';\n\tconst baseStep = isStepAny ? 1 : ensureNumber( step );\n\tconst baseSpin = ensureNumber( spinFactor ) * baseStep;\n\tconst baseValue = roundClamp( 0, min, max, baseStep );\n\tconst constrainValue = (\n\t\tvalue: number | string,\n\t\tstepOverride?: number\n\t) => {\n\t\t// When step is \"any\" clamp the value, otherwise round and clamp it.\n\t\t// Use '' + to convert to string for use in input value attribute.\n\t\treturn isStepAny\n\t\t\t? '' + Math.min( max, Math.max( min, ensureNumber( value ) ) )\n\t\t\t: '' + roundClamp( value, min, max, stepOverride ?? baseStep );\n\t};\n\n\tconst autoComplete = typeProp === 'number' ? 'off' : undefined;\n\tconst classes = classNames( 'components-number-control', className );\n\tconst cx = useCx();\n\tconst spinButtonClasses = cx( size === 'small' && styles.smallSpinButtons );\n\n\tconst spinValue = (\n\t\tvalue: string | number | undefined,\n\t\tdirection: 'up' | 'down',\n\t\tevent: KeyboardEvent | MouseEvent | undefined\n\t) => {\n\t\tevent?.preventDefault();\n\t\tconst shift = event?.shiftKey && isShiftStepEnabled;\n\t\tconst delta = shift ? ensureNumber( shiftStep ) * baseSpin : baseSpin;\n\t\tlet nextValue = isValueEmpty( value ) ? baseValue : value;\n\t\tif ( direction === 'up' ) {\n\t\t\tnextValue = add( nextValue, delta );\n\t\t} else if ( direction === 'down' ) {\n\t\t\tnextValue = subtract( nextValue, delta );\n\t\t}\n\t\treturn constrainValue( nextValue, shift ? delta : undefined );\n\t};\n\n\t/**\n\t * \"Middleware\" function that intercepts updates from InputControl.\n\t * This allows us to tap into actions to transform the (next) state for\n\t * InputControl.\n\t *\n\t * @return The updated state to apply to InputControl\n\t */\n\tconst numberControlStateReducer: NumberControlProps[ '__unstableStateReducer' ] =\n\t\t( state, action ) => {\n\t\t\tconst nextState = { ...state };\n\n\t\t\tconst { type, payload } = action;\n\t\t\tconst event = payload.event;\n\t\t\tconst currentValue = nextState.value;\n\n\t\t\t/**\n\t\t\t * Handles custom UP and DOWN Keyboard events\n\t\t\t */\n\t\t\tif (\n\t\t\t\ttype === inputControlActionTypes.PRESS_UP ||\n\t\t\t\ttype === inputControlActionTypes.PRESS_DOWN\n\t\t\t) {\n\t\t\t\tnextState.value = spinValue(\n\t\t\t\t\tcurrentValue,\n\t\t\t\t\ttype === inputControlActionTypes.PRESS_UP ? 'up' : 'down',\n\t\t\t\t\tevent as KeyboardEvent | undefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Handles drag to update events\n\t\t\t */\n\t\t\tif ( type === inputControlActionTypes.DRAG && isDragEnabled ) {\n\t\t\t\tconst [ x, y ] = payload.delta;\n\t\t\t\tconst enableShift = payload.shiftKey && isShiftStepEnabled;\n\t\t\t\tconst modifier = enableShift\n\t\t\t\t\t? ensureNumber( shiftStep ) * baseSpin\n\t\t\t\t\t: baseSpin;\n\n\t\t\t\tlet directionModifier;\n\t\t\t\tlet delta;\n\n\t\t\t\tswitch ( dragDirection ) {\n\t\t\t\t\tcase 'n':\n\t\t\t\t\t\tdelta = y;\n\t\t\t\t\t\tdirectionModifier = -1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'e':\n\t\t\t\t\t\tdelta = x;\n\t\t\t\t\t\tdirectionModifier = isRTL() ? -1 : 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 's':\n\t\t\t\t\t\tdelta = y;\n\t\t\t\t\t\tdirectionModifier = 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'w':\n\t\t\t\t\t\tdelta = x;\n\t\t\t\t\t\tdirectionModifier = isRTL() ? 1 : -1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif ( delta !== 0 ) {\n\t\t\t\t\tdelta = Math.ceil( Math.abs( delta ) ) * Math.sign( delta );\n\t\t\t\t\tconst distance = delta * modifier * directionModifier;\n\n\t\t\t\t\tnextState.value = constrainValue(\n\t\t\t\t\t\t// @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined\n\t\t\t\t\t\tadd( currentValue, distance ),\n\t\t\t\t\t\tenableShift ? modifier : undefined\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Handles commit (ENTER key press or blur)\n\t\t\t */\n\t\t\tif (\n\t\t\t\ttype === inputControlActionTypes.PRESS_ENTER ||\n\t\t\t\ttype === inputControlActionTypes.COMMIT\n\t\t\t) {\n\t\t\t\tconst applyEmptyValue =\n\t\t\t\t\trequired === false && currentValue === '';\n\n\t\t\t\tnextState.value = applyEmptyValue\n\t\t\t\t\t? currentValue\n\t\t\t\t\t: // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined\n\t\t\t\t\t constrainValue( currentValue );\n\t\t\t}\n\n\t\t\treturn nextState;\n\t\t};\n\n\tconst buildSpinButtonClickHandler =\n\t\t( direction: 'up' | 'down' ) =>\n\t\t( event: MouseEvent< HTMLButtonElement > ) =>\n\t\t\tonChange( String( spinValue( valueProp, direction, event ) ), {\n\t\t\t\t// Set event.target to the <input> so that consumers can use\n\t\t\t\t// e.g. event.target.validity.\n\t\t\t\tevent: {\n\t\t\t\t\t...event,\n\t\t\t\t\ttarget: inputRef.current!,\n\t\t\t\t},\n\t\t\t} );\n\n\treturn (\n\t\t<Input\n\t\t\tautoComplete={ autoComplete }\n\t\t\tinputMode=\"numeric\"\n\t\t\t{ ...restProps }\n\t\t\tclassName={ classes }\n\t\t\tdragDirection={ dragDirection }\n\t\t\thideHTMLArrows={ spinControls !== 'native' }\n\t\t\tisDragEnabled={ isDragEnabled }\n\t\t\tlabel={ label }\n\t\t\tmax={ max }\n\t\t\tmin={ min }\n\t\t\tref={ mergedRef }\n\t\t\trequired={ required }\n\t\t\tstep={ step }\n\t\t\ttype={ typeProp }\n\t\t\t// @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components\n\t\t\tvalue={ valueProp }\n\t\t\t__unstableStateReducer={ ( state, action ) => {\n\t\t\t\tconst baseState = numberControlStateReducer( state, action );\n\t\t\t\treturn stateReducerProp?.( baseState, action ) ?? baseState;\n\t\t\t} }\n\t\t\tsize={ size }\n\t\t\tsuffix={\n\t\t\t\tspinControls === 'custom' ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t\t<Spacer marginBottom={ 0 } marginRight={ 2 }>\n\t\t\t\t\t\t\t<HStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t<SpinButton\n\t\t\t\t\t\t\t\t\tclassName={ spinButtonClasses }\n\t\t\t\t\t\t\t\t\ticon={ plusIcon }\n\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\taria-label={ __( 'Increment' ) }\n\t\t\t\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\t\t\t\tonClick={ buildSpinButtonClickHandler(\n\t\t\t\t\t\t\t\t\t\t'up'\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<SpinButton\n\t\t\t\t\t\t\t\t\tclassName={ spinButtonClasses }\n\t\t\t\t\t\t\t\t\ticon={ resetIcon }\n\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\taria-label={ __( 'Decrement' ) }\n\t\t\t\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\t\t\t\tonClick={ buildSpinButtonClickHandler(\n\t\t\t\t\t\t\t\t\t\t'down'\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</HStack>\n\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\tsuffix\n\t\t\t\t)\n\t\t\t}\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\nexport const NumberControl = forwardRef( UnforwardedNumberControl );\n\nexport default NumberControl;\n"],"mappings":";;;;;;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mI,QAAA"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_i18n","_icons","_compose","_deprecated","_numberControlStyles","inputControlActionTypes","_interopRequireWildcard","_math","_values","_hStack","_spacer","_utils","_useDeprecatedProps","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","noop","UnforwardedNumberControl","props","forwardedRef","__unstableStateReducer","stateReducerProp","className","dragDirection","hideHTMLArrows","spinControls","isDragEnabled","isShiftStepEnabled","label","max","Infinity","min","required","shiftStep","step","spinFactor","type","typeProp","value","valueProp","size","suffix","onChange","restProps","useDeprecated36pxDefaultSizeProp","deprecated","alternative","since","version","inputRef","useRef","mergedRef","useMergeRefs","isStepAny","baseStep","ensureNumber","baseSpin","baseValue","roundClamp","constrainValue","stepOverride","Math","autoComplete","undefined","classes","classNames","cx","useCx","spinButtonClasses","styles","smallSpinButtons","spinValue","direction","event","preventDefault","shift","shiftKey","delta","nextValue","isValueEmpty","add","subtract","numberControlStateReducer","state","action","nextState","payload","currentValue","PRESS_UP","PRESS_DOWN","DRAG","x","y","enableShift","modifier","directionModifier","isRTL","ceil","abs","sign","distance","PRESS_ENTER","COMMIT","applyEmptyValue","buildSpinButtonClickHandler","String","target","current","_react","createElement","Input","inputMode","ref","_stateReducerProp","baseState","Fragment","Spacer","marginBottom","marginRight","HStack","spacing","SpinButton","icon","plusIcon","__","onClick","resetIcon","NumberControl","forwardRef","exports","_default"],"sources":["@wordpress/components/src/number-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\nimport type { ForwardedRef, KeyboardEvent, MouseEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, forwardRef } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { plus as plusIcon, reset as resetIcon } from '@wordpress/icons';\nimport { useMergeRefs } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { Input, SpinButton, styles } from './styles/number-control-styles';\nimport * as inputControlActionTypes from '../input-control/reducer/actions';\nimport { add, subtract, roundClamp } from '../utils/math';\nimport { ensureNumber, isValueEmpty } from '../utils/values';\nimport type { WordPressComponentProps } from '../context/wordpress-component';\nimport type { NumberControlProps } from './types';\nimport { HStack } from '../h-stack';\nimport { Spacer } from '../spacer';\nimport { useCx } from '../utils';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\n\nconst noop = () => {};\n\nfunction UnforwardedNumberControl(\n\tprops: WordPressComponentProps< NumberControlProps, 'input', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer: stateReducerProp,\n\t\tclassName,\n\t\tdragDirection = 'n',\n\t\thideHTMLArrows = false,\n\t\tspinControls = hideHTMLArrows ? 'none' : 'native',\n\t\tisDragEnabled = true,\n\t\tisShiftStepEnabled = true,\n\t\tlabel,\n\t\tmax = Infinity,\n\t\tmin = -Infinity,\n\t\trequired = false,\n\t\tshiftStep = 10,\n\t\tstep = 1,\n\t\tspinFactor = 1,\n\t\ttype: typeProp = 'number',\n\t\tvalue: valueProp,\n\t\tsize = 'default',\n\t\tsuffix,\n\t\tonChange = noop,\n\t\t...restProps\n\t} = useDeprecated36pxDefaultSizeProp< NumberControlProps >(\n\t\tprops,\n\t\t'wp.components.NumberControl',\n\t\t'6.4'\n\t);\n\n\tif ( hideHTMLArrows ) {\n\t\tdeprecated( 'wp.components.NumberControl hideHTMLArrows prop ', {\n\t\t\talternative: 'spinControls=\"none\"',\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.3',\n\t\t} );\n\t}\n\tconst inputRef = useRef< HTMLInputElement >();\n\tconst mergedRef = useMergeRefs( [ inputRef, forwardedRef ] );\n\n\tconst isStepAny = step === 'any';\n\tconst baseStep = isStepAny ? 1 : ensureNumber( step );\n\tconst baseSpin = ensureNumber( spinFactor ) * baseStep;\n\tconst baseValue = roundClamp( 0, min, max, baseStep );\n\tconst constrainValue = (\n\t\tvalue: number | string,\n\t\tstepOverride?: number\n\t) => {\n\t\t// When step is \"any\" clamp the value, otherwise round and clamp it.\n\t\t// Use '' + to convert to string for use in input value attribute.\n\t\treturn isStepAny\n\t\t\t? '' + Math.min( max, Math.max( min, ensureNumber( value ) ) )\n\t\t\t: '' + roundClamp( value, min, max, stepOverride ?? baseStep );\n\t};\n\n\tconst autoComplete = typeProp === 'number' ? 'off' : undefined;\n\tconst classes = classNames( 'components-number-control', className );\n\tconst cx = useCx();\n\tconst spinButtonClasses = cx( size === 'small' && styles.smallSpinButtons );\n\n\tconst spinValue = (\n\t\tvalue: string | number | undefined,\n\t\tdirection: 'up' | 'down',\n\t\tevent: KeyboardEvent | MouseEvent | undefined\n\t) => {\n\t\tevent?.preventDefault();\n\t\tconst shift = event?.shiftKey && isShiftStepEnabled;\n\t\tconst delta = shift ? ensureNumber( shiftStep ) * baseSpin : baseSpin;\n\t\tlet nextValue = isValueEmpty( value ) ? baseValue : value;\n\t\tif ( direction === 'up' ) {\n\t\t\tnextValue = add( nextValue, delta );\n\t\t} else if ( direction === 'down' ) {\n\t\t\tnextValue = subtract( nextValue, delta );\n\t\t}\n\t\treturn constrainValue( nextValue, shift ? delta : undefined );\n\t};\n\n\t/**\n\t * \"Middleware\" function that intercepts updates from InputControl.\n\t * This allows us to tap into actions to transform the (next) state for\n\t * InputControl.\n\t *\n\t * @return The updated state to apply to InputControl\n\t */\n\tconst numberControlStateReducer: NumberControlProps[ '__unstableStateReducer' ] =\n\t\t( state, action ) => {\n\t\t\tconst nextState = { ...state };\n\n\t\t\tconst { type, payload } = action;\n\t\t\tconst event = payload.event;\n\t\t\tconst currentValue = nextState.value;\n\n\t\t\t/**\n\t\t\t * Handles custom UP and DOWN Keyboard events\n\t\t\t */\n\t\t\tif (\n\t\t\t\ttype === inputControlActionTypes.PRESS_UP ||\n\t\t\t\ttype === inputControlActionTypes.PRESS_DOWN\n\t\t\t) {\n\t\t\t\tnextState.value = spinValue(\n\t\t\t\t\tcurrentValue,\n\t\t\t\t\ttype === inputControlActionTypes.PRESS_UP ? 'up' : 'down',\n\t\t\t\t\tevent as KeyboardEvent | undefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Handles drag to update events\n\t\t\t */\n\t\t\tif ( type === inputControlActionTypes.DRAG && isDragEnabled ) {\n\t\t\t\tconst [ x, y ] = payload.delta;\n\t\t\t\tconst enableShift = payload.shiftKey && isShiftStepEnabled;\n\t\t\t\tconst modifier = enableShift\n\t\t\t\t\t? ensureNumber( shiftStep ) * baseSpin\n\t\t\t\t\t: baseSpin;\n\n\t\t\t\tlet directionModifier;\n\t\t\t\tlet delta;\n\n\t\t\t\tswitch ( dragDirection ) {\n\t\t\t\t\tcase 'n':\n\t\t\t\t\t\tdelta = y;\n\t\t\t\t\t\tdirectionModifier = -1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'e':\n\t\t\t\t\t\tdelta = x;\n\t\t\t\t\t\tdirectionModifier = isRTL() ? -1 : 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 's':\n\t\t\t\t\t\tdelta = y;\n\t\t\t\t\t\tdirectionModifier = 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'w':\n\t\t\t\t\t\tdelta = x;\n\t\t\t\t\t\tdirectionModifier = isRTL() ? 1 : -1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif ( delta !== 0 ) {\n\t\t\t\t\tdelta = Math.ceil( Math.abs( delta ) ) * Math.sign( delta );\n\t\t\t\t\tconst distance = delta * modifier * directionModifier;\n\n\t\t\t\t\tnextState.value = constrainValue(\n\t\t\t\t\t\t// @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined\n\t\t\t\t\t\tadd( currentValue, distance ),\n\t\t\t\t\t\tenableShift ? modifier : undefined\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Handles commit (ENTER key press or blur)\n\t\t\t */\n\t\t\tif (\n\t\t\t\ttype === inputControlActionTypes.PRESS_ENTER ||\n\t\t\t\ttype === inputControlActionTypes.COMMIT\n\t\t\t) {\n\t\t\t\tconst applyEmptyValue =\n\t\t\t\t\trequired === false && currentValue === '';\n\n\t\t\t\tnextState.value = applyEmptyValue\n\t\t\t\t\t? currentValue\n\t\t\t\t\t: // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined\n\t\t\t\t\t constrainValue( currentValue );\n\t\t\t}\n\n\t\t\treturn nextState;\n\t\t};\n\n\tconst buildSpinButtonClickHandler =\n\t\t( direction: 'up' | 'down' ) =>\n\t\t( event: MouseEvent< HTMLButtonElement > ) =>\n\t\t\tonChange( String( spinValue( valueProp, direction, event ) ), {\n\t\t\t\t// Set event.target to the <input> so that consumers can use\n\t\t\t\t// e.g. event.target.validity.\n\t\t\t\tevent: {\n\t\t\t\t\t...event,\n\t\t\t\t\ttarget: inputRef.current!,\n\t\t\t\t},\n\t\t\t} );\n\n\treturn (\n\t\t<Input\n\t\t\tautoComplete={ autoComplete }\n\t\t\tinputMode=\"numeric\"\n\t\t\t{ ...restProps }\n\t\t\tclassName={ classes }\n\t\t\tdragDirection={ dragDirection }\n\t\t\thideHTMLArrows={ spinControls !== 'native' }\n\t\t\tisDragEnabled={ isDragEnabled }\n\t\t\tlabel={ label }\n\t\t\tmax={ max }\n\t\t\tmin={ min }\n\t\t\tref={ mergedRef }\n\t\t\trequired={ required }\n\t\t\tstep={ step }\n\t\t\ttype={ typeProp }\n\t\t\t// @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components\n\t\t\tvalue={ valueProp }\n\t\t\t__unstableStateReducer={ ( state, action ) => {\n\t\t\t\tconst baseState = numberControlStateReducer( state, action );\n\t\t\t\treturn stateReducerProp?.( baseState, action ) ?? baseState;\n\t\t\t} }\n\t\t\tsize={ size }\n\t\t\tsuffix={\n\t\t\t\tspinControls === 'custom' ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t\t<Spacer marginBottom={ 0 } marginRight={ 2 }>\n\t\t\t\t\t\t\t<HStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t<SpinButton\n\t\t\t\t\t\t\t\t\tclassName={ spinButtonClasses }\n\t\t\t\t\t\t\t\t\ticon={ plusIcon }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Increment' ) }\n\t\t\t\t\t\t\t\t\tonClick={ buildSpinButtonClickHandler(\n\t\t\t\t\t\t\t\t\t\t'up'\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<SpinButton\n\t\t\t\t\t\t\t\t\tclassName={ spinButtonClasses }\n\t\t\t\t\t\t\t\t\ticon={ resetIcon }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Decrement' ) }\n\t\t\t\t\t\t\t\t\tonClick={ buildSpinButtonClickHandler(\n\t\t\t\t\t\t\t\t\t\t'down'\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</HStack>\n\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\tsuffix\n\t\t\t\t)\n\t\t\t}\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\nexport const NumberControl = forwardRef( UnforwardedNumberControl );\n\nexport default NumberControl;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAMA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,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AAAD,MAAA,CAAAO,QAAA,QACG1E,MAAM,EACR,IAAAmE,MAAA,CAAAC,aAAA,EAACtH,OAAA,CAAA6H,MAAM;MAACC,YAAY,EAAG,CAAG;MAACC,WAAW,EAAG;IAAG,GAC3C,IAAAV,MAAA,CAAAC,aAAA,EAACvH,OAAA,CAAAiI,MAAM;MAACC,OAAO,EAAG;IAAG,GACpB,IAAAZ,MAAA,CAAAC,aAAA,EAAC5H,oBAAA,CAAAwI,UAAU;MACVnG,SAAS,EAAG8C,iBAAmB;MAC/BsD,IAAI,EAAGC,WAAU;MACjBnF,IAAI,EAAC,OAAO;MACZZ,KAAK,EAAG,IAAAgG,QAAE,EAAE,WAAY,CAAG;MAC3BC,OAAO,EAAGrB,2BAA2B,CACpC,IACD;IAAG,CACH,CAAC,EACF,IAAAI,MAAA,CAAAC,aAAA,EAAC5H,oBAAA,CAAAwI,UAAU;MACVnG,SAAS,EAAG8C,iBAAmB;MAC/BsD,IAAI,EAAGI,YAAW;MAClBtF,IAAI,EAAC,OAAO;MACZZ,KAAK,EAAG,IAAAgG,QAAE,EAAE,WAAY,CAAG;MAC3BC,OAAO,EAAGrB,2BAA2B,CACpC,MACD;IAAG,CACH,CACM,CACD,CACP,CAAC,GAEH/D,MAED;IACDC,QAAQ,EAAGA;EAAU,CACrB,CAAC;AAEJ;AAEO,MAAMqF,aAAa,GAAG,IAAAC,mBAAU,EAAE/G,wBAAyB,CAAC;AAACgH,OAAA,CAAAF,aAAA,GAAAA,aAAA;AAAA,IAAAG,QAAA,GAErDH,aAAa;AAAAE,OAAA,CAAAhI,OAAA,GAAAiI,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/number-control/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { InputControlProps } from '../input-control/types';\n\nexport type NumberControlProps = Omit<\n\tInputControlProps,\n\t'isDragEnabled' | 'min' | 'max' | 'required' | 'step' | 'type' | 'value'\n> & {\n\t/**\n\t * If true, the default `input` HTML arrows will be hidden.\n\t *\n\t * @deprecated\n\t * @default false\n\t */\n\thideHTMLArrows?: boolean;\n\t/**\n\t * The type of spin controls to display. These are butons that allow the\n\t * user to quickly increment and decrement the number.\n\t *\n\t * - 'none' - Do not show spin controls.\n\t * - 'native' - Use browser's native HTML `input` controls.\n\t * - 'custom' - Use plus and minus icon buttons.\n\t *\n\t * @default 'native'\n\t */\n\tspinControls?: 'none' | 'native' | 'custom';\n\t/**\n\t * If true, enables mouse drag gestures.\n\t *\n\t * @default true\n\t */\n\tisDragEnabled?: InputControlProps[ 'isDragEnabled' ];\n\t/**\n\t * If true, pressing `UP` or `DOWN` along with the `SHIFT` key will increment the\n\t * value by the `shiftStep` value.\n\t *\n\t * @default true\n\t */\n\tisShiftStepEnabled?: boolean;\n\t/**\n\t * The maximum `value` allowed.\n\t *\n\t * @default Infinity\n\t */\n\tmax?: number;\n\t/**\n\t * The minimum `value` allowed.\n\t *\n\t * @default -Infinity\n\t */\n\tmin?: number;\n\t/**\n\t * If `true` enforces a valid number within the control's min/max range.\n\t * If `false` allows an empty string as a valid value.\n\t *\n\t * @default false\n\t */\n\trequired?: InputControlProps[ 'required' ];\n\t/**\n\t * Amount to increment by when the `SHIFT` key is held down. This shift value is\n\t * a multiplier to the `step` value. For example, if the `step` value is `5`,\n\t * and `shiftStep` is `10`, each jump would increment/decrement by `50`.\n\t *\n\t * @default 10\n\t */\n\tshiftStep?: number;\n\t/**\n\t * Amount by which the `value` is changed when incrementing/decrementing.\n\t * It is also a factor in validation as `value` must be a multiple of `step`\n\t * (offset by `min`, if specified) to be valid. Accepts the special string value `any`\n\t * that voids the validation constraint and causes stepping actions to increment/decrement by `1`.\n\t *\n\t * @default 1\n\t */\n\tstep?: InputControlProps[ 'step' ];\n\t/**\n\t * Optional multiplication factor in spin changes. i.e. A spin changes\n\t * by `spinFactor * step` (if `step` is \"any\", 1 is used instead).\n\t *\n\t * @default 1\n\t */\n\tspinFactor?: number;\n\t/**\n\t * The `type` attribute of the `input` element.\n\t *\n\t * @default 'number'\n\t */\n\ttype?: InputControlProps[ 'type' ];\n\t/**\n\t * The value of the input.\n\t */\n\tvalue?: number | string;\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/number-control/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { InputControlProps } from '../input-control/types';\n\nexport type NumberControlProps = Omit<\n\tInputControlProps,\n\t'isDragEnabled' | 'min' | 'max' | 'required' | 'step' | 'type' | 'value'\n> & {\n\t/**\n\t * If true, the default `input` HTML arrows will be hidden.\n\t *\n\t * @deprecated\n\t * @default false\n\t */\n\thideHTMLArrows?: boolean;\n\t/**\n\t * The type of spin controls to display. These are buttons that allow the\n\t * user to quickly increment and decrement the number.\n\t *\n\t * - 'none' - Do not show spin controls.\n\t * - 'native' - Use browser's native HTML `input` controls.\n\t * - 'custom' - Use plus and minus icon buttons.\n\t *\n\t * @default 'native'\n\t */\n\tspinControls?: 'none' | 'native' | 'custom';\n\t/**\n\t * If true, enables mouse drag gestures.\n\t *\n\t * @default true\n\t */\n\tisDragEnabled?: InputControlProps[ 'isDragEnabled' ];\n\t/**\n\t * If true, pressing `UP` or `DOWN` along with the `SHIFT` key will increment the\n\t * value by the `shiftStep` value.\n\t *\n\t * @default true\n\t */\n\tisShiftStepEnabled?: boolean;\n\t/**\n\t * The maximum `value` allowed.\n\t *\n\t * @default Infinity\n\t */\n\tmax?: number;\n\t/**\n\t * The minimum `value` allowed.\n\t *\n\t * @default -Infinity\n\t */\n\tmin?: number;\n\t/**\n\t * If `true` enforces a valid number within the control's min/max range.\n\t * If `false` allows an empty string as a valid value.\n\t *\n\t * @default false\n\t */\n\trequired?: InputControlProps[ 'required' ];\n\t/**\n\t * Amount to increment by when the `SHIFT` key is held down. This shift value is\n\t * a multiplier to the `step` value. For example, if the `step` value is `5`,\n\t * and `shiftStep` is `10`, each jump would increment/decrement by `50`.\n\t *\n\t * @default 10\n\t */\n\tshiftStep?: number;\n\t/**\n\t * Amount by which the `value` is changed when incrementing/decrementing.\n\t * It is also a factor in validation as `value` must be a multiple of `step`\n\t * (offset by `min`, if specified) to be valid. Accepts the special string value `any`\n\t * that voids the validation constraint and causes stepping actions to increment/decrement by `1`.\n\t *\n\t * @default 1\n\t */\n\tstep?: InputControlProps[ 'step' ];\n\t/**\n\t * Optional multiplication factor in spin changes. i.e. A spin changes\n\t * by `spinFactor * step` (if `step` is \"any\", 1 is used instead).\n\t *\n\t * @default 1\n\t */\n\tspinFactor?: number;\n\t/**\n\t * The `type` attribute of the `input` element.\n\t *\n\t * @default 'number'\n\t */\n\ttype?: InputControlProps[ 'type' ];\n\t/**\n\t * The value of the input.\n\t */\n\tvalue?: number | string;\n};\n"],"mappings":""}
@@ -4,14 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.DEFAULT_COLOR = void 0;
8
7
  exports.PaletteEdit = PaletteEdit;
9
8
  exports.default = void 0;
10
9
  exports.getNameForPosition = getNameForPosition;
11
- exports.isTemporaryElement = isTemporaryElement;
12
10
  var _react = require("react");
13
11
  var _classnames = _interopRequireDefault(require("classnames"));
14
- var _changeCase = require("change-case");
15
12
  var _element = require("@wordpress/element");
16
13
  var _i18n = require("@wordpress/i18n");
17
14
  var _icons = require("@wordpress/icons");
@@ -30,6 +27,7 @@ var _styles = require("./styles");
30
27
  var _navigableContainer = require("../navigable-container");
31
28
  var _constants = require("../custom-gradient-picker/constants");
32
29
  var _customGradientPicker = _interopRequireDefault(require("../custom-gradient-picker"));
30
+ var _strings = require("../utils/strings");
33
31
  /**
34
32
  * External dependencies
35
33
  */
@@ -43,7 +41,6 @@ var _customGradientPicker = _interopRequireDefault(require("../custom-gradient-p
43
41
  */
44
42
 
45
43
  const DEFAULT_COLOR = '#000';
46
- exports.DEFAULT_COLOR = DEFAULT_COLOR;
47
44
  function NameInput({
48
45
  value,
49
46
  onChange,
@@ -58,8 +55,8 @@ function NameInput({
58
55
  }
59
56
 
60
57
  /**
61
- * Returns a temporary name for a palette item in the format "Color + id".
62
- * To ensure there are no duplicate ids, this function checks all slugs for temporary names.
58
+ * Returns a name for a palette item in the format "Color + id".
59
+ * To ensure there are no duplicate ids, this function checks all slugs.
63
60
  * It expects slugs to be in the format: slugPrefix + color- + number.
64
61
  * It then sets the id component of the new name based on the incremented id of the highest existing slug id.
65
62
  *
@@ -69,10 +66,10 @@ function NameInput({
69
66
  * @return A unique name for a palette item.
70
67
  */
71
68
  function getNameForPosition(elements, slugPrefix) {
72
- const temporaryNameRegex = new RegExp(`^${slugPrefix}color-([\\d]+)$`);
69
+ const nameRegex = new RegExp(`^${slugPrefix}color-([\\d]+)$`);
73
70
  const position = elements.reduce((previousValue, currentValue) => {
74
71
  if (typeof currentValue?.slug === 'string') {
75
- const matches = currentValue?.slug.match(temporaryNameRegex);
72
+ const matches = currentValue?.slug.match(nameRegex);
76
73
  if (matches) {
77
74
  const id = parseInt(matches[1], 10);
78
75
  if (id >= previousValue) {
@@ -82,7 +79,7 @@ function getNameForPosition(elements, slugPrefix) {
82
79
  }
83
80
  return previousValue;
84
81
  }, 1);
85
- return (0, _i18n.sprintf)( /* translators: %s: is a temporary id for a custom color */
82
+ return (0, _i18n.sprintf)( /* translators: %s: is an id for a custom color */
86
83
  (0, _i18n.__)('Color %s'), position);
87
84
  }
88
85
  function ColorPickerPopover({
@@ -177,10 +174,10 @@ function Option({
177
174
  onChange: nextName => onChange({
178
175
  ...element,
179
176
  name: nextName,
180
- slug: slugPrefix + (0, _changeCase.paramCase)(nextName !== null && nextName !== void 0 ? nextName : '')
177
+ slug: slugPrefix + (0, _strings.kebabCase)(nextName !== null && nextName !== void 0 ? nextName : '')
181
178
  })
182
179
  }) : (0, _react.createElement)(_styles.NameContainer, null, element.name)), isEditing && !canOnlyChangeValues && (0, _react.createElement)(_flex.FlexItem, null, (0, _react.createElement)(_styles.RemoveButton, {
183
- isSmall: true,
180
+ size: "small",
184
181
  icon: _icons.lineSolid,
185
182
  label: (0, _i18n.__)('Remove color'),
186
183
  onClick: onRemove
@@ -191,31 +188,6 @@ function Option({
191
188
  popoverProps: popoverProps
192
189
  }));
193
190
  }
194
-
195
- /**
196
- * Checks if a color or gradient is a temporary element by testing against default values.
197
- */
198
- function isTemporaryElement(slugPrefix, {
199
- slug,
200
- color,
201
- gradient
202
- }) {
203
- const regex = new RegExp(`^${slugPrefix}color-([\\d]+)$`);
204
-
205
- // If the slug matches the temporary name regex,
206
- // check if the color or gradient matches the default value.
207
- if (regex.test(slug)) {
208
- // The order is important as gradient elements
209
- // contain a color property.
210
- if (!!gradient) {
211
- return gradient === _constants.DEFAULT_GRADIENT;
212
- }
213
- if (!!color) {
214
- return color === DEFAULT_COLOR;
215
- }
216
- }
217
- return false;
218
- }
219
191
  function PaletteEditListView({
220
192
  elements,
221
193
  onChange,
@@ -231,17 +203,6 @@ function PaletteEditListView({
231
203
  (0, _element.useEffect)(() => {
232
204
  elementsReference.current = elements;
233
205
  }, [elements]);
234
- (0, _element.useEffect)(() => {
235
- return () => {
236
- if (elementsReference.current?.some(element => isTemporaryElement(slugPrefix, element))) {
237
- const newElements = elementsReference.current.filter(element => !isTemporaryElement(slugPrefix, element));
238
- onChange(newElements.length ? newElements : undefined);
239
- }
240
- };
241
- // Disable reason: adding the missing dependency here would cause breaking changes that will require
242
- // a heavier refactor to avoid. See https://github.com/WordPress/gutenberg/pull/43911
243
- // eslint-disable-next-line react-hooks/exhaustive-deps
244
- }, []);
245
206
  const debounceOnChange = (0, _compose.useDebounce)(onChange, 100);
246
207
  return (0, _react.createElement)(_vStack.VStack, {
247
208
  spacing: 3
@@ -340,29 +301,29 @@ function PaletteEdit({
340
301
  return (0, _react.createElement)(_styles.PaletteEditStyles, null, (0, _react.createElement)(_styles.PaletteHStackHeader, null, (0, _react.createElement)(_styles.PaletteHeading, {
341
302
  level: paletteLabelHeadingLevel
342
303
  }, paletteLabel), (0, _react.createElement)(_styles.PaletteActionsContainer, null, hasElements && isEditing && (0, _react.createElement)(_styles.DoneButton, {
343
- isSmall: true,
304
+ size: "small",
344
305
  onClick: () => {
345
306
  setIsEditing(false);
346
307
  setEditingElement(null);
347
308
  }
348
309
  }, (0, _i18n.__)('Done')), !canOnlyChangeValues && (0, _react.createElement)(_button.default, {
349
- isSmall: true,
310
+ size: "small",
350
311
  isPressed: isAdding,
351
312
  icon: _icons.plus,
352
313
  label: isGradient ? (0, _i18n.__)('Add gradient') : (0, _i18n.__)('Add color'),
353
314
  onClick: () => {
354
- const tempOptionName = getNameForPosition(elements, slugPrefix);
315
+ const optionName = getNameForPosition(elements, slugPrefix);
355
316
  if (!!gradients) {
356
317
  onChange([...gradients, {
357
318
  gradient: _constants.DEFAULT_GRADIENT,
358
- name: tempOptionName,
359
- slug: slugPrefix + (0, _changeCase.paramCase)(tempOptionName)
319
+ name: optionName,
320
+ slug: slugPrefix + (0, _strings.kebabCase)(optionName)
360
321
  }]);
361
322
  } else {
362
323
  onChange([...colors, {
363
324
  color: DEFAULT_COLOR,
364
- name: tempOptionName,
365
- slug: slugPrefix + (0, _changeCase.paramCase)(tempOptionName)
325
+ name: optionName,
326
+ slug: slugPrefix + (0, _strings.kebabCase)(optionName)
366
327
  }]);
367
328
  }
368
329
  setIsEditing(true);
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_changeCase","_element","_i18n","_icons","_compose","_button","_colorPicker","_flex","_hStack","_itemGroup","_vStack","_gradientPicker","_colorPalette","_dropdownMenu","_popover","_styles","_navigableContainer","_constants","_customGradientPicker","DEFAULT_COLOR","exports","NameInput","value","onChange","label","_react","createElement","NameInputControl","hideLabelFromVision","getNameForPosition","elements","slugPrefix","temporaryNameRegex","RegExp","position","reduce","previousValue","currentValue","slug","matches","match","id","parseInt","sprintf","__","ColorPickerPopover","isGradient","element","popoverProps","receivedPopoverProps","onClose","useMemo","shift","offset","resize","placement","className","classnames","default","ColorPicker","color","enableAlpha","newColor","__nextHasNoMargin","__experimentalIsRenderedInSidebar","gradient","newGradient","Option","canOnlyChangeValues","isEditing","onStartEditing","onRemove","onStopEditing","focusOutsideProps","useFocusOutside","popoverAnchor","setPopoverAnchor","useState","anchor","PaletteItem","undefined","as","onClick","ref","style","cursor","HStack","justify","FlexItem","IndicatorStyled","background","name","nextName","kebabCase","NameContainer","RemoveButton","isSmall","icon","lineSolid","isTemporaryElement","regex","test","DEFAULT_GRADIENT","PaletteEditListView","editingElement","setEditingElement","elementsReference","useRef","useEffect","current","some","newElements","filter","length","debounceOnChange","useDebounce","VStack","spacing","ItemGroup","isRounded","map","index","key","newElement","currentElement","currentIndex","_currentElement","EMPTY_ARRAY","PaletteEdit","gradients","colors","paletteLabel","paletteLabelHeadingLevel","emptyMessage","canReset","setIsEditing","isAdding","elementsLength","hasElements","onSelectPaletteItem","useCallback","newEditingElementIndex","selectedElement","PaletteEditStyles","PaletteHStackHeader","PaletteHeading","level","PaletteActionsContainer","DoneButton","isPressed","plus","tempOptionName","moreVertical","toggleProps","Fragment","NavigableMenu","role","variant","clearable","disableCustomGradients","disableCustomColors","_default"],"sources":["@wordpress/components/src/palette-edit/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { lineSolid, moreVertical, plus } from '@wordpress/icons';\nimport {\n\t__experimentalUseFocusOutside as useFocusOutside,\n\tuseDebounce,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { ColorPicker } from '../color-picker';\nimport { FlexItem } from '../flex';\nimport { HStack } from '../h-stack';\nimport { ItemGroup } from '../item-group';\nimport { VStack } from '../v-stack';\nimport GradientPicker from '../gradient-picker';\nimport ColorPalette from '../color-palette';\nimport DropdownMenu from '../dropdown-menu';\nimport Popover from '../popover';\nimport {\n\tPaletteActionsContainer,\n\tPaletteEditStyles,\n\tPaletteHeading,\n\tPaletteHStackHeader,\n\tIndicatorStyled,\n\tPaletteItem,\n\tNameContainer,\n\tNameInputControl,\n\tDoneButton,\n\tRemoveButton,\n} from './styles';\nimport { NavigableMenu } from '../navigable-container';\nimport { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport type {\n\tColor,\n\tColorPickerPopoverProps,\n\tGradient,\n\tNameInputProps,\n\tOptionProps,\n\tPaletteEditListViewProps,\n\tPaletteEditProps,\n\tPaletteElement,\n} from './types';\n\nexport const DEFAULT_COLOR = '#000';\n\nfunction NameInput( { value, onChange, label }: NameInputProps ) {\n\treturn (\n\t\t<NameInputControl\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Returns a temporary name for a palette item in the format \"Color + id\".\n * To ensure there are no duplicate ids, this function checks all slugs for temporary names.\n * It expects slugs to be in the format: slugPrefix + color- + number.\n * It then sets the id component of the new name based on the incremented id of the highest existing slug id.\n *\n * @param elements An array of color palette items.\n * @param slugPrefix The slug prefix used to match the element slug.\n *\n * @return A unique name for a palette item.\n */\nexport function getNameForPosition(\n\telements: PaletteElement[],\n\tslugPrefix: string\n) {\n\tconst temporaryNameRegex = new RegExp( `^${ slugPrefix }color-([\\\\d]+)$` );\n\tconst position = elements.reduce( ( previousValue, currentValue ) => {\n\t\tif ( typeof currentValue?.slug === 'string' ) {\n\t\t\tconst matches = currentValue?.slug.match( temporaryNameRegex );\n\t\t\tif ( matches ) {\n\t\t\t\tconst id = parseInt( matches[ 1 ], 10 );\n\t\t\t\tif ( id >= previousValue ) {\n\t\t\t\t\treturn id + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn previousValue;\n\t}, 1 );\n\n\treturn sprintf(\n\t\t/* translators: %s: is a temporary id for a custom color */\n\t\t__( 'Color %s' ),\n\t\tposition\n\t);\n}\n\nfunction ColorPickerPopover< T extends Color | Gradient >( {\n\tisGradient,\n\telement,\n\tonChange,\n\tpopoverProps: receivedPopoverProps,\n\tonClose = () => {},\n}: ColorPickerPopoverProps< T > ) {\n\tconst popoverProps: ColorPickerPopoverProps< T >[ 'popoverProps' ] =\n\t\tuseMemo(\n\t\t\t() => ( {\n\t\t\t\tshift: true,\n\t\t\t\toffset: 20,\n\t\t\t\t// Disabling resize as it would otherwise cause the popover to show\n\t\t\t\t// scrollbars while dragging the color picker's handle close to the\n\t\t\t\t// popover edge.\n\t\t\t\tresize: false,\n\t\t\t\tplacement: 'left-start',\n\t\t\t\t...receivedPopoverProps,\n\t\t\t\tclassName: classnames(\n\t\t\t\t\t'components-palette-edit__popover',\n\t\t\t\t\treceivedPopoverProps?.className\n\t\t\t\t),\n\t\t\t} ),\n\t\t\t[ receivedPopoverProps ]\n\t\t);\n\n\treturn (\n\t\t<Popover { ...popoverProps } onClose={ onClose }>\n\t\t\t{ ! isGradient && (\n\t\t\t\t<ColorPicker\n\t\t\t\t\tcolor={ element.color }\n\t\t\t\t\tenableAlpha\n\t\t\t\t\tonChange={ ( newColor ) => {\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\tcolor: newColor,\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\t{ isGradient && (\n\t\t\t\t<div className=\"components-palette-edit__popover-gradient-picker\">\n\t\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tvalue={ element.gradient }\n\t\t\t\t\t\tonChange={ ( newGradient ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\t\tgradient: newGradient,\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</div>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nfunction Option< T extends Color | Gradient >( {\n\tcanOnlyChangeValues,\n\telement,\n\tonChange,\n\tisEditing,\n\tonStartEditing,\n\tonRemove,\n\tonStopEditing,\n\tpopoverProps: receivedPopoverProps,\n\tslugPrefix,\n\tisGradient,\n}: OptionProps< T > ) {\n\tconst focusOutsideProps = useFocusOutside( onStopEditing );\n\tconst value = isGradient ? element.gradient : element.color;\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t...receivedPopoverProps,\n\t\t\t// Use the custom palette color item as the popover anchor.\n\t\t\tanchor: popoverAnchor,\n\t\t} ),\n\t\t[ popoverAnchor, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<PaletteItem\n\t\t\tclassName={ isEditing ? 'is-selected' : undefined }\n\t\t\tas=\"div\"\n\t\t\tonClick={ onStartEditing }\n\t\t\tref={ setPopoverAnchor }\n\t\t\t{ ...( isEditing\n\t\t\t\t? { ...focusOutsideProps }\n\t\t\t\t: {\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t},\n\t\t\t\t } ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<IndicatorStyled\n\t\t\t\t\t\tstyle={ { background: value, color: 'transparent' } }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t{ isEditing && ! canOnlyChangeValues ? (\n\t\t\t\t\t\t<NameInput\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t? __( 'Gradient name' )\n\t\t\t\t\t\t\t\t\t: __( 'Color name' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ element.name }\n\t\t\t\t\t\t\tonChange={ ( nextName?: string ) =>\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\t\t\tname: nextName,\n\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\tkebabCase( nextName ?? '' ),\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\t\t<NameContainer>{ element.name }</NameContainer>\n\t\t\t\t\t) }\n\t\t\t\t</FlexItem>\n\t\t\t\t{ isEditing && ! canOnlyChangeValues && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<RemoveButton\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\ticon={ lineSolid }\n\t\t\t\t\t\t\tlabel={ __( 'Remove color' ) }\n\t\t\t\t\t\t\tonClick={ onRemove }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ isEditing && (\n\t\t\t\t<ColorPickerPopover\n\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\telement={ element }\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PaletteItem>\n\t);\n}\n\n/**\n * Checks if a color or gradient is a temporary element by testing against default values.\n */\nexport function isTemporaryElement(\n\tslugPrefix: string,\n\t{ slug, color, gradient }: Color | Gradient\n): Boolean {\n\tconst regex = new RegExp( `^${ slugPrefix }color-([\\\\d]+)$` );\n\n\t// If the slug matches the temporary name regex,\n\t// check if the color or gradient matches the default value.\n\tif ( regex.test( slug ) ) {\n\t\t// The order is important as gradient elements\n\t\t// contain a color property.\n\t\tif ( !! gradient ) {\n\t\t\treturn gradient === DEFAULT_GRADIENT;\n\t\t}\n\n\t\tif ( !! color ) {\n\t\t\treturn color === DEFAULT_COLOR;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nfunction PaletteEditListView< T extends Color | Gradient >( {\n\telements,\n\tonChange,\n\teditingElement,\n\tsetEditingElement,\n\tcanOnlyChangeValues,\n\tslugPrefix,\n\tisGradient,\n\tpopoverProps,\n}: PaletteEditListViewProps< T > ) {\n\t// When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.\n\tconst elementsReference = useRef< typeof elements >();\n\tuseEffect( () => {\n\t\telementsReference.current = elements;\n\t}, [ elements ] );\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\telementsReference.current?.some( ( element ) =>\n\t\t\t\t\tisTemporaryElement( slugPrefix, element )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tconst newElements = elementsReference.current.filter(\n\t\t\t\t\t( element ) => ! isTemporaryElement( slugPrefix, element )\n\t\t\t\t);\n\t\t\t\tonChange( newElements.length ? newElements : undefined );\n\t\t\t}\n\t\t};\n\t\t// Disable reason: adding the missing dependency here would cause breaking changes that will require\n\t\t// a heavier refactor to avoid. See https://github.com/WordPress/gutenberg/pull/43911\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst debounceOnChange = useDebounce( onChange, 100 );\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<ItemGroup isRounded>\n\t\t\t\t{ elements.map( ( element, index ) => (\n\t\t\t\t\t<Option\n\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\tcanOnlyChangeValues={ canOnlyChangeValues }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\telement={ element }\n\t\t\t\t\t\tonStartEditing={ () => {\n\t\t\t\t\t\t\tif ( editingElement !== index ) {\n\t\t\t\t\t\t\t\tsetEditingElement( index );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( newElement ) => {\n\t\t\t\t\t\t\tdebounceOnChange(\n\t\t\t\t\t\t\t\telements.map(\n\t\t\t\t\t\t\t\t\t( currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\t\tif ( currentIndex === index ) {\n\t\t\t\t\t\t\t\t\t\t\treturn newElement;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn currentElement;\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);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\tconst newElements = elements.filter(\n\t\t\t\t\t\t\t\t( _currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\tif ( currentIndex === index ) {\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tnewElements.length ? newElements : undefined\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisEditing={ index === editingElement }\n\t\t\t\t\t\tonStopEditing={ () => {\n\t\t\t\t\t\t\tif ( index === editingElement ) {\n\t\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</VStack>\n\t);\n}\n\nconst EMPTY_ARRAY: Color[] = [];\n\n/**\n * Allows editing a palette of colors or gradients.\n *\n * ```jsx\n * import { PaletteEdit } from '@wordpress/components';\n * const MyPaletteEdit = () => {\n * const [ controlledColors, setControlledColors ] = useState( colors );\n *\n * return (\n * <PaletteEdit\n * colors={ controlledColors }\n * onChange={ ( newColors?: Color[] ) => {\n * setControlledColors( newColors );\n * } }\n * paletteLabel=\"Here is a label\"\n * />\n * );\n * };\n * ```\n */\nexport function PaletteEdit( {\n\tgradients,\n\tcolors = EMPTY_ARRAY,\n\tonChange,\n\tpaletteLabel,\n\tpaletteLabelHeadingLevel = 2,\n\temptyMessage,\n\tcanOnlyChangeValues,\n\tcanReset,\n\tslugPrefix = '',\n\tpopoverProps,\n}: PaletteEditProps ) {\n\tconst isGradient = !! gradients;\n\tconst elements = isGradient ? gradients : colors;\n\tconst [ isEditing, setIsEditing ] = useState( false );\n\tconst [ editingElement, setEditingElement ] = useState<\n\t\tnumber | null | undefined\n\t>( null );\n\tconst isAdding =\n\t\tisEditing &&\n\t\t!! editingElement &&\n\t\telements[ editingElement ] &&\n\t\t! elements[ editingElement ].slug;\n\tconst elementsLength = elements.length;\n\tconst hasElements = elementsLength > 0;\n\tconst debounceOnChange = useDebounce( onChange, 100 );\n\tconst onSelectPaletteItem = useCallback(\n\t\t(\n\t\t\tvalue?: PaletteElement[ keyof PaletteElement ],\n\t\t\tnewEditingElementIndex?: number\n\t\t) => {\n\t\t\tconst selectedElement =\n\t\t\t\tnewEditingElementIndex === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: elements[ newEditingElementIndex ];\n\t\t\tconst key = isGradient ? 'gradient' : 'color';\n\t\t\t// Ensures that the index returned matches a known element value.\n\t\t\tif ( !! selectedElement && selectedElement[ key ] === value ) {\n\t\t\t\tsetEditingElement( newEditingElementIndex );\n\t\t\t} else {\n\t\t\t\tsetIsEditing( true );\n\t\t\t}\n\t\t},\n\t\t[ isGradient, elements ]\n\t);\n\n\treturn (\n\t\t<PaletteEditStyles>\n\t\t\t<PaletteHStackHeader>\n\t\t\t\t<PaletteHeading level={ paletteLabelHeadingLevel }>\n\t\t\t\t\t{ paletteLabel }\n\t\t\t\t</PaletteHeading>\n\t\t\t\t<PaletteActionsContainer>\n\t\t\t\t\t{ hasElements && isEditing && (\n\t\t\t\t\t\t<DoneButton\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsEditing( false );\n\t\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t\t\t</DoneButton>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tisPressed={ isAdding }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t? __( 'Add gradient' )\n\t\t\t\t\t\t\t\t\t: __( 'Add color' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst tempOptionName = getNameForPosition(\n\t\t\t\t\t\t\t\t\telements,\n\t\t\t\t\t\t\t\t\tslugPrefix\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif ( !! gradients ) {\n\t\t\t\t\t\t\t\t\tonChange( [\n\t\t\t\t\t\t\t\t\t\t...gradients,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tgradient: DEFAULT_GRADIENT,\n\t\t\t\t\t\t\t\t\t\t\tname: tempOptionName,\n\t\t\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\t\t\tkebabCase( tempOptionName ),\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} else {\n\t\t\t\t\t\t\t\t\tonChange( [\n\t\t\t\t\t\t\t\t\t\t...colors,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcolor: DEFAULT_COLOR,\n\t\t\t\t\t\t\t\t\t\t\tname: tempOptionName,\n\t\t\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\t\t\tkebabCase( tempOptionName ),\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\tsetIsEditing( true );\n\t\t\t\t\t\t\t\tsetEditingElement( elements.length );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ hasElements &&\n\t\t\t\t\t\t( ! isEditing ||\n\t\t\t\t\t\t\t! canOnlyChangeValues ||\n\t\t\t\t\t\t\tcanReset ) && (\n\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t\t? __( 'Gradient options' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Color options' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ( { onClose }: { onClose: () => void } ) => (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<NavigableMenu role=\"menu\">\n\t\t\t\t\t\t\t\t\t\t\t{ ! isEditing && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEditing( true );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-palette-edit__menu-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Show details' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetEditingElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEditing( false );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-palette-edit__menu-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ isGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove all gradients'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove all colors'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ canReset && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetEditingElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ isGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Reset gradient' )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Reset colors' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</NavigableMenu>\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</DropdownMenu>\n\t\t\t\t\t\t) }\n\t\t\t\t</PaletteActionsContainer>\n\t\t\t</PaletteHStackHeader>\n\t\t\t{ hasElements && (\n\t\t\t\t<>\n\t\t\t\t\t{ isEditing && (\n\t\t\t\t\t\t<PaletteEditListView< ( typeof elements )[ number ] >\n\t\t\t\t\t\t\tcanOnlyChangeValues={ canOnlyChangeValues }\n\t\t\t\t\t\t\telements={ elements }\n\t\t\t\t\t\t\t// @ts-expect-error TODO: Don't know how to resolve\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\teditingElement={ editingElement }\n\t\t\t\t\t\t\tsetEditingElement={ setEditingElement }\n\t\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditing && editingElement !== null && (\n\t\t\t\t\t\t<ColorPickerPopover\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t\tonClose={ () => setEditingElement( null ) }\n\t\t\t\t\t\t\tonChange={ (\n\t\t\t\t\t\t\t\tnewElement: ( typeof elements )[ number ]\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tdebounceOnChange(\n\t\t\t\t\t\t\t\t\t// @ts-expect-error TODO: Don't know how to resolve\n\t\t\t\t\t\t\t\t\telements.map(\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tcurrentElement: ( typeof elements )[ number ],\n\t\t\t\t\t\t\t\t\t\t\tcurrentIndex: number\n\t\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\tcurrentIndex === editingElement\n\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn newElement;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\treturn currentElement;\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} }\n\t\t\t\t\t\t\telement={ elements[ editingElement ?? -1 ] }\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditing &&\n\t\t\t\t\t\t( isGradient ? (\n\t\t\t\t\t\t\t<GradientPicker\n\t\t\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t\t\tgradients={ gradients }\n\t\t\t\t\t\t\t\tonChange={ onSelectPaletteItem }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t\tdisableCustomGradients={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\t\t\tonChange={ onSelectPaletteItem }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t\tdisableCustomColors={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! hasElements && emptyMessage }\n\t\t</PaletteEditStyles>\n\t);\n}\n\nexport default PaletteEdit;\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAQA,IAAAM,OAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,eAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,aAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,aAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,QAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,OAAA,GAAAhB,OAAA;AAYA,IAAAiB,mBAAA,GAAAjB,OAAA;AACA,IAAAkB,UAAA,GAAAlB,OAAA;AACA,IAAAmB,qBAAA,GAAApB,sBAAA,CAAAC,OAAA;AAlDA;AACA;AACA;;AAIA;AACA;AACA;;AAeA;AACA;AACA;;AAqCO,MAAMoB,aAAa,GAAG,MAAM;AAACC,OAAA,CAAAD,aAAA,GAAAA,aAAA;AAEpC,SAASE,S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Y,KAAKrB,cAAc,EAC9B;UACD,OAAOmB,UAAU;QAClB;QACA,OAAOC,cAAc;MACtB,CACD,CACD,CAAC;IACF,CAAG;IACH7E,OAAO,EAAGjB,QAAQ,CAAE0E,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,CAAC,CAAC,CAAI;IAC5CxD,YAAY,EAAGA;EAAc,CAC7B,CACD,EACC,CAAEqB,SAAS,KACVvB,UAAU,GACX,IAAArB,MAAA,CAAAC,aAAA,EAACf,eAAA,CAAA+C,OAAc;IACdK,iBAAiB;IACjBkE,SAAS,EAAGA,SAAW;IACvB1G,QAAQ,EAAGoH,mBAAqB;IAChCmB,SAAS,EAAG,KAAO;IACnBC,sBAAsB,EAAG;EAAM,CAC/B,CAAC,GAEF,IAAAtI,MAAA,CAAAC,aAAA,EAACd,aAAA,CAAA8C,OAAY;IACZwE,MAAM,EAAGA,MAAQ;IACjB3G,QAAQ,EAAGoH,mBAAqB;IAChCmB,SAAS,EAAG,KAAO;IACnBE,mBAAmB,EAAG;EAAM,CAC5B,CACD,CACD,CACF,EACC,CAAEtB,WAAW,IAAIL,YACD,CAAC;AAEtB;AAAC,IAAA4B,QAAA,GAEcjC,WAAW;AAAA5G,OAAA,CAAAsC,OAAA,GAAAuG,QAAA"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_i18n","_icons","_compose","_button","_colorPicker","_flex","_hStack","_itemGroup","_vStack","_gradientPicker","_colorPalette","_dropdownMenu","_popover","_styles","_navigableContainer","_constants","_customGradientPicker","_strings","DEFAULT_COLOR","NameInput","value","onChange","label","_react","createElement","NameInputControl","hideLabelFromVision","getNameForPosition","elements","slugPrefix","nameRegex","RegExp","position","reduce","previousValue","currentValue","slug","matches","match","id","parseInt","sprintf","__","ColorPickerPopover","isGradient","element","popoverProps","receivedPopoverProps","onClose","useMemo","shift","offset","resize","placement","className","classnames","default","ColorPicker","color","enableAlpha","newColor","__nextHasNoMargin","__experimentalIsRenderedInSidebar","gradient","newGradient","Option","canOnlyChangeValues","isEditing","onStartEditing","onRemove","onStopEditing","focusOutsideProps","useFocusOutside","popoverAnchor","setPopoverAnchor","useState","anchor","PaletteItem","undefined","as","onClick","ref","style","cursor","HStack","justify","FlexItem","IndicatorStyled","background","name","nextName","kebabCase","NameContainer","RemoveButton","size","icon","lineSolid","PaletteEditListView","editingElement","setEditingElement","elementsReference","useRef","useEffect","current","debounceOnChange","useDebounce","VStack","spacing","ItemGroup","isRounded","map","index","key","newElement","currentElement","currentIndex","newElements","filter","_currentElement","length","EMPTY_ARRAY","PaletteEdit","gradients","colors","paletteLabel","paletteLabelHeadingLevel","emptyMessage","canReset","setIsEditing","isAdding","elementsLength","hasElements","onSelectPaletteItem","useCallback","newEditingElementIndex","selectedElement","PaletteEditStyles","PaletteHStackHeader","PaletteHeading","level","PaletteActionsContainer","DoneButton","isPressed","plus","optionName","DEFAULT_GRADIENT","moreVertical","toggleProps","isSmall","Fragment","NavigableMenu","role","variant","clearable","disableCustomGradients","disableCustomColors","_default","exports"],"sources":["@wordpress/components/src/palette-edit/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { lineSolid, moreVertical, plus } from '@wordpress/icons';\nimport {\n\t__experimentalUseFocusOutside as useFocusOutside,\n\tuseDebounce,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { ColorPicker } from '../color-picker';\nimport { FlexItem } from '../flex';\nimport { HStack } from '../h-stack';\nimport { ItemGroup } from '../item-group';\nimport { VStack } from '../v-stack';\nimport GradientPicker from '../gradient-picker';\nimport ColorPalette from '../color-palette';\nimport DropdownMenu from '../dropdown-menu';\nimport Popover from '../popover';\nimport {\n\tPaletteActionsContainer,\n\tPaletteEditStyles,\n\tPaletteHeading,\n\tPaletteHStackHeader,\n\tIndicatorStyled,\n\tPaletteItem,\n\tNameContainer,\n\tNameInputControl,\n\tDoneButton,\n\tRemoveButton,\n} from './styles';\nimport { NavigableMenu } from '../navigable-container';\nimport { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { kebabCase } from '../utils/strings';\nimport type {\n\tColor,\n\tColorPickerPopoverProps,\n\tGradient,\n\tNameInputProps,\n\tOptionProps,\n\tPaletteEditListViewProps,\n\tPaletteEditProps,\n\tPaletteElement,\n} from './types';\n\nconst DEFAULT_COLOR = '#000';\n\nfunction NameInput( { value, onChange, label }: NameInputProps ) {\n\treturn (\n\t\t<NameInputControl\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Returns a name for a palette item in the format \"Color + id\".\n * To ensure there are no duplicate ids, this function checks all slugs.\n * It expects slugs to be in the format: slugPrefix + color- + number.\n * It then sets the id component of the new name based on the incremented id of the highest existing slug id.\n *\n * @param elements An array of color palette items.\n * @param slugPrefix The slug prefix used to match the element slug.\n *\n * @return A unique name for a palette item.\n */\nexport function getNameForPosition(\n\telements: PaletteElement[],\n\tslugPrefix: string\n) {\n\tconst nameRegex = new RegExp( `^${ slugPrefix }color-([\\\\d]+)$` );\n\tconst position = elements.reduce( ( previousValue, currentValue ) => {\n\t\tif ( typeof currentValue?.slug === 'string' ) {\n\t\t\tconst matches = currentValue?.slug.match( nameRegex );\n\t\t\tif ( matches ) {\n\t\t\t\tconst id = parseInt( matches[ 1 ], 10 );\n\t\t\t\tif ( id >= previousValue ) {\n\t\t\t\t\treturn id + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn previousValue;\n\t}, 1 );\n\n\treturn sprintf(\n\t\t/* translators: %s: is an id for a custom color */\n\t\t__( 'Color %s' ),\n\t\tposition\n\t);\n}\n\nfunction ColorPickerPopover< T extends Color | Gradient >( {\n\tisGradient,\n\telement,\n\tonChange,\n\tpopoverProps: receivedPopoverProps,\n\tonClose = () => {},\n}: ColorPickerPopoverProps< T > ) {\n\tconst popoverProps: ColorPickerPopoverProps< T >[ 'popoverProps' ] =\n\t\tuseMemo(\n\t\t\t() => ( {\n\t\t\t\tshift: true,\n\t\t\t\toffset: 20,\n\t\t\t\t// Disabling resize as it would otherwise cause the popover to show\n\t\t\t\t// scrollbars while dragging the color picker's handle close to the\n\t\t\t\t// popover edge.\n\t\t\t\tresize: false,\n\t\t\t\tplacement: 'left-start',\n\t\t\t\t...receivedPopoverProps,\n\t\t\t\tclassName: classnames(\n\t\t\t\t\t'components-palette-edit__popover',\n\t\t\t\t\treceivedPopoverProps?.className\n\t\t\t\t),\n\t\t\t} ),\n\t\t\t[ receivedPopoverProps ]\n\t\t);\n\n\treturn (\n\t\t<Popover { ...popoverProps } onClose={ onClose }>\n\t\t\t{ ! isGradient && (\n\t\t\t\t<ColorPicker\n\t\t\t\t\tcolor={ element.color }\n\t\t\t\t\tenableAlpha\n\t\t\t\t\tonChange={ ( newColor ) => {\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\tcolor: newColor,\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\t{ isGradient && (\n\t\t\t\t<div className=\"components-palette-edit__popover-gradient-picker\">\n\t\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tvalue={ element.gradient }\n\t\t\t\t\t\tonChange={ ( newGradient ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\t\tgradient: newGradient,\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</div>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nfunction Option< T extends Color | Gradient >( {\n\tcanOnlyChangeValues,\n\telement,\n\tonChange,\n\tisEditing,\n\tonStartEditing,\n\tonRemove,\n\tonStopEditing,\n\tpopoverProps: receivedPopoverProps,\n\tslugPrefix,\n\tisGradient,\n}: OptionProps< T > ) {\n\tconst focusOutsideProps = useFocusOutside( onStopEditing );\n\tconst value = isGradient ? element.gradient : element.color;\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t...receivedPopoverProps,\n\t\t\t// Use the custom palette color item as the popover anchor.\n\t\t\tanchor: popoverAnchor,\n\t\t} ),\n\t\t[ popoverAnchor, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<PaletteItem\n\t\t\tclassName={ isEditing ? 'is-selected' : undefined }\n\t\t\tas=\"div\"\n\t\t\tonClick={ onStartEditing }\n\t\t\tref={ setPopoverAnchor }\n\t\t\t{ ...( isEditing\n\t\t\t\t? { ...focusOutsideProps }\n\t\t\t\t: {\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t},\n\t\t\t\t } ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<IndicatorStyled\n\t\t\t\t\t\tstyle={ { background: value, color: 'transparent' } }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t{ isEditing && ! canOnlyChangeValues ? (\n\t\t\t\t\t\t<NameInput\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t? __( 'Gradient name' )\n\t\t\t\t\t\t\t\t\t: __( 'Color name' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ element.name }\n\t\t\t\t\t\t\tonChange={ ( nextName?: string ) =>\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\t\t\tname: nextName,\n\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\tkebabCase( nextName ?? '' ),\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\t\t<NameContainer>{ element.name }</NameContainer>\n\t\t\t\t\t) }\n\t\t\t\t</FlexItem>\n\t\t\t\t{ isEditing && ! canOnlyChangeValues && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<RemoveButton\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ lineSolid }\n\t\t\t\t\t\t\tlabel={ __( 'Remove color' ) }\n\t\t\t\t\t\t\tonClick={ onRemove }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ isEditing && (\n\t\t\t\t<ColorPickerPopover\n\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\telement={ element }\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PaletteItem>\n\t);\n}\n\nfunction PaletteEditListView< T extends Color | Gradient >( {\n\telements,\n\tonChange,\n\teditingElement,\n\tsetEditingElement,\n\tcanOnlyChangeValues,\n\tslugPrefix,\n\tisGradient,\n\tpopoverProps,\n}: PaletteEditListViewProps< T > ) {\n\t// When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.\n\tconst elementsReference = useRef< typeof elements >();\n\tuseEffect( () => {\n\t\telementsReference.current = elements;\n\t}, [ elements ] );\n\n\tconst debounceOnChange = useDebounce( onChange, 100 );\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<ItemGroup isRounded>\n\t\t\t\t{ elements.map( ( element, index ) => (\n\t\t\t\t\t<Option\n\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\tcanOnlyChangeValues={ canOnlyChangeValues }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\telement={ element }\n\t\t\t\t\t\tonStartEditing={ () => {\n\t\t\t\t\t\t\tif ( editingElement !== index ) {\n\t\t\t\t\t\t\t\tsetEditingElement( index );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( newElement ) => {\n\t\t\t\t\t\t\tdebounceOnChange(\n\t\t\t\t\t\t\t\telements.map(\n\t\t\t\t\t\t\t\t\t( currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\t\tif ( currentIndex === index ) {\n\t\t\t\t\t\t\t\t\t\t\treturn newElement;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn currentElement;\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);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\tconst newElements = elements.filter(\n\t\t\t\t\t\t\t\t( _currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\tif ( currentIndex === index ) {\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tnewElements.length ? newElements : undefined\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisEditing={ index === editingElement }\n\t\t\t\t\t\tonStopEditing={ () => {\n\t\t\t\t\t\t\tif ( index === editingElement ) {\n\t\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</VStack>\n\t);\n}\n\nconst EMPTY_ARRAY: Color[] = [];\n\n/**\n * Allows editing a palette of colors or gradients.\n *\n * ```jsx\n * import { PaletteEdit } from '@wordpress/components';\n * const MyPaletteEdit = () => {\n * const [ controlledColors, setControlledColors ] = useState( colors );\n *\n * return (\n * <PaletteEdit\n * colors={ controlledColors }\n * onChange={ ( newColors?: Color[] ) => {\n * setControlledColors( newColors );\n * } }\n * paletteLabel=\"Here is a label\"\n * />\n * );\n * };\n * ```\n */\nexport function PaletteEdit( {\n\tgradients,\n\tcolors = EMPTY_ARRAY,\n\tonChange,\n\tpaletteLabel,\n\tpaletteLabelHeadingLevel = 2,\n\temptyMessage,\n\tcanOnlyChangeValues,\n\tcanReset,\n\tslugPrefix = '',\n\tpopoverProps,\n}: PaletteEditProps ) {\n\tconst isGradient = !! gradients;\n\tconst elements = isGradient ? gradients : colors;\n\tconst [ isEditing, setIsEditing ] = useState( false );\n\tconst [ editingElement, setEditingElement ] = useState<\n\t\tnumber | null | undefined\n\t>( null );\n\tconst isAdding =\n\t\tisEditing &&\n\t\t!! editingElement &&\n\t\telements[ editingElement ] &&\n\t\t! elements[ editingElement ].slug;\n\tconst elementsLength = elements.length;\n\tconst hasElements = elementsLength > 0;\n\tconst debounceOnChange = useDebounce( onChange, 100 );\n\tconst onSelectPaletteItem = useCallback(\n\t\t(\n\t\t\tvalue?: PaletteElement[ keyof PaletteElement ],\n\t\t\tnewEditingElementIndex?: number\n\t\t) => {\n\t\t\tconst selectedElement =\n\t\t\t\tnewEditingElementIndex === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: elements[ newEditingElementIndex ];\n\t\t\tconst key = isGradient ? 'gradient' : 'color';\n\t\t\t// Ensures that the index returned matches a known element value.\n\t\t\tif ( !! selectedElement && selectedElement[ key ] === value ) {\n\t\t\t\tsetEditingElement( newEditingElementIndex );\n\t\t\t} else {\n\t\t\t\tsetIsEditing( true );\n\t\t\t}\n\t\t},\n\t\t[ isGradient, elements ]\n\t);\n\n\treturn (\n\t\t<PaletteEditStyles>\n\t\t\t<PaletteHStackHeader>\n\t\t\t\t<PaletteHeading level={ paletteLabelHeadingLevel }>\n\t\t\t\t\t{ paletteLabel }\n\t\t\t\t</PaletteHeading>\n\t\t\t\t<PaletteActionsContainer>\n\t\t\t\t\t{ hasElements && isEditing && (\n\t\t\t\t\t\t<DoneButton\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsEditing( false );\n\t\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t\t\t</DoneButton>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tisPressed={ isAdding }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t? __( 'Add gradient' )\n\t\t\t\t\t\t\t\t\t: __( 'Add color' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst optionName = getNameForPosition(\n\t\t\t\t\t\t\t\t\telements,\n\t\t\t\t\t\t\t\t\tslugPrefix\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif ( !! gradients ) {\n\t\t\t\t\t\t\t\t\tonChange( [\n\t\t\t\t\t\t\t\t\t\t...gradients,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tgradient: DEFAULT_GRADIENT,\n\t\t\t\t\t\t\t\t\t\t\tname: optionName,\n\t\t\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\t\t\tkebabCase( optionName ),\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} else {\n\t\t\t\t\t\t\t\t\tonChange( [\n\t\t\t\t\t\t\t\t\t\t...colors,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcolor: DEFAULT_COLOR,\n\t\t\t\t\t\t\t\t\t\t\tname: optionName,\n\t\t\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\t\t\tkebabCase( optionName ),\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\tsetIsEditing( true );\n\t\t\t\t\t\t\t\tsetEditingElement( elements.length );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ hasElements &&\n\t\t\t\t\t\t( ! isEditing ||\n\t\t\t\t\t\t\t! canOnlyChangeValues ||\n\t\t\t\t\t\t\tcanReset ) && (\n\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t\t? __( 'Gradient options' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Color options' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ( { onClose }: { onClose: () => void } ) => (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<NavigableMenu role=\"menu\">\n\t\t\t\t\t\t\t\t\t\t\t{ ! isEditing && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEditing( true );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-palette-edit__menu-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Show details' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetEditingElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEditing( false );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-palette-edit__menu-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ isGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove all gradients'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove all colors'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ canReset && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetEditingElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ isGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Reset gradient' )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Reset colors' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</NavigableMenu>\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</DropdownMenu>\n\t\t\t\t\t\t) }\n\t\t\t\t</PaletteActionsContainer>\n\t\t\t</PaletteHStackHeader>\n\t\t\t{ hasElements && (\n\t\t\t\t<>\n\t\t\t\t\t{ isEditing && (\n\t\t\t\t\t\t<PaletteEditListView< ( typeof elements )[ number ] >\n\t\t\t\t\t\t\tcanOnlyChangeValues={ canOnlyChangeValues }\n\t\t\t\t\t\t\telements={ elements }\n\t\t\t\t\t\t\t// @ts-expect-error TODO: Don't know how to resolve\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\teditingElement={ editingElement }\n\t\t\t\t\t\t\tsetEditingElement={ setEditingElement }\n\t\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditing && editingElement !== null && (\n\t\t\t\t\t\t<ColorPickerPopover\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t\tonClose={ () => setEditingElement( null ) }\n\t\t\t\t\t\t\tonChange={ (\n\t\t\t\t\t\t\t\tnewElement: ( typeof elements )[ number ]\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tdebounceOnChange(\n\t\t\t\t\t\t\t\t\t// @ts-expect-error TODO: Don't know how to resolve\n\t\t\t\t\t\t\t\t\telements.map(\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tcurrentElement: ( typeof elements )[ number ],\n\t\t\t\t\t\t\t\t\t\t\tcurrentIndex: number\n\t\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\tcurrentIndex === editingElement\n\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn newElement;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\treturn currentElement;\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} }\n\t\t\t\t\t\t\telement={ elements[ editingElement ?? -1 ] }\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditing &&\n\t\t\t\t\t\t( isGradient ? (\n\t\t\t\t\t\t\t<GradientPicker\n\t\t\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t\t\tgradients={ gradients }\n\t\t\t\t\t\t\t\tonChange={ onSelectPaletteItem }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t\tdisableCustomGradients={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\t\t\tonChange={ onSelectPaletteItem }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t\tdisableCustomColors={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! hasElements && emptyMessage }\n\t\t</PaletteEditStyles>\n\t);\n}\n\nexport default PaletteEdit;\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAQA,IAAAK,OAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,eAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,aAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,aAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,QAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,OAAA,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mBAAmB,EAAG;EAAM,CAC5B,CACD,CACD,CACF,EACC,CAAExB,WAAW,IAAIL,YACD,CAAC;AAEtB;AAAC,IAAA8B,QAAA,GAEcnC,WAAW;AAAAoC,OAAA,CAAArG,OAAA,GAAAoG,QAAA"}
@@ -4,18 +4,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.unlock = exports.privateApis = exports.lock = void 0;
8
- var _privateApis = require("@wordpress/private-apis");
7
+ exports.privateApis = void 0;
9
8
  var _v = require("./composite/v2");
10
9
  var _customSelectControl = _interopRequireDefault(require("./custom-select-control"));
11
10
  var _utils = require("./popover/utils");
12
11
  var _progressBar = _interopRequireDefault(require("./progress-bar"));
13
12
  var _slotFill = require("./slot-fill");
14
13
  var _dropdownMenuV = require("./dropdown-menu-v2");
15
- var _dropdownMenuV2Ariakit = require("./dropdown-menu-v2-ariakit");
16
14
  var _contextSystemProvider = require("./context/context-system-provider");
17
15
  var _theme = _interopRequireDefault(require("./theme"));
18
16
  var _tabs = _interopRequireDefault(require("./tabs"));
17
+ var _strings = require("./utils/strings");
18
+ var _lockUnlock = require("./lock-unlock");
19
19
  /**
20
20
  * WordPress dependencies
21
21
  */
@@ -24,15 +24,9 @@ var _tabs = _interopRequireDefault(require("./tabs"));
24
24
  * Internal dependencies
25
25
  */
26
26
 
27
- const {
28
- lock,
29
- unlock
30
- } = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/components');
31
- exports.unlock = unlock;
32
- exports.lock = lock;
33
27
  const privateApis = {};
34
28
  exports.privateApis = privateApis;
35
- lock(privateApis, {
29
+ (0, _lockUnlock.lock)(privateApis, {
36
30
  CompositeV2: _v.Composite,
37
31
  CompositeGroupV2: _v.CompositeGroup,
38
32
  CompositeItemV2: _v.CompositeItem,
@@ -42,26 +36,17 @@ lock(privateApis, {
42
36
  __experimentalPopoverLegacyPositionToPlacement: _utils.positionToPlacement,
43
37
  createPrivateSlotFill: _slotFill.createPrivateSlotFill,
44
38
  ComponentsContext: _contextSystemProvider.ComponentsContext,
39
+ ProgressBar: _progressBar.default,
40
+ Tabs: _tabs.default,
41
+ Theme: _theme.default,
45
42
  DropdownMenuV2: _dropdownMenuV.DropdownMenu,
46
- DropdownMenuCheckboxItemV2: _dropdownMenuV.DropdownMenuCheckboxItem,
47
43
  DropdownMenuGroupV2: _dropdownMenuV.DropdownMenuGroup,
48
44
  DropdownMenuItemV2: _dropdownMenuV.DropdownMenuItem,
49
- DropdownMenuLabelV2: _dropdownMenuV.DropdownMenuLabel,
50
- DropdownMenuRadioGroupV2: _dropdownMenuV.DropdownMenuRadioGroup,
45
+ DropdownMenuCheckboxItemV2: _dropdownMenuV.DropdownMenuCheckboxItem,
51
46
  DropdownMenuRadioItemV2: _dropdownMenuV.DropdownMenuRadioItem,
52
47
  DropdownMenuSeparatorV2: _dropdownMenuV.DropdownMenuSeparator,
53
- DropdownSubMenuV2: _dropdownMenuV.DropdownSubMenu,
54
- DropdownSubMenuTriggerV2: _dropdownMenuV.DropdownSubMenuTrigger,
55
- ProgressBar: _progressBar.default,
56
- Tabs: _tabs.default,
57
- Theme: _theme.default,
58
- DropdownMenuV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenu,
59
- DropdownMenuGroupV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuGroup,
60
- DropdownMenuItemV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuItem,
61
- DropdownMenuCheckboxItemV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuCheckboxItem,
62
- DropdownMenuRadioItemV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuRadioItem,
63
- DropdownMenuSeparatorV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuSeparator,
64
- DropdownMenuItemLabelV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuItemLabel,
65
- DropdownMenuItemHelpTextV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuItemHelpText
48
+ DropdownMenuItemLabelV2: _dropdownMenuV.DropdownMenuItemLabel,
49
+ DropdownMenuItemHelpTextV2: _dropdownMenuV.DropdownMenuItemHelpText,
50
+ kebabCase: _strings.kebabCase
66
51
  });
67
52
  //# sourceMappingURL=private-apis.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_privateApis","require","_v","_customSelectControl","_interopRequireDefault","_utils","_progressBar","_slotFill","_dropdownMenuV","_dropdownMenuV2Ariakit","_contextSystemProvider","_theme","_tabs","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports","privateApis","CompositeV2","CompositeGroupV2","CompositeItemV2","CompositeRowV2","useCompositeStoreV2","CustomSelectControl","__experimentalPopoverLegacyPositionToPlacement","createPrivateSlotFill","ComponentsContext","DropdownMenuV2","DropdownMenuCheckboxItemV2","DropdownMenuGroupV2","DropdownMenuItemV2","DropdownMenuLabelV2","DropdownMenuRadioGroupV2","DropdownMenuRadioItemV2","DropdownMenuSeparatorV2","DropdownSubMenuV2","DropdownSubMenuTriggerV2","ProgressBar","Tabs","Theme","DropdownMenuV2Ariakit","DropdownMenuGroupV2Ariakit","DropdownMenuItemV2Ariakit","DropdownMenuCheckboxItemV2Ariakit","DropdownMenuRadioItemV2Ariakit","DropdownMenuSeparatorV2Ariakit","DropdownMenuItemLabelV2Ariakit","DropdownMenuItemHelpTextV2Ariakit"],"sources":["@wordpress/components/src/private-apis.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\n/**\n * Internal dependencies\n */\nimport {\n\tComposite as CompositeV2,\n\tCompositeGroup as CompositeGroupV2,\n\tCompositeItem as CompositeItemV2,\n\tCompositeRow as CompositeRowV2,\n\tuseCompositeStore as useCompositeStoreV2,\n} from './composite/v2';\nimport { default as CustomSelectControl } from './custom-select-control';\nimport { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';\nimport { default as ProgressBar } from './progress-bar';\nimport { createPrivateSlotFill } from './slot-fill';\nimport {\n\tDropdownMenu as DropdownMenuV2,\n\tDropdownMenuCheckboxItem as DropdownMenuCheckboxItemV2,\n\tDropdownMenuGroup as DropdownMenuGroupV2,\n\tDropdownMenuItem as DropdownMenuItemV2,\n\tDropdownMenuLabel as DropdownMenuLabelV2,\n\tDropdownMenuRadioGroup as DropdownMenuRadioGroupV2,\n\tDropdownMenuRadioItem as DropdownMenuRadioItemV2,\n\tDropdownMenuSeparator as DropdownMenuSeparatorV2,\n\tDropdownSubMenu as DropdownSubMenuV2,\n\tDropdownSubMenuTrigger as DropdownSubMenuTriggerV2,\n} from './dropdown-menu-v2';\nimport {\n\tDropdownMenu as DropdownMenuV2Ariakit,\n\tDropdownMenuGroup as DropdownMenuGroupV2Ariakit,\n\tDropdownMenuItem as DropdownMenuItemV2Ariakit,\n\tDropdownMenuCheckboxItem as DropdownMenuCheckboxItemV2Ariakit,\n\tDropdownMenuRadioItem as DropdownMenuRadioItemV2Ariakit,\n\tDropdownMenuSeparator as DropdownMenuSeparatorV2Ariakit,\n\tDropdownMenuItemLabel as DropdownMenuItemLabelV2Ariakit,\n\tDropdownMenuItemHelpText as DropdownMenuItemHelpTextV2Ariakit,\n} from './dropdown-menu-v2-ariakit';\nimport { ComponentsContext } from './context/context-system-provider';\nimport Theme from './theme';\nimport Tabs from './tabs';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/components'\n\t);\n\nexport const privateApis = {};\nlock( privateApis, {\n\tCompositeV2,\n\tCompositeGroupV2,\n\tCompositeItemV2,\n\tCompositeRowV2,\n\tuseCompositeStoreV2,\n\tCustomSelectControl,\n\t__experimentalPopoverLegacyPositionToPlacement,\n\tcreatePrivateSlotFill,\n\tComponentsContext,\n\tDropdownMenuV2,\n\tDropdownMenuCheckboxItemV2,\n\tDropdownMenuGroupV2,\n\tDropdownMenuItemV2,\n\tDropdownMenuLabelV2,\n\tDropdownMenuRadioGroupV2,\n\tDropdownMenuRadioItemV2,\n\tDropdownMenuSeparatorV2,\n\tDropdownSubMenuV2,\n\tDropdownSubMenuTriggerV2,\n\tProgressBar,\n\tTabs,\n\tTheme,\n\tDropdownMenuV2Ariakit,\n\tDropdownMenuGroupV2Ariakit,\n\tDropdownMenuItemV2Ariakit,\n\tDropdownMenuCheckboxItemV2Ariakit,\n\tDropdownMenuRadioItemV2Ariakit,\n\tDropdownMenuSeparatorV2Ariakit,\n\tDropdownMenuItemLabelV2Ariakit,\n\tDropdownMenuItemHelpTextV2Ariakit,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,EAAA,GAAAD,OAAA;AAOA,IAAAE,oBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AAYA,IAAAQ,sBAAA,GAAAR,OAAA;AAUA,IAAAS,sBAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAP,sBAAA,CAAAH,OAAA;AACA,IAAAW,KAAA,GAAAR,sBAAA,CAAAH,OAAA;AA3CA;AACA;AACA;;AAGA;AACA;AACA;;AAsCO,MAAM;EAAEY,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,iHAAiH,EACjH,uBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA;AAEI,MAAMI,WAAW,GAAG,CAAC,CAAC;AAACD,OAAA,CAAAC,WAAA,GAAAA,WAAA;AAC9BJ,IAAI,CAAEI,WAAW,EAAE;EAClBC,WAAW,EAAXA,YAAW;EACXC,gBAAgB,EAAhBA,iBAAgB;EAChBC,eAAe,EAAfA,gBAAe;EACfC,cAAc,EAAdA,eAAc;EACdC,mBAAmB,EAAnBA,oBAAmB;EACnBC,mBAAmB,EAAnBA,4BAAmB;EACnBC,8CAA8C,EAA9CA,0BAA8C;EAC9CC,qBAAqB,EAArBA,+BAAqB;EACrBC,iBAAiB,EAAjBA,wCAAiB;EACjBC,cAAc,EAAdA,2BAAc;EACdC,0BAA0B,EAA1BA,uCAA0B;EAC1BC,mBAAmB,EAAnBA,gCAAmB;EACnBC,kBAAkB,EAAlBA,+BAAkB;EAClBC,mBAAmB,EAAnBA,gCAAmB;EACnBC,wBAAwB,EAAxBA,qCAAwB;EACxBC,uBAAuB,EAAvBA,oCAAuB;EACvBC,uBAAuB,EAAvBA,oCAAuB;EACvBC,iBAAiB,EAAjBA,8BAAiB;EACjBC,wBAAwB,EAAxBA,qCAAwB;EACxBC,WAAW,EAAXA,oBAAW;EACXC,IAAI,EAAJA,aAAI;EACJC,KAAK,EAALA,cAAK;EACLC,qBAAqB,EAArBA,mCAAqB;EACrBC,0BAA0B,EAA1BA,wCAA0B;EAC1BC,yBAAyB,EAAzBA,uCAAyB;EACzBC,iCAAiC,EAAjCA,+CAAiC;EACjCC,8BAA8B,EAA9BA,4CAA8B;EAC9BC,8BAA8B,EAA9BA,4CAA8B;EAC9BC,8BAA8B,EAA9BA,4CAA8B;EAC9BC,iCAAiC,EAAjCA;AACD,CAAE,CAAC"}
1
+ {"version":3,"names":["_v","require","_customSelectControl","_interopRequireDefault","_utils","_progressBar","_slotFill","_dropdownMenuV","_contextSystemProvider","_theme","_tabs","_strings","_lockUnlock","privateApis","exports","lock","CompositeV2","CompositeGroupV2","CompositeItemV2","CompositeRowV2","useCompositeStoreV2","CustomSelectControl","__experimentalPopoverLegacyPositionToPlacement","createPrivateSlotFill","ComponentsContext","ProgressBar","Tabs","Theme","DropdownMenuV2","DropdownMenuGroupV2","DropdownMenuItemV2","DropdownMenuCheckboxItemV2","DropdownMenuRadioItemV2","DropdownMenuSeparatorV2","DropdownMenuItemLabelV2","DropdownMenuItemHelpTextV2","kebabCase"],"sources":["@wordpress/components/src/private-apis.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\n/**\n * Internal dependencies\n */\nimport {\n\tComposite as CompositeV2,\n\tCompositeGroup as CompositeGroupV2,\n\tCompositeItem as CompositeItemV2,\n\tCompositeRow as CompositeRowV2,\n\tuseCompositeStore as useCompositeStoreV2,\n} from './composite/v2';\nimport { default as CustomSelectControl } from './custom-select-control';\nimport { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';\nimport { default as ProgressBar } from './progress-bar';\nimport { createPrivateSlotFill } from './slot-fill';\nimport {\n\tDropdownMenu as DropdownMenuV2,\n\tDropdownMenuGroup as DropdownMenuGroupV2,\n\tDropdownMenuItem as DropdownMenuItemV2,\n\tDropdownMenuCheckboxItem as DropdownMenuCheckboxItemV2,\n\tDropdownMenuRadioItem as DropdownMenuRadioItemV2,\n\tDropdownMenuSeparator as DropdownMenuSeparatorV2,\n\tDropdownMenuItemLabel as DropdownMenuItemLabelV2,\n\tDropdownMenuItemHelpText as DropdownMenuItemHelpTextV2,\n} from './dropdown-menu-v2';\nimport { ComponentsContext } from './context/context-system-provider';\nimport Theme from './theme';\nimport Tabs from './tabs';\nimport { kebabCase } from './utils/strings';\nimport { lock } from './lock-unlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tCompositeV2,\n\tCompositeGroupV2,\n\tCompositeItemV2,\n\tCompositeRowV2,\n\tuseCompositeStoreV2,\n\tCustomSelectControl,\n\t__experimentalPopoverLegacyPositionToPlacement,\n\tcreatePrivateSlotFill,\n\tComponentsContext,\n\tProgressBar,\n\tTabs,\n\tTheme,\n\tDropdownMenuV2,\n\tDropdownMenuGroupV2,\n\tDropdownMenuItemV2,\n\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B,EAAvBA,oCAAuB;EACvBC,uBAAuB,EAAvBA,oCAAuB;EACvBC,0BAA0B,EAA1BA,uCAA0B;EAC1BC,SAAS,EAATA;AACD,CAAE,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.privateApis = void 0;
7
+ var _strings = require("./utils/strings");
8
+ var _lockUnlock = require("./lock-unlock");
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+
13
+ /**
14
+ * Private @wordpress/components APIs.
15
+ */
16
+ const privateApis = {};
17
+ exports.privateApis = privateApis;
18
+ (0, _lockUnlock.lock)(privateApis, {
19
+ kebabCase: _strings.kebabCase
20
+ });
21
+ //# sourceMappingURL=private-apis.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_strings","require","_lockUnlock","privateApis","exports","lock","kebabCase"],"sources":["@wordpress/components/src/private-apis.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { kebabCase } from './utils/strings';\nimport { lock } from './lock-unlock';\n\n/**\n * Private @wordpress/components APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\tkebabCase,\n} );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACO,MAAME,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,SAAS,EAATA;AACD,CAAE,CAAC"}