@wordpress/components 19.1.5 → 19.2.1-next.33ec3857e2.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 +40 -3
- package/build/angle-picker-control/index.js +2 -0
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/button/index.native.js +13 -3
- package/build/button/index.native.js.map +1 -1
- package/build/checkbox-control/index.js +1 -1
- package/build/checkbox-control/index.js.map +1 -1
- package/build/clipboard-button/index.js +1 -2
- package/build/clipboard-button/index.js.map +1 -1
- package/build/color-palette/index.js +12 -0
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/color-display.js +4 -2
- package/build/color-picker/color-display.js.map +1 -1
- package/build/color-picker/hex-input.js +3 -1
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/input-with-slider.js +3 -1
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/confirm-dialog/component.js +103 -0
- package/build/confirm-dialog/component.js.map +1 -0
- package/build/confirm-dialog/index.js +16 -0
- package/build/confirm-dialog/index.js.map +1 -0
- package/build/confirm-dialog/types.js +6 -0
- package/build/confirm-dialog/types.js.map +1 -0
- package/build/custom-gradient-picker/index.js +1 -0
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/date-time/date.js +63 -86
- package/build/date-time/date.js.map +1 -1
- package/build/date-time/utils.js +32 -0
- package/build/date-time/utils.js.map +1 -0
- package/build/divider/component.js +8 -7
- package/build/divider/component.js.map +1 -1
- package/build/divider/styles.js +38 -13
- package/build/divider/styles.js.map +1 -1
- package/build/drop-zone/index.js +14 -6
- package/build/drop-zone/index.js.map +1 -1
- package/build/drop-zone/provider.js +1 -0
- package/build/drop-zone/provider.js.map +1 -1
- package/build/flyout/styles.js +2 -2
- package/build/flyout/styles.js.map +1 -1
- package/build/focusable-iframe/index.js +1 -0
- package/build/focusable-iframe/index.js.map +1 -1
- package/build/font-size-picker/index.js +10 -9
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/utils.js +28 -17
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/higher-order/with-focus-outside/index.js +2 -0
- package/build/higher-order/with-focus-outside/index.js.map +1 -1
- package/build/index.js +8 -0
- package/build/index.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +44 -32
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js +10 -3
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build/mobile/color-settings/index.native.js +4 -2
- package/build/mobile/color-settings/index.native.js.map +1 -1
- package/build/mobile/color-settings/palette.screen.native.js +7 -6
- package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +1 -1
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/mobile/gridicons/index.native.js +3 -1
- package/build/mobile/gridicons/index.native.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +45 -4
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/mobile/link-settings/index.native.js +10 -0
- package/build/mobile/link-settings/index.native.js.map +1 -1
- package/build/modal/aria-helper.js +2 -0
- package/build/modal/aria-helper.js.map +1 -1
- package/build/modal/index.js +17 -8
- package/build/modal/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +33 -9
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/style-provider/index.js +2 -0
- package/build/style-provider/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +7 -2
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +25 -14
- package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
- package/build/tools-panel/styles.js +12 -10
- package/build/tools-panel/styles.js.map +1 -1
- package/build/tools-panel/tools-panel/component.js +6 -8
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +48 -17
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-item/hook.js +5 -1
- package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build/unit-control/styles/unit-control-styles.js +23 -41
- package/build/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build/z-stack/component.js.map +1 -1
- package/build/z-stack/styles.js +10 -8
- package/build/z-stack/styles.js.map +1 -1
- package/build-module/angle-picker-control/index.js +2 -0
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/button/index.native.js +13 -3
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/checkbox-control/index.js +1 -1
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/clipboard-button/index.js +1 -2
- package/build-module/clipboard-button/index.js.map +1 -1
- package/build-module/color-palette/index.js +13 -1
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/color-display.js +3 -2
- package/build-module/color-picker/color-display.js.map +1 -1
- package/build-module/color-picker/hex-input.js +2 -1
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +2 -1
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/confirm-dialog/component.js +84 -0
- package/build-module/confirm-dialog/component.js.map +1 -0
- package/build-module/confirm-dialog/index.js +6 -0
- package/build-module/confirm-dialog/index.js.map +1 -0
- package/build-module/confirm-dialog/types.js +2 -0
- package/build-module/confirm-dialog/types.js.map +1 -0
- package/build-module/custom-gradient-picker/index.js +1 -0
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/date-time/date.js +63 -87
- package/build-module/date-time/date.js.map +1 -1
- package/build-module/date-time/utils.js +20 -0
- package/build-module/date-time/utils.js.map +1 -0
- package/build-module/divider/component.js +8 -7
- package/build-module/divider/component.js.map +1 -1
- package/build-module/divider/styles.js +37 -13
- package/build-module/divider/styles.js.map +1 -1
- package/build-module/drop-zone/index.js +14 -6
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/drop-zone/provider.js +1 -0
- package/build-module/drop-zone/provider.js.map +1 -1
- package/build-module/flyout/styles.js +2 -2
- package/build-module/flyout/styles.js.map +1 -1
- package/build-module/focusable-iframe/index.js +1 -0
- package/build-module/focusable-iframe/index.js.map +1 -1
- package/build-module/font-size-picker/index.js +10 -9
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/utils.js +28 -17
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/higher-order/with-focus-outside/index.js +1 -0
- package/build-module/higher-order/with-focus-outside/index.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +44 -32
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +10 -4
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build-module/mobile/color-settings/index.native.js +4 -2
- package/build-module/mobile/color-settings/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/palette.screen.native.js +7 -6
- package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/mobile/gridicons/index.native.js +1 -0
- package/build-module/mobile/gridicons/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +50 -8
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/mobile/link-settings/index.native.js +10 -0
- package/build-module/mobile/link-settings/index.native.js.map +1 -1
- package/build-module/modal/aria-helper.js +2 -0
- package/build-module/modal/aria-helper.js.map +1 -1
- package/build-module/modal/index.js +15 -8
- package/build-module/modal/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +33 -9
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/style-provider/index.js +1 -0
- package/build-module/style-provider/index.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +8 -3
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +25 -14
- package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
- package/build-module/tools-panel/styles.js +12 -11
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/tools-panel/tools-panel/component.js +5 -8
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +48 -17
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/hook.js +5 -1
- package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build-module/unit-control/styles/unit-control-styles.js +23 -41
- package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build-module/z-stack/component.js.map +1 -1
- package/build-module/z-stack/styles.js +13 -8
- package/build-module/z-stack/styles.js.map +1 -1
- package/build-style/style-rtl.css +23 -11
- package/build-style/style.css +23 -11
- package/build-types/base-field/hook.d.ts +16 -16
- package/build-types/card/card/hook.d.ts +16 -16
- package/build-types/card/card-body/hook.d.ts +16 -16
- package/build-types/card/card-divider/hook.d.ts +18 -18
- package/build-types/card/card-footer/hook.d.ts +17 -17
- package/build-types/card/card-header/hook.d.ts +16 -16
- package/build-types/card/card-media/hook.d.ts +16 -16
- package/build-types/divider/component.d.ts +8 -7
- package/build-types/divider/component.d.ts.map +1 -1
- package/build-types/divider/styles.d.ts +2 -2
- package/build-types/divider/styles.d.ts.map +1 -1
- package/build-types/divider/types.d.ts +5 -5
- package/build-types/divider/types.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +15 -15
- package/build-types/flex/flex/hook.d.ts +16 -16
- package/build-types/flex/flex-block/hook.d.ts +16 -16
- package/build-types/flex/flex-item/hook.d.ts +16 -16
- package/build-types/flyout/flyout/hook.d.ts +17 -17
- package/build-types/flyout/styles.d.ts +7 -9
- package/build-types/flyout/styles.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +16 -16
- package/build-types/h-stack/hook.d.ts +16 -16
- package/build-types/heading/hook.d.ts +16 -16
- package/build-types/input-control/index.d.ts +1 -1
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts +1 -1
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts +1 -2
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +2 -1
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +16 -16
- package/build-types/item-group/item-group/hook.d.ts +16 -16
- package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
- package/build-types/scrollable/hook.d.ts +16 -16
- package/build-types/select-control/styles/select-control-styles.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/spacer/hook.d.ts +16 -16
- package/build-types/surface/hook.d.ts +16 -16
- package/build-types/text/hook.d.ts +16 -16
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts.map +1 -1
- package/build-types/tools-panel/styles.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +16 -16
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +16 -16
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +16 -16
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/tools-panel/types.d.ts +2 -1
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +16 -16
- package/build-types/ui/control-group/hook.d.ts +18 -18
- package/build-types/ui/control-label/hook.d.ts +16 -16
- package/build-types/ui/form-group/form-group.d.ts +4 -4
- package/build-types/ui/form-group/use-form-group.d.ts +55 -55
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -0
- package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +2 -2
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +16 -16
- package/build-types/z-stack/component.d.ts +1 -1
- package/build-types/z-stack/styles.d.ts.map +1 -1
- package/package.json +21 -23
- package/src/alignment-matrix-control/stories/index.js +1 -1
- package/src/angle-picker-control/index.js +2 -0
- package/src/base-control/stories/index.js +1 -1
- package/src/button/index.native.js +15 -1
- package/src/button/stories/index.js +1 -1
- package/src/button/style.scss +14 -0
- package/src/card/card/README.md +3 -3
- package/src/card/stories/index.js +1 -1
- package/src/card/test/__snapshots__/index.js.snap +6 -6
- package/src/checkbox-control/index.js +1 -1
- package/src/checkbox-control/stories/index.js +1 -1
- package/src/clipboard-button/index.js +1 -2
- package/src/color-indicator/stories/index.js +1 -1
- package/src/color-indicator/style.scss +5 -8
- package/src/color-palette/index.js +10 -1
- package/src/color-palette/stories/index.js +1 -1
- package/src/color-palette/test/__snapshots__/index.js.snap +1 -0
- package/src/color-picker/color-display.tsx +3 -2
- package/src/color-picker/hex-input.tsx +2 -1
- package/src/color-picker/input-with-slider.tsx +2 -1
- package/src/color-picker/stories/index.js +1 -1
- package/src/combobox-control/README.md +2 -2
- package/src/confirm-dialog/README.md +128 -0
- package/src/confirm-dialog/component.tsx +114 -0
- package/src/confirm-dialog/index.tsx +6 -0
- package/src/confirm-dialog/stories/index.js +120 -0
- package/src/confirm-dialog/test/index.js +302 -0
- package/src/confirm-dialog/types.ts +26 -0
- package/src/custom-gradient-picker/index.js +1 -0
- package/src/custom-gradient-picker/style.scss +0 -4
- package/src/date-time/README.md +7 -0
- package/src/date-time/date.js +67 -84
- package/src/date-time/stories/index.js +1 -1
- package/src/date-time/stories/time.js +1 -1
- package/src/date-time/test/date.js +3 -29
- package/src/date-time/test/utils.js +32 -0
- package/src/date-time/utils.js +18 -0
- package/src/dimension-control/README.md +1 -1
- package/src/divider/README.md +33 -5
- package/src/divider/component.tsx +8 -7
- package/src/divider/stories/index.js +43 -17
- package/src/divider/styles.ts +53 -16
- package/src/divider/test/__snapshots__/index.js.snap +11 -11
- package/src/divider/test/index.js +4 -4
- package/src/divider/types.ts +5 -5
- package/src/drop-zone/index.js +14 -6
- package/src/drop-zone/provider.js +1 -0
- package/src/dropdown-menu/stories/index.js +1 -1
- package/src/duotone-picker/README.md +1 -1
- package/src/elevation/stories/index.js +1 -1
- package/src/external-link/stories/index.js +1 -1
- package/src/flyout/styles.ts +4 -2
- package/src/focusable-iframe/index.js +1 -0
- package/src/font-size-picker/index.js +27 -13
- package/src/font-size-picker/stories/index.js +63 -1
- package/src/font-size-picker/test/index.js +87 -0
- package/src/font-size-picker/test/util.js +74 -0
- package/src/font-size-picker/utils.js +31 -17
- package/src/form-token-field/stories/index.js +1 -1
- package/src/gradient-picker/stories/index.js +1 -1
- package/src/grid/stories/index.js +1 -1
- package/src/guide/stories/index.js +1 -1
- package/src/higher-order/with-focus-outside/index.js +2 -0
- package/src/icon/stories/index.js +1 -1
- package/src/index.js +1 -0
- package/src/input-control/stories/index.js +2 -1
- package/src/input-control/styles/input-control-styles.tsx +16 -6
- package/src/input-control/types.ts +3 -1
- package/src/item-group/stories/index.js +84 -2
- package/src/menu-item/README.md +2 -2
- package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +6 -2
- package/src/mobile/color-settings/index.native.js +2 -0
- package/src/mobile/color-settings/palette.screen.native.js +8 -5
- package/src/mobile/color-settings/style.native.scss +1 -1
- package/src/mobile/global-styles-context/utils.native.js +1 -1
- package/src/mobile/gridicons/index.native.js +3 -3
- package/src/mobile/inserter-button/style.native.scss +1 -0
- package/src/mobile/link-picker/index.native.js +41 -7
- package/src/mobile/link-settings/index.native.js +11 -0
- package/src/mobile/link-settings/test/edit.native.js +432 -0
- package/src/modal/README.md +10 -0
- package/src/modal/aria-helper.js +2 -0
- package/src/modal/index.js +72 -55
- package/src/modal/stories/index.js +6 -1
- package/src/modal/style.scss +9 -0
- package/src/modal/test/index.js +11 -0
- package/src/navigation/README.md +0 -9
- package/src/notice/stories/index.js +1 -1
- package/src/number-control/stories/index.js +1 -1
- package/src/panel/stories/index.js +1 -1
- package/src/placeholder/stories/index.js +1 -1
- package/src/popover/stories/index.js +1 -1
- package/src/query-controls/README.md +138 -6
- package/src/radio-group/README.md +4 -1
- package/src/range-control/stories/index.js +1 -1
- package/src/resizable-box/stories/index.js +1 -1
- package/src/scrollable/stories/index.js +1 -1
- package/src/search-control/stories/index.js +1 -1
- package/src/select-control/stories/index.js +2 -1
- package/src/select-control/styles/select-control-styles.ts +25 -2
- package/src/select-control/types.ts +1 -1
- package/src/slot-fill/stories/index.js +1 -1
- package/src/snackbar/stories/index.js +1 -1
- package/src/spacer/stories/index.js +1 -1
- package/src/style-provider/index.js +2 -0
- package/src/surface/stories/index.js +1 -1
- package/src/tab-panel/stories/index.js +1 -1
- package/src/text-control/stories/index.js +1 -1
- package/src/text-highlight/stories/index.js +1 -1
- package/src/textarea-control/stories/index.js +1 -1
- package/src/tip/stories/index.js +1 -1
- package/src/toggle-control/stories/index.js +1 -1
- package/src/toggle-group-control/stories/index.js +1 -1
- package/src/toggle-group-control/toggle-group-control/component.tsx +7 -2
- package/src/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.tsx +24 -9
- package/src/toolbar-button/stories/index.js +1 -1
- package/src/tools-panel/stories/index.js +237 -0
- package/src/tools-panel/styles.ts +41 -1
- package/src/tools-panel/test/index.js +234 -1
- package/src/tools-panel/tools-panel/README.md +9 -0
- package/src/tools-panel/tools-panel/component.tsx +2 -5
- package/src/tools-panel/tools-panel/hook.ts +50 -18
- package/src/tools-panel/tools-panel-item/hook.ts +5 -1
- package/src/tools-panel/types.ts +5 -1
- package/src/tooltip/stories/index.js +1 -1
- package/src/tree-select/stories/index.js +1 -1
- package/src/truncate/stories/index.js +1 -1
- package/src/unit-control/stories/index.js +19 -1
- package/src/unit-control/styles/unit-control-styles.ts +33 -46
- package/src/unit-control/types.ts +5 -2
- package/src/z-stack/README.md +1 -1
- package/src/z-stack/component.tsx +1 -1
- package/src/z-stack/stories/index.js +1 -1
- package/src/z-stack/styles.ts +7 -2
- package/tsconfig.json +6 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -25,6 +25,11 @@ displaying by default through the `isShownByDefault` prop. Determining whether a
|
|
|
25
25
|
child has a value is done via the `hasValue` function provided through the
|
|
26
26
|
child's props.
|
|
27
27
|
|
|
28
|
+
Components that are not wrapped within a `ToolsPanelItem` are still rendered
|
|
29
|
+
however they will not be represented within, or controlled by, the `ToolsPanel`
|
|
30
|
+
menu. An example scenario that benefits from this could be displaying
|
|
31
|
+
introduction or help text within a panel.
|
|
32
|
+
|
|
28
33
|
## Usage
|
|
29
34
|
|
|
30
35
|
```jsx
|
|
@@ -51,6 +56,10 @@ export function DimensionPanel( props ) {
|
|
|
51
56
|
|
|
52
57
|
return (
|
|
53
58
|
<ToolsPanel label={ __( 'Dimensions' ) } resetAll={ resetAll }>
|
|
59
|
+
<p>
|
|
60
|
+
Select dimensions or spacing related settings from the menu for
|
|
61
|
+
additional controls.
|
|
62
|
+
</p>
|
|
54
63
|
{ ! isPaddingDisabled && (
|
|
55
64
|
<ToolsPanelItem
|
|
56
65
|
hasValue={ () => hasPaddingValue( props ) }
|
|
@@ -24,14 +24,11 @@ const ToolsPanel = (
|
|
|
24
24
|
panelContext,
|
|
25
25
|
resetAllItems,
|
|
26
26
|
toggleItem,
|
|
27
|
-
|
|
27
|
+
...toolsPanelProps
|
|
28
28
|
} = useToolsPanel( props );
|
|
29
29
|
|
|
30
|
-
// Props are not directly passed through to avoid exposing Grid props
|
|
31
|
-
// until agreement has been reached on how ToolsPanel layout should be
|
|
32
|
-
// handled.
|
|
33
30
|
return (
|
|
34
|
-
<Grid
|
|
31
|
+
<Grid { ...toolsPanelProps } columns={ 2 } ref={ forwardedRef }>
|
|
35
32
|
<ToolsPanelContext.Provider value={ panelContext }>
|
|
36
33
|
<ToolsPanelHeader
|
|
37
34
|
label={ label }
|
|
@@ -22,12 +22,21 @@ const DEFAULT_COLUMNS = 2;
|
|
|
22
22
|
const generateMenuItems = ( {
|
|
23
23
|
panelItems,
|
|
24
24
|
shouldReset,
|
|
25
|
+
currentMenuItems,
|
|
25
26
|
}: ToolsPanelMenuItemsConfig ) => {
|
|
26
27
|
const menuItems: ToolsPanelMenuItems = { default: {}, optional: {} };
|
|
27
28
|
|
|
28
29
|
panelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {
|
|
29
30
|
const group = isShownByDefault ? 'default' : 'optional';
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
// If a menu item for this label already exists, do not overwrite its value.
|
|
33
|
+
// This can cause default controls that have been flagged as customized to
|
|
34
|
+
// lose their value.
|
|
35
|
+
const existingItemValue = currentMenuItems?.[ group ]?.[ label ];
|
|
36
|
+
const value =
|
|
37
|
+
existingItemValue !== undefined ? existingItemValue : hasValue();
|
|
38
|
+
|
|
39
|
+
menuItems[ group ][ label ] = shouldReset ? false : value;
|
|
31
40
|
} );
|
|
32
41
|
|
|
33
42
|
return menuItems;
|
|
@@ -62,7 +71,19 @@ export function useToolsPanel(
|
|
|
62
71
|
const [ panelItems, setPanelItems ] = useState< ToolsPanelItem[] >( [] );
|
|
63
72
|
|
|
64
73
|
const registerPanelItem = ( item: ToolsPanelItem ) => {
|
|
65
|
-
setPanelItems( ( items ) =>
|
|
74
|
+
setPanelItems( ( items ) => {
|
|
75
|
+
const newItems = [ ...items ];
|
|
76
|
+
// If an item with this label is already registered, remove it first.
|
|
77
|
+
// This can happen when an item is moved between the default and optional
|
|
78
|
+
// groups.
|
|
79
|
+
const existingIndex = newItems.findIndex(
|
|
80
|
+
( oldItem ) => oldItem.label === item.label
|
|
81
|
+
);
|
|
82
|
+
if ( existingIndex !== -1 ) {
|
|
83
|
+
newItems.splice( existingIndex, 1 );
|
|
84
|
+
}
|
|
85
|
+
return [ ...newItems, item ];
|
|
86
|
+
} );
|
|
66
87
|
};
|
|
67
88
|
|
|
68
89
|
// Panels need to deregister on unmount to avoid orphans in menu state.
|
|
@@ -72,11 +93,16 @@ export function useToolsPanel(
|
|
|
72
93
|
// controls, e.g. both panels have a "padding" control, the
|
|
73
94
|
// deregistration of the first panel doesn't occur until after the
|
|
74
95
|
// registration of the next.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
96
|
+
setPanelItems( ( items ) => {
|
|
97
|
+
const newItems = [ ...items ];
|
|
98
|
+
const index = newItems.findIndex(
|
|
99
|
+
( item ) => item.label === label
|
|
100
|
+
);
|
|
101
|
+
if ( index !== -1 ) {
|
|
102
|
+
newItems.splice( index, 1 );
|
|
103
|
+
}
|
|
104
|
+
return newItems;
|
|
105
|
+
} );
|
|
80
106
|
};
|
|
81
107
|
|
|
82
108
|
// Manage and share display state of menu items representing child controls.
|
|
@@ -87,27 +113,33 @@ export function useToolsPanel(
|
|
|
87
113
|
|
|
88
114
|
// Setup menuItems state as panel items register themselves.
|
|
89
115
|
useEffect( () => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
116
|
+
setMenuItems( ( prevState ) => {
|
|
117
|
+
const items = generateMenuItems( {
|
|
118
|
+
panelItems,
|
|
119
|
+
shouldReset: false,
|
|
120
|
+
currentMenuItems: prevState,
|
|
121
|
+
} );
|
|
122
|
+
return items;
|
|
93
123
|
} );
|
|
94
|
-
setMenuItems( items );
|
|
95
124
|
}, [ panelItems ] );
|
|
96
125
|
|
|
97
126
|
// Force a menu item to be checked.
|
|
98
127
|
// This is intended for use with default panel items. They are displayed
|
|
99
128
|
// separately to optional items and have different display states,
|
|
100
|
-
|
|
129
|
+
// we need to update that when their value is customized.
|
|
101
130
|
const flagItemCustomization = (
|
|
102
131
|
label: string,
|
|
103
132
|
group: ToolsPanelMenuItemKey = 'default'
|
|
104
133
|
) => {
|
|
105
|
-
setMenuItems( {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
134
|
+
setMenuItems( ( items ) => {
|
|
135
|
+
const newState = {
|
|
136
|
+
...items,
|
|
137
|
+
[ group ]: {
|
|
138
|
+
...items[ group ],
|
|
139
|
+
[ label ]: true,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
return newState;
|
|
111
143
|
} );
|
|
112
144
|
};
|
|
113
145
|
|
package/src/tools-panel/types.ts
CHANGED
|
@@ -124,7 +124,10 @@ export type ToolsPanelContext = {
|
|
|
124
124
|
hasMenuItems: boolean;
|
|
125
125
|
registerPanelItem: ( item: ToolsPanelItem ) => void;
|
|
126
126
|
deregisterPanelItem: ( label: string ) => void;
|
|
127
|
-
flagItemCustomization: (
|
|
127
|
+
flagItemCustomization: (
|
|
128
|
+
label: string,
|
|
129
|
+
group?: ToolsPanelMenuItemKey
|
|
130
|
+
) => void;
|
|
128
131
|
isResetting: boolean;
|
|
129
132
|
shouldRenderPlaceholderItems: boolean;
|
|
130
133
|
areAllOptionalControlsHidden: boolean;
|
|
@@ -139,4 +142,5 @@ export type ToolsPanelControlsGroupProps = {
|
|
|
139
142
|
export type ToolsPanelMenuItemsConfig = {
|
|
140
143
|
panelItems: ToolsPanelItem[];
|
|
141
144
|
shouldReset: boolean;
|
|
145
|
+
currentMenuItems?: ToolsPanelMenuItems;
|
|
142
146
|
};
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
title: 'Components/UnitControl',
|
|
20
20
|
component: UnitControl,
|
|
21
21
|
parameters: {
|
|
22
|
-
knobs: {
|
|
22
|
+
knobs: { disable: false },
|
|
23
23
|
},
|
|
24
24
|
};
|
|
25
25
|
|
|
@@ -45,6 +45,7 @@ function Example() {
|
|
|
45
45
|
{
|
|
46
46
|
default: 'default',
|
|
47
47
|
small: 'small',
|
|
48
|
+
'__unstable-large': '__unstable-large',
|
|
48
49
|
},
|
|
49
50
|
'default'
|
|
50
51
|
),
|
|
@@ -67,6 +68,23 @@ export const _default = () => {
|
|
|
67
68
|
return <Example />;
|
|
68
69
|
};
|
|
69
70
|
|
|
71
|
+
export const WithSingleUnit = ( props ) => {
|
|
72
|
+
const [ value, setValue ] = useState( '10px' );
|
|
73
|
+
return (
|
|
74
|
+
<ControlWrapperView>
|
|
75
|
+
<UnitControl
|
|
76
|
+
{ ...props }
|
|
77
|
+
value={ value }
|
|
78
|
+
onChange={ ( v ) => setValue( v ) }
|
|
79
|
+
/>
|
|
80
|
+
</ControlWrapperView>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
WithSingleUnit.args = {
|
|
84
|
+
label: 'Value',
|
|
85
|
+
units: CSS_UNITS.slice( 0, 1 ),
|
|
86
|
+
};
|
|
87
|
+
|
|
70
88
|
export function WithCustomUnits() {
|
|
71
89
|
const [ value, setValue ] = useState( '10km' );
|
|
72
90
|
|
|
@@ -18,6 +18,7 @@ type SelectProps = {
|
|
|
18
18
|
|
|
19
19
|
type InputProps = {
|
|
20
20
|
disableUnits?: boolean;
|
|
21
|
+
size: SelectSize;
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
export const Root = styled.div`
|
|
@@ -25,11 +26,21 @@ export const Root = styled.div`
|
|
|
25
26
|
position: relative;
|
|
26
27
|
`;
|
|
27
28
|
|
|
28
|
-
const paddingStyles = ( { disableUnits }: InputProps ) => {
|
|
29
|
-
const
|
|
29
|
+
const paddingStyles = ( { disableUnits, size }: InputProps ) => {
|
|
30
|
+
const paddings = {
|
|
31
|
+
default: {
|
|
32
|
+
paddingRight: 8,
|
|
33
|
+
},
|
|
34
|
+
small: {
|
|
35
|
+
paddingRight: 8,
|
|
36
|
+
},
|
|
37
|
+
'__unstable-large': {
|
|
38
|
+
paddingRight: disableUnits ? 16 : 8,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
30
41
|
|
|
31
42
|
return css`
|
|
32
|
-
${ rtl(
|
|
43
|
+
${ rtl( paddings[ size ] )() };
|
|
33
44
|
`;
|
|
34
45
|
};
|
|
35
46
|
|
|
@@ -62,49 +73,24 @@ export const ValueInput = styled( NumberControl )`
|
|
|
62
73
|
}
|
|
63
74
|
`;
|
|
64
75
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const baseUnitLabelStyles = ( props: SelectProps ) => {
|
|
85
|
-
return css`
|
|
86
|
-
appearance: none;
|
|
87
|
-
background: transparent;
|
|
88
|
-
border-radius: 2px;
|
|
89
|
-
border: none;
|
|
90
|
-
box-sizing: border-box;
|
|
91
|
-
color: ${ COLORS.darkGray[ 500 ] };
|
|
92
|
-
display: block;
|
|
93
|
-
font-size: 8px;
|
|
94
|
-
line-height: 1;
|
|
95
|
-
letter-spacing: -0.5px;
|
|
96
|
-
outline: none;
|
|
97
|
-
padding: 2px 1px;
|
|
98
|
-
position: absolute;
|
|
99
|
-
text-align-last: center;
|
|
100
|
-
text-transform: uppercase;
|
|
101
|
-
width: 20px;
|
|
102
|
-
|
|
103
|
-
${ rtl( { borderTopLeftRadius: 0, borderBottomLeftRadius: 0 } )() }
|
|
104
|
-
${ rtl( { right: 0 } )() }
|
|
105
|
-
${ unitSizeStyles( props ) }
|
|
106
|
-
`;
|
|
107
|
-
};
|
|
76
|
+
const baseUnitLabelStyles = css`
|
|
77
|
+
appearance: none;
|
|
78
|
+
background: transparent;
|
|
79
|
+
border-radius: 2px;
|
|
80
|
+
border: none;
|
|
81
|
+
box-sizing: border-box;
|
|
82
|
+
color: ${ COLORS.darkGray[ 500 ] };
|
|
83
|
+
display: block;
|
|
84
|
+
font-size: 8px;
|
|
85
|
+
letter-spacing: -0.5px;
|
|
86
|
+
outline: none;
|
|
87
|
+
padding: 2px 1px;
|
|
88
|
+
text-align-last: center;
|
|
89
|
+
text-transform: uppercase;
|
|
90
|
+
width: 20px;
|
|
91
|
+
|
|
92
|
+
${ rtl( { borderTopLeftRadius: 0, borderBottomLeftRadius: 0 } )() }
|
|
93
|
+
`;
|
|
108
94
|
|
|
109
95
|
export const UnitLabel = styled.div< SelectProps >`
|
|
110
96
|
&&& {
|
|
@@ -119,6 +105,7 @@ export const UnitSelect = styled.select< SelectProps >`
|
|
|
119
105
|
${ baseUnitLabelStyles };
|
|
120
106
|
cursor: pointer;
|
|
121
107
|
border: 1px solid transparent;
|
|
108
|
+
height: 100%;
|
|
122
109
|
|
|
123
110
|
&:hover {
|
|
124
111
|
background-color: ${ COLORS.lightGray[ 300 ] };
|
|
@@ -8,11 +8,14 @@ import type { SyntheticEvent } from 'react';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import type { StateReducer } from '../input-control/reducer/state';
|
|
11
|
-
import type {
|
|
11
|
+
import type {
|
|
12
|
+
InputChangeCallback,
|
|
13
|
+
Size as InputSize,
|
|
14
|
+
} from '../input-control/types';
|
|
12
15
|
|
|
13
16
|
export type Value = number | string;
|
|
14
17
|
|
|
15
|
-
export type SelectSize =
|
|
18
|
+
export type SelectSize = InputSize;
|
|
16
19
|
|
|
17
20
|
export type WPUnitControlUnit = {
|
|
18
21
|
/**
|
package/src/z-stack/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Reverse the layer ordering. When `true`, the first child has the lowest `z-index
|
|
|
34
34
|
|
|
35
35
|
### `offset`: `number`
|
|
36
36
|
|
|
37
|
-
The amount of space between each child element. Defaults to `0`.
|
|
37
|
+
The amount of space between each child element. Defaults to `0`. Its value is automatically inverted (i.e. from positive to negative, and viceversa) when switching from LTR to RTL.
|
|
38
38
|
|
|
39
39
|
### `children`: `ReactNode`
|
|
40
40
|
|
|
@@ -31,7 +31,7 @@ export interface ZStackProps {
|
|
|
31
31
|
*/
|
|
32
32
|
isReversed?: boolean;
|
|
33
33
|
/**
|
|
34
|
-
* The amount of offset between each child element.
|
|
34
|
+
* The amount of offset between each child element. The amount of space between each child element. Defaults to `0`. Its value is automatically inverted (i.e. from positive to negative, and viceversa) when switching from LTR to RTL.
|
|
35
35
|
*
|
|
36
36
|
* @default 0
|
|
37
37
|
*/
|
package/src/z-stack/styles.ts
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import styled from '@emotion/styled';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { rtl } from '../utils';
|
|
11
|
+
|
|
7
12
|
export const ZStackView = styled.div`
|
|
8
13
|
display: flex;
|
|
9
14
|
position: relative;
|
|
@@ -16,8 +21,8 @@ export const ZStackChildView = styled.div< {
|
|
|
16
21
|
} >`
|
|
17
22
|
${ ( { isLayered, offsetAmount } ) =>
|
|
18
23
|
isLayered
|
|
19
|
-
? css( { marginLeft: offsetAmount } )
|
|
20
|
-
: css( { right: offsetAmount * -1 } ) }
|
|
24
|
+
? css( rtl( { marginLeft: offsetAmount } )() )
|
|
25
|
+
: css( rtl( { right: offsetAmount * -1 } )() ) }
|
|
21
26
|
|
|
22
27
|
${ ( { isLayered } ) =>
|
|
23
28
|
isLayered ? positionAbsolute : positionRelative }
|
package/tsconfig.json
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"src/base-field/**/*",
|
|
29
29
|
"src/button/**/*",
|
|
30
30
|
"src/card/**/*",
|
|
31
|
+
"src/confirm-dialog/**/*",
|
|
31
32
|
"src/dashicon/**/*",
|
|
32
33
|
"src/disabled/**/*",
|
|
33
34
|
"src/divider/**/*",
|
|
@@ -41,11 +42,13 @@
|
|
|
41
42
|
"src/grid/**/*",
|
|
42
43
|
"src/h-stack/**/*",
|
|
43
44
|
"src/heading/**/*",
|
|
44
|
-
"src/
|
|
45
|
-
"src/input-control/**/*",
|
|
45
|
+
"src/higher-order/with-focus-outside/**/*",
|
|
46
46
|
"src/icon/**/*",
|
|
47
|
+
"src/input-control/**/*",
|
|
48
|
+
"src/item-group/**/*",
|
|
47
49
|
"src/menu-item/**/*",
|
|
48
50
|
"src/menu-group/**/*",
|
|
51
|
+
"src/modal/**/*",
|
|
49
52
|
"src/navigable-container/**/*",
|
|
50
53
|
"src/navigator/**/*",
|
|
51
54
|
"src/number-control/**/*",
|
|
@@ -57,6 +60,7 @@
|
|
|
57
60
|
"src/select-control/**/*",
|
|
58
61
|
"src/shortcut/**/*",
|
|
59
62
|
"src/slot-fill/**/*",
|
|
63
|
+
"src/style-provider/**/*",
|
|
60
64
|
"src/spacer/**/*",
|
|
61
65
|
"src/spinner/**/*",
|
|
62
66
|
"src/surface/**/*",
|