@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
|
@@ -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
|
/**
|
|
@@ -148,14 +148,23 @@ export default function ColorPalette( {
|
|
|
148
148
|
/>
|
|
149
149
|
);
|
|
150
150
|
|
|
151
|
+
let dropdownPosition;
|
|
152
|
+
let popoverProps;
|
|
153
|
+
if ( __experimentalIsRenderedInSidebar ) {
|
|
154
|
+
dropdownPosition = isRTL() ? 'bottom right' : 'bottom left';
|
|
155
|
+
popoverProps = { __unstableForcePosition: true };
|
|
156
|
+
}
|
|
157
|
+
|
|
151
158
|
const colordColor = colord( value );
|
|
152
159
|
|
|
153
160
|
return (
|
|
154
161
|
<VStack spacing={ 3 } className={ className }>
|
|
155
162
|
{ ! disableCustomColors && (
|
|
156
163
|
<CustomColorPickerDropdown
|
|
164
|
+
position={ dropdownPosition }
|
|
157
165
|
isRenderedInSidebar={ __experimentalIsRenderedInSidebar }
|
|
158
166
|
renderContent={ renderCustomColorPicker }
|
|
167
|
+
popoverProps={ popoverProps }
|
|
159
168
|
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
160
169
|
<button
|
|
161
170
|
className="components-color-palette__custom-color"
|
|
@@ -173,6 +173,7 @@ exports[`ColorPalette should render a dynamic toolbar of colors 1`] = `
|
|
|
173
173
|
data-wp-component="VStack"
|
|
174
174
|
isColumn={true}
|
|
175
175
|
>
|
|
176
|
+
<Noop />
|
|
176
177
|
<div
|
|
177
178
|
className="components-flex components-h-stack components-v-stack emotion-4 emotion-5"
|
|
178
179
|
data-wp-c16t={true}
|
|
@@ -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.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
// eslint-disable-next-line no-restricted-imports
|
|
5
|
+
import React, { useEffect, useState } from 'react';
|
|
6
|
+
// eslint-disable-next-line no-restricted-imports
|
|
7
|
+
import type { Ref, KeyboardEvent } from 'react';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* WordPress dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { __ } from '@wordpress/i18n';
|
|
13
|
+
import { useCallback } from '@wordpress/element';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import Modal from '../modal';
|
|
19
|
+
import type { OwnProps, DialogInputEvent } from './types';
|
|
20
|
+
import {
|
|
21
|
+
useContextSystem,
|
|
22
|
+
contextConnect,
|
|
23
|
+
WordPressComponentProps,
|
|
24
|
+
} from '../ui/context';
|
|
25
|
+
import { Flex } from '../flex';
|
|
26
|
+
import Button from '../button';
|
|
27
|
+
import { Text } from '../text';
|
|
28
|
+
import { VStack } from '../v-stack';
|
|
29
|
+
|
|
30
|
+
function ConfirmDialog(
|
|
31
|
+
props: WordPressComponentProps< OwnProps, 'div', false >,
|
|
32
|
+
forwardedRef: Ref< any >
|
|
33
|
+
) {
|
|
34
|
+
const {
|
|
35
|
+
isOpen: isOpenProp,
|
|
36
|
+
onConfirm,
|
|
37
|
+
onCancel,
|
|
38
|
+
children,
|
|
39
|
+
...otherProps
|
|
40
|
+
} = useContextSystem( props, 'ConfirmDialog' );
|
|
41
|
+
|
|
42
|
+
const [ isOpen, setIsOpen ] = useState< boolean >();
|
|
43
|
+
const [ shouldSelfClose, setShouldSelfClose ] = useState< boolean >();
|
|
44
|
+
|
|
45
|
+
useEffect( () => {
|
|
46
|
+
// We only allow the dialog to close itself if `isOpenProp` is *not* set.
|
|
47
|
+
// If `isOpenProp` is set, then it (probably) means it's controlled by a
|
|
48
|
+
// parent component. In that case, `shouldSelfClose` might do more harm than
|
|
49
|
+
// good, so we disable it.
|
|
50
|
+
const isIsOpenSet = typeof isOpenProp !== 'undefined';
|
|
51
|
+
setIsOpen( isIsOpenSet ? isOpenProp : true );
|
|
52
|
+
setShouldSelfClose( ! isIsOpenSet );
|
|
53
|
+
}, [ isOpenProp ] );
|
|
54
|
+
|
|
55
|
+
const handleEvent = useCallback(
|
|
56
|
+
( callback?: ( event: DialogInputEvent ) => void ) => (
|
|
57
|
+
event: DialogInputEvent
|
|
58
|
+
) => {
|
|
59
|
+
callback?.( event );
|
|
60
|
+
if ( shouldSelfClose ) {
|
|
61
|
+
setIsOpen( false );
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
[ shouldSelfClose, setIsOpen ]
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const handleEnter = useCallback(
|
|
68
|
+
( event: KeyboardEvent< HTMLDivElement > ) => {
|
|
69
|
+
if ( event.key === 'Enter' ) {
|
|
70
|
+
handleEvent( onConfirm )( event );
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
[ handleEvent, onConfirm ]
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const cancelLabel = __( 'Cancel' );
|
|
77
|
+
const confirmLabel = __( 'OK' );
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<>
|
|
81
|
+
{ isOpen && (
|
|
82
|
+
<Modal
|
|
83
|
+
onRequestClose={ handleEvent( onCancel ) }
|
|
84
|
+
onKeyDown={ handleEnter }
|
|
85
|
+
closeButtonLabel={ cancelLabel }
|
|
86
|
+
isDismissible={ true }
|
|
87
|
+
ref={ forwardedRef }
|
|
88
|
+
__experimentalHideHeader
|
|
89
|
+
{ ...otherProps }
|
|
90
|
+
>
|
|
91
|
+
<VStack spacing={ 8 }>
|
|
92
|
+
<Text>{ children }</Text>
|
|
93
|
+
<Flex direction="row" justify="flex-end">
|
|
94
|
+
<Button
|
|
95
|
+
variant="tertiary"
|
|
96
|
+
onClick={ handleEvent( onCancel ) }
|
|
97
|
+
>
|
|
98
|
+
{ cancelLabel }
|
|
99
|
+
</Button>
|
|
100
|
+
<Button
|
|
101
|
+
variant="primary"
|
|
102
|
+
onClick={ handleEvent( onConfirm ) }
|
|
103
|
+
>
|
|
104
|
+
{ confirmLabel }
|
|
105
|
+
</Button>
|
|
106
|
+
</Flex>
|
|
107
|
+
</VStack>
|
|
108
|
+
</Modal>
|
|
109
|
+
) }
|
|
110
|
+
</>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export default contextConnect( ConfirmDialog, 'ConfirmDialog' );
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
// eslint-disable-next-line no-restricted-imports
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
import { text } from '@storybook/addon-knobs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import Button from '../../button';
|
|
12
|
+
import { Heading } from '../../heading';
|
|
13
|
+
import { ConfirmDialog } from '..';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
component: ConfirmDialog,
|
|
17
|
+
title: 'Components (Experimental)/ConfirmDialog',
|
|
18
|
+
parameters: {
|
|
19
|
+
knobs: { disable: false },
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const daText = () =>
|
|
24
|
+
text( 'message', 'Would you like to privately publish the post now?' );
|
|
25
|
+
|
|
26
|
+
// Simplest usage: just declare the component with the required `onConfirm` prop.
|
|
27
|
+
export const _default = () => {
|
|
28
|
+
const [ confirmVal, setConfirmVal ] = useState( "Hasn't confirmed yet" );
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<ConfirmDialog onConfirm={ () => setConfirmVal( 'Confirmed!' ) }>
|
|
33
|
+
{ daText() }
|
|
34
|
+
</ConfirmDialog>
|
|
35
|
+
<Heading level={ 1 }>{ confirmVal }</Heading>
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const WithJSXMessage = () => {
|
|
41
|
+
const [ confirmVal, setConfirmVal ] = useState( "Hasn't confirmed yet" );
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<ConfirmDialog onConfirm={ () => setConfirmVal( 'Confirmed!' ) }>
|
|
46
|
+
<Heading level={ 2 }>{ daText() }</Heading>
|
|
47
|
+
</ConfirmDialog>
|
|
48
|
+
<Heading level={ 1 }>{ confirmVal }</Heading>
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const VeeeryLongMessage = () => {
|
|
54
|
+
const [ confirmVal, setConfirmVal ] = useState( "Hasn't confirmed yet" );
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<>
|
|
58
|
+
<ConfirmDialog onConfirm={ () => setConfirmVal( 'Confirmed!' ) }>
|
|
59
|
+
{ daText().repeat( 20 ) }
|
|
60
|
+
</ConfirmDialog>
|
|
61
|
+
<Heading level={ 1 }>{ confirmVal }</Heading>
|
|
62
|
+
</>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const UncontrolledAndWithExplicitOnCancel = () => {
|
|
67
|
+
const [ confirmVal, setConfirmVal ] = useState(
|
|
68
|
+
"Hasn't confirmed or cancelled yet"
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
<ConfirmDialog
|
|
74
|
+
onConfirm={ () => setConfirmVal( 'Confirmed!' ) }
|
|
75
|
+
onCancel={ () => setConfirmVal( 'Cancelled' ) }
|
|
76
|
+
>
|
|
77
|
+
{ daText() }
|
|
78
|
+
</ConfirmDialog>
|
|
79
|
+
<Heading level={ 1 }>{ confirmVal }</Heading>
|
|
80
|
+
</>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Controlled `ConfirmDialog`s require both `onConfirm` *and* `onCancel to be passed
|
|
85
|
+
// It's expected that the user will then use it to hide the dialog, too (see the
|
|
86
|
+
// `setIsOpen` calls below).
|
|
87
|
+
export const Controlled = () => {
|
|
88
|
+
const [ isOpen, setIsOpen ] = useState( false );
|
|
89
|
+
const [ confirmVal, setConfirmVal ] = useState(
|
|
90
|
+
"Hasn't confirmed or cancelled yet"
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const handleConfirm = () => {
|
|
94
|
+
setConfirmVal( 'Confirmed!' );
|
|
95
|
+
setIsOpen( false );
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const handleCancel = () => {
|
|
99
|
+
setConfirmVal( 'Cancelled' );
|
|
100
|
+
setIsOpen( false );
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<>
|
|
105
|
+
<ConfirmDialog
|
|
106
|
+
isOpen={ isOpen }
|
|
107
|
+
onConfirm={ handleConfirm }
|
|
108
|
+
onCancel={ handleCancel }
|
|
109
|
+
>
|
|
110
|
+
{ daText() }
|
|
111
|
+
</ConfirmDialog>
|
|
112
|
+
|
|
113
|
+
<Heading level={ 1 }>{ confirmVal }</Heading>
|
|
114
|
+
|
|
115
|
+
<Button variant="primary" onClick={ () => setIsOpen( true ) }>
|
|
116
|
+
Open ConfirmDialog
|
|
117
|
+
</Button>
|
|
118
|
+
</>
|
|
119
|
+
);
|
|
120
|
+
};
|