@wordpress/components 19.10.0 → 19.11.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 +24 -6
- package/build/border-box-control/border-box-control/component.js +22 -7
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/hook.js +3 -2
- package/build/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +21 -8
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-box-control/border-box-control-visualizer/hook.js +3 -2
- package/build/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
- package/build/border-box-control/styles.js +11 -15
- package/build/border-box-control/styles.js.map +1 -1
- package/build/border-control/border-control/component.js +5 -3
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control/hook.js +6 -3
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +6 -2
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/hook.js +5 -5
- package/build/border-control/border-control-dropdown/hook.js.map +1 -1
- package/build/border-control/styles.js +58 -29
- package/build/border-control/styles.js.map +1 -1
- package/build/button/index.native.js +16 -2
- package/build/button/index.native.js.map +1 -1
- package/build/button-group/index.js +24 -7
- package/build/button-group/index.js.map +1 -1
- package/build/{flyout → button-group}/types.js +0 -0
- package/build/button-group/types.js.map +1 -0
- package/build/checkbox-control/index.js +34 -7
- package/build/checkbox-control/index.js.map +1 -1
- package/build/checkbox-control/types.js +6 -0
- package/build/checkbox-control/types.js.map +1 -0
- package/build/color-palette/index.js +5 -12
- package/build/color-palette/index.js.map +1 -1
- package/build/date-time/date.js +43 -19
- package/build/date-time/date.js.map +1 -1
- package/build/date-time/index.js +28 -3
- package/build/date-time/index.js.map +1 -1
- package/build/date-time/time.js +42 -40
- package/build/date-time/time.js.map +1 -1
- package/build/date-time/timezone.js +4 -3
- package/build/date-time/timezone.js.map +1 -1
- package/build/date-time/types.js +6 -0
- package/build/date-time/types.js.map +1 -0
- package/build/date-time/utils.js +6 -4
- package/build/date-time/utils.js.map +1 -1
- package/build/disabled/index.js +1 -1
- package/build/disabled/index.js.map +1 -1
- package/build/draggable/index.native.js +223 -0
- package/build/draggable/index.native.js.map +1 -0
- package/build/dropdown/index.js +7 -5
- package/build/dropdown/index.js.map +1 -1
- package/build/focal-point-picker/index.native.js +3 -3
- package/build/focal-point-picker/index.native.js.map +1 -1
- package/build/index.js +0 -8
- package/build/index.js.map +1 -1
- package/build/index.native.js +16 -0
- package/build/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js +1 -1
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet-select-control/index.native.js +3 -2
- package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build/mobile/html-text-input/index.native.js +19 -8
- package/build/mobile/html-text-input/index.native.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.android.js +28 -5
- package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js +47 -24
- package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build/palette-edit/index.js +38 -7
- package/build/palette-edit/index.js.map +1 -1
- package/build/popover/index.js +223 -277
- package/build/popover/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js +5 -8
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/sandbox/index.native.js +1 -1
- package/build/sandbox/index.native.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +14 -11
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +1 -3
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/tooltip/index.js +2 -2
- package/build/tooltip/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +22 -7
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/hook.js +3 -2
- package/build-module/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +21 -8
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-visualizer/hook.js +3 -2
- package/build-module/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
- package/build-module/border-box-control/styles.js +9 -15
- package/build-module/border-box-control/styles.js.map +1 -1
- package/build-module/border-control/border-control/component.js +5 -3
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control/hook.js +6 -3
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +6 -2
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/hook.js +5 -5
- package/build-module/border-control/border-control-dropdown/hook.js.map +1 -1
- package/build-module/border-control/styles.js +56 -29
- package/build-module/border-control/styles.js.map +1 -1
- package/build-module/button/index.native.js +16 -3
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/button-group/index.js +27 -7
- package/build-module/button-group/index.js.map +1 -1
- package/build-module/{flyout → button-group}/types.js +0 -0
- package/build-module/{flyout → button-group}/types.js.map +0 -0
- package/build-module/checkbox-control/index.js +31 -7
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/checkbox-control/types.js +2 -0
- package/{build/flyout → build-module/checkbox-control}/types.js.map +0 -0
- package/build-module/color-palette/index.js +5 -11
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/date-time/date.js +44 -19
- package/build-module/date-time/date.js.map +1 -1
- package/build-module/date-time/index.js +28 -4
- package/build-module/date-time/index.js.map +1 -1
- package/build-module/date-time/time.js +43 -41
- package/build-module/date-time/time.js.map +1 -1
- package/build-module/date-time/timezone.js +4 -3
- package/build-module/date-time/timezone.js.map +1 -1
- package/build-module/date-time/types.js +2 -0
- package/build-module/date-time/types.js.map +1 -0
- package/build-module/date-time/utils.js +6 -4
- package/build-module/date-time/utils.js.map +1 -1
- package/build-module/disabled/index.js +1 -1
- package/build-module/disabled/index.js.map +1 -1
- package/build-module/draggable/index.native.js +206 -0
- package/build-module/draggable/index.native.js.map +1 -0
- package/build-module/dropdown/index.js +7 -5
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/focal-point-picker/index.native.js +3 -3
- package/build-module/focal-point-picker/index.native.js.map +1 -1
- package/build-module/index.js +0 -1
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +2 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-select-control/index.native.js +3 -2
- package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build-module/mobile/html-text-input/index.native.js +20 -9
- package/build-module/mobile/html-text-input/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js +21 -5
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +42 -25
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build-module/palette-edit/index.js +37 -7
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/popover/index.js +225 -279
- package/build-module/popover/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js +4 -5
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/sandbox/index.native.js +1 -1
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +14 -11
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +2 -3
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/tooltip/index.js +2 -2
- package/build-module/tooltip/index.js.map +1 -1
- package/build-style/style-rtl.css +31 -170
- package/build-style/style.css +27 -170
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +3 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +3 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
- package/build-types/border-box-control/styles.d.ts +2 -2
- package/build-types/border-box-control/styles.d.ts.map +1 -1
- package/build-types/border-box-control/types.d.ts +40 -13
- package/build-types/border-box-control/types.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts +2 -1
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +1 -0
- package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
- package/build-types/border-control/styles.d.ts +2 -1
- package/build-types/border-control/styles.d.ts.map +1 -1
- package/build-types/border-control/types.d.ts +18 -6
- package/build-types/border-control/types.d.ts.map +1 -1
- package/build-types/button-group/index.d.ts +25 -0
- package/build-types/button-group/index.d.ts.map +1 -0
- package/build-types/button-group/stories/index.d.ts +12 -0
- package/build-types/button-group/stories/index.d.ts.map +1 -0
- package/build-types/button-group/types.d.ts +11 -0
- package/build-types/button-group/types.d.ts.map +1 -0
- package/build-types/checkbox-control/index.d.ts +26 -0
- package/build-types/checkbox-control/index.d.ts.map +1 -0
- package/build-types/checkbox-control/stories/index.d.ts +13 -0
- package/build-types/checkbox-control/stories/index.d.ts.map +1 -0
- package/build-types/checkbox-control/types.d.ts +35 -0
- package/build-types/checkbox-control/types.d.ts.map +1 -0
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +1 -1
- package/build-types/date-time/date.d.ts +24 -0
- package/build-types/date-time/date.d.ts.map +1 -0
- package/build-types/date-time/index.d.ts +35 -0
- package/build-types/date-time/index.d.ts.map +1 -0
- package/build-types/date-time/stories/date.d.ts +14 -0
- package/build-types/date-time/stories/date.d.ts.map +1 -0
- package/build-types/date-time/stories/index.d.ts +14 -0
- package/build-types/date-time/stories/index.d.ts.map +1 -0
- package/build-types/date-time/stories/time.d.ts +12 -0
- package/build-types/date-time/stories/time.d.ts.map +1 -0
- package/build-types/date-time/stories/utils.d.ts +3 -0
- package/build-types/date-time/stories/utils.d.ts.map +1 -0
- package/build-types/date-time/test/date.d.ts +2 -0
- package/build-types/date-time/test/date.d.ts.map +1 -0
- package/build-types/date-time/test/time.d.ts +2 -0
- package/build-types/date-time/test/time.d.ts.map +1 -0
- package/build-types/date-time/test/utils.d.ts +2 -0
- package/build-types/date-time/test/utils.d.ts.map +1 -0
- package/build-types/date-time/time.d.ts +25 -0
- package/build-types/date-time/time.d.ts.map +1 -0
- package/build-types/date-time/timezone.d.ts +8 -0
- package/build-types/date-time/timezone.d.ts.map +1 -0
- package/build-types/date-time/types.d.ts +91 -0
- package/build-types/date-time/types.d.ts.map +1 -0
- package/build-types/date-time/utils.d.ts +15 -0
- package/build-types/date-time/utils.d.ts.map +1 -0
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/input-control/index.d.ts +1 -1
- package/build-types/input-control/stories/index.d.ts +5 -5
- package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
- package/build-types/popover/index.d.ts +5 -7
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/resizable-box/index.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/autocomplete/style.scss +1 -1
- package/src/border-box-control/border-box-control/README.md +10 -14
- package/src/border-box-control/border-box-control/component.tsx +21 -4
- package/src/border-box-control/border-box-control-linked-button/hook.ts +10 -6
- package/src/border-box-control/border-box-control-split-controls/component.tsx +24 -7
- package/src/border-box-control/border-box-control-visualizer/hook.ts +11 -6
- package/src/border-box-control/stories/index.js +1 -0
- package/src/border-box-control/styles.ts +15 -8
- package/src/border-box-control/types.ts +40 -14
- package/src/border-control/border-control/README.md +0 -7
- package/src/border-control/border-control/component.tsx +4 -2
- package/src/border-control/border-control/hook.ts +5 -2
- package/src/border-control/border-control-dropdown/component.tsx +18 -11
- package/src/border-control/border-control-dropdown/hook.ts +7 -5
- package/src/border-control/stories/index.js +1 -0
- package/src/border-control/styles.ts +82 -22
- package/src/border-control/types.ts +18 -6
- package/src/button/index.native.js +33 -18
- package/src/button-group/index.tsx +47 -0
- package/src/button-group/stories/index.tsx +41 -0
- package/src/button-group/types.ts +11 -0
- package/src/checkbox-control/README.md +10 -8
- package/src/checkbox-control/{index.js → index.tsx} +49 -14
- package/src/checkbox-control/stories/{index.js → index.tsx} +49 -27
- package/src/checkbox-control/types.ts +36 -0
- package/src/circular-option-picker/style.scss +1 -0
- package/src/color-palette/index.js +6 -13
- package/src/color-palette/style.scss +3 -18
- package/src/date-time/README.md +13 -10
- package/src/date-time/{date.js → date.tsx} +49 -20
- package/src/date-time/{index.js → index.tsx} +31 -5
- package/src/date-time/stories/date.tsx +73 -0
- package/src/date-time/stories/index.tsx +75 -0
- package/src/date-time/stories/time.tsx +51 -0
- package/src/date-time/stories/utils.ts +9 -0
- package/src/date-time/test/{date.js → date.tsx} +3 -2
- package/src/date-time/test/{time.js → time.tsx} +34 -19
- package/src/date-time/test/{utils.js → utils.ts} +1 -1
- package/src/date-time/{time.js → time.tsx} +57 -46
- package/src/date-time/{timezone.js → timezone.tsx} +4 -3
- package/src/date-time/types.ts +106 -0
- package/src/date-time/utils.ts +20 -0
- package/src/disabled/index.js +1 -1
- package/src/draggable/index.native.js +215 -0
- package/src/draggable/style.native.scss +3 -0
- package/src/dropdown/index.js +9 -4
- package/src/dropdown/style.scss +1 -1
- package/src/focal-point-picker/index.native.js +3 -3
- package/src/form-file-upload/test/index.js +8 -4
- package/src/index.js +0 -1
- package/src/index.native.js +1 -0
- package/src/item-group/stories/index.js +22 -18
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +1 -1
- package/src/mobile/bottom-sheet/index.native.js +1 -1
- package/src/mobile/bottom-sheet-select-control/index.native.js +7 -2
- package/src/mobile/html-text-input/index.native.js +45 -29
- package/src/mobile/html-text-input/style.android.scss +1 -15
- package/src/mobile/html-text-input/style.ios.scss +1 -15
- package/src/mobile/html-text-input/{style-common.native.scss → style.scss} +16 -0
- package/src/mobile/keyboard-aware-flat-list/index.android.js +15 -5
- package/src/mobile/keyboard-aware-flat-list/index.ios.js +75 -46
- package/src/navigator/stories/index.js +16 -10
- package/src/palette-edit/index.js +37 -9
- package/src/palette-edit/style.scss +0 -7
- package/src/palette-edit/test/index.js +63 -0
- package/src/panel/README.md +1 -1
- package/src/placeholder/test/index.js +7 -0
- package/src/popover/README.md +7 -9
- package/src/popover/index.js +242 -371
- package/src/popover/style.scss +20 -190
- package/src/popover/test/__snapshots__/index.js.snap +6 -18
- package/src/resizable-box/resize-tooltip/utils.ts +4 -5
- package/src/sandbox/index.native.js +1 -1
- package/src/select-control/styles/select-control-styles.ts +6 -3
- package/src/tab-panel/style.scss +1 -1
- package/src/toggle-group-control/test/__snapshots__/index.js.snap +4 -10
- package/src/toggle-group-control/toggle-group-control/component.tsx +7 -3
- package/src/tooltip/index.js +8 -2
- package/src/tooltip/style.scss +2 -4
- package/src/tooltip/test/index.native.js +1 -1
- package/src/unit-control/test/index.tsx +84 -4
- package/tsconfig.json +6 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/flyout/context.js +0 -23
- package/build/flyout/context.js.map +0 -1
- package/build/flyout/flyout/component.js +0 -106
- package/build/flyout/flyout/component.js.map +0 -1
- package/build/flyout/flyout/hook.js +0 -53
- package/build/flyout/flyout/hook.js.map +0 -1
- package/build/flyout/flyout/index.js +0 -24
- package/build/flyout/flyout/index.js.map +0 -1
- package/build/flyout/flyout-content/component.js +0 -65
- package/build/flyout/flyout-content/component.js.map +0 -1
- package/build/flyout/flyout-content/index.js +0 -16
- package/build/flyout/flyout-content/index.js.map +0 -1
- package/build/flyout/index.js +0 -16
- package/build/flyout/index.js.map +0 -1
- package/build/flyout/styles.js +0 -46
- package/build/flyout/styles.js.map +0 -1
- package/build/flyout/utils.js +0 -36
- package/build/flyout/utils.js.map +0 -1
- package/build/mobile/html-text-input/container.android.js +0 -41
- package/build/mobile/html-text-input/container.android.js.map +0 -1
- package/build/mobile/html-text-input/container.ios.js +0 -60
- package/build/mobile/html-text-input/container.ios.js.map +0 -1
- package/build/popover/utils.js +0 -322
- package/build/popover/utils.js.map +0 -1
- package/build-module/flyout/context.js +0 -11
- package/build-module/flyout/context.js.map +0 -1
- package/build-module/flyout/flyout/component.js +0 -89
- package/build-module/flyout/flyout/component.js.map +0 -1
- package/build-module/flyout/flyout/hook.js +0 -44
- package/build-module/flyout/flyout/hook.js.map +0 -1
- package/build-module/flyout/flyout/index.js +0 -3
- package/build-module/flyout/flyout/index.js.map +0 -1
- package/build-module/flyout/flyout-content/component.js +0 -51
- package/build-module/flyout/flyout-content/component.js.map +0 -1
- package/build-module/flyout/flyout-content/index.js +0 -2
- package/build-module/flyout/flyout-content/index.js.map +0 -1
- package/build-module/flyout/index.js +0 -2
- package/build-module/flyout/index.js.map +0 -1
- package/build-module/flyout/styles.js +0 -27
- package/build-module/flyout/styles.js.map +0 -1
- package/build-module/flyout/utils.js +0 -25
- package/build-module/flyout/utils.js.map +0 -1
- package/build-module/mobile/html-text-input/container.android.js +0 -29
- package/build-module/mobile/html-text-input/container.android.js.map +0 -1
- package/build-module/mobile/html-text-input/container.ios.js +0 -48
- package/build-module/mobile/html-text-input/container.ios.js.map +0 -1
- package/build-module/popover/utils.js +0 -308
- package/build-module/popover/utils.js.map +0 -1
- package/build-types/flyout/context.d.ts +0 -6
- package/build-types/flyout/context.d.ts.map +0 -1
- package/build-types/flyout/flyout/component.d.ts +0 -21
- package/build-types/flyout/flyout/component.d.ts.map +0 -1
- package/build-types/flyout/flyout/hook.d.ts +0 -270
- package/build-types/flyout/flyout/hook.d.ts.map +0 -1
- package/build-types/flyout/flyout/index.d.ts +0 -3
- package/build-types/flyout/flyout/index.d.ts.map +0 -1
- package/build-types/flyout/flyout-content/component.d.ts +0 -3
- package/build-types/flyout/flyout-content/component.d.ts.map +0 -1
- package/build-types/flyout/flyout-content/index.d.ts +0 -2
- package/build-types/flyout/flyout-content/index.d.ts.map +0 -1
- package/build-types/flyout/index.d.ts +0 -2
- package/build-types/flyout/index.d.ts.map +0 -1
- package/build-types/flyout/styles.d.ts +0 -22
- package/build-types/flyout/styles.d.ts.map +0 -1
- package/build-types/flyout/types.d.ts +0 -80
- package/build-types/flyout/types.d.ts.map +0 -1
- package/build-types/flyout/utils.d.ts +0 -8
- package/build-types/flyout/utils.d.ts.map +0 -1
- package/build-types/popover/utils.d.ts +0 -70
- package/build-types/popover/utils.d.ts.map +0 -1
- package/src/button-group/index.js +0 -17
- package/src/button-group/stories/index.js +0 -21
- package/src/date-time/stories/date.js +0 -17
- package/src/date-time/stories/index.js +0 -91
- package/src/date-time/stories/time.js +0 -32
- package/src/date-time/utils.js +0 -18
- package/src/flyout/context.js +0 -10
- package/src/flyout/flyout/README.md +0 -98
- package/src/flyout/flyout/component.js +0 -111
- package/src/flyout/flyout/hook.js +0 -45
- package/src/flyout/flyout/index.js +0 -2
- package/src/flyout/flyout-content/component.js +0 -53
- package/src/flyout/flyout-content/index.js +0 -1
- package/src/flyout/index.js +0 -1
- package/src/flyout/stories/index.js +0 -24
- package/src/flyout/styles.ts +0 -41
- package/src/flyout/test/__snapshots__/index.js.snap +0 -186
- package/src/flyout/test/index.js +0 -103
- package/src/flyout/types.ts +0 -84
- package/src/flyout/utils.js +0 -23
- package/src/mobile/html-text-input/container.android.js +0 -23
- package/src/mobile/html-text-input/container.ios.js +0 -50
- package/src/popover/test/utils.js +0 -304
- package/src/popover/utils.js +0 -396
package/build/popover/index.js
CHANGED
|
@@ -13,13 +13,13 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _reactDom = require("@floating-ui/react-dom");
|
|
17
17
|
|
|
18
18
|
var _compose = require("@wordpress/compose");
|
|
19
19
|
|
|
20
20
|
var _icons = require("@wordpress/icons");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
23
23
|
|
|
24
24
|
var _button = _interopRequireDefault(require("../button"));
|
|
25
25
|
|
|
@@ -51,322 +51,167 @@ var _animate = require("../animate");
|
|
|
51
51
|
const SLOT_NAME = 'Popover';
|
|
52
52
|
const slotNameContext = (0, _element.createContext)();
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
let container = arguments.length > 4 ? arguments[4] : undefined;
|
|
54
|
+
const positionToPlacement = position => {
|
|
55
|
+
const [x, y, z] = position.split(' ');
|
|
57
56
|
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
}
|
|
57
|
+
if (['top', 'bottom'].includes(x)) {
|
|
58
|
+
let suffix = '';
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
if (!!z && z === 'left' || y === 'right') {
|
|
61
|
+
suffix = '-start';
|
|
62
|
+
} else if (!!z && z === 'right' || y === 'left') {
|
|
63
|
+
suffix = '-end';
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
return (0, _utils.offsetIframe)(rect, rect.ownerDocument || anchorRefFallback.current.ownerDocument, container);
|
|
66
|
+
return x + suffix;
|
|
69
67
|
}
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return;
|
|
74
|
-
} // Duck-type to check if `anchorRef` is an instance of Range
|
|
75
|
-
// `anchorRef instanceof window.Range` checks will break across document boundaries
|
|
76
|
-
// such as in an iframe.
|
|
77
|
-
|
|
69
|
+
return y;
|
|
70
|
+
};
|
|
78
71
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// `anchorRef instanceof window.Element` checks will break across document boundaries
|
|
83
|
-
// such as in an iframe.
|
|
72
|
+
const placementToAnimationOrigin = placement => {
|
|
73
|
+
const [a, b] = placement.split('-');
|
|
74
|
+
let x, y;
|
|
84
75
|
|
|
76
|
+
if (a === 'top' || a === 'bottom') {
|
|
77
|
+
x = a === 'top' ? 'bottom' : 'top';
|
|
78
|
+
y = 'middle';
|
|
85
79
|
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
if (b === 'start') {
|
|
81
|
+
y = 'left';
|
|
82
|
+
} else if (b === 'end') {
|
|
83
|
+
y = 'right';
|
|
89
84
|
}
|
|
90
|
-
|
|
91
|
-
const {
|
|
92
|
-
top,
|
|
93
|
-
bottom
|
|
94
|
-
} = anchorRef;
|
|
95
|
-
const topRect = top.getBoundingClientRect();
|
|
96
|
-
const bottomRect = bottom.getBoundingClientRect();
|
|
97
|
-
return (0, _utils.offsetIframe)(new window.DOMRect(topRect.left, topRect.top, topRect.width, bottomRect.bottom - topRect.top), top.ownerDocument, container);
|
|
98
85
|
}
|
|
99
86
|
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const {
|
|
105
|
-
parentNode
|
|
106
|
-
} = anchorRefFallback.current;
|
|
107
|
-
return (0, _utils.offsetIframe)(parentNode.getBoundingClientRect(), parentNode.ownerDocument, container);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Sets or removes an element attribute.
|
|
111
|
-
*
|
|
112
|
-
* @param {Element} element The element to modify.
|
|
113
|
-
* @param {string} name The attribute name to set or remove.
|
|
114
|
-
* @param {?string} value The value to set. A falsy value will remove the
|
|
115
|
-
* attribute.
|
|
116
|
-
*/
|
|
117
|
-
|
|
87
|
+
if (a === 'left' || a === 'right') {
|
|
88
|
+
x = 'center';
|
|
89
|
+
y = a === 'left' ? 'right' : 'left';
|
|
118
90
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
|
|
91
|
+
if (b === 'start') {
|
|
92
|
+
x = 'top';
|
|
93
|
+
} else if (b === 'end') {
|
|
94
|
+
x = 'bottom';
|
|
123
95
|
}
|
|
124
|
-
} else if (element.getAttribute(name) !== value) {
|
|
125
|
-
element.setAttribute(name, value);
|
|
126
96
|
}
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Sets or removes an element style property.
|
|
130
|
-
*
|
|
131
|
-
* @param {Element} element The element to modify.
|
|
132
|
-
* @param {string} property The property to set or remove.
|
|
133
|
-
* @param {?string} value The value to set. A falsy value will remove the
|
|
134
|
-
* property.
|
|
135
|
-
*/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
function setStyle(element, property) {
|
|
139
|
-
let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
140
|
-
|
|
141
|
-
if (element.style[property] !== value) {
|
|
142
|
-
element.style[property] = value;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Sets or removes an element class.
|
|
147
|
-
*
|
|
148
|
-
* @param {Element} element The element to modify.
|
|
149
|
-
* @param {string} name The class to set or remove.
|
|
150
|
-
* @param {boolean} toggle True to set the class, false to remove.
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
97
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (!element.classList.contains(name)) {
|
|
157
|
-
element.classList.add(name);
|
|
158
|
-
}
|
|
159
|
-
} else if (element.classList.contains(name)) {
|
|
160
|
-
element.classList.remove(name);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function getAnchorDocument(anchor) {
|
|
165
|
-
if (!anchor) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (anchor.endContainer) {
|
|
170
|
-
return anchor.endContainer.ownerDocument;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (anchor.top) {
|
|
174
|
-
return anchor.top.ownerDocument;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return anchor.ownerDocument;
|
|
178
|
-
}
|
|
98
|
+
return x + ' ' + y;
|
|
99
|
+
};
|
|
179
100
|
|
|
180
101
|
const Popover = (_ref, ref) => {
|
|
181
102
|
let {
|
|
103
|
+
range,
|
|
104
|
+
animate = true,
|
|
182
105
|
headerTitle,
|
|
183
106
|
onClose,
|
|
184
107
|
children,
|
|
185
108
|
className,
|
|
186
109
|
noArrow = true,
|
|
187
110
|
isAlternate,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
/* eslint-disable no-unused-vars */
|
|
192
|
-
position = 'bottom right',
|
|
193
|
-
range,
|
|
111
|
+
position,
|
|
112
|
+
placement = 'bottom-start',
|
|
113
|
+
offset,
|
|
194
114
|
focusOnMount = 'firstElement',
|
|
195
115
|
anchorRef,
|
|
196
116
|
anchorRect,
|
|
197
117
|
getAnchorRect,
|
|
198
118
|
expandOnMobile,
|
|
199
|
-
animate = true,
|
|
200
119
|
onFocusOutside,
|
|
201
|
-
__unstableStickyBoundaryElement,
|
|
202
120
|
__unstableSlotName = SLOT_NAME,
|
|
203
121
|
__unstableObserveElement,
|
|
204
|
-
__unstableBoundaryParent,
|
|
205
122
|
__unstableForcePosition,
|
|
206
|
-
__unstableForceXAlignment,
|
|
207
|
-
__unstableEditorCanvasWrapper,
|
|
208
|
-
|
|
209
|
-
/* eslint-enable no-unused-vars */
|
|
210
123
|
...contentProps
|
|
211
124
|
} = _ref;
|
|
212
|
-
const anchorRefFallback = (0, _element.useRef)(null);
|
|
213
|
-
const contentRef = (0, _element.useRef)(null);
|
|
214
|
-
const containerRef = (0, _element.useRef)();
|
|
215
|
-
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
216
|
-
const [animateOrigin, setAnimateOrigin] = (0, _element.useState)();
|
|
217
125
|
|
|
218
|
-
|
|
126
|
+
if (range) {
|
|
127
|
+
(0, _deprecated.default)('range prop in Popover component', {
|
|
128
|
+
since: '6.1',
|
|
129
|
+
version: '6.3'
|
|
130
|
+
});
|
|
131
|
+
}
|
|
219
132
|
|
|
220
|
-
const
|
|
133
|
+
const arrowRef = (0, _element.useRef)(null);
|
|
134
|
+
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
221
135
|
const isExpanded = expandOnMobile && isMobileViewport;
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
136
|
+
const hasArrow = !isExpanded && !noArrow;
|
|
137
|
+
const usedPlacement = position ? positionToPlacement(position) : placement;
|
|
138
|
+
/**
|
|
139
|
+
* Offsets the the position of the popover when the anchor is inside an iframe.
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
const frameOffset = (0, _element.useMemo)(() => {
|
|
143
|
+
let ownerDocument = document;
|
|
144
|
+
|
|
145
|
+
if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
|
|
146
|
+
ownerDocument = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.top.ownerDocument;
|
|
147
|
+
} else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.startContainer) {
|
|
148
|
+
ownerDocument = anchorRef.startContainer.ownerDocument;
|
|
149
|
+
} else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
|
|
150
|
+
ownerDocument = anchorRef.current.ownerDocument;
|
|
151
|
+
} else if (anchorRef) {
|
|
152
|
+
// This one should be deprecated.
|
|
153
|
+
ownerDocument = anchorRef.ownerDocument;
|
|
154
|
+
} else if (anchorRect && anchorRect !== null && anchorRect !== void 0 && anchorRect.ownerDocument) {
|
|
155
|
+
ownerDocument = anchorRect.ownerDocument;
|
|
156
|
+
} else if (getAnchorRect) {
|
|
157
|
+
var _getAnchorRect$ownerD, _getAnchorRect;
|
|
158
|
+
|
|
159
|
+
ownerDocument = (_getAnchorRect$ownerD = (_getAnchorRect = getAnchorRect()) === null || _getAnchorRect === void 0 ? void 0 : _getAnchorRect.ownerDocument) !== null && _getAnchorRect$ownerD !== void 0 ? _getAnchorRect$ownerD : document;
|
|
235
160
|
}
|
|
236
161
|
|
|
237
|
-
const refresh = () => {
|
|
238
|
-
if (!containerRef.current || !contentRef.current) {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
let anchor = computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect, anchorRef, containerRef.current);
|
|
243
|
-
|
|
244
|
-
if (!anchor) {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const {
|
|
249
|
-
offsetParent,
|
|
250
|
-
ownerDocument
|
|
251
|
-
} = containerRef.current;
|
|
252
|
-
let relativeOffsetTop = 0; // If there is a positioned ancestor element that is not the body,
|
|
253
|
-
// subtract the position from the anchor rect. If the position of
|
|
254
|
-
// the popover is fixed, the offset parent is null or the body
|
|
255
|
-
// element, in which case the position is relative to the viewport.
|
|
256
|
-
// See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
|
|
257
|
-
|
|
258
|
-
if (offsetParent && offsetParent !== ownerDocument.body) {
|
|
259
|
-
const offsetParentRect = offsetParent.getBoundingClientRect();
|
|
260
|
-
relativeOffsetTop = offsetParentRect.top;
|
|
261
|
-
anchor = new window.DOMRect(anchor.left - offsetParentRect.left, anchor.top - offsetParentRect.top, anchor.width, anchor.height);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
let boundaryElement;
|
|
265
|
-
|
|
266
|
-
if (__unstableBoundaryParent) {
|
|
267
|
-
boundaryElement = containerRef.current.parentElement;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
const usedContentSize = !contentSize.height ? contentRef.current.getBoundingClientRect() : contentSize;
|
|
271
|
-
const {
|
|
272
|
-
popoverTop,
|
|
273
|
-
popoverLeft,
|
|
274
|
-
xAxis,
|
|
275
|
-
yAxis,
|
|
276
|
-
contentHeight,
|
|
277
|
-
contentWidth
|
|
278
|
-
} = (0, _utils.computePopoverPosition)(anchor, usedContentSize, position, __unstableStickyBoundaryElement, containerRef.current, relativeOffsetTop, boundaryElement, __unstableForcePosition, __unstableForceXAlignment, __unstableEditorCanvasWrapper);
|
|
279
|
-
|
|
280
|
-
if (typeof popoverTop === 'number' && typeof popoverLeft === 'number') {
|
|
281
|
-
setStyle(containerRef.current, 'top', popoverTop + 'px');
|
|
282
|
-
setStyle(containerRef.current, 'left', popoverLeft + 'px');
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
setClass(containerRef.current, 'is-without-arrow', noArrow || xAxis === 'center' && yAxis === 'middle');
|
|
286
|
-
setClass(containerRef.current, 'is-alternate', isAlternate);
|
|
287
|
-
setAttribute(containerRef.current, 'data-x-axis', xAxis);
|
|
288
|
-
setAttribute(containerRef.current, 'data-y-axis', yAxis);
|
|
289
|
-
setStyle(contentRef.current, 'maxHeight', typeof contentHeight === 'number' ? contentHeight + 'px' : '');
|
|
290
|
-
setStyle(contentRef.current, 'maxWidth', typeof contentWidth === 'number' ? contentWidth + 'px' : ''); // Compute the animation position.
|
|
291
|
-
|
|
292
|
-
const yAxisMapping = {
|
|
293
|
-
top: 'bottom',
|
|
294
|
-
bottom: 'top'
|
|
295
|
-
};
|
|
296
|
-
const xAxisMapping = {
|
|
297
|
-
left: 'right',
|
|
298
|
-
right: 'left'
|
|
299
|
-
};
|
|
300
|
-
const animateYAxis = yAxisMapping[yAxis] || 'middle';
|
|
301
|
-
const animateXAxis = xAxisMapping[xAxis] || 'center';
|
|
302
|
-
setAnimateOrigin(animateXAxis + ' ' + animateYAxis);
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
refresh();
|
|
306
|
-
const {
|
|
307
|
-
ownerDocument
|
|
308
|
-
} = containerRef.current;
|
|
309
162
|
const {
|
|
310
163
|
defaultView
|
|
311
164
|
} = ownerDocument;
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
*/
|
|
319
|
-
|
|
320
|
-
const intervalHandle = defaultView.setInterval(refresh, 500);
|
|
321
|
-
let rafId;
|
|
322
|
-
|
|
323
|
-
const refreshOnAnimationFrame = () => {
|
|
324
|
-
defaultView.cancelAnimationFrame(rafId);
|
|
325
|
-
rafId = defaultView.requestAnimationFrame(refresh);
|
|
326
|
-
}; // Sometimes a click trigger a layout change that affects the popover
|
|
327
|
-
// position. This is an opportunity to immediately refresh rather than
|
|
328
|
-
// at the interval.
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
defaultView.addEventListener('click', refreshOnAnimationFrame);
|
|
332
|
-
defaultView.addEventListener('resize', refresh);
|
|
333
|
-
defaultView.addEventListener('scroll', refresh, true);
|
|
334
|
-
const anchorDocument = getAnchorDocument(anchorRef); // If the anchor is within an iframe, the popover position also needs
|
|
335
|
-
// to refrest when the iframe content is scrolled or resized.
|
|
336
|
-
|
|
337
|
-
if (anchorDocument && anchorDocument !== ownerDocument) {
|
|
338
|
-
anchorDocument.defaultView.addEventListener('resize', refresh);
|
|
339
|
-
anchorDocument.defaultView.addEventListener('scroll', refresh, true);
|
|
165
|
+
const {
|
|
166
|
+
frameElement
|
|
167
|
+
} = defaultView;
|
|
168
|
+
|
|
169
|
+
if (!frameElement || ownerDocument === document) {
|
|
170
|
+
return undefined;
|
|
340
171
|
}
|
|
341
172
|
|
|
342
|
-
|
|
173
|
+
const iframeRect = frameElement.getBoundingClientRect();
|
|
174
|
+
return {
|
|
175
|
+
name: 'iframeOffset',
|
|
176
|
+
|
|
177
|
+
fn(_ref2) {
|
|
178
|
+
let {
|
|
179
|
+
x,
|
|
180
|
+
y
|
|
181
|
+
} = _ref2;
|
|
182
|
+
return {
|
|
183
|
+
x: x + iframeRect.left,
|
|
184
|
+
y: y + iframeRect.top
|
|
185
|
+
};
|
|
186
|
+
}
|
|
343
187
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
188
|
+
};
|
|
189
|
+
}, [anchorRef, anchorRect, getAnchorRect]);
|
|
190
|
+
const middlewares = [frameOffset, offset ? (0, _reactDom.offset)(offset) : undefined, __unstableForcePosition ? undefined : (0, _reactDom.flip)(), __unstableForcePosition ? undefined : (0, _reactDom.size)({
|
|
191
|
+
apply(_ref3) {
|
|
192
|
+
let {
|
|
193
|
+
width,
|
|
194
|
+
height
|
|
195
|
+
} = _ref3;
|
|
196
|
+
if (!refs.floating.current) return;
|
|
197
|
+
Object.assign(refs.floating.current.firstChild.style, {
|
|
198
|
+
maxWidth: `${width}px`,
|
|
199
|
+
maxHeight: `${height}px`,
|
|
200
|
+
overflow: 'auto'
|
|
348
201
|
});
|
|
349
202
|
}
|
|
350
203
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
if (anchorDocument && anchorDocument !== ownerDocument) {
|
|
359
|
-
var _anchorDocument$defau, _anchorDocument$defau2;
|
|
204
|
+
}),, (0, _reactDom.shift)({
|
|
205
|
+
crossAxis: true,
|
|
206
|
+
limiter: (0, _reactDom.limitShift)()
|
|
207
|
+
}), hasArrow ? (0, _reactDom.arrow)({
|
|
208
|
+
element: arrowRef
|
|
209
|
+
}) : undefined].filter(m => !!m);
|
|
210
|
+
const anchorRefFallback = (0, _element.useRef)(null);
|
|
360
211
|
|
|
361
|
-
|
|
362
|
-
(_anchorDocument$defau2 = anchorDocument.defaultView) === null || _anchorDocument$defau2 === void 0 ? void 0 : _anchorDocument$defau2.removeEventListener('scroll', refresh, true);
|
|
363
|
-
}
|
|
212
|
+
const slotName = (0, _element.useContext)(slotNameContext) || __unstableSlotName;
|
|
364
213
|
|
|
365
|
-
|
|
366
|
-
observer.disconnect();
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
}, [isExpanded, anchorRect, getAnchorRect, anchorRef, position, contentSize, __unstableStickyBoundaryElement, __unstableObserveElement, __unstableBoundaryParent]);
|
|
214
|
+
const slot = (0, _slotFill.useSlot)(slotName);
|
|
370
215
|
|
|
371
216
|
const onDialogClose = (type, event) => {
|
|
372
217
|
// Ideally the popover should have just a single onClose prop and
|
|
@@ -383,12 +228,104 @@ const Popover = (_ref, ref) => {
|
|
|
383
228
|
__unstableOnClose: onDialogClose,
|
|
384
229
|
onClose: onDialogClose
|
|
385
230
|
});
|
|
386
|
-
const
|
|
231
|
+
const {
|
|
232
|
+
x,
|
|
233
|
+
y,
|
|
234
|
+
reference,
|
|
235
|
+
floating,
|
|
236
|
+
strategy,
|
|
237
|
+
refs,
|
|
238
|
+
update,
|
|
239
|
+
placement: placementData,
|
|
240
|
+
middlewareData: {
|
|
241
|
+
arrow: arrowData = {}
|
|
242
|
+
}
|
|
243
|
+
} = (0, _reactDom.useFloating)({
|
|
244
|
+
placement: usedPlacement,
|
|
245
|
+
middleware: middlewares
|
|
246
|
+
});
|
|
247
|
+
const staticSide = {
|
|
248
|
+
top: 'bottom',
|
|
249
|
+
right: 'left',
|
|
250
|
+
bottom: 'top',
|
|
251
|
+
left: 'right'
|
|
252
|
+
}[placementData.split('-')[0]];
|
|
253
|
+
const mergedRefs = (0, _compose.useMergeRefs)([floating, dialogRef, ref]); // Updates references
|
|
254
|
+
|
|
255
|
+
(0, _element.useLayoutEffect)(() => {
|
|
256
|
+
// No ref or position have been passed
|
|
257
|
+
let usedRef;
|
|
258
|
+
|
|
259
|
+
if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
|
|
260
|
+
usedRef = {
|
|
261
|
+
getBoundingClientRect() {
|
|
262
|
+
const topRect = anchorRef.top.getBoundingClientRect();
|
|
263
|
+
const bottomRect = anchorRef.bottom.getBoundingClientRect();
|
|
264
|
+
return new window.DOMRect(topRect.x, topRect.y, topRect.width, bottomRect.bottom - topRect.top);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
};
|
|
268
|
+
} else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
|
|
269
|
+
usedRef = anchorRef.current;
|
|
270
|
+
} else if (anchorRef) {
|
|
271
|
+
usedRef = anchorRef;
|
|
272
|
+
} else if (anchorRect) {
|
|
273
|
+
usedRef = {
|
|
274
|
+
getBoundingClientRect() {
|
|
275
|
+
return anchorRect;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
};
|
|
279
|
+
} else if (getAnchorRect) {
|
|
280
|
+
usedRef = {
|
|
281
|
+
getBoundingClientRect() {
|
|
282
|
+
var _rect$x, _rect$y, _rect$height, _rect$width;
|
|
283
|
+
|
|
284
|
+
const rect = getAnchorRect();
|
|
285
|
+
return { ...rect,
|
|
286
|
+
x: (_rect$x = rect.x) !== null && _rect$x !== void 0 ? _rect$x : rect.left,
|
|
287
|
+
y: (_rect$y = rect.y) !== null && _rect$y !== void 0 ? _rect$y : rect.top,
|
|
288
|
+
height: (_rect$height = rect.height) !== null && _rect$height !== void 0 ? _rect$height : rect.bottom - rect.top,
|
|
289
|
+
width: (_rect$width = rect.width) !== null && _rect$width !== void 0 ? _rect$width : rect.right - rect.left
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
};
|
|
294
|
+
} else if (anchorRefFallback.current) {
|
|
295
|
+
usedRef = anchorRefFallback.current;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (!usedRef) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
reference(usedRef);
|
|
303
|
+
|
|
304
|
+
if (!refs.floating.current) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return (0, _reactDom.autoUpdate)(usedRef, refs.floating.current, update);
|
|
309
|
+
}, [anchorRef, anchorRect, getAnchorRect]); // This is only needed for a smoth transition when moving blocks.
|
|
310
|
+
|
|
311
|
+
(0, _element.useLayoutEffect)(() => {
|
|
312
|
+
if (!__unstableObserveElement) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const observer = new window.MutationObserver(update);
|
|
317
|
+
observer.observe(__unstableObserveElement, {
|
|
318
|
+
attributes: true
|
|
319
|
+
});
|
|
320
|
+
return () => {
|
|
321
|
+
observer.disconnect();
|
|
322
|
+
};
|
|
323
|
+
}, [__unstableObserveElement]);
|
|
387
324
|
/** @type {false | string} */
|
|
388
325
|
|
|
389
|
-
const animateClassName =
|
|
326
|
+
const animateClassName = !!animate && (0, _animate.getAnimateClassName)({
|
|
390
327
|
type: 'appear',
|
|
391
|
-
origin:
|
|
328
|
+
origin: placementToAnimationOrigin(placementData)
|
|
392
329
|
}); // Disable reason: We care to capture the _bubbled_ events from inputs
|
|
393
330
|
// within popover as inferring close intent.
|
|
394
331
|
|
|
@@ -397,13 +334,17 @@ const Popover = (_ref, ref) => {
|
|
|
397
334
|
(0, _element.createElement)("div", (0, _extends2.default)({
|
|
398
335
|
className: (0, _classnames.default)('components-popover', className, animateClassName, {
|
|
399
336
|
'is-expanded': isExpanded,
|
|
400
|
-
'is-without-arrow': noArrow,
|
|
401
337
|
'is-alternate': isAlternate
|
|
402
338
|
})
|
|
403
339
|
}, contentProps, {
|
|
404
340
|
ref: mergedRefs
|
|
405
341
|
}, dialogProps, {
|
|
406
|
-
tabIndex: "-1"
|
|
342
|
+
tabIndex: "-1",
|
|
343
|
+
style: isExpanded ? undefined : {
|
|
344
|
+
position: strategy,
|
|
345
|
+
left: Number.isNaN(x) ? 0 : x,
|
|
346
|
+
top: Number.isNaN(y) ? 0 : y
|
|
347
|
+
}
|
|
407
348
|
}), isExpanded && (0, _element.createElement)(_scrollLock.default, null), isExpanded && (0, _element.createElement)("div", {
|
|
408
349
|
className: "components-popover__header"
|
|
409
350
|
}, (0, _element.createElement)("span", {
|
|
@@ -413,13 +354,18 @@ const Popover = (_ref, ref) => {
|
|
|
413
354
|
icon: _icons.close,
|
|
414
355
|
onClick: onClose
|
|
415
356
|
})), (0, _element.createElement)("div", {
|
|
416
|
-
ref: contentRef,
|
|
417
357
|
className: "components-popover__content"
|
|
418
|
-
}, (0, _element.createElement)("div", {
|
|
358
|
+
}, children), hasArrow && (0, _element.createElement)("div", {
|
|
359
|
+
className: "components-popover__arrow",
|
|
360
|
+
ref: arrowRef,
|
|
419
361
|
style: {
|
|
420
|
-
|
|
362
|
+
left: !(arrowData !== null && arrowData !== void 0 && arrowData.x) || Number.isNaN(arrowData === null || arrowData === void 0 ? void 0 : arrowData.x) ? 0 : arrowData.x,
|
|
363
|
+
top: !(arrowData !== null && arrowData !== void 0 && arrowData.y) || Number.isNaN(arrowData === null || arrowData === void 0 ? void 0 : arrowData.y) ? 0 : arrowData.y,
|
|
364
|
+
right: undefined,
|
|
365
|
+
bottom: undefined,
|
|
366
|
+
[staticSide]: '-4px'
|
|
421
367
|
}
|
|
422
|
-
}
|
|
368
|
+
}));
|
|
423
369
|
|
|
424
370
|
if (slot.ref) {
|
|
425
371
|
content = (0, _element.createElement)(_slotFill.Fill, {
|
|
@@ -438,10 +384,10 @@ const Popover = (_ref, ref) => {
|
|
|
438
384
|
|
|
439
385
|
const PopoverContainer = (0, _element.forwardRef)(Popover);
|
|
440
386
|
|
|
441
|
-
function PopoverSlot(
|
|
387
|
+
function PopoverSlot(_ref4, ref) {
|
|
442
388
|
let {
|
|
443
389
|
name = SLOT_NAME
|
|
444
|
-
} =
|
|
390
|
+
} = _ref4;
|
|
445
391
|
return (0, _element.createElement)(_slotFill.Slot, {
|
|
446
392
|
bubblesVirtually: true,
|
|
447
393
|
name: name,
|