@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","_borderControlStylePicker","_interopRequireDefault","_button","_colorIndicator","_colorPalette","_dropdown","_vStack","_context","_hook","_dropdownContentWrapper","_utils","_jsxRuntime","getAriaLabelColorValue","colorValue","replace","getColorObject","colors","isMultiplePaletteArray","matchedColor","some","origin","color","find","getToggleAriaLabel","colorObject","style","isStyleEnabled","ariaLabelValue","sprintf","__","name","BorderControlDropdown","props","forwardedRef","__experimentalIsRenderedInSidebar","border","disableCustomColors","enableAlpha","enableStyle","indicatorClassName","indicatorWrapperClassName","isStyleSettable","onReset","onColorChange","onStyleChange","popoverContentClassName","popoverControlsClassName","resetButtonClassName","size","__unstablePopoverProps","otherProps","useBorderControlDropdown","toggleAriaLabel","showResetButton","dropdownPosition","undefined","renderToggle","onToggle","jsx","default","onClick","variant","tooltipPosition","label","showTooltip","__next40pxDefaultSize","children","className","renderContent","onClose","jsxs","Fragment","paddingSize","VStack","spacing","value","onChange","clearable","popoverProps","ref","ConnectedBorderControlDropdown","contextConnect","_default","exports"],"sources":["@wordpress/components/src/border-control/border-control-dropdown/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderControlStylePicker from '../border-control-style-picker';\nimport Button from '../../button';\nimport ColorIndicator from '../../color-indicator';\nimport ColorPalette from '../../color-palette';\nimport Dropdown from '../../dropdown';\nimport { VStack } from '../../v-stack';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { useBorderControlDropdown } from './hook';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\n\nimport type { ColorObject } from '../../color-palette/types';\nimport { isMultiplePaletteArray } from '../../color-palette/utils';\nimport type { DropdownProps as DropdownComponentProps } from '../../dropdown/types';\nimport type { ColorProps, DropdownProps } from '../types';\n\nconst getAriaLabelColorValue = ( colorValue: string ) => {\n\t// Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n\treturn colorValue.replace( /^var\\((.+)\\)$/, '$1' );\n};\n\nconst getColorObject = (\n\tcolorValue: CSSProperties[ 'borderColor' ],\n\tcolors: ColorProps[ 'colors' ] | undefined\n) => {\n\tif ( ! colorValue || ! colors ) {\n\t\treturn;\n\t}\n\n\tif ( isMultiplePaletteArray( colors ) ) {\n\t\t// Multiple origins\n\t\tlet matchedColor;\n\n\t\tcolors.some( ( origin ) =>\n\t\t\torigin.colors.some( ( color ) => {\n\t\t\t\tif ( color.color === colorValue ) {\n\t\t\t\t\tmatchedColor = color;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t} )\n\t\t);\n\n\t\treturn matchedColor;\n\t}\n\n\t// Single origin\n\treturn colors.find( ( color ) => color.color === colorValue );\n};\n\nconst getToggleAriaLabel = (\n\tcolorValue: CSSProperties[ 'borderColor' ],\n\tcolorObject: ColorObject | undefined,\n\tstyle: CSSProperties[ 'borderStyle' ],\n\tisStyleEnabled: boolean\n) => {\n\tif ( isStyleEnabled ) {\n\t\tif ( colorObject ) {\n\t\t\tconst ariaLabelValue = getAriaLabelColorValue( colorObject.color );\n\t\t\treturn style\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\". 3: The current border style selection e.g. \"solid\".\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\". The currently selected style is \"%3$s\".'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcolorObject.name,\n\t\t\t\t\t\tariaLabelValue,\n\t\t\t\t\t\tstyle\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\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\t\t__(\n\t\t\t\t\t\t\t'Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcolorObject.name,\n\t\t\t\t\t\tariaLabelValue\n\t\t\t\t );\n\t\t}\n\n\t\tif ( colorValue ) {\n\t\t\tconst ariaLabelValue = getAriaLabelColorValue( colorValue );\n\t\t\treturn style\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: 1: The color's hex code e.g.: \"#f00:\". 2: The current border style selection e.g. \"solid\".\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Border color and style picker. The currently selected color has a value of \"%1$s\". The currently selected style is \"%2$s\".'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tariaLabelValue,\n\t\t\t\t\t\tstyle\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: The color's hex code e.g: \"#f00\".\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Border color and style picker. The currently selected color has a value of \"%s\".'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tariaLabelValue\n\t\t\t\t );\n\t\t}\n\n\t\treturn __( 'Border color and style picker.' );\n\t}\n\n\tif ( colorObject ) {\n\t\treturn sprintf(\n\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__(\n\t\t\t\t'Border color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t),\n\t\t\tcolorObject.name,\n\t\t\tgetAriaLabelColorValue( colorObject.color )\n\t\t);\n\t}\n\n\tif ( colorValue ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: The color's hex code e.g: \"#f00\".\n\t\t\t__(\n\t\t\t\t'Border color picker. The currently selected color has a value of \"%s\".'\n\t\t\t),\n\t\t\tgetAriaLabelColorValue( colorValue )\n\t\t);\n\t}\n\n\treturn __( 'Border color picker.' );\n};\n\nconst BorderControlDropdown = (\n\tprops: WordPressComponentProps< DropdownProps, 'div' >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\t__experimentalIsRenderedInSidebar,\n\t\tborder,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\tindicatorClassName,\n\t\tindicatorWrapperClassName,\n\t\tisStyleSettable,\n\t\tonReset,\n\t\tonColorChange,\n\t\tonStyleChange,\n\t\tpopoverContentClassName,\n\t\tpopoverControlsClassName,\n\t\tresetButtonClassName,\n\t\tsize,\n\t\t__unstablePopoverProps,\n\t\t...otherProps\n\t} = useBorderControlDropdown( props );\n\n\tconst { color, style } = border || {};\n\tconst colorObject = getColorObject( color, colors );\n\n\tconst toggleAriaLabel = getToggleAriaLabel(\n\t\tcolor,\n\t\tcolorObject,\n\t\tstyle,\n\t\tenableStyle\n\t);\n\n\tconst showResetButton = color || ( style && style !== 'none' );\n\tconst dropdownPosition = __experimentalIsRenderedInSidebar\n\t\t? 'bottom left'\n\t\t: undefined;\n\n\tconst renderToggle: DropdownComponentProps[ 'renderToggle' ] = ( {\n\t\tonToggle,\n\t} ) => (\n\t\t<Button\n\t\t\tonClick={ onToggle }\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-label={ toggleAriaLabel }\n\t\t\ttooltipPosition={ dropdownPosition }\n\t\t\tlabel={ __( 'Border color and style picker' ) }\n\t\t\tshowTooltip\n\t\t\t__next40pxDefaultSize={ size === '__unstable-large' }\n\t\t>\n\t\t\t<span className={ indicatorWrapperClassName }>\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tclassName={ indicatorClassName }\n\t\t\t\t\tcolorValue={ color }\n\t\t\t\t/>\n\t\t\t</span>\n\t\t</Button>\n\t);\n\n\tconst renderContent: DropdownComponentProps[ 'renderContent' ] = ( {\n\t\tonClose,\n\t} ) => (\n\t\t<>\n\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t<VStack className={ popoverControlsClassName } spacing={ 6 }>\n\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\tclassName={ popoverContentClassName }\n\t\t\t\t\t\tvalue={ color }\n\t\t\t\t\t\tonChange={ onColorChange }\n\t\t\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t\t{ enableStyle && isStyleSettable && (\n\t\t\t\t\t\t<BorderControlStylePicker\n\t\t\t\t\t\t\tlabel={ __( 'Style' ) }\n\t\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\t\tonChange={ onStyleChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t</DropdownContentWrapper>\n\t\t\t{ showResetButton && (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName={ resetButtonClassName }\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonReset();\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\trenderToggle={ renderToggle }\n\t\t\trenderContent={ renderContent }\n\t\t\tpopoverProps={ {\n\t\t\t\t...__unstablePopoverProps,\n\t\t\t} }\n\t\t\t{ ...otherProps }\n\t\t\tref={ forwardedRef }\n\t\t/>\n\t);\n};\n\nconst ConnectedBorderControlDropdown = contextConnect(\n\tBorderControlDropdown,\n\t'BorderControlDropdown'\n);\n\nexport default ConnectedBorderControlDropdown;\n"],"mappings":";;;;;;;AAQA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,yBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,eAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,aAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,SAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,uBAAA,GAAAR,sBAAA,CAAAF,OAAA;AAGA,IAAAW,MAAA,GAAAX,OAAA;AAAmE,IAAAY,WAAA,GAAAZ,OAAA;AAzBnE;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAiBA,MAAMa,sBAAsB,GAAKC,UAAkB,IAAM;EACxD;EACA,OAAOA,UAAU,CAACC,OAAO,CAAE,eAAe,EAAE,IAAK,CAAC;AACnD,CAAC;AAED,MAAMC,cAAc,GAAGA,CACtBF,UAA0C,EAC1CG,MAA0C,KACtC;EACJ,IAAK,CAAEH,UAAU,IAAI,CAAEG,MAAM,EAAG;IAC/B;EACD;EAEA,IAAK,IAAAC,6BAAsB,EAAED,MAAO,CAAC,EAAG;IACvC;IACA,IAAIE,YAAY;IAEhBF,MAAM,CAACG,IAAI,CAAIC,MAAM,IACpBA,MAAM,CAACJ,MAAM,CAACG,IAAI,CAAIE,KAAK,IAAM;MAChC,IAAKA,KAAK,CAACA,KAAK,KAAKR,UAAU,EAAG;QACjCK,YAAY,GAAGG,KAAK;QACpB,OAAO,IAAI;MACZ;MAEA,OAAO,KAAK;IACb,CAAE,CACH,CAA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Cc,OAAO,EAAC,UAAU;QAClBD,OAAO,EAAGA,CAAA,KAAM;UACflB,OAAO,CAAC,CAAC;UACT2B,OAAO,CAAC,CAAC;QACV,CAAG;QACHJ,qBAAqB;QAAAC,QAAA,EAEnB,IAAArC,QAAE,EAAE,OAAQ;MAAC,CACR;IAAC,CACc,CACxB;EAAA,CACA,CACF;EAED,oBACC,IAAAlB,WAAA,CAAA+C,GAAA,EAACrD,SAAA,CAAAsD,OAAQ;IACRH,YAAY,EAAGA,YAAc;IAC7BY,aAAa,EAAGA,aAAe;IAC/BU,YAAY,EAAG;MACd,GAAG7B;IACJ,CAAG;IAAA,GACEC,UAAU;IACf6B,GAAG,EAAG9C;EAAc,CACpB,CAAC;AAEJ,CAAC;AAED,MAAM+C,8BAA8B,GAAG,IAAAC,uBAAc,EACpDlD,qBAAqB,EACrB,uBACD,CAAC;AAAC,IAAAmD,QAAA,GAAAC,OAAA,CAAAxB,OAAA,GAEaqB,8BAA8B","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_borderControlStylePicker","_interopRequireDefault","_button","_colorIndicator","_colorPalette","_dropdown","_vStack","_context","_hook","_dropdownContentWrapper","_utils","_jsxRuntime","getAriaLabelColorValue","colorValue","replace","getColorObject","colors","isMultiplePaletteArray","matchedColor","some","origin","color","find","getToggleAriaLabel","colorObject","style","isStyleEnabled","ariaLabelValue","sprintf","__","name","BorderControlDropdown","props","forwardedRef","__experimentalIsRenderedInSidebar","border","disableCustomColors","enableAlpha","enableStyle","indicatorClassName","indicatorWrapperClassName","isStyleSettable","onReset","onColorChange","onStyleChange","popoverContentClassName","popoverControlsClassName","resetButtonClassName","size","__unstablePopoverProps","otherProps","useBorderControlDropdown","toggleAriaLabel","showResetButton","dropdownPosition","undefined","renderToggle","onToggle","jsx","default","onClick","variant","tooltipPosition","label","showTooltip","__next40pxDefaultSize","children","className","renderContent","onClose","jsxs","Fragment","paddingSize","VStack","spacing","value","onChange","clearable","popoverProps","ref","ConnectedBorderControlDropdown","contextConnect","_default","exports"],"sources":["@wordpress/components/src/border-control/border-control-dropdown/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderControlStylePicker from '../border-control-style-picker';\nimport Button from '../../button';\nimport ColorIndicator from '../../color-indicator';\nimport ColorPalette from '../../color-palette';\nimport Dropdown from '../../dropdown';\nimport { VStack } from '../../v-stack';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { useBorderControlDropdown } from './hook';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\n\nimport type { ColorObject } from '../../color-palette/types';\nimport { isMultiplePaletteArray } from '../../color-palette/utils';\nimport type { DropdownProps as DropdownComponentProps } from '../../dropdown/types';\nimport type { ColorProps, DropdownProps } from '../types';\n\nconst getAriaLabelColorValue = ( colorValue: string ) => {\n\t// Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n\treturn colorValue.replace( /^var\\((.+)\\)$/, '$1' );\n};\n\nconst getColorObject = (\n\tcolorValue: CSSProperties[ 'borderColor' ],\n\tcolors: ColorProps[ 'colors' ] | undefined\n) => {\n\tif ( ! colorValue || ! colors ) {\n\t\treturn;\n\t}\n\n\tif ( isMultiplePaletteArray( colors ) ) {\n\t\t// Multiple origins\n\t\tlet matchedColor;\n\n\t\tcolors.some( ( origin ) =>\n\t\t\torigin.colors.some( ( color ) => {\n\t\t\t\tif ( color.color === colorValue ) {\n\t\t\t\t\tmatchedColor = color;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t} )\n\t\t);\n\n\t\treturn matchedColor;\n\t}\n\n\t// Single origin\n\treturn colors.find( ( color ) => color.color === colorValue );\n};\n\nconst getToggleAriaLabel = (\n\tcolorValue: CSSProperties[ 'borderColor' ],\n\tcolorObject: ColorObject | undefined,\n\tstyle: CSSProperties[ 'borderStyle' ],\n\tisStyleEnabled: boolean\n) => {\n\tif ( isStyleEnabled ) {\n\t\tif ( colorObject ) {\n\t\t\tconst ariaLabelValue = getAriaLabelColorValue( colorObject.color );\n\t\t\treturn style\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\". 3: The current border style selection e.g. \"solid\".\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\". The currently selected style is \"%3$s\".'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcolorObject.name,\n\t\t\t\t\t\tariaLabelValue,\n\t\t\t\t\t\tstyle\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\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\t\t__(\n\t\t\t\t\t\t\t'Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcolorObject.name,\n\t\t\t\t\t\tariaLabelValue\n\t\t\t\t );\n\t\t}\n\n\t\tif ( colorValue ) {\n\t\t\tconst ariaLabelValue = getAriaLabelColorValue( colorValue );\n\t\t\treturn style\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: 1: The color's hex code e.g.: \"#f00:\". 2: The current border style selection e.g. \"solid\".\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Border color and style picker. The currently selected color has a value of \"%1$s\". The currently selected style is \"%2$s\".'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tariaLabelValue,\n\t\t\t\t\t\tstyle\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: The color's hex code e.g: \"#f00\".\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Border color and style picker. The currently selected color has a value of \"%s\".'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tariaLabelValue\n\t\t\t\t );\n\t\t}\n\n\t\treturn __( 'Border color and style picker.' );\n\t}\n\n\tif ( colorObject ) {\n\t\treturn sprintf(\n\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__(\n\t\t\t\t'Border color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t),\n\t\t\tcolorObject.name,\n\t\t\tgetAriaLabelColorValue( colorObject.color )\n\t\t);\n\t}\n\n\tif ( colorValue ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: The color's hex code e.g: \"#f00\".\n\t\t\t__(\n\t\t\t\t'Border color picker. The currently selected color has a value of \"%s\".'\n\t\t\t),\n\t\t\tgetAriaLabelColorValue( colorValue )\n\t\t);\n\t}\n\n\treturn __( 'Border color picker.' );\n};\n\nconst BorderControlDropdown = (\n\tprops: WordPressComponentProps< DropdownProps, 'div' >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\t__experimentalIsRenderedInSidebar,\n\t\tborder,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\tindicatorClassName,\n\t\tindicatorWrapperClassName,\n\t\tisStyleSettable,\n\t\tonReset,\n\t\tonColorChange,\n\t\tonStyleChange,\n\t\tpopoverContentClassName,\n\t\tpopoverControlsClassName,\n\t\tresetButtonClassName,\n\t\tsize,\n\t\t__unstablePopoverProps,\n\t\t...otherProps\n\t} = useBorderControlDropdown( props );\n\n\tconst { color, style } = border || {};\n\tconst colorObject = getColorObject( color, colors );\n\n\tconst toggleAriaLabel = getToggleAriaLabel(\n\t\tcolor,\n\t\tcolorObject,\n\t\tstyle,\n\t\tenableStyle\n\t);\n\n\tconst showResetButton = color || ( style && style !== 'none' );\n\tconst dropdownPosition = __experimentalIsRenderedInSidebar\n\t\t? 'bottom left'\n\t\t: undefined;\n\n\tconst renderToggle: DropdownComponentProps[ 'renderToggle' ] = ( {\n\t\tonToggle,\n\t} ) => (\n\t\t<Button\n\t\t\tonClick={ onToggle }\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-label={ toggleAriaLabel }\n\t\t\ttooltipPosition={ dropdownPosition }\n\t\t\tlabel={ __( 'Border color and style picker' ) }\n\t\t\tshowTooltip\n\t\t\t__next40pxDefaultSize={ size === '__unstable-large' }\n\t\t>\n\t\t\t<span className={ indicatorWrapperClassName }>\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tclassName={ indicatorClassName }\n\t\t\t\t\tcolorValue={ color }\n\t\t\t\t/>\n\t\t\t</span>\n\t\t</Button>\n\t);\n\n\tconst renderContent: DropdownComponentProps[ 'renderContent' ] = ( {\n\t\tonClose,\n\t} ) => (\n\t\t<>\n\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t<VStack className={ popoverControlsClassName } spacing={ 6 }>\n\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\tclassName={ popoverContentClassName }\n\t\t\t\t\t\tvalue={ color }\n\t\t\t\t\t\tonChange={ onColorChange }\n\t\t\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t\t{ enableStyle && isStyleSettable && (\n\t\t\t\t\t\t<BorderControlStylePicker\n\t\t\t\t\t\t\tlabel={ __( 'Style' ) }\n\t\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\t\tonChange={ onStyleChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t</DropdownContentWrapper>\n\t\t\t{ showResetButton && (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName={ resetButtonClassName }\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonReset();\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\trenderToggle={ renderToggle }\n\t\t\trenderContent={ renderContent }\n\t\t\tpopoverProps={ {\n\t\t\t\t...__unstablePopoverProps,\n\t\t\t} }\n\t\t\t{ ...otherProps }\n\t\t\tref={ forwardedRef }\n\t\t/>\n\t);\n};\n\nconst ConnectedBorderControlDropdown = contextConnect(\n\tBorderControlDropdown,\n\t'BorderControlDropdown'\n);\n\nexport default ConnectedBorderControlDropdown;\n"],"mappings":";;;;;;;;AAQA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,yBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,eAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,aAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,SAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,uBAAA,GAAAR,sBAAA,CAAAF,OAAA;AAGA,IAAAW,MAAA,GAAAX,OAAA;AAAmE,IAAAY,WAAA,GAAAZ,OAAA;AAzBnE;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAiBA,MAAMa,sBAAsB,GAAKC,UAAkB,IAAM;EACxD;EACA,OAAOA,UAAU,CAACC,OAAO,CAAE,eAAe,EAAE,IAAK,CAAC;AACnD,CAAC;AA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,iBAC/B,IAAA9B,WAAA,CAAA+C,GAAA,EAAC1D,yBAAA,CAAA2D,OAAwB;UACxBI,KAAK,EAAG,IAAAlC,QAAE,EAAE,OAAQ,CAAG;UACvB8C,KAAK,EAAGlD,KAAO;UACfmD,QAAQ,EAAGhC;QAAe,CAC1B,CACD;MAAA,CACM;IAAC,CACc,CAAC,EACvBS,eAAe,iBAChB,IAAA1C,WAAA,CAAA+C,GAAA,EAACjD,uBAAA,CAAAkD,OAAsB;MAACa,WAAW,EAAC,MAAM;MAAAN,QAAA,eACzC,IAAAvD,WAAA,CAAA+C,GAAA,EAACxD,OAAA,CAAAyD,OAAM;QACNQ,SAAS,EAAGpB,oBAAsB;QAClCc,OAAO,EAAC,UAAU;QAClBD,OAAO,EAAGA,CAAA,KAAM;UACflB,OAAO,CAAC,CAAC;UACT2B,OAAO,CAAC,CAAC;QACV,CAAG;QACHJ,qBAAqB;QAAAC,QAAA,EAEnB,IAAArC,QAAE,EAAE,OAAQ;MAAC,CACR;IAAC,CACc,CACxB;EAAA,CACA,CACF;EAED,oBACC,IAAAlB,WAAA,CAAA+C,GAAA,EAACrD,SAAA,CAAAsD,OAAQ;IACRH,YAAY,EAAGA,YAAc;IAC7BY,aAAa,EAAGA,aAAe;IAC/BU,YAAY,EAAG;MACd,GAAG7B;IACJ,CAAG;IAAA,GACEC,UAAU;IACf6B,GAAG,EAAG9C;EAAc,CACpB,CAAC;AAEJ,CAAC;AAED,MAAM+C,8BAA8B,GAAG,IAAAC,uBAAc,EACpDlD,qBAAqB,EACrB,uBACD,CAAC;AAAC,IAAAmD,QAAA,GAAAC,OAAA,CAAAxB,OAAA,GAEaqB,8BAA8B","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  Object.defineProperty(exports, "__esModule", {
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_i18n","_context","_toggleGroupControl","_jsxRuntime","BORDER_STYLES","label","__","icon","lineSolid","value","lineDashed","lineDotted","UnconnectedBorderControlStylePicker","onChange","restProps","forwardedRef","jsx","ToggleGroupControl","__nextHasNoMarginBottom","__next40pxDefaultSize","ref","isDeselectable","children","map","borderStyle","ToggleGroupControlOptionIcon","BorderControlStylePicker","contextConnect","_default","exports","default"],"sources":["@wordpress/components/src/border-control/border-control-style-picker/component.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { lineDashed, lineDotted, lineSolid } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect } from '../../context';\nimport type { StylePickerProps } from '../types';\nimport {\n\tToggleGroupControl,\n\tToggleGroupControlOptionIcon,\n} from '../../toggle-group-control';\n\nconst BORDER_STYLES = [\n\t{ label: __( 'Solid' ), icon: lineSolid, value: 'solid' },\n\t{ label: __( 'Dashed' ), icon: lineDashed, value: 'dashed' },\n\t{ label: __( 'Dotted' ), icon: lineDotted, value: 'dotted' },\n];\n\nfunction UnconnectedBorderControlStylePicker(\n\t{ onChange, ...restProps }: StylePickerProps,\n\tforwardedRef: React.ForwardedRef< any >\n) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tref={ forwardedRef }\n\t\t\tisDeselectable\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tonChange?.( value as string | undefined );\n\t\t\t} }\n\t\t\t{ ...restProps }\n\t\t>\n\t\t\t{ BORDER_STYLES.map( ( borderStyle ) => (\n\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\tkey={ borderStyle.value }\n\t\t\t\t\tvalue={ borderStyle.value }\n\t\t\t\t\ticon={ borderStyle.icon }\n\t\t\t\t\tlabel={ borderStyle.label }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n\nconst BorderControlStylePicker = contextConnect(\n\tUnconnectedBorderControlStylePicker,\n\t'BorderControlStylePicker'\n);\n\nexport default Bor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AAC;AAEvB;AAEA,MAAMiB,wBAAwB,GAAG,IAAAC,uBAAc,EAC9Cf,mCAAmC,EACnC,0BACD,CAAC;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaJ,wBAAwB","ignoreList":[]}
1
+ {"version":3,"names":["_icons","require","_i18n","_context","_toggleGroupControl","_jsxRuntime","BORDER_STYLES","label","__","icon","lineSolid","value","lineDashed","lineDotted","UnconnectedBorderControlStylePicker","onChange","restProps","forwardedRef","jsx","ToggleGroupControl","__nextHasNoMarginBottom","__next40pxDefaultSize","ref","isDeselectable","children","map","borderStyle","ToggleGroupControlOptionIcon","BorderControlStylePicker","contextConnect","_default","exports","default"],"sources":["@wordpress/components/src/border-control/border-control-style-picker/component.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { lineDashed, lineDotted, lineSolid } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect } from '../../context';\nimport type { StylePickerProps } from '../types';\nimport {\n\tToggleGroupControl,\n\tToggleGroupControlOptionIcon,\n} from '../../toggle-group-control';\n\nconst BORDER_STYLES = [\n\t{ label: __( 'Solid' ), icon: lineSolid, value: 'solid' },\n\t{ label: __( 'Dashed' ), icon: lineDashed, value: 'dashed' },\n\t{ label: __( 'Dotted' ), icon: lineDotted, value: 'dotted' },\n];\n\nfunction UnconnectedBorderControlStylePicker(\n\t{ onChange, ...restProps }: StylePickerProps,\n\tforwardedRef: React.ForwardedRef< any >\n) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tref={ forwardedRef }\n\t\t\tisDeselectable\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tonChange?.( value as string | undefined );\n\t\t\t} }\n\t\t\t{ ...restProps }\n\t\t>\n\t\t\t{ BORDER_STYLES.map( ( borderStyle ) => (\n\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\tkey={ borderStyle.value }\n\t\t\t\t\tvalue={ borderStyle.value }\n\t\t\t\t\ticon={ borderStyle.icon }\n\t\t\t\t\tlabel={ borderStyle.label }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n\nconst BorderControlStylePicker = contextConnect(\n\tUnconnectedBorderControlStylePicker,\n\t'BorderControlStylePicker'\n);\n\nexport default BorderControlStylePicker;\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAH,OAAA;AAGoC,IAAAI,WAAA,GAAAJ,OAAA;AAdpC;AACA;AACA;;AAIA;AACA;AACA;;AAQA,MAAMK,aAAa,GAAG,CACrB;EAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;EAAEC,IAAI,EAAEC,gBAAS;EAAEC,KAAK,EAAE;AAAQ,CAAC,EACzD;EAAEJ,KAAK,EAAE,IAAAC,QAAE,EAAE,QAAS,CAAC;EAAEC,IAAI,EAAEG,iBAAU;EAAED,KAAK,EAAE;AAAS,CAAC,EAC5D;EAAEJ,KAAK,EAAE,IAAAC,QAAE,EAAE,QAAS,CAAC;EAAEC,IAAI,EAAEI,iBAAU;EAAEF,KAAK,EAAE;AAAS,CAAC,CAC5D;AAED,SAASG,mCAAmCA,CAC3C;EAAEC,QAAQ;EAAE,GAAGC;AAA4B,CAAC,EAC5CC,YAAuC,EACtC;EACD,oBACC,IAAAZ,WAAA,CAAAa,GAAA,EAACd,mBAAA,CAAAe,kBAAkB;IAClBC,uBAAuB;IACvBC,qBAAqB;IACrBC,GAAG,EAAGL,YAAc;IACpBM,cAAc;IACdR,QAAQ,EAAKJ,KAAK,IAAM;MACvBI,QAAQ,GAAIJ,KAA4B,CAAC;IAC1C,CAAG;IAAA,GACEK,SAAS;IAAAQ,QAAA,EAEZlB,aAAa,CAACmB,GAAG,CAAIC,WAAW,iBACjC,IAAArB,WAAA,CAAAa,GAAA,EAACd,mBAAA,CAAAuB,4BAA4B;MAE5BhB,KAAK,EAAGe,WAAW,CAACf,KAAO;MAC3BF,IAAI,EAAGiB,WAAW,CAACjB,IAAM;MACzBF,KAAK,EAAGmB,WAAW,CAACnB;IAAO,GAHrBmB,WAAW,CAACf,KAIlB,CACA;EAAC,CACgB,CAAC;AAEvB;AAEA,MAAMiB,wBAAwB,GAAG,IAAAC,uBAAc,EAC9Cf,mCAAmC,EACnC,0BACD,CAAC;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaJ,wBAAwB","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -15,9 +16,7 @@ var _compose = require("@wordpress/compose");
15
16
  var _element = require("@wordpress/element");
16
17
  var _i18n = require("@wordpress/i18n");
17
18
  var _baseControl = require("../base-control");
18
- var _allInputControl = _interopRequireDefault(require("./all-input-control"));
19
- var _inputControls = _interopRequireDefault(require("./input-controls"));
20
- var _axialInputControls = _interopRequireDefault(require("./axial-input-controls"));
19
+ var _inputControl = _interopRequireDefault(require("./input-control"));
21
20
  var _linkedButton = _interopRequireDefault(require("./linked-button"));
22
21
  var _grid = require("../grid");
23
22
  var _boxControlStyles = require("./styles/box-control-styles");
@@ -91,7 +90,7 @@ function BoxControl({
91
90
  const hasInitialValue = (0, _utils2.isValuesDefined)(valuesProp);
92
91
  const hasOneSide = sides?.length === 1;
93
92
  const [isDirty, setIsDirty] = (0, _element.useState)(hasInitialValue);
94
- const [isLinked, setIsLinked] = (0, _element.useState)(!hasInitialValue || !(0, _utils2.isValuesMixed)(inputValues) || hasOneSide);
93
+ const [isLinked, setIsLinked] = (0, _element.useState)(!hasInitialValue || !(0, _utils2.isValueMixed)(inputValues) || hasOneSide);
95
94
  const [side, setSide] = (0, _element.useState)((0, _utils2.getInitialSide)(isLinked, splitOnAxis));
96
95
 
97
96
  // Tracking selected units via internal state allows filtering of CSS unit
@@ -144,6 +143,7 @@ function BoxControl({
144
143
  __next40pxDefaultSize,
145
144
  size: undefined
146
145
  });
146
+ const sidesToRender = (0, _utils2.getAllowedSides)(sides);
147
147
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_grid.Grid, {
148
148
  id: id,
149
149
  columns: 3,
@@ -153,23 +153,23 @@ function BoxControl({
153
153
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_baseControl.BaseControl.VisualLabel, {
154
154
  id: headingId,
155
155
  children: label
156
- }), isLinked && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_boxControlStyles.InputWrapper, {
157
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_boxControlStyles.FlexedBoxControlIcon, {
158
- side: side,
159
- sides: sides
160
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_allInputControl.default, {
156
+ }), isLinked && /*#__PURE__*/(0, _jsxRuntime.jsx)(_boxControlStyles.InputWrapper, {
157
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_inputControl.default, {
158
+ side: "all",
161
159
  ...inputControlProps
162
- })]
160
+ })
163
161
  }), !hasOneSide && /*#__PURE__*/(0, _jsxRuntime.jsx)(_boxControlStyles.LinkedButtonWrapper, {
164
162
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_linkedButton.default, {
165
163
  onClick: toggleLinked,
166
164
  isLinked: isLinked
167
165
  })
168
- }), !isLinked && splitOnAxis && /*#__PURE__*/(0, _jsxRuntime.jsx)(_axialInputControls.default, {
166
+ }), !isLinked && splitOnAxis && ['vertical', 'horizontal'].map(axis => /*#__PURE__*/(0, _jsxRuntime.jsx)(_inputControl.default, {
167
+ side: axis,
169
168
  ...inputControlProps
170
- }), !isLinked && !splitOnAxis && /*#__PURE__*/(0, _jsxRuntime.jsx)(_inputControls.default, {
169
+ }, axis)), !isLinked && !splitOnAxis && Array.from(sidesToRender).map(axis => /*#__PURE__*/(0, _jsxRuntime.jsx)(_inputControl.default, {
170
+ side: axis,
171
171
  ...inputControlProps
172
- }), allowReset && /*#__PURE__*/(0, _jsxRuntime.jsx)(_boxControlStyles.ResetButton, {
172
+ }, axis)), allowReset && /*#__PURE__*/(0, _jsxRuntime.jsx)(_boxControlStyles.ResetButton, {
173
173
  className: "component-box-control__reset-button",
174
174
  variant: "secondary",
175
175
  size: "small",
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_element","_i18n","_baseControl","_allInputControl","_interopRequireDefault","_inputControls","_axialInputControls","_linkedButton","_grid","_boxControlStyles","_utils","_utils2","_hooks","_deprecated36pxSize","_jsxRuntime","defaultInputProps","min","noop","useUniqueId","idProp","instanceId","useInstanceId","BoxControl","__next40pxDefaultSize","id","inputProps","onChange","label","__","values","valuesProp","units","sides","splitOnAxis","allowReset","resetValues","DEFAULT_VALUES","onMouseOver","onMouseOut","setValues","useControlledState","fallback","inputValues","hasInitialValue","isValuesDefined","hasOneSide","length","isDirty","setIsDirty","useState","isLinked","setIsLinked","isValuesMixed","side","setSide","getInitialSide","selectedUnits","setSelectedUnits","top","parseQuantityAndUnitFromRawValue","right","bottom","left","headingId","toggleLinked","handleOnFocus","_event","nextSide","handleOnChange","nextValues","handleOnReset","inputControlProps","onFocus","maybeWarnDeprecated36pxSize","componentName","size","undefined","jsxs","Grid","columns","templateColumns","role","children","jsx","BaseControl","VisualLabel","InputWrapper","FlexedBoxControlIcon","default","LinkedButtonWrapper","onClick","ResetButton","className","variant","disabled","_default","exports"],"sources":["@wordpress/components/src/box-control/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { BaseControl } from '../base-control';\nimport AllInputControl from './all-input-control';\nimport InputControls from './input-controls';\nimport AxialInputControls from './axial-input-controls';\nimport LinkedButton from './linked-button';\nimport { Grid } from '../grid';\nimport {\n\tFlexedBoxControlIcon,\n\tInputWrapper,\n\tResetButton,\n\tLinkedButtonWrapper,\n} from './styles/box-control-styles';\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';\nimport {\n\tDEFAULT_VALUES,\n\tgetInitialSide,\n\tisValuesMixed,\n\tisValuesDefined,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport type {\n\tBoxControlIconProps,\n\tBoxControlProps,\n\tBoxControlValue,\n} from './types';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nconst defaultInputProps = {\n\tmin: 0,\n};\n\nconst noop = () => {};\n\nfunction useUniqueId( idProp?: string ) {\n\tconst instanceId = useInstanceId( BoxControl, 'inspector-box-control' );\n\n\treturn idProp || instanceId;\n}\n\n/**\n * A control that lets users set values for top, right, bottom, and left. Can be\n * used as an input control for values like `padding` or `margin`.\n *\n * ```jsx\n * import { useState } from 'react';\n * import { BoxControl } from '@wordpress/components';\n *\n * function Example() {\n * const [ values, setValues ] = useState( {\n * top: '50px',\n * left: '10%',\n * right: '10%',\n * bottom: '50px',\n * } );\n *\n * return (\n * <BoxControl\n * __next40pxDefaultSize\n * values={ values }\n * onChange={ setValues }\n * />\n * );\n * };\n * ```\n */\nfunction BoxControl( {\n\t__next40pxDefaultSize = false,\n\tid: idProp,\n\tinputProps = defaultInputProps,\n\tonChange = noop,\n\tlabel = __( 'Box Control' ),\n\tvalues: valuesProp,\n\tunits,\n\tsides,\n\tsplitOnAxis = false,\n\tallowReset = true,\n\tresetValues = DEFAULT_VALUES,\n\tonMouseOver,\n\tonMouseOut,\n}: BoxControlProps ) {\n\tconst [ values, setValues ] = useControlledState( valuesProp, {\n\t\tfallback: DEFAULT_VALUES,\n\t} );\n\tconst inputValues = values || DEFAULT_VALUES;\n\tconst hasInitialValue = isValuesDefined( valuesProp );\n\tconst hasOneSide = sides?.length === 1;\n\n\tconst [ isDirty, setIsDirty ] = useState( hasInitialValue );\n\tconst [ isLinked, setIsLinked ] = useState(\n\t\t! hasInitialValue || ! isValuesMixed( inputValues ) || hasOneSide\n\t);\n\n\tconst [ side, setSide ] = useState< BoxControlIconProps[ 'side' ] >(\n\t\tgetInitialSide( isLinked, splitOnAxis )\n\t);\n\n\t// Tracking selected units via internal state allows filtering of CSS unit\n\t// only values from being saved while maintaining preexisting unit selection\n\t// behaviour. Filtering CSS only values prevents invalid style values.\n\tconst [ selectedUnits, setSelectedUnits ] = useState< BoxControlValue >( {\n\t\ttop: parseQuantityAndUnitFromRawValue( valuesProp?.top )[ 1 ],\n\t\tright: parseQuantityAndUnitFromRawValue( valuesProp?.right )[ 1 ],\n\t\tbottom: parseQuantityAndUnitFromRawValue( valuesProp?.bottom )[ 1 ],\n\t\tleft: parseQuantityAndUnitFromRawValue( valuesProp?.left )[ 1 ],\n\t} );\n\n\tconst id = useUniqueId( idProp );\n\tconst headingId = `${ id }-heading`;\n\n\tconst toggleLinked = () => {\n\t\tsetIsLinked( ! isLinked );\n\t\tsetSide( getInitialSide( ! isLinked, splitOnAxis ) );\n\t};\n\n\tconst handleOnFocus = (\n\t\t_event: React.FocusEvent< HTMLInputElement >,\n\t\t{ side: nextSide }: { side: typeof side }\n\t) => {\n\t\tsetSide( nextSide );\n\t};\n\n\tconst handleOnChange = ( nextValues: BoxControlValue ) => {\n\t\tonChange( nextValues );\n\t\tsetValues( nextValues );\n\t\tsetIsDirty( true );\n\t};\n\n\tconst handleOnReset = () => {\n\t\tonChange( resetValues );\n\t\tsetValues( resetValues );\n\t\tsetSelectedUnits( resetValues );\n\t\tsetIsDirty( false );\n\t};\n\n\tconst inputControlProps = {\n\t\tonMouseOver,\n\t\tonMouseOut,\n\t\t...inputProps,\n\t\tonChange: handleOnChange,\n\t\tonFocus: handleOnFocus,\n\t\tisLinked,\n\t\tunits,\n\t\tselectedUnits,\n\t\tsetSelectedUnits,\n\t\tsides,\n\t\tvalues: inputValues,\n\t\t__next40pxDefaultSize,\n\t};\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'BoxControl',\n\t\t__next40pxDefaultSize,\n\t\tsize: undefined,\n\t} );\n\n\treturn (\n\t\t<Grid\n\t\t\tid={ id }\n\t\t\tcolumns={ 3 }\n\t\t\ttemplateColumns=\"1fr min-content min-content\"\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ headingId }\n\t\t>\n\t\t\t<BaseControl.VisualLabel id={ headingId }>\n\t\t\t\t{ label }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t{ isLinked && (\n\t\t\t\t<InputWrapper>\n\t\t\t\t\t<FlexedBoxControlIcon side={ side } sides={ sides } />\n\t\t\t\t\t<AllInputControl { ...inputControlProps } />\n\t\t\t\t</InputWrapper>\n\t\t\t) }\n\t\t\t{ ! hasOneSide && (\n\t\t\t\t<LinkedButtonWrapper>\n\t\t\t\t\t<LinkedButton\n\t\t\t\t\t\tonClick={ toggleLinked }\n\t\t\t\t\t\tisLinked={ isLinked }\n\t\t\t\t\t/>\n\t\t\t\t</LinkedButtonWrapper>\n\t\t\t) }\n\n\t\t\t{ ! isLinked && splitOnAxis && (\n\t\t\t\t<AxialInputControls { ...inputControlProps } />\n\t\t\t) }\n\t\t\t{ ! isLinked && ! splitOnAxis && (\n\t\t\t\t<InputControls { ...inputControlProps } />\n\t\t\t) }\n\t\t\t{ allowReset && (\n\t\t\t\t<ResetButton\n\t\t\t\t\tclassName=\"component-box-control__reset-button\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\tdisabled={ ! isDirty }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t</ResetButton>\n\t\t\t) }\n\t\t</Grid>\n\t);\n}\n\nexport { applyValueToSides } from './utils';\nexport default BoxControl;\n"],"mappings":";;;;;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAA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EAEpB,IAAAtD,QAAE,EAAE,OAAQ;IAAC,CACH,CACb;EAAA,CACI,CAAC;AAET;AAAC,IAAAmE,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAGclE,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["_compose","require","_element","_i18n","_baseControl","_inputControl","_interopRequireDefault","_linkedButton","_grid","_boxControlStyles","_utils","_utils2","_hooks","_deprecated36pxSize","_jsxRuntime","defaultInputProps","min","noop","useUniqueId","idProp","instanceId","useInstanceId","BoxControl","__next40pxDefaultSize","id","inputProps","onChange","label","__","values","valuesProp","units","sides","splitOnAxis","allowReset","resetValues","DEFAULT_VALUES","onMouseOver","onMouseOut","setValues","useControlledState","fallback","inputValues","hasInitialValue","isValuesDefined","hasOneSide","length","isDirty","setIsDirty","useState","isLinked","setIsLinked","isValueMixed","side","setSide","getInitialSide","selectedUnits","setSelectedUnits","top","parseQuantityAndUnitFromRawValue","right","bottom","left","headingId","toggleLinked","handleOnFocus","_event","nextSide","handleOnChange","nextValues","handleOnReset","inputControlProps","onFocus","maybeWarnDeprecated36pxSize","componentName","size","undefined","sidesToRender","getAllowedSides","jsxs","Grid","columns","templateColumns","role","children","jsx","BaseControl","VisualLabel","InputWrapper","default","LinkedButtonWrapper","onClick","map","axis","Array","from","ResetButton","className","variant","disabled","_default","exports"],"sources":["@wordpress/components/src/box-control/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { BaseControl } from '../base-control';\nimport InputControl from './input-control';\nimport LinkedButton from './linked-button';\nimport { Grid } from '../grid';\nimport {\n\tInputWrapper,\n\tResetButton,\n\tLinkedButtonWrapper,\n} from './styles/box-control-styles';\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';\nimport {\n\tDEFAULT_VALUES,\n\tgetInitialSide,\n\tisValueMixed,\n\tisValuesDefined,\n\tgetAllowedSides,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport type {\n\tBoxControlIconProps,\n\tBoxControlProps,\n\tBoxControlValue,\n} from './types';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nconst defaultInputProps = {\n\tmin: 0,\n};\n\nconst noop = () => {};\n\nfunction useUniqueId( idProp?: string ) {\n\tconst instanceId = useInstanceId( BoxControl, 'inspector-box-control' );\n\n\treturn idProp || instanceId;\n}\n\n/**\n * A control that lets users set values for top, right, bottom, and left. Can be\n * used as an input control for values like `padding` or `margin`.\n *\n * ```jsx\n * import { useState } from 'react';\n * import { BoxControl } from '@wordpress/components';\n *\n * function Example() {\n * const [ values, setValues ] = useState( {\n * top: '50px',\n * left: '10%',\n * right: '10%',\n * bottom: '50px',\n * } );\n *\n * return (\n * <BoxControl\n * __next40pxDefaultSize\n * values={ values }\n * onChange={ setValues }\n * />\n * );\n * };\n * ```\n */\nfunction BoxControl( {\n\t__next40pxDefaultSize = false,\n\tid: idProp,\n\tinputProps = defaultInputProps,\n\tonChange = noop,\n\tlabel = __( 'Box Control' ),\n\tvalues: valuesProp,\n\tunits,\n\tsides,\n\tsplitOnAxis = false,\n\tallowReset = true,\n\tresetValues = DEFAULT_VALUES,\n\tonMouseOver,\n\tonMouseOut,\n}: BoxControlProps ) {\n\tconst [ values, setValues ] = useControlledState( valuesProp, {\n\t\tfallback: DEFAULT_VALUES,\n\t} );\n\tconst inputValues = values || DEFAULT_VALUES;\n\tconst hasInitialValue = isValuesDefined( valuesProp );\n\tconst hasOneSide = sides?.length === 1;\n\n\tconst [ isDirty, setIsDirty ] = useState( hasInitialValue );\n\tconst [ isLinked, setIsLinked ] = useState(\n\t\t! hasInitialValue || ! isValueMixed( inputValues ) || hasOneSide\n\t);\n\n\tconst [ side, setSide ] = useState< BoxControlIconProps[ 'side' ] >(\n\t\tgetInitialSide( isLinked, splitOnAxis )\n\t);\n\n\t// Tracking selected units via internal state allows filtering of CSS unit\n\t// only values from being saved while maintaining preexisting unit selection\n\t// behaviour. Filtering CSS only values prevents invalid style values.\n\tconst [ selectedUnits, setSelectedUnits ] = useState< BoxControlValue >( {\n\t\ttop: parseQuantityAndUnitFromRawValue( valuesProp?.top )[ 1 ],\n\t\tright: parseQuantityAndUnitFromRawValue( valuesProp?.right )[ 1 ],\n\t\tbottom: parseQuantityAndUnitFromRawValue( valuesProp?.bottom )[ 1 ],\n\t\tleft: parseQuantityAndUnitFromRawValue( valuesProp?.left )[ 1 ],\n\t} );\n\n\tconst id = useUniqueId( idProp );\n\tconst headingId = `${ id }-heading`;\n\n\tconst toggleLinked = () => {\n\t\tsetIsLinked( ! isLinked );\n\t\tsetSide( getInitialSide( ! isLinked, splitOnAxis ) );\n\t};\n\n\tconst handleOnFocus = (\n\t\t_event: React.FocusEvent< HTMLInputElement >,\n\t\t{ side: nextSide }: { side: typeof side }\n\t) => {\n\t\tsetSide( nextSide );\n\t};\n\n\tconst handleOnChange = ( nextValues: BoxControlValue ) => {\n\t\tonChange( nextValues );\n\t\tsetValues( nextValues );\n\t\tsetIsDirty( true );\n\t};\n\n\tconst handleOnReset = () => {\n\t\tonChange( resetValues );\n\t\tsetValues( resetValues );\n\t\tsetSelectedUnits( resetValues );\n\t\tsetIsDirty( false );\n\t};\n\n\tconst inputControlProps = {\n\t\tonMouseOver,\n\t\tonMouseOut,\n\t\t...inputProps,\n\t\tonChange: handleOnChange,\n\t\tonFocus: handleOnFocus,\n\t\tisLinked,\n\t\tunits,\n\t\tselectedUnits,\n\t\tsetSelectedUnits,\n\t\tsides,\n\t\tvalues: inputValues,\n\t\t__next40pxDefaultSize,\n\t};\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'BoxControl',\n\t\t__next40pxDefaultSize,\n\t\tsize: undefined,\n\t} );\n\tconst sidesToRender = getAllowedSides( sides );\n\n\treturn (\n\t\t<Grid\n\t\t\tid={ id }\n\t\t\tcolumns={ 3 }\n\t\t\ttemplateColumns=\"1fr min-content min-content\"\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ headingId }\n\t\t>\n\t\t\t<BaseControl.VisualLabel id={ headingId }>\n\t\t\t\t{ label }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t{ isLinked && (\n\t\t\t\t<InputWrapper>\n\t\t\t\t\t<InputControl side=\"all\" { ...inputControlProps } />\n\t\t\t\t</InputWrapper>\n\t\t\t) }\n\t\t\t{ ! hasOneSide && (\n\t\t\t\t<LinkedButtonWrapper>\n\t\t\t\t\t<LinkedButton\n\t\t\t\t\t\tonClick={ toggleLinked }\n\t\t\t\t\t\tisLinked={ isLinked }\n\t\t\t\t\t/>\n\t\t\t\t</LinkedButtonWrapper>\n\t\t\t) }\n\n\t\t\t{ ! isLinked &&\n\t\t\t\tsplitOnAxis &&\n\t\t\t\t[ 'vertical', 'horizontal' ].map( ( axis ) => (\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\tkey={ axis }\n\t\t\t\t\t\tside={ axis as 'horizontal' | 'vertical' }\n\t\t\t\t\t\t{ ...inputControlProps }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t{ ! isLinked &&\n\t\t\t\t! splitOnAxis &&\n\t\t\t\tArray.from( sidesToRender ).map( ( axis ) => (\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\tkey={ axis }\n\t\t\t\t\t\tside={ axis }\n\t\t\t\t\t\t{ ...inputControlProps }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t{ allowReset && (\n\t\t\t\t<ResetButton\n\t\t\t\t\tclassName=\"component-box-control__reset-button\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\tdisabled={ ! isDirty }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t</ResetButton>\n\t\t\t) }\n\t\t</Grid>\n\t);\n}\n\nexport { applyValueToSides } from './utils';\nexport default BoxControl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,EAAC,qCAAqC;MAC/CC,OAAO,EAAC,WAAW;MACnBvB,IAAI,EAAC,OAAO;MACZgB,OAAO,EAAGrB,aAAe;MACzB6B,QAAQ,EAAG,CAAEpD,OAAS;MAAAqC,QAAA,EAEpB,IAAAxD,QAAE,EAAE,OAAQ;IAAC,CACH,CACb;EAAA,CACI,CAAC;AAET;AAAC,IAAAwE,QAAA,GAAAC,OAAA,CAAAZ,OAAA,GAGcnE,UAAU","ignoreList":[]}
@@ -0,0 +1,161 @@
1
+ /* wp:polyfill */
2
+ "use strict";
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = BoxInputControl;
9
+ var _compose = require("@wordpress/compose");
10
+ var _i18n = require("@wordpress/i18n");
11
+ var _tooltip = _interopRequireDefault(require("../tooltip"));
12
+ var _utils = require("../unit-control/utils");
13
+ var _utils2 = require("./utils");
14
+ var _boxControlStyles = require("./styles/box-control-styles");
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+
20
+ /**
21
+ * Internal dependencies
22
+ */
23
+
24
+ const noop = () => {};
25
+ function getSidesToModify(side, sides, isAlt) {
26
+ const allowedSides = (0, _utils2.getAllowedSides)(sides);
27
+ let modifiedSides = [];
28
+ switch (side) {
29
+ case 'all':
30
+ modifiedSides = ['top', 'bottom', 'left', 'right'];
31
+ break;
32
+ case 'horizontal':
33
+ modifiedSides = ['left', 'right'];
34
+ break;
35
+ case 'vertical':
36
+ modifiedSides = ['top', 'bottom'];
37
+ break;
38
+ default:
39
+ modifiedSides = [side];
40
+ }
41
+ if (isAlt) {
42
+ switch (side) {
43
+ case 'top':
44
+ modifiedSides.push('bottom');
45
+ break;
46
+ case 'bottom':
47
+ modifiedSides.push('top');
48
+ break;
49
+ case 'left':
50
+ modifiedSides.push('left');
51
+ break;
52
+ case 'right':
53
+ modifiedSides.push('right');
54
+ break;
55
+ }
56
+ }
57
+ return modifiedSides.filter(s => allowedSides.has(s));
58
+ }
59
+ function BoxInputControl({
60
+ __next40pxDefaultSize,
61
+ onChange = noop,
62
+ onFocus = noop,
63
+ values,
64
+ selectedUnits,
65
+ setSelectedUnits,
66
+ sides,
67
+ side,
68
+ ...props
69
+ }) {
70
+ var _CUSTOM_VALUE_SETTING, _CUSTOM_VALUE_SETTING2;
71
+ const defaultValuesToModify = getSidesToModify(side, sides);
72
+ const handleOnFocus = event => {
73
+ onFocus(event, {
74
+ side
75
+ });
76
+ };
77
+ const handleOnChange = nextValues => {
78
+ onChange(nextValues);
79
+ };
80
+ const handleOnValueChange = (next, extra) => {
81
+ const nextValues = {
82
+ ...values
83
+ };
84
+ const isNumeric = next !== undefined && !isNaN(parseFloat(next));
85
+ const nextValue = isNumeric ? next : undefined;
86
+ const modifiedSides = getSidesToModify(side, sides,
87
+ /**
88
+ * Supports changing pair sides. For example, holding the ALT key
89
+ * when changing the TOP will also update BOTTOM.
90
+ */
91
+ // @ts-expect-error - TODO: event.altKey is only present when the change event was
92
+ // triggered by a keyboard event. Should this feature be implemented differently so
93
+ // it also works with drag events?
94
+ !!extra?.event.altKey);
95
+ modifiedSides.forEach(modifiedSide => {
96
+ nextValues[modifiedSide] = nextValue;
97
+ });
98
+ handleOnChange(nextValues);
99
+ };
100
+ const handleOnUnitChange = next => {
101
+ const newUnits = {
102
+ ...selectedUnits
103
+ };
104
+ defaultValuesToModify.forEach(modifiedSide => {
105
+ newUnits[modifiedSide] = next;
106
+ });
107
+ setSelectedUnits(newUnits);
108
+ };
109
+ const mergedValue = (0, _utils2.getMergedValue)(values, defaultValuesToModify);
110
+ const hasValues = (0, _utils2.isValuesDefined)(values);
111
+ const isMixed = hasValues && defaultValuesToModify.length > 1 && (0, _utils2.isValueMixed)(values, defaultValuesToModify);
112
+ const [parsedQuantity, parsedUnit] = (0, _utils.parseQuantityAndUnitFromRawValue)(mergedValue);
113
+ const computedUnit = hasValues ? parsedUnit : selectedUnits[defaultValuesToModify[0]];
114
+ const generatedId = (0, _compose.useInstanceId)(BoxInputControl, 'box-control-input');
115
+ const inputId = [generatedId, side].join('-');
116
+ const isMixedUnit = defaultValuesToModify.length > 1 && mergedValue === undefined && defaultValuesToModify.some(s => selectedUnits[s] !== computedUnit);
117
+ const usedValue = mergedValue === undefined && computedUnit ? computedUnit : mergedValue;
118
+ const mixedPlaceholder = isMixed || isMixedUnit ? (0, _i18n.__)('Mixed') : undefined;
119
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_boxControlStyles.InputWrapper, {
120
+ expanded: true,
121
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_boxControlStyles.FlexedBoxControlIcon, {
122
+ side: side,
123
+ sides: sides
124
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_tooltip.default, {
125
+ placement: "top-end",
126
+ text: _utils2.LABELS[side],
127
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_boxControlStyles.StyledUnitControl, {
128
+ ...props,
129
+ __shouldNotWarnDeprecated36pxSize: true,
130
+ __next40pxDefaultSize: __next40pxDefaultSize,
131
+ className: "component-box-control__unit-control",
132
+ id: inputId,
133
+ isPressEnterToChange: true,
134
+ disableUnits: isMixed || isMixedUnit,
135
+ value: usedValue,
136
+ onChange: handleOnValueChange,
137
+ onUnitChange: handleOnUnitChange,
138
+ onFocus: handleOnFocus,
139
+ label: _utils2.LABELS[side],
140
+ placeholder: mixedPlaceholder,
141
+ hideLabelFromVision: true
142
+ })
143
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_boxControlStyles.FlexedRangeControl, {
144
+ __nextHasNoMarginBottom: true,
145
+ __next40pxDefaultSize: __next40pxDefaultSize,
146
+ __shouldNotWarnDeprecated36pxSize: true,
147
+ "aria-controls": inputId,
148
+ label: _utils2.LABELS[side],
149
+ hideLabelFromVision: true,
150
+ onChange: newValue => {
151
+ handleOnValueChange(newValue !== undefined ? [newValue, computedUnit].join('') : undefined);
152
+ },
153
+ min: 0,
154
+ max: (_CUSTOM_VALUE_SETTING = _utils2.CUSTOM_VALUE_SETTINGS[computedUnit !== null && computedUnit !== void 0 ? computedUnit : 'px']?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10,
155
+ step: (_CUSTOM_VALUE_SETTING2 = _utils2.CUSTOM_VALUE_SETTINGS[computedUnit !== null && computedUnit !== void 0 ? computedUnit : 'px']?.step) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1,
156
+ value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : 0,
157
+ withInputField: false
158
+ })]
159
+ }, `box-control-${side}`);
160
+ }
161
+ //# sourceMappingURL=input-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_compose","require","_i18n","_tooltip","_interopRequireDefault","_utils","_utils2","_boxControlStyles","_jsxRuntime","noop","getSidesToModify","side","sides","isAlt","allowedSides","getAllowedSides","modifiedSides","push","filter","s","has","BoxInputControl","__next40pxDefaultSize","onChange","onFocus","values","selectedUnits","setSelectedUnits","props","_CUSTOM_VALUE_SETTING","_CUSTOM_VALUE_SETTING2","defaultValuesToModify","handleOnFocus","event","handleOnChange","nextValues","handleOnValueChange","next","extra","isNumeric","undefined","isNaN","parseFloat","nextValue","altKey","forEach","modifiedSide","handleOnUnitChange","newUnits","mergedValue","getMergedValue","hasValues","isValuesDefined","isMixed","length","isValueMixed","parsedQuantity","parsedUnit","parseQuantityAndUnitFromRawValue","computedUnit","generatedId","useInstanceId","inputId","join","isMixedUnit","some","usedValue","mixedPlaceholder","__","jsxs","InputWrapper","expanded","children","jsx","FlexedBoxControlIcon","default","placement","text","LABELS","StyledUnitControl","__shouldNotWarnDeprecated36pxSize","className","id","isPressEnterToChange","disableUnits","value","onUnitChange","label","placeholder","hideLabelFromVision","FlexedRangeControl","__nextHasNoMarginBottom","newValue","min","max","CUSTOM_VALUE_SETTINGS","step","withInputField"],"sources":["@wordpress/components/src/box-control/input-control.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../tooltip';\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';\nimport {\n\tCUSTOM_VALUE_SETTINGS,\n\tgetAllowedSides,\n\tgetMergedValue,\n\tisValueMixed,\n\tisValuesDefined,\n\tLABELS,\n} from './utils';\nimport {\n\tFlexedBoxControlIcon,\n\tFlexedRangeControl,\n\tInputWrapper,\n\tStyledUnitControl,\n} from './styles/box-control-styles';\nimport type { BoxControlInputControlProps, BoxControlValue } from './types';\n\nconst noop = () => {};\n\nfunction getSidesToModify(\n\tside: BoxControlInputControlProps[ 'side' ],\n\tsides: BoxControlInputControlProps[ 'sides' ],\n\tisAlt?: boolean\n) {\n\tconst allowedSides = getAllowedSides( sides );\n\n\tlet modifiedSides: ( keyof BoxControlValue )[] = [];\n\tswitch ( side ) {\n\t\tcase 'all':\n\t\t\tmodifiedSides = [ 'top', 'bottom', 'left', 'right' ];\n\t\t\tbreak;\n\t\tcase 'horizontal':\n\t\t\tmodifiedSides = [ 'left', 'right' ];\n\t\t\tbreak;\n\t\tcase 'vertical':\n\t\t\tmodifiedSides = [ 'top', 'bottom' ];\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tmodifiedSides = [ side ];\n\t}\n\n\tif ( isAlt ) {\n\t\tswitch ( side ) {\n\t\t\tcase 'top':\n\t\t\t\tmodifiedSides.push( 'bottom' );\n\t\t\t\tbreak;\n\t\t\tcase 'bottom':\n\t\t\t\tmodifiedSides.push( 'top' );\n\t\t\t\tbreak;\n\t\t\tcase 'left':\n\t\t\t\tmodifiedSides.push( 'left' );\n\t\t\t\tbreak;\n\t\t\tcase 'right':\n\t\t\t\tmodifiedSides.push( 'right' );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn modifiedSides.filter( ( s ) => allowedSides.has( s ) );\n}\n\nexport default function BoxInputControl( {\n\t__next40pxDefaultSize,\n\tonChange = noop,\n\tonFocus = noop,\n\tvalues,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tsides,\n\tside,\n\t...props\n}: BoxControlInputControlProps ) {\n\tconst defaultValuesToModify = getSidesToModify( side, sides );\n\n\tconst handleOnFocus = ( event: React.FocusEvent< HTMLInputElement > ) => {\n\t\tonFocus( event, { side } );\n\t};\n\n\tconst handleOnChange = ( nextValues: BoxControlValue ) => {\n\t\tonChange( nextValues );\n\t};\n\n\tconst handleOnValueChange = (\n\t\tnext?: string,\n\t\textra?: { event: React.SyntheticEvent< Element, Event > }\n\t) => {\n\t\tconst nextValues = { ...values };\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\t\tconst modifiedSides = getSidesToModify(\n\t\t\tside,\n\t\t\tsides,\n\t\t\t/**\n\t\t\t * Supports changing pair sides. For example, holding the ALT key\n\t\t\t * when changing the TOP will also update BOTTOM.\n\t\t\t */\n\t\t\t// @ts-expect-error - TODO: event.altKey is only present when the change event was\n\t\t\t// triggered by a keyboard event. Should this feature be implemented differently so\n\t\t\t// it also works with drag events?\n\t\t\t!! extra?.event.altKey\n\t\t);\n\n\t\tmodifiedSides.forEach( ( modifiedSide ) => {\n\t\t\tnextValues[ modifiedSide ] = nextValue;\n\t\t} );\n\n\t\thandleOnChange( nextValues );\n\t};\n\n\tconst handleOnUnitChange = ( next?: string ) => {\n\t\tconst newUnits = { ...selectedUnits };\n\t\tdefaultValuesToModify.forEach( ( modifiedSide ) => {\n\t\t\tnewUnits[ modifiedSide ] = next;\n\t\t} );\n\t\tsetSelectedUnits( newUnits );\n\t};\n\n\tconst mergedValue = getMergedValue( values, defaultValuesToModify );\n\tconst hasValues = isValuesDefined( values );\n\tconst isMixed =\n\t\thasValues &&\n\t\tdefaultValuesToModify.length > 1 &&\n\t\tisValueMixed( values, defaultValuesToModify );\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( mergedValue );\n\tconst computedUnit = hasValues\n\t\t? parsedUnit\n\t\t: selectedUnits[ defaultValuesToModify[ 0 ] ];\n\tconst generatedId = useInstanceId( BoxInputControl, 'box-control-input' );\n\tconst inputId = [ generatedId, side ].join( '-' );\n\tconst isMixedUnit =\n\t\tdefaultValuesToModify.length > 1 &&\n\t\tmergedValue === undefined &&\n\t\tdefaultValuesToModify.some(\n\t\t\t( s ) => selectedUnits[ s ] !== computedUnit\n\t\t);\n\tconst usedValue =\n\t\tmergedValue === undefined && computedUnit ? computedUnit : mergedValue;\n\tconst mixedPlaceholder = isMixed || isMixedUnit ? __( 'Mixed' ) : undefined;\n\n\treturn (\n\t\t<InputWrapper key={ `box-control-${ side }` } expanded>\n\t\t\t<FlexedBoxControlIcon side={ side } sides={ sides } />\n\t\t\t<Tooltip placement=\"top-end\" text={ LABELS[ side ] }>\n\t\t\t\t<StyledUnitControl\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\tclassName=\"component-box-control__unit-control\"\n\t\t\t\t\tid={ inputId }\n\t\t\t\t\tisPressEnterToChange\n\t\t\t\t\tdisableUnits={ isMixed || isMixedUnit }\n\t\t\t\t\tvalue={ usedValue }\n\t\t\t\t\tonChange={ handleOnValueChange }\n\t\t\t\t\tonUnitChange={ handleOnUnitChange }\n\t\t\t\t\tonFocus={ handleOnFocus }\n\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\tplaceholder={ mixedPlaceholder }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t/>\n\t\t\t</Tooltip>\n\n\t\t\t<FlexedRangeControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\taria-controls={ inputId }\n\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\thideLabelFromVision\n\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\thandleOnValueChange(\n\t\t\t\t\t\tnewValue !== undefined\n\t\t\t\t\t\t\t? [ newValue, computedUnit ].join( '' )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t\tmin={ 0 }\n\t\t\t\tmax={ CUSTOM_VALUE_SETTINGS[ computedUnit ?? 'px' ]?.max ?? 10 }\n\t\t\t\tstep={\n\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ computedUnit ?? 'px' ]?.step ?? 0.1\n\t\t\t\t}\n\t\t\t\tvalue={ parsedQuantity ?? 0 }\n\t\t\t\twithInputField={ false }\n\t\t\t/>\n\t\t</InputWrapper>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAQA,IAAAM,iBAAA,GAAAN,OAAA;AAKqC,IAAAO,WAAA,GAAAP,OAAA;AAxBrC;AACA;AACA;;AAIA;AACA;AACA;;AAmBA,MAAMQ,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,SAASC,gBAAgBA,CACxBC,IAA2C,EAC3CC,KAA6C,EAC7CC,KAAe,EACd;EACD,MAAMC,YAAY,GAAG,IAAAC,uBAAe,EAAEH,KAAM,CAAC;EAE7C,IAAII,aAA0C,GAAG,EAAE;EACnD,QAASL,IAAI;IACZ,KAAK,KAAK;MACTK,aAAa,GAAG,CAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAE;MACpD;IACD,KAAK,YAAY;MAChBA,aAAa,GAAG,CAAE,MAAM,EAAE,OAAO,CAAE;M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BAAkB;QAChCsB,mBAAmB;MAAA,CACnB;IAAC,CACM,CAAC,eAEV,IAAAjF,WAAA,CAAAiE,GAAA,EAAClE,iBAAA,CAAAmF,kBAAkB;MAClBC,uBAAuB;MACvBrE,qBAAqB,EAAGA,qBAAuB;MAC/C0D,iCAAiC;MACjC,iBAAgBlB,OAAS;MACzByB,KAAK,EAAGT,cAAM,CAAEnE,IAAI,CAAI;MACxB8E,mBAAmB;MACnBlE,QAAQ,EAAKqE,QAAQ,IAAM;QAC1BxD,mBAAmB,CAClBwD,QAAQ,KAAKpD,SAAS,GACnB,CAAEoD,QAAQ,EAAEjC,YAAY,CAAE,CAACI,IAAI,CAAE,EAAG,CAAC,GACrCvB,SACJ,CAAC;MACF,CAAG;MACHqD,GAAG,EAAG,CAAG;MACTC,GAAG,GAAAjE,qBAAA,GAAGkE,6BAAqB,CAAEpC,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAI,IAAI,CAAE,EAAEmC,GAAG,cAAAjE,qBAAA,cAAAA,qBAAA,GAAI,EAAI;MAChEmE,IAAI,GAAAlE,sBAAA,GACHiE,6BAAqB,CAAEpC,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAI,IAAI,CAAE,EAAEqC,IAAI,cAAAlE,sBAAA,cAAAA,sBAAA,GAAI,GACvD;MACDuD,KAAK,EAAG7B,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,CAAG;MAC7ByC,cAAc,EAAG;IAAO,CACxB,CAAC;EAAA,GA1CiB,eAAgBtF,IAAI,EA2C1B,CAAC;AAEjB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/box-control/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { UnitControlProps } from '../unit-control/types';\nimport type { LABELS } from './utils';\n\nexport type BoxControlValue = {\n\ttop?: string;\n\tright?: string;\n\tbottom?: string;\n\tleft?: string;\n};\n\nexport type CustomValueUnits = {\n\t[ key: string ]: { max: number; step: number };\n};\n\ntype UnitControlPassthroughProps = Omit<\n\tUnitControlProps,\n\t'label' | 'onChange' | 'onFocus' | 'units'\n>;\n\ntype DeprecatedBoxControlProps = {\n\t/**\n\t * @deprecated Pass to the `inputProps` prop instead.\n\t * @ignore\n\t */\n\tonMouseOver?: UnitControlProps[ 'onMouseOver' ];\n\t/**\n\t * @deprecated Pass to the `inputProps` prop instead.\n\t * @ignore\n\t */\n\tonMouseOut?: UnitControlProps[ 'onMouseOut' ];\n};\n\nexport type BoxControlProps = Pick< UnitControlProps, 'units' > &\n\tDeprecatedBoxControlProps & {\n\t\t/**\n\t\t * If this property is true, a button to reset the box control is rendered.\n\t\t *\n\t\t * @default true\n\t\t */\n\t\tallowReset?: boolean;\n\t\t/**\n\t\t * The id to use as a base for the unique HTML id attribute of the control.\n\t\t */\n\t\tid?: string;\n\t\t/**\n\t\t * Props for the internal `UnitControl` components.\n\t\t *\n\t\t * @default { min: 0 }\n\t\t */\n\t\tinputProps?: UnitControlPassthroughProps;\n\t\t/**\n\t\t * Heading label for the control.\n\t\t *\n\t\t * @default __( 'Box Control' )\n\t\t */\n\t\tlabel?: string;\n\t\t/**\n\t\t * A callback function when an input value changes.\n\t\t */\n\t\tonChange: ( next: BoxControlValue ) => void;\n\t\t/**\n\t\t * The `top`, `right`, `bottom`, and `left` box dimension values to use when the control is reset.\n\t\t *\n\t\t * @default { top: undefined, right: undefined, bottom: undefined, left: undefined }\n\t\t */\n\t\tresetValues?: BoxControlValue;\n\t\t/**\n\t\t * Collection of sides to allow control of. If omitted or empty, all sides will be available.\n\t\t *\n\t\t * Allowed values are \"top\", \"right\", \"bottom\", \"left\", \"vertical\", and \"horizontal\".\n\t\t */\n\t\tsides?: readonly (\n\t\t\t| keyof BoxControlValue\n\t\t\t| 'horizontal'\n\t\t\t| 'vertical'\n\t\t)[];\n\t\t/**\n\t\t * If this property is true, when the box control is unlinked, vertical and horizontal controls\n\t\t * can be used instead of updating individual sides.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\tsplitOnAxis?: boolean;\n\t\t/**\n\t\t * The current values of the control, expressed as an object of `top`, `right`, `bottom`, and `left` values.\n\t\t */\n\t\tvalues?: BoxControlValue;\n\t\t/**\n\t\t * Start opting into the larger default height that will become the default size in a future version.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\t__next40pxDefaultSize?: boolean;\n\t};\n\nexport type BoxControlInputControlProps = UnitControlPassthroughProps & {\n\tonChange?: ( nextValues: BoxControlValue ) => void;\n\tonFocus?: (\n\t\t_event: React.FocusEvent< HTMLInputElement >,\n\t\t{ side }: { side: keyof typeof LABELS }\n\t) => void;\n\tonHoverOff?: (\n\t\tsides: Partial< Record< keyof BoxControlValue, boolean > >\n\t) => void;\n\tonHoverOn?: (\n\t\tsides: Partial< Record< keyof BoxControlValue, boolean > >\n\t) => void;\n\tselectedUnits: BoxControlValue;\n\tsetSelectedUnits: React.Dispatch< React.SetStateAction< BoxControlValue > >;\n\tsides: BoxControlProps[ 'sides' ];\n\tvalues: BoxControlValue;\n};\n\nexport type BoxControlIconProps = {\n\t/**\n\t * @default 24\n\t */\n\tsize?: number;\n\t/**\n\t * @default 'all'\n\t */\n\tside?: keyof typeof LABELS;\n\tsides?: BoxControlProps[ 'sides' ];\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/box-control/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { UnitControlProps } from '../unit-control/types';\nimport type { LABELS } from './utils';\n\nexport type BoxControlValue = {\n\ttop?: string;\n\tright?: string;\n\tbottom?: string;\n\tleft?: string;\n};\n\nexport type CustomValueUnits = {\n\t[ key: string ]: { max: number; step: number };\n};\n\ntype UnitControlPassthroughProps = Omit<\n\tUnitControlProps,\n\t'label' | 'onChange' | 'onFocus' | 'units'\n>;\n\ntype DeprecatedBoxControlProps = {\n\t/**\n\t * @deprecated Pass to the `inputProps` prop instead.\n\t * @ignore\n\t */\n\tonMouseOver?: UnitControlProps[ 'onMouseOver' ];\n\t/**\n\t * @deprecated Pass to the `inputProps` prop instead.\n\t * @ignore\n\t */\n\tonMouseOut?: UnitControlProps[ 'onMouseOut' ];\n};\n\nexport type BoxControlProps = Pick< UnitControlProps, 'units' > &\n\tDeprecatedBoxControlProps & {\n\t\t/**\n\t\t * If this property is true, a button to reset the box control is rendered.\n\t\t *\n\t\t * @default true\n\t\t */\n\t\tallowReset?: boolean;\n\t\t/**\n\t\t * The id to use as a base for the unique HTML id attribute of the control.\n\t\t */\n\t\tid?: string;\n\t\t/**\n\t\t * Props for the internal `UnitControl` components.\n\t\t *\n\t\t * @default { min: 0 }\n\t\t */\n\t\tinputProps?: UnitControlPassthroughProps;\n\t\t/**\n\t\t * Heading label for the control.\n\t\t *\n\t\t * @default __( 'Box Control' )\n\t\t */\n\t\tlabel?: string;\n\t\t/**\n\t\t * A callback function when an input value changes.\n\t\t */\n\t\tonChange: ( next: BoxControlValue ) => void;\n\t\t/**\n\t\t * The `top`, `right`, `bottom`, and `left` box dimension values to use when the control is reset.\n\t\t *\n\t\t * @default { top: undefined, right: undefined, bottom: undefined, left: undefined }\n\t\t */\n\t\tresetValues?: BoxControlValue;\n\t\t/**\n\t\t * Collection of sides to allow control of. If omitted or empty, all sides will be available.\n\t\t *\n\t\t * Allowed values are \"top\", \"right\", \"bottom\", \"left\", \"vertical\", and \"horizontal\".\n\t\t */\n\t\tsides?: readonly (\n\t\t\t| keyof BoxControlValue\n\t\t\t| 'horizontal'\n\t\t\t| 'vertical'\n\t\t)[];\n\t\t/**\n\t\t * If this property is true, when the box control is unlinked, vertical and horizontal controls\n\t\t * can be used instead of updating individual sides.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\tsplitOnAxis?: boolean;\n\t\t/**\n\t\t * The current values of the control, expressed as an object of `top`, `right`, `bottom`, and `left` values.\n\t\t */\n\t\tvalues?: BoxControlValue;\n\t\t/**\n\t\t * Start opting into the larger default height that will become the default size in a future version.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\t__next40pxDefaultSize?: boolean;\n\t};\n\nexport type BoxControlInputControlProps = UnitControlPassthroughProps & {\n\tonChange?: ( nextValues: BoxControlValue ) => void;\n\tonFocus?: (\n\t\t_event: React.FocusEvent< HTMLInputElement >,\n\t\t{ side }: { side: keyof typeof LABELS }\n\t) => void;\n\tonHoverOff?: (\n\t\tsides: Partial< Record< keyof BoxControlValue, boolean > >\n\t) => void;\n\tonHoverOn?: (\n\t\tsides: Partial< Record< keyof BoxControlValue, boolean > >\n\t) => void;\n\tselectedUnits: BoxControlValue;\n\tsetSelectedUnits: React.Dispatch< React.SetStateAction< BoxControlValue > >;\n\tvalues: BoxControlValue;\n\t/**\n\t * Collection of sides to allow control of. If omitted or empty, all sides will be available.\n\t */\n\tsides: BoxControlProps[ 'sides' ];\n\t/**\n\t * Side represents the current side being rendered by the input.\n\t * It can be a concrete side like: left, right, top, bottom or a combined one like: horizontal, vertical.\n\t */\n\tside: keyof typeof LABELS;\n};\n\nexport type BoxControlIconProps = {\n\t/**\n\t * @default 24\n\t */\n\tsize?: number;\n\t/**\n\t * @default 'all'\n\t */\n\tside?: keyof typeof LABELS;\n\tsides?: BoxControlProps[ 'sides' ];\n};\n"],"mappings":"","ignoreList":[]}
@@ -1,18 +1,21 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.LABELS = exports.DEFAULT_VALUES = exports.CUSTOM_VALUE_SETTINGS = exports.ALL_SIDES = void 0;
7
9
  exports.applyValueToSides = applyValueToSides;
8
10
  exports.getAllUnitFallback = getAllUnitFallback;
9
- exports.getAllValue = getAllValue;
11
+ exports.getAllowedSides = getAllowedSides;
10
12
  exports.getInitialSide = getInitialSide;
13
+ exports.getMergedValue = getMergedValue;
14
+ exports.isValueMixed = isValueMixed;
11
15
  exports.isValuesDefined = isValuesDefined;
12
- exports.isValuesMixed = isValuesMixed;
13
16
  exports.normalizeSides = normalizeSides;
14
17
  var _i18n = require("@wordpress/i18n");
15
- var _utils = require("../unit-control/utils");
18
+ var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
16
19
  /**
17
20
  * WordPress dependencies
18
21
  */
@@ -141,7 +144,6 @@ const LABELS = exports.LABELS = {
141
144
  bottom: (0, _i18n.__)('Bottom side'),
142
145
  left: (0, _i18n.__)('Left side'),
143
146
  right: (0, _i18n.__)('Right side'),
144
- mixed: (0, _i18n.__)('Mixed'),
145
147
  vertical: (0, _i18n.__)('Top and bottom sides'),
146
148
  horizontal: (0, _i18n.__)('Left and right sides')
147
149
  };
@@ -165,43 +167,31 @@ function mode(arr) {
165
167
  }
166
168
 
167
169
  /**
168
- * Gets the 'all' input value and unit from values data.
170
+ * Gets the merged input value and unit from values data.
169
171
  *
170
172
  * @param values Box values.
171
- * @param selectedUnits Box units.
172
173
  * @param availableSides Available box sides to evaluate.
173
174
  *
174
175
  * @return A value + unit for the 'all' input.
175
176
  */
176
- function getAllValue(values = {}, selectedUnits, availableSides = ALL_SIDES) {
177
+ function getMergedValue(values = {}, availableSides = ALL_SIDES) {
177
178
  const sides = normalizeSides(availableSides);
178
- const parsedQuantitiesAndUnits = sides.map(side => (0, _utils.parseQuantityAndUnitFromRawValue)(values[side]));
179
- const allParsedQuantities = parsedQuantitiesAndUnits.map(value => {
180
- var _value$;
181
- return (_value$ = value[0]) !== null && _value$ !== void 0 ? _value$ : '';
182
- });
183
- const allParsedUnits = parsedQuantitiesAndUnits.map(value => value[1]);
184
- const commonQuantity = allParsedQuantities.every(v => v === allParsedQuantities[0]) ? allParsedQuantities[0] : '';
185
-
186
- /**
187
- * The typeof === 'number' check is important. On reset actions, the incoming value
188
- * may be null or an empty string.
189
- *
190
- * Also, the value may also be zero (0), which is considered a valid unit value.
191
- *
192
- * typeof === 'number' is more specific for these cases, rather than relying on a
193
- * simple truthy check.
194
- */
195
- let commonUnit;
196
- if (typeof commonQuantity === 'number') {
197
- commonUnit = mode(allParsedUnits);
198
- } else {
199
- var _getAllUnitFallback;
200
- // Set meaningful unit selection if no commonQuantity and user has previously
201
- // selected units without assigning values while controls were unlinked.
202
- commonUnit = (_getAllUnitFallback = getAllUnitFallback(selectedUnits)) !== null && _getAllUnitFallback !== void 0 ? _getAllUnitFallback : mode(allParsedUnits);
179
+ if (sides.every(side => values[side] === values[sides[0]])) {
180
+ return values[sides[0]];
203
181
  }
204
- return [commonQuantity, commonUnit].join('');
182
+ return undefined;
183
+ }
184
+
185
+ /**
186
+ * Checks if the values are mixed.
187
+ *
188
+ * @param values Box values.
189
+ * @param availableSides Available box sides to evaluate.
190
+ * @return Whether the values are mixed.
191
+ */
192
+ function isValueMixed(values = {}, availableSides = ALL_SIDES) {
193
+ const sides = normalizeSides(availableSides);
194
+ return sides.some(side => values[side] !== values[sides[0]]);
205
195
  }
206
196
 
207
197
  /**
@@ -218,21 +208,6 @@ function getAllUnitFallback(selectedUnits) {
218
208
  return mode(filteredUnits);
219
209
  }
220
210
 
221
- /**
222
- * Checks to determine if values are mixed.
223
- *
224
- * @param values Box values.
225
- * @param selectedUnits Box units.
226
- * @param sides Available box sides to evaluate.
227
- *
228
- * @return Whether values are mixed.
229
- */
230
- function isValuesMixed(values = {}, selectedUnits, sides = ALL_SIDES) {
231
- const allValue = getAllValue(values, selectedUnits, sides);
232
- const isMixed = isNaN(parseFloat(allValue));
233
- return isMixed;
234
- }
235
-
236
211
  /**
237
212
  * Checks to determine if values are defined.
238
213
  *
@@ -293,6 +268,8 @@ function normalizeSides(sides) {
293
268
  * Applies a value to an object representing top, right, bottom and left sides
294
269
  * while taking into account any custom side configuration.
295
270
  *
271
+ * @deprecated
272
+ *
296
273
  * @param currentValues The current values for each side.
297
274
  * @param newValue The value to apply to the sides object.
298
275
  * @param sides Array defining valid sides.
@@ -300,6 +277,10 @@ function normalizeSides(sides) {
300
277
  * @return Object containing the updated values for each side.
301
278
  */
302
279
  function applyValueToSides(currentValues, newValue, sides) {
280
+ (0, _deprecated.default)('applyValueToSides', {
281
+ since: '6.8',
282
+ version: '7.0'
283
+ });
303
284
  const newValues = {
304
285
  ...currentValues
305
286
  };
@@ -320,4 +301,26 @@ function applyValueToSides(currentValues, newValue, sides) {
320
301
  }
321
302
  return newValues;
322
303
  }
304
+
305
+ /**
306
+ * Return the allowed sides based on the sides configuration.
307
+ *
308
+ * @param sides Sides configuration.
309
+ * @return Allowed sides.
310
+ */
311
+ function getAllowedSides(sides) {
312
+ const allowedSides = new Set(!sides ? ALL_SIDES : []);
313
+ sides?.forEach(allowedSide => {
314
+ if (allowedSide === 'vertical') {
315
+ allowedSides.add('top');
316
+ allowedSides.add('bottom');
317
+ } else if (allowedSide === 'horizontal') {
318
+ allowedSides.add('right');
319
+ allowedSides.add('left');
320
+ } else {
321
+ allowedSides.add(allowedSide);
322
+ }
323
+ });
324
+ return allowedSides;
325
+ }
323
326
  //# sourceMappingURL=utils.js.map