@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
package/build/date-time/date.js
CHANGED
|
@@ -17,6 +17,8 @@ var _DayPickerSingleDateController = _interopRequireDefault(require("react-dates
|
|
|
17
17
|
|
|
18
18
|
var _i18n = require("@wordpress/i18n");
|
|
19
19
|
|
|
20
|
+
var _utils = require("./utils");
|
|
21
|
+
|
|
20
22
|
/**
|
|
21
23
|
* External dependencies
|
|
22
24
|
*/
|
|
@@ -27,6 +29,10 @@ var _i18n = require("@wordpress/i18n");
|
|
|
27
29
|
* WordPress dependencies
|
|
28
30
|
*/
|
|
29
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Internal dependencies
|
|
34
|
+
*/
|
|
35
|
+
|
|
30
36
|
/**
|
|
31
37
|
* Module Constants
|
|
32
38
|
*/
|
|
@@ -77,20 +83,20 @@ function DatePickerDay(_ref) {
|
|
|
77
83
|
}, day.format('D'));
|
|
78
84
|
}
|
|
79
85
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
86
|
+
function DatePicker(_ref2) {
|
|
87
|
+
let {
|
|
88
|
+
currentDate,
|
|
89
|
+
onChange,
|
|
90
|
+
events,
|
|
91
|
+
isInvalidDate,
|
|
92
|
+
onMonthPreviewed
|
|
93
|
+
} = _ref2;
|
|
94
|
+
const nodeRef = (0, _element.useRef)();
|
|
95
|
+
|
|
96
|
+
const onMonthPreviewedHandler = newMonthDate => {
|
|
97
|
+
onMonthPreviewed === null || onMonthPreviewed === void 0 ? void 0 : onMonthPreviewed(newMonthDate.toISOString());
|
|
98
|
+
keepFocusInside();
|
|
99
|
+
};
|
|
94
100
|
/*
|
|
95
101
|
* Todo: We should remove this function ASAP.
|
|
96
102
|
* It is kept because focus is lost when we click on the previous and next month buttons.
|
|
@@ -99,21 +105,21 @@ class DatePicker extends _element.Component {
|
|
|
99
105
|
*/
|
|
100
106
|
|
|
101
107
|
|
|
102
|
-
keepFocusInside() {
|
|
103
|
-
if (!
|
|
108
|
+
const keepFocusInside = () => {
|
|
109
|
+
if (!nodeRef.current) {
|
|
104
110
|
return;
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
const {
|
|
108
114
|
ownerDocument
|
|
109
|
-
} =
|
|
115
|
+
} = nodeRef.current;
|
|
110
116
|
const {
|
|
111
117
|
activeElement
|
|
112
118
|
} = ownerDocument; // If focus was lost.
|
|
113
119
|
|
|
114
|
-
if (!activeElement || !
|
|
120
|
+
if (!activeElement || !nodeRef.current.contains(ownerDocument.activeElement)) {
|
|
115
121
|
// Retrieve the focus region div.
|
|
116
|
-
const focusRegion =
|
|
122
|
+
const focusRegion = nodeRef.current.querySelector('.DayPicker_focusRegion');
|
|
117
123
|
|
|
118
124
|
if (!focusRegion) {
|
|
119
125
|
return;
|
|
@@ -122,14 +128,10 @@ class DatePicker extends _element.Component {
|
|
|
122
128
|
|
|
123
129
|
focusRegion.focus();
|
|
124
130
|
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
onChangeMoment(newDate) {
|
|
128
|
-
const {
|
|
129
|
-
currentDate,
|
|
130
|
-
onChange
|
|
131
|
-
} = this.props; // If currentDate is null, use now as momentTime to designate hours, minutes, seconds.
|
|
131
|
+
};
|
|
132
132
|
|
|
133
|
+
const onChangeMoment = newDate => {
|
|
134
|
+
// If currentDate is null, use now as momentTime to designate hours, minutes, seconds.
|
|
133
135
|
const momentDate = currentDate ? (0, _moment.default)(currentDate) : (0, _moment.default)();
|
|
134
136
|
const momentTime = {
|
|
135
137
|
hours: momentDate.hours(),
|
|
@@ -138,71 +140,46 @@ class DatePicker extends _element.Component {
|
|
|
138
140
|
};
|
|
139
141
|
onChange(newDate.set(momentTime).format(TIMEZONELESS_FORMAT)); // Keep focus on the date picker.
|
|
140
142
|
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Create a Moment object from a date string. With no currentDate supplied, default to a Moment
|
|
145
|
-
* object representing now. If a null value is passed, return a null value.
|
|
146
|
-
*
|
|
147
|
-
* @param {?string} currentDate Date representing the currently selected date or null to signify no selection.
|
|
148
|
-
* @return {?moment.Moment} Moment object for selected date or null.
|
|
149
|
-
*/
|
|
143
|
+
keepFocusInside();
|
|
144
|
+
};
|
|
150
145
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (null === currentDate) {
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return currentDate ? (0, _moment.default)(currentDate) : (0, _moment.default)();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
getEventsPerDay(day) {
|
|
161
|
-
var _this$props$events;
|
|
162
|
-
|
|
163
|
-
if (!((_this$props$events = this.props.events) !== null && _this$props$events !== void 0 && _this$props$events.length)) {
|
|
146
|
+
const getEventsPerDay = day => {
|
|
147
|
+
if (!(events !== null && events !== void 0 && events.length)) {
|
|
164
148
|
return [];
|
|
165
149
|
}
|
|
166
150
|
|
|
167
|
-
return
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
render() {
|
|
171
|
-
const {
|
|
172
|
-
currentDate,
|
|
173
|
-
isInvalidDate
|
|
174
|
-
} = this.props;
|
|
175
|
-
const momentDate = this.getMomentDate(currentDate);
|
|
176
|
-
return (0, _element.createElement)("div", {
|
|
177
|
-
className: "components-datetime__date",
|
|
178
|
-
ref: this.nodeRef
|
|
179
|
-
}, (0, _element.createElement)(_DayPickerSingleDateController.default, {
|
|
180
|
-
date: momentDate,
|
|
181
|
-
daySize: 30,
|
|
182
|
-
focused: true,
|
|
183
|
-
hideKeyboardShortcutsPanel: true // This is a hack to force the calendar to update on month or year change
|
|
184
|
-
// https://github.com/airbnb/react-dates/issues/240#issuecomment-361776665
|
|
185
|
-
,
|
|
186
|
-
key: `datepicker-controller-${momentDate ? momentDate.format('MM-YYYY') : 'null'}`,
|
|
187
|
-
noBorder: true,
|
|
188
|
-
numberOfMonths: 1,
|
|
189
|
-
onDateChange: this.onChangeMoment,
|
|
190
|
-
transitionDuration: 0,
|
|
191
|
-
weekDayFormat: "ddd",
|
|
192
|
-
dayAriaLabelFormat: ARIAL_LABEL_TIME_FORMAT,
|
|
193
|
-
isRTL: (0, _i18n.isRTL)(),
|
|
194
|
-
isOutsideRange: date => {
|
|
195
|
-
return isInvalidDate && isInvalidDate(date.toDate());
|
|
196
|
-
},
|
|
197
|
-
onPrevMonthClick: this.onMonthPreviewedHandler,
|
|
198
|
-
onNextMonthClick: this.onMonthPreviewedHandler,
|
|
199
|
-
renderDayContents: day => (0, _element.createElement)(DatePickerDay, {
|
|
200
|
-
day: day,
|
|
201
|
-
events: this.getEventsPerDay(day)
|
|
202
|
-
})
|
|
203
|
-
}));
|
|
204
|
-
}
|
|
151
|
+
return events.filter(eventDay => day.isSame(eventDay.date, 'day'));
|
|
152
|
+
};
|
|
205
153
|
|
|
154
|
+
const momentDate = (0, _utils.getMomentDate)(currentDate);
|
|
155
|
+
return (0, _element.createElement)("div", {
|
|
156
|
+
className: "components-datetime__date",
|
|
157
|
+
ref: nodeRef
|
|
158
|
+
}, (0, _element.createElement)(_DayPickerSingleDateController.default, {
|
|
159
|
+
date: momentDate,
|
|
160
|
+
daySize: 30,
|
|
161
|
+
focused: true,
|
|
162
|
+
hideKeyboardShortcutsPanel: true // This is a hack to force the calendar to update on month or year change
|
|
163
|
+
// https://github.com/airbnb/react-dates/issues/240#issuecomment-361776665
|
|
164
|
+
,
|
|
165
|
+
key: `datepicker-controller-${momentDate ? momentDate.format('MM-YYYY') : 'null'}`,
|
|
166
|
+
noBorder: true,
|
|
167
|
+
numberOfMonths: 1,
|
|
168
|
+
onDateChange: onChangeMoment,
|
|
169
|
+
transitionDuration: 0,
|
|
170
|
+
weekDayFormat: "ddd",
|
|
171
|
+
dayAriaLabelFormat: ARIAL_LABEL_TIME_FORMAT,
|
|
172
|
+
isRTL: (0, _i18n.isRTL)(),
|
|
173
|
+
isOutsideRange: date => {
|
|
174
|
+
return isInvalidDate && isInvalidDate(date.toDate());
|
|
175
|
+
},
|
|
176
|
+
onPrevMonthClick: onMonthPreviewedHandler,
|
|
177
|
+
onNextMonthClick: onMonthPreviewedHandler,
|
|
178
|
+
renderDayContents: day => (0, _element.createElement)(DatePickerDay, {
|
|
179
|
+
day: day,
|
|
180
|
+
events: getEventsPerDay(day)
|
|
181
|
+
})
|
|
182
|
+
}));
|
|
206
183
|
}
|
|
207
184
|
|
|
208
185
|
var _default = DatePicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/date-time/date.js"],"names":["TIMEZONELESS_FORMAT","ARIAL_LABEL_TIME_FORMAT","DatePickerDay","day","events","ref","current","parentNode","dayAriaLabel","format","length","setAttribute","dayWithEventsDescription","DatePicker","Component","constructor","arguments","onChangeMoment","bind","nodeRef","onMonthPreviewedHandler","newMonthDate","props","onMonthPreviewed","toISOString","keepFocusInside","ownerDocument","activeElement","contains","focusRegion","querySelector","focus","newDate","currentDate","onChange","momentDate","momentTime","hours","minutes","seconds","set","getMomentDate","getEventsPerDay","filter","eventDay","isSame","date","render","isInvalidDate","toDate"],"mappings":";;;;;;;;;AAaA;;AAVA;;AACA;;AAIA;;AAMA;;AAdA;AACA;AACA;AAIA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA,MAAMA,mBAAmB,GAAG,qBAA5B;AACA,MAAMC,uBAAuB,GAAG,UAAhC;;AAEA,SAASC,aAAT,OAA+C;AAAA,MAAvB;AAAEC,IAAAA,GAAF;AAAOC,IAAAA,MAAM,GAAG;AAAhB,GAAuB;AAC9C,QAAMC,GAAG,GAAG,sBAAZ;AAEA;AACD;AACA;AACA;A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Aa,CAAEF,IAAI,CAACG,MAAL,EAAF,CAArC;AACA,OAnBF;AAoBC,MAAA,gBAAgB,EAAG,KAAK7B,uBApBzB;AAqBC,MAAA,gBAAgB,EAAG,KAAKA,uBArBzB;AAsBC,MAAA,iBAAiB,EAAKjB,GAAF,IACnB,4BAAC,aAAD;AACC,QAAA,GAAG,EAAGA,GADP;AAEC,QAAA,MAAM,EAAG,KAAKuC,eAAL,CAAsBvC,GAAtB;AAFV;AAvBF,MADD,CADD;AAiCA;;AA7HiC;;eAgIpBU,U","sourcesContent":["/**\n * External dependencies\n */\nimport moment from 'moment';\nimport classnames from 'classnames';\n\n// react-dates doesn't tree-shake correctly, so we import from the individual\n// component here, to avoid including too much of the library\nimport DayPickerSingleDateController from 'react-dates/lib/components/DayPickerSingleDateController';\n\n/**\n * WordPress dependencies\n */\nimport { Component, createRef, useEffect, useRef } from '@wordpress/element';\nimport { isRTL, _n, sprintf } from '@wordpress/i18n';\n\n/**\n * Module Constants\n */\nconst TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss';\nconst ARIAL_LABEL_TIME_FORMAT = 'dddd, LL';\n\nfunction DatePickerDay( { day, events = [] } ) {\n\tconst ref = useRef();\n\n\t/*\n\t * a11y hack to make the `There is/are n events` string\n\t * available speaking for readers,\n\t * re-defining the aria-label attribute.\n\t * This attribute is handled by the react-dates component.\n\t */\n\tuseEffect( () => {\n\t\t// Bail when no parent node.\n\t\tif ( ! ref?.current?.parentNode ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { parentNode } = ref.current;\n\t\tconst dayAriaLabel = moment( day ).format( ARIAL_LABEL_TIME_FORMAT );\n\n\t\tif ( ! events.length ) {\n\t\t\t// Set aria-label without event description.\n\t\t\tparentNode.setAttribute( 'aria-label', dayAriaLabel );\n\t\t\treturn;\n\t\t}\n\n\t\tconst dayWithEventsDescription = sprintf(\n\t\t\t// translators: 1: Calendar day format, 2: Calendar event number.\n\t\t\t_n(\n\t\t\t\t'%1$s. There is %2$d event.',\n\t\t\t\t'%1$s. There are %2$d events.',\n\t\t\t\tevents.length\n\t\t\t),\n\t\t\tdayAriaLabel,\n\t\t\tevents.length\n\t\t);\n\n\t\tparentNode.setAttribute( 'aria-label', dayWithEventsDescription );\n\t}, [ events.length ] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ classnames( 'components-datetime__date__day', {\n\t\t\t\t'has-events': events?.length,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ day.format( 'D' ) }\n\t\t</div>\n\t);\n}\n\nclass DatePicker extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.onChangeMoment = this.onChangeMoment.bind( this );\n\t\tthis.nodeRef = createRef();\n\t\tthis.onMonthPreviewedHandler = this.onMonthPreviewedHandler.bind(\n\t\t\tthis\n\t\t);\n\t}\n\n\tonMonthPreviewedHandler( newMonthDate ) {\n\t\tthis.props.onMonthPreviewed?.( newMonthDate.toISOString() );\n\t\tthis.keepFocusInside();\n\t}\n\n\t/*\n\t * Todo: We should remove this function ASAP.\n\t * It is kept because focus is lost when we click on the previous and next month buttons.\n\t * This focus loss closes the date picker popover.\n\t * Ideally we should add an upstream commit on react-dates to fix this issue.\n\t */\n\tkeepFocusInside() {\n\t\tif ( ! this.nodeRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = this.nodeRef.current;\n\t\tconst { activeElement } = ownerDocument;\n\n\t\t// If focus was lost.\n\t\tif (\n\t\t\t! activeElement ||\n\t\t\t! this.nodeRef.current.contains( ownerDocument.activeElement )\n\t\t) {\n\t\t\t// Retrieve the focus region div.\n\t\t\tconst focusRegion = this.nodeRef.current.querySelector(\n\t\t\t\t'.DayPicker_focusRegion'\n\t\t\t);\n\t\t\tif ( ! focusRegion ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Keep the focus on focus region.\n\t\t\tfocusRegion.focus();\n\t\t}\n\t}\n\n\tonChangeMoment( newDate ) {\n\t\tconst { currentDate, onChange } = this.props;\n\n\t\t// If currentDate is null, use now as momentTime to designate hours, minutes, seconds.\n\t\tconst momentDate = currentDate ? moment( currentDate ) : moment();\n\t\tconst momentTime = {\n\t\t\thours: momentDate.hours(),\n\t\t\tminutes: momentDate.minutes(),\n\t\t\tseconds: 0,\n\t\t};\n\n\t\tonChange( newDate.set( momentTime ).format( TIMEZONELESS_FORMAT ) );\n\n\t\t// Keep focus on the date picker.\n\t\tthis.keepFocusInside();\n\t}\n\n\t/**\n\t * Create a Moment object from a date string. With no currentDate supplied, default to a Moment\n\t * object representing now. If a null value is passed, return a null value.\n\t *\n\t * @param {?string} currentDate Date representing the currently selected date or null to signify no selection.\n\t * @return {?moment.Moment} Moment object for selected date or null.\n\t */\n\tgetMomentDate( currentDate ) {\n\t\tif ( null === currentDate ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn currentDate ? moment( currentDate ) : moment();\n\t}\n\n\tgetEventsPerDay( day ) {\n\t\tif ( ! this.props.events?.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn this.props.events.filter( ( eventDay ) =>\n\t\t\tday.isSame( eventDay.date, 'day' )\n\t\t);\n\t}\n\n\trender() {\n\t\tconst { currentDate, isInvalidDate } = this.props;\n\t\tconst momentDate = this.getMomentDate( currentDate );\n\n\t\treturn (\n\t\t\t<div className=\"components-datetime__date\" ref={ this.nodeRef }>\n\t\t\t\t<DayPickerSingleDateController\n\t\t\t\t\tdate={ momentDate }\n\t\t\t\t\tdaySize={ 30 }\n\t\t\t\t\tfocused\n\t\t\t\t\thideKeyboardShortcutsPanel\n\t\t\t\t\t// This is a hack to force the calendar to update on month or year change\n\t\t\t\t\t// https://github.com/airbnb/react-dates/issues/240#issuecomment-361776665\n\t\t\t\t\tkey={ `datepicker-controller-${\n\t\t\t\t\t\tmomentDate ? momentDate.format( 'MM-YYYY' ) : 'null'\n\t\t\t\t\t}` }\n\t\t\t\t\tnoBorder\n\t\t\t\t\tnumberOfMonths={ 1 }\n\t\t\t\t\tonDateChange={ this.onChangeMoment }\n\t\t\t\t\ttransitionDuration={ 0 }\n\t\t\t\t\tweekDayFormat=\"ddd\"\n\t\t\t\t\tdayAriaLabelFormat={ ARIAL_LABEL_TIME_FORMAT }\n\t\t\t\t\tisRTL={ isRTL() }\n\t\t\t\t\tisOutsideRange={ ( date ) => {\n\t\t\t\t\t\treturn isInvalidDate && isInvalidDate( date.toDate() );\n\t\t\t\t\t} }\n\t\t\t\t\tonPrevMonthClick={ this.onMonthPreviewedHandler }\n\t\t\t\t\tonNextMonthClick={ this.onMonthPreviewedHandler }\n\t\t\t\t\trenderDayContents={ ( day ) => (\n\t\t\t\t\t\t<DatePickerDay\n\t\t\t\t\t\t\tday={ day }\n\t\t\t\t\t\t\tevents={ this.getEventsPerDay( day ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default DatePicker;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/date-time/date.js"],"names":["TIMEZONELESS_FORMAT","ARIAL_LABEL_TIME_FORMAT","DatePickerDay","day","events","ref","current","parentNode","dayAriaLabel","format","length","setAttribute","dayWithEventsDescription","DatePicker","currentDate","onChange","isInvalidDate","onMonthPreviewed","nodeRef","onMonthPreviewedHandler","newMonthDate","toISOString","keepFocusInside","ownerDocument","activeElement","contains","focusRegion","querySelector","focus","onChangeMoment","newDate","momentDate","momentTime","hours","minutes","seconds","set","getEventsPerDay","filter","eventDay","isSame","date","toDate"],"mappings":";;;;;;;;;AAaA;;AAVA;;AACA;;AAIA;;AAMA;;AAKA;;AAnBA;AACA;AACA;AAIA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA,MAAMA,mBAAmB,GAAG,qBAA5B;AACA,MAAMC,uBAAuB,GAAG,UAAhC;;AAEA,SAASC,aAAT,OAA+C;AAAA,MAAvB;AAAEC,IAAAA,GAAF;AAAOC,IAA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O,EAAP;AACA;;AAED,WAAON,MAAM,CAACkC,MAAP,CAAiBC,QAAF,IACrBpC,GAAG,CAACqC,MAAJ,CAAYD,QAAQ,CAACE,IAArB,EAA2B,KAA3B,CADM,CAAP;AAGA,GARD;;AAUA,QAAMV,UAAU,GAAG,0BAAejB,WAAf,CAAnB;AAEA,SACC;AAAK,IAAA,SAAS,EAAC,2BAAf;AAA2C,IAAA,GAAG,EAAGI;AAAjD,KACC,4BAAC,sCAAD;AACC,IAAA,IAAI,EAAGa,UADR;AAEC,IAAA,OAAO,EAAG,EAFX;AAGC,IAAA,OAAO,MAHR;AAIC,IAAA,0BAA0B,MAJ3B,CAKC;AACA;AAND;AAOC,IAAA,GAAG,EAAI,yBACNA,UAAU,GAAGA,UAAU,CAACtB,MAAX,CAAmB,SAAnB,CAAH,GAAoC,MAC9C,EATF;AAUC,IAAA,QAAQ,MAVT;AAWC,IAAA,cAAc,EAAG,CAXlB;AAYC,IAAA,YAAY,EAAGoB,cAZhB;AAaC,IAAA,kBAAkB,EAAG,CAbtB;AAcC,IAAA,aAAa,EAAC,KAdf;AAeC,IAAA,kBAAkB,EAAG5B,uBAftB;AAgBC,IAAA,KAAK,EAAG,kBAhBT;AAiBC,IAAA,cAAc,EAAKwC,IAAF,IAAY;AAC5B,aAAOzB,aAAa,IAAIA,aAAa,CAAEyB,IAAI,CAACC,MAAL,EAAF,CAArC;AACA,KAnBF;AAoBC,IAAA,gBAAgB,EAAGvB,uBApBpB;AAqBC,IAAA,gBAAgB,EAAGA,uBArBpB;AAsBC,IAAA,iBAAiB,EAAKhB,GAAF,IACnB,4BAAC,aAAD;AACC,MAAA,GAAG,EAAGA,GADP;AAEC,MAAA,MAAM,EAAGkC,eAAe,CAAElC,GAAF;AAFzB;AAvBF,IADD,CADD;AAiCA;;eAEcU,U","sourcesContent":["/**\n * External dependencies\n */\nimport moment from 'moment';\nimport classnames from 'classnames';\n\n// react-dates doesn't tree-shake correctly, so we import from the individual\n// component here, to avoid including too much of the library\nimport DayPickerSingleDateController from 'react-dates/lib/components/DayPickerSingleDateController';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { isRTL, _n, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getMomentDate } from './utils';\n\n/**\n * Module Constants\n */\nconst TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss';\nconst ARIAL_LABEL_TIME_FORMAT = 'dddd, LL';\n\nfunction DatePickerDay( { day, events = [] } ) {\n\tconst ref = useRef();\n\n\t/*\n\t * a11y hack to make the `There is/are n events` string\n\t * available speaking for readers,\n\t * re-defining the aria-label attribute.\n\t * This attribute is handled by the react-dates component.\n\t */\n\tuseEffect( () => {\n\t\t// Bail when no parent node.\n\t\tif ( ! ref?.current?.parentNode ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { parentNode } = ref.current;\n\t\tconst dayAriaLabel = moment( day ).format( ARIAL_LABEL_TIME_FORMAT );\n\n\t\tif ( ! events.length ) {\n\t\t\t// Set aria-label without event description.\n\t\t\tparentNode.setAttribute( 'aria-label', dayAriaLabel );\n\t\t\treturn;\n\t\t}\n\n\t\tconst dayWithEventsDescription = sprintf(\n\t\t\t// translators: 1: Calendar day format, 2: Calendar event number.\n\t\t\t_n(\n\t\t\t\t'%1$s. There is %2$d event.',\n\t\t\t\t'%1$s. There are %2$d events.',\n\t\t\t\tevents.length\n\t\t\t),\n\t\t\tdayAriaLabel,\n\t\t\tevents.length\n\t\t);\n\n\t\tparentNode.setAttribute( 'aria-label', dayWithEventsDescription );\n\t}, [ events.length ] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ classnames( 'components-datetime__date__day', {\n\t\t\t\t'has-events': events?.length,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ day.format( 'D' ) }\n\t\t</div>\n\t);\n}\n\nfunction DatePicker( {\n\tcurrentDate,\n\tonChange,\n\tevents,\n\tisInvalidDate,\n\tonMonthPreviewed,\n} ) {\n\tconst nodeRef = useRef();\n\tconst onMonthPreviewedHandler = ( newMonthDate ) => {\n\t\tonMonthPreviewed?.( newMonthDate.toISOString() );\n\t\tkeepFocusInside();\n\t};\n\n\t/*\n\t * Todo: We should remove this function ASAP.\n\t * It is kept because focus is lost when we click on the previous and next month buttons.\n\t * This focus loss closes the date picker popover.\n\t * Ideally we should add an upstream commit on react-dates to fix this issue.\n\t */\n\tconst keepFocusInside = () => {\n\t\tif ( ! nodeRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = nodeRef.current;\n\t\tconst { activeElement } = ownerDocument;\n\n\t\t// If focus was lost.\n\t\tif (\n\t\t\t! activeElement ||\n\t\t\t! nodeRef.current.contains( ownerDocument.activeElement )\n\t\t) {\n\t\t\t// Retrieve the focus region div.\n\t\t\tconst focusRegion = nodeRef.current.querySelector(\n\t\t\t\t'.DayPicker_focusRegion'\n\t\t\t);\n\t\t\tif ( ! focusRegion ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Keep the focus on focus region.\n\t\t\tfocusRegion.focus();\n\t\t}\n\t};\n\n\tconst onChangeMoment = ( newDate ) => {\n\t\t// If currentDate is null, use now as momentTime to designate hours, minutes, seconds.\n\t\tconst momentDate = currentDate ? moment( currentDate ) : moment();\n\t\tconst momentTime = {\n\t\t\thours: momentDate.hours(),\n\t\t\tminutes: momentDate.minutes(),\n\t\t\tseconds: 0,\n\t\t};\n\n\t\tonChange( newDate.set( momentTime ).format( TIMEZONELESS_FORMAT ) );\n\n\t\t// Keep focus on the date picker.\n\t\tkeepFocusInside();\n\t};\n\n\tconst getEventsPerDay = ( day ) => {\n\t\tif ( ! events?.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn events.filter( ( eventDay ) =>\n\t\t\tday.isSame( eventDay.date, 'day' )\n\t\t);\n\t};\n\n\tconst momentDate = getMomentDate( currentDate );\n\n\treturn (\n\t\t<div className=\"components-datetime__date\" ref={ nodeRef }>\n\t\t\t<DayPickerSingleDateController\n\t\t\t\tdate={ momentDate }\n\t\t\t\tdaySize={ 30 }\n\t\t\t\tfocused\n\t\t\t\thideKeyboardShortcutsPanel\n\t\t\t\t// This is a hack to force the calendar to update on month or year change\n\t\t\t\t// https://github.com/airbnb/react-dates/issues/240#issuecomment-361776665\n\t\t\t\tkey={ `datepicker-controller-${\n\t\t\t\t\tmomentDate ? momentDate.format( 'MM-YYYY' ) : 'null'\n\t\t\t\t}` }\n\t\t\t\tnoBorder\n\t\t\t\tnumberOfMonths={ 1 }\n\t\t\t\tonDateChange={ onChangeMoment }\n\t\t\t\ttransitionDuration={ 0 }\n\t\t\t\tweekDayFormat=\"ddd\"\n\t\t\t\tdayAriaLabelFormat={ ARIAL_LABEL_TIME_FORMAT }\n\t\t\t\tisRTL={ isRTL() }\n\t\t\t\tisOutsideRange={ ( date ) => {\n\t\t\t\t\treturn isInvalidDate && isInvalidDate( date.toDate() );\n\t\t\t\t} }\n\t\t\t\tonPrevMonthClick={ onMonthPreviewedHandler }\n\t\t\t\tonNextMonthClick={ onMonthPreviewedHandler }\n\t\t\t\trenderDayContents={ ( day ) => (\n\t\t\t\t\t<DatePickerDay\n\t\t\t\t\t\tday={ day }\n\t\t\t\t\t\tevents={ getEventsPerDay( day ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default DatePicker;\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.getMomentDate = void 0;
|
|
9
|
+
|
|
10
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* External dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Create a Moment object from a date string. With no date supplied, default to a Moment
|
|
18
|
+
* object representing now. If a null value is passed, return a null value.
|
|
19
|
+
*
|
|
20
|
+
* @param {?string} date Date representing the currently selected date or null to signify no selection.
|
|
21
|
+
* @return {?moment.Moment} Moment object for selected date or null.
|
|
22
|
+
*/
|
|
23
|
+
const getMomentDate = date => {
|
|
24
|
+
if (null === date) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return date ? (0, _moment.default)(date) : (0, _moment.default)();
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.getMomentDate = getMomentDate;
|
|
32
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/date-time/utils.js"],"names":["getMomentDate","date"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GAAKC,IAAF,IAAY;AACxC,MAAK,SAASA,IAAd,EAAqB;AACpB,WAAO,IAAP;AACA;;AACD,SAAOA,IAAI,GAAG,qBAAQA,IAAR,CAAH,GAAoB,sBAA/B;AACA,CALM","sourcesContent":["/**\n * External dependencies\n */\nimport moment from 'moment';\n\n/**\n * Create a Moment object from a date string. With no date supplied, default to a Moment\n * object representing now. If a null value is passed, return a null value.\n *\n * @param {?string} date Date representing the currently selected date or null to signify no selection.\n * @return {?moment.Moment} Moment object for selected date or null.\n */\nexport const getMomentDate = ( date ) => {\n\tif ( null === date ) {\n\t\treturn null;\n\t}\n\treturn date ? moment( date ) : moment();\n};\n"]}
|
|
@@ -39,17 +39,18 @@ function Divider(props, forwardedRef) {
|
|
|
39
39
|
* @example
|
|
40
40
|
* ```js
|
|
41
41
|
* import {
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* __experimentalDivider as Divider,
|
|
43
|
+
* __experimentalText as Text,
|
|
44
|
+
* __experimentalVStack as VStack,
|
|
45
|
+
* } from `@wordpress/components`;
|
|
45
46
|
*
|
|
46
47
|
* function Example() {
|
|
47
48
|
* return (
|
|
48
|
-
* <
|
|
49
|
-
* <
|
|
49
|
+
* <VStack spacing={4}>
|
|
50
|
+
* <Text>Some text here</Text>
|
|
50
51
|
* <Divider />
|
|
51
|
-
* <
|
|
52
|
-
* </
|
|
52
|
+
* <Text>Some more text here</Text>
|
|
53
|
+
* </VStack>
|
|
53
54
|
* );
|
|
54
55
|
* }
|
|
55
56
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/divider/component.tsx"],"names":["Divider","props","forwardedRef","contextProps","DividerView","ConnectedDivider"],"mappings":";;;;;;;;;;;;;AAIA;;AAOA;;AAKA;;AAhBA;AACA;AACA;AACA;;AAKA;AACA;AACA;AASA,SAASA,OAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,YAAY,GAAG,+BAAkBF,KAAlB,EAAyB,SAAzB,CAArB;AAEA,SACC,4BAAC,iBAAD;AACC,IAAA,EAAE,EAAGG;AADN,KAEMD,YAFN;AAGC,IAAA,GAAG,EAAGD;AAHP,KADD;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,gBAAgB,GAAG,6BAAgBL,OAAhB,EAAyB,SAAzB,CAAzB;eAEeK,gB","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport { Separator } from 'reakit';\n// eslint-disable-next-line no-restricted-imports\nimport type { Ref } from 'react';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../ui/context';\nimport { DividerView } from './styles';\nimport type { Props } from './types';\n\nfunction Divider(\n\tprops: WordPressComponentProps< Props, 'hr', false >,\n\tforwardedRef: Ref< any >\n) {\n\tconst contextProps = useContextSystem( props, 'Divider' );\n\n\treturn (\n\t\t<Separator\n\t\t\tas={ DividerView }\n\t\t\t{ ...contextProps }\n\t\t\tref={ forwardedRef }\n\t\t/>\n\t);\n}\n\n/**\n * `Divider` is a layout component that separates groups of related content.\n *\n * @example\n * ```js\n * import {\n *
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/divider/component.tsx"],"names":["Divider","props","forwardedRef","contextProps","DividerView","ConnectedDivider"],"mappings":";;;;;;;;;;;;;AAIA;;AAOA;;AAKA;;AAhBA;AACA;AACA;AACA;;AAKA;AACA;AACA;AASA,SAASA,OAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,YAAY,GAAG,+BAAkBF,KAAlB,EAAyB,SAAzB,CAArB;AAEA,SACC,4BAAC,iBAAD;AACC,IAAA,EAAE,EAAGG;AADN,KAEMD,YAFN;AAGC,IAAA,GAAG,EAAGD;AAHP,KADD;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,gBAAgB,GAAG,6BAAgBL,OAAhB,EAAyB,SAAzB,CAAzB;eAEeK,gB","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport { Separator } from 'reakit';\n// eslint-disable-next-line no-restricted-imports\nimport type { Ref } from 'react';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../ui/context';\nimport { DividerView } from './styles';\nimport type { Props } from './types';\n\nfunction Divider(\n\tprops: WordPressComponentProps< Props, 'hr', false >,\n\tforwardedRef: Ref< any >\n) {\n\tconst contextProps = useContextSystem( props, 'Divider' );\n\n\treturn (\n\t\t<Separator\n\t\t\tas={ DividerView }\n\t\t\t{ ...contextProps }\n\t\t\tref={ forwardedRef }\n\t\t/>\n\t);\n}\n\n/**\n * `Divider` is a layout component that separates groups of related content.\n *\n * @example\n * ```js\n * import {\n * \t\t__experimentalDivider as Divider,\n * \t\t__experimentalText as Text,\n * \t\t__experimentalVStack as VStack,\n * } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<VStack spacing={4}>\n * \t\t\t<Text>Some text here</Text>\n * \t\t\t<Divider />\n * \t\t\t<Text>Some more text here</Text>\n * \t\t</VStack>\n * \t);\n * }\n * ```\n */\nconst ConnectedDivider = contextConnect( Divider, 'Divider' );\n\nexport default ConnectedDivider;\n"]}
|
package/build/divider/styles.js
CHANGED
|
@@ -13,7 +13,7 @@ var _react = require("@emotion/react");
|
|
|
13
13
|
|
|
14
14
|
var _space = require("../ui/utils/space");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _utils = require("../utils");
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* External dependencies
|
|
@@ -22,24 +22,49 @@ var _configValues = _interopRequireDefault(require("../utils/config-values"));
|
|
|
22
22
|
/**
|
|
23
23
|
* Internal dependencies
|
|
24
24
|
*/
|
|
25
|
+
const MARGIN_DIRECTIONS = {
|
|
26
|
+
vertical: {
|
|
27
|
+
start: 'marginLeft',
|
|
28
|
+
end: 'marginRight'
|
|
29
|
+
},
|
|
30
|
+
horizontal: {
|
|
31
|
+
start: 'marginTop',
|
|
32
|
+
end: 'marginBottom'
|
|
33
|
+
}
|
|
34
|
+
}; // Renders the correct margins given the Divider's `orientation` and the writing direction.
|
|
35
|
+
// When both the generic `margin` and the specific `marginStart|marginEnd` props are defined,
|
|
36
|
+
// the latter will take priority.
|
|
37
|
+
|
|
25
38
|
const renderMargin = _ref => {
|
|
26
39
|
let {
|
|
40
|
+
'aria-orientation': orientation = 'horizontal',
|
|
27
41
|
margin,
|
|
28
|
-
|
|
29
|
-
|
|
42
|
+
marginStart,
|
|
43
|
+
marginEnd
|
|
30
44
|
} = _ref;
|
|
45
|
+
return /*#__PURE__*/(0, _react.css)((0, _utils.rtl)({
|
|
46
|
+
[MARGIN_DIRECTIONS[orientation].start]: (0, _space.space)(marginStart !== null && marginStart !== void 0 ? marginStart : margin),
|
|
47
|
+
[MARGIN_DIRECTIONS[orientation].end]: (0, _space.space)(marginEnd !== null && marginEnd !== void 0 ? marginEnd : margin)
|
|
48
|
+
})(), process.env.NODE_ENV === "production" ? "" : ";label:renderMargin;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGl2aWRlci9zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBb0NDIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGl2aWRlci9zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IHNwYWNlIH0gZnJvbSAnLi4vdWkvdXRpbHMvc3BhY2UnO1xuaW1wb3J0IHsgcnRsIH0gZnJvbSAnLi4vdXRpbHMnO1xuaW1wb3J0IHR5cGUgeyBQcm9wcyB9IGZyb20gJy4vdHlwZXMnO1xuXG5jb25zdCBNQVJHSU5fRElSRUNUSU9OUzogUmVjb3JkPFxuXHROb25OdWxsYWJsZTwgUHJvcHNbICdvcmllbnRhdGlvbicgXSA+LFxuXHRSZWNvcmQ8ICdzdGFydCcgfCAnZW5kJywgc3RyaW5nID5cbj4gPSB7XG5cdHZlcnRpY2FsOiB7XG5cdFx0c3RhcnQ6ICdtYXJnaW5MZWZ0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Y3NzKCB7XG5cdFx0WyBvcmllbnRhdGlvbiA9PT0gJ3ZlcnRpY2FsJ1xuXHRcdFx0PyAnYm9yZGVyUmlnaHQnXG5cdFx0XHQ6ICdib3JkZXJCb3R0b20nIF06ICcxcHggc29saWQgY3VycmVudENvbG9yJyxcblx0fSApO1xufTtcblxuY29uc3QgcmVuZGVyU2l6ZSA9ICgge1xuXHQnYXJpYS1vcmllbnRhdGlvbic6IG9yaWVudGF0aW9uID0gJ2hvcml6b250YWwnLFxufTogUHJvcHMgKSA9PlxuXHRjc3MoIHtcblx0XHRoZWlnaHQ6IG9yaWVudGF0aW9uID09PSAndmVydGljYWwnID8gJ2F1dG8nIDogMCxcblx0XHR3aWR0aDogb3JpZW50YXRpb24gPT09ICd2ZXJ0aWNhbCcgPyAwIDogJ2F1dG8nLFxuXHR9ICk7XG5cbmV4cG9ydCBjb25zdCBEaXZpZGVyVmlldyA9IHN0eWxlZC5ocjwgUHJvcHMgPmBcblx0Ym9yZGVyOiAwO1xuXHRtYXJnaW46IDA7XG5cblx0JHsgcmVuZGVyQm9yZGVyIH1cblx0JHsgcmVuZGVyU2l6ZSB9XG5cdCR7IHJlbmRlck1hcmdpbiB9XG5gO1xuIl19 */");
|
|
49
|
+
};
|
|
31
50
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
51
|
+
const renderBorder = _ref2 => {
|
|
52
|
+
let {
|
|
53
|
+
'aria-orientation': orientation = 'horizontal'
|
|
54
|
+
} = _ref2;
|
|
55
|
+
return /*#__PURE__*/(0, _react.css)({
|
|
56
|
+
[orientation === 'vertical' ? 'borderRight' : 'borderBottom']: '1px solid currentColor'
|
|
57
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:renderBorder;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29t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IG9yaWVudGF0aW9uID09PSAndmVydGljYWwnID8gJ2F1dG8nIDogMCxcblx0XHR3aWR0aDogb3JpZW50YXRpb24gPT09ICd2ZXJ0aWNhbCcgPyAwIDogJ2F1dG8nLFxuXHR9ICk7XG5cbmV4cG9ydCBjb25zdCBEaXZpZGVyVmlldyA9IHN0eWxlZC5ocjwgUHJvcHMgPmBcblx0Ym9yZGVyOiAwO1xuXHRtYXJnaW46IDA7XG5cblx0JHsgcmVuZGVyQm9yZGVyIH1cblx0JHsgcmVuZGVyU2l6ZSB9XG5cdCR7IHJlbmRlck1hcmdpbiB9XG5gO1xuIl19 */");
|
|
58
|
+
};
|
|
38
59
|
|
|
60
|
+
const renderSize = _ref3 => {
|
|
61
|
+
let {
|
|
62
|
+
'aria-orientation': orientation = 'horizontal'
|
|
63
|
+
} = _ref3;
|
|
39
64
|
return /*#__PURE__*/(0, _react.css)({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, process.env.NODE_ENV === "production" ? "" : ";label:
|
|
65
|
+
height: orientation === 'vertical' ? 'auto' : 0,
|
|
66
|
+
width: orientation === 'vertical' ? 0 : 'auto'
|
|
67
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:renderSize;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGl2aWRlci9zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBNERDIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGl2aWRlci9zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1v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bmRlck1hcmdpbiB9XG5gO1xuIl19 */");
|
|
43
68
|
};
|
|
44
69
|
|
|
45
70
|
const DividerView = (0, _base.default)("hr", process.env.NODE_ENV === "production" ? {
|
|
@@ -47,6 +72,6 @@ const DividerView = (0, _base.default)("hr", process.env.NODE_ENV === "productio
|
|
|
47
72
|
} : {
|
|
48
73
|
target: "e19on6iw0",
|
|
49
74
|
label: "DividerView"
|
|
50
|
-
})("border
|
|
75
|
+
})("border:0;margin:0;", renderBorder, " ", renderSize, " ", renderMargin, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGl2aWRlci9zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBaUU2QyIsImZpbGUiOiJAd29yZHByZXNzL2NvbXBvbmVudHMvc3JjL2RpdmlkZXIvc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIEludGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyBzcGFjZSB9IGZyb20gJy4uL3VpL3V0aWxzL3NwYWNlJztcbmltcG9ydCB7IHJ0bCB9IGZyb20gJy4uL3V0aWxzJztcbmltcG9ydCB0eXBlIHsgUHJvcHMgfSBmcm9tICcuL3R5cGVzJztcblxuY29uc3QgTUFSR0lOX0RJUkVDVElPTlM6IFJlY29yZDxcblx0Tm9uTnVsbGFibGU8IFByb3BzWyAnb3JpZW50YXRpb24nIF0gPixcblx0UmVjb3JkPCAnc3RhcnQnIHwgJ2VuZCcsIHN0cmluZ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0aW9uJzogb3JpZW50YXRpb24gPSAnaG9yaXpvbnRhbCcsXG59OiBQcm9wcyApID0+IHtcblx0cmV0dXJuIGNzcygge1xuXHRcdFsgb3JpZW50YXRpb24gPT09ICd2ZXJ0aWNhbCdcblx0XHRcdD8gJ2JvcmRlclJpZ2h0J1xuXHRcdFx0OiAnYm9yZGVyQm90dG9tJyBdOiAnMXB4IHNvbGlkIGN1cnJlbnRDb2xvcicsXG5cdH0gKTtcbn07XG5cbmNvbnN0IHJlbmRlclNpemUgPSAoIHtcblx0J2FyaWEtb3JpZW50YXRpb24nOiBvcmllbnRhdGlvbiA9ICdob3Jpem9udGFsJyxcbn06IFByb3BzICkgPT5cblx0Y3NzKCB7XG5cdFx0aGVpZ2h0OiBvcmllbnRhdGlvbiA9PT0gJ3ZlcnRpY2FsJyA/ICdhdXRvJyA6IDAsXG5cdFx0d2lkdGg6IG9yaWVudGF0aW9uID09PSAndmVydGljYWwnID8gMCA6ICdhdXRvJyxcblx0fSApO1xuXG5leHBvcnQgY29uc3QgRGl2aWRlclZpZXcgPSBzdHlsZWQuaHI8IFByb3BzID5gXG5cdGJvcmRlcjogMDtcblx0bWFyZ2luOiAwO1xuXG5cdCR7IHJlbmRlckJvcmRlciB9XG5cdCR7IHJlbmRlclNpemUgfVxuXHQkeyByZW5kZXJNYXJnaW4gfVxuYDtcbiJdfQ== */"));
|
|
51
76
|
exports.DividerView = DividerView;
|
|
52
77
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/divider/styles.ts"],"names":["renderMargin","margin","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/divider/styles.ts"],"names":["MARGIN_DIRECTIONS","vertical","start","end","horizontal","renderMargin","orientation","margin","marginStart","marginEnd","renderBorder","renderSize","height","width","DividerView"],"mappings":";;;;;;;;;;;AAIA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAKA,MAAMA,iBAG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AKpBC,UALoB,OAMpBN,YANoB,ymFAAjB","sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\nimport { css } from '@emotion/react';\n\n/**\n * Internal dependencies\n */\nimport { space } from '../ui/utils/space';\nimport { rtl } from '../utils';\nimport type { Props } from './types';\n\nconst MARGIN_DIRECTIONS: Record<\n\tNonNullable< Props[ 'orientation' ] >,\n\tRecord< 'start' | 'end', string >\n> = {\n\tvertical: {\n\t\tstart: 'marginLeft',\n\t\tend: 'marginRight',\n\t},\n\thorizontal: {\n\t\tstart: 'marginTop',\n\t\tend: 'marginBottom',\n\t},\n};\n\n// Renders the correct margins given the Divider's `orientation` and the writing direction.\n// When both the generic `margin` and the specific `marginStart|marginEnd` props are defined,\n// the latter will take priority.\nconst renderMargin = ( {\n\t'aria-orientation': orientation = 'horizontal',\n\tmargin,\n\tmarginStart,\n\tmarginEnd,\n}: Props ) =>\n\tcss(\n\t\trtl( {\n\t\t\t[ MARGIN_DIRECTIONS[ orientation ].start ]: space(\n\t\t\t\tmarginStart ?? margin\n\t\t\t),\n\t\t\t[ MARGIN_DIRECTIONS[ orientation ].end ]: space(\n\t\t\t\tmarginEnd ?? margin\n\t\t\t),\n\t\t} )()\n\t);\n\nconst renderBorder = ( {\n\t'aria-orientation': orientation = 'horizontal',\n}: Props ) => {\n\treturn css( {\n\t\t[ orientation === 'vertical'\n\t\t\t? 'borderRight'\n\t\t\t: 'borderBottom' ]: '1px solid currentColor',\n\t} );\n};\n\nconst renderSize = ( {\n\t'aria-orientation': orientation = 'horizontal',\n}: Props ) =>\n\tcss( {\n\t\theight: orientation === 'vertical' ? 'auto' : 0,\n\t\twidth: orientation === 'vertical' ? 0 : 'auto',\n\t} );\n\nexport const DividerView = styled.hr< Props >`\n\tborder: 0;\n\tmargin: 0;\n\n\t${ renderBorder }\n\t${ renderSize }\n\t${ renderMargin }\n`;\n"]}
|
package/build/drop-zone/index.js
CHANGED
|
@@ -49,11 +49,15 @@ function DropZoneComponent(_ref) {
|
|
|
49
49
|
onDrop(event) {
|
|
50
50
|
const files = (0, _dom.getFilesFromDataTransfer)(event.dataTransfer);
|
|
51
51
|
const html = event.dataTransfer.getData('text/html');
|
|
52
|
+
/**
|
|
53
|
+
* From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
|
|
54
|
+
* The order of the checks is important to recognise the HTML drop.
|
|
55
|
+
*/
|
|
52
56
|
|
|
53
|
-
if (
|
|
54
|
-
onFilesDrop(files);
|
|
55
|
-
} else if (html && onHTMLDrop) {
|
|
57
|
+
if (html && onHTMLDrop) {
|
|
56
58
|
onHTMLDrop(html);
|
|
59
|
+
} else if (files.length && onFilesDrop) {
|
|
60
|
+
onFilesDrop(files);
|
|
57
61
|
} else if (onDrop) {
|
|
58
62
|
onDrop(event);
|
|
59
63
|
}
|
|
@@ -62,13 +66,17 @@ function DropZoneComponent(_ref) {
|
|
|
62
66
|
onDragStart(event) {
|
|
63
67
|
setIsDraggingOverDocument(true);
|
|
64
68
|
let _type = 'default';
|
|
69
|
+
/**
|
|
70
|
+
* From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
|
|
71
|
+
* The order of the checks is important to recognise the HTML drop.
|
|
72
|
+
*/
|
|
65
73
|
|
|
66
|
-
if (
|
|
74
|
+
if ((0, _lodash.includes)(event.dataTransfer.types, 'text/html')) {
|
|
75
|
+
_type = 'html';
|
|
76
|
+
} else if ( // Check for the types because sometimes the files themselves
|
|
67
77
|
// are only available on drop.
|
|
68
78
|
(0, _lodash.includes)(event.dataTransfer.types, 'Files') || (0, _dom.getFilesFromDataTransfer)(event.dataTransfer).length > 0) {
|
|
69
79
|
_type = 'file';
|
|
70
|
-
} else if ((0, _lodash.includes)(event.dataTransfer.types, 'text/html')) {
|
|
71
|
-
_type = 'html';
|
|
72
80
|
}
|
|
73
81
|
|
|
74
82
|
setType(_type);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/drop-zone/index.js"],"names":["DropZoneComponent","className","label","onFilesDrop","onHTMLDrop","onDrop","isDraggingOverDocument","setIsDraggingOverDocument","isDraggingOverElement","setIsDraggingOverElement","type","setType","ref","event","files","dataTransfer","html","getData","length","onDragStart","_type","types","onDragEnd","onDragEnter","onDragLeave","disableMotion","children","backdrop","hidden","scaleY","opacity","show","transition","duration","delay","delayChildren","exit","foreground","scale","upload","classes"],"mappings":";;;;;;;;;AAUA;;AAPA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AAQA;;AArBA;AACA;AACA;;AAIA;AACA;AACA;;AAUA;AACA;AACA;AAMe,SAASA,iBAAT,OAMX;AAAA,MANuC;AAC1CC,IAAAA,SAD0C;AAE1CC,IAAAA,KAF0C;AAG1CC,IAAAA,WAH0C;AAI1CC,IAAAA,UAJ0C;AAK1CC,IAAAA;AAL0C,GAMvC;AACH,QAAM,CAAEC,sBAAF,EAA0BC,yBAA1B,IAAwD,wBAA9D;AACA,QAAM,CAAEC,qBAAF,EAAyBC,wBAAzB,IAAsD,wBAA5D;AACA,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,wBAA1B;AACA,QAAMC,GAAG,GAAG,wCAAa;AACxBP,IAAAA,MAAM,CAAEQ,KAAF,EAAU;AACf,YAAMC,KAAK,GAAG,mCAA0BD,KAAK,CAACE,YAAhC,CAAd;AACA,YAAMC,IAAI,GAAGH,KAAK,CAACE,YAAN,CAAmBE,OAAnB,CAA4B,WAA5B,CAAb;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/drop-zone/index.js"],"names":["DropZoneComponent","className","label","onFilesDrop","onHTMLDrop","onDrop","isDraggingOverDocument","setIsDraggingOverDocument","isDraggingOverElement","setIsDraggingOverElement","type","setType","ref","event","files","dataTransfer","html","getData","length","onDragStart","_type","types","onDragEnd","onDragEnter","onDragLeave","disableMotion","children","backdrop","hidden","scaleY","opacity","show","transition","duration","delay","delayChildren","exit","foreground","scale","upload","classes"],"mappings":";;;;;;;;;AAUA;;AAPA;;AACA;;AAKA;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CAAD,QAAmBA,QAAnB,CAJF,CADD;AASA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { upload, Icon } from '@wordpress/icons';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\nimport {\n\t__experimentalUseDropZone as useDropZone,\n\tuseReducedMotion,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '../animation';\n\nexport default function DropZoneComponent( {\n\tclassName,\n\tlabel,\n\tonFilesDrop,\n\tonHTMLDrop,\n\tonDrop,\n} ) {\n\tconst [ isDraggingOverDocument, setIsDraggingOverDocument ] = useState();\n\tconst [ isDraggingOverElement, setIsDraggingOverElement ] = useState();\n\tconst [ type, setType ] = useState();\n\tconst ref = useDropZone( {\n\t\tonDrop( event ) {\n\t\t\tconst files = getFilesFromDataTransfer( event.dataTransfer );\n\t\t\tconst html = event.dataTransfer.getData( 'text/html' );\n\n\t\t\t/**\n\t\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t\t */\n\t\t\tif ( html && onHTMLDrop ) {\n\t\t\t\tonHTMLDrop( html );\n\t\t\t} else if ( files.length && onFilesDrop ) {\n\t\t\t\tonFilesDrop( files );\n\t\t\t} else if ( onDrop ) {\n\t\t\t\tonDrop( event );\n\t\t\t}\n\t\t},\n\t\tonDragStart( event ) {\n\t\t\tsetIsDraggingOverDocument( true );\n\n\t\t\tlet _type = 'default';\n\n\t\t\t/**\n\t\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t\t */\n\t\t\tif ( includes( event.dataTransfer.types, 'text/html' ) ) {\n\t\t\t\t_type = 'html';\n\t\t\t} else if (\n\t\t\t\t// Check for the types because sometimes the files themselves\n\t\t\t\t// are only available on drop.\n\t\t\t\tincludes( event.dataTransfer.types, 'Files' ) ||\n\t\t\t\tgetFilesFromDataTransfer( event.dataTransfer ).length > 0\n\t\t\t) {\n\t\t\t\t_type = 'file';\n\t\t\t}\n\n\t\t\tsetType( _type );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tsetIsDraggingOverDocument( false );\n\t\t\tsetType();\n\t\t},\n\t\tonDragEnter() {\n\t\t\tsetIsDraggingOverElement( true );\n\t\t},\n\t\tonDragLeave() {\n\t\t\tsetIsDraggingOverElement( false );\n\t\t},\n\t} );\n\tconst disableMotion = useReducedMotion();\n\n\tlet children;\n\n\tconst backdrop = {\n\t\thidden: { scaleY: 0, opacity: 0 },\n\t\tshow: {\n\t\t\tscaleY: 1,\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: 0.2,\n\t\t\t\tdelay: 0.1,\n\t\t\t\tdelayChildren: 0.2,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\tscaleY: 1,\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.3,\n\t\t\t\tdelayChildren: 0,\n\t\t\t},\n\t\t},\n\t};\n\n\tconst foreground = {\n\t\thidden: { opacity: 0, scale: 0.75 },\n\t\tshow: { opacity: 1, scale: 1 },\n\t\texit: { opacity: 0, scale: 0.9 },\n\t};\n\n\tif ( isDraggingOverElement ) {\n\t\tchildren = (\n\t\t\t<motion.div\n\t\t\t\tvariants={ backdrop }\n\t\t\t\tinitial={ disableMotion ? 'show' : 'hidden' }\n\t\t\t\tanimate=\"show\"\n\t\t\t\texit={ disableMotion ? 'show' : 'exit' }\n\t\t\t\tclassName=\"components-drop-zone__content\"\n\t\t\t>\n\t\t\t\t<motion.div variants={ foreground }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\tclassName=\"components-drop-zone__content-icon\"\n\t\t\t\t\t/>\n\t\t\t\t\t<span className=\"components-drop-zone__content-text\">\n\t\t\t\t\t\t{ label ? label : __( 'Drop files to upload' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t);\n\t}\n\n\tconst classes = classnames( 'components-drop-zone', className, {\n\t\t'is-active':\n\t\t\t( isDraggingOverDocument || isDraggingOverElement ) &&\n\t\t\t( ( type === 'file' && onFilesDrop ) ||\n\t\t\t\t( type === 'html' && onHTMLDrop ) ||\n\t\t\t\t( type === 'default' && onDrop ) ),\n\t\t'is-dragging-over-document': isDraggingOverDocument,\n\t\t'is-dragging-over-element': isDraggingOverElement,\n\t\t[ `is-dragging-${ type }` ]: !! type,\n\t} );\n\n\treturn (\n\t\t<div ref={ ref } className={ classes }>\n\t\t\t{ disableMotion ? (\n\t\t\t\tchildren\n\t\t\t) : (\n\t\t\t\t<AnimatePresence>{ children }</AnimatePresence>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -17,6 +17,7 @@ function DropZoneProvider(_ref) {
|
|
|
17
17
|
children
|
|
18
18
|
} = _ref;
|
|
19
19
|
(0, _deprecated.default)('wp.components.DropZoneProvider', {
|
|
20
|
+
since: '5.8',
|
|
20
21
|
hint: 'wp.component.DropZone no longer needs a provider. wp.components.DropZoneProvider is safe to remove from your code.'
|
|
21
22
|
});
|
|
22
23
|
return children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/drop-zone/provider.js"],"names":["DropZoneProvider","children","hint"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,gBAAT,OAA0C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACxD,2BAAY,gCAAZ,EAA8C;AAC7CC,IAAAA,IAAI,EACH;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/drop-zone/provider.js"],"names":["DropZoneProvider","children","since","hint"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,gBAAT,OAA0C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACxD,2BAAY,gCAAZ,EAA8C;AAC7CC,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,IAAI,EACH;AAH4C,GAA9C;AAKA,SAAOF,QAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\nexport default function DropZoneProvider( { children } ) {\n\tdeprecated( 'wp.components.DropZoneProvider', {\n\t\tsince: '5.8',\n\t\thint:\n\t\t\t'wp.component.DropZone no longer needs a provider. wp.components.DropZoneProvider is safe to remove from your code.',\n\t} );\n\treturn children;\n}\n"]}
|
package/build/flyout/styles.js
CHANGED
|
@@ -34,13 +34,13 @@ const FlyoutContentView = ( /*#__PURE__*/0, _base.default)(_reakit.Popover, proc
|
|
|
34
34
|
} : {
|
|
35
35
|
target: "e1vtu5161",
|
|
36
36
|
label: "FlyoutContentView"
|
|
37
|
-
})("z-index:", ZIndex.Flyout, ";box-sizing:border-box;opacity:0;outline:none;position:relative;transform-origin:center center;transition:opacity ", _configValues.default.transitionDurationFastest, " linear;width:100%;&[data-enter]{opacity:1;}&::before,&::after{display:none;}" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
37
|
+
})("z-index:", ZIndex.Flyout, ";box-sizing:border-box;opacity:0;outline:none;position:relative;transform-origin:center center;transition:opacity ", _configValues.default.transitionDurationFastest, " linear;width:100%;&[data-enter]{opacity:1;}&::before,&::after{display:none;}" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZmx5b3V0L3N0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFnQjJCIiwiZmlsZSI6IkB3b3Jkc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EtZW50ZXJdIHtcblx0XHRvcGFjaXR5OiAxO1xuXHR9XG5cblx0Jjo6YmVmb3JlLFxuXHQmOjphZnRlciB7XG5cdFx0ZGlzcGxheTogbm9uZTtcblx0fVxuYDtcblxuZXhwb3J0IGNvbnN0IENhcmRWaWV3ID0gc3R5bGVkKCBDYXJkIClgXG5cdCR7IENhcmRCb2R5LnNlbGVjdG9yIH0ge1xuXHRcdG1heC1oZWlnaHQ6IDgwdmg7XG5cdH1cbmA7XG4iXX0= */"));
|
|
38
38
|
exports.FlyoutContentView = FlyoutContentView;
|
|
39
39
|
const CardView = ( /*#__PURE__*/0, _base.default)(_card.Card, process.env.NODE_ENV === "production" ? {
|
|
40
40
|
target: "e1vtu5160"
|
|
41
41
|
} : {
|
|
42
42
|
target: "e1vtu5160",
|
|
43
43
|
label: "CardView"
|
|
44
|
-
})(_card.CardBody.selector, "{max-height:80vh;}" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
44
|
+
})(_card.CardBody.selector, "{max-height:80vh;}" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZmx5b3V0L3N0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFvQ3NDIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZmx5b3V0L3N0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBzdHlsZWQsIHsgU3R5bGVkQ29tcG9uZW50IH0gZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbi8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1yZXN0cmljdGVkLWltcG9ydHNcbmltcG9ydCB7IFBv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|
exports.CardView = CardView;
|
|
46
46
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/flyout/styles.ts"],"names":["FlyoutContentView","ReakitPopover","ZIndex","Flyout","CONFIG","transitionDurationFastest","CardView","Card","CardBody","selector"],"mappings":";;;;;;;;;;;AAKA;;AAKA;;AACA;;AACA;;;;;;AAZA;AACA;AACA;AAEA;;AAGA;AACA;AACA;AAKO,MAAMA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/flyout/styles.ts"],"names":["FlyoutContentView","ReakitPopover","ZIndex","Flyout","CONFIG","transitionDurationFastest","CardView","Card","CardBody","selector"],"mappings":";;;;;;;;;;;AAKA;;AAKA;;AACA;;AACA;;;;;;AAZA;AACA;AACA;AAEA;;AAGA;AACA;AACA;AAKO,MAAMA,iBAEZ,GAAG,iCAAQC,eAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH,aACYC,MAAM,CAACC,MADnB,wHAOuBC,sBAAOC,yBAP9B,yqDAFM;;AAsBA,MAAMC,QAAQ,GAAG,iCAAQC,UAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH,CACjBC,eAASC,QADQ,8mDAAd","sourcesContent":["/**\n * External dependencies\n */\nimport styled, { StyledComponent } from '@emotion/styled';\n// eslint-disable-next-line no-restricted-imports\nimport { Popover as ReakitPopover } from 'reakit';\n\n/**\n * Internal dependencies\n */\nimport { Card, CardBody } from '../card';\nimport * as ZIndex from '../utils/z-index';\nimport CONFIG from '../utils/config-values';\n\nexport const FlyoutContentView: StyledComponent<\n\tReact.ComponentPropsWithoutRef< typeof ReakitPopover >\n> = styled( ReakitPopover )`\n\tz-index: ${ ZIndex.Flyout };\n\tbox-sizing: border-box;\n\topacity: 0;\n\toutline: none;\n\tposition: relative;\n\ttransform-origin: center center;\n\ttransition: opacity ${ CONFIG.transitionDurationFastest } linear;\n\twidth: 100%;\n\n\t&[data-enter] {\n\t\topacity: 1;\n\t}\n\n\t&::before,\n\t&::after {\n\t\tdisplay: none;\n\t}\n`;\n\nexport const CardView = styled( Card )`\n\t${ CardBody.selector } {\n\t\tmax-height: 80vh;\n\t}\n`;\n"]}
|
|
@@ -25,6 +25,7 @@ function FocusableIframe(_ref) {
|
|
|
25
25
|
} = _ref;
|
|
26
26
|
const ref = (0, _compose.useMergeRefs)([iframeRef, (0, _compose.useFocusableIframe)()]);
|
|
27
27
|
(0, _deprecated.default)('wp.components.FocusableIframe', {
|
|
28
|
+
since: '5.9',
|
|
28
29
|
alternative: 'wp.compose.useFocusableIframe'
|
|
29
30
|
}); // Disable reason: The rendered iframe is a pass-through component,
|
|
30
31
|
// assigning props inherited from the rendering parent. It's the
|