@wordpress/components 29.0.0 → 29.1.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.
- package/CHANGELOG.md +39 -1
- package/LICENSE.md +1 -1
- package/build/badge/index.js +64 -0
- package/build/badge/index.js.map +1 -0
- package/build/badge/types.js +6 -0
- package/build/badge/types.js.map +1 -0
- package/build/box-control/index.js +5 -1
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/input-control.js +90 -29
- package/build/box-control/input-control.js.map +1 -1
- package/build/box-control/types.js.map +1 -1
- package/build/box-control/utils.js +50 -0
- package/build/box-control/utils.js.map +1 -1
- package/build/button-group/index.js +10 -0
- package/build/button-group/index.js.map +1 -1
- package/build/button-group/types.js.map +1 -1
- package/build/custom-select-control/index.js +3 -5
- package/build/custom-select-control/index.js.map +1 -1
- package/build/custom-select-control-v2/custom-select.js +2 -3
- package/build/custom-select-control-v2/custom-select.js.map +1 -1
- package/build/date-time/date/index.js +1 -0
- package/build/date-time/date/index.js.map +1 -1
- package/build/dimension-control/index.js +1 -0
- package/build/dimension-control/index.js.map +1 -1
- package/build/font-size-picker/styles.js +9 -9
- package/build/font-size-picker/styles.js.map +1 -1
- package/build/heading/hook.js +1 -1
- package/build/heading/hook.js.map +1 -1
- package/build/input-control/index.js +9 -0
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/types.js.map +1 -1
- package/build/menu/checkbox-item.js +2 -0
- package/build/menu/checkbox-item.js.map +1 -1
- package/build/menu/index.js +25 -94
- package/build/menu/index.js.map +1 -1
- package/build/menu/item.js +10 -1
- package/build/menu/item.js.map +1 -1
- package/build/menu/popover.js +89 -0
- package/build/menu/popover.js.map +1 -0
- package/build/menu/radio-item.js +2 -0
- package/build/menu/radio-item.js.map +1 -1
- package/build/menu/submenu-trigger-item.js +58 -0
- package/build/menu/submenu-trigger-item.js.map +1 -0
- package/build/menu/trigger-button.js +45 -0
- package/build/menu/trigger-button.js.map +1 -0
- package/build/menu/types.js.map +1 -1
- package/build/navigation/back-button/index.js +1 -0
- package/build/navigation/back-button/index.js.map +1 -1
- package/build/navigation/index.js +6 -0
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/item/index.js +1 -0
- package/build/navigation/item/index.js.map +1 -1
- package/build/number-control/index.js +1 -0
- package/build/number-control/index.js.map +1 -1
- package/build/palette-edit/index.js +1 -0
- package/build/palette-edit/index.js.map +1 -1
- package/build/private-apis.js +3 -1
- package/build/private-apis.js.map +1 -1
- package/build/radio-group/index.js +6 -0
- package/build/radio-group/index.js.map +1 -1
- package/build/radio-group/radio.js +2 -3
- package/build/radio-group/radio.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +28 -28
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/select-control/index.js +9 -0
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/types.js.map +1 -1
- package/build/slot-fill/context.js +4 -3
- package/build/slot-fill/context.js.map +1 -1
- package/build/slot-fill/fill.js +10 -15
- package/build/slot-fill/fill.js.map +1 -1
- package/build/slot-fill/provider.js +41 -55
- package/build/slot-fill/provider.js.map +1 -1
- package/build/slot-fill/slot.js +31 -23
- package/build/slot-fill/slot.js.map +1 -1
- package/build/slot-fill/types.js.map +1 -1
- package/build/tab-panel/index.js +2 -3
- package/build/tab-panel/index.js.map +1 -1
- package/build/tabs/index.js +21 -4
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/types.js.map +1 -1
- package/build/text/hook.js +6 -6
- package/build/text/hook.js.map +1 -1
- package/build/text/styles.js +7 -7
- package/build/text/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js +2 -3
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build/tooltip/index.js +2 -3
- package/build/tooltip/index.js.map +1 -1
- package/build/tree-select/index.js +10 -2
- package/build/tree-select/index.js.map +1 -1
- package/build/tree-select/types.js.map +1 -1
- package/build-module/badge/index.js +57 -0
- package/build-module/badge/index.js.map +1 -0
- package/build-module/badge/types.js +2 -0
- package/build-module/badge/types.js.map +1 -0
- package/build-module/box-control/index.js +5 -1
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/input-control.js +92 -31
- package/build-module/box-control/input-control.js.map +1 -1
- package/build-module/box-control/types.js.map +1 -1
- package/build-module/box-control/utils.js +47 -0
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/button-group/index.js +10 -0
- package/build-module/button-group/index.js.map +1 -1
- package/build-module/button-group/types.js.map +1 -1
- package/build-module/custom-select-control/index.js +3 -5
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/custom-select-control-v2/custom-select.js +1 -2
- package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
- package/build-module/date-time/date/index.js +1 -0
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/dimension-control/index.js +1 -0
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/font-size-picker/styles.js +9 -9
- package/build-module/font-size-picker/styles.js.map +1 -1
- package/build-module/heading/hook.js +1 -1
- package/build-module/heading/hook.js.map +1 -1
- package/build-module/input-control/index.js +9 -0
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/types.js.map +1 -1
- package/build-module/menu/checkbox-item.js +2 -0
- package/build-module/menu/checkbox-item.js.map +1 -1
- package/build-module/menu/index.js +28 -97
- package/build-module/menu/index.js.map +1 -1
- package/build-module/menu/item.js +10 -1
- package/build-module/menu/item.js.map +1 -1
- package/build-module/menu/popover.js +81 -0
- package/build-module/menu/popover.js.map +1 -0
- package/build-module/menu/radio-item.js +2 -0
- package/build-module/menu/radio-item.js.map +1 -1
- package/build-module/menu/submenu-trigger-item.js +50 -0
- package/build-module/menu/submenu-trigger-item.js.map +1 -0
- package/build-module/menu/trigger-button.js +37 -0
- package/build-module/menu/trigger-button.js.map +1 -0
- package/build-module/menu/types.js.map +1 -1
- package/build-module/navigation/back-button/index.js +1 -0
- package/build-module/navigation/back-button/index.js.map +1 -1
- package/build-module/navigation/index.js +6 -0
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/item/index.js +1 -0
- package/build-module/navigation/item/index.js.map +1 -1
- package/build-module/number-control/index.js +1 -0
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/palette-edit/index.js +1 -0
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/radio-group/index.js +6 -0
- package/build-module/radio-group/index.js.map +1 -1
- package/build-module/radio-group/radio.js +1 -2
- package/build-module/radio-group/radio.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +28 -28
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/select-control/index.js +9 -0
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/types.js.map +1 -1
- package/build-module/slot-fill/context.js +5 -3
- package/build-module/slot-fill/context.js.map +1 -1
- package/build-module/slot-fill/fill.js +10 -15
- package/build-module/slot-fill/fill.js.map +1 -1
- package/build-module/slot-fill/provider.js +41 -55
- package/build-module/slot-fill/provider.js.map +1 -1
- package/build-module/slot-fill/slot.js +32 -24
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/slot-fill/types.js.map +1 -1
- package/build-module/tab-panel/index.js +1 -2
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/tabs/index.js +21 -4
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/types.js.map +1 -1
- package/build-module/text/hook.js +6 -6
- package/build-module/text/hook.js.map +1 -1
- package/build-module/text/styles.js +7 -7
- package/build-module/text/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +1 -2
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build-module/tooltip/index.js +1 -2
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tree-select/index.js +10 -2
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/tree-select/types.js.map +1 -1
- package/build-style/style-rtl.css +60 -13
- package/build-style/style.css +60 -13
- package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
- package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
- package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
- package/build-types/animate/stories/index.story.d.ts +7 -7
- package/build-types/animate/stories/index.story.d.ts.map +1 -1
- package/build-types/badge/index.d.ts +8 -0
- package/build-types/badge/index.d.ts.map +1 -0
- package/build-types/badge/stories/index.story.d.ts +17 -0
- package/build-types/badge/stories/index.story.d.ts.map +1 -0
- package/build-types/badge/test/index.d.ts +2 -0
- package/build-types/badge/test/index.d.ts.map +1 -0
- package/build-types/badge/types.d.ts +13 -0
- package/build-types/badge/types.d.ts.map +1 -0
- package/build-types/base-control/stories/index.story.d.ts +1 -1
- package/build-types/border-box-control/stories/index.story.d.ts +1 -1
- package/build-types/border-control/stories/index.story.d.ts +5 -5
- package/build-types/box-control/index.d.ts +1 -1
- package/build-types/box-control/index.d.ts.map +1 -1
- package/build-types/box-control/input-control.d.ts +1 -1
- package/build-types/box-control/input-control.d.ts.map +1 -1
- package/build-types/box-control/stories/index.story.d.ts +356 -11
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
- package/build-types/box-control/types.d.ts +17 -0
- package/build-types/box-control/types.d.ts.map +1 -1
- package/build-types/box-control/utils.d.ts +27 -1
- package/build-types/box-control/utils.d.ts.map +1 -1
- package/build-types/button/stories/e2e/index.story.d.ts +1 -1
- package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts +7 -7
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/button-group/index.d.ts +3 -1
- package/build-types/button-group/index.d.ts.map +1 -1
- package/build-types/button-group/stories/index.story.d.ts +6 -0
- package/build-types/button-group/stories/index.story.d.ts.map +1 -1
- package/build-types/button-group/types.d.ts +7 -0
- package/build-types/button-group/types.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.story.d.ts +5 -5
- package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.story.d.ts +3 -3
- package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -2
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts +4 -4
- package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
- package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/stories/index.story.d.ts +1 -1
- package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-select-control/stories/index.story.d.ts +3 -3
- package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/stories/index.story.d.ts +3 -3
- package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/date-time/stories/time.story.d.ts +1 -1
- package/build-types/date-time/stories/time.story.d.ts.map +1 -1
- package/build-types/date-time/time/styles.d.ts +4 -4
- package/build-types/dimension-control/index.d.ts.map +1 -1
- package/build-types/dimension-control/stories/index.story.d.ts +1 -1
- package/build-types/disabled/stories/index.story.d.ts.map +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
- package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +1 -1
- package/build-types/duotone-picker/stories/duotone-picker.story.d.ts.map +1 -1
- package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts +3 -3
- package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
- package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
- package/build-types/font-size-picker/styles.d.ts.map +1 -1
- package/build-types/form-file-upload/stories/index.story.d.ts +5 -5
- package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
- package/build-types/gradient-picker/stories/index.story.d.ts +3 -3
- package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/guide/stories/index.story.d.ts +1 -1
- package/build-types/guide/stories/index.story.d.ts.map +1 -1
- package/build-types/icon/stories/index.story.d.ts +4 -4
- package/build-types/icon/stories/index.story.d.ts.map +1 -1
- package/build-types/input-control/index.d.ts +1 -0
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/stories/index.story.d.ts +7 -7
- package/build-types/input-control/stories/index.story.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +11 -2
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts +1 -1
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
- package/build-types/menu/checkbox-item.d.ts.map +1 -1
- package/build-types/menu/index.d.ts +10 -1
- package/build-types/menu/index.d.ts.map +1 -1
- package/build-types/menu/item.d.ts.map +1 -1
- package/build-types/menu/popover.d.ts +3 -0
- package/build-types/menu/popover.d.ts.map +1 -0
- package/build-types/menu/radio-item.d.ts.map +1 -1
- package/build-types/menu/stories/index.story.d.ts +9 -9
- package/build-types/menu/stories/index.story.d.ts.map +1 -1
- package/build-types/menu/submenu-trigger-item.d.ts +3 -0
- package/build-types/menu/submenu-trigger-item.d.ts.map +1 -0
- package/build-types/menu/trigger-button.d.ts +3 -0
- package/build-types/menu/trigger-button.d.ts.map +1 -0
- package/build-types/menu/types.d.ts +208 -57
- package/build-types/menu/types.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts +1 -1
- package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-item/stories/index.story.d.ts +4 -4
- package/build-types/modal/stories/index.story.d.ts.map +1 -1
- package/build-types/navigation/back-button/index.d.ts.map +1 -1
- package/build-types/navigation/index.d.ts.map +1 -1
- package/build-types/navigation/item/index.d.ts.map +1 -1
- package/build-types/navigation/stories/index.story.d.ts +6 -6
- package/build-types/navigation/stories/index.story.d.ts.map +1 -1
- package/build-types/notice/stories/index.story.d.ts +4 -4
- package/build-types/notice/stories/index.story.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +1 -1
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts +2 -2
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/palette-edit/stories/index.story.d.ts +2 -2
- package/build-types/palette-edit/stories/index.story.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
- package/build-types/query-controls/stories/index.story.d.ts +1 -1
- package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
- package/build-types/radio-group/index.d.ts.map +1 -1
- package/build-types/radio-group/radio.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.story.d.ts +2 -2
- package/build-types/responsive-wrapper/stories/index.story.d.ts +1 -1
- package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
- package/build-types/sandbox/stories/index.story.d.ts +1 -1
- package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
- package/build-types/search-control/stories/index.story.d.ts +1 -1
- package/build-types/search-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts +1 -0
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts +5 -5
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/types.d.ts +1 -1
- package/build-types/select-control/types.d.ts.map +1 -1
- package/build-types/shortcut/stories/index.story.d.ts +1 -1
- package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
- package/build-types/slot-fill/context.d.ts.map +1 -1
- package/build-types/slot-fill/fill.d.ts.map +1 -1
- package/build-types/slot-fill/provider.d.ts.map +1 -1
- package/build-types/slot-fill/slot.d.ts.map +1 -1
- package/build-types/slot-fill/types.d.ts +13 -11
- package/build-types/slot-fill/types.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.story.d.ts +4 -4
- package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/index.d.ts +21 -4
- package/build-types/tabs/index.d.ts.map +1 -1
- package/build-types/tabs/stories/index.story.d.ts +10 -10
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/types.d.ts +13 -13
- package/build-types/tabs/types.d.ts.map +1 -1
- package/build-types/text/stories/index.story.d.ts +3 -3
- package/build-types/theme/stories/index.story.d.ts +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
- package/build-types/toolbar/stories/index.story.d.ts +3 -3
- package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/tooltip/stories/index.story.d.ts +1 -1
- package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-grid/stories/index.story.d.ts +1 -1
- package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts +3 -2
- package/build-types/tree-select/index.d.ts.map +1 -1
- package/build-types/tree-select/stories/index.story.d.ts +1 -1
- package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-select/types.d.ts +5 -1
- package/build-types/tree-select/types.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
- package/build-types/v-stack/stories/index.story.d.ts +1 -1
- package/package.json +19 -19
- package/src/alignment-matrix-control/README.md +16 -15
- package/src/angle-picker-control/README.md +10 -9
- package/src/badge/README.md +24 -0
- package/src/badge/docs-manifest.json +5 -0
- package/src/badge/index.tsx +67 -0
- package/src/badge/stories/index.story.tsx +54 -0
- package/src/badge/styles.scss +49 -0
- package/src/badge/test/index.tsx +45 -0
- package/src/badge/types.ts +12 -0
- package/src/base-control/README.md +22 -21
- package/src/box-control/README.md +41 -24
- package/src/box-control/index.tsx +4 -0
- package/src/box-control/input-control.tsx +142 -40
- package/src/box-control/stories/index.story.tsx +12 -0
- package/src/box-control/types.ts +18 -0
- package/src/box-control/utils.ts +60 -0
- package/src/button/README.md +51 -50
- package/src/button/style.scss +9 -10
- package/src/button/test/index.tsx +9 -2
- package/src/button-group/README.md +4 -0
- package/src/button-group/index.tsx +11 -1
- package/src/button-group/stories/index.story.tsx +8 -1
- package/src/button-group/types.ts +7 -0
- package/src/custom-select-control/index.tsx +3 -3
- package/src/custom-select-control-v2/custom-select.tsx +1 -2
- package/src/custom-select-control-v2/stories/index.story.tsx +4 -0
- package/src/date-time/date/index.tsx +1 -0
- package/src/dimension-control/index.tsx +1 -0
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
- package/src/disabled/stories/index.story.tsx +1 -0
- package/src/drop-zone/stories/index.story.tsx +7 -1
- package/src/font-size-picker/styles.ts +1 -0
- package/src/form-file-upload/README.md +22 -21
- package/src/gradient-picker/README.md +36 -35
- package/src/heading/hook.ts +1 -1
- package/src/heading/test/__snapshots__/index.tsx.snap +4 -4
- package/src/icon/README.md +9 -8
- package/src/input-control/README.md +1 -0
- package/src/input-control/index.tsx +10 -0
- package/src/input-control/stories/index.story.tsx +6 -1
- package/src/input-control/test/index.js +9 -3
- package/src/input-control/types.ts +11 -2
- package/src/menu/checkbox-item.tsx +2 -1
- package/src/menu/index.tsx +61 -165
- package/src/menu/item.tsx +17 -2
- package/src/menu/popover.tsx +103 -0
- package/src/menu/radio-item.tsx +2 -1
- package/src/menu/stories/index.story.tsx +533 -381
- package/src/menu/submenu-trigger-item.tsx +61 -0
- package/src/menu/test/index.tsx +266 -182
- package/src/menu/trigger-button.tsx +46 -0
- package/src/menu/types.ts +210 -63
- package/src/modal/stories/index.story.tsx +4 -1
- package/src/navigation/back-button/index.tsx +1 -0
- package/src/navigation/index.tsx +7 -0
- package/src/navigation/item/index.tsx +2 -0
- package/src/navigation/test/index.tsx +4 -0
- package/src/navigator/test/index.tsx +4 -0
- package/src/number-control/index.tsx +1 -0
- package/src/palette-edit/index.tsx +1 -0
- package/src/panel/stories/index.story.tsx +3 -3
- package/src/private-apis.ts +2 -0
- package/src/radio-group/index.tsx +12 -1
- package/src/radio-group/radio.tsx +1 -2
- package/src/range-control/styles/range-control-styles.ts +8 -4
- package/src/select-control/README.md +3 -0
- package/src/select-control/index.tsx +10 -0
- package/src/select-control/stories/index.story.tsx +2 -0
- package/src/select-control/test/select-control.tsx +7 -1
- package/src/select-control/types.ts +1 -0
- package/src/slot-fill/context.ts +5 -3
- package/src/slot-fill/fill.ts +10 -15
- package/src/slot-fill/provider.tsx +63 -64
- package/src/slot-fill/slot.tsx +40 -27
- package/src/slot-fill/types.ts +23 -11
- package/src/style.scss +1 -0
- package/src/tab-panel/index.tsx +1 -2
- package/src/tab-panel/stories/index.story.tsx +4 -0
- package/src/tabs/README.md +151 -187
- package/src/tabs/docs-manifest.json +22 -0
- package/src/tabs/index.tsx +21 -4
- package/src/tabs/stories/best-practices.mdx +99 -0
- package/src/tabs/stories/index.story.tsx +5 -0
- package/src/tabs/types.ts +13 -14
- package/src/text/hook.ts +2 -2
- package/src/text/styles.ts +1 -1
- package/src/text/test/__snapshots__/index.tsx.snap +3 -3
- package/src/text/test/index.tsx +1 -1
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +2 -2
- package/src/toggle-group-control/test/index.tsx +7 -1
- package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +1 -2
- package/src/tooltip/index.tsx +1 -2
- package/src/tree-grid/stories/index.story.tsx +2 -0
- package/src/tree-select/README.md +144 -28
- package/src/tree-select/docs-manifest.json +5 -0
- package/src/tree-select/index.tsx +11 -2
- package/src/tree-select/stories/index.story.tsx +1 -0
- package/src/tree-select/types.ts +8 -1
- package/tsconfig.json +0 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/build/slot-fill/use-slot.js +0 -32
- package/build/slot-fill/use-slot.js.map +0 -1
- package/build-module/slot-fill/use-slot.js +0 -24
- package/build-module/slot-fill/use-slot.js.map +0 -1
- package/build-types/slot-fill/use-slot.d.ts +0 -10
- package/build-types/slot-fill/use-slot.d.ts.map +0 -1
- package/src/slot-fill/use-slot.ts +0 -27
|
@@ -21,47 +21,48 @@ const Example = () => {
|
|
|
21
21
|
);
|
|
22
22
|
};
|
|
23
23
|
```
|
|
24
|
+
|
|
24
25
|
## Props
|
|
25
26
|
|
|
26
27
|
### `defaultValue`
|
|
27
28
|
|
|
28
|
-
If provided, sets the default alignment value.
|
|
29
|
-
|
|
30
29
|
- Type: `"center" | "top left" | "top center" | "top right" | "center left" | "center center" | "center right" | "bottom left" | "bottom center" | "bottom right"`
|
|
31
30
|
- Required: No
|
|
32
31
|
- Default: `'center center'`
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
If provided, sets the default alignment value.
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
underlying `grid` widget.
|
|
35
|
+
### `label`
|
|
38
36
|
|
|
39
37
|
- Type: `string`
|
|
40
38
|
- Required: No
|
|
41
39
|
- Default: `'Alignment Matrix Control'`
|
|
42
40
|
|
|
43
|
-
|
|
41
|
+
Accessible label. If provided, sets the `aria-label` attribute of the
|
|
42
|
+
underlying `grid` widget.
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
### `onChange`
|
|
46
45
|
|
|
47
46
|
- Type: `(newValue: AlignmentMatrixControlValue) => void`
|
|
48
47
|
- Required: No
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
A function that receives the updated alignment value.
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
### `value`
|
|
53
52
|
|
|
54
53
|
- Type: `"center" | "top left" | "top center" | "top right" | "center left" | "center center" | "center right" | "bottom left" | "bottom center" | "bottom right"`
|
|
55
54
|
- Required: No
|
|
56
55
|
|
|
57
|
-
|
|
56
|
+
The current alignment value.
|
|
58
57
|
|
|
59
|
-
|
|
58
|
+
### `width`
|
|
60
59
|
|
|
61
60
|
- Type: `number`
|
|
62
61
|
- Required: No
|
|
63
62
|
- Default: `92`
|
|
64
63
|
|
|
64
|
+
If provided, sets the width of the control.
|
|
65
|
+
|
|
65
66
|
## Subcomponents
|
|
66
67
|
|
|
67
68
|
### AlignmentMatrixControl.Icon
|
|
@@ -70,16 +71,16 @@ If provided, sets the width of the control.
|
|
|
70
71
|
|
|
71
72
|
##### `disablePointerEvents`
|
|
72
73
|
|
|
73
|
-
If `true`, disables pointer events on the icon.
|
|
74
|
-
|
|
75
74
|
- Type: `boolean`
|
|
76
75
|
- Required: No
|
|
77
76
|
- Default: `true`
|
|
78
77
|
|
|
79
|
-
|
|
78
|
+
If `true`, disables pointer events on the icon.
|
|
80
79
|
|
|
81
|
-
|
|
80
|
+
##### `value`
|
|
82
81
|
|
|
83
82
|
- Type: `"center" | "top left" | "top center" | "top right" | "center left" | "center center" | "center right" | "bottom left" | "bottom center" | "bottom right"`
|
|
84
83
|
- Required: No
|
|
85
84
|
- Default: `center`
|
|
85
|
+
|
|
86
|
+
The current alignment value.
|
|
@@ -23,34 +23,35 @@ function Example() {
|
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
```
|
|
26
|
+
|
|
26
27
|
## Props
|
|
27
28
|
|
|
28
29
|
### `as`
|
|
29
30
|
|
|
30
|
-
The HTML element or React component to render the component as.
|
|
31
|
-
|
|
32
31
|
- Type: `"symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | ...`
|
|
33
32
|
- Required: No
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
The HTML element or React component to render the component as.
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
### `label`
|
|
38
37
|
|
|
39
38
|
- Type: `string`
|
|
40
39
|
- Required: No
|
|
41
40
|
- Default: `__( 'Angle' )`
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
Label to use for the angle picker.
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
### `onChange`
|
|
46
45
|
|
|
47
46
|
- Type: `(value: number) => void`
|
|
48
47
|
- Required: Yes
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
A function that receives the new value of the input.
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
and should be a value between 0 and 360.
|
|
51
|
+
### `value`
|
|
54
52
|
|
|
55
53
|
- Type: `string | number`
|
|
56
54
|
- Required: Yes
|
|
55
|
+
|
|
56
|
+
The current value of the input. The value represents an angle in degrees
|
|
57
|
+
and should be a value between 0 and 360.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Badge
|
|
2
|
+
|
|
3
|
+
<!-- This file is generated automatically and cannot be edited directly. Make edits via TypeScript types and TSDocs. -->
|
|
4
|
+
|
|
5
|
+
🔒 This component is locked as a [private API](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-private-apis/). We do not yet recommend using this outside of the Gutenberg project.
|
|
6
|
+
|
|
7
|
+
<p class="callout callout-info">See the <a href="https://wordpress.github.io/gutenberg/?path=/docs/components-badge--docs">WordPress Storybook</a> for more detailed, interactive documentation.</p>
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
### `children`
|
|
12
|
+
|
|
13
|
+
- Type: `string`
|
|
14
|
+
- Required: Yes
|
|
15
|
+
|
|
16
|
+
Text to display inside the badge.
|
|
17
|
+
|
|
18
|
+
### `intent`
|
|
19
|
+
|
|
20
|
+
- Type: `"default" | "info" | "success" | "warning" | "error"`
|
|
21
|
+
- Required: No
|
|
22
|
+
- Default: `default`
|
|
23
|
+
|
|
24
|
+
Badge variant.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { info, caution, error, published } from '@wordpress/icons';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import type { BadgeProps } from './types';
|
|
15
|
+
import type { WordPressComponentProps } from '../context';
|
|
16
|
+
import Icon from '../icon';
|
|
17
|
+
|
|
18
|
+
function Badge( {
|
|
19
|
+
className,
|
|
20
|
+
intent = 'default',
|
|
21
|
+
children,
|
|
22
|
+
...props
|
|
23
|
+
}: WordPressComponentProps< BadgeProps, 'span', false > ) {
|
|
24
|
+
/**
|
|
25
|
+
* Returns an icon based on the badge context.
|
|
26
|
+
*
|
|
27
|
+
* @return The corresponding icon for the provided context.
|
|
28
|
+
*/
|
|
29
|
+
function contextBasedIcon() {
|
|
30
|
+
switch ( intent ) {
|
|
31
|
+
case 'info':
|
|
32
|
+
return info;
|
|
33
|
+
case 'success':
|
|
34
|
+
return published;
|
|
35
|
+
case 'warning':
|
|
36
|
+
return caution;
|
|
37
|
+
case 'error':
|
|
38
|
+
return error;
|
|
39
|
+
default:
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<span
|
|
46
|
+
className={ clsx(
|
|
47
|
+
'components-badge',
|
|
48
|
+
`is-${ intent }`,
|
|
49
|
+
intent !== 'default' && 'has-icon',
|
|
50
|
+
className
|
|
51
|
+
) }
|
|
52
|
+
{ ...props }
|
|
53
|
+
>
|
|
54
|
+
{ intent !== 'default' && (
|
|
55
|
+
<Icon
|
|
56
|
+
icon={ contextBasedIcon() }
|
|
57
|
+
size={ 16 }
|
|
58
|
+
fill="currentColor"
|
|
59
|
+
className="components-badge__icon"
|
|
60
|
+
/>
|
|
61
|
+
) }
|
|
62
|
+
<span className="components-badge__content">{ children }</span>
|
|
63
|
+
</span>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default Badge;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import Badge from '..';
|
|
10
|
+
|
|
11
|
+
const meta: Meta< typeof Badge > = {
|
|
12
|
+
component: Badge,
|
|
13
|
+
title: 'Components/Containers/Badge',
|
|
14
|
+
id: 'components-badge',
|
|
15
|
+
tags: [ 'status-private' ],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj< typeof meta >;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
children: 'Code is Poetry',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Info: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
...Default.args,
|
|
31
|
+
intent: 'info',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Success: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
...Default.args,
|
|
38
|
+
intent: 'success',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Warning: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
...Default.args,
|
|
45
|
+
intent: 'warning',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Error: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
...Default.args,
|
|
52
|
+
intent: 'error',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
$badge-colors: (
|
|
2
|
+
"info": #3858e9,
|
|
3
|
+
"warning": $alert-yellow,
|
|
4
|
+
"error": $alert-red,
|
|
5
|
+
"success": $alert-green,
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
.components-badge {
|
|
9
|
+
@include reset;
|
|
10
|
+
|
|
11
|
+
background-color: color-mix(in srgb, $white 90%, var(--base-color));
|
|
12
|
+
color: color-mix(in srgb, $black 50%, var(--base-color));
|
|
13
|
+
padding: 0 $grid-unit-10;
|
|
14
|
+
min-height: $grid-unit-30;
|
|
15
|
+
max-width: 100%;
|
|
16
|
+
border-radius: $radius-small;
|
|
17
|
+
font-size: $font-size-small;
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
line-height: $font-line-height-small;
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: 2px;
|
|
23
|
+
|
|
24
|
+
&:where(.is-default) {
|
|
25
|
+
background-color: $gray-100;
|
|
26
|
+
color: $gray-800;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.has-icon {
|
|
30
|
+
padding-inline-start: $grid-unit-05;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Generate color variants
|
|
34
|
+
@each $type, $color in $badge-colors {
|
|
35
|
+
&.is-#{$type} {
|
|
36
|
+
--base-color: #{$color};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.components-badge__icon {
|
|
42
|
+
flex-shrink: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.components-badge__content {
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
text-overflow: ellipsis;
|
|
49
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import _Badge from '..';
|
|
10
|
+
|
|
11
|
+
const testid = 'my-badge';
|
|
12
|
+
const Badge = ( props: React.ComponentProps< typeof _Badge > ) => (
|
|
13
|
+
<_Badge data-testid={ testid } { ...props } />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
describe( 'Badge', () => {
|
|
17
|
+
it( 'should render correctly with default props', () => {
|
|
18
|
+
render( <Badge>Code is Poetry</Badge> );
|
|
19
|
+
const badge = screen.getByTestId( testid );
|
|
20
|
+
expect( badge ).toBeInTheDocument();
|
|
21
|
+
expect( badge.tagName ).toBe( 'SPAN' );
|
|
22
|
+
expect( badge ).toHaveClass( 'components-badge' );
|
|
23
|
+
} );
|
|
24
|
+
|
|
25
|
+
it( 'should render as per its intent and contain an icon', () => {
|
|
26
|
+
render( <Badge intent="error">Code is Poetry</Badge> );
|
|
27
|
+
const badge = screen.getByTestId( testid );
|
|
28
|
+
expect( badge ).toHaveClass( 'components-badge', 'is-error' );
|
|
29
|
+
expect( badge ).toHaveClass( 'has-icon' );
|
|
30
|
+
} );
|
|
31
|
+
|
|
32
|
+
it( 'should combine custom className with default class', () => {
|
|
33
|
+
render( <Badge className="custom-class">Code is Poetry</Badge> );
|
|
34
|
+
const badge = screen.getByTestId( testid );
|
|
35
|
+
expect( badge ).toHaveClass( 'components-badge' );
|
|
36
|
+
expect( badge ).toHaveClass( 'custom-class' );
|
|
37
|
+
} );
|
|
38
|
+
|
|
39
|
+
it( 'should pass through additional props', () => {
|
|
40
|
+
render( <Badge data-testid="custom-badge">Code is Poetry</Badge> );
|
|
41
|
+
const badge = screen.getByTestId( 'custom-badge' );
|
|
42
|
+
expect( badge ).toHaveTextContent( 'Code is Poetry' );
|
|
43
|
+
expect( badge ).toHaveClass( 'components-badge' );
|
|
44
|
+
} );
|
|
45
|
+
} );
|
|
@@ -25,71 +25,71 @@ const MyCustomTextareaControl = ({ children, ...baseProps }) => (
|
|
|
25
25
|
);
|
|
26
26
|
);
|
|
27
27
|
```
|
|
28
|
+
|
|
28
29
|
## Props
|
|
29
30
|
|
|
30
31
|
### `__nextHasNoMarginBottom`
|
|
31
32
|
|
|
32
|
-
Start opting into the new margin-free styles that will become the default in a future version.
|
|
33
|
-
|
|
34
33
|
- Type: `boolean`
|
|
35
34
|
- Required: No
|
|
36
35
|
- Default: `false`
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
Start opting into the new margin-free styles that will become the default in a future version.
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
### `as`
|
|
41
40
|
|
|
42
41
|
- Type: `"symbol" | "object" | "label" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | ... 516 more ... | ("view" & FunctionComponent<...>)`
|
|
43
42
|
- Required: No
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
The HTML element or React component to render the component as.
|
|
46
45
|
|
|
46
|
+
### `className`
|
|
47
47
|
|
|
48
48
|
- Type: `string`
|
|
49
49
|
- Required: No
|
|
50
50
|
|
|
51
51
|
### `children`
|
|
52
52
|
|
|
53
|
-
The content to be displayed within the `BaseControl`.
|
|
54
|
-
|
|
55
53
|
- Type: `ReactNode`
|
|
56
54
|
- Required: Yes
|
|
57
55
|
|
|
56
|
+
The content to be displayed within the `BaseControl`.
|
|
57
|
+
|
|
58
58
|
### `help`
|
|
59
59
|
|
|
60
|
+
- Type: `ReactNode`
|
|
61
|
+
- Required: No
|
|
62
|
+
|
|
60
63
|
Additional description for the control.
|
|
61
64
|
|
|
62
65
|
Only use for meaningful description or instructions for the control. An element containing the description will be programmatically associated to the BaseControl by the means of an `aria-describedby` attribute.
|
|
63
66
|
|
|
64
|
-
- Type: `ReactNode`
|
|
65
|
-
- Required: No
|
|
66
|
-
|
|
67
67
|
### `hideLabelFromVision`
|
|
68
68
|
|
|
69
|
-
If true, the label will only be visible to screen readers.
|
|
70
|
-
|
|
71
69
|
- Type: `boolean`
|
|
72
70
|
- Required: No
|
|
73
71
|
- Default: `false`
|
|
74
72
|
|
|
73
|
+
If true, the label will only be visible to screen readers.
|
|
74
|
+
|
|
75
75
|
### `id`
|
|
76
76
|
|
|
77
|
+
- Type: `string`
|
|
78
|
+
- Required: No
|
|
79
|
+
|
|
77
80
|
The HTML `id` of the control element (passed in as a child to `BaseControl`) to which labels and help text are being generated.
|
|
78
81
|
This is necessary to accessibly associate the label with that element.
|
|
79
82
|
|
|
80
83
|
The recommended way is to use the `useBaseControlProps` hook, which takes care of generating a unique `id` for you.
|
|
81
84
|
Otherwise, if you choose to pass an explicit `id` to this prop, you are responsible for ensuring the uniqueness of the `id`.
|
|
82
85
|
|
|
83
|
-
- Type: `string`
|
|
84
|
-
- Required: No
|
|
85
|
-
|
|
86
86
|
### `label`
|
|
87
87
|
|
|
88
|
-
If this property is added, a label will be generated using label property as the content.
|
|
89
|
-
|
|
90
88
|
- Type: `ReactNode`
|
|
91
89
|
- Required: No
|
|
92
90
|
|
|
91
|
+
If this property is added, a label will be generated using label property as the content.
|
|
92
|
+
|
|
93
93
|
## Subcomponents
|
|
94
94
|
|
|
95
95
|
### BaseControl.VisualLabel
|
|
@@ -113,18 +113,19 @@ const MyBaseControl = () => (
|
|
|
113
113
|
</BaseControl>
|
|
114
114
|
);
|
|
115
115
|
```
|
|
116
|
+
|
|
116
117
|
#### Props
|
|
117
118
|
|
|
118
119
|
##### `as`
|
|
119
120
|
|
|
120
|
-
The HTML element or React component to render the component as.
|
|
121
|
-
|
|
122
121
|
- Type: `"symbol" | "object" | "label" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | ...`
|
|
123
122
|
- Required: No
|
|
124
123
|
|
|
125
|
-
|
|
124
|
+
The HTML element or React component to render the component as.
|
|
126
125
|
|
|
127
|
-
|
|
126
|
+
##### `children`
|
|
128
127
|
|
|
129
128
|
- Type: `ReactNode`
|
|
130
129
|
- Required: Yes
|
|
130
|
+
|
|
131
|
+
The content to be displayed within the `BaseControl.VisualLabel`.
|
|
@@ -28,34 +28,33 @@ function Example() {
|
|
|
28
28
|
);
|
|
29
29
|
};
|
|
30
30
|
```
|
|
31
|
+
|
|
31
32
|
## Props
|
|
32
33
|
|
|
33
34
|
### `__next40pxDefaultSize`
|
|
34
35
|
|
|
35
|
-
Start opting into the larger default height that will become the default size in a future version.
|
|
36
|
-
|
|
37
36
|
- Type: `boolean`
|
|
38
37
|
- Required: No
|
|
39
38
|
- Default: `false`
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
Start opting into the larger default height that will become the default size in a future version.
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
### `allowReset`
|
|
44
43
|
|
|
45
44
|
- Type: `boolean`
|
|
46
45
|
- Required: No
|
|
47
46
|
- Default: `true`
|
|
48
47
|
|
|
49
|
-
|
|
48
|
+
If this property is true, a button to reset the box control is rendered.
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
### `id`
|
|
52
51
|
|
|
53
52
|
- Type: `string`
|
|
54
53
|
- Required: No
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
The id to use as a base for the unique HTML id attribute of the control.
|
|
57
56
|
|
|
58
|
-
|
|
57
|
+
### `inputProps`
|
|
59
58
|
|
|
60
59
|
- Type: `UnitControlPassthroughProps`
|
|
61
60
|
- Required: No
|
|
@@ -63,25 +62,41 @@ Props for the internal `UnitControl` components.
|
|
|
63
62
|
min: 0,
|
|
64
63
|
}`
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
Props for the internal `UnitControl` components.
|
|
67
66
|
|
|
68
|
-
|
|
67
|
+
### `label`
|
|
69
68
|
|
|
70
69
|
- Type: `string`
|
|
71
70
|
- Required: No
|
|
72
71
|
- Default: `__( 'Box Control' )`
|
|
73
72
|
|
|
74
|
-
|
|
73
|
+
Heading label for the control.
|
|
75
74
|
|
|
76
|
-
|
|
75
|
+
### `onChange`
|
|
77
76
|
|
|
78
77
|
- Type: `(next: BoxControlValue) => void`
|
|
79
78
|
- Required: No
|
|
80
79
|
- Default: `() => {}`
|
|
81
80
|
|
|
82
|
-
|
|
81
|
+
A callback function when an input value changes.
|
|
83
82
|
|
|
84
|
-
|
|
83
|
+
### `presets`
|
|
84
|
+
|
|
85
|
+
- Type: `Preset[]`
|
|
86
|
+
- Required: No
|
|
87
|
+
|
|
88
|
+
Available presets to pick from.
|
|
89
|
+
|
|
90
|
+
### `presetKey`
|
|
91
|
+
|
|
92
|
+
- Type: `string`
|
|
93
|
+
- Required: No
|
|
94
|
+
|
|
95
|
+
The key of the preset to apply.
|
|
96
|
+
If you provide a list of presets, you must provide a preset key to use.
|
|
97
|
+
The format of preset selected values is going to be `var:preset|${ presetKey }|${ presetSlug }`
|
|
98
|
+
|
|
99
|
+
### `resetValues`
|
|
85
100
|
|
|
86
101
|
- Type: `BoxControlValue`
|
|
87
102
|
- Required: No
|
|
@@ -92,35 +107,37 @@ The `top`, `right`, `bottom`, and `left` box dimension values to use when the co
|
|
|
92
107
|
left: undefined,
|
|
93
108
|
}`
|
|
94
109
|
|
|
110
|
+
The `top`, `right`, `bottom`, and `left` box dimension values to use when the control is reset.
|
|
111
|
+
|
|
95
112
|
### `sides`
|
|
96
113
|
|
|
114
|
+
- Type: `readonly (keyof BoxControlValue | "horizontal" | "vertical")[]`
|
|
115
|
+
- Required: No
|
|
116
|
+
|
|
97
117
|
Collection of sides to allow control of. If omitted or empty, all sides will be available.
|
|
98
118
|
|
|
99
119
|
Allowed values are "top", "right", "bottom", "left", "vertical", and "horizontal".
|
|
100
120
|
|
|
101
|
-
- Type: `readonly (keyof BoxControlValue | "horizontal" | "vertical")[]`
|
|
102
|
-
- Required: No
|
|
103
|
-
|
|
104
121
|
### `splitOnAxis`
|
|
105
122
|
|
|
106
|
-
If this property is true, when the box control is unlinked, vertical and horizontal controls
|
|
107
|
-
can be used instead of updating individual sides.
|
|
108
|
-
|
|
109
123
|
- Type: `boolean`
|
|
110
124
|
- Required: No
|
|
111
125
|
- Default: `false`
|
|
112
126
|
|
|
113
|
-
|
|
127
|
+
If this property is true, when the box control is unlinked, vertical and horizontal controls
|
|
128
|
+
can be used instead of updating individual sides.
|
|
114
129
|
|
|
115
|
-
|
|
130
|
+
### `units`
|
|
116
131
|
|
|
117
132
|
- Type: `WPUnitControlUnit[]`
|
|
118
133
|
- Required: No
|
|
119
134
|
- Default: `CSS_UNITS`
|
|
120
135
|
|
|
121
|
-
|
|
136
|
+
Available units to select from.
|
|
122
137
|
|
|
123
|
-
|
|
138
|
+
### `values`
|
|
124
139
|
|
|
125
140
|
- Type: `BoxControlValue`
|
|
126
141
|
- Required: No
|
|
142
|
+
|
|
143
|
+
The current values of the control, expressed as an object of `top`, `right`, `bottom`, and `left` values.
|
|
@@ -83,6 +83,8 @@ function BoxControl( {
|
|
|
83
83
|
splitOnAxis = false,
|
|
84
84
|
allowReset = true,
|
|
85
85
|
resetValues = DEFAULT_VALUES,
|
|
86
|
+
presets,
|
|
87
|
+
presetKey,
|
|
86
88
|
onMouseOver,
|
|
87
89
|
onMouseOut,
|
|
88
90
|
}: BoxControlProps ) {
|
|
@@ -153,6 +155,8 @@ function BoxControl( {
|
|
|
153
155
|
sides,
|
|
154
156
|
values: inputValues,
|
|
155
157
|
__next40pxDefaultSize,
|
|
158
|
+
presets,
|
|
159
|
+
presetKey,
|
|
156
160
|
};
|
|
157
161
|
|
|
158
162
|
maybeWarnDeprecated36pxSize( {
|