@wordpress/components 19.1.2 → 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 +53 -4
- package/README.md +0 -1
- 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 +36 -9
- 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-bar/constants.js +1 -6
- package/build/custom-gradient-bar/constants.js.map +1 -1
- package/build/custom-gradient-bar/control-points.js +52 -21
- package/build/custom-gradient-bar/control-points.js.map +1 -1
- package/build/custom-gradient-bar/index.js +5 -1
- package/build/custom-gradient-bar/index.js.map +1 -1
- package/build/custom-gradient-picker/index.js +4 -1
- 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/gradient-picker/index.js +3 -1
- package/build/gradient-picker/index.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/palette-edit/index.js +13 -11
- package/build/palette-edit/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/toggle-group-control/toggle-group-control-option/styles.js +8 -8
- package/build/toggle-group-control/toggle-group-control-option/styles.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 +34 -10
- 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-bar/constants.js +0 -4
- package/build-module/custom-gradient-bar/constants.js.map +1 -1
- package/build-module/custom-gradient-bar/control-points.js +54 -23
- package/build-module/custom-gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-gradient-bar/index.js +5 -1
- package/build-module/custom-gradient-bar/index.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +4 -1
- 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/gradient-picker/index.js +3 -1
- package/build-module/gradient-picker/index.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/palette-edit/index.js +13 -11
- package/build-module/palette-edit/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/toggle-group-control/toggle-group-control-option/styles.js +8 -8
- package/build-module/toggle-group-control/toggle-group-control-option/styles.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 +34 -12
- package/build-style/style.css +34 -12
- 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/toggle-group-control/toggle-group-control-option/styles.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 +37 -9
- package/src/color-palette/stories/index.js +1 -1
- package/src/color-palette/style.scss +10 -1
- package/src/color-palette/test/__snapshots__/index.js.snap +30 -21
- 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-bar/constants.js +0 -5
- package/src/custom-gradient-bar/control-points.js +40 -9
- package/src/custom-gradient-bar/index.js +8 -0
- package/src/custom-gradient-picker/index.js +9 -1
- 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/index.js +4 -0
- 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/palette-edit/index.js +15 -16
- package/src/palette-edit/style.scss +5 -0
- 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/toggle-group-control/toggle-group-control-option/styles.ts +3 -0
- 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
|
@@ -93,15 +93,29 @@ export function Button( props ) {
|
|
|
93
93
|
label,
|
|
94
94
|
shortcut,
|
|
95
95
|
tooltipPosition,
|
|
96
|
+
isActiveStyle,
|
|
97
|
+
customContainerStyles,
|
|
96
98
|
} = props;
|
|
97
99
|
const preferredColorScheme = usePreferredColorScheme();
|
|
98
100
|
|
|
99
101
|
const isDisabled = ariaDisabled || disabled;
|
|
100
102
|
|
|
103
|
+
const containerStyle = [
|
|
104
|
+
styles.container,
|
|
105
|
+
customContainerStyles && { ...customContainerStyles },
|
|
106
|
+
];
|
|
107
|
+
|
|
101
108
|
const buttonViewStyle = {
|
|
102
109
|
opacity: isDisabled ? 0.3 : 1,
|
|
103
110
|
...( fixedRatio && styles.fixedRatio ),
|
|
104
111
|
...( isPressed ? styles.buttonActive : styles.buttonInactive ),
|
|
112
|
+
...( isPressed &&
|
|
113
|
+
isActiveStyle?.borderRadius && {
|
|
114
|
+
borderRadius: isActiveStyle.borderRadius,
|
|
115
|
+
} ),
|
|
116
|
+
...( isActiveStyle?.backgroundColor && {
|
|
117
|
+
backgroundColor: isActiveStyle.backgroundColor,
|
|
118
|
+
} ),
|
|
105
119
|
};
|
|
106
120
|
|
|
107
121
|
const states = [];
|
|
@@ -159,7 +173,7 @@ export function Button( props ) {
|
|
|
159
173
|
accessibilityHint={ hint }
|
|
160
174
|
onPress={ onClick }
|
|
161
175
|
onLongPress={ onLongPress }
|
|
162
|
-
style={
|
|
176
|
+
style={ containerStyle }
|
|
163
177
|
disabled={ isDisabled }
|
|
164
178
|
testID={ testID }
|
|
165
179
|
>
|
package/src/button/style.scss
CHANGED
|
@@ -201,6 +201,20 @@
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
&.is-destructive.is-tertiary {
|
|
205
|
+
box-shadow: none;
|
|
206
|
+
|
|
207
|
+
&:hover:not(:disabled) {
|
|
208
|
+
box-shadow: inset 0 0 0 $border-width $alert-red;
|
|
209
|
+
color: $alert-red;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
&:focus:not(:disabled) {
|
|
213
|
+
box-shadow: inset 0 0 0 1px $white, 0 0 0 var(--wp-admin-border-width-focus) $alert-red;
|
|
214
|
+
color: $alert-red;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
204
218
|
|
|
205
219
|
/**
|
|
206
220
|
* Link buttons.
|
package/src/card/card/README.md
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
`Card` also provides a convenient set of [sub-components](#sub-components) such as `CardBody`, `CardHeader`, `CardFooter`, and more (see below).
|
|
8
8
|
|
|
9
|
-
```jsx
|
|
9
|
+
```jsx
|
|
10
10
|
import {
|
|
11
11
|
Card,
|
|
12
12
|
CardHeader,
|
|
13
13
|
CardBody,
|
|
14
14
|
CardFooter,
|
|
15
|
-
Text,
|
|
16
|
-
Heading,
|
|
15
|
+
__experimentalText as Text,
|
|
16
|
+
__experimentalHeading as Heading,
|
|
17
17
|
} from '@wordpress/components';
|
|
18
18
|
|
|
19
19
|
function Example() {
|
|
@@ -269,10 +269,10 @@ Object {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
.emotion-10 {
|
|
272
|
-
border
|
|
273
|
-
border-width: 0 0 1px 0;
|
|
274
|
-
height: 0;
|
|
272
|
+
border: 0;
|
|
275
273
|
margin: 0;
|
|
274
|
+
border-bottom: 1px solid currentColor;
|
|
275
|
+
height: 0;
|
|
276
276
|
width: auto;
|
|
277
277
|
box-sizing: border-box;
|
|
278
278
|
display: block;
|
|
@@ -525,10 +525,10 @@ Object {
|
|
|
525
525
|
}
|
|
526
526
|
|
|
527
527
|
.emotion-10 {
|
|
528
|
-
border
|
|
529
|
-
border-width: 0 0 1px 0;
|
|
530
|
-
height: 0;
|
|
528
|
+
border: 0;
|
|
531
529
|
margin: 0;
|
|
530
|
+
border-bottom: 1px solid currentColor;
|
|
531
|
+
height: 0;
|
|
532
532
|
width: auto;
|
|
533
533
|
box-sizing: border-box;
|
|
534
534
|
display: block;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
.component-color-indicator {
|
|
2
|
-
width:
|
|
3
|
-
height:
|
|
4
|
-
|
|
5
|
-
border:
|
|
2
|
+
width: $grid-unit-50 * 0.5;
|
|
3
|
+
height: $grid-unit-50 * 0.5;
|
|
4
|
+
border-radius: 50%;
|
|
5
|
+
border: $border-width solid $gray-300;
|
|
6
6
|
display: inline-block;
|
|
7
|
-
|
|
8
|
-
& + & {
|
|
9
|
-
margin-left: 0.5rem;
|
|
10
|
-
}
|
|
7
|
+
padding: 0;
|
|
11
8
|
}
|
|
@@ -10,7 +10,7 @@ import classnames from 'classnames';
|
|
|
10
10
|
/**
|
|
11
11
|
* WordPress dependencies
|
|
12
12
|
*/
|
|
13
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
13
|
+
import { __, sprintf, isRTL } from '@wordpress/i18n';
|
|
14
14
|
import { useCallback, useMemo } from '@wordpress/element';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -35,6 +35,7 @@ function SinglePalette( {
|
|
|
35
35
|
const colorOptions = useMemo( () => {
|
|
36
36
|
return map( colors, ( { color, name } ) => {
|
|
37
37
|
const colordColor = colord( color );
|
|
38
|
+
|
|
38
39
|
return (
|
|
39
40
|
<CircularOptionPicker.Option
|
|
40
41
|
key={ color }
|
|
@@ -109,6 +110,20 @@ function MultiplePalettes( {
|
|
|
109
110
|
);
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
export function CustomColorPickerDropdown( { isRenderedInSidebar, ...props } ) {
|
|
114
|
+
return (
|
|
115
|
+
<Dropdown
|
|
116
|
+
contentClassName={ classnames(
|
|
117
|
+
'components-color-palette__custom-color-dropdown-content',
|
|
118
|
+
{
|
|
119
|
+
'is-rendered-in-sidebar': isRenderedInSidebar,
|
|
120
|
+
}
|
|
121
|
+
) }
|
|
122
|
+
{ ...props }
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
112
127
|
export default function ColorPalette( {
|
|
113
128
|
clearable = true,
|
|
114
129
|
className,
|
|
@@ -133,17 +148,23 @@ export default function ColorPalette( {
|
|
|
133
148
|
/>
|
|
134
149
|
);
|
|
135
150
|
|
|
151
|
+
let dropdownPosition;
|
|
152
|
+
let popoverProps;
|
|
153
|
+
if ( __experimentalIsRenderedInSidebar ) {
|
|
154
|
+
dropdownPosition = isRTL() ? 'bottom right' : 'bottom left';
|
|
155
|
+
popoverProps = { __unstableForcePosition: true };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const colordColor = colord( value );
|
|
159
|
+
|
|
136
160
|
return (
|
|
137
161
|
<VStack spacing={ 3 } className={ className }>
|
|
138
162
|
{ ! disableCustomColors && (
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
{
|
|
143
|
-
'is-rendered-in-sidebar': __experimentalIsRenderedInSidebar,
|
|
144
|
-
}
|
|
145
|
-
) }
|
|
163
|
+
<CustomColorPickerDropdown
|
|
164
|
+
position={ dropdownPosition }
|
|
165
|
+
isRenderedInSidebar={ __experimentalIsRenderedInSidebar }
|
|
146
166
|
renderContent={ renderCustomColorPicker }
|
|
167
|
+
popoverProps={ popoverProps }
|
|
147
168
|
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
148
169
|
<button
|
|
149
170
|
className="components-color-palette__custom-color"
|
|
@@ -151,7 +172,14 @@ export default function ColorPalette( {
|
|
|
151
172
|
aria-haspopup="true"
|
|
152
173
|
onClick={ onToggle }
|
|
153
174
|
aria-label={ __( 'Custom color picker' ) }
|
|
154
|
-
style={ {
|
|
175
|
+
style={ {
|
|
176
|
+
background: value,
|
|
177
|
+
color:
|
|
178
|
+
colordColor.contrast() >
|
|
179
|
+
colordColor.contrast( '#000' )
|
|
180
|
+
? '#fff'
|
|
181
|
+
: '#000',
|
|
182
|
+
} }
|
|
155
183
|
>
|
|
156
184
|
{ value }
|
|
157
185
|
</button>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.components-color-palette__custom-color {
|
|
2
|
+
position: relative;
|
|
2
3
|
border: none;
|
|
3
4
|
background: none;
|
|
4
|
-
outline: 0;
|
|
5
5
|
display: block;
|
|
6
6
|
border-radius: $radius-block-ui;
|
|
7
7
|
height: $grid-unit-60;
|
|
@@ -15,6 +15,15 @@
|
|
|
15
15
|
box-sizing: border-box;
|
|
16
16
|
color: $white;
|
|
17
17
|
cursor: pointer;
|
|
18
|
+
box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.2);
|
|
19
|
+
// Show a thin outline in Windows high contrast mode.
|
|
20
|
+
outline: 1px solid transparent;
|
|
21
|
+
|
|
22
|
+
&:focus {
|
|
23
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
24
|
+
// Show a outline in Windows high contrast mode.
|
|
25
|
+
outline-width: 2px;
|
|
26
|
+
}
|
|
18
27
|
}
|
|
19
28
|
|
|
20
29
|
.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content {
|
|
@@ -17,6 +17,7 @@ exports[`ColorPalette Dropdown .renderToggle should render dropdown content 1`]
|
|
|
17
17
|
style={
|
|
18
18
|
Object {
|
|
19
19
|
"background": "#f00",
|
|
20
|
+
"color": "#000",
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
>
|
|
@@ -27,7 +28,6 @@ exports[`ColorPalette Dropdown .renderToggle should render dropdown content 1`]
|
|
|
27
28
|
exports[`ColorPalette Dropdown should render it correctly 1`] = `
|
|
28
29
|
<Dropdown
|
|
29
30
|
contentClassName="components-color-palette__custom-color-dropdown-content"
|
|
30
|
-
key=".0"
|
|
31
31
|
renderContent={[Function]}
|
|
32
32
|
renderToggle={[Function]}
|
|
33
33
|
>
|
|
@@ -44,6 +44,7 @@ exports[`ColorPalette Dropdown should render it correctly 1`] = `
|
|
|
44
44
|
style={
|
|
45
45
|
Object {
|
|
46
46
|
"background": "#f00",
|
|
47
|
+
"color": "#000",
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
>
|
|
@@ -172,37 +173,45 @@ exports[`ColorPalette should render a dynamic toolbar of colors 1`] = `
|
|
|
172
173
|
data-wp-component="VStack"
|
|
173
174
|
isColumn={true}
|
|
174
175
|
>
|
|
176
|
+
<Noop />
|
|
175
177
|
<div
|
|
176
178
|
className="components-flex components-h-stack components-v-stack emotion-4 emotion-5"
|
|
177
179
|
data-wp-c16t={true}
|
|
178
180
|
data-wp-component="VStack"
|
|
179
181
|
>
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
+
<CustomColorPickerDropdown
|
|
183
|
+
isRenderedInSidebar={false}
|
|
182
184
|
key=".0"
|
|
183
185
|
renderContent={[Function]}
|
|
184
186
|
renderToggle={[Function]}
|
|
185
187
|
>
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
188
|
+
<Dropdown
|
|
189
|
+
contentClassName="components-color-palette__custom-color-dropdown-content"
|
|
190
|
+
renderContent={[Function]}
|
|
191
|
+
renderToggle={[Function]}
|
|
189
192
|
>
|
|
190
|
-
<
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
aria-label="Custom color picker"
|
|
194
|
-
className="components-color-palette__custom-color"
|
|
195
|
-
onClick={[Function]}
|
|
196
|
-
style={
|
|
197
|
-
Object {
|
|
198
|
-
"background": "#f00",
|
|
199
|
-
}
|
|
200
|
-
}
|
|
193
|
+
<div
|
|
194
|
+
className="components-dropdown"
|
|
195
|
+
tabIndex="-1"
|
|
201
196
|
>
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
197
|
+
<button
|
|
198
|
+
aria-expanded={false}
|
|
199
|
+
aria-haspopup="true"
|
|
200
|
+
aria-label="Custom color picker"
|
|
201
|
+
className="components-color-palette__custom-color"
|
|
202
|
+
onClick={[Function]}
|
|
203
|
+
style={
|
|
204
|
+
Object {
|
|
205
|
+
"background": "#f00",
|
|
206
|
+
"color": "#000",
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
>
|
|
210
|
+
#f00
|
|
211
|
+
</button>
|
|
212
|
+
</div>
|
|
213
|
+
</Dropdown>
|
|
214
|
+
</CustomColorPickerDropdown>
|
|
206
215
|
<SinglePalette
|
|
207
216
|
actions={
|
|
208
217
|
<ButtonAction
|
|
@@ -18,6 +18,7 @@ import { Flex, FlexItem } from '../flex';
|
|
|
18
18
|
import { Tooltip } from '../ui/tooltip';
|
|
19
19
|
import type { ColorType } from './types';
|
|
20
20
|
import { space } from '../ui/utils/space';
|
|
21
|
+
import { COLORS } from '../utils/colors-values';
|
|
21
22
|
|
|
22
23
|
interface ColorDisplayProps {
|
|
23
24
|
color: Colord;
|
|
@@ -41,7 +42,7 @@ const ValueDisplay = ( { values }: ValueDisplayProps ) => (
|
|
|
41
42
|
{ values.map( ( [ value, abbreviation ] ) => {
|
|
42
43
|
return (
|
|
43
44
|
<FlexItem key={ abbreviation } isBlock display="flex">
|
|
44
|
-
<Text color=
|
|
45
|
+
<Text color={ COLORS.ui.theme }>{ abbreviation }</Text>
|
|
45
46
|
<Text>{ value }</Text>
|
|
46
47
|
</FlexItem>
|
|
47
48
|
);
|
|
@@ -84,7 +85,7 @@ const HexDisplay = ( { color }: DisplayProps ) => {
|
|
|
84
85
|
const colorWithoutHash = color.toHex().slice( 1 ).toUpperCase();
|
|
85
86
|
return (
|
|
86
87
|
<FlexItem>
|
|
87
|
-
<Text color=
|
|
88
|
+
<Text color={ COLORS.ui.theme }>#</Text>
|
|
88
89
|
<Text>{ colorWithoutHash }</Text>
|
|
89
90
|
</FlexItem>
|
|
90
91
|
);
|
|
@@ -15,6 +15,7 @@ import { Text } from '../text';
|
|
|
15
15
|
import { Spacer } from '../spacer';
|
|
16
16
|
import { space } from '../ui/utils/space';
|
|
17
17
|
import { ColorHexInputControl } from './styles';
|
|
18
|
+
import { COLORS } from '../utils/colors-values';
|
|
18
19
|
|
|
19
20
|
interface HexInputProps {
|
|
20
21
|
color: Colord;
|
|
@@ -35,7 +36,7 @@ export const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {
|
|
|
35
36
|
<Spacer
|
|
36
37
|
as={ Text }
|
|
37
38
|
marginLeft={ space( 3.5 ) }
|
|
38
|
-
color=
|
|
39
|
+
color={ COLORS.ui.theme }
|
|
39
40
|
lineHeight={ 1 }
|
|
40
41
|
>
|
|
41
42
|
#
|
|
@@ -6,6 +6,7 @@ import { Text } from '../text';
|
|
|
6
6
|
import { Spacer } from '../spacer';
|
|
7
7
|
import { space } from '../ui/utils/space';
|
|
8
8
|
import { RangeControl, NumberControlWrapper } from './styles';
|
|
9
|
+
import { COLORS } from '../utils/colors-values';
|
|
9
10
|
|
|
10
11
|
interface InputWithSliderProps {
|
|
11
12
|
min: number;
|
|
@@ -37,7 +38,7 @@ export const InputWithSlider = ( {
|
|
|
37
38
|
<Spacer
|
|
38
39
|
as={ Text }
|
|
39
40
|
paddingLeft={ space( 3.5 ) }
|
|
40
|
-
color=
|
|
41
|
+
color={ COLORS.ui.theme }
|
|
41
42
|
lineHeight={ 1 }
|
|
42
43
|
>
|
|
43
44
|
{ abbreviation }
|
|
@@ -21,7 +21,7 @@ These are the same as [the ones for `SelectControl`s](/packages/components/src/s
|
|
|
21
21
|
* WordPress dependencies
|
|
22
22
|
*/
|
|
23
23
|
import { ComboboxControl } from '@wordpress/components';
|
|
24
|
-
import { useState } from '@wordpress/
|
|
24
|
+
import { useState } from '@wordpress/element';
|
|
25
25
|
|
|
26
26
|
const options = [
|
|
27
27
|
{
|
|
@@ -51,7 +51,7 @@ function MyComboboxControl() {
|
|
|
51
51
|
value={ fontSize }
|
|
52
52
|
onChange={ setFontSize }
|
|
53
53
|
options={ filteredOptions }
|
|
54
|
-
|
|
54
|
+
onFilterValueChange={ ( inputValue ) =>
|
|
55
55
|
setFilteredOptions(
|
|
56
56
|
options.filter( ( option ) =>
|
|
57
57
|
option.label
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# `ConfirmDialog`
|
|
2
|
+
|
|
3
|
+
<div class="callout callout-alert">
|
|
4
|
+
This feature is still experimental. "Experimental" means this is an early implementation subject to drastic and breaking changes.
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
`ConfirmDialog` is built of top of [`Modal`](/packages/components/src/modal/README.md] and displays a confirmation dialog, with _confirm_ and _cancel_ buttons.
|
|
8
|
+
|
|
9
|
+
The dialog is confirmed by clicking the _confirm_ button or by pressing the `Enter` key. It is cancelled (closed) by clicking the _cancel_ button, by pressing the `ESC` key, or by clicking outside the dialog focus (i.e, the overlay).
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
`ConfirmDialog` has two main implicit modes: controlled and uncontrolled.
|
|
14
|
+
|
|
15
|
+
### Uncontrolled mode
|
|
16
|
+
|
|
17
|
+
Allows the component to be used standalone, just by declaring it as part of another React's component render method:
|
|
18
|
+
* It will be automatically open (displayed) upon mounting;
|
|
19
|
+
* It will be automatically closed when when clicking the _cancel_ button, by pressing the `ESC` key, or by clicking outside the dialog focus (i.e, the overlay);
|
|
20
|
+
* `onCancel` is not mandatory but can be passed. Even if passed, the dialog will still be able to close itself.
|
|
21
|
+
|
|
22
|
+
Activating this mode is as simple as omitting the `isOpen` prop. The only mandatory prop, in this case, is the `onConfirm` callback. The message is passed as the `children`. You can pass any JSX you'd like, which allows to further format the message or include sub-component if you'd like:
|
|
23
|
+
|
|
24
|
+
```jsx
|
|
25
|
+
import {
|
|
26
|
+
__experimentalConfirmDialog as ConfirmDialog
|
|
27
|
+
} from '@wordpress/components';
|
|
28
|
+
|
|
29
|
+
function Example() {
|
|
30
|
+
return (
|
|
31
|
+
<ConfirmDialog onConfirm={ () => console.debug(' Confirmed! ') }>
|
|
32
|
+
Are you sure? <strong>This action cannot be undone!</strong>
|
|
33
|
+
</ConfirmDialog>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Controlled mode
|
|
39
|
+
|
|
40
|
+
Let the parent component control when the dialog is open/closed. It's activated when a boolean value is passed to `isOpen`:
|
|
41
|
+
* It will not be automatically closed. You need to let it know when to open/close by updating the value of the `isOpen` prop;
|
|
42
|
+
* Both `onConfirm` and the `onCancel` callbacks are mandatory props in this mode;
|
|
43
|
+
* You'll want to update the state that controls `isOpen` by updating it from the `onCancel` and `onConfirm` callbacks.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
```jsx
|
|
47
|
+
import {
|
|
48
|
+
__experimentalConfirmDialog as ConfirmDialog
|
|
49
|
+
} from '@wordpress/components';
|
|
50
|
+
|
|
51
|
+
function Example() {
|
|
52
|
+
const [ isOpen, setIsOpen ] = useState( true );
|
|
53
|
+
|
|
54
|
+
const handleConfirm = () => {
|
|
55
|
+
console.debug( 'Confirmed!' );
|
|
56
|
+
setIsOpen( false );
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const handleCancel = () => {
|
|
60
|
+
console.debug( 'Cancelled!' );
|
|
61
|
+
setIsOpen( false );
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<ConfirmDialog
|
|
66
|
+
isOpen={ isOpen }
|
|
67
|
+
onConfirm={ handleConfirm }
|
|
68
|
+
onCancel={ handleCancel }
|
|
69
|
+
>
|
|
70
|
+
Are you sure? <strong>This action cannot be undone!</strong>
|
|
71
|
+
</ConfirmDialog>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Unsupported: Multiple instances
|
|
77
|
+
|
|
78
|
+
Multiple `ConfirmDialog's is an edge case that's currently not officially supported by this component. At the moment, new instances will end up closing the last instance due to the way the `Modal` is implemented.
|
|
79
|
+
|
|
80
|
+
## Custom Types
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
type DialogInputEvent =
|
|
84
|
+
| KeyboardEvent< HTMLDivElement >
|
|
85
|
+
| MouseEvent< HTMLButtonElement >
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Props
|
|
89
|
+
|
|
90
|
+
### `title`: `string`
|
|
91
|
+
|
|
92
|
+
- Required: No
|
|
93
|
+
|
|
94
|
+
An optional `title` for the dialog. Setting a title will render it in a title bar at the top of the dialog, making it a bit taller. The bar will also include an `x` close button at the top-right corner.
|
|
95
|
+
|
|
96
|
+
### `children`: `React.ReactNode`
|
|
97
|
+
|
|
98
|
+
- Required: Yes
|
|
99
|
+
|
|
100
|
+
The actual message for the dialog. It's passed as children and any valid `ReactNode` is accepted:
|
|
101
|
+
|
|
102
|
+
```jsx
|
|
103
|
+
<ConfirmDialog>
|
|
104
|
+
Are you sure? <strong>This action cannot be undone!</strong>
|
|
105
|
+
</ConfirmDialog>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### `isOpen`: `boolean`
|
|
109
|
+
|
|
110
|
+
- Required: No
|
|
111
|
+
|
|
112
|
+
Defines if the dialog is open (displayed) or closed (not rendered/displayed). It also implicitly toggles the controlled mode if set or the uncontrolled mode if it's not set.
|
|
113
|
+
|
|
114
|
+
### `onConfirm`: `( event: DialogInputEvent ) => void`
|
|
115
|
+
|
|
116
|
+
- Required: Yes
|
|
117
|
+
|
|
118
|
+
The callback that's called when the user confirms. A confirmation can happen when the `OK` button is clicked or when `Enter` is pressed.
|
|
119
|
+
|
|
120
|
+
### `onCancel`: `( event: DialogInputEvent ) => void`
|
|
121
|
+
|
|
122
|
+
- Required: Only if `isOpen` is not set
|
|
123
|
+
|
|
124
|
+
The callback that's called when the user cancels. A cancellation can happen when the `Cancel` button is clicked, when the `ESC` key is pressed, or when a click outside of the dialog focus is detected (i.e. in the overlay).
|
|
125
|
+
|
|
126
|
+
It's not required if `isOpen` is not set (uncontrolled mode), as the component will take care of closing itself, but you can still pass a callback if something must be done upon cancelling (the component will still close itself in this case).
|
|
127
|
+
|
|
128
|
+
If `isOpen` is set (controlled mode), then it's required, and you need to set the state that defines `isOpen` to `false` as part of this callback if you want the dialog to close when the user cancels.
|