@wordpress/components 19.7.0-next.e230fbab09.0 → 19.7.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 (178) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/build/base-control/index.js +19 -14
  3. package/build/base-control/index.js.map +1 -1
  4. package/build/base-control/styles/base-control-styles.js +33 -12
  5. package/build/base-control/styles/base-control-styles.js.map +1 -1
  6. package/build/box-control/all-input-control.js +3 -7
  7. package/build/box-control/all-input-control.js.map +1 -1
  8. package/build/box-control/axial-input-controls.js +20 -15
  9. package/build/box-control/axial-input-controls.js.map +1 -1
  10. package/build/box-control/input-controls.js +21 -16
  11. package/build/box-control/input-controls.js.map +1 -1
  12. package/build/box-control/utils.js +25 -11
  13. package/build/box-control/utils.js.map +1 -1
  14. package/build/checkbox-control/index.js +21 -1
  15. package/build/checkbox-control/index.js.map +1 -1
  16. package/build/color-palette/index.js +53 -4
  17. package/build/color-palette/index.js.map +1 -1
  18. package/build/custom-select-control/index.js +8 -3
  19. package/build/custom-select-control/index.js.map +1 -1
  20. package/build/divider/styles.js +28 -16
  21. package/build/divider/styles.js.map +1 -1
  22. package/build/focal-point-picker/controls.js +2 -3
  23. package/build/focal-point-picker/controls.js.map +1 -1
  24. package/build/form-file-upload/index.js +4 -1
  25. package/build/form-file-upload/index.js.map +1 -1
  26. package/build/input-control/input-field.js +21 -14
  27. package/build/input-control/input-field.js.map +1 -1
  28. package/build/input-control/reducer/actions.js +1 -3
  29. package/build/input-control/reducer/actions.js.map +1 -1
  30. package/build/input-control/reducer/reducer.js +1 -43
  31. package/build/input-control/reducer/reducer.js.map +1 -1
  32. package/build/number-control/index.js +15 -10
  33. package/build/number-control/index.js.map +1 -1
  34. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
  35. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  36. package/build/toggle-group-control/toggle-group-control-option/component.js +1 -4
  37. package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  38. package/build/toggle-group-control/toggle-group-control-option/styles.js +12 -19
  39. package/build/toggle-group-control/toggle-group-control-option/styles.js.map +1 -1
  40. package/build/tree-grid/index.js +4 -1
  41. package/build/tree-grid/index.js.map +1 -1
  42. package/build/unit-control/index.js +49 -27
  43. package/build/unit-control/index.js.map +1 -1
  44. package/build/unit-control/unit-select-control.js +2 -4
  45. package/build/unit-control/unit-select-control.js.map +1 -1
  46. package/build-module/base-control/index.js +19 -14
  47. package/build-module/base-control/index.js.map +1 -1
  48. package/build-module/base-control/styles/base-control-styles.js +34 -6
  49. package/build-module/base-control/styles/base-control-styles.js.map +1 -1
  50. package/build-module/box-control/all-input-control.js +4 -8
  51. package/build-module/box-control/all-input-control.js.map +1 -1
  52. package/build-module/box-control/axial-input-controls.js +18 -14
  53. package/build-module/box-control/axial-input-controls.js.map +1 -1
  54. package/build-module/box-control/input-controls.js +18 -14
  55. package/build-module/box-control/input-controls.js.map +1 -1
  56. package/build-module/box-control/utils.js +25 -11
  57. package/build-module/box-control/utils.js.map +1 -1
  58. package/build-module/checkbox-control/index.js +24 -3
  59. package/build-module/checkbox-control/index.js.map +1 -1
  60. package/build-module/color-palette/index.js +52 -4
  61. package/build-module/color-palette/index.js.map +1 -1
  62. package/build-module/custom-select-control/index.js +8 -3
  63. package/build-module/custom-select-control/index.js.map +1 -1
  64. package/build-module/divider/styles.js +29 -10
  65. package/build-module/divider/styles.js.map +1 -1
  66. package/build-module/focal-point-picker/controls.js +2 -3
  67. package/build-module/focal-point-picker/controls.js.map +1 -1
  68. package/build-module/form-file-upload/index.js +4 -1
  69. package/build-module/form-file-upload/index.js.map +1 -1
  70. package/build-module/input-control/input-field.js +21 -13
  71. package/build-module/input-control/input-field.js.map +1 -1
  72. package/build-module/input-control/reducer/actions.js +0 -1
  73. package/build-module/input-control/reducer/actions.js.map +1 -1
  74. package/build-module/input-control/reducer/reducer.js +2 -39
  75. package/build-module/input-control/reducer/reducer.js.map +1 -1
  76. package/build-module/number-control/index.js +15 -9
  77. package/build-module/number-control/index.js.map +1 -1
  78. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
  79. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  80. package/build-module/toggle-group-control/toggle-group-control-option/component.js +1 -4
  81. package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  82. package/build-module/toggle-group-control/toggle-group-control-option/styles.js +11 -17
  83. package/build-module/toggle-group-control/toggle-group-control-option/styles.js.map +1 -1
  84. package/build-module/tree-grid/index.js +4 -1
  85. package/build-module/tree-grid/index.js.map +1 -1
  86. package/build-module/unit-control/index.js +47 -25
  87. package/build-module/unit-control/index.js.map +1 -1
  88. package/build-module/unit-control/unit-select-control.js +2 -3
  89. package/build-module/unit-control/unit-select-control.js.map +1 -1
  90. package/build-style/style-rtl.css +29 -181
  91. package/build-style/style.css +29 -181
  92. package/build-types/base-control/index.d.ts +23 -18
  93. package/build-types/base-control/index.d.ts.map +1 -1
  94. package/build-types/base-control/styles/base-control-styles.d.ts +4 -0
  95. package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
  96. package/build-types/card/card-divider/hook.d.ts +1 -1
  97. package/build-types/color-palette/index.d.ts.map +1 -1
  98. package/build-types/color-picker/styles.d.ts +1 -1
  99. package/build-types/divider/stories/index.d.ts +1 -0
  100. package/build-types/divider/stories/index.d.ts.map +1 -1
  101. package/build-types/divider/styles.d.ts.map +1 -1
  102. package/build-types/divider/types.d.ts +8 -1
  103. package/build-types/divider/types.d.ts.map +1 -1
  104. package/build-types/input-control/input-field.d.ts.map +1 -1
  105. package/build-types/input-control/reducer/actions.d.ts +1 -3
  106. package/build-types/input-control/reducer/actions.d.ts.map +1 -1
  107. package/build-types/input-control/reducer/reducer.d.ts +3 -9
  108. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  109. package/build-types/input-control/types.d.ts +2 -2
  110. package/build-types/input-control/types.d.ts.map +1 -1
  111. package/build-types/number-control/index.d.ts +3 -3
  112. package/build-types/number-control/index.d.ts.map +1 -1
  113. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  114. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  115. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  116. package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts +0 -4
  117. package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts.map +1 -1
  118. package/build-types/unit-control/index.d.ts +7 -4
  119. package/build-types/unit-control/index.d.ts.map +1 -1
  120. package/build-types/unit-control/stories/index.d.ts +33 -0
  121. package/build-types/unit-control/stories/index.d.ts.map +1 -0
  122. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  123. package/build-types/unit-control/types.d.ts +23 -6
  124. package/build-types/unit-control/types.d.ts.map +1 -1
  125. package/build-types/unit-control/unit-select-control.d.ts.map +1 -1
  126. package/package.json +17 -17
  127. package/src/base-control/README.md +9 -1
  128. package/src/base-control/index.js +20 -13
  129. package/src/base-control/stories/index.js +2 -2
  130. package/src/base-control/styles/base-control-styles.js +23 -1
  131. package/src/box-control/all-input-control.js +2 -10
  132. package/src/box-control/axial-input-controls.js +32 -21
  133. package/src/box-control/input-controls.js +30 -19
  134. package/src/box-control/utils.js +29 -12
  135. package/src/checkbox-control/index.js +34 -3
  136. package/src/checkbox-control/stories/index.js +44 -0
  137. package/src/checkbox-control/style.scss +4 -2
  138. package/src/color-palette/index.js +73 -8
  139. package/src/color-palette/stories/index.js +62 -26
  140. package/src/color-palette/style.scss +11 -3
  141. package/src/color-palette/test/__snapshots__/index.js.snap +662 -12
  142. package/src/color-palette/test/index.js +1 -1
  143. package/src/custom-select-control/index.js +8 -2
  144. package/src/custom-select-control/stories/index.js +77 -74
  145. package/src/custom-select-control/style.scss +18 -3
  146. package/src/divider/stories/index.tsx +26 -23
  147. package/src/divider/styles.ts +9 -0
  148. package/src/divider/types.ts +11 -1
  149. package/src/focal-point-picker/controls.js +2 -3
  150. package/src/font-size-picker/test/index.js +0 -2
  151. package/src/form-file-upload/README.md +18 -0
  152. package/src/form-file-upload/index.js +3 -0
  153. package/src/form-file-upload/test/index.js +73 -11
  154. package/src/input-control/input-field.tsx +23 -12
  155. package/src/input-control/reducer/actions.ts +1 -7
  156. package/src/input-control/reducer/reducer.ts +0 -29
  157. package/src/input-control/types.ts +2 -1
  158. package/src/number-control/README.md +14 -0
  159. package/src/number-control/index.js +13 -12
  160. package/src/number-control/stories/index.js +14 -7
  161. package/src/number-control/test/index.js +79 -1
  162. package/src/range-control/stories/index.js +91 -119
  163. package/src/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +1 -0
  164. package/src/toggle-group-control/test/__snapshots__/index.js.snap +0 -27
  165. package/src/toggle-group-control/toggle-group-control-option/component.tsx +1 -4
  166. package/src/toggle-group-control/toggle-group-control-option/styles.ts +0 -12
  167. package/src/toolbar-group/style.scss +0 -73
  168. package/src/tree-grid/README.md +1 -1
  169. package/src/tree-grid/index.js +4 -0
  170. package/src/tree-grid/test/index.js +61 -17
  171. package/src/unit-control/README.md +1 -3
  172. package/src/unit-control/index.tsx +59 -30
  173. package/src/unit-control/stories/index.tsx +170 -0
  174. package/src/unit-control/test/index.js +143 -100
  175. package/src/unit-control/types.ts +60 -41
  176. package/src/unit-control/unit-select-control.tsx +2 -3
  177. package/tsconfig.tsbuildinfo +1 -1
  178. package/src/unit-control/stories/index.js +0 -127
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/toggle-group-control/toggle-group-control-option/component.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,6BAA6B,EAAoB,MAAM,UAAU,CAAC;AA+EhF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,iCAAiC,8FAGtC,CAAC;AAEF,eAAe,iCAAiC,CAAC"}
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/toggle-group-control/toggle-group-control-option/component.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,6BAA6B,EAAoB,MAAM,UAAU,CAAC;AA4EhF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,iCAAiC,8FAGtC,CAAC;AAEF,eAAe,iCAAiC,CAAC"}
@@ -11,9 +11,5 @@ export declare const ButtonContentView: import("@emotion/styled").StyledComponen
11
11
  as?: import("react").ElementType<any> | undefined;
12
12
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
13
13
  export declare const separatorActive: import("@emotion/utils").SerializedStyles;
14
- export declare const LabelPlaceholderView: import("@emotion/styled").StyledComponent<{
15
- theme?: import("@emotion/react").Theme | undefined;
16
- as?: import("react").ElementType<any> | undefined;
17
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
18
14
  export declare const medium: import("@emotion/utils").SerializedStyles;
19
15
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/toggle-group-control/toggle-group-control-option/styles.ts"],"names":[],"mappings":";AAWA,eAAO,MAAM,SAAS;;;yGAKrB,CAAC;AAEF,eAAO,MAAM,UAAU,2CAEtB,CAAC;AAEF,eAAO,MAAM,UAAU,2CA+BtB,CAAC;AAEF,eAAO,MAAM,YAAY,2CAGxB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;yGAO7B,CAAC;AAEF,eAAO,MAAM,eAAe,2CAE3B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;yGAMhC,CAAC;AAEF,eAAO,MAAM,MAAM,2CAElB,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/toggle-group-control/toggle-group-control-option/styles.ts"],"names":[],"mappings":";AAWA,eAAO,MAAM,SAAS;;;yGAKrB,CAAC;AAEF,eAAO,MAAM,UAAU,2CAEtB,CAAC;AAEF,eAAO,MAAM,UAAU,2CA+BtB,CAAC;AAEF,eAAO,MAAM,YAAY,2CAGxB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;yGAG7B,CAAC;AAEF,eAAO,MAAM,eAAe,2CAE3B,CAAC;AAEF,eAAO,MAAM,MAAM,2CAElB,CAAC"}
@@ -2,7 +2,7 @@
2
2
  import type { UnitControlOnChangeCallback } from './types';
3
3
  import type { StateReducer } from '../input-control/reducer/state';
4
4
  /**
5
- * `UnitControl` allows the user to set a value as well as a unit (e.g. `px`).
5
+ * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).
6
6
  *
7
7
  *
8
8
  * @example
@@ -17,7 +17,7 @@ import type { StateReducer } from '../input-control/reducer/state';
17
17
  * };
18
18
  * ```
19
19
  */
20
- declare const ForwardedUnitControl: import("react").ForwardRefExoticComponent<Pick<import("./types").UnitSelectControlProps & {
20
+ export declare const UnitControl: import("react").ForwardRefExoticComponent<Pick<Omit<import("./types").UnitSelectControlProps, "unit"> & Pick<import("../input-control/types").InputControlProps, "hideLabelFromVision"> & {
21
21
  __unstableStateReducer?: StateReducer | undefined;
22
22
  __unstableInputWidth?: import("csstype").Property.Width<string | number> | undefined;
23
23
  disableUnits?: boolean | undefined;
@@ -25,10 +25,13 @@ declare const ForwardedUnitControl: import("react").ForwardRefExoticComponent<Pi
25
25
  isResetValueOnUnitChange?: boolean | undefined;
26
26
  label?: string | undefined;
27
27
  onUnitChange?: UnitControlOnChangeCallback | undefined;
28
+ unit?: string | undefined;
28
29
  value?: string | number | undefined;
30
+ isShiftStepEnabled?: boolean | undefined;
31
+ shiftStep?: number | undefined;
29
32
  } & Omit<Pick<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof import("react").InputHTMLAttributes<HTMLInputElement>> & {
30
33
  ref?: ((instance: HTMLInputElement | null) => void) | import("react").RefObject<HTMLInputElement> | null | undefined;
31
- }, "children" | "value" | "label" | "as" | "__unstableInputWidth" | "isPressEnterToChange" | "__unstableStateReducer" | "disableUnits" | keyof import("./types").UnitSelectControlProps | "isResetValueOnUnitChange" | "onUnitChange">, "type" | "value" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "className" | "color" | "height" | "id" | "lang" | "max" | "min" | "name" | "width" | "role" | "tabIndex" | "crossOrigin" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "key" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "alt" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "autoComplete" | "accept" | "capture" | "checked" | "enterKeyHint" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "step" | "__unstableInputWidth" | "isPressEnterToChange" | "__unstableStateReducer" | "disableUnits" | keyof import("./types").UnitSelectControlProps | "isResetValueOnUnitChange" | "onUnitChange"> & import("react").RefAttributes<any>>;
34
+ }, "children" | "value" | "label" | "as" | "onChange" | "size" | "hideLabelFromVision" | "__unstableInputWidth" | "isPressEnterToChange" | "__unstableStateReducer" | "isShiftStepEnabled" | "shiftStep" | "unit" | "isUnitSelectTabbable" | "units" | "disableUnits" | "isResetValueOnUnitChange" | "onUnitChange">, "type" | "value" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "className" | "color" | "height" | "id" | "lang" | "max" | "min" | "name" | "width" | "role" | "tabIndex" | "crossOrigin" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "key" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "alt" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "autoComplete" | "accept" | "capture" | "checked" | "enterKeyHint" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "size" | "step" | "hideLabelFromVision" | "__unstableInputWidth" | "isPressEnterToChange" | "__unstableStateReducer" | "isShiftStepEnabled" | "shiftStep" | "unit" | "isUnitSelectTabbable" | "units" | "disableUnits" | "isResetValueOnUnitChange" | "onUnitChange"> & import("react").RefAttributes<any>>;
32
35
  export { parseQuantityAndUnitFromRawValue, useCustomUnits } from './utils';
33
- export default ForwardedUnitControl;
36
+ export default UnitControl;
34
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/unit-control/index.tsx"],"names":[],"mappings":";AAmCA,OAAO,KAAK,EAAoB,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AA2NnE;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,oBAAoB;;;;;;;;;;;mzKAA4B,CAAC;AAEvD,OAAO,EAAE,gCAAgC,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC3E,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/unit-control/index.tsx"],"names":[],"mappings":";AAmCA,OAAO,KAAK,EAAoB,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAwPnE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;+8KAAuC,CAAC;AAEhE,OAAO,EAAE,gCAAgC,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC3E,eAAe,WAAW,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import { UnitControl } from '../';
9
+ declare const meta: ComponentMeta<typeof UnitControl>;
10
+ export default meta;
11
+ export declare const Default: ComponentStory<typeof UnitControl>;
12
+ /**
13
+ * If the `isPressEnterToChange` prop is set to `true`, the `onChange` callback
14
+ * will not fire while a new value is typed in the input field (you can verify this
15
+ * behavior by inspecting the console's output).
16
+ */
17
+ export declare const PressEnterToChange: ComponentStory<typeof UnitControl>;
18
+ /**
19
+ * Most of `NumberControl`'s props can be passed to `UnitControl`, and they will
20
+ * affect its numeric input field.
21
+ */
22
+ export declare const TweakingTheNumberInput: ComponentStory<typeof UnitControl>;
23
+ /**
24
+ * When only one unit is available, the unit selection dropdown becomes static text.
25
+ */
26
+ export declare const WithSingleUnit: ComponentStory<typeof UnitControl>;
27
+ /**
28
+ * It is possible to pass a custom list of units. Every time the unit changes,
29
+ * if the `isResetValueOnUnitChange` is set to `true`, the input's quantity is
30
+ * reset to the new unit's default value.
31
+ */
32
+ export declare const WithCustomUnits: ComponentStory<typeof UnitControl>;
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/unit-control/stories/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOtE;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAGlC,QAAA,MAAM,IAAI,EAAE,aAAa,CAAE,OAAO,WAAW,CA8B5C,CAAC;AACF,eAAe,IAAI,CAAC;AAsBpB,eAAO,MAAM,OAAO,EAAE,cAAc,CACnC,OAAO,WAAW,CACW,CAAC;AAK/B;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAC9C,OAAO,WAAW,CACW,CAAC;AAU/B;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,cAAc,CAClD,OAAO,WAAW,CACW,CAAC;AAS/B;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAC1C,OAAO,WAAW,CACW,CAAC;AAM/B;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAE,OAAO,WAAW,CAkB/D,CAAC"}
@@ -13,7 +13,7 @@ export declare const Root: import("@emotion/styled").StyledComponent<{
13
13
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
14
14
  export declare const ValueInput: import("@emotion/styled").StyledComponent<Pick<{
15
15
  [x: string]: any;
16
- __unstableStateReducer?: ((state: any) => any) | undefined;
16
+ __unstableStateReducer: any;
17
17
  className: any;
18
18
  dragDirection?: string | undefined;
19
19
  hideHTMLArrows?: boolean | undefined;
@@ -6,7 +6,7 @@ import type { CSSProperties, SyntheticEvent } from 'react';
6
6
  * Internal dependencies
7
7
  */
8
8
  import type { StateReducer } from '../input-control/reducer/state';
9
- import type { InputChangeCallback, Size as InputSize } from '../input-control/types';
9
+ import type { InputChangeCallback, InputControlProps, Size as InputSize } from '../input-control/types';
10
10
  export declare type SelectSize = InputSize;
11
11
  export declare type WPUnitControlUnit = {
12
12
  /**
@@ -42,8 +42,6 @@ export declare type UnitSelectControlProps = {
42
42
  isUnitSelectTabbable?: boolean;
43
43
  /**
44
44
  * A callback function invoked when the value is changed.
45
- *
46
- * @default noop
47
45
  */
48
46
  onChange?: UnitControlOnChangeCallback;
49
47
  /**
@@ -63,7 +61,7 @@ export declare type UnitSelectControlProps = {
63
61
  */
64
62
  units?: WPUnitControlUnit[];
65
63
  };
66
- export declare type UnitControlProps = UnitSelectControlProps & {
64
+ export declare type UnitControlProps = Omit<UnitSelectControlProps, 'unit'> & Pick<InputControlProps, 'hideLabelFromVision'> & {
67
65
  __unstableStateReducer?: StateReducer;
68
66
  __unstableInputWidth?: CSSProperties['width'];
69
67
  /**
@@ -92,14 +90,33 @@ export declare type UnitControlProps = UnitSelectControlProps & {
92
90
  label?: string;
93
91
  /**
94
92
  * Callback when the `unit` changes.
95
- *
96
- * @default noop
97
93
  */
98
94
  onUnitChange?: UnitControlOnChangeCallback;
95
+ /**
96
+ * Current unit. _Note: this prop is deprecated. Instead, provide a unit with a value through the `value` prop._
97
+ *
98
+ * @deprecated
99
+ */
100
+ unit?: string;
99
101
  /**
100
102
  * Current value. If passed as a string, the current unit will be inferred from this value.
101
103
  * For example, a `value` of "50%" will set the current unit to `%`.
102
104
  */
103
105
  value?: string | number;
106
+ /**
107
+ * If true, pressing `UP` or `DOWN` along with the `SHIFT` key will increment
108
+ * the value by the `shiftStep` value.
109
+ *
110
+ * @default true
111
+ */
112
+ isShiftStepEnabled?: boolean;
113
+ /**
114
+ * Amount to increment by when the `SHIFT` key is held down. This shift value
115
+ * is a multiplier to the `step` value. For example, if the `step` value is `5`,
116
+ * and `shiftStep` is `10`, each jump would increment/decrement by `50`.
117
+ *
118
+ * @default 10
119
+ */
120
+ shiftStep?: number;
104
121
  };
105
122
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/unit-control/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE3D;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EACX,mBAAmB,EACnB,IAAI,IAAI,SAAS,EACjB,MAAM,wBAAwB,CAAC;AAEhC,oBAAY,UAAU,GAAG,SAAS,CAAC;AAEnC,oBAAY,iBAAiB,GAAG;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oBAAY,2BAA2B,GAAG,mBAAmB,CAC5D,cAAc,CAAE,iBAAiB,GAAG,gBAAgB,CAAE,EACtD;IAAE,IAAI,CAAC,EAAE,iBAAiB,CAAA;CAAE,CAC5B,CAAC;AAEF,oBAAY,sBAAsB,GAAG;IACpC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,2BAA2B,CAAC;IACvC;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC5B,CAAC;AAGF,oBAAY,gBAAgB,GAAG,sBAAsB,GAAG;IACvD,sBAAsB,CAAC,EAAE,YAAY,CAAC;IACtC,oBAAoB,CAAC,EAAE,aAAa,CAAE,OAAO,CAAE,CAAC;IAChD;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,2BAA2B,CAAC;IAC3C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/unit-control/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE3D;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EACX,mBAAmB,EACnB,iBAAiB,EACjB,IAAI,IAAI,SAAS,EACjB,MAAM,wBAAwB,CAAC;AAEhC,oBAAY,UAAU,GAAG,SAAS,CAAC;AAEnC,oBAAY,iBAAiB,GAAG;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oBAAY,2BAA2B,GAAG,mBAAmB,CAC5D,cAAc,CAAE,iBAAiB,GAAG,gBAAgB,CAAE,EACtD;IAAE,IAAI,CAAC,EAAE,iBAAiB,CAAA;CAAE,CAC5B,CAAC;AAEF,oBAAY,sBAAsB,GAAG;IACpC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,2BAA2B,CAAC;IACvC;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC5B,CAAC;AAGF,oBAAY,gBAAgB,GAAG,IAAI,CAAE,sBAAsB,EAAE,MAAM,CAAE,GACpE,IAAI,CAAE,iBAAiB,EAAE,qBAAqB,CAAE,GAAG;IAClD,sBAAsB,CAAC,EAAE,YAAY,CAAC;IACtC,oBAAoB,CAAC,EAAE,aAAa,CAAE,OAAO,CAAE,CAAC;IAChD;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,2BAA2B,CAAC;IAC3C;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"unit-select-control.d.ts","sourceRoot":"","sources":["../../src/unit-control/unit-select-control.tsx"],"names":[],"mappings":";AAOA;;GAEG;AACH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAE,EAC1C,SAAS,EACT,oBAAoB,EAAE,UAAiB,EACvC,QAAe,EACf,IAAgB,EAChB,IAAW,EACX,KAAiB,EACjB,GAAG,KAAK,EACR,EAAE,uBAAuB,CAAE,sBAAsB,EAAE,QAAQ,EAAE,KAAK,CAAE,eAqCpE"}
1
+ {"version":3,"file":"unit-select-control.d.ts","sourceRoot":"","sources":["../../src/unit-control/unit-select-control.tsx"],"names":[],"mappings":";AAMA;;GAEG;AACH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAE,EAC1C,SAAS,EACT,oBAAoB,EAAE,UAAiB,EACvC,QAAQ,EACR,IAAgB,EAChB,IAAW,EACX,KAAiB,EACjB,GAAG,KAAK,EACR,EAAE,uBAAuB,CAAE,sBAAsB,EAAE,QAAQ,EAAE,KAAK,CAAE,eAqCpE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/components",
3
- "version": "19.7.0-next.e230fbab09.0",
3
+ "version": "19.7.0",
4
4
  "description": "UI components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -37,21 +37,21 @@
37
37
  "@emotion/styled": "^11.6.0",
38
38
  "@emotion/utils": "1.0.0",
39
39
  "@use-gesture/react": "^10.2.6",
40
- "@wordpress/a11y": "^3.4.0-next.e230fbab09.0",
41
- "@wordpress/compose": "^5.2.0-next.e230fbab09.0",
42
- "@wordpress/date": "^4.4.0-next.e230fbab09.0",
43
- "@wordpress/deprecated": "^3.4.0-next.e230fbab09.0",
44
- "@wordpress/dom": "^3.4.0-next.e230fbab09.0",
45
- "@wordpress/element": "^4.3.0-next.e230fbab09.0",
46
- "@wordpress/escape-html": "^2.4.0-next.e230fbab09.0",
47
- "@wordpress/hooks": "^3.4.0-next.e230fbab09.0",
48
- "@wordpress/i18n": "^4.4.0-next.e230fbab09.0",
49
- "@wordpress/icons": "^7.1.0-next.e230fbab09.0",
50
- "@wordpress/is-shallow-equal": "^4.4.0-next.e230fbab09.0",
51
- "@wordpress/keycodes": "^3.4.0-next.e230fbab09.0",
52
- "@wordpress/primitives": "^3.2.0-next.e230fbab09.0",
53
- "@wordpress/rich-text": "^5.2.0-next.e230fbab09.0",
54
- "@wordpress/warning": "^2.4.0-next.e230fbab09.0",
40
+ "@wordpress/a11y": "^3.5.0",
41
+ "@wordpress/compose": "^5.3.0",
42
+ "@wordpress/date": "^4.5.0",
43
+ "@wordpress/deprecated": "^3.5.0",
44
+ "@wordpress/dom": "^3.5.0",
45
+ "@wordpress/element": "^4.3.0",
46
+ "@wordpress/escape-html": "^2.5.0",
47
+ "@wordpress/hooks": "^3.5.0",
48
+ "@wordpress/i18n": "^4.5.0",
49
+ "@wordpress/icons": "^8.1.0",
50
+ "@wordpress/is-shallow-equal": "^4.5.0",
51
+ "@wordpress/keycodes": "^3.5.0",
52
+ "@wordpress/primitives": "^3.3.0",
53
+ "@wordpress/rich-text": "^5.3.0",
54
+ "@wordpress/warning": "^2.5.0",
55
55
  "classnames": "^2.3.1",
56
56
  "colord": "^2.7.0",
57
57
  "dom-scroll-into-view": "^1.2.1",
@@ -76,5 +76,5 @@
76
76
  "publishConfig": {
77
77
  "access": "public"
78
78
  },
79
- "gitHead": "308df03e6a96ded732f9c4e32471b1b4f8dea54a"
79
+ "gitHead": "aa003c3634016cc4ab6348b2106907e371c648e1"
80
80
  }
@@ -10,7 +10,7 @@ Render a BaseControl for a textarea input:
10
10
  import { BaseControl } from '@wordpress/components';
11
11
 
12
12
  const MyBaseControl = () => (
13
- <BaseControl id="textarea-1" label="Text" help="Enter some text">
13
+ <BaseControl id="textarea-1" label="Text" help="Enter some text" __nextHasNoMarginBottom={ true }>
14
14
  <textarea id="textarea-1" />
15
15
  </BaseControl>
16
16
  );
@@ -63,6 +63,14 @@ The content to be displayed within the BaseControl.
63
63
  - Type: `Element`
64
64
  - Required: Yes
65
65
 
66
+ ### __nextHasNoMarginBottom
67
+
68
+ Start opting into the new margin-free styles that will become the default in a future version.
69
+
70
+ - Type: `Boolean`
71
+ - Required: No
72
+ - Default: `false`
73
+
66
74
  ## BaseControl.VisualLabel
67
75
 
68
76
  `BaseControl.VisualLabel` component is used to render a purely visual label inside a `BaseControl` component.
@@ -17,18 +17,19 @@ import {
17
17
 
18
18
  /**
19
19
  * @typedef Props
20
- * @property {string} [id] The id of the element to which labels and help text are being generated.
21
- * That element should be passed as a child.
22
- * @property {import('react').ReactNode} help If this property is added, a help text will be
23
- * generated using help property as the content.
24
- * @property {import('react').ReactNode} [label] If this property is added, a label will be generated
25
- * using label property as the content.
26
- * @property {boolean} [hideLabelFromVision] If true, the label will only be visible to screen readers.
27
- * @property {string} [className] The class that will be added with "components-base-control" to the
28
- * classes of the wrapper div. If no className is passed only
29
- * components-base-control is used.
30
- * @property {import('react').ReactNode} [children] The content to be displayed within
31
- * the BaseControl.
20
+ * @property {boolean} [__nextHasNoMarginBottom] Start opting into the new margin-free styles that will become the default in a future version.
21
+ * @property {string} [id] The id of the element to which labels and help text are being generated.
22
+ * That element should be passed as a child.
23
+ * @property {import('react').ReactNode} help If this property is added, a help text will be
24
+ * generated using help property as the content.
25
+ * @property {import('react').ReactNode} [label] If this property is added, a label will be generated
26
+ * using label property as the content.
27
+ * @property {boolean} [hideLabelFromVision] If true, the label will only be visible to screen readers.
28
+ * @property {string} [className] The class that will be added with "components-base-control" to the
29
+ * classes of the wrapper div. If no className is passed only
30
+ * components-base-control is used.
31
+ * @property {import('react').ReactNode} [children] The content to be displayed within
32
+ * the BaseControl.
32
33
  */
33
34
 
34
35
  /**
@@ -36,6 +37,7 @@ import {
36
37
  * @return {JSX.Element} Element
37
38
  */
38
39
  function BaseControl( {
40
+ __nextHasNoMarginBottom = false,
39
41
  id,
40
42
  label,
41
43
  hideLabelFromVision,
@@ -47,7 +49,11 @@ function BaseControl( {
47
49
  <Wrapper
48
50
  className={ classnames( 'components-base-control', className ) }
49
51
  >
50
- <StyledField className="components-base-control__field">
52
+ <StyledField
53
+ className="components-base-control__field"
54
+ // TODO: Official deprecation for this should start after all internal usages have been migrated
55
+ __nextHasNoMarginBottom={ __nextHasNoMarginBottom }
56
+ >
51
57
  { label &&
52
58
  id &&
53
59
  ( hideLabelFromVision ? (
@@ -77,6 +83,7 @@ function BaseControl( {
77
83
  <StyledHelp
78
84
  id={ id ? id + '__help' : undefined }
79
85
  className="components-base-control__help"
86
+ __nextHasNoMarginBottom={ __nextHasNoMarginBottom }
80
87
  >
81
88
  { help }
82
89
  </StyledHelp>
@@ -4,7 +4,6 @@
4
4
  import BaseControl from '../';
5
5
  import Button from '../../button';
6
6
  import { Spacer } from '../../spacer';
7
- import TextareaControl from '../../textarea-control';
8
7
 
9
8
  export default {
10
9
  title: 'Components/BaseControl',
@@ -15,13 +14,14 @@ export default {
15
14
  const BaseControlWithTextarea = ( { id, ...props } ) => {
16
15
  return (
17
16
  <BaseControl id={ id } { ...props }>
18
- <TextareaControl id={ id } />
17
+ <textarea style={ { display: 'block' } } id={ id } />
19
18
  </BaseControl>
20
19
  );
21
20
  };
22
21
 
23
22
  export const Default = BaseControlWithTextarea.bind( {} );
24
23
  Default.args = {
24
+ __nextHasNoMarginBottom: true,
25
25
  id: 'textarea-1',
26
26
  label: '',
27
27
  hideLabelFromVision: false,
@@ -15,8 +15,17 @@ export const Wrapper = styled.div`
15
15
  font-size: ${ font( 'default.fontSize' ) };
16
16
  `;
17
17
 
18
+ const deprecatedMarginField = ( { __nextHasNoMarginBottom = false } ) => {
19
+ return (
20
+ ! __nextHasNoMarginBottom &&
21
+ css`
22
+ margin-bottom: ${ space( 2 ) };
23
+ `
24
+ );
25
+ };
26
+
18
27
  export const StyledField = styled.div`
19
- margin-bottom: ${ space( 2 ) };
28
+ ${ deprecatedMarginField }
20
29
 
21
30
  .components-panel__row & {
22
31
  margin-bottom: inherit;
@@ -32,10 +41,23 @@ export const StyledLabel = styled.label`
32
41
  ${ labelStyles }
33
42
  `;
34
43
 
44
+ const deprecatedMarginHelp = ( { __nextHasNoMarginBottom = false } ) => {
45
+ return (
46
+ ! __nextHasNoMarginBottom &&
47
+ css`
48
+ margin-bottom: revert;
49
+ `
50
+ );
51
+ };
52
+
35
53
  export const StyledHelp = styled.p`
54
+ margin-top: ${ space( 2 ) };
55
+ margin-bottom: 0;
36
56
  font-size: ${ font( 'helpText.fontSize' ) };
37
57
  font-style: normal;
38
58
  color: ${ COLORS.mediumGray.text };
59
+
60
+ ${ deprecatedMarginHelp }
39
61
  `;
40
62
 
41
63
  export const StyledVisualLabel = styled.span`
@@ -10,7 +10,6 @@ import {
10
10
  ALL_SIDES,
11
11
  LABELS,
12
12
  getAllValue,
13
- getAllUnitFallback,
14
13
  isValuesMixed,
15
14
  isValuesDefined,
16
15
  } from './utils';
@@ -26,17 +25,11 @@ export default function AllInputControl( {
26
25
  setSelectedUnits,
27
26
  ...props
28
27
  } ) {
29
- const allValue = getAllValue( values, sides );
28
+ const allValue = getAllValue( values, selectedUnits, sides );
30
29
  const hasValues = isValuesDefined( values );
31
- const isMixed = hasValues && isValuesMixed( values, sides );
30
+ const isMixed = hasValues && isValuesMixed( values, selectedUnits, sides );
32
31
  const allPlaceholder = isMixed ? LABELS.mixed : null;
33
32
 
34
- // Set meaningful unit selection if no allValue and user has previously
35
- // selected units without assigning values while controls were unlinked.
36
- const allUnitFallback = ! allValue
37
- ? getAllUnitFallback( selectedUnits )
38
- : undefined;
39
-
40
33
  const handleOnFocus = ( event ) => {
41
34
  onFocus( event, { side: 'all' } );
42
35
  };
@@ -104,7 +97,6 @@ export default function AllInputControl( {
104
97
  disableUnits={ isMixed }
105
98
  isOnly
106
99
  value={ allValue }
107
- unit={ allUnitFallback }
108
100
  onChange={ handleOnChange }
109
101
  onUnitChange={ handleOnUnitChange }
110
102
  onFocus={ handleOnFocus }
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
+ import { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';
4
5
  import UnitControl from './unit-control';
5
6
  import { LABELS } from './utils';
6
7
  import { Layout } from './styles/box-control-styles';
@@ -113,27 +114,37 @@ export default function AxialInputControls( {
113
114
  align="top"
114
115
  className="component-box-control__vertical-horizontal-input-controls"
115
116
  >
116
- { filteredSides.map( ( side ) => (
117
- <UnitControl
118
- { ...props }
119
- isFirst={ first === side }
120
- isLast={ last === side }
121
- isOnly={ only === side }
122
- value={ side === 'vertical' ? values.top : values.left }
123
- unit={
124
- side === 'vertical'
125
- ? selectedUnits.top
126
- : selectedUnits.left
127
- }
128
- onChange={ createHandleOnChange( side ) }
129
- onUnitChange={ createHandleOnUnitChange( side ) }
130
- onFocus={ createHandleOnFocus( side ) }
131
- onHoverOn={ createHandleOnHoverOn( side ) }
132
- onHoverOff={ createHandleOnHoverOff( side ) }
133
- label={ LABELS[ side ] }
134
- key={ side }
135
- />
136
- ) ) }
117
+ { filteredSides.map( ( side ) => {
118
+ const [
119
+ parsedQuantity,
120
+ parsedUnit,
121
+ ] = parseQuantityAndUnitFromRawValue(
122
+ side === 'vertical' ? values.top : values.left
123
+ );
124
+ const selectedUnit =
125
+ side === 'vertical'
126
+ ? selectedUnits.top
127
+ : selectedUnits.left;
128
+ return (
129
+ <UnitControl
130
+ { ...props }
131
+ isFirst={ first === side }
132
+ isLast={ last === side }
133
+ isOnly={ only === side }
134
+ value={ [
135
+ parsedQuantity,
136
+ selectedUnit ?? parsedUnit,
137
+ ].join( '' ) }
138
+ onChange={ createHandleOnChange( side ) }
139
+ onUnitChange={ createHandleOnUnitChange( side ) }
140
+ onFocus={ createHandleOnFocus( side ) }
141
+ onHoverOn={ createHandleOnHoverOn( side ) }
142
+ onHoverOff={ createHandleOnHoverOff( side ) }
143
+ label={ LABELS[ side ] }
144
+ key={ side }
145
+ />
146
+ );
147
+ } ) }
137
148
  </Layout>
138
149
  );
139
150
  }
@@ -7,6 +7,7 @@ import { noop } from 'lodash';
7
7
  * Internal dependencies
8
8
  */
9
9
  import UnitControl from './unit-control';
10
+ import { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';
10
11
  import { ALL_SIDES, LABELS } from './utils';
11
12
  import { LayoutContainer, Layout } from './styles/box-control-styles';
12
13
 
@@ -91,25 +92,35 @@ export default function BoxInputControls( {
91
92
  align="top"
92
93
  className="component-box-control__input-controls"
93
94
  >
94
- { filteredSides.map( ( side ) => (
95
- <UnitControl
96
- { ...props }
97
- isFirst={ first === side }
98
- isLast={ last === side }
99
- isOnly={ only === side }
100
- value={ values[ side ] }
101
- unit={
102
- values[ side ] ? undefined : selectedUnits[ side ]
103
- }
104
- onChange={ createHandleOnChange( side ) }
105
- onUnitChange={ createHandleOnUnitChange( side ) }
106
- onFocus={ createHandleOnFocus( side ) }
107
- onHoverOn={ createHandleOnHoverOn( side ) }
108
- onHoverOff={ createHandleOnHoverOff( side ) }
109
- label={ LABELS[ side ] }
110
- key={ `box-control-${ side }` }
111
- />
112
- ) ) }
95
+ { filteredSides.map( ( side ) => {
96
+ const [
97
+ parsedQuantity,
98
+ parsedUnit,
99
+ ] = parseQuantityAndUnitFromRawValue( values[ side ] );
100
+
101
+ const computedUnit = values[ side ]
102
+ ? parsedUnit
103
+ : selectedUnits[ side ];
104
+
105
+ return (
106
+ <UnitControl
107
+ { ...props }
108
+ isFirst={ first === side }
109
+ isLast={ last === side }
110
+ isOnly={ only === side }
111
+ value={ [ parsedQuantity, computedUnit ].join(
112
+ ''
113
+ ) }
114
+ onChange={ createHandleOnChange( side ) }
115
+ onUnitChange={ createHandleOnUnitChange( side ) }
116
+ onFocus={ createHandleOnFocus( side ) }
117
+ onHoverOn={ createHandleOnHoverOn( side ) }
118
+ onHoverOff={ createHandleOnHoverOff( side ) }
119
+ label={ LABELS[ side ] }
120
+ key={ `box-control-${ side }` }
121
+ />
122
+ );
123
+ } ) }
113
124
  </Layout>
114
125
  </LayoutContainer>
115
126
  );