@wordpress/components 25.15.0 → 25.16.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 (236) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/build/border-box-control/border-box-control/component.js.map +1 -1
  3. package/build/border-box-control/border-box-control/hook.js +3 -1
  4. package/build/border-box-control/border-box-control/hook.js.map +1 -1
  5. package/build/border-box-control/types.js.map +1 -1
  6. package/build/border-control/border-control/component.js +5 -1
  7. package/build/border-control/border-control/component.js.map +1 -1
  8. package/build/border-control/border-control/hook.js +18 -15
  9. package/build/border-control/border-control/hook.js.map +1 -1
  10. package/build/border-control/border-control-dropdown/component.js +2 -1
  11. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  12. package/build/border-control/border-control-style-picker/component.js +21 -49
  13. package/build/border-control/border-control-style-picker/component.js.map +1 -1
  14. package/build/border-control/styles.js +15 -27
  15. package/build/border-control/styles.js.map +1 -1
  16. package/build/border-control/types.js.map +1 -1
  17. package/build/box-control/all-input-control.js +35 -29
  18. package/build/box-control/all-input-control.js.map +1 -1
  19. package/build/box-control/axial-input-controls.js +40 -54
  20. package/build/box-control/axial-input-controls.js.map +1 -1
  21. package/build/box-control/index.js +21 -24
  22. package/build/box-control/index.js.map +1 -1
  23. package/build/box-control/input-controls.js +45 -37
  24. package/build/box-control/input-controls.js.map +1 -1
  25. package/build/box-control/styles/box-control-styles.js +50 -112
  26. package/build/box-control/styles/box-control-styles.js.map +1 -1
  27. package/build/box-control/types.js.map +1 -1
  28. package/build/box-control/utils.js +123 -8
  29. package/build/box-control/utils.js.map +1 -1
  30. package/build/button/index.js +14 -16
  31. package/build/button/index.js.map +1 -1
  32. package/build/button/types.js.map +1 -1
  33. package/build/color-palette/index.native.js +11 -7
  34. package/build/color-palette/index.native.js.map +1 -1
  35. package/build/color-picker/hsl-input.js +55 -33
  36. package/build/color-picker/hsl-input.js.map +1 -1
  37. package/build/custom-select-control-v2/index.js +3 -2
  38. package/build/custom-select-control-v2/index.js.map +1 -1
  39. package/build/mobile/color-settings/palette.screen.native.js +8 -4
  40. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  41. package/build/slot-fill/bubbles-virtually/use-slot-fills.js +1 -1
  42. package/build/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -1
  43. package/build/theme/styles.js +11 -6
  44. package/build/theme/styles.js.map +1 -1
  45. package/build/toggle-group-control/toggle-group-control/utils.js +7 -1
  46. package/build/toggle-group-control/toggle-group-control/utils.js.map +1 -1
  47. package/build/tooltip/index.js +35 -8
  48. package/build/tooltip/index.js.map +1 -1
  49. package/build/tooltip/types.js.map +1 -1
  50. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  51. package/build-module/border-box-control/border-box-control/hook.js +3 -1
  52. package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
  53. package/build-module/border-box-control/types.js.map +1 -1
  54. package/build-module/border-control/border-control/component.js +5 -1
  55. package/build-module/border-control/border-control/component.js.map +1 -1
  56. package/build-module/border-control/border-control/hook.js +18 -15
  57. package/build-module/border-control/border-control/hook.js.map +1 -1
  58. package/build-module/border-control/border-control-dropdown/component.js +2 -1
  59. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  60. package/build-module/border-control/border-control-style-picker/component.js +21 -48
  61. package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
  62. package/build-module/border-control/styles.js +14 -24
  63. package/build-module/border-control/styles.js.map +1 -1
  64. package/build-module/border-control/types.js.map +1 -1
  65. package/build-module/box-control/all-input-control.js +38 -28
  66. package/build-module/box-control/all-input-control.js.map +1 -1
  67. package/build-module/box-control/axial-input-controls.js +42 -57
  68. package/build-module/box-control/axial-input-controls.js.map +1 -1
  69. package/build-module/box-control/index.js +22 -25
  70. package/build-module/box-control/index.js.map +1 -1
  71. package/build-module/box-control/input-controls.js +47 -40
  72. package/build-module/box-control/input-controls.js.map +1 -1
  73. package/build-module/box-control/styles/box-control-styles.js +45 -105
  74. package/build-module/box-control/styles/box-control-styles.js.map +1 -1
  75. package/build-module/box-control/types.js.map +1 -1
  76. package/build-module/box-control/utils.js +121 -7
  77. package/build-module/box-control/utils.js.map +1 -1
  78. package/build-module/button/index.js +14 -16
  79. package/build-module/button/index.js.map +1 -1
  80. package/build-module/button/types.js.map +1 -1
  81. package/build-module/color-palette/index.native.js +11 -7
  82. package/build-module/color-palette/index.native.js.map +1 -1
  83. package/build-module/color-picker/hsl-input.js +55 -33
  84. package/build-module/color-picker/hsl-input.js.map +1 -1
  85. package/build-module/custom-select-control-v2/index.js +3 -2
  86. package/build-module/custom-select-control-v2/index.js.map +1 -1
  87. package/build-module/mobile/color-settings/palette.screen.native.js +8 -4
  88. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  89. package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js +1 -1
  90. package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -1
  91. package/build-module/theme/styles.js +11 -2
  92. package/build-module/theme/styles.js.map +1 -1
  93. package/build-module/toggle-group-control/toggle-group-control/utils.js +7 -1
  94. package/build-module/toggle-group-control/toggle-group-control/utils.js.map +1 -1
  95. package/build-module/tooltip/index.js +34 -9
  96. package/build-module/tooltip/index.js.map +1 -1
  97. package/build-module/tooltip/types.js.map +1 -1
  98. package/build-style/style-rtl.css +6 -4
  99. package/build-style/style.css +6 -4
  100. package/build-types/border-box-control/border-box-control/component.d.ts +1 -0
  101. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  102. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  103. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +3 -3
  104. package/build-types/border-box-control/stories/index.story.d.ts +2 -1
  105. package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
  106. package/build-types/border-box-control/types.d.ts +6 -0
  107. package/build-types/border-box-control/types.d.ts.map +1 -1
  108. package/build-types/border-control/border-control/component.d.ts +1 -0
  109. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  110. package/build-types/border-control/border-control/hook.d.ts +2 -0
  111. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  112. package/build-types/border-control/border-control-dropdown/component.d.ts +1 -0
  113. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  114. package/build-types/border-control/border-control-dropdown/hook.d.ts +1 -0
  115. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  116. package/build-types/border-control/border-control-style-picker/component.d.ts +3 -4
  117. package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
  118. package/build-types/border-control/stories/index.story.d.ts +12 -6
  119. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  120. package/build-types/border-control/styles.d.ts +0 -2
  121. package/build-types/border-control/styles.d.ts.map +1 -1
  122. package/build-types/border-control/types.d.ts +12 -1
  123. package/build-types/border-control/types.d.ts.map +1 -1
  124. package/build-types/box-control/all-input-control.d.ts +1 -1
  125. package/build-types/box-control/all-input-control.d.ts.map +1 -1
  126. package/build-types/box-control/axial-input-controls.d.ts +1 -1
  127. package/build-types/box-control/axial-input-controls.d.ts.map +1 -1
  128. package/build-types/box-control/index.d.ts +1 -1
  129. package/build-types/box-control/index.d.ts.map +1 -1
  130. package/build-types/box-control/input-controls.d.ts +1 -1
  131. package/build-types/box-control/input-controls.d.ts.map +1 -1
  132. package/build-types/box-control/stories/index.story.d.ts +24 -18
  133. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  134. package/build-types/box-control/styles/box-control-styles.d.ts +49 -23
  135. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  136. package/build-types/box-control/types.d.ts +12 -12
  137. package/build-types/box-control/types.d.ts.map +1 -1
  138. package/build-types/box-control/utils.d.ts +2 -1
  139. package/build-types/box-control/utils.d.ts.map +1 -1
  140. package/build-types/button/deprecated.d.ts +1 -1
  141. package/build-types/button/index.d.ts.map +1 -1
  142. package/build-types/button/types.d.ts +7 -3
  143. package/build-types/button/types.d.ts.map +1 -1
  144. package/build-types/color-picker/hsl-input.d.ts.map +1 -1
  145. package/build-types/color-picker/styles.d.ts +1 -1
  146. package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
  147. package/build-types/date-time/time/styles.d.ts +4 -4
  148. package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
  149. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  150. package/build-types/navigation/styles/navigation-styles.d.ts +1 -1
  151. package/build-types/navigator/navigator-back-button/hook.d.ts +2 -2
  152. package/build-types/navigator/navigator-button/hook.d.ts +2 -2
  153. package/build-types/number-control/index.d.ts +1 -1
  154. package/build-types/number-control/stories/index.story.d.ts +1 -1
  155. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  156. package/build-types/search-control/index.d.ts +1 -1
  157. package/build-types/search-control/stories/index.story.d.ts +2 -2
  158. package/build-types/text-control/index.d.ts +1 -1
  159. package/build-types/textarea-control/index.d.ts +1 -1
  160. package/build-types/theme/styles.d.ts.map +1 -1
  161. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +1 -1
  162. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +1 -1
  163. package/build-types/toggle-group-control/toggle-group-control/utils.d.ts.map +1 -1
  164. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +1 -1
  165. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
  166. package/build-types/toolbar/toolbar-button/index.d.ts +1 -1
  167. package/build-types/tooltip/index.d.ts +1 -1
  168. package/build-types/tooltip/index.d.ts.map +1 -1
  169. package/build-types/tooltip/stories/index.story.d.ts +10 -1
  170. package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
  171. package/build-types/tooltip/types.d.ts +3 -0
  172. package/build-types/tooltip/types.d.ts.map +1 -1
  173. package/build-types/unit-control/index.d.ts +1 -1
  174. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  175. package/package.json +19 -19
  176. package/src/border-box-control/border-box-control/component.tsx +0 -1
  177. package/src/border-box-control/border-box-control/hook.ts +5 -1
  178. package/src/border-box-control/types.ts +6 -0
  179. package/src/border-control/border-control/component.tsx +4 -0
  180. package/src/border-control/border-control/hook.ts +22 -16
  181. package/src/border-control/border-control-dropdown/component.tsx +2 -1
  182. package/src/border-control/border-control-style-picker/component.tsx +31 -66
  183. package/src/border-control/styles.ts +0 -15
  184. package/src/border-control/types.ts +15 -1
  185. package/src/box-control/all-input-control.tsx +57 -34
  186. package/src/box-control/axial-input-controls.tsx +79 -69
  187. package/src/box-control/index.tsx +47 -54
  188. package/src/box-control/input-controls.tsx +114 -83
  189. package/src/box-control/styles/box-control-styles.ts +21 -61
  190. package/src/box-control/test/index.tsx +126 -18
  191. package/src/box-control/types.ts +10 -21
  192. package/src/box-control/utils.ts +43 -8
  193. package/src/button/README.md +1 -1
  194. package/src/button/index.tsx +21 -33
  195. package/src/button/test/index.tsx +122 -0
  196. package/src/button/types.ts +7 -3
  197. package/src/circular-option-picker/test/index.tsx +10 -16
  198. package/src/color-palette/index.native.js +18 -7
  199. package/src/color-picker/hsl-input.tsx +56 -30
  200. package/src/color-picker/test/index.tsx +190 -16
  201. package/src/custom-select-control-v2/index.tsx +5 -2
  202. package/src/mobile/color-settings/palette.screen.native.js +7 -5
  203. package/src/palette-edit/test/index.tsx +326 -10
  204. package/src/slot-fill/bubbles-virtually/use-slot-fills.ts +1 -1
  205. package/src/tabs/test/index.tsx +3 -1
  206. package/src/theme/styles.ts +3 -1
  207. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +6 -6
  208. package/src/toggle-group-control/test/index.tsx +73 -36
  209. package/src/toggle-group-control/toggle-group-control/utils.ts +8 -3
  210. package/src/tooltip/README.md +4 -0
  211. package/src/tooltip/index.tsx +46 -8
  212. package/src/tooltip/stories/index.story.tsx +18 -1
  213. package/src/tooltip/test/index.tsx +77 -12
  214. package/src/tooltip/types.ts +4 -0
  215. package/tsconfig.tsbuildinfo +1 -1
  216. package/build/border-control/border-control-style-picker/hook.js +0 -41
  217. package/build/border-control/border-control-style-picker/hook.js.map +0 -1
  218. package/build/box-control/styles/box-control-visualizer-styles.js +0 -93
  219. package/build/box-control/styles/box-control-visualizer-styles.js.map +0 -1
  220. package/build/box-control/unit-control.js +0 -76
  221. package/build/box-control/unit-control.js.map +0 -1
  222. package/build-module/border-control/border-control-style-picker/hook.js +0 -32
  223. package/build-module/border-control/border-control-style-picker/hook.js.map +0 -1
  224. package/build-module/box-control/styles/box-control-visualizer-styles.js +0 -86
  225. package/build-module/box-control/styles/box-control-visualizer-styles.js.map +0 -1
  226. package/build-module/box-control/unit-control.js +0 -68
  227. package/build-module/box-control/unit-control.js.map +0 -1
  228. package/build-types/border-control/border-control-style-picker/hook.d.ts +0 -267
  229. package/build-types/border-control/border-control-style-picker/hook.d.ts.map +0 -1
  230. package/build-types/box-control/styles/box-control-visualizer-styles.d.ts +0 -46
  231. package/build-types/box-control/styles/box-control-visualizer-styles.d.ts.map +0 -1
  232. package/build-types/box-control/unit-control.d.ts +0 -4
  233. package/build-types/box-control/unit-control.d.ts.map +0 -1
  234. package/src/border-control/border-control-style-picker/hook.ts +0 -35
  235. package/src/box-control/styles/box-control-visualizer-styles.ts +0 -75
  236. package/src/box-control/unit-control.tsx +0 -74
@@ -1 +1 @@
1
- {"version":3,"names":["css","COLORS","CONFIG","boxSizingReset","rtl","space","StyledLabel","ValueInput","UnitControlWrapper","UnitSelect","labelStyles","process","env","NODE_ENV","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","focusBoxShadow","controlBoxShadowFocus","borderControl","innerWrapper","wrapperWidth","wrapperHeight","size","borderControlDropdown","borderRadius","borderWidth","ui","border","borderFocus","colorIndicatorBorder","color","style","fallbackColor","gray","undefined","colorIndicatorWrapper","swatchSize","swatchGap","borderControlPopoverControls","borderControlPopoverContent","borderColorIndicator","resetButton","borderControlStylePicker","borderStyleButton","borderSlider","marginRight"],"sources":["@wordpress/components/src/border-control/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * Internal dependencies\n */\nimport { COLORS, CONFIG, boxSizingReset, rtl } from '../utils';\nimport { space } from '../utils/space';\nimport { StyledLabel } from '../base-control/styles/base-control-styles';\nimport {\n\tValueInput as UnitControlWrapper,\n\tUnitSelect,\n} from '../unit-control/styles/unit-control-styles';\n\nimport type { Border } from './types';\n\nconst labelStyles = css`\n\tfont-weight: 500;\n`;\n\nconst focusBoxShadow = css`\n\tbox-shadow: inset ${ CONFIG.controlBoxShadowFocus };\n`;\n\nexport const borderControl = css`\n\tborder: 0;\n\tpadding: 0;\n\tmargin: 0;\n\t${ boxSizingReset }\n`;\n\nexport const innerWrapper = () => css`\n\t${ UnitControlWrapper } {\n\t\tflex: 1 1 40%;\n\t}\n\t&& ${ UnitSelect } {\n\t\t/* Prevent unit select forcing min height larger than its UnitControl */\n\t\tmin-height: 0;\n\t}\n`;\n\n/*\n * This style is only applied to the UnitControl wrapper when the border width\n * field should be a set width. Omitting this allows the UnitControl &\n * RangeControl to share the available width in a 40/60 split respectively.\n */\nexport const wrapperWidth = css`\n\t${ UnitControlWrapper } {\n\t\t/* Force the UnitControl's set width. */\n\t\tflex: 0 0 auto;\n\t}\n`;\n\nexport const wrapperHeight = ( size?: 'default' | '__unstable-large' ) => {\n\treturn css`\n\t\theight: ${ size === '__unstable-large' ? '40px' : '30px' };\n\t`;\n};\n\nexport const borderControlDropdown = css`\n\tbackground: #fff;\n\n\t&& > button {\n\t\taspect-ratio: 1;\n\t\tpadding: 0;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\t${ rtl(\n\t\t\t{ borderRadius: `2px 0 0 2px` },\n\t\t\t{ borderRadius: `0 2px 2px 0` }\n\t\t)() }\n\t\tborder: ${ CONFIG.borderWidth } solid ${ COLORS.ui.border };\n\n\t\t&:focus,\n\t\t&:hover:not( :disabled ) {\n\t\t\t${ focusBoxShadow }\n\t\t\tborder-color: ${ COLORS.ui.borderFocus };\n\t\t\tz-index: 1;\n\t\t\tposition: relative;\n\t\t}\n\t}\n`;\n\nexport const colorIndicatorBorder = ( border?: Border ) => {\n\tconst { color, style } = border || {};\n\n\tconst fallbackColor =\n\t\t!! style && style !== 'none' ? COLORS.gray[ 300 ] : undefined;\n\n\treturn css`\n\t\tborder-style: ${ style === 'none' ? 'solid' : style };\n\t\tborder-color: ${ color || fallbackColor };\n\t`;\n};\n\nexport const colorIndicatorWrapper = (\n\tborder?: Border,\n\tsize?: 'default' | '__unstable-large'\n) => {\n\tconst { style } = border || {};\n\n\treturn css`\n\t\tborder-radius: 9999px;\n\t\tborder: 2px solid transparent;\n\t\t${ style ? colorIndicatorBorder( border ) : undefined }\n\t\twidth: ${ size === '__unstable-large' ? '24px' : '22px' };\n\t\theight: ${ size === '__unstable-large' ? '24px' : '22px' };\n\t\tpadding: ${ size === '__unstable-large' ? '2px' : '1px' };\n\n\t\t/*\n\t\t * ColorIndicator\n\t\t *\n\t\t * The transparent colors used here ensure visibility of the indicator\n\t\t * over the active state of the border control dropdown's toggle button.\n\t\t */\n\t\t& > span {\n\t\t\theight: ${ space( 4 ) };\n\t\t\twidth: ${ space( 4 ) };\n\t\t\tbackground: linear-gradient(\n\t\t\t\t-45deg,\n\t\t\t\ttransparent 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 52%,\n\t\t\t\ttransparent 52%\n\t\t\t);\n\t\t}\n\t`;\n};\n\n// Must equal $color-palette-circle-size from:\n// @wordpress/components/src/circular-option-picker/style.scss\nconst swatchSize = 28;\nconst swatchGap = 12;\n\nexport const borderControlPopoverControls = css`\n\twidth: ${ swatchSize * 6 + swatchGap * 5 }px;\n\n\t> div:first-of-type > ${ StyledLabel } {\n\t\tmargin-bottom: 0;\n\t\t${ labelStyles }\n\t}\n\n\t&& ${ StyledLabel } + button:not( .has-text ) {\n\t\tmin-width: 24px;\n\t\tpadding: 0;\n\t}\n`;\n\nexport const borderControlPopoverContent = css``;\nexport const borderColorIndicator = css``;\n\nexport const resetButton = css`\n\tjustify-content: center;\n\twidth: 100%;\n\n\t/* Override button component styling */\n\t&& {\n\t\tborder-top: ${ CONFIG.borderWidth } solid ${ COLORS.gray[ 400 ] };\n\t\tborder-top-left-radius: 0;\n\t\tborder-top-right-radius: 0;\n\t\theight: 40px;\n\t}\n`;\n\nexport const borderControlStylePicker = css`\n\t${ StyledLabel } {\n\t\t${ labelStyles }\n\t}\n`;\n\nexport const borderStyleButton = css`\n\t&&&&& {\n\t\tmin-width: 32px;\n\t\twidth: 32px;\n\t\theight: 32px;\n\t\tpadding: 4px;\n\t}\n`;\n\nexport const borderSlider = () => css`\n\tflex: 1 1 60%;\n\t${ rtl( { marginRight: space( 3 ) } )() }\n`;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,GAAG,QAAQ,gBAAgB;;AAEpC;AACA;AACA;AACA,SAASC,MAAM,EAAEC,MAAM,EAAEC,cAAc,EAAEC,GAAG,QAAQ,UAAU;AAC9D,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,WAAW,QAAQ,4CAA4C;AACxE,SACCC,UAAU,IAAIC,kBAAkB,EAChCC,UAAU,QACJ,4CAA4C;AAInD,MAAMC,WAAW,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,GAAA;EAAAC,QAAA,EAAAC;AAAA,CAEhB;AAED,MAAMC,cAAc,gBAAGnB,GAAG,sBACJE,MAAM,CAACkB,qBAAqB,SAAAT,OAAA,CAAAC,GAAA,CAAAC,QAAA,oDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,2vMACjD;AAED,OAAO,MAAMQ,aAAa,gBAAGrB,GAAG,iCAI5BG,cAAc,SAAAQ,OAAA,CAAAC,GAAA,CAAAC,QAAA,mDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,2vMACjB;AAED,OAAO,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AAA,2vMAAE;AAEzC,OAAO,MAAM+B,WAAW,gBAAG5C,GAAG,qDAMbE,MAAM,CAAC0B,WAAW,aAAY3B,MAAM,CAACmC,IAAI,CAAE,GAAG,CAAE,yEAAAzB,OAAA,CAAAC,GAAA,CAAAC,QAAA,iDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,2vMAKhE;AAED,OAAO,MAAMgC,wBAAwB,gBAAG7C,GAAG,CACvCM,WAAW,OACVI,WAAW,UAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,8DAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,2vMAEf;AAED,OAAO,MAAMiC,iBAAiB,GAAAnC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,GAAA;EAAAC,QAAA,EAAAC;AAAA,CAO7B;AAED,OAAO,MAAM6B,YAAY,GAAGA,CAAA,kBAAM/C,GAAG,kBAEjCI,GAAG,CAAE;EAAE4C,WAAW,EAAE3C,KAAK,CAAE,CAAE;AAAE,CAAE,CAAC,CAAC,CAAC,SAAAM,OAAA,CAAAC,GAAA,CAAAC,QAAA,kDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,2vMACvC"}
1
+ {"version":3,"names":["css","COLORS","CONFIG","boxSizingReset","rtl","space","StyledLabel","ValueInput","UnitControlWrapper","UnitSelect","labelStyles","process","env","NODE_ENV","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","focusBoxShadow","controlBoxShadowFocus","borderControl","innerWrapper","wrapperWidth","wrapperHeight","size","borderControlDropdown","borderRadius","borderWidth","ui","border","borderFocus","colorIndicatorBorder","color","style","fallbackColor","gray","undefined","colorIndicatorWrapper","swatchSize","swatchGap","borderControlPopoverControls","borderControlPopoverContent","borderColorIndicator","resetButton","borderSlider","marginRight"],"sources":["@wordpress/components/src/border-control/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * Internal dependencies\n */\nimport { COLORS, CONFIG, boxSizingReset, rtl } from '../utils';\nimport { space } from '../utils/space';\nimport { StyledLabel } from '../base-control/styles/base-control-styles';\nimport {\n\tValueInput as UnitControlWrapper,\n\tUnitSelect,\n} from '../unit-control/styles/unit-control-styles';\n\nimport type { Border } from './types';\n\nconst labelStyles = css`\n\tfont-weight: 500;\n`;\n\nconst focusBoxShadow = css`\n\tbox-shadow: inset ${ CONFIG.controlBoxShadowFocus };\n`;\n\nexport const borderControl = css`\n\tborder: 0;\n\tpadding: 0;\n\tmargin: 0;\n\t${ boxSizingReset }\n`;\n\nexport const innerWrapper = () => css`\n\t${ UnitControlWrapper } {\n\t\tflex: 1 1 40%;\n\t}\n\t&& ${ UnitSelect } {\n\t\t/* Prevent unit select forcing min height larger than its UnitControl */\n\t\tmin-height: 0;\n\t}\n`;\n\n/*\n * This style is only applied to the UnitControl wrapper when the border width\n * field should be a set width. Omitting this allows the UnitControl &\n * RangeControl to share the available width in a 40/60 split respectively.\n */\nexport const wrapperWidth = css`\n\t${ UnitControlWrapper } {\n\t\t/* Force the UnitControl's set width. */\n\t\tflex: 0 0 auto;\n\t}\n`;\n\nexport const wrapperHeight = ( size?: 'default' | '__unstable-large' ) => {\n\treturn css`\n\t\theight: ${ size === '__unstable-large' ? '40px' : '30px' };\n\t`;\n};\n\nexport const borderControlDropdown = css`\n\tbackground: #fff;\n\n\t&& > button {\n\t\taspect-ratio: 1;\n\t\tpadding: 0;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\t${ rtl(\n\t\t\t{ borderRadius: `2px 0 0 2px` },\n\t\t\t{ borderRadius: `0 2px 2px 0` }\n\t\t)() }\n\t\tborder: ${ CONFIG.borderWidth } solid ${ COLORS.ui.border };\n\n\t\t&:focus,\n\t\t&:hover:not( :disabled ) {\n\t\t\t${ focusBoxShadow }\n\t\t\tborder-color: ${ COLORS.ui.borderFocus };\n\t\t\tz-index: 1;\n\t\t\tposition: relative;\n\t\t}\n\t}\n`;\n\nexport const colorIndicatorBorder = ( border?: Border ) => {\n\tconst { color, style } = border || {};\n\n\tconst fallbackColor =\n\t\t!! style && style !== 'none' ? COLORS.gray[ 300 ] : undefined;\n\n\treturn css`\n\t\tborder-style: ${ style === 'none' ? 'solid' : style };\n\t\tborder-color: ${ color || fallbackColor };\n\t`;\n};\n\nexport const colorIndicatorWrapper = (\n\tborder?: Border,\n\tsize?: 'default' | '__unstable-large'\n) => {\n\tconst { style } = border || {};\n\n\treturn css`\n\t\tborder-radius: 9999px;\n\t\tborder: 2px solid transparent;\n\t\t${ style ? colorIndicatorBorder( border ) : undefined }\n\t\twidth: ${ size === '__unstable-large' ? '24px' : '22px' };\n\t\theight: ${ size === '__unstable-large' ? '24px' : '22px' };\n\t\tpadding: ${ size === '__unstable-large' ? '2px' : '1px' };\n\n\t\t/*\n\t\t * ColorIndicator\n\t\t *\n\t\t * The transparent colors used here ensure visibility of the indicator\n\t\t * over the active state of the border control dropdown's toggle button.\n\t\t */\n\t\t& > span {\n\t\t\theight: ${ space( 4 ) };\n\t\t\twidth: ${ space( 4 ) };\n\t\t\tbackground: linear-gradient(\n\t\t\t\t-45deg,\n\t\t\t\ttransparent 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 52%,\n\t\t\t\ttransparent 52%\n\t\t\t);\n\t\t}\n\t`;\n};\n\n// Must equal $color-palette-circle-size from:\n// @wordpress/components/src/circular-option-picker/style.scss\nconst swatchSize = 28;\nconst swatchGap = 12;\n\nexport const borderControlPopoverControls = css`\n\twidth: ${ swatchSize * 6 + swatchGap * 5 }px;\n\n\t> div:first-of-type > ${ StyledLabel } {\n\t\tmargin-bottom: 0;\n\t\t${ labelStyles }\n\t}\n\n\t&& ${ StyledLabel } + button:not( .has-text ) {\n\t\tmin-width: 24px;\n\t\tpadding: 0;\n\t}\n`;\n\nexport const borderControlPopoverContent = css``;\nexport const borderColorIndicator = css``;\n\nexport const resetButton = css`\n\tjustify-content: center;\n\twidth: 100%;\n\n\t/* Override button component styling */\n\t&& {\n\t\tborder-top: ${ CONFIG.borderWidth } solid ${ COLORS.gray[ 400 ] };\n\t\tborder-top-left-radius: 0;\n\t\tborder-top-right-radius: 0;\n\t\theight: 40px;\n\t}\n`;\n\nexport const borderSlider = () => css`\n\tflex: 1 1 60%;\n\t${ rtl( { marginRight: space( 3 ) } )() }\n`;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,GAAG,QAAQ,gBAAgB;;AAEpC;AACA;AACA;AACA,SAASC,MAAM,EAAEC,MAAM,EAAEC,cAAc,EAAEC,GAAG,QAAQ,UAAU;AAC9D,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,WAAW,QAAQ,4CAA4C;AACxE,SACCC,UAAU,IAAIC,kBAAkB,EAChCC,UAAU,QACJ,4CAA4C;AAInD,MAAMC,WAAW,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,GAAA;EAAAC,QAAA,EAAAC;AAAA,CAEhB;AAED,MAAMC,cAAc,gBAAGnB,GAAG,sBACJE,MAAM,CAACkB,qBAAqB,SAAAT,OAAA,CAAAC,GAAA,CAAAC,QAAA,oDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,27LACjD;AAED,OAAO,MAAMQ,aAAa,gBAAGrB,GAAG,iCAI5BG,cAAc,SAAAQ,OAAA,CAAAC,GAAA,CAAAC,QAAA,mDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,27LACjB;AAED,OAAO,MAAMS,YAAY,GAAGA,CAAA,kBAAMtB,GAAG,CACjCQ,kBAAkB,wBAGfC,UAAU,uBAAAE,OAAA,CAAAC,GAAA,CAAAC,QAAA,kDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,27LAIhB;;AAED;AACA;AACA;AACA;AACA;AACA,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CAAAC,QAAA,27LAKhE;AAED,OAAO,MAAMgC,YAAY,GAAGA,CAAA,kBAAM7C,GAAG,kBAEjCI,GAAG,CAAE;EAAE0C,WAAW,EAAEzC,KAAK,CAAE,CAAE;AAAE,CAAE,CAAC,CAAC,CAAC,SAAAM,OAAA,CAAAC,GAAA,CAAAC,QAAA,kDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,27LACvC"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/border-control/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { ColorPaletteProps } from '../color-palette/types';\nimport type { PopoverProps } from '../popover/types';\n\nexport type Border = {\n\tcolor?: CSSProperties[ 'borderColor' ];\n\tstyle?: CSSProperties[ 'borderStyle' ];\n\twidth?: CSSProperties[ 'borderWidth' ];\n};\n\nexport type ColorProps = Pick<\n\tColorPaletteProps,\n\t'colors' | 'enableAlpha' | '__experimentalIsRenderedInSidebar'\n> & {\n\t/**\n\t * This toggles the ability to choose custom colors.\n\t */\n\tdisableCustomColors?: boolean;\n};\n\nexport type LabelProps = {\n\t/**\n\t * Provides control over whether the label will only be visible to\n\t * screen readers.\n\t */\n\thideLabelFromVision?: boolean;\n\t/**\n\t * If provided, a label will be generated using this as the content.\n\t */\n\tlabel?: string;\n};\n\nexport type BorderControlProps = ColorProps &\n\tLabelProps & {\n\t\t/**\n\t\t * This controls whether unit selection should be disabled.\n\t\t */\n\t\tdisableUnits?: boolean;\n\t\t/**\n\t\t * This controls whether to support border style selection.\n\t\t *\n\t\t * @default true\n\t\t */\n\t\tenableStyle?: boolean;\n\t\t/**\n\t\t * This flags the `BorderControl` to render with a more compact\n\t\t * appearance. It restricts the width of the control and prevents it\n\t\t * from expanding to take up additional space.\n\t\t */\n\t\tisCompact?: boolean;\n\t\t/**\n\t\t * A callback function invoked when the border value is changed via an\n\t\t * interaction that selects or clears, border color, style, or width.\n\t\t */\n\t\tonChange: ( value?: Border ) => void;\n\t\t/**\n\t\t * An internal prop used to control the visibility of the dropdown.\n\t\t */\n\t\t__unstablePopoverProps?: Omit< PopoverProps, 'children' >;\n\t\t/**\n\t\t * If opted into, sanitizing the border means that if no width or color\n\t\t * have been selected, the border style is also cleared and `undefined`\n\t\t * is returned as the new border value.\n\t\t *\n\t\t * @default true\n\t\t */\n\t\tshouldSanitizeBorder?: boolean;\n\t\t/**\n\t\t * Whether or not to show the header for the border color and style\n\t\t * picker dropdown. The header includes a label for the color picker\n\t\t * and a close button.\n\t\t */\n\t\tshowDropdownHeader?: boolean;\n\t\t/**\n\t\t * Size of the control.\n\t\t *\n\t\t * @default 'default'\n\t\t */\n\t\tsize?: 'default' | '__unstable-large';\n\t\t/**\n\t\t * An object representing a border or `undefined`. Used to set the\n\t\t * current border configuration for this component.\n\t\t */\n\t\tvalue?: Border;\n\t\t/**\n\t\t * Controls the visual width of the `BorderControl`. It has no effect if\n\t\t * the `isCompact` prop is set to `true`.\n\t\t */\n\t\twidth?: CSSProperties[ 'width' ];\n\t\t/**\n\t\t * Flags whether this `BorderControl` should also render a\n\t\t * `RangeControl` for additional control over a border's width.\n\t\t */\n\t\twithSlider?: boolean;\n\t};\n\nexport type DropdownProps = ColorProps &\n\tPick< BorderControlProps, 'enableStyle' | 'size' > & {\n\t\t/**\n\t\t * An object representing a border or `undefined`. This component will\n\t\t * extract the border color and style selections from this object to use as\n\t\t * values for its popover controls.\n\t\t */\n\t\tborder?: Border;\n\t\t/**\n\t\t * An internal prop used to control the visibility of the dropdown.\n\t\t */\n\t\t__unstablePopoverProps?: Omit< PopoverProps, 'children' >;\n\t\t/**\n\t\t * A callback invoked when the border color or style selections change.\n\t\t */\n\t\tonChange: ( newBorder?: Border ) => void;\n\t\t/**\n\t\t * Any previous style selection made by the user. This can be used to\n\t\t * reapply that previous selection when, for example, a zero border width is\n\t\t * to a non-zero value.\n\t\t */\n\t\tpreviousStyleSelection?: string;\n\t\t/**\n\t\t * Whether or not to render a header for the border color and style picker\n\t\t * dropdown. The header includes a label for the color picker and a\n\t\t * close button.\n\t\t */\n\t\tshowDropdownHeader?: boolean;\n\t};\n\nexport type StylePickerProps = LabelProps & {\n\t/**\n\t * A callback function invoked when a border style is selected or cleared.\n\t */\n\tonChange: ( style?: string ) => void;\n\t/**\n\t * The currently selected border style if there is one. Styles available via\n\t * this control are `solid`, `dashed` & `dotted`, however the possibility\n\t * to store other valid CSS values is maintained e.g. `none`, `inherit` etc.\n\t */\n\tvalue?: string;\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/border-control/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { ColorPaletteProps } from '../color-palette/types';\nimport type { PopoverProps } from '../popover/types';\nimport type { ToggleGroupControlProps } from '../toggle-group-control/types';\n\nexport type Border = {\n\tcolor?: CSSProperties[ 'borderColor' ];\n\tstyle?: CSSProperties[ 'borderStyle' ];\n\twidth?: CSSProperties[ 'borderWidth' ];\n};\n\nexport type ColorProps = Pick<\n\tColorPaletteProps,\n\t'colors' | 'enableAlpha' | '__experimentalIsRenderedInSidebar'\n> & {\n\t/**\n\t * This toggles the ability to choose custom colors.\n\t */\n\tdisableCustomColors?: boolean;\n};\n\nexport type LabelProps = {\n\t/**\n\t * Provides control over whether the label will only be visible to\n\t * screen readers.\n\t */\n\thideLabelFromVision?: boolean;\n\t/**\n\t * If provided, a label will be generated using this as the content.\n\t */\n\tlabel?: string;\n};\n\nexport type BorderControlProps = ColorProps &\n\tLabelProps & {\n\t\t/**\n\t\t * This controls whether unit selection should be disabled.\n\t\t */\n\t\tdisableUnits?: boolean;\n\t\t/**\n\t\t * This controls whether to support border style selection.\n\t\t *\n\t\t * @default true\n\t\t */\n\t\tenableStyle?: boolean;\n\t\t/**\n\t\t * This flags the `BorderControl` to render with a more compact\n\t\t * appearance. It restricts the width of the control and prevents it\n\t\t * from expanding to take up additional space.\n\t\t */\n\t\tisCompact?: boolean;\n\t\t/**\n\t\t * A callback function invoked when the border value is changed via an\n\t\t * interaction that selects or clears, border color, style, or width.\n\t\t */\n\t\tonChange: ( value?: Border ) => void;\n\t\t/**\n\t\t * An internal prop used to control the visibility of the dropdown.\n\t\t */\n\t\t__unstablePopoverProps?: Omit< PopoverProps, 'children' >;\n\t\t/**\n\t\t * If opted into, sanitizing the border means that if no width or color\n\t\t * have been selected, the border style is also cleared and `undefined`\n\t\t * is returned as the new border value.\n\t\t *\n\t\t * @default true\n\t\t */\n\t\tshouldSanitizeBorder?: boolean;\n\t\t/**\n\t\t * Whether or not to show the header for the border color and style\n\t\t * picker dropdown. The header includes a label for the color picker\n\t\t * and a close button.\n\t\t */\n\t\tshowDropdownHeader?: boolean;\n\t\t/**\n\t\t * Size of the control.\n\t\t *\n\t\t * @default 'default'\n\t\t */\n\t\tsize?: 'default' | '__unstable-large';\n\t\t/**\n\t\t * An object representing a border or `undefined`. Used to set the\n\t\t * current border configuration for this component.\n\t\t */\n\t\tvalue?: Border;\n\t\t/**\n\t\t * Controls the visual width of the `BorderControl`. It has no effect if\n\t\t * the `isCompact` prop is set to `true`.\n\t\t */\n\t\twidth?: CSSProperties[ 'width' ];\n\t\t/**\n\t\t * Flags whether this `BorderControl` should also render a\n\t\t * `RangeControl` for additional control over a border's width.\n\t\t */\n\t\twithSlider?: boolean;\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 DropdownProps = ColorProps &\n\tPick< BorderControlProps, 'enableStyle' | 'size' > & {\n\t\t/**\n\t\t * An object representing a border or `undefined`. This component will\n\t\t * extract the border color and style selections from this object to use as\n\t\t * values for its popover controls.\n\t\t */\n\t\tborder?: Border;\n\t\t/**\n\t\t * Whether a border style can be set, based on the border sanitization settings.\n\t\t */\n\t\tisStyleSettable: boolean;\n\t\t/**\n\t\t * An internal prop used to control the visibility of the dropdown.\n\t\t */\n\t\t__unstablePopoverProps?: Omit< PopoverProps, 'children' >;\n\t\t/**\n\t\t * A callback invoked when the border color or style selections change.\n\t\t */\n\t\tonChange: ( newBorder?: Border ) => void;\n\t\t/**\n\t\t * Any previous style selection made by the user. This can be used to\n\t\t * reapply that previous selection when, for example, a zero border width is\n\t\t * to a non-zero value.\n\t\t */\n\t\tpreviousStyleSelection?: string;\n\t\t/**\n\t\t * Whether or not to render a header for the border color and style picker\n\t\t * dropdown. The header includes a label for the color picker and a\n\t\t * close button.\n\t\t */\n\t\tshowDropdownHeader?: boolean;\n\t};\n\nexport type StylePickerProps = Omit<\n\tToggleGroupControlProps,\n\t'value' | 'onChange' | 'children'\n> & {\n\t/**\n\t * A callback function invoked when a border style is selected or cleared.\n\t */\n\tonChange: ( style?: string ) => void;\n\t/**\n\t * The currently selected border style if there is one. Styles available via\n\t * this control are `solid`, `dashed` & `dotted`, however the possibility\n\t * to store other valid CSS values is maintained e.g. `none`, `inherit` etc.\n\t */\n\tvalue?: string;\n};\n"],"mappings":""}
@@ -1,37 +1,48 @@
1
1
  import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { useInstanceId } from '@wordpress/compose';
2
6
  /**
3
7
  * Internal dependencies
4
8
  */
5
9
 
6
- import UnitControl from './unit-control';
7
- import { LABELS, applyValueToSides, getAllValue, isValuesMixed, isValuesDefined } from './utils';
10
+ import { FlexedRangeControl, StyledUnitControl } from './styles/box-control-styles';
11
+ import { HStack } from '../h-stack';
12
+ import { parseQuantityAndUnitFromRawValue } from '../unit-control';
13
+ import { LABELS, applyValueToSides, getAllValue, isValuesMixed, isValuesDefined, CUSTOM_VALUE_SETTINGS } from './utils';
8
14
  const noop = () => {};
9
15
  export default function AllInputControl({
16
+ __next40pxDefaultSize,
10
17
  onChange = noop,
11
18
  onFocus = noop,
12
- onHoverOn = noop,
13
- onHoverOff = noop,
14
19
  values,
15
20
  sides,
16
21
  selectedUnits,
17
22
  setSelectedUnits,
18
23
  ...props
19
24
  }) {
25
+ var _CUSTOM_VALUE_SETTING, _CUSTOM_VALUE_SETTING2;
26
+ const inputId = useInstanceId(AllInputControl, 'box-control-input-all');
20
27
  const allValue = getAllValue(values, selectedUnits, sides);
21
28
  const hasValues = isValuesDefined(values);
22
29
  const isMixed = hasValues && isValuesMixed(values, selectedUnits, sides);
23
30
  const allPlaceholder = isMixed ? LABELS.mixed : undefined;
31
+ const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(allValue);
24
32
  const handleOnFocus = event => {
25
33
  onFocus(event, {
26
34
  side: 'all'
27
35
  });
28
36
  };
29
- const handleOnChange = next => {
37
+ const onValueChange = next => {
30
38
  const isNumeric = next !== undefined && !isNaN(parseFloat(next));
31
39
  const nextValue = isNumeric ? next : undefined;
32
40
  const nextValues = applyValueToSides(values, nextValue, sides);
33
41
  onChange(nextValues);
34
42
  };
43
+ const sliderOnChange = next => {
44
+ onValueChange(next !== undefined ? [next, parsedUnit].join('') : undefined);
45
+ };
35
46
 
36
47
  // Set selected unit so it can be used as fallback by unlinked controls
37
48
  // when individual sides do not have a value containing a unit.
@@ -39,33 +50,32 @@ export default function AllInputControl({
39
50
  const newUnits = applyValueToSides(selectedUnits, unit, sides);
40
51
  setSelectedUnits(newUnits);
41
52
  };
42
- const handleOnHoverOn = () => {
43
- onHoverOn({
44
- top: true,
45
- bottom: true,
46
- left: true,
47
- right: true
48
- });
49
- };
50
- const handleOnHoverOff = () => {
51
- onHoverOff({
52
- top: false,
53
- bottom: false,
54
- left: false,
55
- right: false
56
- });
57
- };
58
- return createElement(UnitControl, {
53
+ return createElement(HStack, null, createElement(StyledUnitControl, {
59
54
  ...props,
55
+ __next40pxDefaultSize: __next40pxDefaultSize,
56
+ className: "component-box-control__unit-control",
60
57
  disableUnits: isMixed,
61
- isOnly: true,
58
+ id: inputId,
59
+ isPressEnterToChange: true,
62
60
  value: allValue,
63
- onChange: handleOnChange,
61
+ onChange: onValueChange,
64
62
  onUnitChange: handleOnUnitChange,
65
63
  onFocus: handleOnFocus,
66
- onHoverOn: handleOnHoverOn,
67
- onHoverOff: handleOnHoverOff,
68
- placeholder: allPlaceholder
69
- });
64
+ placeholder: allPlaceholder,
65
+ label: LABELS.all,
66
+ hideLabelFromVision: true
67
+ }), createElement(FlexedRangeControl, {
68
+ __nextHasNoMarginBottom: true,
69
+ __next40pxDefaultSize: __next40pxDefaultSize,
70
+ "aria-controls": inputId,
71
+ label: LABELS.all,
72
+ hideLabelFromVision: true,
73
+ onChange: sliderOnChange,
74
+ min: 0,
75
+ max: (_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[parsedUnit !== null && parsedUnit !== void 0 ? parsedUnit : 'px']?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10,
76
+ step: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[parsedUnit !== null && parsedUnit !== void 0 ? parsedUnit : 'px']?.step) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1,
77
+ value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : 0,
78
+ withInputField: false
79
+ }));
70
80
  }
71
81
  //# sourceMappingURL=all-input-control.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["UnitControl","LABELS","applyValueToSides","getAllValue","isValuesMixed","isValuesDefined","noop","AllInputControl","onChange","onFocus","onHoverOn","onHoverOff","values","sides","selectedUnits","setSelectedUnits","props","allValue","hasValues","isMixed","allPlaceholder","mixed","undefined","handleOnFocus","event","side","handleOnChange","next","isNumeric","isNaN","parseFloat","nextValue","nextValues","handleOnUnitChange","unit","newUnits","handleOnHoverOn","top","bottom","left","right","handleOnHoverOff","createElement","disableUnits","isOnly","value","onUnitChange","placeholder"],"sources":["@wordpress/components/src/box-control/all-input-control.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { UnitControlProps } from '../unit-control/types';\nimport type { BoxControlInputControlProps } from './types';\nimport UnitControl from './unit-control';\nimport {\n\tLABELS,\n\tapplyValueToSides,\n\tgetAllValue,\n\tisValuesMixed,\n\tisValuesDefined,\n} from './utils';\n\nconst noop = () => {};\n\nexport default function AllInputControl( {\n\tonChange = noop,\n\tonFocus = noop,\n\tonHoverOn = noop,\n\tonHoverOff = noop,\n\tvalues,\n\tsides,\n\tselectedUnits,\n\tsetSelectedUnits,\n\t...props\n}: BoxControlInputControlProps ) {\n\tconst allValue = getAllValue( values, selectedUnits, sides );\n\tconst hasValues = isValuesDefined( values );\n\tconst isMixed = hasValues && isValuesMixed( values, selectedUnits, sides );\n\tconst allPlaceholder = isMixed ? LABELS.mixed : undefined;\n\n\tconst handleOnFocus: React.FocusEventHandler< HTMLInputElement > = (\n\t\tevent\n\t) => {\n\t\tonFocus( event, { side: 'all' } );\n\t};\n\n\tconst handleOnChange: UnitControlProps[ 'onChange' ] = ( next ) => {\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\t\tconst nextValues = applyValueToSides( values, nextValue, sides );\n\n\t\tonChange( nextValues );\n\t};\n\n\t// Set selected unit so it can be used as fallback by unlinked controls\n\t// when individual sides do not have a value containing a unit.\n\tconst handleOnUnitChange: UnitControlProps[ 'onUnitChange' ] = ( unit ) => {\n\t\tconst newUnits = applyValueToSides( selectedUnits, unit, sides );\n\t\tsetSelectedUnits( newUnits );\n\t};\n\n\tconst handleOnHoverOn = () => {\n\t\tonHoverOn( {\n\t\t\ttop: true,\n\t\t\tbottom: true,\n\t\t\tleft: true,\n\t\t\tright: true,\n\t\t} );\n\t};\n\n\tconst handleOnHoverOff = () => {\n\t\tonHoverOff( {\n\t\t\ttop: false,\n\t\t\tbottom: false,\n\t\t\tleft: false,\n\t\t\tright: false,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<UnitControl\n\t\t\t{ ...props }\n\t\t\tdisableUnits={ isMixed }\n\t\t\tisOnly\n\t\t\tvalue={ allValue }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ handleOnUnitChange }\n\t\t\tonFocus={ handleOnFocus }\n\t\t\tonHoverOn={ handleOnHoverOn }\n\t\t\tonHoverOff={ handleOnHoverOff }\n\t\t\tplaceholder={ allPlaceholder }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;;AAGA,OAAOA,WAAW,MAAM,gBAAgB;AACxC,SACCC,MAAM,EACNC,iBAAiB,EACjBC,WAAW,EACXC,aAAa,EACbC,eAAe,QACT,SAAS;AAEhB,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,eAAe,SAASC,eAAeA,CAAE;EACxCC,QAAQ,GAAGF,IAAI;EACfG,OAAO,GAAGH,IAAI;EACdI,SAAS,GAAGJ,IAAI;EAChBK,UAAU,GAAGL,IAAI;EACjBM,MAAM;EACNC,KAAK;EACLC,aAAa;EACbC,gBAAgB;EAChB,GAAGC;AACyB,CAAC,EAAG;EAChC,MAAMC,QAAQ,GAAGd,WAAW,CAAES,MAAM,EAAEE,aAAa,EAAED,KAAM,CAAC;EAC5D,MAAMK,SAAS,GAAGb,eAAe,CAAEO,MAAO,CAAC;EAC3C,MAAMO,OAAO,GAAGD,SAAS,IAAId,aAAa,CAAEQ,MAAM,EAAEE,aAAa,EAAED,KAAM,CAAC;EAC1E,MAAMO,cAAc,GAAGD,OAAO,GAAGlB,MAAM,CAACoB,KAAK,GAAGC,SAAS;EAEzD,MAAMC,aAA0D,GAC/DC,KAAK,IACD;IACJf,OAAO,CAAEe,KAAK,EAAE;MAAEC,IAAI,EAAE;IAAM,CAAE,CAAC;EAClC,CAAC;EAED,MAAMC,cAA8C,GAAKC,IAAI,IAAM;IAClE,MAAMC,SAAS,GAAGD,IAAI,KAAKL,SAAS,IAAI,CAAEO,KAAK,CAAEC,UAAU,CAAEH,IAAK,CAAE,CAAC;IACrE,MAAMI,SAAS,GAAGH,SAAS,GAAGD,IAAI,GAAGL,SAAS;IAC9C,MAAMU,UAAU,GAAG9B,iBAAiB,CAAEU,MAAM,EAAEmB,SAAS,EAAElB,KAAM,CAAC;IAEhEL,QAAQ,CAAEwB,UAAW,CAAC;EACvB,CAAC;;EAED;EACA;EACA,MAAMC,kBAAsD,GAAKC,IAAI,IAAM;IAC1E,MAAMC,QAAQ,GAAGjC,iBAAiB,CAAEY,aAAa,EAAEoB,IAAI,EAAErB,KAAM,CAAC;IAChEE,gBAAgB,CAAEoB,QAAS,CAAC;EAC7B,CAAC;EAED,MAAMC,eAAe,GAAGA,CAAA,KAAM;IAC7B1B,SAAS,CAAE;MACV2B,GAAG,EAAE,IAAI;MACTC,MAAM,EAAE,IAAI;MACZC,IAAI,EAAE,IAAI;MACVC,KAAK,EAAE;IACR,CAAE,CAAC;EACJ,CAAC;EAED,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;IAC9B9B,UAAU,CAAE;MACX0B,GAAG,EAAE,KAAK;MACVC,MAAM,EAAE,KAAK;MACbC,IAAI,EAAE,KAAK;MACXC,KAAK,EAAE;IACR,CAAE,CAAC;EACJ,CAAC;EAED,OACCE,aAAA,CAAC1C,WAAW;IAAA,GACNgB,KAAK;IACV2B,YAAY,EAAGxB,OAAS;IACxByB,MAAM;IACNC,KAAK,EAAG5B,QAAU;IAClBT,QAAQ,EAAGkB,cAAgB;IAC3BoB,YAAY,EAAGb,kBAAoB;IACnCxB,OAAO,EAAGc,aAAe;IACzBb,SAAS,EAAG0B,eAAiB;IAC7BzB,UAAU,EAAG8B,gBAAkB;IAC/BM,WAAW,EAAG3B;EAAgB,CAC9B,CAAC;AAEJ"}
1
+ {"version":3,"names":["useInstanceId","FlexedRangeControl","StyledUnitControl","HStack","parseQuantityAndUnitFromRawValue","LABELS","applyValueToSides","getAllValue","isValuesMixed","isValuesDefined","CUSTOM_VALUE_SETTINGS","noop","AllInputControl","__next40pxDefaultSize","onChange","onFocus","values","sides","selectedUnits","setSelectedUnits","props","_CUSTOM_VALUE_SETTING","_CUSTOM_VALUE_SETTING2","inputId","allValue","hasValues","isMixed","allPlaceholder","mixed","undefined","parsedQuantity","parsedUnit","handleOnFocus","event","side","onValueChange","next","isNumeric","isNaN","parseFloat","nextValue","nextValues","sliderOnChange","join","handleOnUnitChange","unit","newUnits","createElement","className","disableUnits","id","isPressEnterToChange","value","onUnitChange","placeholder","label","all","hideLabelFromVision","__nextHasNoMarginBottom","min","max","step","withInputField"],"sources":["@wordpress/components/src/box-control/all-input-control.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport type { UnitControlProps } from '../unit-control/types';\nimport {\n\tFlexedRangeControl,\n\tStyledUnitControl,\n} from './styles/box-control-styles';\nimport { HStack } from '../h-stack';\nimport type { BoxControlInputControlProps } from './types';\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control';\nimport {\n\tLABELS,\n\tapplyValueToSides,\n\tgetAllValue,\n\tisValuesMixed,\n\tisValuesDefined,\n\tCUSTOM_VALUE_SETTINGS,\n} from './utils';\n\nconst noop = () => {};\n\nexport default function AllInputControl( {\n\t__next40pxDefaultSize,\n\tonChange = noop,\n\tonFocus = noop,\n\tvalues,\n\tsides,\n\tselectedUnits,\n\tsetSelectedUnits,\n\t...props\n}: BoxControlInputControlProps ) {\n\tconst inputId = useInstanceId( AllInputControl, 'box-control-input-all' );\n\n\tconst allValue = getAllValue( values, selectedUnits, sides );\n\tconst hasValues = isValuesDefined( values );\n\tconst isMixed = hasValues && isValuesMixed( values, selectedUnits, sides );\n\tconst allPlaceholder = isMixed ? LABELS.mixed : undefined;\n\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( allValue );\n\n\tconst handleOnFocus: React.FocusEventHandler< HTMLInputElement > = (\n\t\tevent\n\t) => {\n\t\tonFocus( event, { side: 'all' } );\n\t};\n\n\tconst onValueChange = ( next?: string ) => {\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\t\tconst nextValues = applyValueToSides( values, nextValue, sides );\n\n\t\tonChange( nextValues );\n\t};\n\n\tconst sliderOnChange = ( next?: number ) => {\n\t\tonValueChange(\n\t\t\tnext !== undefined ? [ next, parsedUnit ].join( '' ) : undefined\n\t\t);\n\t};\n\n\t// Set selected unit so it can be used as fallback by unlinked controls\n\t// when individual sides do not have a value containing a unit.\n\tconst handleOnUnitChange: UnitControlProps[ 'onUnitChange' ] = ( unit ) => {\n\t\tconst newUnits = applyValueToSides( selectedUnits, unit, sides );\n\t\tsetSelectedUnits( newUnits );\n\t};\n\n\treturn (\n\t\t<HStack>\n\t\t\t<StyledUnitControl\n\t\t\t\t{ ...props }\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\tclassName=\"component-box-control__unit-control\"\n\t\t\t\tdisableUnits={ isMixed }\n\t\t\t\tid={ inputId }\n\t\t\t\tisPressEnterToChange\n\t\t\t\tvalue={ allValue }\n\t\t\t\tonChange={ onValueChange }\n\t\t\t\tonUnitChange={ handleOnUnitChange }\n\t\t\t\tonFocus={ handleOnFocus }\n\t\t\t\tplaceholder={ allPlaceholder }\n\t\t\t\tlabel={ LABELS.all }\n\t\t\t\thideLabelFromVision\n\t\t\t/>\n\n\t\t\t<FlexedRangeControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\taria-controls={ inputId }\n\t\t\t\tlabel={ LABELS.all }\n\t\t\t\thideLabelFromVision\n\t\t\t\tonChange={ sliderOnChange }\n\t\t\t\tmin={ 0 }\n\t\t\t\tmax={ CUSTOM_VALUE_SETTINGS[ parsedUnit ?? 'px' ]?.max ?? 10 }\n\t\t\t\tstep={\n\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ parsedUnit ?? 'px' ]?.step ?? 0.1\n\t\t\t\t}\n\t\t\t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AAK,EAAGlD,MAAM,CAACmD,GAAK;IACpBC,mBAAmB;IACnB3C,QAAQ,EAAG4B,cAAgB;IAC3BiB,GAAG,EAAG,CAAG;IACTC,GAAG,GAAAvC,qBAAA,GAAGX,qBAAqB,CAAEqB,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI,IAAI,CAAE,EAAE6B,GAAG,cAAAvC,qBAAA,cAAAA,qBAAA,GAAI,EAAI;IAC9DwC,IAAI,GAAAvC,sBAAA,GACHZ,qBAAqB,CAAEqB,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI,IAAI,CAAE,EAAE8B,IAAI,cAAAvC,sBAAA,cAAAA,sBAAA,GAAI,GACrD;IACD8B,KAAK,EAAGtB,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,CAAG;IAC7BgC,cAAc,EAAG;EAAO,CACxB,CACM,CAAC;AAEX"}
@@ -1,23 +1,27 @@
1
- import { createElement } from "react";
1
+ import { createElement, Fragment } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { useInstanceId } from '@wordpress/compose';
2
6
  /**
3
7
  * Internal dependencies
4
8
  */
5
9
  import { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';
6
- import UnitControl from './unit-control';
7
- import { LABELS } from './utils';
8
- import { Layout } from './styles/box-control-styles';
10
+ import Tooltip from '../tooltip';
11
+ import { CUSTOM_VALUE_SETTINGS, LABELS } from './utils';
12
+ import { FlexedBoxControlIcon, FlexedRangeControl, InputWrapper, StyledUnitControl } from './styles/box-control-styles';
9
13
  const groupedSides = ['vertical', 'horizontal'];
10
14
  export default function AxialInputControls({
15
+ __next40pxDefaultSize,
11
16
  onChange,
12
17
  onFocus,
13
- onHoverOn,
14
- onHoverOff,
15
18
  values,
16
19
  selectedUnits,
17
20
  setSelectedUnits,
18
21
  sides,
19
22
  ...props
20
23
  }) {
24
+ const generatedId = useInstanceId(AxialInputControls, `box-control-input`);
21
25
  const createHandleOnFocus = side => event => {
22
26
  if (!onFocus) {
23
27
  return;
@@ -26,41 +30,7 @@ export default function AxialInputControls({
26
30
  side
27
31
  });
28
32
  };
29
- const createHandleOnHoverOn = side => () => {
30
- if (!onHoverOn) {
31
- return;
32
- }
33
- if (side === 'vertical') {
34
- onHoverOn({
35
- top: true,
36
- bottom: true
37
- });
38
- }
39
- if (side === 'horizontal') {
40
- onHoverOn({
41
- left: true,
42
- right: true
43
- });
44
- }
45
- };
46
- const createHandleOnHoverOff = side => () => {
47
- if (!onHoverOff) {
48
- return;
49
- }
50
- if (side === 'vertical') {
51
- onHoverOff({
52
- top: false,
53
- bottom: false
54
- });
55
- }
56
- if (side === 'horizontal') {
57
- onHoverOff({
58
- left: false,
59
- right: false
60
- });
61
- }
62
- };
63
- const createHandleOnChange = side => next => {
33
+ const handleOnValueChange = (side, next) => {
64
34
  if (!onChange) {
65
35
  return;
66
36
  }
@@ -96,30 +66,45 @@ export default function AxialInputControls({
96
66
 
97
67
  // Filter sides if custom configuration provided, maintaining default order.
98
68
  const filteredSides = sides?.length ? groupedSides.filter(side => sides.includes(side)) : groupedSides;
99
- const first = filteredSides[0];
100
- const last = filteredSides[filteredSides.length - 1];
101
- const only = first === last && first;
102
- return createElement(Layout, {
103
- gap: 0,
104
- align: "top",
105
- className: "component-box-control__vertical-horizontal-input-controls"
106
- }, filteredSides.map(side => {
69
+ return createElement(Fragment, null, filteredSides.map(side => {
70
+ var _CUSTOM_VALUE_SETTING, _CUSTOM_VALUE_SETTING2;
107
71
  const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(side === 'vertical' ? values.top : values.left);
108
72
  const selectedUnit = side === 'vertical' ? selectedUnits.top : selectedUnits.left;
109
- return createElement(UnitControl, {
73
+ const inputId = [generatedId, side].join('-');
74
+ return createElement(InputWrapper, {
75
+ key: side
76
+ }, createElement(FlexedBoxControlIcon, {
77
+ side: side,
78
+ sides: sides
79
+ }), createElement(Tooltip, {
80
+ placement: "top-end",
81
+ text: LABELS[side]
82
+ }, createElement(StyledUnitControl, {
110
83
  ...props,
111
- isFirst: first === side,
112
- isLast: last === side,
113
- isOnly: only === side,
84
+ __next40pxDefaultSize: __next40pxDefaultSize,
85
+ className: "component-box-control__unit-control",
86
+ id: inputId,
87
+ isPressEnterToChange: true,
114
88
  value: [parsedQuantity, selectedUnit !== null && selectedUnit !== void 0 ? selectedUnit : parsedUnit].join(''),
115
- onChange: createHandleOnChange(side),
89
+ onChange: newValue => handleOnValueChange(side, newValue),
116
90
  onUnitChange: createHandleOnUnitChange(side),
117
91
  onFocus: createHandleOnFocus(side),
118
- onHoverOn: createHandleOnHoverOn(side),
119
- onHoverOff: createHandleOnHoverOff(side),
120
92
  label: LABELS[side],
93
+ hideLabelFromVision: true,
121
94
  key: side
122
- });
95
+ })), createElement(FlexedRangeControl, {
96
+ __nextHasNoMarginBottom: true,
97
+ __next40pxDefaultSize: __next40pxDefaultSize,
98
+ "aria-controls": inputId,
99
+ label: LABELS[side],
100
+ hideLabelFromVision: true,
101
+ onChange: newValue => handleOnValueChange(side, newValue !== undefined ? [newValue, selectedUnit !== null && selectedUnit !== void 0 ? selectedUnit : parsedUnit].join('') : undefined),
102
+ min: 0,
103
+ max: (_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[selectedUnit !== null && selectedUnit !== void 0 ? selectedUnit : 'px']?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10,
104
+ step: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[selectedUnit !== null && selectedUnit !== void 0 ? selectedUnit : 'px']?.step) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1,
105
+ value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : 0,
106
+ withInputField: false
107
+ }));
123
108
  }));
124
109
  }
125
110
  //# sourceMappingURL=axial-input-controls.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["parseQuantityAndUnitFromRawValue","UnitControl","LABELS","Layout","groupedSides","AxialInputControls","onChange","onFocus","onHoverOn","onHoverOff","values","selectedUnits","setSelectedUnits","sides","props","createHandleOnFocus","side","event","createHandleOnHoverOn","top","bottom","left","right","createHandleOnHoverOff","createHandleOnChange","next","nextValues","isNumeric","undefined","isNaN","parseFloat","nextValue","createHandleOnUnitChange","newUnits","filteredSides","length","filter","includes","first","last","only","createElement","gap","align","className","map","parsedQuantity","parsedUnit","selectedUnit","isFirst","isLast","isOnly","value","join","onUnitChange","label","key"],"sources":["@wordpress/components/src/box-control/axial-input-controls.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';\nimport UnitControl from './unit-control';\nimport { LABELS } from './utils';\nimport { Layout } from './styles/box-control-styles';\nimport type { BoxControlInputControlProps } from './types';\n\nconst groupedSides = [ 'vertical', 'horizontal' ] as const;\ntype GroupedSide = ( typeof groupedSides )[ number ];\n\nexport default function AxialInputControls( {\n\tonChange,\n\tonFocus,\n\tonHoverOn,\n\tonHoverOff,\n\tvalues,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tsides,\n\t...props\n}: BoxControlInputControlProps ) {\n\tconst createHandleOnFocus =\n\t\t( side: GroupedSide ) =>\n\t\t( event: React.FocusEvent< HTMLInputElement > ) => {\n\t\t\tif ( ! onFocus ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonFocus( event, { side } );\n\t\t};\n\n\tconst createHandleOnHoverOn = ( side: GroupedSide ) => () => {\n\t\tif ( ! onHoverOn ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( side === 'vertical' ) {\n\t\t\tonHoverOn( {\n\t\t\t\ttop: true,\n\t\t\t\tbottom: true,\n\t\t\t} );\n\t\t}\n\t\tif ( side === 'horizontal' ) {\n\t\t\tonHoverOn( {\n\t\t\t\tleft: true,\n\t\t\t\tright: true,\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst createHandleOnHoverOff = ( side: GroupedSide ) => () => {\n\t\tif ( ! onHoverOff ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( side === 'vertical' ) {\n\t\t\tonHoverOff( {\n\t\t\t\ttop: false,\n\t\t\t\tbottom: false,\n\t\t\t} );\n\t\t}\n\t\tif ( side === 'horizontal' ) {\n\t\t\tonHoverOff( {\n\t\t\t\tleft: false,\n\t\t\t\tright: false,\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst createHandleOnChange = ( side: GroupedSide ) => ( next?: string ) => {\n\t\tif ( ! onChange ) {\n\t\t\treturn;\n\t\t}\n\t\tconst nextValues = { ...values };\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\n\t\tif ( side === 'vertical' ) {\n\t\t\tnextValues.top = nextValue;\n\t\t\tnextValues.bottom = nextValue;\n\t\t}\n\n\t\tif ( side === 'horizontal' ) {\n\t\t\tnextValues.left = nextValue;\n\t\t\tnextValues.right = nextValue;\n\t\t}\n\n\t\tonChange( nextValues );\n\t};\n\n\tconst createHandleOnUnitChange =\n\t\t( side: GroupedSide ) => ( next?: string ) => {\n\t\t\tconst newUnits = { ...selectedUnits };\n\n\t\t\tif ( side === 'vertical' ) {\n\t\t\t\tnewUnits.top = next;\n\t\t\t\tnewUnits.bottom = next;\n\t\t\t}\n\n\t\t\tif ( side === 'horizontal' ) {\n\t\t\t\tnewUnits.left = next;\n\t\t\t\tnewUnits.right = next;\n\t\t\t}\n\n\t\t\tsetSelectedUnits( newUnits );\n\t\t};\n\n\t// Filter sides if custom configuration provided, maintaining default order.\n\tconst filteredSides = sides?.length\n\t\t? groupedSides.filter( ( side ) => sides.includes( side ) )\n\t\t: groupedSides;\n\n\tconst first = filteredSides[ 0 ];\n\tconst last = filteredSides[ filteredSides.length - 1 ];\n\tconst only = first === last && first;\n\n\treturn (\n\t\t<Layout\n\t\t\tgap={ 0 }\n\t\t\talign=\"top\"\n\t\t\tclassName=\"component-box-control__vertical-horizontal-input-controls\"\n\t\t>\n\t\t\t{ filteredSides.map( ( side ) => {\n\t\t\t\tconst [ parsedQuantity, parsedUnit ] =\n\t\t\t\t\tparseQuantityAndUnitFromRawValue(\n\t\t\t\t\t\tside === 'vertical' ? values.top : values.left\n\t\t\t\t\t);\n\t\t\t\tconst selectedUnit =\n\t\t\t\t\tside === 'vertical'\n\t\t\t\t\t\t? selectedUnits.top\n\t\t\t\t\t\t: selectedUnits.left;\n\t\t\t\treturn (\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\tisFirst={ first === side }\n\t\t\t\t\t\tisLast={ last === side }\n\t\t\t\t\t\tisOnly={ only === side }\n\t\t\t\t\t\tvalue={ [\n\t\t\t\t\t\t\tparsedQuantity,\n\t\t\t\t\t\t\tselectedUnit ?? parsedUnit,\n\t\t\t\t\t\t].join( '' ) }\n\t\t\t\t\t\tonChange={ createHandleOnChange( side ) }\n\t\t\t\t\t\tonUnitChange={ createHandleOnUnitChange( side ) }\n\t\t\t\t\t\tonFocus={ createHandleOnFocus( side ) }\n\t\t\t\t\t\tonHoverOn={ createHandleOnHoverOn( side ) }\n\t\t\t\t\t\tonHoverOff={ createHandleOnHoverOff( side ) }\n\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\tkey={ side }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Layout>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gCAAgC,QAAQ,uBAAuB;AACxE,OAAOC,WAAW,MAAM,gBAAgB;AACxC,SAASC,MAAM,QAAQ,SAAS;AAChC,SAASC,MAAM,QAAQ,6BAA6B;AAGpD,MAAMC,YAAY,GAAG,CAAE,UAAU,EAAE,YAAY,CAAW;AAG1D,eAAe,SAASC,kBAAkBA,CAAE;EAC3CC,QAAQ;EACRC,OAAO;EACPC,SAAS;EACTC,UAAU;EACVC,MAAM;EACNC,aAAa;EACbC,gBAAgB;EAChBC,KAAK;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AE,GACnC/C,gCAAgC,CAC/BgB,IAAI,KAAK,UAAU,GAAGN,MAAM,CAACS,GAAG,GAAGT,MAAM,CAACW,IAC3C,CAAC;IACF,MAAM2B,YAAY,GACjBhC,IAAI,KAAK,UAAU,GAChBL,aAAa,CAACQ,GAAG,GACjBR,aAAa,CAACU,IAAI;IACtB,OACCoB,aAAA,CAACxC,WAAW;MAAA,GACNa,KAAK;MACVmC,OAAO,EAAGX,KAAK,KAAKtB,IAAM;MAC1BkC,MAAM,EAAGX,IAAI,KAAKvB,IAAM;MACxBmC,MAAM,EAAGX,IAAI,KAAKxB,IAAM;MACxBoC,KAAK,EAAG,CACPN,cAAc,EACdE,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAID,UAAU,CAC1B,CAACM,IAAI,CAAE,EAAG,CAAG;MACd/C,QAAQ,EAAGkB,oBAAoB,CAAER,IAAK,CAAG;MACzCsC,YAAY,EAAGtB,wBAAwB,CAAEhB,IAAK,CAAG;MACjDT,OAAO,EAAGQ,mBAAmB,CAAEC,IAAK,CAAG;MACvCR,SAAS,EAAGU,qBAAqB,CAAEF,IAAK,CAAG;MAC3CP,UAAU,EAAGc,sBAAsB,CAAEP,IAAK,CAAG;MAC7CuC,KAAK,EAAGrD,MAAM,CAAEc,IAAI,CAAI;MACxBwC,GAAG,EAAGxC;IAAM,CACZ,CAAC;EAEJ,CAAE,CACK,CAAC;AAEX"}
1
+ {"version":3,"names":["useInstanceId","parseQuantityAndUnitFromRawValue","Tooltip","CUSTOM_VALUE_SETTINGS","LABELS","FlexedBoxControlIcon","FlexedRangeControl","InputWrapper","StyledUnitControl","groupedSides","AxialInputControls","__next40pxDefaultSize","onChange","onFocus","values","selectedUnits","setSelectedUnits","sides","props","generatedId","createHandleOnFocus","side","event","handleOnValueChange","next","nextValues","isNumeric","undefined","isNaN","parseFloat","nextValue","top","bottom","left","right","createHandleOnUnitChange","newUnits","filteredSides","length","filter","includes","createElement","Fragment","map","_CUSTOM_VALUE_SETTING","_CUSTOM_VALUE_SETTING2","parsedQuantity","parsedUnit","selectedUnit","inputId","join","key","placement","text","className","id","isPressEnterToChange","value","newValue","onUnitChange","label","hideLabelFromVision","__nextHasNoMarginBottom","min","max","step","withInputField"],"sources":["@wordpress/components/src/box-control/axial-input-controls.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';\nimport Tooltip from '../tooltip';\nimport { CUSTOM_VALUE_SETTINGS, LABELS } from './utils';\nimport {\n\tFlexedBoxControlIcon,\n\tFlexedRangeControl,\n\tInputWrapper,\n\tStyledUnitControl,\n} from './styles/box-control-styles';\nimport type { BoxControlInputControlProps } from './types';\n\nconst groupedSides = [ 'vertical', 'horizontal' ] as const;\ntype GroupedSide = ( typeof groupedSides )[ number ];\n\nexport default function AxialInputControls( {\n\t__next40pxDefaultSize,\n\tonChange,\n\tonFocus,\n\tvalues,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tsides,\n\t...props\n}: BoxControlInputControlProps ) {\n\tconst generatedId = useInstanceId(\n\t\tAxialInputControls,\n\t\t`box-control-input`\n\t);\n\n\tconst createHandleOnFocus =\n\t\t( side: GroupedSide ) =>\n\t\t( event: React.FocusEvent< HTMLInputElement > ) => {\n\t\t\tif ( ! onFocus ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonFocus( event, { side } );\n\t\t};\n\n\tconst handleOnValueChange = ( side: GroupedSide, next?: string ) => {\n\t\tif ( ! onChange ) {\n\t\t\treturn;\n\t\t}\n\t\tconst nextValues = { ...values };\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\n\t\tif ( side === 'vertical' ) {\n\t\t\tnextValues.top = nextValue;\n\t\t\tnextValues.bottom = nextValue;\n\t\t}\n\n\t\tif ( side === 'horizontal' ) {\n\t\t\tnextValues.left = nextValue;\n\t\t\tnextValues.right = nextValue;\n\t\t}\n\n\t\tonChange( nextValues );\n\t};\n\n\tconst createHandleOnUnitChange =\n\t\t( side: GroupedSide ) => ( next?: string ) => {\n\t\t\tconst newUnits = { ...selectedUnits };\n\n\t\t\tif ( side === 'vertical' ) {\n\t\t\t\tnewUnits.top = next;\n\t\t\t\tnewUnits.bottom = next;\n\t\t\t}\n\n\t\t\tif ( side === 'horizontal' ) {\n\t\t\t\tnewUnits.left = next;\n\t\t\t\tnewUnits.right = next;\n\t\t\t}\n\n\t\t\tsetSelectedUnits( newUnits );\n\t\t};\n\n\t// Filter sides if custom configuration provided, maintaining default order.\n\tconst filteredSides = sides?.length\n\t\t? groupedSides.filter( ( side ) => sides.includes( side ) )\n\t\t: groupedSides;\n\n\treturn (\n\t\t<>\n\t\t\t{ filteredSides.map( ( side ) => {\n\t\t\t\tconst [ parsedQuantity, parsedUnit ] =\n\t\t\t\t\tparseQuantityAndUnitFromRawValue(\n\t\t\t\t\t\tside === 'vertical' ? values.top : values.left\n\t\t\t\t\t);\n\t\t\t\tconst selectedUnit =\n\t\t\t\t\tside === 'vertical'\n\t\t\t\t\t\t? selectedUnits.top\n\t\t\t\t\t\t: selectedUnits.left;\n\n\t\t\t\tconst inputId = [ generatedId, side ].join( '-' );\n\n\t\t\t\treturn (\n\t\t\t\t\t<InputWrapper key={ side }>\n\t\t\t\t\t\t<FlexedBoxControlIcon side={ side } sides={ sides } />\n\t\t\t\t\t\t<Tooltip placement=\"top-end\" text={ LABELS[ side ] }>\n\t\t\t\t\t\t\t<StyledUnitControl\n\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\t\t\tclassName=\"component-box-control__unit-control\"\n\t\t\t\t\t\t\t\tid={ inputId }\n\t\t\t\t\t\t\t\tisPressEnterToChange\n\t\t\t\t\t\t\t\tvalue={ [\n\t\t\t\t\t\t\t\t\tparsedQuantity,\n\t\t\t\t\t\t\t\t\tselectedUnit ?? parsedUnit,\n\t\t\t\t\t\t\t\t].join( '' ) }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\t\t\t\t\thandleOnValueChange( side, newValue )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonUnitChange={ createHandleOnUnitChange(\n\t\t\t\t\t\t\t\t\tside\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonFocus={ createHandleOnFocus( side ) }\n\t\t\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tkey={ side }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t<FlexedRangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\t\taria-controls={ inputId }\n\t\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\t\t\t\thandleOnValueChange(\n\t\t\t\t\t\t\t\t\tside,\n\t\t\t\t\t\t\t\t\tnewValue !== undefined\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\tnewValue,\n\t\t\t\t\t\t\t\t\t\t\t\tselectedUnit ?? parsedUnit,\n\t\t\t\t\t\t\t\t\t\t ].join( '' )\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ selectedUnit ?? 'px' ]\n\t\t\t\t\t\t\t\t\t?.max ?? 10\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstep={\n\t\t\t\t\t\t\t\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,CACA+B,QAAQ,EACRV,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAID,UAAU,CACzB,CAACG,IAAI,CAAE,EAAG,CAAC,GACZvB,SACJ,CACA;MACDoC,GAAG,EAAG,CAAG;MACTC,GAAG,GAAApB,qBAAA,GACFzC,qBAAqB,CAAE6C,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAI,IAAI,CAAE,EAC1CgB,GAAG,cAAApB,qBAAA,cAAAA,qBAAA,GAAI,EACV;MACDqB,IAAI,GAAApB,sBAAA,GACH1C,qBAAqB,CAAE6C,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAI,IAAI,CAAE,EAC1CiB,IAAI,cAAApB,sBAAA,cAAAA,sBAAA,GAAI,GACX;MACDY,KAAK,EAAGX,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,CAAG;MAC7BoB,cAAc,EAAG;IAAO,CACxB,CACY,CAAC;EAEjB,CAAE,CACD,CAAC;AAEL"}
@@ -10,14 +10,12 @@ import { __ } from '@wordpress/i18n';
10
10
  * Internal dependencies
11
11
  */
12
12
  import { BaseControl } from '../base-control';
13
- import Button from '../button';
14
- import { FlexItem, FlexBlock } from '../flex';
15
13
  import AllInputControl from './all-input-control';
16
14
  import InputControls from './input-controls';
17
15
  import AxialInputControls from './axial-input-controls';
18
- import BoxControlIcon from './icon';
19
16
  import LinkedButton from './linked-button';
20
- import { Root, Header, HeaderControlWrapper } from './styles/box-control-styles';
17
+ import { Grid } from '../grid';
18
+ import { FlexedBoxControlIcon, InputWrapper, ResetButton, LinkedButtonWrapper } from './styles/box-control-styles';
21
19
  import { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';
22
20
  import { DEFAULT_VALUES, getInitialSide, isValuesMixed, isValuesDefined } from './utils';
23
21
  import { useControlledState } from '../utils/hooks';
@@ -56,6 +54,7 @@ function useUniqueId(idProp) {
56
54
  * ```
57
55
  */
58
56
  function BoxControl({
57
+ __next40pxDefaultSize = false,
59
58
  id: idProp,
60
59
  inputProps = defaultInputProps,
61
60
  onChange = noop,
@@ -121,38 +120,36 @@ function BoxControl({
121
120
  sides,
122
121
  values: inputValues,
123
122
  onMouseOver,
124
- onMouseOut
123
+ onMouseOut,
124
+ __next40pxDefaultSize
125
125
  };
126
- return createElement(Root, {
126
+ return createElement(Grid, {
127
127
  id: id,
128
+ columns: 3,
129
+ templateColumns: "1fr min-content min-content",
128
130
  role: "group",
129
131
  "aria-labelledby": headingId
130
- }, createElement(Header, {
131
- className: "component-box-control__header"
132
- }, createElement(FlexItem, null, createElement(BaseControl.VisualLabel, {
132
+ }, createElement(BaseControl.VisualLabel, {
133
133
  id: headingId
134
- }, label)), allowReset && createElement(FlexItem, null, createElement(Button, {
135
- className: "component-box-control__reset-button",
136
- variant: "secondary",
137
- size: "small",
138
- onClick: handleOnReset,
139
- disabled: !isDirty
140
- }, __('Reset')))), createElement(HeaderControlWrapper, {
141
- className: "component-box-control__header-control-wrapper"
142
- }, createElement(FlexItem, null, createElement(BoxControlIcon, {
134
+ }, label), isLinked && createElement(InputWrapper, null, createElement(FlexedBoxControlIcon, {
143
135
  side: side,
144
136
  sides: sides
145
- })), isLinked && createElement(FlexBlock, null, createElement(AllInputControl, {
146
- "aria-label": label,
147
- ...inputControlProps
148
- })), !isLinked && splitOnAxis && createElement(FlexBlock, null, createElement(AxialInputControls, {
137
+ }), createElement(AllInputControl, {
149
138
  ...inputControlProps
150
- })), !hasOneSide && createElement(FlexItem, null, createElement(LinkedButton, {
139
+ })), !hasOneSide && createElement(LinkedButtonWrapper, null, createElement(LinkedButton, {
151
140
  onClick: toggleLinked,
152
141
  isLinked: isLinked
153
- }))), !isLinked && !splitOnAxis && createElement(InputControls, {
142
+ })), !isLinked && splitOnAxis && createElement(AxialInputControls, {
154
143
  ...inputControlProps
155
- }));
144
+ }), !isLinked && !splitOnAxis && createElement(InputControls, {
145
+ ...inputControlProps
146
+ }), allowReset && createElement(ResetButton, {
147
+ className: "component-box-control__reset-button",
148
+ variant: "secondary",
149
+ size: "small",
150
+ onClick: handleOnReset,
151
+ disabled: !isDirty
152
+ }, __('Reset')));
156
153
  }
157
154
  export { applyValueToSides } from './utils';
158
155
  export default BoxControl;
@@ -1 +1 @@
1
- {"version":3,"names":["useInstanceId","useState","__","BaseControl","Button","FlexItem","FlexBlock","AllInputControl","InputControls","AxialInputControls","BoxControlIcon","LinkedButton","Root","Header","HeaderControlWrapper","parseQuantityAndUnitFromRawValue","DEFAULT_VALUES","getInitialSide","isValuesMixed","isValuesDefined","useControlledState","defaultInputProps","min","noop","useUniqueId","idProp","instanceId","BoxControl","id","inputProps","onChange","label","values","valuesProp","units","sides","splitOnAxis","allowReset","resetValues","onMouseOver","onMouseOut","setValues","fallback","inputValues","hasInitialValue","hasOneSide","length","isDirty","setIsDirty","isLinked","setIsLinked","side","setSide","selectedUnits","setSelectedUnits","top","right","bottom","left","headingId","toggleLinked","handleOnFocus","_event","nextSide","handleOnChange","nextValues","handleOnReset","inputControlProps","onFocus","createElement","role","className","VisualLabel","variant","size","onClick","disabled","applyValueToSides"],"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 Button from '../button';\nimport { FlexItem, FlexBlock } from '../flex';\nimport AllInputControl from './all-input-control';\nimport InputControls from './input-controls';\nimport AxialInputControls from './axial-input-controls';\nimport BoxControlIcon from './icon';\nimport LinkedButton from './linked-button';\nimport {\n\tRoot,\n\tHeader,\n\tHeaderControlWrapper,\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';\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 * BoxControl components let users set values for Top, Right, Bottom, and Left.\n * This can be used as an input control for values like `padding` or `margin`.\n *\n * ```jsx\n * import { __experimentalBoxControl as BoxControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ values, setValues ] = useState( {\n * \t\ttop: '50px',\n * \t\tleft: '10%',\n * \t\tright: '10%',\n * \t\tbottom: '50px',\n * \t} );\n *\n * \treturn (\n * \t\t<BoxControl\n * \t\t\tvalues={ values }\n * \t\t\tonChange={ ( nextValues ) => setValues( nextValues ) }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nfunction BoxControl( {\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\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\tonMouseOver,\n\t\tonMouseOut,\n\t};\n\n\treturn (\n\t\t<Root id={ id } role=\"group\" aria-labelledby={ headingId }>\n\t\t\t<Header className=\"component-box-control__header\">\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<BaseControl.VisualLabel id={ headingId }>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t</FlexItem>\n\t\t\t\t{ allowReset && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"component-box-control__reset-button\"\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t\tdisabled={ ! isDirty }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</Header>\n\t\t\t<HeaderControlWrapper className=\"component-box-control__header-control-wrapper\">\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<BoxControlIcon side={ side } sides={ sides } />\n\t\t\t\t</FlexItem>\n\t\t\t\t{ isLinked && (\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<AllInputControl\n\t\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\t\t{ ...inputControlProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t) }\n\t\t\t\t{ ! isLinked && splitOnAxis && (\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<AxialInputControls { ...inputControlProps } />\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t) }\n\t\t\t\t{ ! hasOneSide && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<LinkedButton\n\t\t\t\t\t\t\tonClick={ toggleLinked }\n\t\t\t\t\t\t\tisLinked={ isLinked }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</HeaderControlWrapper>\n\t\t\t{ ! isLinked && ! splitOnAxis && (\n\t\t\t\t<InputControls { ...inputControlProps } />\n\t\t\t) }\n\t\t</Root>\n\t);\n}\n\nexport { applyValueToSides } from './utils';\nexport default BoxControl;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AAC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GAEpB7C,EAAE,CAAE,OAAQ,CACP,CACC,CAEJ,CAAC,EACTmE,aAAA,CAACvD,oBAAoB;IAACyD,SAAS,EAAC;EAA+C,GAC9EF,aAAA,CAAChE,QAAQ,QACRgE,aAAA,CAAC3D,cAAc;IAACyC,IAAI,EAAGA,IAAM;IAAChB,KAAK,EAAGA;EAAO,CAAE,CACtC,CAAC,EACTc,QAAQ,IACToB,aAAA,CAAC/D,SAAS,QACT+D,aAAA,CAAC9D,eAAe;IACf,cAAawB,KAAO;IAAA,GACfoC;EAAiB,CACtB,CACS,CACX,EACC,CAAElB,QAAQ,IAAIb,WAAW,IAC1BiC,aAAA,CAAC/D,SAAS,QACT+D,aAAA,CAAC5D,kBAAkB;IAAA,GAAM0D;EAAiB,CAAI,CACpC,CACX,EACC,CAAEtB,UAAU,IACbwB,aAAA,CAAChE,QAAQ,QACRgE,aAAA,CAAC1D,YAAY;IACZgE,OAAO,EAAGf,YAAc;IACxBX,QAAQ,EAAGA;EAAU,CACrB,CACQ,CAEU,CAAC,EACrB,CAAEA,QAAQ,IAAI,CAAEb,WAAW,IAC5BiC,aAAA,CAAC7D,aAAa;IAAA,GAAM2D;EAAiB,CAAI,CAErC,CAAC;AAET;AAEA,SAASU,iBAAiB,QAAQ,SAAS;AAC3C,eAAelD,UAAU"}
1
+ {"version":3,"names":["useInstanceId","useState","__","BaseControl","AllInputControl","InputControls","AxialInputControls","LinkedButton","Grid","FlexedBoxControlIcon","InputWrapper","ResetButton","LinkedButtonWrapper","parseQuantityAndUnitFromRawValue","DEFAULT_VALUES","getInitialSide","isValuesMixed","isValuesDefined","useControlledState","defaultInputProps","min","noop","useUniqueId","idProp","instanceId","BoxControl","__next40pxDefaultSize","id","inputProps","onChange","label","values","valuesProp","units","sides","splitOnAxis","allowReset","resetValues","onMouseOver","onMouseOut","setValues","fallback","inputValues","hasInitialValue","hasOneSide","length","isDirty","setIsDirty","isLinked","setIsLinked","side","setSide","selectedUnits","setSelectedUnits","top","right","bottom","left","headingId","toggleLinked","handleOnFocus","_event","nextSide","handleOnChange","nextValues","handleOnReset","inputControlProps","onFocus","createElement","columns","templateColumns","role","VisualLabel","onClick","className","variant","size","disabled","applyValueToSides"],"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';\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 * BoxControl components let users set values for Top, Right, Bottom, and Left.\n * This can be used as an input control for values like `padding` or `margin`.\n *\n * ```jsx\n * import { __experimentalBoxControl as BoxControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ values, setValues ] = useState( {\n * \t\ttop: '50px',\n * \t\tleft: '10%',\n * \t\tright: '10%',\n * \t\tbottom: '50px',\n * \t} );\n *\n * \treturn (\n * \t\t<BoxControl\n * \t\t\tvalues={ values }\n * \t\t\tonChange={ ( nextValues ) => setValues( nextValues ) }\n * \t\t/>\n * \t);\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\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\tonMouseOver,\n\t\tonMouseOut,\n\t\t__next40pxDefaultSize,\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":";AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,kBAAkB,MAAM,wBAAwB;AACvD,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,SAASC,IAAI,QAAQ,SAAS;AAC9B,SACCC,oBAAoB,EACpBC,YAAY,EACZC,WAAW,EACXC,mBAAmB,QACb,6BAA6B;AACpC,SAASC,gCAAgC,QAAQ,uBAAuB;AACxE,SACCC,cAAc,EACdC,cAAc,EACdC,aAAa,EACbC,eAAe,QACT,SAAS;AAChB,SAASC,kBAAkB,QAAQ,gBAAgB;AAOnD,MAAMC,iBAAiB,GAAG;EACzBC,GAAG,EAAE;AACN,CAAC;AAED,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,SAASC,WAAWA,CAAEC,MAAe,EAAG;EACvC,MAAMC,UAAU,GAAGxB,aAAa,CAAEyB,UAAU,EAAE,uBAAwB,CAAC;EAEvE,OAAOF,MAAM,IAAIC,UAAU;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,UAAUA,CAAE;EACpBC,qBAAqB,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