@wordpress/components 28.14.1-next.cd6172eb0.0 → 29.0.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 (747) hide show
  1. package/CHANGELOG.md +16 -9
  2. package/build/alignment-matrix-control/icon.js +1 -0
  3. package/build/alignment-matrix-control/icon.js.map +1 -1
  4. package/build/alignment-matrix-control/index.js +1 -0
  5. package/build/alignment-matrix-control/index.js.map +1 -1
  6. package/build/animation/index.js +0 -6
  7. package/build/animation/index.js.map +1 -1
  8. package/build/autocomplete/autocompleter-ui.js +1 -0
  9. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  10. package/build/autocomplete/autocompleter-ui.native.js +1 -0
  11. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  12. package/build/autocomplete/get-default-use-items.js +1 -0
  13. package/build/autocomplete/get-default-use-items.js.map +1 -1
  14. package/build/autocomplete/index.js +1 -0
  15. package/build/autocomplete/index.js.map +1 -1
  16. package/build/border-box-control/utils.js +1 -0
  17. package/build/border-box-control/utils.js.map +1 -1
  18. package/build/border-control/border-control-dropdown/component.js +1 -0
  19. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  20. package/build/border-control/border-control-style-picker/component.js +1 -0
  21. package/build/border-control/border-control-style-picker/component.js.map +1 -1
  22. package/build/box-control/index.js +13 -13
  23. package/build/box-control/index.js.map +1 -1
  24. package/build/box-control/input-control.js +161 -0
  25. package/build/box-control/input-control.js.map +1 -0
  26. package/build/box-control/types.js.map +1 -1
  27. package/build/box-control/utils.js +51 -48
  28. package/build/box-control/utils.js.map +1 -1
  29. package/build/button/index.native.js +1 -0
  30. package/build/button/index.native.js.map +1 -1
  31. package/build/button/types.js.map +1 -1
  32. package/build/color-indicator/index.native.js +1 -0
  33. package/build/color-indicator/index.native.js.map +1 -1
  34. package/build/color-palette/index.js +1 -0
  35. package/build/color-palette/index.js.map +1 -1
  36. package/build/color-palette/index.native.js +1 -0
  37. package/build/color-palette/index.native.js.map +1 -1
  38. package/build/color-palette/utils.js +1 -0
  39. package/build/color-palette/utils.js.map +1 -1
  40. package/build/combobox-control/index.js +1 -0
  41. package/build/combobox-control/index.js.map +1 -1
  42. package/build/composite/legacy/index.js +1 -0
  43. package/build/composite/legacy/index.js.map +1 -1
  44. package/build/context/context-connect.js +1 -0
  45. package/build/context/context-connect.js.map +1 -1
  46. package/build/custom-gradient-picker/gradient-bar/control-points.js +1 -0
  47. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  48. package/build/custom-gradient-picker/gradient-bar/index.js +1 -0
  49. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  50. package/build/custom-gradient-picker/gradient-bar/utils.js +1 -0
  51. package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  52. package/build/custom-gradient-picker/index.js +1 -0
  53. package/build/custom-gradient-picker/index.js.map +1 -1
  54. package/build/custom-gradient-picker/serializer.js +1 -0
  55. package/build/custom-gradient-picker/serializer.js.map +1 -1
  56. package/build/custom-gradient-picker/utils.js +1 -0
  57. package/build/custom-gradient-picker/utils.js.map +1 -1
  58. package/build/custom-select-control/index.js +3 -2
  59. package/build/custom-select-control/index.js.map +1 -1
  60. package/build/dashicon/index.js +1 -0
  61. package/build/dashicon/index.js.map +1 -1
  62. package/build/date-time/date/index.js +1 -0
  63. package/build/date-time/date/index.js.map +1 -1
  64. package/build/date-time/date/use-lilius/index.js +1 -0
  65. package/build/date-time/date/use-lilius/index.js.map +1 -1
  66. package/build/date-time/time/index.js +1 -0
  67. package/build/date-time/time/index.js.map +1 -1
  68. package/build/dimension-control/index.js +1 -0
  69. package/build/dimension-control/index.js.map +1 -1
  70. package/build/dimension-control/sizes.js +1 -0
  71. package/build/dimension-control/sizes.js.map +1 -1
  72. package/build/draggable/index.js +1 -0
  73. package/build/draggable/index.js.map +1 -1
  74. package/build/draggable/index.native.js +1 -0
  75. package/build/draggable/index.native.js.map +1 -1
  76. package/build/dropdown-menu/index.js +1 -0
  77. package/build/dropdown-menu/index.js.map +1 -1
  78. package/build/dropdown-menu/index.native.js +1 -0
  79. package/build/dropdown-menu/index.native.js.map +1 -1
  80. package/build/duotone-picker/color-list-picker/index.js +1 -0
  81. package/build/duotone-picker/color-list-picker/index.js.map +1 -1
  82. package/build/duotone-picker/duotone-picker.js +1 -0
  83. package/build/duotone-picker/duotone-picker.js.map +1 -1
  84. package/build/duotone-picker/utils.js +1 -0
  85. package/build/duotone-picker/utils.js.map +1 -1
  86. package/build/external-link/index.js +1 -0
  87. package/build/external-link/index.js.map +1 -1
  88. package/build/font-size-picker/font-size-picker-select.js +1 -0
  89. package/build/font-size-picker/font-size-picker-select.js.map +1 -1
  90. package/build/font-size-picker/font-size-picker-toggle-group.js +1 -0
  91. package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  92. package/build/font-size-picker/index.js +1 -0
  93. package/build/font-size-picker/index.js.map +1 -1
  94. package/build/font-size-picker/index.native.js +1 -0
  95. package/build/font-size-picker/index.native.js.map +1 -1
  96. package/build/font-size-picker/utils.js +1 -0
  97. package/build/font-size-picker/utils.js.map +1 -1
  98. package/build/form-token-field/index.js +1 -0
  99. package/build/form-token-field/index.js.map +1 -1
  100. package/build/form-token-field/suggestions-list.js +1 -0
  101. package/build/form-token-field/suggestions-list.js.map +1 -1
  102. package/build/gradient-picker/index.js +1 -0
  103. package/build/gradient-picker/index.js.map +1 -1
  104. package/build/guide/index.js +1 -0
  105. package/build/guide/index.js.map +1 -1
  106. package/build/guide/page-control.js +1 -0
  107. package/build/guide/page-control.js.map +1 -1
  108. package/build/h-stack/hook.js +1 -0
  109. package/build/h-stack/hook.js.map +1 -1
  110. package/build/higher-order/navigate-regions/index.js +1 -0
  111. package/build/higher-order/navigate-regions/index.js.map +1 -1
  112. package/build/higher-order/with-fallback-styles/index.js +1 -0
  113. package/build/higher-order/with-fallback-styles/index.js.map +1 -1
  114. package/build/higher-order/with-filters/index.js +1 -0
  115. package/build/higher-order/with-filters/index.js.map +1 -1
  116. package/build/higher-order/with-notices/index.js +1 -0
  117. package/build/higher-order/with-notices/index.js.map +1 -1
  118. package/build/index.js +0 -6
  119. package/build/index.js.map +1 -1
  120. package/build/keyboard-shortcuts/index.js +1 -0
  121. package/build/keyboard-shortcuts/index.js.map +1 -1
  122. package/build/menu/styles.js +16 -16
  123. package/build/menu/styles.js.map +1 -1
  124. package/build/menu-items-choice/index.js +1 -0
  125. package/build/menu-items-choice/index.js.map +1 -1
  126. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
  127. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  128. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
  129. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  130. package/build/mobile/bottom-sheet/picker-cell.native.js +1 -0
  131. package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  132. package/build/mobile/bottom-sheet-select-control/index.native.js +1 -0
  133. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  134. package/build/mobile/color-settings/palette.screen.native.js +1 -0
  135. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  136. package/build/mobile/gradient/index.native.js +1 -0
  137. package/build/mobile/gradient/index.native.js.map +1 -1
  138. package/build/mobile/media-edit/index.native.js +1 -0
  139. package/build/mobile/media-edit/index.native.js.map +1 -1
  140. package/build/mobile/picker/index.android.js +1 -0
  141. package/build/mobile/picker/index.android.js.map +1 -1
  142. package/build/mobile/picker/index.ios.js +1 -0
  143. package/build/mobile/picker/index.ios.js.map +1 -1
  144. package/build/mobile/segmented-control/index.native.js +1 -0
  145. package/build/mobile/segmented-control/index.native.js.map +1 -1
  146. package/build/mobile/utils/get-px-from-css-unit.native.js +1 -0
  147. package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  148. package/build/navigable-container/container.js +1 -0
  149. package/build/navigable-container/container.js.map +1 -1
  150. package/build/navigation/group/index.js +1 -0
  151. package/build/navigation/group/index.js.map +1 -1
  152. package/build/navigation/menu/menu-title-search.js +1 -0
  153. package/build/navigation/menu/menu-title-search.js.map +1 -1
  154. package/build/navigation/menu/search-no-results-found.js +1 -0
  155. package/build/navigation/menu/search-no-results-found.js.map +1 -1
  156. package/build/navigation/styles/navigation-styles.js +12 -12
  157. package/build/navigation/styles/navigation-styles.js.map +1 -1
  158. package/build/navigator/navigator/component.js +1 -0
  159. package/build/navigator/navigator/component.js.map +1 -1
  160. package/build/navigator/navigator-screen/component.js +1 -0
  161. package/build/navigator/navigator-screen/component.js.map +1 -1
  162. package/build/navigator/utils/router.js +1 -0
  163. package/build/navigator/utils/router.js.map +1 -1
  164. package/build/notice/index.js +1 -0
  165. package/build/notice/index.js.map +1 -1
  166. package/build/notice/list.js +1 -0
  167. package/build/notice/list.js.map +1 -1
  168. package/build/notice/list.native.js +1 -0
  169. package/build/notice/list.native.js.map +1 -1
  170. package/build/palette-edit/index.js +1 -0
  171. package/build/palette-edit/index.js.map +1 -1
  172. package/build/panel/actions.native.js +1 -0
  173. package/build/panel/actions.native.js.map +1 -1
  174. package/build/query-controls/index.js +1 -0
  175. package/build/query-controls/index.js.map +1 -1
  176. package/build/query-controls/terms.js +1 -0
  177. package/build/query-controls/terms.js.map +1 -1
  178. package/build/radio-control/index.js +1 -0
  179. package/build/radio-control/index.js.map +1 -1
  180. package/build/radio-control/index.native.js +1 -0
  181. package/build/radio-control/index.native.js.map +1 -1
  182. package/build/range-control/mark.js +0 -1
  183. package/build/range-control/mark.js.map +1 -1
  184. package/build/range-control/rail.js +1 -0
  185. package/build/range-control/rail.js.map +1 -1
  186. package/build/range-control/styles/range-control-styles.js +33 -45
  187. package/build/range-control/styles/range-control-styles.js.map +1 -1
  188. package/build/resizable-box/index.js +1 -0
  189. package/build/resizable-box/index.js.map +1 -1
  190. package/build/sandbox/index.js +1 -0
  191. package/build/sandbox/index.js.map +1 -1
  192. package/build/sandbox/index.native.js +1 -0
  193. package/build/sandbox/index.native.js.map +1 -1
  194. package/build/search-control/index.native.js +1 -0
  195. package/build/search-control/index.native.js.map +1 -1
  196. package/build/select-control/index.js +1 -0
  197. package/build/select-control/index.js.map +1 -1
  198. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -0
  199. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  200. package/build/slot-fill/provider.js +1 -0
  201. package/build/slot-fill/provider.js.map +1 -1
  202. package/build/slot-fill/slot.js +1 -0
  203. package/build/slot-fill/slot.js.map +1 -1
  204. package/build/snackbar/index.js +1 -0
  205. package/build/snackbar/index.js.map +1 -1
  206. package/build/snackbar/list.js +1 -0
  207. package/build/snackbar/list.js.map +1 -1
  208. package/build/tab-panel/index.js +1 -0
  209. package/build/tab-panel/index.js.map +1 -1
  210. package/build/tabs/index.js +1 -0
  211. package/build/tabs/index.js.map +1 -1
  212. package/build/text/utils.js +1 -0
  213. package/build/text/utils.js.map +1 -1
  214. package/build/theme/color-algorithms.js +1 -0
  215. package/build/theme/color-algorithms.js.map +1 -1
  216. package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
  217. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  218. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
  219. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  220. package/build/toolbar/toolbar-group/index.js +1 -0
  221. package/build/toolbar/toolbar-group/index.js.map +1 -1
  222. package/build/tools-panel/tools-panel/hook.js +1 -0
  223. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  224. package/build/tools-panel/tools-panel-header/component.js +1 -0
  225. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  226. package/build/tree-grid/cell.js +4 -1
  227. package/build/tree-grid/cell.js.map +1 -1
  228. package/build/tree-grid/index.js +1 -0
  229. package/build/tree-grid/index.js.map +1 -1
  230. package/build/tree-grid/types.js.map +1 -1
  231. package/build/tree-select/index.js +1 -0
  232. package/build/tree-select/index.js.map +1 -1
  233. package/build/unit-control/index.js +1 -0
  234. package/build/unit-control/index.js.map +1 -1
  235. package/build/unit-control/index.native.js +1 -0
  236. package/build/unit-control/index.native.js.map +1 -1
  237. package/build/unit-control/unit-select-control.js +1 -0
  238. package/build/unit-control/unit-select-control.js.map +1 -1
  239. package/build/unit-control/utils.js +1 -0
  240. package/build/unit-control/utils.js.map +1 -1
  241. package/build/utils/colors-values.js +3 -0
  242. package/build/utils/colors-values.js.map +1 -1
  243. package/build/utils/config-values.js +0 -1
  244. package/build/utils/config-values.js.map +1 -1
  245. package/build/utils/get-valid-children.js +1 -0
  246. package/build/utils/get-valid-children.js.map +1 -1
  247. package/build/utils/hooks/use-animated-offset-rect.js +1 -0
  248. package/build/utils/hooks/use-animated-offset-rect.js.map +1 -1
  249. package/build/utils/hooks/use-cx.js +1 -0
  250. package/build/utils/hooks/use-cx.js.map +1 -1
  251. package/build/utils/math.js +1 -0
  252. package/build/utils/math.js.map +1 -1
  253. package/build/utils/rtl.js +1 -0
  254. package/build/utils/rtl.js.map +1 -1
  255. package/build/utils/values.js +1 -0
  256. package/build/utils/values.js.map +1 -1
  257. package/build/z-stack/component.js +1 -0
  258. package/build/z-stack/component.js.map +1 -1
  259. package/build-module/alignment-matrix-control/icon.js +1 -0
  260. package/build-module/alignment-matrix-control/icon.js.map +1 -1
  261. package/build-module/alignment-matrix-control/index.js +1 -0
  262. package/build-module/alignment-matrix-control/index.js.map +1 -1
  263. package/build-module/animation/index.js +1 -1
  264. package/build-module/animation/index.js.map +1 -1
  265. package/build-module/autocomplete/autocompleter-ui.js +1 -0
  266. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  267. package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
  268. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  269. package/build-module/autocomplete/get-default-use-items.js +1 -0
  270. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  271. package/build-module/autocomplete/index.js +1 -0
  272. package/build-module/autocomplete/index.js.map +1 -1
  273. package/build-module/border-box-control/utils.js +1 -0
  274. package/build-module/border-box-control/utils.js.map +1 -1
  275. package/build-module/border-control/border-control-dropdown/component.js +1 -0
  276. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  277. package/build-module/border-control/border-control-style-picker/component.js +1 -0
  278. package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
  279. package/build-module/box-control/index.js +15 -15
  280. package/build-module/box-control/index.js.map +1 -1
  281. package/build-module/box-control/input-control.js +153 -0
  282. package/build-module/box-control/input-control.js.map +1 -0
  283. package/build-module/box-control/types.js.map +1 -1
  284. package/build-module/box-control/utils.js +48 -46
  285. package/build-module/box-control/utils.js.map +1 -1
  286. package/build-module/button/index.native.js +1 -0
  287. package/build-module/button/index.native.js.map +1 -1
  288. package/build-module/button/types.js.map +1 -1
  289. package/build-module/color-indicator/index.native.js +1 -0
  290. package/build-module/color-indicator/index.native.js.map +1 -1
  291. package/build-module/color-palette/index.js +1 -0
  292. package/build-module/color-palette/index.js.map +1 -1
  293. package/build-module/color-palette/index.native.js +1 -0
  294. package/build-module/color-palette/index.native.js.map +1 -1
  295. package/build-module/color-palette/utils.js +1 -0
  296. package/build-module/color-palette/utils.js.map +1 -1
  297. package/build-module/combobox-control/index.js +1 -0
  298. package/build-module/combobox-control/index.js.map +1 -1
  299. package/build-module/composite/legacy/index.js +1 -0
  300. package/build-module/composite/legacy/index.js.map +1 -1
  301. package/build-module/context/context-connect.js +1 -0
  302. package/build-module/context/context-connect.js.map +1 -1
  303. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -0
  304. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  305. package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -0
  306. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  307. package/build-module/custom-gradient-picker/gradient-bar/utils.js +1 -0
  308. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  309. package/build-module/custom-gradient-picker/index.js +1 -0
  310. package/build-module/custom-gradient-picker/index.js.map +1 -1
  311. package/build-module/custom-gradient-picker/serializer.js +1 -0
  312. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  313. package/build-module/custom-gradient-picker/utils.js +1 -0
  314. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  315. package/build-module/custom-select-control/index.js +3 -2
  316. package/build-module/custom-select-control/index.js.map +1 -1
  317. package/build-module/dashicon/index.js +1 -0
  318. package/build-module/dashicon/index.js.map +1 -1
  319. package/build-module/date-time/date/index.js +1 -0
  320. package/build-module/date-time/date/index.js.map +1 -1
  321. package/build-module/date-time/date/use-lilius/index.js +1 -0
  322. package/build-module/date-time/date/use-lilius/index.js.map +1 -1
  323. package/build-module/date-time/time/index.js +1 -0
  324. package/build-module/date-time/time/index.js.map +1 -1
  325. package/build-module/dimension-control/index.js +1 -0
  326. package/build-module/dimension-control/index.js.map +1 -1
  327. package/build-module/dimension-control/sizes.js +1 -0
  328. package/build-module/dimension-control/sizes.js.map +1 -1
  329. package/build-module/draggable/index.js +1 -0
  330. package/build-module/draggable/index.js.map +1 -1
  331. package/build-module/draggable/index.native.js +1 -0
  332. package/build-module/draggable/index.native.js.map +1 -1
  333. package/build-module/dropdown-menu/index.js +1 -0
  334. package/build-module/dropdown-menu/index.js.map +1 -1
  335. package/build-module/dropdown-menu/index.native.js +1 -0
  336. package/build-module/dropdown-menu/index.native.js.map +1 -1
  337. package/build-module/duotone-picker/color-list-picker/index.js +1 -0
  338. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
  339. package/build-module/duotone-picker/duotone-picker.js +1 -0
  340. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  341. package/build-module/duotone-picker/utils.js +1 -0
  342. package/build-module/duotone-picker/utils.js.map +1 -1
  343. package/build-module/external-link/index.js +1 -0
  344. package/build-module/external-link/index.js.map +1 -1
  345. package/build-module/font-size-picker/font-size-picker-select.js +1 -0
  346. package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
  347. package/build-module/font-size-picker/font-size-picker-toggle-group.js +1 -0
  348. package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  349. package/build-module/font-size-picker/index.js +1 -0
  350. package/build-module/font-size-picker/index.js.map +1 -1
  351. package/build-module/font-size-picker/index.native.js +1 -0
  352. package/build-module/font-size-picker/index.native.js.map +1 -1
  353. package/build-module/font-size-picker/utils.js +1 -0
  354. package/build-module/font-size-picker/utils.js.map +1 -1
  355. package/build-module/form-token-field/index.js +1 -0
  356. package/build-module/form-token-field/index.js.map +1 -1
  357. package/build-module/form-token-field/suggestions-list.js +1 -0
  358. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  359. package/build-module/gradient-picker/index.js +1 -0
  360. package/build-module/gradient-picker/index.js.map +1 -1
  361. package/build-module/guide/index.js +1 -0
  362. package/build-module/guide/index.js.map +1 -1
  363. package/build-module/guide/page-control.js +1 -0
  364. package/build-module/guide/page-control.js.map +1 -1
  365. package/build-module/h-stack/hook.js +1 -0
  366. package/build-module/h-stack/hook.js.map +1 -1
  367. package/build-module/higher-order/navigate-regions/index.js +1 -0
  368. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  369. package/build-module/higher-order/with-fallback-styles/index.js +1 -0
  370. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  371. package/build-module/higher-order/with-filters/index.js +1 -0
  372. package/build-module/higher-order/with-filters/index.js.map +1 -1
  373. package/build-module/higher-order/with-notices/index.js +1 -0
  374. package/build-module/higher-order/with-notices/index.js.map +1 -1
  375. package/build-module/index.js +1 -1
  376. package/build-module/index.js.map +1 -1
  377. package/build-module/keyboard-shortcuts/index.js +1 -0
  378. package/build-module/keyboard-shortcuts/index.js.map +1 -1
  379. package/build-module/menu/styles.js +16 -16
  380. package/build-module/menu/styles.js.map +1 -1
  381. package/build-module/menu-items-choice/index.js +1 -0
  382. package/build-module/menu-items-choice/index.js.map +1 -1
  383. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
  384. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  385. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
  386. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  387. package/build-module/mobile/bottom-sheet/picker-cell.native.js +1 -0
  388. package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  389. package/build-module/mobile/bottom-sheet-select-control/index.native.js +1 -0
  390. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  391. package/build-module/mobile/color-settings/palette.screen.native.js +1 -0
  392. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  393. package/build-module/mobile/gradient/index.native.js +1 -0
  394. package/build-module/mobile/gradient/index.native.js.map +1 -1
  395. package/build-module/mobile/media-edit/index.native.js +1 -0
  396. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  397. package/build-module/mobile/picker/index.android.js +1 -0
  398. package/build-module/mobile/picker/index.android.js.map +1 -1
  399. package/build-module/mobile/picker/index.ios.js +1 -0
  400. package/build-module/mobile/picker/index.ios.js.map +1 -1
  401. package/build-module/mobile/segmented-control/index.native.js +1 -0
  402. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  403. package/build-module/mobile/utils/get-px-from-css-unit.native.js +1 -0
  404. package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  405. package/build-module/navigable-container/container.js +1 -0
  406. package/build-module/navigable-container/container.js.map +1 -1
  407. package/build-module/navigation/group/index.js +1 -0
  408. package/build-module/navigation/group/index.js.map +1 -1
  409. package/build-module/navigation/menu/menu-title-search.js +1 -0
  410. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  411. package/build-module/navigation/menu/search-no-results-found.js +1 -0
  412. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  413. package/build-module/navigation/styles/navigation-styles.js +12 -12
  414. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  415. package/build-module/navigator/navigator/component.js +1 -0
  416. package/build-module/navigator/navigator/component.js.map +1 -1
  417. package/build-module/navigator/navigator-screen/component.js +1 -0
  418. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  419. package/build-module/navigator/utils/router.js +1 -0
  420. package/build-module/navigator/utils/router.js.map +1 -1
  421. package/build-module/notice/index.js +1 -0
  422. package/build-module/notice/index.js.map +1 -1
  423. package/build-module/notice/list.js +1 -0
  424. package/build-module/notice/list.js.map +1 -1
  425. package/build-module/notice/list.native.js +1 -0
  426. package/build-module/notice/list.native.js.map +1 -1
  427. package/build-module/palette-edit/index.js +1 -0
  428. package/build-module/palette-edit/index.js.map +1 -1
  429. package/build-module/panel/actions.native.js +1 -0
  430. package/build-module/panel/actions.native.js.map +1 -1
  431. package/build-module/query-controls/index.js +1 -0
  432. package/build-module/query-controls/index.js.map +1 -1
  433. package/build-module/query-controls/terms.js +1 -0
  434. package/build-module/query-controls/terms.js.map +1 -1
  435. package/build-module/radio-control/index.js +1 -0
  436. package/build-module/radio-control/index.js.map +1 -1
  437. package/build-module/radio-control/index.native.js +1 -0
  438. package/build-module/radio-control/index.native.js.map +1 -1
  439. package/build-module/range-control/mark.js +0 -1
  440. package/build-module/range-control/mark.js.map +1 -1
  441. package/build-module/range-control/rail.js +1 -0
  442. package/build-module/range-control/rail.js.map +1 -1
  443. package/build-module/range-control/styles/range-control-styles.js +33 -45
  444. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  445. package/build-module/resizable-box/index.js +1 -0
  446. package/build-module/resizable-box/index.js.map +1 -1
  447. package/build-module/sandbox/index.js +1 -0
  448. package/build-module/sandbox/index.js.map +1 -1
  449. package/build-module/sandbox/index.native.js +1 -0
  450. package/build-module/sandbox/index.native.js.map +1 -1
  451. package/build-module/search-control/index.native.js +1 -0
  452. package/build-module/search-control/index.native.js.map +1 -1
  453. package/build-module/select-control/index.js +1 -0
  454. package/build-module/select-control/index.js.map +1 -1
  455. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -0
  456. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  457. package/build-module/slot-fill/provider.js +1 -0
  458. package/build-module/slot-fill/provider.js.map +1 -1
  459. package/build-module/slot-fill/slot.js +1 -0
  460. package/build-module/slot-fill/slot.js.map +1 -1
  461. package/build-module/snackbar/index.js +1 -0
  462. package/build-module/snackbar/index.js.map +1 -1
  463. package/build-module/snackbar/list.js +1 -0
  464. package/build-module/snackbar/list.js.map +1 -1
  465. package/build-module/tab-panel/index.js +1 -0
  466. package/build-module/tab-panel/index.js.map +1 -1
  467. package/build-module/tabs/index.js +1 -0
  468. package/build-module/tabs/index.js.map +1 -1
  469. package/build-module/text/utils.js +1 -0
  470. package/build-module/text/utils.js.map +1 -1
  471. package/build-module/theme/color-algorithms.js +1 -0
  472. package/build-module/theme/color-algorithms.js.map +1 -1
  473. package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
  474. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  475. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
  476. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  477. package/build-module/toolbar/toolbar-group/index.js +1 -0
  478. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  479. package/build-module/tools-panel/tools-panel/hook.js +1 -0
  480. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  481. package/build-module/tools-panel/tools-panel-header/component.js +1 -0
  482. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  483. package/build-module/tree-grid/cell.js +4 -1
  484. package/build-module/tree-grid/cell.js.map +1 -1
  485. package/build-module/tree-grid/index.js +1 -0
  486. package/build-module/tree-grid/index.js.map +1 -1
  487. package/build-module/tree-grid/types.js.map +1 -1
  488. package/build-module/tree-select/index.js +1 -0
  489. package/build-module/tree-select/index.js.map +1 -1
  490. package/build-module/unit-control/index.js +1 -0
  491. package/build-module/unit-control/index.js.map +1 -1
  492. package/build-module/unit-control/index.native.js +1 -0
  493. package/build-module/unit-control/index.native.js.map +1 -1
  494. package/build-module/unit-control/unit-select-control.js +1 -0
  495. package/build-module/unit-control/unit-select-control.js.map +1 -1
  496. package/build-module/unit-control/utils.js +1 -0
  497. package/build-module/unit-control/utils.js.map +1 -1
  498. package/build-module/utils/colors-values.js +3 -0
  499. package/build-module/utils/colors-values.js.map +1 -1
  500. package/build-module/utils/config-values.js +0 -1
  501. package/build-module/utils/config-values.js.map +1 -1
  502. package/build-module/utils/get-valid-children.js +1 -0
  503. package/build-module/utils/get-valid-children.js.map +1 -1
  504. package/build-module/utils/hooks/use-animated-offset-rect.js +1 -0
  505. package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -1
  506. package/build-module/utils/hooks/use-cx.js +1 -0
  507. package/build-module/utils/hooks/use-cx.js.map +1 -1
  508. package/build-module/utils/math.js +1 -0
  509. package/build-module/utils/math.js.map +1 -1
  510. package/build-module/utils/rtl.js +1 -0
  511. package/build-module/utils/rtl.js.map +1 -1
  512. package/build-module/utils/values.js +1 -0
  513. package/build-module/utils/values.js.map +1 -1
  514. package/build-module/z-stack/component.js +1 -0
  515. package/build-module/z-stack/component.js.map +1 -1
  516. package/build-style/style-rtl.css +3 -3
  517. package/build-style/style.css +3 -3
  518. package/build-types/alignment-matrix-control/styles.d.ts.map +1 -1
  519. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
  520. package/build-types/animation/index.d.ts +1 -1
  521. package/build-types/animation/index.d.ts.map +1 -1
  522. package/build-types/base-control/hooks.d.ts +4 -4
  523. package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
  524. package/build-types/border-box-control/border-box-control/hook.d.ts +83 -83
  525. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +93 -93
  526. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +83 -83
  527. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +83 -83
  528. package/build-types/border-control/border-control/hook.d.ts +83 -83
  529. package/build-types/border-control/border-control-dropdown/hook.d.ts +83 -83
  530. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  531. package/build-types/box-control/index.d.ts.map +1 -1
  532. package/build-types/box-control/input-control.d.ts +3 -0
  533. package/build-types/box-control/input-control.d.ts.map +1 -0
  534. package/build-types/box-control/stories/index.story.d.ts +816 -816
  535. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  536. package/build-types/box-control/styles/box-control-icon-styles.d.ts.map +1 -1
  537. package/build-types/box-control/types.d.ts +9 -1
  538. package/build-types/box-control/types.d.ts.map +1 -1
  539. package/build-types/box-control/utils.d.ts +23 -15
  540. package/build-types/box-control/utils.d.ts.map +1 -1
  541. package/build-types/button/stories/index.story.d.ts +18 -0
  542. package/build-types/button/stories/index.story.d.ts.map +1 -1
  543. package/build-types/button/types.d.ts +6 -4
  544. package/build-types/button/types.d.ts.map +1 -1
  545. package/build-types/card/card/hook.d.ts +83 -83
  546. package/build-types/card/card-body/hook.d.ts +83 -83
  547. package/build-types/card/card-divider/hook.d.ts +84 -84
  548. package/build-types/card/card-footer/hook.d.ts +83 -83
  549. package/build-types/card/card-header/hook.d.ts +83 -83
  550. package/build-types/card/card-media/hook.d.ts +83 -83
  551. package/build-types/color-picker/styles.d.ts.map +1 -1
  552. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  553. package/build-types/composite/index.d.ts.map +1 -1
  554. package/build-types/context/constants.d.ts.map +1 -1
  555. package/build-types/context/get-styled-class-name-from-key.d.ts +1 -9
  556. package/build-types/context/get-styled-class-name-from-key.d.ts.map +1 -1
  557. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  558. package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
  559. package/build-types/date-time/date/styles.d.ts.map +1 -1
  560. package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
  561. package/build-types/date-time/stories/date.story.d.ts.map +1 -1
  562. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  563. package/build-types/date-time/time/styles.d.ts.map +1 -1
  564. package/build-types/dimension-control/stories/index.story.d.ts.map +1 -1
  565. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  566. package/build-types/elevation/hook.d.ts +83 -83
  567. package/build-types/flex/flex/hook.d.ts +83 -83
  568. package/build-types/flex/flex-block/hook.d.ts +83 -83
  569. package/build-types/flex/flex-item/hook.d.ts +83 -83
  570. package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
  571. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -1
  572. package/build-types/font-size-picker/styles.d.ts.map +1 -1
  573. package/build-types/grid/hook.d.ts +83 -83
  574. package/build-types/h-stack/hook.d.ts +83 -83
  575. package/build-types/heading/hook.d.ts +82 -82
  576. package/build-types/higher-order/with-fallback-styles/index.d.ts +2 -2
  577. package/build-types/higher-order/with-filters/index.d.ts +4 -4
  578. package/build-types/index.d.ts +1 -1
  579. package/build-types/index.d.ts.map +1 -1
  580. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  581. package/build-types/item-group/item/hook.d.ts +83 -83
  582. package/build-types/item-group/item-group/hook.d.ts +83 -83
  583. package/build-types/menu/styles.d.ts.map +1 -1
  584. package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
  585. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
  586. package/build-types/navigator/navigator-back-button/hook.d.ts +92 -92
  587. package/build-types/navigator/navigator-button/hook.d.ts +92 -92
  588. package/build-types/popover/stories/index.story.d.ts.map +1 -1
  589. package/build-types/progress-bar/styles.d.ts.map +1 -1
  590. package/build-types/range-control/mark.d.ts.map +1 -1
  591. package/build-types/range-control/styles/range-control-styles.d.ts +2 -2
  592. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  593. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  594. package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
  595. package/build-types/scrollable/hook.d.ts +83 -83
  596. package/build-types/scrollable/stories/index.story.d.ts.map +1 -1
  597. package/build-types/select-control/index.d.ts.map +1 -1
  598. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  599. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  600. package/build-types/spacer/hook.d.ts +83 -83
  601. package/build-types/spinner/styles.d.ts.map +1 -1
  602. package/build-types/surface/hook.d.ts +83 -83
  603. package/build-types/text/hook.d.ts +83 -83
  604. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  605. package/build-types/tools-panel/tools-panel/hook.d.ts +83 -83
  606. package/build-types/tools-panel/tools-panel-header/hook.d.ts +83 -83
  607. package/build-types/tools-panel/tools-panel-item/hook.d.ts +83 -83
  608. package/build-types/tree-grid/cell.d.ts.map +1 -1
  609. package/build-types/tree-grid/types.d.ts +1 -1
  610. package/build-types/tree-grid/types.d.ts.map +1 -1
  611. package/build-types/truncate/hook.d.ts +83 -83
  612. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  613. package/build-types/utils/colors-values.d.ts +3 -0
  614. package/build-types/utils/colors-values.d.ts.map +1 -1
  615. package/build-types/utils/config-values.d.ts +0 -1
  616. package/build-types/utils/hooks/use-controlled-state.d.ts +1 -1
  617. package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
  618. package/build-types/utils/rtl.d.ts +1 -1
  619. package/build-types/utils/rtl.d.ts.map +1 -1
  620. package/build-types/v-stack/hook.d.ts +83 -83
  621. package/build-types/z-stack/styles.d.ts.map +1 -1
  622. package/package.json +19 -19
  623. package/src/alignment-matrix-control/stories/index.story.tsx +2 -2
  624. package/src/angle-picker-control/stories/index.story.tsx +2 -2
  625. package/src/animation/index.tsx +0 -1
  626. package/src/base-control/stories/index.story.tsx +1 -1
  627. package/src/border-box-control/stories/index.story.tsx +1 -1
  628. package/src/border-control/stories/index.story.tsx +1 -1
  629. package/src/box-control/index.tsx +24 -14
  630. package/src/box-control/input-control.tsx +197 -0
  631. package/src/box-control/stories/index.story.tsx +1 -1
  632. package/src/box-control/types.ts +9 -1
  633. package/src/box-control/utils.ts +62 -60
  634. package/src/button/README.md +108 -219
  635. package/src/button/docs-manifest.json +5 -0
  636. package/src/button/stories/best-practices.mdx +31 -0
  637. package/src/button/stories/index.story.tsx +18 -0
  638. package/src/button/types.ts +6 -4
  639. package/src/button-group/stories/index.story.tsx +1 -1
  640. package/src/card/stories/index.story.tsx +2 -2
  641. package/src/checkbox-control/stories/index.story.tsx +1 -1
  642. package/src/circular-option-picker/stories/index.story.tsx +2 -2
  643. package/src/color-palette/stories/index.story.tsx +3 -3
  644. package/src/color-picker/stories/index.story.tsx +2 -2
  645. package/src/combobox-control/stories/index.story.tsx +1 -1
  646. package/src/composite/stories/index.story.tsx +3 -3
  647. package/src/confirm-dialog/stories/index.story.tsx +1 -1
  648. package/src/custom-select-control/index.tsx +2 -2
  649. package/src/custom-select-control/stories/index.story.tsx +2 -2
  650. package/src/custom-select-control-v2/stories/index.story.tsx +2 -2
  651. package/src/date-time/stories/date-time.story.tsx +4 -1
  652. package/src/date-time/stories/date.story.tsx +4 -1
  653. package/src/date-time/stories/time.story.tsx +4 -1
  654. package/src/dimension-control/stories/index.story.tsx +1 -1
  655. package/src/disabled/stories/index.story.tsx +3 -3
  656. package/src/divider/stories/index.story.tsx +1 -1
  657. package/src/draggable/stories/index.story.tsx +2 -2
  658. package/src/dropdown/stories/index.story.tsx +7 -7
  659. package/src/dropdown-menu/index.tsx +3 -1
  660. package/src/dropdown-menu/stories/index.story.tsx +3 -3
  661. package/src/duotone-picker/stories/duotone-picker.story.tsx +1 -1
  662. package/src/flex/stories/index.story.tsx +1 -1
  663. package/src/font-size-picker/stories/index.story.tsx +1 -1
  664. package/src/form-file-upload/stories/index.story.tsx +3 -3
  665. package/src/form-token-field/stories/index.story.tsx +2 -2
  666. package/src/gradient-picker/stories/index.story.tsx +1 -1
  667. package/src/grid/stories/index.story.tsx +1 -1
  668. package/src/h-stack/stories/index.story.tsx +2 -2
  669. package/src/index.ts +1 -5
  670. package/src/input-control/stories/index.story.tsx +4 -4
  671. package/src/item-group/stories/index.story.tsx +2 -2
  672. package/src/menu/stories/index.story.tsx +2 -2
  673. package/src/menu/styles.ts +1 -1
  674. package/src/menu-group/stories/index.story.tsx +1 -1
  675. package/src/menu-item/stories/index.story.tsx +1 -1
  676. package/src/menu-items-choice/stories/index.story.tsx +1 -1
  677. package/src/modal/stories/index.story.tsx +2 -2
  678. package/src/modal/test/index.tsx +2 -1
  679. package/src/navigable-container/stories/navigable-menu.story.tsx +1 -1
  680. package/src/navigable-container/stories/tabbable-container.story.tsx +1 -1
  681. package/src/navigation/stories/index.story.tsx +4 -4
  682. package/src/navigation/styles/navigation-styles.tsx +3 -2
  683. package/src/navigator/stories/index.story.tsx +3 -3
  684. package/src/number-control/stories/index.story.tsx +1 -1
  685. package/src/panel/stories/index.story.tsx +1 -1
  686. package/src/placeholder/stories/index.story.tsx +3 -3
  687. package/src/popover/stories/index.story.tsx +11 -9
  688. package/src/query-controls/stories/index.story.tsx +6 -6
  689. package/src/radio-control/stories/index.story.tsx +1 -1
  690. package/src/radio-group/stories/index.story.tsx +3 -3
  691. package/src/range-control/mark.tsx +0 -1
  692. package/src/range-control/stories/index.story.tsx +7 -7
  693. package/src/range-control/styles/range-control-styles.ts +18 -19
  694. package/src/resizable-box/stories/index.story.tsx +1 -1
  695. package/src/responsive-wrapper/stories/index.story.tsx +1 -1
  696. package/src/sandbox/stories/index.story.tsx +1 -1
  697. package/src/scrollable/stories/index.story.tsx +2 -1
  698. package/src/search-control/stories/index.story.tsx +1 -1
  699. package/src/select-control/stories/index.story.tsx +1 -1
  700. package/src/slot-fill/stories/index.story.tsx +2 -2
  701. package/src/snackbar/stories/index.story.tsx +4 -4
  702. package/src/snackbar/stories/list.story.tsx +2 -2
  703. package/src/surface/stories/index.story.tsx +1 -1
  704. package/src/text-control/stories/index.story.tsx +1 -1
  705. package/src/textarea-control/stories/index.story.tsx +1 -1
  706. package/src/theme/stories/index.story.tsx +1 -1
  707. package/src/toggle-control/stories/index.story.tsx +1 -1
  708. package/src/toggle-group-control/stories/index.story.tsx +1 -1
  709. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +22 -22
  710. package/src/toggle-group-control/toggle-group-control/styles.ts +1 -1
  711. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +6 -6
  712. package/src/toolbar/stories/index.story.tsx +1 -1
  713. package/src/tools-panel/stories/index.story.tsx +3 -3
  714. package/src/tools-panel/test/index.tsx +0 -17
  715. package/src/tooltip/stories/index.story.tsx +1 -1
  716. package/src/tree-grid/cell.tsx +5 -1
  717. package/src/tree-grid/stories/index.story.tsx +1 -1
  718. package/src/tree-grid/types.ts +1 -1
  719. package/src/tree-select/stories/index.story.tsx +1 -1
  720. package/src/unit-control/stories/index.story.tsx +4 -4
  721. package/src/utils/colors-values.js +3 -0
  722. package/src/utils/config-values.js +0 -1
  723. package/src/view/stories/index.story.tsx +1 -1
  724. package/src/visually-hidden/stories/index.story.tsx +1 -1
  725. package/src/z-stack/stories/index.story.tsx +1 -1
  726. package/tsconfig.tsbuildinfo +1 -1
  727. package/build/box-control/all-input-control.js +0 -91
  728. package/build/box-control/all-input-control.js.map +0 -1
  729. package/build/box-control/axial-input-controls.js +0 -125
  730. package/build/box-control/axial-input-controls.js.map +0 -1
  731. package/build/box-control/input-controls.js +0 -133
  732. package/build/box-control/input-controls.js.map +0 -1
  733. package/build-module/box-control/all-input-control.js +0 -84
  734. package/build-module/box-control/all-input-control.js.map +0 -1
  735. package/build-module/box-control/axial-input-controls.js +0 -116
  736. package/build-module/box-control/axial-input-controls.js.map +0 -1
  737. package/build-module/box-control/input-controls.js +0 -124
  738. package/build-module/box-control/input-controls.js.map +0 -1
  739. package/build-types/box-control/all-input-control.d.ts +0 -3
  740. package/build-types/box-control/all-input-control.d.ts.map +0 -1
  741. package/build-types/box-control/axial-input-controls.d.ts +0 -3
  742. package/build-types/box-control/axial-input-controls.d.ts.map +0 -1
  743. package/build-types/box-control/input-controls.d.ts +0 -3
  744. package/build-types/box-control/input-controls.d.ts.map +0 -1
  745. package/src/box-control/all-input-control.tsx +0 -110
  746. package/src/box-control/axial-input-controls.tsx +0 -165
  747. package/src/box-control/input-controls.tsx +0 -167
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_utils","CUSTOM_VALUE_SETTINGS","exports","px","max","step","vw","vh","em","rm","svw","lvw","dvw","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","LABELS","all","__","top","bottom","left","right","mixed","vertical","horizontal","DEFAULT_VALUES","undefined","ALL_SIDES","mode","arr","sort","a","b","filter","v","length","pop","getAllValue","values","selectedUnits","availableSides","sides","normalizeSides","parsedQuantitiesAndUnits","map","side","parseQuantityAndUnitFromRawValue","allParsedQuantities","value","_value$","allParsedUnits","commonQuantity","every","commonUnit","_getAllUnitFallback","getAllUnitFallback","join","filteredUnits","Object","Boolean","isValuesMixed","allValue","isMixed","isNaN","parseFloat","isValuesDefined","test","getInitialSide","isLinked","splitOnAxis","initialSide","filteredSides","includes","push","newSides","applyValueToSides","currentValues","newValue","newValues","forEach"],"sources":["@wordpress/components/src/box-control/utils.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';\nimport type {\n\tBoxControlProps,\n\tBoxControlValue,\n\tCustomValueUnits,\n} from './types';\n\nexport const CUSTOM_VALUE_SETTINGS: CustomValueUnits = {\n\tpx: { max: 300, step: 1 },\n\t'%': { max: 100, step: 1 },\n\tvw: { max: 100, step: 1 },\n\tvh: { max: 100, step: 1 },\n\tem: { max: 10, step: 0.1 },\n\trm: { max: 10, step: 0.1 },\n\tsvw: { max: 100, step: 1 },\n\tlvw: { max: 100, step: 1 },\n\tdvw: { max: 100, step: 1 },\n\tsvh: { max: 100, step: 1 },\n\tlvh: { max: 100, step: 1 },\n\tdvh: { max: 100, step: 1 },\n\tvi: { max: 100, step: 1 },\n\tsvi: { max: 100, step: 1 },\n\tlvi: { max: 100, step: 1 },\n\tdvi: { max: 100, step: 1 },\n\tvb: { max: 100, step: 1 },\n\tsvb: { max: 100, step: 1 },\n\tlvb: { max: 100, step: 1 },\n\tdvb: { max: 100, step: 1 },\n\tvmin: { max: 100, step: 1 },\n\tsvmin: { max: 100, step: 1 },\n\tlvmin: { max: 100, step: 1 },\n\tdvmin: { max: 100, step: 1 },\n\tvmax: { max: 100, step: 1 },\n\tsvmax: { max: 100, step: 1 },\n\tlvmax: { max: 100, step: 1 },\n\tdvmax: { max: 100, step: 1 },\n};\n\nexport const LABELS = {\n\tall: __( 'All sides' ),\n\ttop: __( 'Top side' ),\n\tbottom: __( 'Bottom side' ),\n\tleft: __( 'Left side' ),\n\tright: __( 'Right side' ),\n\tmixed: __( 'Mixed' ),\n\tvertical: __( 'Top and bottom sides' ),\n\thorizontal: __( 'Left and right sides' ),\n};\n\nexport const DEFAULT_VALUES = {\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ] as const;\n\n/**\n * Gets an items with the most occurrence within an array\n * https://stackoverflow.com/a/20762713\n *\n * @param arr Array of items to check.\n * @return The item with the most occurrences.\n */\nfunction mode< T >( arr: T[] ) {\n\treturn arr\n\t\t.sort(\n\t\t\t( a, b ) =>\n\t\t\t\tarr.filter( ( v ) => v === a ).length -\n\t\t\t\tarr.filter( ( v ) => v === b ).length\n\t\t)\n\t\t.pop();\n}\n\n/**\n * Gets the 'all' input value and unit from values data.\n *\n * @param values Box values.\n * @param selectedUnits Box units.\n * @param availableSides Available box sides to evaluate.\n *\n * @return A value + unit for the 'all' input.\n */\nexport function getAllValue(\n\tvalues: BoxControlValue = {},\n\tselectedUnits?: BoxControlValue,\n\tavailableSides: BoxControlProps[ 'sides' ] = ALL_SIDES\n) {\n\tconst sides = normalizeSides( availableSides );\n\tconst parsedQuantitiesAndUnits = sides.map( ( side ) =>\n\t\tparseQuantityAndUnitFromRawValue( values[ side ] )\n\t);\n\tconst allParsedQuantities = parsedQuantitiesAndUnits.map(\n\t\t( value ) => value[ 0 ] ?? ''\n\t);\n\tconst allParsedUnits = parsedQuantitiesAndUnits.map(\n\t\t( value ) => value[ 1 ]\n\t);\n\n\tconst commonQuantity = allParsedQuantities.every(\n\t\t( v ) => v === allParsedQuantities[ 0 ]\n\t)\n\t\t? allParsedQuantities[ 0 ]\n\t\t: '';\n\n\t/**\n\t * The typeof === 'number' check is important. On reset actions, the incoming value\n\t * may be null or an empty string.\n\t *\n\t * Also, the value may also be zero (0), which is considered a valid unit value.\n\t *\n\t * typeof === 'number' is more specific for these cases, rather than relying on a\n\t * simple truthy check.\n\t */\n\tlet commonUnit;\n\tif ( typeof commonQuantity === 'number' ) {\n\t\tcommonUnit = mode( allParsedUnits );\n\t} else {\n\t\t// Set meaningful unit selection if no commonQuantity and user has previously\n\t\t// selected units without assigning values while controls were unlinked.\n\t\tcommonUnit =\n\t\t\tgetAllUnitFallback( selectedUnits ) ?? mode( allParsedUnits );\n\t}\n\n\treturn [ commonQuantity, commonUnit ].join( '' );\n}\n\n/**\n * Determine the most common unit selection to use as a fallback option.\n *\n * @param selectedUnits Current unit selections for individual sides.\n * @return Most common unit selection.\n */\nexport function getAllUnitFallback( selectedUnits?: BoxControlValue ) {\n\tif ( ! selectedUnits || typeof selectedUnits !== 'object' ) {\n\t\treturn undefined;\n\t}\n\n\tconst filteredUnits = Object.values( selectedUnits ).filter( Boolean );\n\n\treturn mode( filteredUnits );\n}\n\n/**\n * Checks to determine if values are mixed.\n *\n * @param values Box values.\n * @param selectedUnits Box units.\n * @param sides Available box sides to evaluate.\n *\n * @return Whether values are mixed.\n */\nexport function isValuesMixed(\n\tvalues: BoxControlValue = {},\n\tselectedUnits?: BoxControlValue,\n\tsides: BoxControlProps[ 'sides' ] = ALL_SIDES\n) {\n\tconst allValue = getAllValue( values, selectedUnits, sides );\n\tconst isMixed = isNaN( parseFloat( allValue ) );\n\n\treturn isMixed;\n}\n\n/**\n * Checks to determine if values are defined.\n *\n * @param values Box values.\n *\n * @return Whether values are mixed.\n */\nexport function isValuesDefined( values?: BoxControlValue ) {\n\treturn (\n\t\tvalues &&\n\t\tObject.values( values ).filter(\n\t\t\t// Switching units when input is empty causes values only\n\t\t\t// containing units. This gives false positive on mixed values\n\t\t\t// unless filtered.\n\t\t\t( value ) => !! value && /\\d/.test( value )\n\t\t).length > 0\n\t);\n}\n\n/**\n * Get initial selected side, factoring in whether the sides are linked,\n * and whether the vertical / horizontal directions are grouped via splitOnAxis.\n *\n * @param isLinked Whether the box control's fields are linked.\n * @param splitOnAxis Whether splitting by horizontal or vertical axis.\n * @return The initial side.\n */\nexport function getInitialSide( isLinked: boolean, splitOnAxis: boolean ) {\n\tlet initialSide: keyof typeof LABELS = 'all';\n\n\tif ( ! isLinked ) {\n\t\tinitialSide = splitOnAxis ? 'vertical' : 'top';\n\t}\n\n\treturn initialSide;\n}\n\n/**\n * Normalizes provided sides configuration to an array containing only top,\n * right, bottom and left. This essentially just maps `horizontal` or `vertical`\n * to their appropriate sides to facilitate correctly determining value for\n * all input control.\n *\n * @param sides Available sides for box control.\n * @return Normalized sides configuration.\n */\nexport function normalizeSides( sides: BoxControlProps[ 'sides' ] ) {\n\tconst filteredSides: ( keyof BoxControlValue )[] = [];\n\n\tif ( ! sides?.length ) {\n\t\treturn ALL_SIDES;\n\t}\n\n\tif ( sides.includes( 'vertical' ) ) {\n\t\tfilteredSides.push( ...( [ 'top', 'bottom' ] as const ) );\n\t} else if ( sides.includes( 'horizontal' ) ) {\n\t\tfilteredSides.push( ...( [ 'left', 'right' ] as const ) );\n\t} else {\n\t\tconst newSides = ALL_SIDES.filter( ( side ) => sides.includes( side ) );\n\t\tfilteredSides.push( ...newSides );\n\t}\n\n\treturn filteredSides;\n}\n\n/**\n * Applies a value to an object representing top, right, bottom and left sides\n * while taking into account any custom side configuration.\n *\n * @param currentValues The current values for each side.\n * @param newValue The value to apply to the sides object.\n * @param sides Array defining valid sides.\n *\n * @return Object containing the updated values for each side.\n */\nexport function applyValueToSides(\n\tcurrentValues: BoxControlValue,\n\tnewValue?: string,\n\tsides?: BoxControlProps[ 'sides' ]\n): BoxControlValue {\n\tconst newValues = { ...currentValues };\n\n\tif ( sides?.length ) {\n\t\tsides.forEach( ( side ) => {\n\t\t\tif ( side === 'vertical' ) {\n\t\t\t\tnewValues.top = newValue;\n\t\t\t\tnewValues.bottom = newValue;\n\t\t\t} else if ( side === 'horizontal' ) {\n\t\t\t\tnewValues.left = newValue;\n\t\t\t\tnewValues.right = newValue;\n\t\t\t} else {\n\t\t\t\tnewValues[ side ] = newValue;\n\t\t\t}\n\t\t} );\n\t} else {\n\t\tALL_SIDES.forEach( ( side ) => ( newValues[ side ] = newValue ) );\n\t}\n\n\treturn newValues;\n}\n"],"mappings":";;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAQO,MAAME,qBAAuC,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EACtDE,EAAE,EAAE;IAAEC,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC;EACzB,GAAG,EAAE;IAAED,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC;EAC1BC,EAAE,EAAE;IAAEF,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC;EACzBE,EAAE,EAAE;IAAEH,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC;EACzBG,EAAE,EAAE;IAAEJ,GAAG,EAAE,EAAE;IAAEC,IAAI,EAAE;EAAI,CAAC;EAC1BI,EAAE,EAAE;IAAEL,GAAG,EAAE,EAAE;IAAEC,IAAI,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KA,IAAI,KAAK,UAAU,EAAG;QAC1BiC,SAAS,CAAC5D,GAAG,GAAG2D,QAAQ;QACxBC,SAAS,CAAC3D,MAAM,GAAG0D,QAAQ;MAC5B,CAAC,MAAM,IAAKhC,IAAI,KAAK,YAAY,EAAG;QACnCiC,SAAS,CAAC1D,IAAI,GAAGyD,QAAQ;QACzBC,SAAS,CAACzD,KAAK,GAAGwD,QAAQ;MAC3B,CAAC,MAAM;QACNC,SAAS,CAAEjC,IAAI,CAAE,GAAGgC,QAAQ;MAC7B;IACD,CAAE,CAAC;EACJ,CAAC,MAAM;IACNlD,SAAS,CAACoD,OAAO,CAAIlC,IAAI,IAAQiC,SAAS,CAAEjC,IAAI,CAAE,GAAGgC,QAAW,CAAC;EAClE;EAEA,OAAOC,SAAS;AACjB","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_deprecated","_interopRequireDefault","CUSTOM_VALUE_SETTINGS","exports","px","max","step","vw","vh","em","rm","svw","lvw","dvw","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","LABELS","all","__","top","bottom","left","right","vertical","horizontal","DEFAULT_VALUES","undefined","ALL_SIDES","mode","arr","sort","a","b","filter","v","length","pop","getMergedValue","values","availableSides","sides","normalizeSides","every","side","isValueMixed","some","getAllUnitFallback","selectedUnits","filteredUnits","Object","Boolean","isValuesDefined","value","test","getInitialSide","isLinked","splitOnAxis","initialSide","filteredSides","includes","push","newSides","applyValueToSides","currentValues","newValue","deprecated","since","version","newValues","forEach","getAllowedSides","allowedSides","Set","allowedSide","add"],"sources":["@wordpress/components/src/box-control/utils.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tBoxControlInputControlProps,\n\tBoxControlProps,\n\tBoxControlValue,\n\tCustomValueUnits,\n} from './types';\nimport deprecated from '@wordpress/deprecated';\n\nexport const CUSTOM_VALUE_SETTINGS: CustomValueUnits = {\n\tpx: { max: 300, step: 1 },\n\t'%': { max: 100, step: 1 },\n\tvw: { max: 100, step: 1 },\n\tvh: { max: 100, step: 1 },\n\tem: { max: 10, step: 0.1 },\n\trm: { max: 10, step: 0.1 },\n\tsvw: { max: 100, step: 1 },\n\tlvw: { max: 100, step: 1 },\n\tdvw: { max: 100, step: 1 },\n\tsvh: { max: 100, step: 1 },\n\tlvh: { max: 100, step: 1 },\n\tdvh: { max: 100, step: 1 },\n\tvi: { max: 100, step: 1 },\n\tsvi: { max: 100, step: 1 },\n\tlvi: { max: 100, step: 1 },\n\tdvi: { max: 100, step: 1 },\n\tvb: { max: 100, step: 1 },\n\tsvb: { max: 100, step: 1 },\n\tlvb: { max: 100, step: 1 },\n\tdvb: { max: 100, step: 1 },\n\tvmin: { max: 100, step: 1 },\n\tsvmin: { max: 100, step: 1 },\n\tlvmin: { max: 100, step: 1 },\n\tdvmin: { max: 100, step: 1 },\n\tvmax: { max: 100, step: 1 },\n\tsvmax: { max: 100, step: 1 },\n\tlvmax: { max: 100, step: 1 },\n\tdvmax: { max: 100, step: 1 },\n};\n\nexport const LABELS = {\n\tall: __( 'All sides' ),\n\ttop: __( 'Top side' ),\n\tbottom: __( 'Bottom side' ),\n\tleft: __( 'Left side' ),\n\tright: __( 'Right side' ),\n\tvertical: __( 'Top and bottom sides' ),\n\thorizontal: __( 'Left and right sides' ),\n};\n\nexport const DEFAULT_VALUES = {\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ] as const;\n\n/**\n * Gets an items with the most occurrence within an array\n * https://stackoverflow.com/a/20762713\n *\n * @param arr Array of items to check.\n * @return The item with the most occurrences.\n */\nfunction mode< T >( arr: T[] ) {\n\treturn arr\n\t\t.sort(\n\t\t\t( a, b ) =>\n\t\t\t\tarr.filter( ( v ) => v === a ).length -\n\t\t\t\tarr.filter( ( v ) => v === b ).length\n\t\t)\n\t\t.pop();\n}\n\n/**\n * Gets the merged input value and unit from values data.\n *\n * @param values Box values.\n * @param availableSides Available box sides to evaluate.\n *\n * @return A value + unit for the 'all' input.\n */\nexport function getMergedValue(\n\tvalues: BoxControlValue = {},\n\tavailableSides: BoxControlProps[ 'sides' ] = ALL_SIDES\n) {\n\tconst sides = normalizeSides( availableSides );\n\tif (\n\t\tsides.every(\n\t\t\t( side: keyof BoxControlValue ) =>\n\t\t\t\tvalues[ side ] === values[ sides[ 0 ] ]\n\t\t)\n\t) {\n\t\treturn values[ sides[ 0 ] ];\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Checks if the values are mixed.\n *\n * @param values Box values.\n * @param availableSides Available box sides to evaluate.\n * @return Whether the values are mixed.\n */\nexport function isValueMixed(\n\tvalues: BoxControlValue = {},\n\tavailableSides: BoxControlProps[ 'sides' ] = ALL_SIDES\n) {\n\tconst sides = normalizeSides( availableSides );\n\treturn sides.some(\n\t\t( side: keyof BoxControlValue ) =>\n\t\t\tvalues[ side ] !== values[ sides[ 0 ] ]\n\t);\n}\n\n/**\n * Determine the most common unit selection to use as a fallback option.\n *\n * @param selectedUnits Current unit selections for individual sides.\n * @return Most common unit selection.\n */\nexport function getAllUnitFallback( selectedUnits?: BoxControlValue ) {\n\tif ( ! selectedUnits || typeof selectedUnits !== 'object' ) {\n\t\treturn undefined;\n\t}\n\n\tconst filteredUnits = Object.values( selectedUnits ).filter( Boolean );\n\n\treturn mode( filteredUnits );\n}\n\n/**\n * Checks to determine if values are defined.\n *\n * @param values Box values.\n *\n * @return Whether values are mixed.\n */\nexport function isValuesDefined( values?: BoxControlValue ) {\n\treturn (\n\t\tvalues &&\n\t\tObject.values( values ).filter(\n\t\t\t// Switching units when input is empty causes values only\n\t\t\t// containing units. This gives false positive on mixed values\n\t\t\t// unless filtered.\n\t\t\t( value ) => !! value && /\\d/.test( value )\n\t\t).length > 0\n\t);\n}\n\n/**\n * Get initial selected side, factoring in whether the sides are linked,\n * and whether the vertical / horizontal directions are grouped via splitOnAxis.\n *\n * @param isLinked Whether the box control's fields are linked.\n * @param splitOnAxis Whether splitting by horizontal or vertical axis.\n * @return The initial side.\n */\nexport function getInitialSide( isLinked: boolean, splitOnAxis: boolean ) {\n\tlet initialSide: keyof typeof LABELS = 'all';\n\n\tif ( ! isLinked ) {\n\t\tinitialSide = splitOnAxis ? 'vertical' : 'top';\n\t}\n\n\treturn initialSide;\n}\n\n/**\n * Normalizes provided sides configuration to an array containing only top,\n * right, bottom and left. This essentially just maps `horizontal` or `vertical`\n * to their appropriate sides to facilitate correctly determining value for\n * all input control.\n *\n * @param sides Available sides for box control.\n * @return Normalized sides configuration.\n */\nexport function normalizeSides( sides: BoxControlProps[ 'sides' ] ) {\n\tconst filteredSides: ( keyof BoxControlValue )[] = [];\n\n\tif ( ! sides?.length ) {\n\t\treturn ALL_SIDES;\n\t}\n\n\tif ( sides.includes( 'vertical' ) ) {\n\t\tfilteredSides.push( ...( [ 'top', 'bottom' ] as const ) );\n\t} else if ( sides.includes( 'horizontal' ) ) {\n\t\tfilteredSides.push( ...( [ 'left', 'right' ] as const ) );\n\t} else {\n\t\tconst newSides = ALL_SIDES.filter( ( side ) => sides.includes( side ) );\n\t\tfilteredSides.push( ...newSides );\n\t}\n\n\treturn filteredSides;\n}\n\n/**\n * Applies a value to an object representing top, right, bottom and left sides\n * while taking into account any custom side configuration.\n *\n * @deprecated\n *\n * @param currentValues The current values for each side.\n * @param newValue The value to apply to the sides object.\n * @param sides Array defining valid sides.\n *\n * @return Object containing the updated values for each side.\n */\nexport function applyValueToSides(\n\tcurrentValues: BoxControlValue,\n\tnewValue?: string,\n\tsides?: BoxControlProps[ 'sides' ]\n): BoxControlValue {\n\tdeprecated( 'applyValueToSides', {\n\t\tsince: '6.8',\n\t\tversion: '7.0',\n\t} );\n\tconst newValues = { ...currentValues };\n\n\tif ( sides?.length ) {\n\t\tsides.forEach( ( side ) => {\n\t\t\tif ( side === 'vertical' ) {\n\t\t\t\tnewValues.top = newValue;\n\t\t\t\tnewValues.bottom = newValue;\n\t\t\t} else if ( side === 'horizontal' ) {\n\t\t\t\tnewValues.left = newValue;\n\t\t\t\tnewValues.right = newValue;\n\t\t\t} else {\n\t\t\t\tnewValues[ side ] = newValue;\n\t\t\t}\n\t\t} );\n\t} else {\n\t\tALL_SIDES.forEach( ( side ) => ( newValues[ side ] = newValue ) );\n\t}\n\n\treturn newValues;\n}\n\n/**\n * Return the allowed sides based on the sides configuration.\n *\n * @param sides Sides configuration.\n * @return Allowed sides.\n */\nexport function getAllowedSides(\n\tsides: BoxControlInputControlProps[ 'sides' ]\n) {\n\tconst allowedSides: Set< keyof BoxControlValue > = new Set(\n\t\t! sides ? ALL_SIDES : []\n\t);\n\tsides?.forEach( ( allowedSide ) => {\n\t\tif ( allowedSide === 'vertical' ) {\n\t\t\tallowedSides.add( 'top' );\n\t\t\tallowedSides.add( 'bottom' );\n\t\t} else if ( allowedSide === 'horizontal' ) {\n\t\t\tallowedSides.add( 'right' );\n\t\t\tallowedSides.add( 'left' );\n\t\t} else {\n\t\t\tallowedSides.add( allowedSide );\n\t\t}\n\t} );\n\treturn allowedSides;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAWA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AASO,MAAMG,qBAAuC,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EACtDE,EAAE,EAAE;IAAEC,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC;EACzB,GAAG,EAAE;IAAED,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC;EAC1BC,EAAE,EAAE;IAAEF,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC;EACzBE,EAAE,EAAE;IAAEH,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC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AAEhC,KAAK,GAAGb,SAAS,GAAG,EACvB,CAAC;EACDa,KAAK,EAAE6B,OAAO,CAAII,WAAW,IAAM;IAClC,IAAKA,WAAW,KAAK,UAAU,EAAG;MACjCF,YAAY,CAACG,GAAG,CAAE,KAAM,CAAC;MACzBH,YAAY,CAACG,GAAG,CAAE,QAAS,CAAC;IAC7B,CAAC,MAAM,IAAKD,WAAW,KAAK,YAAY,EAAG;MAC1CF,YAAY,CAACG,GAAG,CAAE,OAAQ,CAAC;MAC3BH,YAAY,CAACG,GAAG,CAAE,MAAO,CAAC;IAC3B,CAAC,MAAM;MACNH,YAAY,CAACG,GAAG,CAAED,WAAY,CAAC;IAChC;EACD,CAAE,CAAC;EACH,OAAOF,YAAY;AACpB","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_reactNativeGestureHandler","_element","_compose","_tooltip","_interopRequireDefault","_icon","_style","_jsxRuntime","isAndroid","Platform","OS","marginBottom","marginLeft","styles","StyleSheet","create","container","flex","padding","justifyContent","alignItems","buttonInactive","flexDirection","fixedRatio","aspectRatio","buttonActive","borderRadius","subscriptInactive","color","fontWeight","fontSize","alignSelf","subscriptInactiveDark","subscriptActive","Button","props","children","onClick","onLongPress","disabled","hint","isPressed","ariaDisabled","subscript","testID","icon","iconSize","showTooltip","label","shortcut","tooltipPosition","isActiveStyle","customContainerStyles","hitSlop","preferredColorScheme","usePreferredColorScheme","isDisabled","containerStyle","buttonActiveColorStyles","usePreferredColorSchemeStyle","style","buttonViewStyle","opacity","backgroundColor","states","push","newChildren","Children","map","child","cloneElement","colorScheme","shouldShowTooltip","Array","isArray","length","newIcon","jsx","default","size","longPressHandler","useCallback","nativeEvent","state","State","ACTIVE","element","TouchableOpacity","activeOpacity","accessible","accessibilityLabel","accessibilityStates","accessibilityRole","accessibilityHint","onPress","LongPressGestureHandler","minDurationMs","maxDist","onHandlerStateChange","View","jsxs","Text","text","position","visible","_default","exports"],"sources":["@wordpress/components/src/button/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tStyleSheet,\n\tTouchableOpacity,\n\tText,\n\tView,\n\tPlatform,\n} from 'react-native';\nimport { LongPressGestureHandler, State } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useCallback } from '@wordpress/element';\nimport {\n\tusePreferredColorScheme,\n\tusePreferredColorSchemeStyle,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../tooltip';\nimport Icon from '../icon';\nimport style from './style.scss';\n\nconst isAndroid = Platform.OS === 'android';\nconst marginBottom = isAndroid ? -0.5 : 0;\nconst marginLeft = -3;\n\nconst styles = StyleSheet.create( {\n\tcontainer: {\n\t\tflex: 1,\n\t\tpadding: 3,\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center',\n\t},\n\tbuttonInactive: {\n\t\tflex: 1,\n\t\tflexDirection: 'row',\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center',\n\t},\n\tfixedRatio: {\n\t\taspectRatio: 1,\n\t},\n\tbuttonActive: {\n\t\tflex: 1,\n\t\tflexDirection: 'row',\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center',\n\t\tborderRadius: 6,\n\t},\n\tsubscriptInactive: {\n\t\tcolor: '#7b9ab1', // $toolbar-button.\n\t\tfontWeight: 'bold',\n\t\tfontSize: 13,\n\t\talignSelf: 'flex-end',\n\t\tmarginLeft,\n\t\tmarginBottom,\n\t},\n\tsubscriptInactiveDark: {\n\t\tcolor: '#a7aaad', // $gray_20.\n\t},\n\tsubscriptActive: {\n\t\tcolor: 'white',\n\t\tfontWeight: 'bold',\n\t\tfontSize: 13,\n\t\talignSelf: 'flex-end',\n\t\tmarginLeft,\n\t\tmarginBottom,\n\t},\n} );\n\nexport function Button( props ) {\n\tconst {\n\t\tchildren,\n\t\tonClick,\n\t\tonLongPress,\n\t\tdisabled,\n\t\thint,\n\t\tfixedRatio = true,\n\t\tisPressed,\n\t\t'aria-disabled': ariaDisabled,\n\t\t'data-subscript': subscript,\n\t\ttestID,\n\t\ticon,\n\t\ticonSize,\n\t\tshowTooltip,\n\t\tlabel,\n\t\tshortcut,\n\t\ttooltipPosition,\n\t\tisActiveStyle,\n\t\tcustomContainerStyles,\n\t\thitSlop,\n\t} = props;\n\tconst preferredColorScheme = usePreferredColorScheme();\n\n\tconst isDisabled = ariaDisabled || disabled;\n\n\tconst containerStyle = [\n\t\tstyles.container,\n\t\tcustomContainerStyles && { ...customContainerStyles },\n\t];\n\n\tconst buttonActiveColorStyles = usePreferredColorSchemeStyle(\n\t\tstyle[ 'components-button-light--active' ],\n\t\tstyle[ 'components-button-dark--active' ]\n\t);\n\n\tconst buttonViewStyle = {\n\t\topacity: isDisabled ? 0.3 : 1,\n\t\t...( fixedRatio && styles.fixedRatio ),\n\t\t...( isPressed ? styles.buttonActive : styles.buttonInactive ),\n\t\t...( isPressed ? buttonActiveColorStyles : {} ),\n\t\t...( isPressed &&\n\t\t\tisActiveStyle?.borderRadius && {\n\t\t\t\tborderRadius: isActiveStyle.borderRadius,\n\t\t\t} ),\n\t\t...( isActiveStyle?.backgroundColor && {\n\t\t\tbackgroundColor: isActiveStyle.backgroundColor,\n\t\t} ),\n\t};\n\n\tconst states = [];\n\tif ( isPressed ) {\n\t\tstates.push( 'selected' );\n\t}\n\n\tif ( isDisabled ) {\n\t\tstates.push( 'disabled' );\n\t}\n\n\tconst subscriptInactive = usePreferredColorSchemeStyle(\n\t\tstyles.subscriptInactive,\n\t\tstyles.subscriptInactiveDark\n\t);\n\n\tconst newChildren = Children.map( children, ( child ) => {\n\t\treturn child\n\t\t\t? cloneElement( child, {\n\t\t\t\t\tcolorScheme: preferredColorScheme,\n\t\t\t\t\tisPressed,\n\t\t\t } )\n\t\t\t: child;\n\t} );\n\n\t// Should show the tooltip if...\n\tconst shouldShowTooltip =\n\t\t! isDisabled &&\n\t\t// An explicit tooltip is passed or...\n\t\t( ( showTooltip && label ) ||\n\t\t\t// There's a shortcut or...\n\t\t\tshortcut ||\n\t\t\t// There's a label and...\n\t\t\t( !! label &&\n\t\t\t\t// The children are empty and...\n\t\t\t\t( ! children ||\n\t\t\t\t\t( Array.isArray( children ) && ! children.length ) ) &&\n\t\t\t\t// The tooltip is not explicitly disabled.\n\t\t\t\tfalse !== showTooltip ) );\n\n\tconst newIcon = icon\n\t\t? cloneElement( <Icon icon={ icon } size={ iconSize } />, {\n\t\t\t\tisPressed,\n\t\t } )\n\t\t: null;\n\n\tconst longPressHandler = useCallback(\n\t\t( { nativeEvent } ) => {\n\t\t\tif ( nativeEvent.state === State.ACTIVE && onLongPress ) {\n\t\t\t\tonLongPress();\n\t\t\t}\n\t\t},\n\t\t[ onLongPress ]\n\t);\n\n\tconst element = (\n\t\t<TouchableOpacity\n\t\t\tactiveOpacity={ 0.7 }\n\t\t\taccessible\n\t\t\taccessibilityLabel={ label }\n\t\t\taccessibilityStates={ states }\n\t\t\taccessibilityRole=\"button\"\n\t\t\taccessibilityHint={ hint }\n\t\t\tonPress={ onClick }\n\t\t\tstyle={ containerStyle }\n\t\t\tdisabled={ isDisabled }\n\t\t\ttestID={ testID }\n\t\t\thitSlop={ hitSlop }\n\t\t>\n\t\t\t<LongPressGestureHandler\n\t\t\t\tminDurationMs={ 500 }\n\t\t\t\tmaxDist={ 150 }\n\t\t\t\tonHandlerStateChange={ longPressHandler }\n\t\t\t>\n\t\t\t\t<View style={ buttonViewStyle }>\n\t\t\t\t\t<View style={ { flexDirection: 'row' } }>\n\t\t\t\t\t\t{ newIcon }\n\t\t\t\t\t\t{ newChildren }\n\t\t\t\t\t\t{ subscript && (\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tisPressed\n\t\t\t\t\t\t\t\t\t\t? styles.subscriptActive\n\t\t\t\t\t\t\t\t\t\t: subscriptInactive\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{ subscript }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t</LongPressGestureHandler>\n\t\t</TouchableOpacity>\n\t);\n\n\tif ( ! shouldShowTooltip ) {\n\t\treturn element;\n\t}\n\n\treturn (\n\t\t<Tooltip\n\t\t\ttext={ label }\n\t\t\tshortcut={ shortcut }\n\t\t\tposition={ tooltipPosition }\n\t\t\tvisible={ showTooltip === true }\n\t\t>\n\t\t\t{ element }\n\t\t</Tooltip>\n\t);\n}\n\nexport default Button;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,0BAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAQA,IAAAI,QAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,KAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,MAAA,GAAAF,sBAAA,CAAAL,OAAA;AAAiC,IAAAQ,WAAA,GAAAR,OAAA;AA1BjC;AACA;AACA;;AAUA;AACA;AACA;;AAOA;AACA;AACA;;AAKA,MAAMS,SAAS,GAAGC,qBAAQ,CAACC,EAAE,KAAK,SAAS;AAC3C,MAAMC,YAAY,GAAGH,SAAS,GAAG,CAAC,GAAG,GAAG,CAAC;AACzC,MAAMI,UAAU,GAAG,CAAC,CAAC;AAErB,MAAMC,MAAM,GAAGC,uBAAU,CAACC,MAAM,CAAE;EACjCC,SAAS,EAAE;IACVC,IAAI,EAAE,CAAC;IACPC,OAAO,EAAE,CAAC;IACVC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACb,CAAC;EACDC,cAAc,EAAE;IACfJ,IAAI,EAAE,CAAC;IACPK,aAAa,EAAE,KAAK;IACpBH,cAAc,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AAiB;QAAAzB,QAAA,eAC9B,IAAA7B,WAAA,CAAA6F,IAAA,EAACtG,YAAA,CAAAqG,IAAI;UAACvC,KAAK,EAAG;YAAEtC,aAAa,EAAE;UAAM,CAAG;UAAAc,QAAA,GACrCwC,OAAO,EACPV,WAAW,EACXvB,SAAS,iBACV,IAAApC,WAAA,CAAAsE,GAAA,EAAC/E,YAAA,CAAAuG,IAAI;YACJzC,KAAK,EACJnB,SAAS,GACN5B,MAAM,CAACoB,eAAe,GACtBN,iBACH;YAAAS,QAAA,EAECO;UAAS,CACN,CACN;QAAA,CACI;MAAC,CACF;IAAC,CACiB;EAAC,CACT,CAClB;EAED,IAAK,CAAE6B,iBAAiB,EAAG;IAC1B,OAAOc,OAAO;EACf;EAEA,oBACC,IAAA/E,WAAA,CAAAsE,GAAA,EAAC1E,QAAA,CAAA2E,OAAO;IACPwB,IAAI,EAAGtD,KAAO;IACdC,QAAQ,EAAGA,QAAU;IACrBsD,QAAQ,EAAGrD,eAAiB;IAC5BsD,OAAO,EAAGzD,WAAW,KAAK,IAAM;IAAAX,QAAA,EAE9BkD;EAAO,CACD,CAAC;AAEZ;AAAC,IAAAmB,QAAA,GAAAC,OAAA,CAAA5B,OAAA,GAEc5C,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_reactNativeGestureHandler","_element","_compose","_tooltip","_interopRequireDefault","_icon","_style","_jsxRuntime","isAndroid","Platform","OS","marginBottom","marginLeft","styles","StyleSheet","create","container","flex","padding","justifyContent","alignItems","buttonInactive","flexDirection","fixedRatio","aspectRatio","buttonActive","borderRadius","subscriptInactive","color","fontWeight","fontSize","alignSelf","subscriptInactiveDark","subscriptActive","Button","props","children","onClick","onLongPress","disabled","hint","isPressed","ariaDisabled","subscript","testID","icon","iconSize","showTooltip","label","shortcut","tooltipPosition","isActiveStyle","customContainerStyles","hitSlop","preferredColorScheme","usePreferredColorScheme","isDisabled","containerStyle","buttonActiveColorStyles","usePreferredColorSchemeStyle","style","buttonViewStyle","opacity","backgroundColor","states","push","newChildren","Children","map","child","cloneElement","colorScheme","shouldShowTooltip","Array","isArray","length","newIcon","jsx","default","size","longPressHandler","useCallback","nativeEvent","state","State","ACTIVE","element","TouchableOpacity","activeOpacity","accessible","accessibilityLabel","accessibilityStates","accessibilityRole","accessibilityHint","onPress","LongPressGestureHandler","minDurationMs","maxDist","onHandlerStateChange","View","jsxs","Text","text","position","visible","_default","exports"],"sources":["@wordpress/components/src/button/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tStyleSheet,\n\tTouchableOpacity,\n\tText,\n\tView,\n\tPlatform,\n} from 'react-native';\nimport { LongPressGestureHandler, State } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useCallback } from '@wordpress/element';\nimport {\n\tusePreferredColorScheme,\n\tusePreferredColorSchemeStyle,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../tooltip';\nimport Icon from '../icon';\nimport style from './style.scss';\n\nconst isAndroid = Platform.OS === 'android';\nconst marginBottom = isAndroid ? -0.5 : 0;\nconst marginLeft = -3;\n\nconst styles = StyleSheet.create( {\n\tcontainer: {\n\t\tflex: 1,\n\t\tpadding: 3,\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center',\n\t},\n\tbuttonInactive: {\n\t\tflex: 1,\n\t\tflexDirection: 'row',\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center',\n\t},\n\tfixedRatio: {\n\t\taspectRatio: 1,\n\t},\n\tbuttonActive: {\n\t\tflex: 1,\n\t\tflexDirection: 'row',\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center',\n\t\tborderRadius: 6,\n\t},\n\tsubscriptInactive: {\n\t\tcolor: '#7b9ab1', // $toolbar-button.\n\t\tfontWeight: 'bold',\n\t\tfontSize: 13,\n\t\talignSelf: 'flex-end',\n\t\tmarginLeft,\n\t\tmarginBottom,\n\t},\n\tsubscriptInactiveDark: {\n\t\tcolor: '#a7aaad', // $gray_20.\n\t},\n\tsubscriptActive: {\n\t\tcolor: 'white',\n\t\tfontWeight: 'bold',\n\t\tfontSize: 13,\n\t\talignSelf: 'flex-end',\n\t\tmarginLeft,\n\t\tmarginBottom,\n\t},\n} );\n\nexport function Button( props ) {\n\tconst {\n\t\tchildren,\n\t\tonClick,\n\t\tonLongPress,\n\t\tdisabled,\n\t\thint,\n\t\tfixedRatio = true,\n\t\tisPressed,\n\t\t'aria-disabled': ariaDisabled,\n\t\t'data-subscript': subscript,\n\t\ttestID,\n\t\ticon,\n\t\ticonSize,\n\t\tshowTooltip,\n\t\tlabel,\n\t\tshortcut,\n\t\ttooltipPosition,\n\t\tisActiveStyle,\n\t\tcustomContainerStyles,\n\t\thitSlop,\n\t} = props;\n\tconst preferredColorScheme = usePreferredColorScheme();\n\n\tconst isDisabled = ariaDisabled || disabled;\n\n\tconst containerStyle = [\n\t\tstyles.container,\n\t\tcustomContainerStyles && { ...customContainerStyles },\n\t];\n\n\tconst buttonActiveColorStyles = usePreferredColorSchemeStyle(\n\t\tstyle[ 'components-button-light--active' ],\n\t\tstyle[ 'components-button-dark--active' ]\n\t);\n\n\tconst buttonViewStyle = {\n\t\topacity: isDisabled ? 0.3 : 1,\n\t\t...( fixedRatio && styles.fixedRatio ),\n\t\t...( isPressed ? styles.buttonActive : styles.buttonInactive ),\n\t\t...( isPressed ? buttonActiveColorStyles : {} ),\n\t\t...( isPressed &&\n\t\t\tisActiveStyle?.borderRadius && {\n\t\t\t\tborderRadius: isActiveStyle.borderRadius,\n\t\t\t} ),\n\t\t...( isActiveStyle?.backgroundColor && {\n\t\t\tbackgroundColor: isActiveStyle.backgroundColor,\n\t\t} ),\n\t};\n\n\tconst states = [];\n\tif ( isPressed ) {\n\t\tstates.push( 'selected' );\n\t}\n\n\tif ( isDisabled ) {\n\t\tstates.push( 'disabled' );\n\t}\n\n\tconst subscriptInactive = usePreferredColorSchemeStyle(\n\t\tstyles.subscriptInactive,\n\t\tstyles.subscriptInactiveDark\n\t);\n\n\tconst newChildren = Children.map( children, ( child ) => {\n\t\treturn child\n\t\t\t? cloneElement( child, {\n\t\t\t\t\tcolorScheme: preferredColorScheme,\n\t\t\t\t\tisPressed,\n\t\t\t } )\n\t\t\t: child;\n\t} );\n\n\t// Should show the tooltip if...\n\tconst shouldShowTooltip =\n\t\t! isDisabled &&\n\t\t// An explicit tooltip is passed or...\n\t\t( ( showTooltip && label ) ||\n\t\t\t// There's a shortcut or...\n\t\t\tshortcut ||\n\t\t\t// There's a label and...\n\t\t\t( !! label &&\n\t\t\t\t// The children are empty and...\n\t\t\t\t( ! children ||\n\t\t\t\t\t( Array.isArray( children ) && ! children.length ) ) &&\n\t\t\t\t// The tooltip is not explicitly disabled.\n\t\t\t\tfalse !== showTooltip ) );\n\n\tconst newIcon = icon\n\t\t? cloneElement( <Icon icon={ icon } size={ iconSize } />, {\n\t\t\t\tisPressed,\n\t\t } )\n\t\t: null;\n\n\tconst longPressHandler = useCallback(\n\t\t( { nativeEvent } ) => {\n\t\t\tif ( nativeEvent.state === State.ACTIVE && onLongPress ) {\n\t\t\t\tonLongPress();\n\t\t\t}\n\t\t},\n\t\t[ onLongPress ]\n\t);\n\n\tconst element = (\n\t\t<TouchableOpacity\n\t\t\tactiveOpacity={ 0.7 }\n\t\t\taccessible\n\t\t\taccessibilityLabel={ label }\n\t\t\taccessibilityStates={ states }\n\t\t\taccessibilityRole=\"button\"\n\t\t\taccessibilityHint={ hint }\n\t\t\tonPress={ onClick }\n\t\t\tstyle={ containerStyle }\n\t\t\tdisabled={ isDisabled }\n\t\t\ttestID={ testID }\n\t\t\thitSlop={ hitSlop }\n\t\t>\n\t\t\t<LongPressGestureHandler\n\t\t\t\tminDurationMs={ 500 }\n\t\t\t\tmaxDist={ 150 }\n\t\t\t\tonHandlerStateChange={ longPressHandler }\n\t\t\t>\n\t\t\t\t<View style={ buttonViewStyle }>\n\t\t\t\t\t<View style={ { flexDirection: 'row' } }>\n\t\t\t\t\t\t{ newIcon }\n\t\t\t\t\t\t{ newChildren }\n\t\t\t\t\t\t{ subscript && (\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tisPressed\n\t\t\t\t\t\t\t\t\t\t? styles.subscriptActive\n\t\t\t\t\t\t\t\t\t\t: subscriptInactive\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{ subscript }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t</LongPressGestureHandler>\n\t\t</TouchableOpacity>\n\t);\n\n\tif ( ! shouldShowTooltip ) {\n\t\treturn element;\n\t}\n\n\treturn (\n\t\t<Tooltip\n\t\t\ttext={ label }\n\t\t\tshortcut={ shortcut }\n\t\t\tposition={ tooltipPosition }\n\t\t\tvisible={ showTooltip === true }\n\t\t>\n\t\t\t{ element }\n\t\t</Tooltip>\n\t);\n}\n\nexport default Button;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,0BAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAQA,IAAAI,QAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,KAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,MAAA,GAAAF,sBAAA,CAAAL,OAAA;AAAiC,IAAAQ,WAAA,GAAAR,OAAA;AA1BjC;AACA;AACA;;AAUA;AACA;AACA;;AAOA;AACA;AACA;;AAKA,MAAMS,SAAS,GAAGC,qBAAQ,CAACC,EAAE,KAAK,SAAS;AAC3C,MAAMC,YAAY,GAAGH,SAAS,GAAG,CAAC,GAAG,GAAG,CAAC;AACzC,MAAMI,UAAU,GAAG,CAAC,CAAC;AAErB,MAAMC,MAAM,GAAGC,uBAAU,CAACC,MAAM,CAAE;EACjCC,SAAS,E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AAuB;MACvBC,aAAa,EAAG,GAAK;MACrBC,OAAO,EAAG,GAAK;MACfC,oBAAoB,EAAGlB,gBAAkB;MAAA5C,QAAA,eAEzC,IAAA7B,WAAA,CAAAsE,GAAA,EAAC/E,YAAA,CAAAqG,IAAI;QAACvC,KAAK,EAAGC,eAAiB;QAAAzB,QAAA,eAC9B,IAAA7B,WAAA,CAAA6F,IAAA,EAACtG,YAAA,CAAAqG,IAAI;UAACvC,KAAK,EAAG;YAAEtC,aAAa,EAAE;UAAM,CAAG;UAAAc,QAAA,GACrCwC,OAAO,EACPV,WAAW,EACXvB,SAAS,iBACV,IAAApC,WAAA,CAAAsE,GAAA,EAAC/E,YAAA,CAAAuG,IAAI;YACJzC,KAAK,EACJnB,SAAS,GACN5B,MAAM,CAACoB,eAAe,GACtBN,iBACH;YAAAS,QAAA,EAECO;UAAS,CACN,CACN;QAAA,CACI;MAAC,CACF;IAAC,CACiB;EAAC,CACT,CAClB;EAED,IAAK,CAAE6B,iBAAiB,EAAG;IAC1B,OAAOc,OAAO;EACf;EAEA,oBACC,IAAA/E,WAAA,CAAAsE,GAAA,EAAC1E,QAAA,CAAA2E,OAAO;IACPwB,IAAI,EAAGtD,KAAO;IACdC,QAAQ,EAAGA,QAAU;IACrBsD,QAAQ,EAAGrD,eAAiB;IAC5BsD,OAAO,EAAGzD,WAAW,KAAK,IAAM;IAAAX,QAAA,EAE9BkD;EAAO,CACD,CAAC;AAEZ;AAAC,IAAAmB,QAAA,GAAAC,OAAA,CAAA5B,OAAA,GAEc5C,MAAM","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/button/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { Props as IconProps } from '../icon';\nimport type { PopoverProps } from '../popover/types';\nimport type { WordPressComponentProps } from '../context/wordpress-component';\n\nexport type ButtonProps =\n\t| WordPressComponentProps< ButtonAsButtonProps, 'button', false >\n\t| WordPressComponentProps< ButtonAsAnchorProps, 'a', false >;\n\nexport type ButtonAsButtonProps = BaseButtonProps & _ButtonProps;\nexport type ButtonAsAnchorProps = BaseButtonProps & AnchorProps;\n\ntype BaseButtonProps = {\n\t/**\n\t * Start opting into the larger default height that will become the\n\t * default size in a future version.\n\t *\n\t * @default false\n\t */\n\t__next40pxDefaultSize?: boolean;\n\t/**\n\t * Whether to keep the button focusable when disabled.\n\t *\n\t * In most cases, it is recommended to set this to `true`. Disabling a control without maintaining focusability\n\t * can cause accessibility issues, by hiding their presence from screen reader users,\n\t * or by preventing focus from returning to a trigger element.\n\t *\n\t * Learn more about the [focusability of disabled controls](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols)\n\t * in the WAI-ARIA Authoring Practices Guide.\n\t *\n\t * @default false\n\t */\n\taccessibleWhenDisabled?: boolean;\n\t/**\n\t * The button's children.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * A visually hidden accessible description for the button.\n\t */\n\tdescription?: string;\n\t/**\n\t * If provided, renders an Icon component inside the button.\n\t */\n\ticon?: IconProps[ 'icon' ];\n\t/**\n\t * If provided with `icon`, sets the position of icon relative to the `text`.\n\t *\n\t * @default 'left'\n\t */\n\ticonPosition?: 'left' | 'right';\n\t/**\n\t * If provided with `icon`, sets the icon size.\n\t * Please refer to the Icon component for more details regarding\n\t * the default value of its `size` prop.\n\t */\n\ticonSize?: IconProps[ 'size' ];\n\t/**\n\t * Indicates activity while a action is being performed.\n\t */\n\tisBusy?: boolean;\n\t/**\n\t * Renders a red text-based button style to indicate destructive behavior.\n\t */\n\tisDestructive?: boolean;\n\t/**\n\t * Renders a pressed button style.\n\t */\n\tisPressed?: boolean;\n\t/**\n\t * Sets the `aria-label` of the component, if none is provided.\n\t * Sets the Tooltip content if `showTooltip` is provided.\n\t */\n\tlabel?: string;\n\t/**\n\t * If provided with `showTooltip`, appends the Shortcut label to the tooltip content.\n\t * If an object is provided, it should contain `display` and `ariaLabel` keys.\n\t */\n\tshortcut?: string | { display: string; ariaLabel: string };\n\t/**\n\t * If provided, renders a Tooltip component for the button.\n\t */\n\tshowTooltip?: boolean;\n\t/**\n\t * The size of the button.\n\t *\n\t * - `'default'`: For normal text-label buttons, unless it is a toggle button.\n\t * - `'compact'`: For toggle buttons, icon buttons, and buttons when used in context of either.\n\t * - `'small'`: For icon buttons associated with more advanced or auxiliary features.\n\t *\n\t * If the deprecated `isSmall` prop is also defined, this prop will take precedence.\n\t *\n\t * @default 'default'\n\t */\n\tsize?: 'default' | 'compact' | 'small';\n\t/**\n\t * If provided, displays the given text inside the button. If the button contains children elements, the text is displayed before them.\n\t */\n\ttext?: string;\n\t/**\n\t * If provided with `showTooltip`, sets the position of the tooltip.\n\t * Please refer to the Tooltip component for more details regarding the defaults.\n\t */\n\ttooltipPosition?: PopoverProps[ 'position' ];\n\t/**\n\t * Specifies the button's style.\n\t * The accepted values are:\n\t * 'primary' (the primary button styles)\n\t * 'secondary' (the default button styles)\n\t * 'tertiary' (the text-based button styles)\n\t * 'link' (the link button styles)\n\t */\n\tvariant?: 'primary' | 'secondary' | 'tertiary' | 'link';\n};\n\ntype _ButtonProps = {\n\t/**\n\t * Whether the button is disabled. If `true`, this will force a `button` element\n\t * to be rendered, even when an `href` is given.\n\t *\n\t * In most cases, it is recommended to also set the `accessibleWhenDisabled` prop to `true`.\n\t */\n\tdisabled?: boolean;\n};\n\ntype AnchorProps = {\n\t/**\n\t * Whether the button is disabled. If `true`, this will force a `button` element\n\t * to be rendered, even when an `href` is given.\n\t *\n\t * In most cases, it is recommended to also set the `accessibleWhenDisabled` prop to `true`.\n\t */\n\tdisabled?: false;\n\t/**\n\t * If provided, renders `a` instead of `button`.\n\t */\n\thref: string;\n\t/**\n\t * If provided with `href`, sets the `target` attribute to the `a`.\n\t */\n\ttarget?: string;\n};\n\nexport type DeprecatedButtonProps = {\n\t/**\n\t * Whether to keep the button focusable when disabled.\n\t *\n\t * @default false\n\t * @deprecated Use the `accessibleWhenDisabled` prop instead.\n\t * @ignore\n\t */\n\t__experimentalIsFocusable?: boolean;\n\t/**\n\t * Gives the button a default style.\n\t *\n\t * @deprecated Use the `'secondary'` value on the `variant` prop instead.\n\t * @ignore\n\t */\n\tisDefault?: boolean;\n\t/**\n\t * Gives the button a link style.\n\t *\n\t * @deprecated Use the `'link'` value on the `variant` prop instead.\n\t * @ignore\n\t */\n\tisLink?: boolean;\n\t/**\n\t * Gives the button a primary style.\n\t *\n\t * @deprecated Use the `'primary'` value on the `variant` prop instead.\n\t * @ignore\n\t */\n\tisPrimary?: boolean;\n\t/**\n\t * Gives the button a default style.\n\t *\n\t * @deprecated Use the `'secondary'` value on the `variant` prop instead.\n\t * @ignore\n\t */\n\tisSecondary?: boolean;\n\t/**\n\t * Gives the button a text-based style.\n\t *\n\t * @deprecated Use the `'tertiary'` value on the `variant` prop instead.\n\t * @ignore\n\t */\n\tisTertiary?: boolean;\n\t/**\n\t * Decreases the size of the button.\n\t *\n\t * @deprecated Use the `'small'` value on the `size` prop instead.\n\t * @ignore\n\t */\n\tisSmall?: boolean;\n\t/**\n\t * A visually hidden accessible description for the button.\n\t *\n\t * @deprecated Use the `description` prop instead.\n\t * @ignore\n\t */\n\tdescribedBy?: string;\n};\n\nexport type DeprecatedIconButtonProps = {\n\tlabelPosition: ButtonProps[ 'tooltipPosition' ];\n\tshowTooltip?: boolean;\n\tsize: ButtonProps[ 'iconSize' ];\n\tlabel: ButtonProps[ 'label' ];\n\ttooltip: ButtonProps[ 'label' ];\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/button/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { Props as IconProps } from '../icon';\nimport type { PopoverProps } from '../popover/types';\nimport type { WordPressComponentProps } from '../context/wordpress-component';\n\nexport type ButtonProps =\n\t| WordPressComponentProps< ButtonAsButtonProps, 'button', false >\n\t| WordPressComponentProps< ButtonAsAnchorProps, 'a', false >;\n\nexport type ButtonAsButtonProps = BaseButtonProps & _ButtonProps;\nexport type ButtonAsAnchorProps = BaseButtonProps & AnchorProps;\n\ntype BaseButtonProps = {\n\t/**\n\t * Start opting into the larger default height that will become the\n\t * default size in a future version.\n\t *\n\t * @default false\n\t */\n\t__next40pxDefaultSize?: boolean;\n\t/**\n\t * Whether to keep the button focusable when disabled.\n\t *\n\t * In most cases, it is recommended to set this to `true`. Disabling a control without maintaining focusability\n\t * can cause accessibility issues, by hiding their presence from screen reader users,\n\t * or by preventing focus from returning to a trigger element.\n\t *\n\t * Learn more about the [focusability of disabled controls](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols)\n\t * in the WAI-ARIA Authoring Practices Guide.\n\t *\n\t * @default false\n\t */\n\taccessibleWhenDisabled?: boolean;\n\t/**\n\t * The button's children.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * A visually hidden accessible description for the button.\n\t */\n\tdescription?: string;\n\t/**\n\t * If provided, renders an Icon component inside the button.\n\t */\n\ticon?: IconProps[ 'icon' ];\n\t/**\n\t * If provided with `icon`, sets the position of icon relative to the `text`.\n\t *\n\t * @default 'left'\n\t */\n\ticonPosition?: 'left' | 'right';\n\t/**\n\t * If provided with `icon`, sets the icon size.\n\t * Please refer to the Icon component for more details regarding\n\t * the default value of its `size` prop.\n\t */\n\ticonSize?: IconProps[ 'size' ];\n\t/**\n\t * Indicates activity while a action is being performed.\n\t */\n\tisBusy?: boolean;\n\t/**\n\t * Renders a red text-based button style to indicate destructive behavior.\n\t */\n\tisDestructive?: boolean;\n\t/**\n\t * Renders a pressed button style.\n\t */\n\tisPressed?: boolean;\n\t/**\n\t * Sets the `aria-label` of the component, if none is provided.\n\t * Sets the Tooltip content if `showTooltip` is provided.\n\t */\n\tlabel?: string;\n\t/**\n\t * If provided with `showTooltip`, appends the Shortcut label to the tooltip content.\n\t * If an object is provided, it should contain `display` and `ariaLabel` keys.\n\t */\n\tshortcut?: string | { display: string; ariaLabel: string };\n\t/**\n\t * If provided, renders a Tooltip component for the button.\n\t */\n\tshowTooltip?: boolean;\n\t/**\n\t * The size of the button.\n\t *\n\t * - `'default'`: For normal text-label buttons, unless it is a toggle button.\n\t * - `'compact'`: For toggle buttons, icon buttons, and buttons when used in context of either.\n\t * - `'small'`: For icon buttons associated with more advanced or auxiliary features.\n\t *\n\t * If the deprecated `isSmall` prop is also defined, this prop will take precedence.\n\t *\n\t * @default 'default'\n\t */\n\tsize?: 'default' | 'compact' | 'small';\n\t/**\n\t * If provided, displays the given text inside the button. If the button contains children elements, the text is displayed before them.\n\t */\n\ttext?: string;\n\t/**\n\t * If provided with `showTooltip`, sets the position of the tooltip.\n\t * Please refer to the Tooltip component for more details regarding the defaults.\n\t */\n\ttooltipPosition?: PopoverProps[ 'position' ];\n\t/**\n\t * Specifies the button's style.\n\t *\n\t * The accepted values are:\n\t *\n\t * 1. `'primary'` (the primary button styles)\n\t * 2. `'secondary'` (the default button styles)\n\t * 3. `'tertiary'` (the text-based button styles)\n\t * 4. `'link'` (the link button styles)\n\t */\n\tvariant?: 'primary' | 'secondary' | 'tertiary' | 'link';\n};\n\ntype _ButtonProps = {\n\t/**\n\t * Whether the button is disabled. If `true`, this will force a `button` element\n\t * to be rendered, even when an `href` is given.\n\t *\n\t * In most cases, it is recommended to also set the `accessibleWhenDisabled` prop to `true`.\n\t */\n\tdisabled?: boolean;\n};\n\ntype AnchorProps = {\n\t/**\n\t * Whether the button is disabled. If `true`, this will force a `button` element\n\t * to be rendered, even when an `href` is given.\n\t *\n\t * In most cases, it is recommended to also set the `accessibleWhenDisabled` prop to `true`.\n\t */\n\tdisabled?: false;\n\t/**\n\t * If provided, renders `a` instead of `button`.\n\t */\n\thref: string;\n\t/**\n\t * If provided with `href`, sets the `target` attribute to the `a`.\n\t */\n\ttarget?: string;\n};\n\nexport type DeprecatedButtonProps = {\n\t/**\n\t * Whether to keep the button focusable when disabled.\n\t *\n\t * @default false\n\t * @deprecated Use the `accessibleWhenDisabled` prop instead.\n\t * @ignore\n\t */\n\t__experimentalIsFocusable?: boolean;\n\t/**\n\t * Gives the button a default style.\n\t *\n\t * @deprecated Use the `'secondary'` value on the `variant` prop instead.\n\t * @ignore\n\t */\n\tisDefault?: boolean;\n\t/**\n\t * Gives the button a link style.\n\t *\n\t * @deprecated Use the `'link'` value on the `variant` prop instead.\n\t * @ignore\n\t */\n\tisLink?: boolean;\n\t/**\n\t * Gives the button a primary style.\n\t *\n\t * @deprecated Use the `'primary'` value on the `variant` prop instead.\n\t * @ignore\n\t */\n\tisPrimary?: boolean;\n\t/**\n\t * Gives the button a default style.\n\t *\n\t * @deprecated Use the `'secondary'` value on the `variant` prop instead.\n\t * @ignore\n\t */\n\tisSecondary?: boolean;\n\t/**\n\t * Gives the button a text-based style.\n\t *\n\t * @deprecated Use the `'tertiary'` value on the `variant` prop instead.\n\t * @ignore\n\t */\n\tisTertiary?: boolean;\n\t/**\n\t * Decreases the size of the button.\n\t *\n\t * @deprecated Use the `'small'` value on the `size` prop instead.\n\t * @ignore\n\t */\n\tisSmall?: boolean;\n\t/**\n\t * A visually hidden accessible description for the button.\n\t *\n\t * @deprecated Use the `description` prop instead.\n\t * @ignore\n\t */\n\tdescribedBy?: string;\n};\n\nexport type DeprecatedIconButtonProps = {\n\tlabelPosition: ButtonProps[ 'tooltipPosition' ];\n\tshowTooltip?: boolean;\n\tsize: ButtonProps[ 'iconSize' ];\n\tlabel: ButtonProps[ 'label' ];\n\ttooltip: ButtonProps[ 'label' ];\n};\n"],"mappings":"","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_icons","_compose","_style","_interopRequireDefault","_gradient","_utils","_jsxRuntime","SelectedIcon","opacity","jsxs","Animated","View","style","styles","selected","children","jsx","outline","selectedOutline","Icon","icon","check","size","ColorIndicator","color","isSelected","withCustomPicker","isGradient","colorsUtils","outlineStyle","usePreferredColorSchemeStyle","outlineDark","default","circleOption","gradientValue","map","absolute","backgroundColor","_default","exports"],"sources":["@wordpress/components/src/color-indicator/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Animated } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { Icon, check } from '@wordpress/icons';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport Gradient from '../mobile/gradient';\nimport { colorsUtils } from '../mobile/color-settings/utils';\n\nfunction SelectedIcon( { opacity } ) {\n\treturn (\n\t\t<Animated.View style={ [ styles.selected, { opacity } ] }>\n\t\t\t<View style={ [ styles.outline, styles.selectedOutline ] } />\n\t\t\t<Icon icon={ check } style={ styles.icon } size={ 24 } />\n\t\t</Animated.View>\n\t);\n}\n\nfunction ColorIndicator( {\n\tcolor,\n\tisSelected,\n\twithCustomPicker,\n\tstyle,\n\topacity,\n} ) {\n\tconst { isGradient } = colorsUtils;\n\n\tconst outlineStyle = usePreferredColorSchemeStyle(\n\t\tstyles.outline,\n\t\tstyles.outlineDark\n\t);\n\n\tif ( isGradient( color ) ) {\n\t\treturn (\n\t\t\t<Gradient\n\t\t\t\tstyle={ [ styles.circleOption, style ] }\n\t\t\t\tgradientValue={ color }\n\t\t\t>\n\t\t\t\t<View style={ outlineStyle } />\n\t\t\t\t{ isSelected && <SelectedIcon opacity={ opacity } /> }\n\t\t\t</Gradient>\n\t\t);\n\t} else if ( withCustomPicker ) {\n\t\treturn (\n\t\t\t<View style={ [ styles.circleOption, style ] }>\n\t\t\t\t<View style={ outlineStyle } />\n\t\t\t\t{ color.map( ( gradientValue ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Gradient\n\t\t\t\t\t\t\tgradientValue={ gradientValue }\n\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\tstyles.circleOption,\n\t\t\t\t\t\t\t\tstyles.absolute,\n\t\t\t\t\t\t\t\tstyle,\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tkey={ gradientValue }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ isSelected && <SelectedIcon /> }\n\t\t\t</View>\n\t\t);\n\t}\n\treturn (\n\t\t<View\n\t\t\tstyle={ [ styles.circleOption, style, { backgroundColor: color } ] }\n\t\t>\n\t\t\t<View style={ outlineStyle } />\n\t\t\t{ isSelected && <SelectedIcon opacity={ opacity } /> }\n\t\t</View>\n\t);\n}\nexport default ColorIndicator;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAIA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAA6D,IAAAO,WAAA,GAAAP,OAAA;AAd7D;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;;AAKA,SAASQ,YAAYA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACpC,oBACC,IAAAF,WAAA,CAAAG,IAAA,EAACX,YAAA,CAAAY,QAAQ,CAACC,IAAI;IAACC,KAAK,EAAG,CAAEC,cAAM,CAACC,QAAQ,EAAE;MAAEN;IAAQ,CAAC,CAAI;IAAAO,QAAA,gBACxD,IAAAT,WAAA,CAAAU,GAAA,EAAClB,YAAA,CAAAa,IAAI;MAACC,KAAK,EAAG,CAAEC,cAAM,CAACI,OAAO,EAAEJ,cAAM,CAACK,eAAe;IAAI,CAAE,CAAC,eAC7D,IAAAZ,WAAA,CAAAU,GAAA,EAAChB,MAAA,CAAAmB,IAAI;MAACC,IAAI,EAAGC,YAAO;MAACT,KAAK,EAAGC,cAAM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pB,cAAM,CAACuB,QAAQ,EACfxB,KAAK;QACH,GACGsB,aACN,CAAC;MAEJ,CAAE,CAAC,EACDT,UAAU,iBAAI,IAAAnB,WAAA,CAAAU,GAAA,EAACT,YAAY,IAAE,CAAC;IAAA,CAC3B,CAAC;EAET;EACA,oBACC,IAAAD,WAAA,CAAAG,IAAA,EAACX,YAAA,CAAAa,IAAI;IACJC,KAAK,EAAG,CAAEC,cAAM,CAACoB,YAAY,EAAErB,KAAK,EAAE;MAAEyB,eAAe,EAAEb;IAAM,CAAC,CAAI;IAAAT,QAAA,gBAEpE,IAAAT,WAAA,CAAAU,GAAA,EAAClB,YAAA,CAAAa,IAAI;MAACC,KAAK,EAAGiB;IAAc,CAAE,CAAC,EAC7BJ,UAAU,iBAAI,IAAAnB,WAAA,CAAAU,GAAA,EAACT,YAAY;MAACC,OAAO,EAAGA;IAAS,CAAE,CAAC;EAAA,CAC/C,CAAC;AAET;AAAC,IAAA8B,QAAA,GAAAC,OAAA,CAAAP,OAAA,GACcT,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_icons","_compose","_style","_interopRequireDefault","_gradient","_utils","_jsxRuntime","SelectedIcon","opacity","jsxs","Animated","View","style","styles","selected","children","jsx","outline","selectedOutline","Icon","icon","check","size","ColorIndicator","color","isSelected","withCustomPicker","isGradient","colorsUtils","outlineStyle","usePreferredColorSchemeStyle","outlineDark","default","circleOption","gradientValue","map","absolute","backgroundColor","_default","exports"],"sources":["@wordpress/components/src/color-indicator/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Animated } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { Icon, check } from '@wordpress/icons';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport Gradient from '../mobile/gradient';\nimport { colorsUtils } from '../mobile/color-settings/utils';\n\nfunction SelectedIcon( { opacity } ) {\n\treturn (\n\t\t<Animated.View style={ [ styles.selected, { opacity } ] }>\n\t\t\t<View style={ [ styles.outline, styles.selectedOutline ] } />\n\t\t\t<Icon icon={ check } style={ styles.icon } size={ 24 } />\n\t\t</Animated.View>\n\t);\n}\n\nfunction ColorIndicator( {\n\tcolor,\n\tisSelected,\n\twithCustomPicker,\n\tstyle,\n\topacity,\n} ) {\n\tconst { isGradient } = colorsUtils;\n\n\tconst outlineStyle = usePreferredColorSchemeStyle(\n\t\tstyles.outline,\n\t\tstyles.outlineDark\n\t);\n\n\tif ( isGradient( color ) ) {\n\t\treturn (\n\t\t\t<Gradient\n\t\t\t\tstyle={ [ styles.circleOption, style ] }\n\t\t\t\tgradientValue={ color }\n\t\t\t>\n\t\t\t\t<View style={ outlineStyle } />\n\t\t\t\t{ isSelected && <SelectedIcon opacity={ opacity } /> }\n\t\t\t</Gradient>\n\t\t);\n\t} else if ( withCustomPicker ) {\n\t\treturn (\n\t\t\t<View style={ [ styles.circleOption, style ] }>\n\t\t\t\t<View style={ outlineStyle } />\n\t\t\t\t{ color.map( ( gradientValue ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Gradient\n\t\t\t\t\t\t\tgradientValue={ gradientValue }\n\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\tstyles.circleOption,\n\t\t\t\t\t\t\t\tstyles.absolute,\n\t\t\t\t\t\t\t\tstyle,\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tkey={ gradientValue }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ isSelected && <SelectedIcon /> }\n\t\t\t</View>\n\t\t);\n\t}\n\treturn (\n\t\t<View\n\t\t\tstyle={ [ styles.circleOption, style, { backgroundColor: color } ] }\n\t\t>\n\t\t\t<View style={ outlineStyle } />\n\t\t\t{ isSelected && <SelectedIcon opacity={ opacity } /> }\n\t\t</View>\n\t);\n}\nexport default ColorIndicator;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAIA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nB,WAAA,CAAAU,GAAA,EAACT,YAAY;MAACC,OAAO,EAAGA;IAAS,CAAE,CAAC;EAAA,CAC/C,CAAC;AAET;AAAC,IAAA8B,QAAA,GAAAC,OAAA,CAAAP,OAAA,GACcT,cAAc","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_colord","require","_names","_interopRequireDefault","_a11y","_clsx","_compose","_i18n","_element","_dropdown","_colorPicker","_circularOptionPicker","_vStack","_truncate","_styles","_dropdownContentWrapper","_utils","_jsxRuntime","extend","namesPlugin","a11yPlugin","SinglePalette","className","clearColor","colors","onChange","value","additionalProps","colorOptions","useMemo","map","color","name","index","colordColor","colord","isSelected","jsx","default","Option","selectedIconProps","fill","contrast","tooltipText","sprintf","__","style","backgroundColor","onClick","OptionGroup","options","MultiplePalettes","headingLevel","instanceId","useInstanceId","length","VStack","spacing","children","colorPalette","id","jsxs","ColorHeading","level","newColor","CustomColorPickerDropdown","isRenderedInSidebar","popoverProps","receivedPopoverProps","props","shift","resize","placement","offset","contentClassName","UnforwardedColorPalette","forwardedRef","asButtons","loop","clearable","disableCustomColors","enableAlpha","__experimentalIsRenderedInSidebar","ariaLabel","ariaLabelledby","normalizedColorValue","setNormalizedColorValue","useState","useCallback","undefined","customColorPaletteCallbackRef","node","normalizeColorValue","hasMultipleColorOrigins","isMultiplePaletteArray","buttonLabelName","extractColorNameFromCurrentValue","renderCustomColorPicker","paddingSize","ColorPicker","isHex","startsWith","displayValue","replace","customColorAccessibleLabel","paletteCommonProps","actions","ButtonAction","accessibleWhenDisabled","disabled","metaProps","_metaProps","ref","renderContent","renderToggle","isOpen","onToggle","background","type","Truncate","clsx","ColorPalette","exports","forwardRef","_default"],"sources":["@wordpress/components/src/color-palette/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Dropdown from '../dropdown';\nimport { ColorPicker } from '../color-picker';\nimport CircularOptionPicker from '../circular-option-picker';\nimport { VStack } from '../v-stack';\nimport { Truncate } from '../truncate';\nimport { ColorHeading } from './styles';\nimport DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';\nimport type {\n\tColorObject,\n\tColorPaletteProps,\n\tCustomColorPickerDropdownProps,\n\tMultiplePalettesProps,\n\tPaletteObject,\n\tSinglePaletteProps,\n} from './types';\nimport type { WordPressComponentProps } from '../context';\nimport type { DropdownProps } from '../dropdown/types';\nimport {\n\textractColorNameFromCurrentValue,\n\tisMultiplePaletteArray,\n\tnormalizeColorValue,\n} from './utils';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nfunction SinglePalette( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\t...additionalProps\n}: SinglePaletteProps ) {\n\tconst colorOptions = useMemo( () => {\n\t\treturn colors.map( ( { color, name }, index ) => {\n\t\t\tconst colordColor = colord( color );\n\t\t\tconst isSelected = value === color;\n\n\t\t\treturn (\n\t\t\t\t<CircularOptionPicker.Option\n\t\t\t\t\tkey={ `${ color }-${ index }` }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tselectedIconProps={\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tfill:\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast() >\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast( '#000' )\n\t\t\t\t\t\t\t\t\t\t\t? '#fff'\n\t\t\t\t\t\t\t\t\t\t\t: '#000',\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: {}\n\t\t\t\t\t}\n\t\t\t\t\ttooltipText={\n\t\t\t\t\t\tname ||\n\t\t\t\t\t\t// translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\tsprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t\tstyle={ { backgroundColor: color, color } }\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tisSelected ? clearColor : () => onChange( color, index )\n\t\t\t\t\t}\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tname\n\t\t\t\t\t\t\t? // translators: %s: The name of the color e.g: \"vivid red\".\n\t\t\t\t\t\t\t sprintf( __( 'Color: %s' ), name )\n\t\t\t\t\t\t\t: // translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\t\t sprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ colors, value, onChange, clearColor ] );\n\n\treturn (\n\t\t<CircularOptionPicker.OptionGroup\n\t\t\tclassName={ className }\n\t\t\toptions={ colorOptions }\n\t\t\t{ ...additionalProps }\n\t\t/>\n\t);\n}\n\nfunction MultiplePalettes( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\theadingLevel,\n}: MultiplePalettesProps ) {\n\tconst instanceId = useInstanceId( MultiplePalettes, 'color-palette' );\n\n\tif ( colors.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ colors.map( ( { name, colors: colorPalette }, index ) => {\n\t\t\t\tconst id = `${ instanceId }-${ index }`;\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading id={ id } level={ headingLevel }>\n\t\t\t\t\t\t\t{ name }\n\t\t\t\t\t\t</ColorHeading>\n\t\t\t\t\t\t<SinglePalette\n\t\t\t\t\t\t\tclearColor={ clearColor }\n\t\t\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\t\t\tonChange={ ( newColor ) =>\n\t\t\t\t\t\t\t\tonChange( newColor, index )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\taria-labelledby={ id }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nexport function CustomColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tpopoverProps: receivedPopoverProps,\n\t...props\n}: CustomColorPickerDropdownProps ) {\n\tconst popoverProps = useMemo< DropdownProps[ 'popoverProps' ] >(\n\t\t() => ( {\n\t\t\tshift: true,\n\t\t\t// Disabling resize as it would otherwise cause the popover to show\n\t\t\t// scrollbars while dragging the color picker's handle close to the\n\t\t\t// popover edge.\n\t\t\tresize: false,\n\t\t\t...( isRenderedInSidebar\n\t\t\t\t? {\n\t\t\t\t\t\t// When in the sidebar: open to the left (stacking),\n\t\t\t\t\t\t// leaving the same gap as the parent popover.\n\t\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t\toffset: 34,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\t// Default behavior: open below the anchor\n\t\t\t\t\t\tplacement: 'bottom',\n\t\t\t\t\t\toffset: 8,\n\t\t\t\t } ),\n\t\t\t...receivedPopoverProps,\n\t\t} ),\n\t\t[ isRenderedInSidebar, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tcontentClassName=\"components-color-palette__custom-color-dropdown-content\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction UnforwardedColorPalette(\n\tprops: WordPressComponentProps< ColorPaletteProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tasButtons,\n\t\tloop,\n\t\tclearable = true,\n\t\tcolors = [],\n\t\tdisableCustomColors = false,\n\t\tenableAlpha = false,\n\t\tonChange,\n\t\tvalue,\n\t\t__experimentalIsRenderedInSidebar = false,\n\t\theadingLevel = 2,\n\t\t'aria-label': ariaLabel,\n\t\t'aria-labelledby': ariaLabelledby,\n\t\t...additionalProps\n\t} = props;\n\tconst [ normalizedColorValue, setNormalizedColorValue ] = useState( value );\n\n\tconst clearColor = useCallback( () => onChange( undefined ), [ onChange ] );\n\n\tconst customColorPaletteCallbackRef = useCallback(\n\t\t( node: HTMLElement | null ) => {\n\t\t\tsetNormalizedColorValue( normalizeColorValue( value, node ) );\n\t\t},\n\t\t[ value ]\n\t);\n\n\tconst hasMultipleColorOrigins = isMultiplePaletteArray( colors );\n\tconst buttonLabelName = useMemo(\n\t\t() =>\n\t\t\textractColorNameFromCurrentValue(\n\t\t\t\tvalue,\n\t\t\t\tcolors,\n\t\t\t\thasMultipleColorOrigins\n\t\t\t),\n\t\t[ value, colors, hasMultipleColorOrigins ]\n\t);\n\n\tconst renderCustomColorPicker = () => (\n\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t<ColorPicker\n\t\t\t\tcolor={ normalizedColorValue }\n\t\t\t\tonChange={ ( color ) => onChange( color ) }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t</DropdownContentWrapper>\n\t);\n\tconst isHex = value?.startsWith( '#' );\n\n\t// Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n\tconst displayValue = value?.replace( /^var\\((.+)\\)$/, '$1' );\n\tconst customColorAccessibleLabel = !! displayValue\n\t\t? sprintf(\n\t\t\t\t// translators: 1: The name of the color e.g: \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n\t\t\t\t__(\n\t\t\t\t\t'Custom color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t\t),\n\t\t\t\tbuttonLabelName,\n\t\t\t\tdisplayValue\n\t\t )\n\t\t: __( 'Custom color picker.' );\n\n\tconst paletteCommonProps = {\n\t\tclearColor,\n\t\tonChange,\n\t\tvalue,\n\t};\n\n\tconst actions = !! clearable && (\n\t\t<CircularOptionPicker.ButtonAction\n\t\t\tonClick={ clearColor }\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ ! value }\n\t\t>\n\t\t\t{ __( 'Clear' ) }\n\t\t</CircularOptionPicker.ButtonAction>\n\t);\n\n\tlet metaProps:\n\t\t| { asButtons: false; loop?: boolean; 'aria-label': string }\n\t\t| { asButtons: false; loop?: boolean; 'aria-labelledby': string }\n\t\t| { asButtons: true };\n\n\tif ( asButtons ) {\n\t\tmetaProps = { asButtons: true };\n\t} else {\n\t\tconst _metaProps: { asButtons: false; loop?: boolean } = {\n\t\t\tasButtons: false,\n\t\t\tloop,\n\t\t};\n\n\t\tif ( ariaLabel ) {\n\t\t\tmetaProps = { ..._metaProps, 'aria-label': ariaLabel };\n\t\t} else if ( ariaLabelledby ) {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-labelledby': ariaLabelledby,\n\t\t\t};\n\t\t} else {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-label': __( 'Custom color picker.' ),\n\t\t\t};\n\t\t}\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 3 } ref={ forwardedRef } { ...additionalProps }>\n\t\t\t{ ! disableCustomColors && (\n\t\t\t\t<CustomColorPickerDropdown\n\t\t\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\t\t\trenderContent={ renderCustomColorPicker }\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-wrapper\"\n\t\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tref={ customColorPaletteCallbackRef }\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-button\"\n\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\taria-label={ customColorAccessibleLabel }\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tbackground: value,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-text-wrapper\"\n\t\t\t\t\t\t\t\tspacing={ 0.5 }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Truncate className=\"components-color-palette__custom-color-name\">\n\t\t\t\t\t\t\t\t\t{ value\n\t\t\t\t\t\t\t\t\t\t? buttonLabelName\n\t\t\t\t\t\t\t\t\t\t: __( 'No color selected' ) }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t\t\tThis `Truncate` is always rendered, even if\n\t\t\t\t\t\t\t\tthere is no `displayValue`, to ensure the layout\n\t\t\t\t\t\t\t\tdoes not shift\n\t\t\t\t\t\t\t\t*/ }\n\t\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'components-color-palette__custom-color-value',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'components-color-palette__custom-color-value--is-hex':\n\t\t\t\t\t\t\t\t\t\t\t\tisHex,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ displayValue }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ( colors.length > 0 || actions ) && (\n\t\t\t\t<CircularOptionPicker\n\t\t\t\t\t{ ...metaProps }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\toptions={\n\t\t\t\t\t\thasMultipleColorOrigins ? (\n\t\t\t\t\t\t\t<MultiplePalettes\n\t\t\t\t\t\t\t\t{ ...paletteCommonProps }\n\t\t\t\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t\t\t\t\tcolors={ colors as PaletteObject[] }\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<SinglePalette\n\t\t\t\t\t\t\t\t{ ...paletteCommonProps }\n\t\t\t\t\t\t\t\tcolors={ colors as ColorObject[] }\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\n/**\n * Allows the user to pick a color from a list of pre-defined color entries.\n *\n * ```jsx\n * import { ColorPalette } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyColorPalette = () => {\n * const [ color, setColor ] = useState ( '#f00' )\n * const colors = [\n * { name: 'red', color: '#f00' },\n * { name: 'white', color: '#fff' },\n * { name: 'blue', color: '#00f' },\n * ];\n * return (\n * <ColorPalette\n * colors={ colors }\n * value={ color }\n * onChange={ ( color ) => setColor( color ) }\n * />\n * );\n * } );\n * ```\n */\nexport const ColorPalette = forwardRef( UnforwardedColorPalette );\n\nexport default ColorPalette;\n"],"mappings":";;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAA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QAAQ;YACRjG,SAAS,EAAG,IAAAkG,aAAI,EACf,8CAA8C,EAC9C;cACC,sDAAsD,EACrDpB;YACF,CACD,CAAG;YAAA1C,QAAA,EAED4C;UAAY,CACL,CAAC;QAAA,CACJ,CAAC;MAAA,CACF;IACN,CACH,CACD,EACC,CAAE9E,MAAM,CAAC+B,MAAM,GAAG,CAAC,IAAImD,OAAO,kBAC/B,IAAAzF,WAAA,CAAAoB,GAAA,EAAC1B,qBAAA,CAAA2B,OAAoB;MAAA,GACfwE,SAAS;MACdJ,OAAO,EAAGA,OAAS;MACnBxD,OAAO,EACN2C,uBAAuB,gBACtB,IAAA5E,WAAA,CAAAoB,GAAA,EAACc,gBAAgB;QAAA,GACXsD,kBAAkB;QACvBrD,YAAY,EAAGA,YAAc;QAC7B5B,MAAM,EAAGA,MAA2B;QACpCE,KAAK,EAAGA;MAAO,CACf,CAAC,gBAEF,IAAAT,WAAA,CAAAoB,GAAA,EAAChB,aAAa;QAAA,GACRoF,kBAAkB;QACvBjF,MAAM,EAAGA,MAAyB;QAClCE,KAAK,EAAGA;MAAO,CACf;IAEF,CACD,CACD;EAAA,CACM,CAAC;AAEX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM+F,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,IAAAE,mBAAU,EAAEhD,uBAAwB,CAAC;AAAC,IAAAiD,QAAA,GAAAF,OAAA,CAAApF,OAAA,GAEnDmF,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_colord","require","_names","_interopRequireDefault","_a11y","_clsx","_compose","_i18n","_element","_dropdown","_colorPicker","_circularOptionPicker","_vStack","_truncate","_styles","_dropdownContentWrapper","_utils","_jsxRuntime","extend","namesPlugin","a11yPlugin","SinglePalette","className","clearColor","colors","onChange","value","additionalProps","colorOptions","useMemo","map","color","name","index","colordColor","colord","isSelected","jsx","default","Option","selectedIconProps","fill","contrast","tooltipText","sprintf","__","style","backgroundColor","onClick","OptionGroup","options","MultiplePalettes","headingLevel","instanceId","useInstanceId","length","VStack","spacing","children","colorPalette","id","jsxs","ColorHeading","level","newColor","CustomColorPickerDropdown","isRenderedInSidebar","popoverProps","receivedPopoverProps","props","shift","resize","placement","offset","contentClassName","UnforwardedColorPalette","forwardedRef","asButtons","loop","clearable","disableCustomColors","enableAlpha","__experimentalIsRenderedInSidebar","ariaLabel","ariaLabelledby","normalizedColorValue","setNormalizedColorValue","useState","useCallback","undefined","customColorPaletteCallbackRef","node","normalizeColorValue","hasMultipleColorOrigins","isMultiplePaletteArray","buttonLabelName","extractColorNameFromCurrentValue","renderCustomColorPicker","paddingSize","ColorPicker","isHex","startsWith","displayValue","replace","customColorAccessibleLabel","paletteCommonProps","actions","ButtonAction","accessibleWhenDisabled","disabled","metaProps","_metaProps","ref","renderContent","renderToggle","isOpen","onToggle","background","type","Truncate","clsx","ColorPalette","exports","forwardRef","_default"],"sources":["@wordpress/components/src/color-palette/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Dropdown from '../dropdown';\nimport { ColorPicker } from '../color-picker';\nimport CircularOptionPicker from '../circular-option-picker';\nimport { VStack } from '../v-stack';\nimport { Truncate } from '../truncate';\nimport { ColorHeading } from './styles';\nimport DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';\nimport type {\n\tColorObject,\n\tColorPaletteProps,\n\tCustomColorPickerDropdownProps,\n\tMultiplePalettesProps,\n\tPaletteObject,\n\tSinglePaletteProps,\n} from './types';\nimport type { WordPressComponentProps } from '../context';\nimport type { DropdownProps } from '../dropdown/types';\nimport {\n\textractColorNameFromCurrentValue,\n\tisMultiplePaletteArray,\n\tnormalizeColorValue,\n} from './utils';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nfunction SinglePalette( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\t...additionalProps\n}: SinglePaletteProps ) {\n\tconst colorOptions = useMemo( () => {\n\t\treturn colors.map( ( { color, name }, index ) => {\n\t\t\tconst colordColor = colord( color );\n\t\t\tconst isSelected = value === color;\n\n\t\t\treturn (\n\t\t\t\t<CircularOptionPicker.Option\n\t\t\t\t\tkey={ `${ color }-${ index }` }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tselectedIconProps={\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tfill:\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast() >\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast( '#000' )\n\t\t\t\t\t\t\t\t\t\t\t? '#fff'\n\t\t\t\t\t\t\t\t\t\t\t: '#000',\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: {}\n\t\t\t\t\t}\n\t\t\t\t\ttooltipText={\n\t\t\t\t\t\tname ||\n\t\t\t\t\t\t// translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\tsprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t\tstyle={ { backgroundColor: color, color } }\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tisSelected ? clearColor : () => onChange( color, index )\n\t\t\t\t\t}\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tname\n\t\t\t\t\t\t\t? // translators: %s: The name of the color e.g: \"vivid red\".\n\t\t\t\t\t\t\t sprintf( __( 'Color: %s' ), name )\n\t\t\t\t\t\t\t: // translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\t\t sprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ colors, value, onChange, clearColor ] );\n\n\treturn (\n\t\t<CircularOptionPicker.OptionGroup\n\t\t\tclassName={ className }\n\t\t\toptions={ colorOptions }\n\t\t\t{ ...additionalProps }\n\t\t/>\n\t);\n}\n\nfunction MultiplePalettes( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\theadingLevel,\n}: MultiplePalettesProps ) {\n\tconst instanceId = useInstanceId( MultiplePalettes, 'color-palette' );\n\n\tif ( colors.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ colors.map( ( { name, colors: colorPalette }, index ) => {\n\t\t\t\tconst id = `${ instanceId }-${ index }`;\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading id={ id } level={ headingLevel }>\n\t\t\t\t\t\t\t{ name }\n\t\t\t\t\t\t</ColorHeading>\n\t\t\t\t\t\t<SinglePalette\n\t\t\t\t\t\t\tclearColor={ clearColor }\n\t\t\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\t\t\tonChange={ ( newColor ) =>\n\t\t\t\t\t\t\t\tonChange( newColor, index )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\taria-labelledby={ id }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nexport function CustomColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tpopoverProps: receivedPopoverProps,\n\t...props\n}: CustomColorPickerDropdownProps ) {\n\tconst popoverProps = useMemo< DropdownProps[ 'popoverProps' ] >(\n\t\t() => ( {\n\t\t\tshift: true,\n\t\t\t// Disabling resize as it would otherwise cause the popover to show\n\t\t\t// scrollbars while dragging the color picker's handle close to the\n\t\t\t// popover edge.\n\t\t\tresize: false,\n\t\t\t...( isRenderedInSidebar\n\t\t\t\t? {\n\t\t\t\t\t\t// When in the sidebar: open to the left (stacking),\n\t\t\t\t\t\t// leaving the same gap as the parent popover.\n\t\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t\toffset: 34,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\t// Default behavior: open below the anchor\n\t\t\t\t\t\tplacement: 'bottom',\n\t\t\t\t\t\toffset: 8,\n\t\t\t\t } ),\n\t\t\t...receivedPopoverProps,\n\t\t} ),\n\t\t[ isRenderedInSidebar, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tcontentClassName=\"components-color-palette__custom-color-dropdown-content\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction UnforwardedColorPalette(\n\tprops: WordPressComponentProps< ColorPaletteProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tasButtons,\n\t\tloop,\n\t\tclearable = true,\n\t\tcolors = [],\n\t\tdisableCustomColors = false,\n\t\tenableAlpha = false,\n\t\tonChange,\n\t\tvalue,\n\t\t__experimentalIsRenderedInSidebar = false,\n\t\theadingLevel = 2,\n\t\t'aria-label': ariaLabel,\n\t\t'aria-labelledby': ariaLabelledby,\n\t\t...additionalProps\n\t} = props;\n\tconst [ normalizedColorValue, setNormalizedColorValue ] = useState( value );\n\n\tconst clearColor = useCallback( () => onChange( undefined ), [ onChange ] );\n\n\tconst customColorPaletteCallbackRef = useCallback(\n\t\t( node: HTMLElement | null ) => {\n\t\t\tsetNormalizedColorValue( normalizeColorValue( value, node ) );\n\t\t},\n\t\t[ value ]\n\t);\n\n\tconst hasMultipleColorOrigins = isMultiplePaletteArray( colors );\n\tconst buttonLabelName = useMemo(\n\t\t() =>\n\t\t\textractColorNameFromCurrentValue(\n\t\t\t\tvalue,\n\t\t\t\tcolors,\n\t\t\t\thasMultipleColorOrigins\n\t\t\t),\n\t\t[ value, colors, hasMultipleColorOrigins ]\n\t);\n\n\tconst renderCustomColorPicker = () => (\n\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t<ColorPicker\n\t\t\t\tcolor={ normalizedColorValue }\n\t\t\t\tonChange={ ( color ) => onChange( color ) }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t</DropdownContentWrapper>\n\t);\n\tconst isHex = value?.startsWith( '#' );\n\n\t// Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n\tconst displayValue = value?.replace( /^var\\((.+)\\)$/, '$1' );\n\tconst customColorAccessibleLabel = !! displayValue\n\t\t? sprintf(\n\t\t\t\t// translators: 1: The name of the color e.g: \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n\t\t\t\t__(\n\t\t\t\t\t'Custom color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t\t),\n\t\t\t\tbuttonLabelName,\n\t\t\t\tdisplayValue\n\t\t )\n\t\t: __( 'Custom color picker.' );\n\n\tconst paletteCommonProps = {\n\t\tclearColor,\n\t\tonChange,\n\t\tvalue,\n\t};\n\n\tconst actions = !! clearable && (\n\t\t<CircularOptionPicker.ButtonAction\n\t\t\tonClick={ clearColor }\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ ! value }\n\t\t>\n\t\t\t{ __( 'Clear' ) }\n\t\t</CircularOptionPicker.ButtonAction>\n\t);\n\n\tlet metaProps:\n\t\t| { asButtons: false; loop?: boolean; 'aria-label': string }\n\t\t| { asButtons: false; loop?: boolean; 'aria-labelledby': string }\n\t\t| { asButtons: true };\n\n\tif ( asButtons ) {\n\t\tmetaProps = { asButtons: true };\n\t} else {\n\t\tconst _metaProps: { asButtons: false; loop?: boolean } = {\n\t\t\tasButtons: false,\n\t\t\tloop,\n\t\t};\n\n\t\tif ( ariaLabel ) {\n\t\t\tmetaProps = { ..._metaProps, 'aria-label': ariaLabel };\n\t\t} else if ( ariaLabelledby ) {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-labelledby': ariaLabelledby,\n\t\t\t};\n\t\t} else {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-label': __( 'Custom color picker.' ),\n\t\t\t};\n\t\t}\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 3 } ref={ forwardedRef } { ...additionalProps }>\n\t\t\t{ ! disableCustomColors && (\n\t\t\t\t<CustomColorPickerDropdown\n\t\t\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\t\t\trenderContent={ renderCustomColorPicker }\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-wrapper\"\n\t\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tref={ customColorPaletteCallbackRef }\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-button\"\n\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\taria-label={ customColorAccessibleLabel }\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tbackground: value,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-text-wrapper\"\n\t\t\t\t\t\t\t\tspacing={ 0.5 }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Truncate className=\"components-color-palette__custom-color-name\">\n\t\t\t\t\t\t\t\t\t{ value\n\t\t\t\t\t\t\t\t\t\t? buttonLabelName\n\t\t\t\t\t\t\t\t\t\t: __( 'No color selected' ) }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t\t\tThis `Truncate` is always rendered, even if\n\t\t\t\t\t\t\t\tthere is no `displayValue`, to ensure the layout\n\t\t\t\t\t\t\t\tdoes not shift\n\t\t\t\t\t\t\t\t*/ }\n\t\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'components-color-palette__custom-color-value',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'components-color-palette__custom-color-value--is-hex':\n\t\t\t\t\t\t\t\t\t\t\t\tisHex,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ displayValue }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ( colors.length > 0 || actions ) && (\n\t\t\t\t<CircularOptionPicker\n\t\t\t\t\t{ ...metaProps }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\toptions={\n\t\t\t\t\t\thasMultipleColorOrigins ? (\n\t\t\t\t\t\t\t<MultiplePalettes\n\t\t\t\t\t\t\t\t{ ...paletteCommonProps }\n\t\t\t\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t\t\t\t\tcolors={ colors as PaletteObject[] }\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<SinglePalette\n\t\t\t\t\t\t\t\t{ ...paletteCommonProps }\n\t\t\t\t\t\t\t\tcolors={ colors as ColorObject[] }\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\n/**\n * Allows the user to pick a color from a list of pre-defined color entries.\n *\n * ```jsx\n * import { ColorPalette } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyColorPalette = () => {\n * const [ color, setColor ] = useState ( '#f00' )\n * const colors = [\n * { name: 'red', color: '#f00' },\n * { name: 'white', color: '#fff' },\n * { name: 'blue', color: '#00f' },\n * ];\n * return (\n * <ColorPalette\n * colors={ colors }\n * value={ color }\n * onChange={ ( color ) => setColor( color ) }\n * />\n * );\n * } );\n * ```\n */\nexport const ColorPalette = forwardRef( UnforwardedColorPalette );\n\nexport default ColorPalette;\n"],"mappings":";;;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,SAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,qBAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,SAAA,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AACA,IAAAc,uBAAA,GAAAZ,sBAAA,CAAAF,OAAA;AAWA,IAAAe,MAAA,GAAAf,OAAA;AAIiB,IAAAgB,WAAA,GAAAhB,OAAA;AAxCjB;AACA;AACA;;AAOA;AACA;AACA;;AAKA;AACA;AACA;;AAwBA,IAAAiB,cAAM,EAAE,CAAEC,cAAW,EAAEC,aAAU,CAAG,CAAC;AAErC,SAASC,aAAaA,CAAE;EACvBC,SAA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pCE,KAAK,EAAGA;MAAO,CACf,CAAC,gBAEF,IAAAT,WAAA,CAAAoB,GAAA,EAAChB,aAAa;QAAA,GACRoF,kBAAkB;QACvBjF,MAAM,EAAGA,MAAyB;QAClCE,KAAK,EAAGA;MAAO,CACf;IAEF,CACD,CACD;EAAA,CACM,CAAC;AAEX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM+F,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,IAAAE,mBAAU,EAAEhD,uBAAwB,CAAC;AAAC,IAAAiD,QAAA,GAAAF,OAAA,CAAApF,OAAA,GAEnDmF,YAAY","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_i18n","_element","_compose","_style","_interopRequireDefault","_colorIndicator","_utils","_jsxRuntime","ANIMATION_DURATION","contentWidth","scrollPosition","customIndicatorWidth","ColorPalette","enableCustomColor","setColor","activeColor","isGradientColor","defaultSettings","currentSegment","onCustomPress","shouldEnableBottomSheetScroll","shouldShowCustomIndicatorOption","shouldShowCustomLabel","shouldShowCustomVerticalSeparator","customColorIndicatorStyles","customIndicatorWrapperStyles","label","_defaultSettings$colo","_defaultSettings$grad","_defaultSettings$allC","_defaultSettings$allG","customSwatchGradients","scrollViewRef","useRef","isIOS","Platform","OS","isGradientSegment","colorsUtils","segments","scale","Animated","Value","current","opacity","delayedScrollRef","mergedColors","Set","colors","map","color","mergedGradients","gradients","gradient","allAvailableColors","allColors","allAvailableGradients","allGradients","customIndicatorColor","isCustomGradientColor","isSelectedCustom","shouldShowCustomIndicator","accessibilityHint","__","customText","useEffect","scrollToEndWithDelay","scrollTo","x","y","isWithinColors","includes","isSelected","timingAnimation","property","toValue","timing","duration","easing","Easing","ease","useNativeDriver","performAnimation","setValue","parallel","start","scaleInterpolation","interpolate","inputRange","outputRange","deselectCustomGradient","width","Dimensions","get","isVisible","getColorGradientName","value","fallbackName","sprintf","foundColorName","find","name","onColorPress","onContentSizeChange","setTimeout","scrollToEnd","clearTimeout","onCustomIndicatorLayout","nativeEvent","layout","onScroll","contentOffset","verticalSeparatorStyle","usePreferredColorSchemeStyle","styles","verticalSeparator","verticalSeparatorDark","customTextStyle","customTextAndroid","customTextDark","customIndicatorWrapperStyle","customIndicatorWrapper","jsxs","Fragment","children","jsx","Text","accessibilityRole","style","headerText","ScrollView","contentContainerStyle","contentContainer","horizontal","showsHorizontalScrollIndicator","keyboardShouldPersistTaps","disableScrollViewPanResponder","scrollEventThrottle","onScrollBeginDrag","onScrollEndDrag","ref","testID","scaleValue","colorName","View","TouchableWithoutFeedback","onPress","accessibilityState","selected","accessibilityLabel","transform","default","colorIndicator","onLayout","withCustomPicker","toUpperCase","_default","exports"],"sources":["@wordpress/components/src/color-palette/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tScrollView,\n\tTouchableWithoutFeedback,\n\tView,\n\tAnimated,\n\tEasing,\n\tDimensions,\n\tPlatform,\n\tText,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport ColorIndicator from '../color-indicator';\nimport { colorsUtils } from '../mobile/color-settings/utils';\n\nconst ANIMATION_DURATION = 200;\n\nlet contentWidth = 0;\nlet scrollPosition = 0;\nlet customIndicatorWidth = 0;\n\nfunction ColorPalette( {\n\tenableCustomColor = false,\n\tsetColor,\n\tactiveColor,\n\tisGradientColor,\n\tdefaultSettings,\n\tcurrentSegment,\n\tonCustomPress,\n\tshouldEnableBottomSheetScroll,\n\tshouldShowCustomIndicatorOption = true,\n\tshouldShowCustomLabel = true,\n\tshouldShowCustomVerticalSeparator = true,\n\tcustomColorIndicatorStyles,\n\tcustomIndicatorWrapperStyles,\n\tlabel,\n} ) {\n\tconst customSwatchGradients = [\n\t\t'linear-gradient(120deg, rgba(255,0,0,.8) 0%, rgba(255,255,255,1) 70.71%)',\n\t\t'linear-gradient(240deg, rgba(0,255,0,.8) 0%, rgba(0,255,0,0) 70.71%)',\n\t\t'linear-gradient(360deg, rgba(0,0,255,.8) 0%, rgba(0,0,255,0) 70.71%)',\n\t];\n\n\tconst scrollViewRef = useRef();\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst isGradientSegment = currentSegment === colorsUtils.segments[ 1 ];\n\n\tconst scale = useRef( new Animated.Value( 1 ) ).current;\n\tconst opacity = useRef( new Animated.Value( 1 ) ).current;\n\tconst delayedScrollRef = useRef();\n\n\tconst mergedColors = [\n\t\t...new Set(\n\t\t\t( defaultSettings.colors ?? [] ).map( ( { color } ) => color )\n\t\t),\n\t];\n\tconst mergedGradients = [\n\t\t...new Set(\n\t\t\t( defaultSettings.gradients ?? [] ).map(\n\t\t\t\t( { gradient } ) => gradient\n\t\t\t)\n\t\t),\n\t];\n\tconst allAvailableColors = [\n\t\t...new Set(\n\t\t\t( defaultSettings.allColors ?? [] ).map( ( { color } ) => color )\n\t\t),\n\t];\n\tconst allAvailableGradients = [\n\t\t...new Set(\n\t\t\t( defaultSettings.allGradients ?? [] ).map(\n\t\t\t\t( { gradient } ) => gradient\n\t\t\t)\n\t\t),\n\t];\n\n\tconst colors = isGradientSegment ? mergedGradients : mergedColors;\n\tconst allColors = isGradientSegment\n\t\t? allAvailableGradients\n\t\t: allAvailableColors;\n\n\tconst customIndicatorColor = isGradientSegment\n\t\t? activeColor\n\t\t: customSwatchGradients;\n\tconst isCustomGradientColor = isGradientColor && isSelectedCustom();\n\tconst shouldShowCustomIndicator =\n\t\tenableCustomColor &&\n\t\tshouldShowCustomIndicatorOption &&\n\t\t( ! isGradientSegment || isCustomGradientColor );\n\n\tconst accessibilityHint = isGradientSegment\n\t\t? __( 'Navigates to customize the gradient' )\n\t\t: __( 'Navigates to custom color picker' );\n\tconst customText = __( 'Custom' );\n\n\tuseEffect( () => {\n\t\tif ( scrollViewRef.current ) {\n\t\t\tif ( isSelectedCustom() ) {\n\t\t\t\tscrollToEndWithDelay();\n\t\t\t} else {\n\t\t\t\tscrollViewRef.current.scrollTo( { x: 0, y: 0 } );\n\t\t\t}\n\t\t}\n\t\t// Not adding additional dependencies until the component can be refactored and updated safely.\n\t\t// Please see https://github.com/WordPress/gutenberg/pull/41253 for discussion and details.\n\t}, [ currentSegment ] );\n\n\tfunction isSelectedCustom() {\n\t\tconst isWithinColors =\n\t\t\tactiveColor && allColors?.includes( activeColor );\n\t\tif ( enableCustomColor && activeColor ) {\n\t\t\tif ( isGradientSegment ) {\n\t\t\t\treturn isGradientColor && ! isWithinColors;\n\t\t\t}\n\t\t\treturn ! isGradientColor && ! isWithinColors;\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction isSelected( color ) {\n\t\treturn ! isSelectedCustom() && activeColor === color;\n\t}\n\n\tfunction timingAnimation( property, toValue ) {\n\t\treturn Animated.timing( property, {\n\t\t\ttoValue,\n\t\t\tduration: ANIMATION_DURATION,\n\t\t\teasing: Easing.ease,\n\t\t\tuseNativeDriver: true,\n\t\t} );\n\t}\n\n\tfunction performAnimation( color ) {\n\t\tif ( ! isSelected( color ) ) {\n\t\t\topacity.setValue( 0 );\n\t\t}\n\n\t\tAnimated.parallel( [\n\t\t\ttimingAnimation( scale, 2 ),\n\t\t\ttimingAnimation( opacity, 1 ),\n\t\t] ).start( () => {\n\t\t\topacity.setValue( 1 );\n\t\t\tscale.setValue( 1 );\n\t\t} );\n\t}\n\n\tconst scaleInterpolation = scale.interpolate( {\n\t\tinputRange: [ 1, 1.5, 2 ],\n\t\toutputRange: [ 1, 0.7, 1 ],\n\t} );\n\n\tfunction deselectCustomGradient() {\n\t\tconst { width } = Dimensions.get( 'window' );\n\t\tconst isVisible =\n\t\t\tcontentWidth - scrollPosition - customIndicatorWidth < width;\n\n\t\tif ( isCustomGradientColor ) {\n\t\t\tif ( ! isIOS ) {\n\t\t\t\t// Scroll position on Android doesn't adjust automatically when removing the last item from the horizontal list.\n\t\t\t\t// https://github.com/facebook/react-native/issues/27504\n\t\t\t\t// Workaround: Force the scroll when deselecting custom gradient color and when custom indicator is visible on layout.\n\t\t\t\tif (\n\t\t\t\t\tisCustomGradientColor &&\n\t\t\t\t\tisVisible &&\n\t\t\t\t\tscrollViewRef.current\n\t\t\t\t) {\n\t\t\t\t\tscrollViewRef.current.scrollTo( {\n\t\t\t\t\t\tx: scrollPosition - customIndicatorWidth,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction getColorGradientName( value ) {\n\t\tconst fallbackName = sprintf(\n\t\t\t/* translators: %s: the hex color value */\n\t\t\t__( 'Unlabeled color. %s' ),\n\t\t\tvalue\n\t\t);\n\t\tconst foundColorName = isGradientSegment\n\t\t\t? defaultSettings.gradients?.find(\n\t\t\t\t\t( gradient ) => gradient.gradient === value\n\t\t\t )\n\t\t\t: defaultSettings.allColors?.find(\n\t\t\t\t\t( color ) => color.color === value\n\t\t\t );\n\t\treturn foundColorName ? foundColorName?.name : fallbackName;\n\t}\n\n\tfunction onColorPress( color ) {\n\t\tdeselectCustomGradient();\n\t\tperformAnimation( color );\n\t\tsetColor( color );\n\t}\n\n\tfunction onContentSizeChange( width ) {\n\t\tcontentWidth = width;\n\t\tif ( isSelectedCustom() && scrollViewRef.current ) {\n\t\t\tscrollToEndWithDelay();\n\t\t}\n\t}\n\n\tfunction scrollToEndWithDelay() {\n\t\tdelayedScrollRef.current = setTimeout( () => {\n\t\t\tscrollViewRef?.current.scrollToEnd();\n\t\t}, ANIMATION_DURATION );\n\t\treturn () => {\n\t\t\tclearTimeout( delayedScrollRef.current );\n\t\t};\n\t}\n\n\tfunction onCustomIndicatorLayout( { nativeEvent } ) {\n\t\tconst { width } = nativeEvent.layout;\n\t\tif ( width !== customIndicatorWidth ) {\n\t\t\tcustomIndicatorWidth = width;\n\t\t}\n\t}\n\n\tfunction onScroll( { nativeEvent } ) {\n\t\tscrollPosition = nativeEvent.contentOffset.x;\n\t}\n\n\tconst verticalSeparatorStyle = usePreferredColorSchemeStyle(\n\t\tstyles.verticalSeparator,\n\t\tstyles.verticalSeparatorDark\n\t);\n\n\tconst customTextStyle = usePreferredColorSchemeStyle(\n\t\t[ styles.customText, ! isIOS && styles.customTextAndroid ],\n\t\tstyles.customTextDark\n\t);\n\n\tconst customIndicatorWrapperStyle = [\n\t\tstyles.customIndicatorWrapper,\n\t\tcustomIndicatorWrapperStyles,\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t{ label && (\n\t\t\t\t<Text accessibilityRole=\"header\" style={ styles.headerText }>\n\t\t\t\t\t{ label }\n\t\t\t\t</Text>\n\t\t\t) }\n\n\t\t\t<ScrollView\n\t\t\t\tcontentContainerStyle={ styles.contentContainer }\n\t\t\t\thorizontal\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\tdisableScrollViewPanResponder\n\t\t\t\tscrollEventThrottle={ 16 }\n\t\t\t\tonScroll={ onScroll }\n\t\t\t\tonContentSizeChange={ onContentSizeChange }\n\t\t\t\tonScrollBeginDrag={ () =>\n\t\t\t\t\tshouldEnableBottomSheetScroll( false )\n\t\t\t\t}\n\t\t\t\tonScrollEndDrag={ () => shouldEnableBottomSheetScroll( true ) }\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\ttestID={ `color-palette${ label ? '-' + label : '' }` }\n\t\t\t>\n\t\t\t\t{ colors.map( ( color ) => {\n\t\t\t\t\tconst scaleValue = isSelected( color )\n\t\t\t\t\t\t? scaleInterpolation\n\t\t\t\t\t\t: 1;\n\t\t\t\t\tconst colorName = getColorGradientName( color );\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<View key={ `${ color }-${ isSelected( color ) }` }>\n\t\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\t\tonPress={ () => onColorPress( color ) }\n\t\t\t\t\t\t\t\taccessibilityRole=\"button\"\n\t\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\t\tselected: isSelected( color ),\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\taccessibilityHint={ color }\n\t\t\t\t\t\t\t\taccessibilityLabel={ colorName }\n\t\t\t\t\t\t\t\ttestID={ color }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Animated.View\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\ttransform: [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tscale: scaleValue,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\tisSelected={ isSelected( color ) }\n\t\t\t\t\t\t\t\t\t\topacity={ opacity }\n\t\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\t\tstyles.colorIndicator,\n\t\t\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles,\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</Animated.View>\n\t\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ shouldShowCustomIndicator && (\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ customIndicatorWrapperStyle }\n\t\t\t\t\t\tonLayout={ onCustomIndicatorLayout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ shouldShowCustomVerticalSeparator && (\n\t\t\t\t\t\t\t<View style={ verticalSeparatorStyle } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\tonPress={ onCustomPress }\n\t\t\t\t\t\t\taccessibilityRole=\"button\"\n\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\tselected: isSelectedCustom(),\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<View style={ customIndicatorWrapperStyle }>\n\t\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\twithCustomPicker={ ! isGradientSegment }\n\t\t\t\t\t\t\t\t\tcolor={ customIndicatorColor }\n\t\t\t\t\t\t\t\t\tisSelected={ isSelectedCustom() }\n\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\tstyles.colorIndicator,\n\t\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles,\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{ shouldShowCustomLabel && (\n\t\t\t\t\t\t\t\t\t<Text style={ customTextStyle }>\n\t\t\t\t\t\t\t\t\t\t{ isIOS\n\t\t\t\t\t\t\t\t\t\t\t? customText\n\t\t\t\t\t\t\t\t\t\t\t: customText.toUpperCase() }\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\t\t\t</ScrollView>\n\t\t</>\n\t);\n}\n\nexport default ColorPalette;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAcA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA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GAAA,EAAC/H,YAAA,CAAAkJ,IAAI;UAAChB,KAAK,EAAGhB;QAAwB,CAAE,CACxC,eACD,IAAAzG,WAAA,CAAAsH,GAAA,EAAC/H,YAAA,CAAAmJ,wBAAwB;UACxBC,OAAO,EAAG/H,aAAe;UACzB4G,iBAAiB,EAAC,QAAQ;UAC1BoB,kBAAkB,EAAG;YACpBC,QAAQ,EAAExF,gBAAgB,CAAC;UAC5B,CAAG;UACHE,iBAAiB,EAAGA,iBAAmB;UAAA8D,QAAA,eAEvC,IAAArH,WAAA,CAAAmH,IAAA,EAAC5H,YAAA,CAAAkJ,IAAI;YAAChB,KAAK,EAAGR,2BAA6B;YAAAI,QAAA,gBAC1C,IAAArH,WAAA,CAAAsH,GAAA,EAACxH,eAAA,CAAAkJ,OAAc;cACdG,gBAAgB,EAAG,CAAErH,iBAAmB;cACxCa,KAAK,EAAGQ,oBAAsB;cAC9Bc,UAAU,EAAGZ,gBAAgB,CAAC,CAAG;cACjCoE,KAAK,EAAG,CACPd,cAAM,CAACsC,cAAc,EACrBhI,0BAA0B;YACxB,CACH,CAAC,EACAF,qBAAqB,iBACtB,IAAAf,WAAA,CAAAsH,GAAA,EAAC/H,YAAA,CAAAgI,IAAI;cAACE,KAAK,EAAGX,eAAiB;cAAAO,QAAA,EAC5B1F,KAAK,GACJ8B,UAAU,GACVA,UAAU,CAAC2F,WAAW,CAAC;YAAC,CACtB,CACN;UAAA,CACI;QAAC,CACkB,CAAC;MAAA,CACtB,CACN;IAAA,CACU,CAAC;EAAA,CACZ,CAAC;AAEL;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEc3I,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_i18n","_element","_compose","_style","_interopRequireDefault","_colorIndicator","_utils","_jsxRuntime","ANIMATION_DURATION","contentWidth","scrollPosition","customIndicatorWidth","ColorPalette","enableCustomColor","setColor","activeColor","isGradientColor","defaultSettings","currentSegment","onCustomPress","shouldEnableBottomSheetScroll","shouldShowCustomIndicatorOption","shouldShowCustomLabel","shouldShowCustomVerticalSeparator","customColorIndicatorStyles","customIndicatorWrapperStyles","label","_defaultSettings$colo","_defaultSettings$grad","_defaultSettings$allC","_defaultSettings$allG","customSwatchGradients","scrollViewRef","useRef","isIOS","Platform","OS","isGradientSegment","colorsUtils","segments","scale","Animated","Value","current","opacity","delayedScrollRef","mergedColors","Set","colors","map","color","mergedGradients","gradients","gradient","allAvailableColors","allColors","allAvailableGradients","allGradients","customIndicatorColor","isCustomGradientColor","isSelectedCustom","shouldShowCustomIndicator","accessibilityHint","__","customText","useEffect","scrollToEndWithDelay","scrollTo","x","y","isWithinColors","includes","isSelected","timingAnimation","property","toValue","timing","duration","easing","Easing","ease","useNativeDriver","performAnimation","setValue","parallel","start","scaleInterpolation","interpolate","inputRange","outputRange","deselectCustomGradient","width","Dimensions","get","isVisible","getColorGradientName","value","fallbackName","sprintf","foundColorName","find","name","onColorPress","onContentSizeChange","setTimeout","scrollToEnd","clearTimeout","onCustomIndicatorLayout","nativeEvent","layout","onScroll","contentOffset","verticalSeparatorStyle","usePreferredColorSchemeStyle","styles","verticalSeparator","verticalSeparatorDark","customTextStyle","customTextAndroid","customTextDark","customIndicatorWrapperStyle","customIndicatorWrapper","jsxs","Fragment","children","jsx","Text","accessibilityRole","style","headerText","ScrollView","contentContainerStyle","contentContainer","horizontal","showsHorizontalScrollIndicator","keyboardShouldPersistTaps","disableScrollViewPanResponder","scrollEventThrottle","onScrollBeginDrag","onScrollEndDrag","ref","testID","scaleValue","colorName","View","TouchableWithoutFeedback","onPress","accessibilityState","selected","accessibilityLabel","transform","default","colorIndicator","onLayout","withCustomPicker","toUpperCase","_default","exports"],"sources":["@wordpress/components/src/color-palette/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tScrollView,\n\tTouchableWithoutFeedback,\n\tView,\n\tAnimated,\n\tEasing,\n\tDimensions,\n\tPlatform,\n\tText,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport ColorIndicator from '../color-indicator';\nimport { colorsUtils } from '../mobile/color-settings/utils';\n\nconst ANIMATION_DURATION = 200;\n\nlet contentWidth = 0;\nlet scrollPosition = 0;\nlet customIndicatorWidth = 0;\n\nfunction ColorPalette( {\n\tenableCustomColor = false,\n\tsetColor,\n\tactiveColor,\n\tisGradientColor,\n\tdefaultSettings,\n\tcurrentSegment,\n\tonCustomPress,\n\tshouldEnableBottomSheetScroll,\n\tshouldShowCustomIndicatorOption = true,\n\tshouldShowCustomLabel = true,\n\tshouldShowCustomVerticalSeparator = true,\n\tcustomColorIndicatorStyles,\n\tcustomIndicatorWrapperStyles,\n\tlabel,\n} ) {\n\tconst customSwatchGradients = [\n\t\t'linear-gradient(120deg, rgba(255,0,0,.8) 0%, rgba(255,255,255,1) 70.71%)',\n\t\t'linear-gradient(240deg, rgba(0,255,0,.8) 0%, rgba(0,255,0,0) 70.71%)',\n\t\t'linear-gradient(360deg, rgba(0,0,255,.8) 0%, rgba(0,0,255,0) 70.71%)',\n\t];\n\n\tconst scrollViewRef = useRef();\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst isGradientSegment = currentSegment === colorsUtils.segments[ 1 ];\n\n\tconst scale = useRef( new Animated.Value( 1 ) ).current;\n\tconst opacity = useRef( new Animated.Value( 1 ) ).current;\n\tconst delayedScrollRef = useRef();\n\n\tconst mergedColors = [\n\t\t...new Set(\n\t\t\t( defaultSettings.colors ?? [] ).map( ( { color } ) => color )\n\t\t),\n\t];\n\tconst mergedGradients = [\n\t\t...new Set(\n\t\t\t( defaultSettings.gradients ?? [] ).map(\n\t\t\t\t( { gradient } ) => gradient\n\t\t\t)\n\t\t),\n\t];\n\tconst allAvailableColors = [\n\t\t...new Set(\n\t\t\t( defaultSettings.allColors ?? [] ).map( ( { color } ) => color )\n\t\t),\n\t];\n\tconst allAvailableGradients = [\n\t\t...new Set(\n\t\t\t( defaultSettings.allGradients ?? [] ).map(\n\t\t\t\t( { gradient } ) => gradient\n\t\t\t)\n\t\t),\n\t];\n\n\tconst colors = isGradientSegment ? mergedGradients : mergedColors;\n\tconst allColors = isGradientSegment\n\t\t? allAvailableGradients\n\t\t: allAvailableColors;\n\n\tconst customIndicatorColor = isGradientSegment\n\t\t? activeColor\n\t\t: customSwatchGradients;\n\tconst isCustomGradientColor = isGradientColor && isSelectedCustom();\n\tconst shouldShowCustomIndicator =\n\t\tenableCustomColor &&\n\t\tshouldShowCustomIndicatorOption &&\n\t\t( ! isGradientSegment || isCustomGradientColor );\n\n\tconst accessibilityHint = isGradientSegment\n\t\t? __( 'Navigates to customize the gradient' )\n\t\t: __( 'Navigates to custom color picker' );\n\tconst customText = __( 'Custom' );\n\n\tuseEffect( () => {\n\t\tif ( scrollViewRef.current ) {\n\t\t\tif ( isSelectedCustom() ) {\n\t\t\t\tscrollToEndWithDelay();\n\t\t\t} else {\n\t\t\t\tscrollViewRef.current.scrollTo( { x: 0, y: 0 } );\n\t\t\t}\n\t\t}\n\t\t// Not adding additional dependencies until the component can be refactored and updated safely.\n\t\t// Please see https://github.com/WordPress/gutenberg/pull/41253 for discussion and details.\n\t}, [ currentSegment ] );\n\n\tfunction isSelectedCustom() {\n\t\tconst isWithinColors =\n\t\t\tactiveColor && allColors?.includes( activeColor );\n\t\tif ( enableCustomColor && activeColor ) {\n\t\t\tif ( isGradientSegment ) {\n\t\t\t\treturn isGradientColor && ! isWithinColors;\n\t\t\t}\n\t\t\treturn ! isGradientColor && ! isWithinColors;\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction isSelected( color ) {\n\t\treturn ! isSelectedCustom() && activeColor === color;\n\t}\n\n\tfunction timingAnimation( property, toValue ) {\n\t\treturn Animated.timing( property, {\n\t\t\ttoValue,\n\t\t\tduration: ANIMATION_DURATION,\n\t\t\teasing: Easing.ease,\n\t\t\tuseNativeDriver: true,\n\t\t} );\n\t}\n\n\tfunction performAnimation( color ) {\n\t\tif ( ! isSelected( color ) ) {\n\t\t\topacity.setValue( 0 );\n\t\t}\n\n\t\tAnimated.parallel( [\n\t\t\ttimingAnimation( scale, 2 ),\n\t\t\ttimingAnimation( opacity, 1 ),\n\t\t] ).start( () => {\n\t\t\topacity.setValue( 1 );\n\t\t\tscale.setValue( 1 );\n\t\t} );\n\t}\n\n\tconst scaleInterpolation = scale.interpolate( {\n\t\tinputRange: [ 1, 1.5, 2 ],\n\t\toutputRange: [ 1, 0.7, 1 ],\n\t} );\n\n\tfunction deselectCustomGradient() {\n\t\tconst { width } = Dimensions.get( 'window' );\n\t\tconst isVisible =\n\t\t\tcontentWidth - scrollPosition - customIndicatorWidth < width;\n\n\t\tif ( isCustomGradientColor ) {\n\t\t\tif ( ! isIOS ) {\n\t\t\t\t// Scroll position on Android doesn't adjust automatically when removing the last item from the horizontal list.\n\t\t\t\t// https://github.com/facebook/react-native/issues/27504\n\t\t\t\t// Workaround: Force the scroll when deselecting custom gradient color and when custom indicator is visible on layout.\n\t\t\t\tif (\n\t\t\t\t\tisCustomGradientColor &&\n\t\t\t\t\tisVisible &&\n\t\t\t\t\tscrollViewRef.current\n\t\t\t\t) {\n\t\t\t\t\tscrollViewRef.current.scrollTo( {\n\t\t\t\t\t\tx: scrollPosition - customIndicatorWidth,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction getColorGradientName( value ) {\n\t\tconst fallbackName = sprintf(\n\t\t\t/* translators: %s: the hex color value */\n\t\t\t__( 'Unlabeled color. %s' ),\n\t\t\tvalue\n\t\t);\n\t\tconst foundColorName = isGradientSegment\n\t\t\t? defaultSettings.gradients?.find(\n\t\t\t\t\t( gradient ) => gradient.gradient === value\n\t\t\t )\n\t\t\t: defaultSettings.allColors?.find(\n\t\t\t\t\t( color ) => color.color === value\n\t\t\t );\n\t\treturn foundColorName ? foundColorName?.name : fallbackName;\n\t}\n\n\tfunction onColorPress( color ) {\n\t\tdeselectCustomGradient();\n\t\tperformAnimation( color );\n\t\tsetColor( color );\n\t}\n\n\tfunction onContentSizeChange( width ) {\n\t\tcontentWidth = width;\n\t\tif ( isSelectedCustom() && scrollViewRef.current ) {\n\t\t\tscrollToEndWithDelay();\n\t\t}\n\t}\n\n\tfunction scrollToEndWithDelay() {\n\t\tdelayedScrollRef.current = setTimeout( () => {\n\t\t\tscrollViewRef?.current.scrollToEnd();\n\t\t}, ANIMATION_DURATION );\n\t\treturn () => {\n\t\t\tclearTimeout( delayedScrollRef.current );\n\t\t};\n\t}\n\n\tfunction onCustomIndicatorLayout( { nativeEvent } ) {\n\t\tconst { width } = nativeEvent.layout;\n\t\tif ( width !== customIndicatorWidth ) {\n\t\t\tcustomIndicatorWidth = width;\n\t\t}\n\t}\n\n\tfunction onScroll( { nativeEvent } ) {\n\t\tscrollPosition = nativeEvent.contentOffset.x;\n\t}\n\n\tconst verticalSeparatorStyle = usePreferredColorSchemeStyle(\n\t\tstyles.verticalSeparator,\n\t\tstyles.verticalSeparatorDark\n\t);\n\n\tconst customTextStyle = usePreferredColorSchemeStyle(\n\t\t[ styles.customText, ! isIOS && styles.customTextAndroid ],\n\t\tstyles.customTextDark\n\t);\n\n\tconst customIndicatorWrapperStyle = [\n\t\tstyles.customIndicatorWrapper,\n\t\tcustomIndicatorWrapperStyles,\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t{ label && (\n\t\t\t\t<Text accessibilityRole=\"header\" style={ styles.headerText }>\n\t\t\t\t\t{ label }\n\t\t\t\t</Text>\n\t\t\t) }\n\n\t\t\t<ScrollView\n\t\t\t\tcontentContainerStyle={ styles.contentContainer }\n\t\t\t\thorizontal\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\tdisableScrollViewPanResponder\n\t\t\t\tscrollEventThrottle={ 16 }\n\t\t\t\tonScroll={ onScroll }\n\t\t\t\tonContentSizeChange={ onContentSizeChange }\n\t\t\t\tonScrollBeginDrag={ () =>\n\t\t\t\t\tshouldEnableBottomSheetScroll( false )\n\t\t\t\t}\n\t\t\t\tonScrollEndDrag={ () => shouldEnableBottomSheetScroll( true ) }\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\ttestID={ `color-palette${ label ? '-' + label : '' }` }\n\t\t\t>\n\t\t\t\t{ colors.map( ( color ) => {\n\t\t\t\t\tconst scaleValue = isSelected( color )\n\t\t\t\t\t\t? scaleInterpolation\n\t\t\t\t\t\t: 1;\n\t\t\t\t\tconst colorName = getColorGradientName( color );\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<View key={ `${ color }-${ isSelected( color ) }` }>\n\t\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\t\tonPress={ () => onColorPress( color ) }\n\t\t\t\t\t\t\t\taccessibilityRole=\"button\"\n\t\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\t\tselected: isSelected( color ),\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\taccessibilityHint={ color }\n\t\t\t\t\t\t\t\taccessibilityLabel={ colorName }\n\t\t\t\t\t\t\t\ttestID={ color }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Animated.View\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\ttransform: [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tscale: scaleValue,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\tisSelected={ isSelected( color ) }\n\t\t\t\t\t\t\t\t\t\topacity={ opacity }\n\t\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\t\tstyles.colorIndicator,\n\t\t\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles,\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</Animated.View>\n\t\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ shouldShowCustomIndicator && (\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ customIndicatorWrapperStyle }\n\t\t\t\t\t\tonLayout={ onCustomIndicatorLayout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ shouldShowCustomVerticalSeparator && (\n\t\t\t\t\t\t\t<View style={ verticalSeparatorStyle } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\tonPress={ onCustomPress }\n\t\t\t\t\t\t\taccessibilityRole=\"button\"\n\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\tselected: isSelectedCustom(),\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<View style={ customIndicatorWrapperStyle }>\n\t\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\twithCustomPicker={ ! isGradientSegment }\n\t\t\t\t\t\t\t\t\tcolor={ customIndicatorColor }\n\t\t\t\t\t\t\t\t\tisSelected={ isSelectedCustom() }\n\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\tstyles.colorIndicator,\n\t\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles,\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{ shouldShowCustomLabel && (\n\t\t\t\t\t\t\t\t\t<Text style={ customTextStyle }>\n\t\t\t\t\t\t\t\t\t\t{ isIOS\n\t\t\t\t\t\t\t\t\t\t\t? customText\n\t\t\t\t\t\t\t\t\t\t\t: customText.toUpperCase() }\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\t\t\t</ScrollView>\n\t\t</>\n\t);\n}\n\nexport default ColorPalette;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAcA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,eAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAA6D,IAAAQ,WAAA,GAAAR,OAAA;AA1B7D;AACA;AACA;;AAYA;AACA;AACA;;AAKA;AACA;AACA;;AAKA,MAAMS,kBAAkB,GAAG,GAAG;AAE9B,IAAIC,YAAY,GAAG,CAAC;AACpB,IAAIC,cAAc,GAAG,CAAC;AACtB,IAAIC,oBAAoB,GAAG,CAAC;AAE5B,SAASC,YAAYA,CAAE;EACtBC,iBAAiB,GAAG,KAAK;EACzBC,QAAQ;EACRC,WAAW;EACXC,eAAe;EACfC,eAAe;EACfC,cAAc;EACdC,aAAa;EACbC,6BAA6B;EAC7BC,+BAA+B,GAAG,IAAI;EACtCC,qBAAqB,GAAG,IAAI;EAC5BC,iCAAiC,GAAG,IAAI;EACxCC,0BAA0B;EAC1BC,4BAA4B;EAC5BC;AACD,CAAC,EAAG;EAAA,IAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;EACH,MAAMC,qBAAqB,GAAG,CAC7B,0EAA0E,EAC1E,sEAAsE,EACtE,sEAAsE,CACtE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,EAC5B1F,KAAK,GACJ8B,UAAU,GACVA,UAAU,CAAC2F,WAAW,CAAC;YAAC,CACtB,CACN;UAAA,CACI;QAAC,CACkB,CAAC;MAAA,CACtB,CACN;IAAA,CACU,CAAC;EAAA,CACZ,CAAC;AAEL;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEc3I,YAAY","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_colord","require","_names","_interopRequireDefault","_a11y","_i18n","extend","namesPlugin","a11yPlugin","isSimpleCSSColor","value","valueIsCssVariable","test","valueIsColorMix","extractColorNameFromCurrentValue","currentValue","colors","showMultiplePalettes","currentValueIsSimpleColor","normalizedCurrentValue","colord","toHex","colorPalettes","paletteColors","name","colorName","color","colorValue","normalizedColorValue","__","exports","isMultiplePaletteObject","obj","Array","isArray","isMultiplePaletteArray","arr","length","every","colorObj","normalizeColorValue","element","ownerDocument","defaultView","computedBackgroundColor","getComputedStyle","backgroundColor"],"sources":["@wordpress/components/src/color-palette/utils.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { ColorObject, ColorPaletteProps, PaletteObject } from './types';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\n/**\n * Checks if a color value is a simple CSS color.\n *\n * @param value The color value to check.\n * @return A boolean indicating whether the color value is a simple CSS color.\n */\nconst isSimpleCSSColor = ( value: string ): boolean => {\n\tconst valueIsCssVariable = /var\\(/.test( value ?? '' );\n\tconst valueIsColorMix = /color-mix\\(/.test( value ?? '' );\n\treturn ! valueIsCssVariable && ! valueIsColorMix;\n};\n\nexport const extractColorNameFromCurrentValue = (\n\tcurrentValue?: ColorPaletteProps[ 'value' ],\n\tcolors: ColorPaletteProps[ 'colors' ] = [],\n\tshowMultiplePalettes: boolean = false\n) => {\n\tif ( ! currentValue ) {\n\t\treturn '';\n\t}\n\tconst currentValueIsSimpleColor = currentValue\n\t\t? isSimpleCSSColor( currentValue )\n\t\t: false;\n\tconst normalizedCurrentValue = currentValueIsSimpleColor\n\t\t? colord( currentValue ).toHex()\n\t\t: currentValue;\n\n\t// Normalize format of `colors` to simplify the following loop\n\ttype normalizedPaletteObject = { colors: ColorObject[] };\n\tconst colorPalettes: normalizedPaletteObject[] = showMultiplePalettes\n\t\t? ( colors as PaletteObject[] )\n\t\t: [ { colors: colors as ColorObject[] } ];\n\tfor ( const { colors: paletteColors } of colorPalettes ) {\n\t\tfor ( const { name: colorName, color: colorValue } of paletteColors ) {\n\t\t\tconst normalizedColorValue = currentValueIsSimpleColor\n\t\t\t\t? colord( colorValue ).toHex()\n\t\t\t\t: colorValue;\n\n\t\t\tif ( normalizedCurrentValue === normalizedColorValue ) {\n\t\t\t\treturn colorName;\n\t\t\t}\n\t\t}\n\t}\n\n\t// translators: shown when the user has picked a custom color (i.e not in the palette of colors).\n\treturn __( 'Custom' );\n};\n\n// The PaletteObject type has a `colors` property (an array of ColorObject),\n// while the ColorObject type has a `color` property (the CSS color value).\nexport const isMultiplePaletteObject = (\n\tobj: PaletteObject | ColorObject\n): obj is PaletteObject =>\n\tArray.isArray( ( obj as PaletteObject ).colors ) && ! ( 'color' in obj );\n\nexport const isMultiplePaletteArray = (\n\tarr: ( PaletteObject | ColorObject )[]\n): arr is PaletteObject[] => {\n\treturn (\n\t\tarr.length > 0 &&\n\t\tarr.every( ( colorObj ) => isMultiplePaletteObject( colorObj ) )\n\t);\n};\n\n/**\n * Transform a CSS variable used as background color into the color value itself.\n *\n * @param value The color value that may be a CSS variable.\n * @param element The element for which to get the computed style.\n * @return The background color value computed from a element.\n */\nexport const normalizeColorValue = (\n\tvalue: string | undefined,\n\telement: HTMLElement | null\n) => {\n\tif ( ! value || ! element || isSimpleCSSColor( value ) ) {\n\t\treturn value;\n\t}\n\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tconst computedBackgroundColor =\n\t\tdefaultView?.getComputedStyle( element ).backgroundColor;\n\n\treturn computedBackgroundColor\n\t\t? colord( computedBackgroundColor ).toHex()\n\t\t: value;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAKA,IAAAI,KAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,IAAAK,cAAM,EAAE,CAAEC,cAAW,EAAEC,aAAU,CAAG,CAAC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAKC,KAAa,IAAe;EACtD,MAAMC,kBAAkB,GAAG,OAAO,CAACC,IAAI,CAAEF,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAG,CAAC;EACtD,MAAMG,eAAe,GAAG,aAAa,CAACD,IAAI,CAAEF,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAG,CAAC;EACzD,OAAO,CAAEC,kBAAkB,IAAI,CAAEE,eAAe;AACjD,CAAC;AAEM,MAAMC,gCAAgC,GAAGA,CAC/CC,YAA2C,EAC3CC,MAAqC,GAAG,EAAE,EAC1CC,oBAA6B,GAAG,KAAK,KACjC;EACJ,IAAK,CAAEF,YAAY,EAAG;IACrB,OAAO,EAAE;EACV;EACA,MAAMG,yBAAyB,GAAGH,YAAY,GAC3CN,gBAAgB,CAAEM,YAAa,CAAC,GAChC,KAAK;EACR,MAAMI,sBAAsB,GAAGD,yBAAyB,GACrD,IAAAE,cAAM,EAAEL,YAAa,CAAC,CAACM,KAAK,CAAC,CAAC,GAC9BN,YA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GD,OAAO;EACjC,MAAM;IAAEE;EAAY,CAAC,GAAGD,aAAa;EACrC,MAAME,uBAAuB,GAC5BD,WAAW,EAAEE,gBAAgB,CAAEJ,OAAQ,CAAC,CAACK,eAAe;EAEzD,OAAOF,uBAAuB,GAC3B,IAAAxB,cAAM,EAAEwB,uBAAwB,CAAC,CAACvB,KAAK,CAAC,CAAC,GACzCX,KAAK;AACT,CAAC;AAACoB,OAAA,CAAAU,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_colord","require","_names","_interopRequireDefault","_a11y","_i18n","extend","namesPlugin","a11yPlugin","isSimpleCSSColor","value","valueIsCssVariable","test","valueIsColorMix","extractColorNameFromCurrentValue","currentValue","colors","showMultiplePalettes","currentValueIsSimpleColor","normalizedCurrentValue","colord","toHex","colorPalettes","paletteColors","name","colorName","color","colorValue","normalizedColorValue","__","exports","isMultiplePaletteObject","obj","Array","isArray","isMultiplePaletteArray","arr","length","every","colorObj","normalizeColorValue","element","ownerDocument","defaultView","computedBackgroundColor","getComputedStyle","backgroundColor"],"sources":["@wordpress/components/src/color-palette/utils.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { ColorObject, ColorPaletteProps, PaletteObject } from './types';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\n/**\n * Checks if a color value is a simple CSS color.\n *\n * @param value The color value to check.\n * @return A boolean indicating whether the color value is a simple CSS color.\n */\nconst isSimpleCSSColor = ( value: string ): boolean => {\n\tconst valueIsCssVariable = /var\\(/.test( value ?? '' );\n\tconst valueIsColorMix = /color-mix\\(/.test( value ?? '' );\n\treturn ! valueIsCssVariable && ! valueIsColorMix;\n};\n\nexport const extractColorNameFromCurrentValue = (\n\tcurrentValue?: ColorPaletteProps[ 'value' ],\n\tcolors: ColorPaletteProps[ 'colors' ] = [],\n\tshowMultiplePalettes: boolean = false\n) => {\n\tif ( ! currentValue ) {\n\t\treturn '';\n\t}\n\tconst currentValueIsSimpleColor = currentValue\n\t\t? isSimpleCSSColor( currentValue )\n\t\t: false;\n\tconst normalizedCurrentValue = currentValueIsSimpleColor\n\t\t? colord( currentValue ).toHex()\n\t\t: currentValue;\n\n\t// Normalize format of `colors` to simplify the following loop\n\ttype normalizedPaletteObject = { colors: ColorObject[] };\n\tconst colorPalettes: normalizedPaletteObject[] = showMultiplePalettes\n\t\t? ( colors as PaletteObject[] )\n\t\t: [ { colors: colors as ColorObject[] } ];\n\tfor ( const { colors: paletteColors } of colorPalettes ) {\n\t\tfor ( const { name: colorName, color: colorValue } of paletteColors ) {\n\t\t\tconst normalizedColorValue = currentValueIsSimpleColor\n\t\t\t\t? colord( colorValue ).toHex()\n\t\t\t\t: colorValue;\n\n\t\t\tif ( normalizedCurrentValue === normalizedColorValue ) {\n\t\t\t\treturn colorName;\n\t\t\t}\n\t\t}\n\t}\n\n\t// translators: shown when the user has picked a custom color (i.e not in the palette of colors).\n\treturn __( 'Custom' );\n};\n\n// The PaletteObject type has a `colors` property (an array of ColorObject),\n// while the ColorObject type has a `color` property (the CSS color value).\nexport const isMultiplePaletteObject = (\n\tobj: PaletteObject | ColorObject\n): obj is PaletteObject =>\n\tArray.isArray( ( obj as PaletteObject ).colors ) && ! ( 'color' in obj );\n\nexport const isMultiplePaletteArray = (\n\tarr: ( PaletteObject | ColorObject )[]\n): arr is PaletteObject[] => {\n\treturn (\n\t\tarr.length > 0 &&\n\t\tarr.every( ( colorObj ) => isMultiplePaletteObject( colorObj ) )\n\t);\n};\n\n/**\n * Transform a CSS variable used as background color into the color value itself.\n *\n * @param value The color value that may be a CSS variable.\n * @param element The element for which to get the computed style.\n * @return The background color value computed from a element.\n */\nexport const normalizeColorValue = (\n\tvalue: string | undefined,\n\telement: HTMLElement | null\n) => {\n\tif ( ! value || ! element || isSimpleCSSColor( value ) ) {\n\t\treturn value;\n\t}\n\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tconst computedBackgroundColor =\n\t\tdefaultView?.getComputedStyle( element ).backgroundColor;\n\n\treturn computedBackgroundColor\n\t\t? colord( computedBackgroundColor ).toHex()\n\t\t: value;\n};\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAKA,IAAAI,KAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,IAAAK,cAAM,EAAE,CAAEC,cAAW,EAAEC,aAAU,CAAG,CAAC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAKC,KAAa,IAAe;EACtD,MAAMC,kBAAkB,GAAG,OAAO,CAACC,IAAI,CAAEF,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAG,CAAC;EACtD,MAAMG,eAAe,GAAG,aAAa,CAACD,IAAI,CAAEF,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAG,CAAC;EACzD,OAAO,CAAEC,kBAAkB,IAAI,CAAEE,eAAe;AACjD,CAAC;AAEM,MAAMC,gCAAgC,GAAGA,CAC/CC,YAA2C,EAC3CC,MAAqC,GAAG,EAAE,EAC1CC,oBAA6B,GAAG,KAAK,KACjC;EACJ,IAAK,CAAEF,YAAY,EAAG;IACrB,OAAO,EAAE;EACV;EACA,MAAMG,yBAAyB,GAAGH,YAAY,GAC3CN,gBAAgB,CAAEM,YAAa,CAAC,GAChC,KAAK;EACR,MAAMI,sBAAsB,GAAGD,yBAAyB,GACrD,IAAAE,cAAM,EAAEL,YAAa,CAAC,CAACM,KAAK,CAAC,CAAC,GAC9BN,YAAY;;EAEf;;EAEA,MAAMO,aAAwC,GAAGL,oBAAoB,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aAAa;EACrC,MAAME,uBAAuB,GAC5BD,WAAW,EAAEE,gBAAgB,CAAEJ,OAAQ,CAAC,CAACK,eAAe;EAEzD,OAAOF,uBAAuB,GAC3B,IAAAxB,cAAM,EAAEwB,uBAAwB,CAAC,CAACvB,KAAK,CAAC,CAAC,GACzCX,KAAK;AACT,CAAC;AAACoB,OAAA,CAAAU,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");