@wordpress/components 25.1.0 → 25.1.1
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 -1
- package/README.md +1 -1
- package/build/alignment-matrix-control/cell.js +4 -5
- package/build/alignment-matrix-control/cell.js.map +1 -1
- package/build/alignment-matrix-control/icon.js +2 -4
- package/build/alignment-matrix-control/icon.js.map +1 -1
- package/build/alignment-matrix-control/index.js +6 -7
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/angle-picker-control/angle-circle.js +4 -7
- package/build/angle-picker-control/angle-circle.js.map +1 -1
- package/build/angle-picker-control/index.js +2 -4
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +28 -1
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/index.js +0 -20
- package/build/autocomplete/index.js.map +1 -1
- package/build/base-control/index.js +2 -4
- package/build/base-control/index.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +4 -6
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js +2 -4
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +15 -13
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-box-control/border-box-control-visualizer/component.js +2 -6
- package/build/border-box-control/border-box-control-visualizer/component.js.map +1 -1
- package/build/border-control/border-control/component.js +4 -6
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +4 -6
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/border-control-style-picker/component.js +2 -4
- package/build/border-control/border-control-style-picker/component.js.map +1 -1
- package/build/box-control/all-input-control.js +2 -4
- package/build/box-control/all-input-control.js.map +1 -1
- package/build/box-control/axial-input-controls.js +2 -4
- package/build/box-control/axial-input-controls.js.map +1 -1
- package/build/box-control/icon.js +4 -7
- package/build/box-control/icon.js.map +1 -1
- package/build/box-control/index.js +7 -6
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/input-controls.js +2 -4
- package/build/box-control/input-controls.js.map +1 -1
- package/build/box-control/linked-button.js +2 -4
- package/build/box-control/linked-button.js.map +1 -1
- package/build/box-control/unit-control.js +6 -6
- package/build/box-control/unit-control.js.map +1 -1
- package/build/button/deprecated.js +2 -4
- package/build/button/deprecated.js.map +1 -1
- package/build/button/index.js +7 -3
- package/build/button/index.js.map +1 -1
- package/build/button-group/index.js +4 -5
- package/build/button-group/index.js.map +1 -1
- package/build/card/card/component.js +2 -4
- package/build/card/card/component.js.map +1 -1
- package/build/card/card-body/component.js +4 -8
- package/build/card/card-body/component.js.map +1 -1
- package/build/card/card-divider/component.js +2 -6
- package/build/card/card-divider/component.js.map +1 -1
- package/build/card/card-footer/component.js +2 -6
- package/build/card/card-footer/component.js.map +1 -1
- package/build/card/card-header/component.js +2 -6
- package/build/card/card-header/component.js.map +1 -1
- package/build/card/card-media/component.js +2 -6
- package/build/card/card-media/component.js.map +1 -1
- package/build/checkbox-control/index.js +4 -5
- package/build/checkbox-control/index.js.map +1 -1
- package/build/circular-option-picker/index.js +19 -16
- package/build/circular-option-picker/index.js.map +1 -1
- package/build/clipboard-button/index.js +9 -20
- package/build/clipboard-button/index.js.map +1 -1
- package/build/clipboard-button/types.js +6 -0
- package/build/clipboard-button/types.js.map +1 -0
- package/build/color-control/index.native.js +4 -5
- package/build/color-control/index.native.js.map +1 -1
- package/build/color-indicator/index.js +4 -5
- package/build/color-indicator/index.js.map +1 -1
- package/build/color-palette/index.js +11 -11
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/color-input.js +6 -3
- package/build/color-picker/color-input.js.map +1 -1
- package/build/color-picker/component.js +4 -5
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/legacy-adapter.js +2 -1
- package/build/color-picker/legacy-adapter.js.map +1 -1
- package/build/confirm-dialog/component.js +4 -5
- package/build/confirm-dialog/component.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +8 -8
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-select-control/index.js +34 -32
- package/build/custom-select-control/index.js.map +1 -1
- package/build/dashicon/index.js +4 -7
- package/build/dashicon/index.js.map +1 -1
- package/build/dashicon/index.native.js +4 -7
- package/build/dashicon/index.native.js.map +1 -1
- package/build/disabled/index.js +4 -7
- package/build/disabled/index.js.map +1 -1
- package/build/divider/component.js +4 -8
- package/build/divider/component.js.map +1 -1
- package/build/drop-zone/index.js +2 -4
- package/build/drop-zone/index.js.map +1 -1
- package/build/dropdown/dropdown-content-wrapper.js +2 -6
- package/build/dropdown/dropdown-content-wrapper.js.map +1 -1
- package/build/dropdown/index.js +29 -24
- package/build/dropdown/index.js.map +1 -1
- package/build/dropdown-menu/index.js +98 -93
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/dropdown-menu/index.native.js +2 -4
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/dropdown-menu-v2/index.js +14 -12
- package/build/dropdown-menu-v2/index.js.map +1 -1
- package/build/dropdown-menu-v2/styles.js +16 -16
- package/build/dropdown-menu-v2/styles.js.map +1 -1
- package/build/elevation/component.js +2 -6
- package/build/elevation/component.js.map +1 -1
- package/build/external-link/index.js +2 -4
- package/build/external-link/index.js.map +1 -1
- package/build/flex/flex/component.js +2 -6
- package/build/flex/flex/component.js.map +1 -1
- package/build/flex/flex-block/component.js +2 -6
- package/build/flex/flex-block/component.js.map +1 -1
- package/build/flex/flex-item/component.js +2 -6
- package/build/flex/flex-item/component.js.map +1 -1
- package/build/focal-point-picker/controls.js +4 -7
- package/build/focal-point-picker/controls.js.map +1 -1
- package/build/focal-point-picker/focal-point.js +2 -4
- package/build/focal-point-picker/focal-point.js.map +1 -1
- package/build/focal-point-picker/grid.js +2 -6
- package/build/focal-point-picker/grid.js.map +1 -1
- package/build/focal-point-picker/index.js +4 -6
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/index.native.js +2 -4
- package/build/focal-point-picker/index.native.js.map +1 -1
- package/build/focal-point-picker/media.js +7 -10
- package/build/focal-point-picker/media.js.map +1 -1
- package/build/focal-point-picker/tooltip/index.native.js +2 -4
- package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build/focusable-iframe/index.js +4 -5
- package/build/focusable-iframe/index.js.map +1 -1
- package/build/footer-message-control/index.native.js +2 -1
- package/build/footer-message-control/index.native.js.map +1 -1
- package/build/form-file-upload/index.js +4 -5
- package/build/form-file-upload/index.js.map +1 -1
- package/build/form-toggle/index.js +4 -5
- package/build/form-toggle/index.js.map +1 -1
- package/build/form-token-field/index.js +4 -5
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/token-input.js +4 -6
- package/build/form-token-field/token-input.js.map +1 -1
- package/build/gradient-picker/index.js +14 -12
- package/build/gradient-picker/index.js.map +1 -1
- package/build/grid/component.js +2 -4
- package/build/grid/component.js.map +1 -1
- package/build/guide/page.js +2 -1
- package/build/guide/page.js.map +1 -1
- package/build/h-stack/component.js +2 -6
- package/build/h-stack/component.js.map +1 -1
- package/build/h-stack/hook.js +4 -7
- package/build/h-stack/hook.js.map +1 -1
- package/build/heading/component.js +2 -6
- package/build/heading/component.js.map +1 -1
- package/build/higher-order/navigate-regions/index.js +3 -1
- package/build/higher-order/navigate-regions/index.js.map +1 -1
- package/build/higher-order/with-constrained-tabbing/index.js +2 -1
- package/build/higher-order/with-constrained-tabbing/index.js.map +1 -1
- package/build/higher-order/with-fallback-styles/index.js +3 -3
- package/build/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build/higher-order/with-filters/index.js +2 -1
- package/build/higher-order/with-filters/index.js.map +1 -1
- package/build/higher-order/with-focus-outside/index.js +5 -7
- package/build/higher-order/with-focus-outside/index.js.map +1 -1
- package/build/higher-order/with-focus-outside/index.native.js +5 -7
- package/build/higher-order/with-focus-outside/index.native.js.map +1 -1
- package/build/higher-order/with-focus-return/index.js +2 -1
- package/build/higher-order/with-focus-return/index.js.map +1 -1
- package/build/higher-order/with-notices/index.js +3 -4
- package/build/higher-order/with-notices/index.js.map +1 -1
- package/build/higher-order/with-spoken-messages/index.js +2 -6
- package/build/higher-order/with-spoken-messages/index.js.map +1 -1
- package/build/icon/index.js +6 -6
- package/build/icon/index.js.map +1 -1
- package/build/input-control/index.js +5 -5
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/input-base.js +3 -4
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/input-field.js +3 -6
- package/build/input-control/input-field.js.map +1 -1
- package/build/input-control/input-prefix-wrapper.js +4 -8
- package/build/input-control/input-prefix-wrapper.js.map +1 -1
- package/build/input-control/input-suffix-wrapper.js +4 -8
- package/build/input-control/input-suffix-wrapper.js.map +1 -1
- package/build/input-control/label.js +4 -7
- package/build/input-control/label.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +2 -4
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/isolated-event-container/index.js +2 -4
- package/build/isolated-event-container/index.js.map +1 -1
- package/build/item-group/item/component.js +2 -6
- package/build/item-group/item/component.js.map +1 -1
- package/build/item-group/item-group/component.js +2 -6
- package/build/item-group/item-group/component.js.map +1 -1
- package/build/item-group/styles.js +10 -10
- package/build/item-group/styles.js.map +1 -1
- package/build/menu-item/index.js +4 -5
- package/build/menu-item/index.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +4 -6
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +2 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +5 -6
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/color-cell.native.js +2 -4
- package/build/mobile/bottom-sheet/color-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cycle-picker-cell.native.js +4 -5
- package/build/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/footer-message-cell.native.js +2 -4
- package/build/mobile/bottom-sheet/footer-message-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js +8 -8
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +4 -7
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js +2 -4
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/picker-cell.native.js +4 -5
- package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/radio-cell.native.js +2 -4
- package/build/mobile/bottom-sheet/radio-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/range-cell.native.js +2 -4
- package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/ripple.native.js +4 -6
- package/build/mobile/bottom-sheet/ripple.native.js.map +1 -1
- package/build/mobile/bottom-sheet/switch-cell.native.js +2 -4
- package/build/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
- package/build/mobile/color-settings/index.native.js +5 -5
- package/build/mobile/color-settings/index.native.js.map +1 -1
- package/build/mobile/cycle-select-control/index.native.js +4 -5
- package/build/mobile/cycle-select-control/index.native.js.map +1 -1
- package/build/mobile/focal-point-settings-panel/index.native.js +5 -5
- package/build/mobile/focal-point-settings-panel/index.native.js.map +1 -1
- package/build/mobile/global-styles-context/index.native.js +2 -6
- package/build/mobile/global-styles-context/index.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js +4 -5
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/image/image-editing-button.native.js +4 -5
- package/build/mobile/image/image-editing-button.native.js.map +1 -1
- package/build/mobile/image/index.native.js +15 -15
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/keyboard-avoiding-view/index.ios.js +2 -4
- package/build/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.android.js +4 -5
- package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js +2 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build/mobile/link-picker/link-picker-results.native.js +4 -6
- package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build/mobile/link-settings/link-settings-navigation.native.js +4 -5
- package/build/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build/mobile/link-settings/link-settings-screen.native.js +2 -4
- package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build/mobile/picker/index.ios.js +4 -6
- package/build/mobile/picker/index.ios.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +4 -5
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/modal/index.js +4 -6
- package/build/modal/index.js.map +1 -1
- package/build/navigable-container/container.js +6 -9
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigable-container/menu.js +4 -5
- package/build/navigable-container/menu.js.map +1 -1
- package/build/navigable-container/tabbable.js +4 -5
- package/build/navigable-container/tabbable.js.map +1 -1
- package/build/navigation/item/base.js +4 -5
- package/build/navigation/item/base.js.map +1 -1
- package/build/navigation/item/index.js +3 -4
- package/build/navigation/item/index.js.map +1 -1
- package/build/navigator/navigator-back-button/component.js +4 -7
- package/build/navigator/navigator-back-button/component.js.map +1 -1
- package/build/navigator/navigator-button/component.js +4 -7
- package/build/navigator/navigator-button/component.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +4 -5
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +9 -10
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/navigator/navigator-to-parent-button/component.js +4 -7
- package/build/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build/notice/list.js +2 -4
- package/build/notice/list.js.map +1 -1
- package/build/notice/list.native.js +2 -4
- package/build/notice/list.native.js.map +1 -1
- package/build/number-control/index.js +4 -6
- package/build/number-control/index.js.map +1 -1
- package/build/palette-edit/index.js +11 -12
- package/build/palette-edit/index.js.map +1 -1
- package/build/panel/body.js +8 -8
- package/build/panel/body.js.map +1 -1
- package/build/placeholder/index.js +2 -4
- package/build/placeholder/index.js.map +1 -1
- package/build/popover/index.js +11 -12
- package/build/popover/index.js.map +1 -1
- package/build/popover/utils.js +15 -1
- package/build/popover/utils.js.map +1 -1
- package/build/query-controls/category-select.js +4 -6
- package/build/query-controls/category-select.js.map +1 -1
- package/build/radio-control/index.js +4 -5
- package/build/radio-control/index.js.map +1 -1
- package/build/radio-control/index.native.js +4 -5
- package/build/radio-control/index.native.js.map +1 -1
- package/build/radio-group/index.js +5 -5
- package/build/radio-group/index.js.map +1 -1
- package/build/radio-group/radio/index.js +5 -5
- package/build/radio-group/radio/index.js.map +1 -1
- package/build/range-control/index.js +2 -4
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/index.native.js +4 -5
- package/build/range-control/index.native.js.map +1 -1
- package/build/range-control/input-range.js +2 -6
- package/build/range-control/input-range.js.map +1 -1
- package/build/range-control/mark.js +2 -4
- package/build/range-control/mark.js.map +1 -1
- package/build/range-control/rail.js +6 -7
- package/build/range-control/rail.js.map +1 -1
- package/build/range-control/tooltip.js +2 -4
- package/build/range-control/tooltip.js.map +1 -1
- package/build/resizable-box/index.js +5 -5
- package/build/resizable-box/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/index.js +4 -5
- package/build/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/label.js +4 -7
- package/build/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build/scrollable/component.js +2 -6
- package/build/scrollable/component.js.map +1 -1
- package/build/search-control/index.js +2 -4
- package/build/search-control/index.js.map +1 -1
- package/build/select-control/index.js +2 -4
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/index.native.js +4 -5
- package/build/select-control/index.native.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js +4 -5
- package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build/slot-fill/index.js +17 -13
- package/build/slot-fill/index.js.map +1 -1
- package/build/slot-fill/index.native.js +10 -9
- package/build/slot-fill/index.native.js.map +1 -1
- package/build/slot-fill/slot.js +2 -4
- package/build/slot-fill/slot.js.map +1 -1
- package/build/snackbar/list.js +2 -4
- package/build/snackbar/list.js.map +1 -1
- package/build/spacer/component.js +2 -6
- package/build/spacer/component.js.map +1 -1
- package/build/spinner/index.js +4 -6
- package/build/spinner/index.js.map +1 -1
- package/build/surface/component.js +2 -6
- package/build/surface/component.js.map +1 -1
- package/build/tab-panel/index.js +4 -5
- package/build/tab-panel/index.js.map +1 -1
- package/build/text/component.js +4 -6
- package/build/text/component.js.map +1 -1
- package/build/text-control/index.js +4 -5
- package/build/text-control/index.js.map +1 -1
- package/build/text-control/index.native.js +4 -5
- package/build/text-control/index.native.js.map +1 -1
- package/build/textarea-control/index.js +4 -5
- package/build/textarea-control/index.js.map +1 -1
- package/build/theme/index.js +4 -7
- package/build/theme/index.js.map +1 -1
- package/build/toggle-control/index.native.js +4 -5
- package/build/toggle-control/index.native.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-button-group.js +4 -6
- package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js +4 -6
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +2 -4
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option/component.js +2 -6
- package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js +6 -7
- package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js +2 -4
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build/toolbar/toolbar/index.js +9 -13
- package/build/toolbar/toolbar/index.js.map +1 -1
- package/build/toolbar/toolbar/toolbar-container.js +9 -13
- package/build/toolbar/toolbar/toolbar-container.js.map +1 -1
- package/build/toolbar/toolbar-button/index.js +13 -11
- package/build/toolbar/toolbar-button/index.js.map +1 -1
- package/build/toolbar/toolbar-context/index.js.map +1 -1
- package/build/toolbar/toolbar-dropdown-menu/index.js +8 -10
- package/build/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
- package/build/toolbar/toolbar-group/index.js +11 -10
- package/build/toolbar/toolbar-group/index.js.map +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.js +6 -6
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.native.js +4 -5
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.native.js.map +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-container.js +4 -7
- package/build/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
- package/build/toolbar/toolbar-item/index.js +13 -11
- package/build/toolbar/toolbar-item/index.js.map +1 -1
- package/build/toolbar/toolbar-item/types.js +6 -0
- package/build/toolbar/toolbar-item/types.js.map +1 -0
- package/build/tools-panel/tools-panel/component.js +2 -4
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +2 -4
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tools-panel/tools-panel-item/component.js +4 -8
- package/build/tools-panel/tools-panel-item/component.js.map +1 -1
- package/build/tooltip/index.js +4 -5
- package/build/tooltip/index.js.map +1 -1
- package/build/tooltip/index.native.js +2 -1
- package/build/tooltip/index.native.js.map +1 -1
- package/build/tree-grid/cell.js +2 -4
- package/build/tree-grid/cell.js.map +1 -1
- package/build/tree-grid/index.js +2 -4
- package/build/tree-grid/index.js.map +1 -1
- package/build/tree-grid/item.js +4 -5
- package/build/tree-grid/item.js.map +1 -1
- package/build/tree-grid/roving-tab-index-item.js +2 -1
- package/build/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build/tree-grid/row.js +2 -6
- package/build/tree-grid/row.js.map +1 -1
- package/build/tree-select/index.js +4 -7
- package/build/tree-select/index.js.map +1 -1
- package/build/truncate/component.js +4 -6
- package/build/truncate/component.js.map +1 -1
- package/build/ui/control-group/component.js +8 -12
- package/build/ui/control-group/component.js.map +1 -1
- package/build/ui/control-label/component.js +4 -8
- package/build/ui/control-label/component.js.map +1 -1
- package/build/ui/form-group/form-group-content.js +4 -5
- package/build/ui/form-group/form-group-content.js.map +1 -1
- package/build/ui/form-group/form-group-label.js +2 -1
- package/build/ui/form-group/form-group-label.js.map +1 -1
- package/build/ui/form-group/form-group.js +8 -8
- package/build/ui/form-group/form-group.js.map +1 -1
- package/build/ui/shortcut/component.js +4 -7
- package/build/ui/shortcut/component.js.map +1 -1
- package/build/ui/spinner/component.js +2 -6
- package/build/ui/spinner/component.js.map +1 -1
- package/build/ui/tooltip/component.js +3 -4
- package/build/ui/tooltip/component.js.map +1 -1
- package/build/ui/tooltip/content.js +5 -8
- package/build/ui/tooltip/content.js.map +1 -1
- package/build/unit-control/index.js +31 -94
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/index.native.js +7 -7
- package/build/unit-control/index.native.js.map +1 -1
- package/build/unit-control/unit-select-control.js +15 -7
- package/build/unit-control/unit-select-control.js.map +1 -1
- package/build/v-stack/component.js +2 -6
- package/build/v-stack/component.js.map +1 -1
- package/build/visually-hidden/component.js +4 -8
- package/build/visually-hidden/component.js.map +1 -1
- package/build/z-stack/component.js +2 -6
- package/build/z-stack/component.js.map +1 -1
- package/build-module/alignment-matrix-control/cell.js +4 -4
- package/build-module/alignment-matrix-control/cell.js.map +1 -1
- package/build-module/alignment-matrix-control/icon.js +2 -3
- package/build-module/alignment-matrix-control/icon.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +6 -6
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/angle-picker-control/angle-circle.js +4 -4
- package/build-module/angle-picker-control/angle-circle.js.map +1 -1
- package/build-module/angle-picker-control/index.js +2 -3
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +27 -2
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/index.js +1 -19
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/base-control/index.js +2 -3
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +4 -5
- 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/component.js +2 -3
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +15 -12
- 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/component.js +2 -3
- package/build-module/border-box-control/border-box-control-visualizer/component.js.map +1 -1
- package/build-module/border-control/border-control/component.js +4 -5
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +4 -5
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/border-control-style-picker/component.js +2 -3
- package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
- package/build-module/box-control/all-input-control.js +2 -3
- package/build-module/box-control/all-input-control.js.map +1 -1
- package/build-module/box-control/axial-input-controls.js +2 -3
- package/build-module/box-control/axial-input-controls.js.map +1 -1
- package/build-module/box-control/icon.js +4 -4
- package/build-module/box-control/icon.js.map +1 -1
- package/build-module/box-control/index.js +7 -5
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/input-controls.js +2 -3
- package/build-module/box-control/input-controls.js.map +1 -1
- package/build-module/box-control/linked-button.js +2 -3
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/box-control/unit-control.js +6 -5
- package/build-module/box-control/unit-control.js.map +1 -1
- package/build-module/button/deprecated.js +2 -3
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/index.js +7 -2
- package/build-module/button/index.js.map +1 -1
- package/build-module/button-group/index.js +4 -4
- package/build-module/button-group/index.js.map +1 -1
- package/build-module/card/card/component.js +2 -3
- package/build-module/card/card/component.js.map +1 -1
- package/build-module/card/card-body/component.js +4 -5
- package/build-module/card/card-body/component.js.map +1 -1
- package/build-module/card/card-divider/component.js +2 -3
- package/build-module/card/card-divider/component.js.map +1 -1
- package/build-module/card/card-footer/component.js +2 -3
- package/build-module/card/card-footer/component.js.map +1 -1
- package/build-module/card/card-header/component.js +2 -3
- package/build-module/card/card-header/component.js.map +1 -1
- package/build-module/card/card-media/component.js +2 -3
- package/build-module/card/card-media/component.js.map +1 -1
- package/build-module/checkbox-control/index.js +4 -4
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/circular-option-picker/index.js +19 -15
- package/build-module/circular-option-picker/index.js.map +1 -1
- package/build-module/clipboard-button/index.js +9 -20
- package/build-module/clipboard-button/index.js.map +1 -1
- package/build-module/clipboard-button/types.js +2 -0
- package/build-module/clipboard-button/types.js.map +1 -0
- package/build-module/color-control/index.native.js +4 -4
- package/build-module/color-control/index.native.js.map +1 -1
- package/build-module/color-indicator/index.js +4 -4
- package/build-module/color-indicator/index.js.map +1 -1
- package/build-module/color-palette/index.js +11 -10
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/color-input.js +6 -3
- package/build-module/color-picker/color-input.js.map +1 -1
- package/build-module/color-picker/component.js +4 -4
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/legacy-adapter.js +2 -1
- package/build-module/color-picker/legacy-adapter.js.map +1 -1
- package/build-module/confirm-dialog/component.js +4 -4
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +8 -7
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-select-control/index.js +34 -31
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/dashicon/index.js +4 -4
- package/build-module/dashicon/index.js.map +1 -1
- package/build-module/dashicon/index.native.js +4 -4
- package/build-module/dashicon/index.native.js.map +1 -1
- package/build-module/disabled/index.js +4 -4
- package/build-module/disabled/index.js.map +1 -1
- package/build-module/divider/component.js +4 -5
- package/build-module/divider/component.js.map +1 -1
- package/build-module/drop-zone/index.js +2 -3
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/dropdown/dropdown-content-wrapper.js +2 -3
- package/build-module/dropdown/dropdown-content-wrapper.js.map +1 -1
- package/build-module/dropdown/index.js +29 -24
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/dropdown-menu/index.js +95 -91
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js +2 -3
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/dropdown-menu-v2/index.js +14 -11
- package/build-module/dropdown-menu-v2/index.js.map +1 -1
- package/build-module/dropdown-menu-v2/styles.js +16 -16
- package/build-module/dropdown-menu-v2/styles.js.map +1 -1
- package/build-module/elevation/component.js +2 -3
- package/build-module/elevation/component.js.map +1 -1
- package/build-module/external-link/index.js +2 -3
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/flex/flex/component.js +2 -3
- package/build-module/flex/flex/component.js.map +1 -1
- package/build-module/flex/flex-block/component.js +2 -3
- package/build-module/flex/flex-block/component.js.map +1 -1
- package/build-module/flex/flex-item/component.js +2 -3
- package/build-module/flex/flex-item/component.js.map +1 -1
- package/build-module/focal-point-picker/controls.js +4 -4
- package/build-module/focal-point-picker/controls.js.map +1 -1
- package/build-module/focal-point-picker/focal-point.js +2 -3
- package/build-module/focal-point-picker/focal-point.js.map +1 -1
- package/build-module/focal-point-picker/grid.js +2 -3
- package/build-module/focal-point-picker/grid.js.map +1 -1
- package/build-module/focal-point-picker/index.js +4 -5
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/index.native.js +2 -3
- package/build-module/focal-point-picker/index.native.js.map +1 -1
- package/build-module/focal-point-picker/media.js +7 -7
- package/build-module/focal-point-picker/media.js.map +1 -1
- package/build-module/focal-point-picker/tooltip/index.native.js +2 -3
- package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build-module/focusable-iframe/index.js +4 -4
- package/build-module/focusable-iframe/index.js.map +1 -1
- package/build-module/footer-message-control/index.native.js +2 -1
- package/build-module/footer-message-control/index.native.js.map +1 -1
- package/build-module/form-file-upload/index.js +4 -4
- package/build-module/form-file-upload/index.js.map +1 -1
- package/build-module/form-toggle/index.js +4 -4
- package/build-module/form-toggle/index.js.map +1 -1
- package/build-module/form-token-field/index.js +4 -4
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/token-input.js +4 -5
- package/build-module/form-token-field/token-input.js.map +1 -1
- package/build-module/gradient-picker/index.js +14 -11
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/grid/component.js +2 -3
- package/build-module/grid/component.js.map +1 -1
- package/build-module/guide/page.js +2 -1
- package/build-module/guide/page.js.map +1 -1
- package/build-module/h-stack/component.js +2 -3
- package/build-module/h-stack/component.js.map +1 -1
- package/build-module/h-stack/hook.js +4 -4
- package/build-module/h-stack/hook.js.map +1 -1
- package/build-module/heading/component.js +2 -3
- package/build-module/heading/component.js.map +1 -1
- package/build-module/higher-order/navigate-regions/index.js +3 -1
- package/build-module/higher-order/navigate-regions/index.js.map +1 -1
- package/build-module/higher-order/with-constrained-tabbing/index.js +2 -1
- package/build-module/higher-order/with-constrained-tabbing/index.js.map +1 -1
- package/build-module/higher-order/with-fallback-styles/index.js +3 -2
- package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build-module/higher-order/with-filters/index.js +2 -1
- package/build-module/higher-order/with-filters/index.js.map +1 -1
- package/build-module/higher-order/with-focus-outside/index.js +5 -4
- package/build-module/higher-order/with-focus-outside/index.js.map +1 -1
- package/build-module/higher-order/with-focus-outside/index.native.js +5 -4
- package/build-module/higher-order/with-focus-outside/index.native.js.map +1 -1
- package/build-module/higher-order/with-focus-return/index.js +2 -1
- package/build-module/higher-order/with-focus-return/index.js.map +1 -1
- package/build-module/higher-order/with-notices/index.js +3 -3
- package/build-module/higher-order/with-notices/index.js.map +1 -1
- package/build-module/higher-order/with-spoken-messages/index.js +2 -3
- package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
- package/build-module/icon/index.js +6 -6
- package/build-module/icon/index.js.map +1 -1
- package/build-module/input-control/index.js +5 -4
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/input-base.js +3 -3
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/input-field.js +3 -3
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/input-control/input-prefix-wrapper.js +4 -5
- package/build-module/input-control/input-prefix-wrapper.js.map +1 -1
- package/build-module/input-control/input-suffix-wrapper.js +4 -5
- package/build-module/input-control/input-suffix-wrapper.js.map +1 -1
- package/build-module/input-control/label.js +4 -4
- package/build-module/input-control/label.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +2 -3
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/isolated-event-container/index.js +2 -3
- package/build-module/isolated-event-container/index.js.map +1 -1
- package/build-module/item-group/item/component.js +2 -3
- package/build-module/item-group/item/component.js.map +1 -1
- package/build-module/item-group/item-group/component.js +2 -3
- package/build-module/item-group/item-group/component.js.map +1 -1
- package/build-module/item-group/styles.js +10 -10
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/menu-item/index.js +4 -4
- package/build-module/menu-item/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +4 -5
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +2 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +5 -5
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/color-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/color-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js +4 -4
- package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/footer-message-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/footer-message-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js +8 -7
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +4 -4
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/picker-cell.native.js +4 -4
- package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/radio-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/radio-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/range-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/ripple.native.js +4 -5
- package/build-module/mobile/bottom-sheet/ripple.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/switch-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
- package/build-module/mobile/color-settings/index.native.js +5 -4
- package/build-module/mobile/color-settings/index.native.js.map +1 -1
- package/build-module/mobile/cycle-select-control/index.native.js +4 -4
- package/build-module/mobile/cycle-select-control/index.native.js.map +1 -1
- package/build-module/mobile/focal-point-settings-panel/index.native.js +5 -4
- package/build-module/mobile/focal-point-settings-panel/index.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/index.native.js +2 -3
- package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js +4 -4
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/image/image-editing-button.native.js +4 -4
- package/build-module/mobile/image/image-editing-button.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +15 -14
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js +2 -3
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js +4 -4
- 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 +2 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js +4 -5
- package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-navigation.native.js +4 -4
- package/build-module/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-screen.native.js +2 -3
- package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build-module/mobile/picker/index.ios.js +4 -5
- package/build-module/mobile/picker/index.ios.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +4 -4
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/modal/index.js +4 -5
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigable-container/container.js +6 -6
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigable-container/menu.js +4 -4
- package/build-module/navigable-container/menu.js.map +1 -1
- package/build-module/navigable-container/tabbable.js +4 -4
- package/build-module/navigable-container/tabbable.js.map +1 -1
- package/build-module/navigation/item/base.js +4 -4
- package/build-module/navigation/item/base.js.map +1 -1
- package/build-module/navigation/item/index.js +3 -3
- package/build-module/navigation/item/index.js.map +1 -1
- package/build-module/navigator/navigator-back-button/component.js +4 -4
- package/build-module/navigator/navigator-back-button/component.js.map +1 -1
- package/build-module/navigator/navigator-button/component.js +4 -4
- package/build-module/navigator/navigator-button/component.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +4 -4
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +9 -7
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/navigator/navigator-to-parent-button/component.js +4 -4
- package/build-module/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build-module/notice/list.js +2 -3
- package/build-module/notice/list.js.map +1 -1
- package/build-module/notice/list.native.js +2 -3
- package/build-module/notice/list.native.js.map +1 -1
- package/build-module/number-control/index.js +4 -5
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/palette-edit/index.js +11 -11
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/panel/body.js +8 -7
- package/build-module/panel/body.js.map +1 -1
- package/build-module/placeholder/index.js +2 -3
- package/build-module/placeholder/index.js.map +1 -1
- package/build-module/popover/index.js +12 -12
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/utils.js +11 -0
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/query-controls/category-select.js +4 -5
- package/build-module/query-controls/category-select.js.map +1 -1
- package/build-module/radio-control/index.js +4 -4
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/radio-control/index.native.js +4 -4
- package/build-module/radio-control/index.native.js.map +1 -1
- package/build-module/radio-group/index.js +5 -4
- package/build-module/radio-group/index.js.map +1 -1
- package/build-module/radio-group/radio/index.js +5 -4
- package/build-module/radio-group/radio/index.js.map +1 -1
- package/build-module/range-control/index.js +2 -3
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/index.native.js +4 -4
- package/build-module/range-control/index.native.js.map +1 -1
- package/build-module/range-control/input-range.js +2 -3
- package/build-module/range-control/input-range.js.map +1 -1
- package/build-module/range-control/mark.js +2 -3
- package/build-module/range-control/mark.js.map +1 -1
- package/build-module/range-control/rail.js +6 -6
- package/build-module/range-control/rail.js.map +1 -1
- package/build-module/range-control/tooltip.js +2 -3
- package/build-module/range-control/tooltip.js.map +1 -1
- package/build-module/resizable-box/index.js +5 -4
- package/build-module/resizable-box/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/index.js +4 -4
- package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/label.js +4 -4
- package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build-module/scrollable/component.js +2 -3
- package/build-module/scrollable/component.js.map +1 -1
- package/build-module/search-control/index.js +2 -3
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/select-control/index.js +2 -3
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/index.native.js +4 -4
- package/build-module/select-control/index.native.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js +4 -4
- package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build-module/slot-fill/index.js +17 -12
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/slot-fill/index.native.js +10 -8
- package/build-module/slot-fill/index.native.js.map +1 -1
- package/build-module/slot-fill/slot.js +2 -3
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/snackbar/list.js +2 -3
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/spacer/component.js +2 -3
- package/build-module/spacer/component.js.map +1 -1
- package/build-module/spinner/index.js +4 -5
- package/build-module/spinner/index.js.map +1 -1
- package/build-module/surface/component.js +2 -3
- package/build-module/surface/component.js.map +1 -1
- package/build-module/tab-panel/index.js +4 -4
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/text/component.js +4 -5
- package/build-module/text/component.js.map +1 -1
- package/build-module/text-control/index.js +4 -4
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/text-control/index.native.js +4 -4
- package/build-module/text-control/index.native.js.map +1 -1
- package/build-module/textarea-control/index.js +4 -4
- package/build-module/textarea-control/index.js.map +1 -1
- package/build-module/theme/index.js +4 -4
- package/build-module/theme/index.js.map +1 -1
- package/build-module/toggle-control/index.native.js +4 -4
- package/build-module/toggle-control/index.native.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-button-group.js +4 -5
- package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +4 -5
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.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/toggle-group-control/toggle-group-control-option/component.js +2 -3
- package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +6 -6
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +2 -3
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build-module/toolbar/toolbar/index.js +10 -13
- package/build-module/toolbar/toolbar/index.js.map +1 -1
- package/build-module/toolbar/toolbar/toolbar-container.js +9 -12
- package/build-module/toolbar/toolbar/toolbar-container.js.map +1 -1
- package/build-module/toolbar/toolbar-button/index.js +13 -10
- package/build-module/toolbar/toolbar-button/index.js.map +1 -1
- package/build-module/toolbar/toolbar-context/index.js.map +1 -1
- package/build-module/toolbar/toolbar-dropdown-menu/index.js +8 -9
- package/build-module/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
- package/build-module/toolbar/toolbar-group/index.js +11 -9
- package/build-module/toolbar/toolbar-group/index.js.map +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js +6 -5
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.native.js +4 -4
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.native.js.map +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-container.js +4 -4
- package/build-module/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
- package/build-module/toolbar/toolbar-item/index.js +13 -10
- package/build-module/toolbar/toolbar-item/index.js.map +1 -1
- package/build-module/toolbar/toolbar-item/types.js +2 -0
- package/build-module/toolbar/toolbar-item/types.js.map +1 -0
- package/build-module/tools-panel/tools-panel/component.js +2 -3
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +2 -3
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/component.js +4 -5
- package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
- package/build-module/tooltip/index.js +4 -4
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tooltip/index.native.js +2 -1
- package/build-module/tooltip/index.native.js.map +1 -1
- package/build-module/tree-grid/cell.js +2 -3
- package/build-module/tree-grid/cell.js.map +1 -1
- package/build-module/tree-grid/index.js +2 -3
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/tree-grid/item.js +4 -4
- package/build-module/tree-grid/item.js.map +1 -1
- package/build-module/tree-grid/roving-tab-index-item.js +2 -1
- package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build-module/tree-grid/row.js +2 -3
- package/build-module/tree-grid/row.js.map +1 -1
- package/build-module/tree-select/index.js +4 -4
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/truncate/component.js +4 -5
- package/build-module/truncate/component.js.map +1 -1
- package/build-module/ui/control-group/component.js +8 -9
- package/build-module/ui/control-group/component.js.map +1 -1
- package/build-module/ui/control-label/component.js +4 -5
- package/build-module/ui/control-label/component.js.map +1 -1
- package/build-module/ui/form-group/form-group-content.js +4 -4
- package/build-module/ui/form-group/form-group-content.js.map +1 -1
- package/build-module/ui/form-group/form-group-label.js +2 -1
- package/build-module/ui/form-group/form-group-label.js.map +1 -1
- package/build-module/ui/form-group/form-group.js +8 -7
- package/build-module/ui/form-group/form-group.js.map +1 -1
- package/build-module/ui/shortcut/component.js +4 -4
- package/build-module/ui/shortcut/component.js.map +1 -1
- package/build-module/ui/spinner/component.js +2 -3
- package/build-module/ui/spinner/component.js.map +1 -1
- package/build-module/ui/tooltip/component.js +3 -3
- package/build-module/ui/tooltip/component.js.map +1 -1
- package/build-module/ui/tooltip/content.js +5 -5
- package/build-module/ui/tooltip/content.js.map +1 -1
- package/build-module/unit-control/index.js +31 -88
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/index.native.js +7 -6
- package/build-module/unit-control/index.native.js.map +1 -1
- package/build-module/unit-control/unit-select-control.js +19 -6
- package/build-module/unit-control/unit-select-control.js.map +1 -1
- package/build-module/v-stack/component.js +2 -3
- package/build-module/v-stack/component.js.map +1 -1
- package/build-module/visually-hidden/component.js +4 -5
- package/build-module/visually-hidden/component.js.map +1 -1
- package/build-module/z-stack/component.js +2 -3
- package/build-module/z-stack/component.js.map +1 -1
- package/build-style/style-rtl.css +8 -14
- package/build-style/style.css +8 -14
- package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/button/stories/e2e/index.d.ts +1 -0
- package/build-types/button/stories/e2e/index.d.ts.map +1 -1
- package/build-types/circular-option-picker/types.d.ts +2 -2
- package/build-types/circular-option-picker/types.d.ts.map +1 -1
- package/build-types/clipboard-button/index.d.ts +4 -15
- package/build-types/clipboard-button/index.d.ts.map +1 -1
- package/build-types/clipboard-button/types.d.ts +11 -0
- package/build-types/clipboard-button/types.d.ts.map +1 -0
- package/build-types/dropdown/index.d.ts +1 -1
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/dropdown/types.d.ts +7 -0
- package/build-types/dropdown/types.d.ts.map +1 -1
- package/build-types/dropdown-menu/index.d.ts +1 -1
- package/build-types/dropdown-menu/index.d.ts.map +1 -1
- package/build-types/dropdown-menu/stories/index.d.ts +4 -3
- package/build-types/dropdown-menu/stories/index.d.ts.map +1 -1
- package/build-types/dropdown-menu/types.d.ts +7 -0
- package/build-types/dropdown-menu/types.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/styles.d.ts +4 -4
- package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/types.d.ts +2 -2
- package/build-types/dropdown-menu-v2/types.d.ts.map +1 -1
- package/build-types/item-group/styles.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/index.d.ts +0 -1
- package/build-types/popover/stories/index.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts +10 -0
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/toolbar/stories/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-context/index.d.ts +2 -2
- package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-item/index.d.ts +4 -6
- package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-item/types.d.ts +17 -0
- package/build-types/toolbar/toolbar-item/types.d.ts.map +1 -0
- package/build-types/unit-control/index.d.ts +3 -6
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/stories/index.d.ts.map +1 -1
- package/build-types/unit-control/unit-select-control.d.ts +7 -6
- package/build-types/unit-control/unit-select-control.d.ts.map +1 -1
- package/package.json +20 -19
- package/src/autocomplete/autocompleter-ui.tsx +44 -2
- package/src/autocomplete/index.tsx +2 -32
- package/src/box-control/test/index.tsx +28 -60
- package/src/button/stories/e2e/index.tsx +22 -0
- package/src/button/style.scss +5 -13
- package/src/circular-option-picker/types.ts +2 -5
- package/src/clipboard-button/{index.js → index.tsx} +11 -17
- package/src/clipboard-button/types.ts +11 -0
- package/src/dropdown/index.tsx +20 -10
- package/src/dropdown/types.ts +8 -0
- package/src/dropdown-menu/index.tsx +101 -85
- package/src/dropdown-menu/stories/index.tsx +1 -1
- package/src/dropdown-menu/types.ts +8 -0
- package/src/dropdown-menu-v2/index.tsx +2 -2
- package/src/dropdown-menu-v2/styles.ts +7 -5
- package/src/dropdown-menu-v2/types.ts +2 -2
- package/src/item-group/styles.ts +12 -4
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +16 -29
- package/src/mobile/bottom-sheet/cell.native.js +1 -1
- package/src/mobile/html-text-input/test/__snapshots__/index.native.js.snap +46 -0
- package/src/mobile/html-text-input/test/index.native.js +2 -2
- package/src/mobile/image/index.native.js +1 -1
- package/src/mobile/link-settings/test/link-settings-navigation.native.js +5 -16
- package/src/modal/style.scss +2 -2
- package/src/popover/index.tsx +3 -2
- package/src/popover/stories/index.tsx +0 -13
- package/src/popover/test/index.tsx +22 -1
- package/src/popover/utils.ts +12 -0
- package/src/search-control/README.md +7 -1
- package/src/toolbar/stories/index.tsx +0 -3
- package/src/toolbar/toolbar/index.tsx +3 -6
- package/src/toolbar/toolbar/toolbar-container.tsx +5 -9
- package/src/toolbar/toolbar-context/index.ts +2 -4
- package/src/toolbar/toolbar-dropdown-menu/index.js +0 -1
- package/src/toolbar/toolbar-item/index.tsx +13 -15
- package/src/toolbar/toolbar-item/types.ts +27 -0
- package/src/tooltip/test/index.native.js +1 -3
- package/src/unit-control/index.tsx +29 -95
- package/src/unit-control/stories/index.tsx +0 -4
- package/src/unit-control/test/index.tsx +151 -223
- package/src/unit-control/unit-select-control.tsx +20 -10
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/picker/index.ios.js"],"names":["Picker","Component","presentPicker","options","onChange","title","destructiveButtonIndex","disabledButtonIndices","getAnchor","isBottomSheetOpened","closeBottomSheet","onHandleClosingBottomSheet","colorScheme","props","labels","map","label","fullOptions","concat","buttonTitleColor","styles","color","ActionSheetIOS","showActionSheetWithOptions","cancelButtonIndex","anchor","tintColor","buttonIndex","selected","requiresModal","value","render","PickerComponent","ref","select","isEditorSidebarOpened","closeGeneralSidebar","BottomSheetContext"],"mappings":";;;;;;;;;AASA
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/picker/index.ios.js"],"names":["Picker","Component","presentPicker","options","onChange","title","destructiveButtonIndex","disabledButtonIndices","getAnchor","isBottomSheetOpened","closeBottomSheet","onHandleClosingBottomSheet","colorScheme","props","labels","map","label","fullOptions","concat","buttonTitleColor","styles","color","ActionSheetIOS","showActionSheetWithOptions","cancelButtonIndex","anchor","tintColor","buttonIndex","selected","requiresModal","value","render","PickerComponent","ref","select","isEditorSidebarOpened","closeGeneralSidebar","BottomSheetContext"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAGA,MAAMA,MAAN,SAAqBC,kBAArB,CAA+B;AAC9BC,EAAAA,aAAa,GAAG;AACf,UAAM;AACLC,MAAAA,OADK;AAELC,MAAAA,QAFK;AAGLC,MAAAA,KAHK;AAILC,MAAAA,sBAJK;AAKLC,MAAAA,qBALK;AAMLC,MAAAA,SANK;AAOLC,MAAAA,mBAPK;AAQLC,MAAAA,gBARK;AASLC,MAAAA,0BATK;AAULC,MAAAA;AAVK,QAWF,KAAKC,KAXT;AAYA,UAAMC,MAAM,GAAGX,OAAO,CAACY,GAAR,CAAa,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAiBA,KAA9B,CAAf;AACA,UAAMC,WAAW,GAAG,CAAE,cAAI,QAA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WAAW,GAAG,uCAApB;AAEA,SACC,4BAAC,MAAD;AACC,IAAA,GAAG,EAAGqB,GADP;AAAA,OAEMpB,KAFN;AAGC,IAAA,mBAAmB,EAAGJ,mBAHvB;AAIC,IAAA,gBAAgB,EAAG2B,mBAJpB;AAKC,IAAA,0BAA0B,EAAGzB,0BAL9B;AAMC,IAAA,WAAW,EAAGC;AANf,IADD;AAUA,CAnBuB,CAAxB;eAqBeoB,e","sourcesContent":["/**\n * External dependencies\n */\nimport { ActionSheetIOS } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component, forwardRef, useContext } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { BottomSheetContext } from '@wordpress/components';\nimport { usePreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\n\nclass Picker extends Component {\n\tpresentPicker() {\n\t\tconst {\n\t\t\toptions,\n\t\t\tonChange,\n\t\t\ttitle,\n\t\t\tdestructiveButtonIndex,\n\t\t\tdisabledButtonIndices,\n\t\t\tgetAnchor,\n\t\t\tisBottomSheetOpened,\n\t\t\tcloseBottomSheet,\n\t\t\tonHandleClosingBottomSheet,\n\t\t\tcolorScheme,\n\t\t} = this.props;\n\t\tconst labels = options.map( ( { label } ) => label );\n\t\tconst fullOptions = [ __( 'Cancel' ) ].concat( labels );\n\n\t\tconst buttonTitleColor =\n\t\t\tcolorScheme === 'light'\n\t\t\t\t? styles[ 'components-picker__button-title' ].color\n\t\t\t\t: styles[ 'components-picker__button-title--dark' ].color;\n\n\t\tActionSheetIOS.showActionSheetWithOptions(\n\t\t\t{\n\t\t\t\ttitle,\n\t\t\t\toptions: fullOptions,\n\t\t\t\tcancelButtonIndex: 0,\n\t\t\t\tdestructiveButtonIndex,\n\t\t\t\tdisabledButtonIndices,\n\t\t\t\tanchor: getAnchor && getAnchor(),\n\t\t\t\ttintColor: buttonTitleColor,\n\t\t\t},\n\t\t\t( buttonIndex ) => {\n\t\t\t\tif ( buttonIndex === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst selected = options[ buttonIndex - 1 ];\n\n\t\t\t\tif ( selected.requiresModal && isBottomSheetOpened ) {\n\t\t\t\t\tonHandleClosingBottomSheet( () => {\n\t\t\t\t\t\tonChange( selected.value );\n\t\t\t\t\t} );\n\t\t\t\t\tcloseBottomSheet();\n\t\t\t\t} else {\n\t\t\t\t\tonChange( selected.value );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\trender() {\n\t\treturn null;\n\t}\n}\n\nconst PickerComponent = forwardRef( ( props, ref ) => {\n\tconst isBottomSheetOpened = useSelect( ( select ) =>\n\t\tselect( 'core/edit-post' ).isEditorSidebarOpened()\n\t);\n\tconst { closeGeneralSidebar } = useDispatch( 'core/edit-post' );\n\tconst { onHandleClosingBottomSheet } = useContext( BottomSheetContext );\n\n\tconst colorScheme = usePreferredColorScheme();\n\n\treturn (\n\t\t<Picker\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tisBottomSheetOpened={ isBottomSheetOpened }\n\t\t\tcloseBottomSheet={ closeGeneralSidebar }\n\t\t\tonHandleClosingBottomSheet={ onHandleClosingBottomSheet }\n\t\t\tcolorScheme={ colorScheme }\n\t\t/>\n\t);\n} );\n\nexport default PickerComponent;\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _reactNative = require("react-native");
|
|
15
13
|
|
|
16
14
|
var _compose = require("@wordpress/compose");
|
|
@@ -49,10 +47,11 @@ const Segment = ({
|
|
|
49
47
|
style: isSelectedIOS && shadowStyle
|
|
50
48
|
}, (0, _element.createElement)(_reactNative.TouchableWithoutFeedback, {
|
|
51
49
|
onPress: onPress
|
|
52
|
-
}, (0, _element.createElement)(_reactNative.View,
|
|
50
|
+
}, (0, _element.createElement)(_reactNative.View, {
|
|
53
51
|
style: segmentStyle,
|
|
54
|
-
onLayout: onLayout
|
|
55
|
-
|
|
52
|
+
onLayout: onLayout,
|
|
53
|
+
...props
|
|
54
|
+
}, (0, _element.createElement)(_reactNative.Text, {
|
|
56
55
|
style: [textStyle, isSelected && selectedTextStyle],
|
|
57
56
|
maxFontSizeMultiplier: 2
|
|
58
57
|
}, title))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/segmented-control/index.native.js"],"names":["ANIMATION_DURATION","isIOS","Platform","OS","Segment","isSelected","title","onPress","onLayout","props","isSelectedIOS","segmentStyle","styles","segment","segmentIOS","textStyle","buttonTextDefault","buttonTextDefaultDark","selectedTextStyle","buttonTextSelected","buttonTextSelectedDark","shadowStyle","shadowIOS","SegmentedControls","segments","segmentHandler","selectedIndex","addonLeft","addonRight","selectedSegmentIndex","activeSegmentIndex","setActiveSegmentIndex","segmentsDimensions","setSegmentsDimensions","width","height","positionAnimationValue","Animated","Value","setValue","calculateEndValue","containerStyle","container","containerDark","performSwatchAnimation","index","timing","toValue","duration","easing","Easing","ease","useNativeDriver","start","paddingLeft","offset","containerIOS","widths","Object","values","map","dimension","widthsDistance","slice","widthsDistanceSum","reduce","sum","n","endValue","onHandlePress","segmentOnLayout","event","nativeEvent","layout","selectedStyle","selected","selectedDark","outlineStyle","outline","outlineIOS","row","flex","length","left"],"mappings":";;;;;;;;;AAcA;;;;AAXA;;AAYA;;AAKA;;AACA;;AArBA;AACA;AACA;;AASA;AACA;AACA;;AAIA;AACA;AACA;AAIA,MAAMA,kBAAkB,GAAG,GAA3B;AAEA,MAAMC,KAAK,GAAGC,sBAASC,EAAT,KAAgB,KAA9B;;AAEA,MAAMC,OAAO,GAAG,CAAE;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,KAAd;AAAqBC,EAAAA,OAArB;AAA8BC,E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Ad,KACGhC,QAAQ,CAACoC,GAAT,CAAc,CAAE/C,OAAF,EAAWgC,KAAX,KAAsB;AACrC,WACC,4BAAC,OAAD;AACC,MAAA,KAAK,EAAGhC,OADT;AAEC,MAAA,OAAO,EAAG,MAAMwD,aAAa,CAAExD,OAAF,EAAWgC,KAAX,CAF9B;AAGC,MAAA,UAAU,EAAGf,kBAAkB,KAAKe,KAHrC;AAIC,MAAA,GAAG,EAAGA,KAJP;AAKC,MAAA,QAAQ,EAAK0B,KAAF,IACVD,eAAe,CAAEC,KAAF,EAAS1B,KAAT,CANjB;AAQC,MAAA,kBAAkB,EAAG;AACpB8B,QAAAA,QAAQ,EAAE7C,kBAAkB,KAAKe;AADb,OARtB;AAWC,MAAA,iBAAiB,EAAG,QAXrB;AAYC,MAAA,kBAAkB,EAAGhC,OAZtB;AAaC,MAAA,iBAAiB,EAAI,GAAGgC,KAAK,GAAG,CAAG,OAClCrB,QAAQ,CAAC0D,MACT;AAfF,MADD;AAmBA,GApBC,CADH,EAsBC,4BAAC,qBAAD,CAAU,IAAV;AACC,IAAA,KAAK,EAAG,CACP;AACChD,MAAAA,KADD;AAECiD,MAAAA,IAAI,EAAE/C,sBAFP;AAGCD,MAAAA;AAHD,KADO,EAMPuC,aANO,EAOPG,YAPO;AADT,IAtBD,CAFD,EAoCC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGjE,eAAOqE;AAArB,KAA8BrD,UAA9B,CApCD,CADD;AAwCA,CAjID;;eAmIeL,iB","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tView,\n\tTouchableWithoutFeedback,\n\tText,\n\tPlatform,\n\tAnimated,\n\tEasing,\n} from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { performLayoutAnimation } from '../layout-animation';\nimport styles from './style.scss';\n\nconst ANIMATION_DURATION = 200;\n\nconst isIOS = Platform.OS === 'ios';\n\nconst Segment = ( { isSelected, title, onPress, onLayout, ...props } ) => {\n\tconst isSelectedIOS = isIOS && isSelected;\n\n\tconst segmentStyle = [ styles.segment, isIOS && styles.segmentIOS ];\n\n\tconst textStyle = usePreferredColorSchemeStyle(\n\t\tstyles.buttonTextDefault,\n\t\tstyles.buttonTextDefaultDark\n\t);\n\tconst selectedTextStyle = usePreferredColorSchemeStyle(\n\t\tstyles.buttonTextSelected,\n\t\tstyles.buttonTextSelectedDark\n\t);\n\tconst shadowStyle = usePreferredColorSchemeStyle( styles.shadowIOS, {} );\n\n\treturn (\n\t\t<View style={ isSelectedIOS && shadowStyle }>\n\t\t\t<TouchableWithoutFeedback onPress={ onPress }>\n\t\t\t\t<View style={ segmentStyle } onLayout={ onLayout } { ...props }>\n\t\t\t\t\t<Text\n\t\t\t\t\t\tstyle={ [ textStyle, isSelected && selectedTextStyle ] }\n\t\t\t\t\t\tmaxFontSizeMultiplier={ 2 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t</View>\n\t);\n};\n\nconst SegmentedControls = ( {\n\tsegments,\n\tsegmentHandler,\n\tselectedIndex,\n\taddonLeft,\n\taddonRight,\n} ) => {\n\tconst selectedSegmentIndex = selectedIndex || 0;\n\tconst [ activeSegmentIndex, setActiveSegmentIndex ] =\n\t\tuseState( selectedSegmentIndex );\n\tconst [ segmentsDimensions, setSegmentsDimensions ] = useState( {\n\t\t[ activeSegmentIndex ]: { width: 0, height: 0 },\n\t} );\n\tconst [ positionAnimationValue ] = useState( new Animated.Value( 0 ) );\n\n\tuseEffect( () => {\n\t\tsetActiveSegmentIndex( selectedSegmentIndex );\n\t\tsegmentHandler( segments[ selectedSegmentIndex ] );\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tpositionAnimationValue.setValue(\n\t\t\tcalculateEndValue( activeSegmentIndex )\n\t\t);\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ segmentsDimensions ] );\n\n\tconst containerStyle = usePreferredColorSchemeStyle(\n\t\tstyles.container,\n\t\tstyles.containerDark\n\t);\n\n\tfunction performSwatchAnimation( index ) {\n\t\tAnimated.timing( positionAnimationValue, {\n\t\t\ttoValue: calculateEndValue( index ),\n\t\t\tduration: ANIMATION_DURATION,\n\t\t\teasing: Easing.ease,\n\t\t\tuseNativeDriver: false,\n\t\t} ).start();\n\t}\n\n\tfunction calculateEndValue( index ) {\n\t\tconst { paddingLeft: offset } = isIOS\n\t\t\t? styles.containerIOS\n\t\t\t: styles.container;\n\t\tconst widths = Object.values( segmentsDimensions ).map(\n\t\t\t( dimension ) => dimension.width\n\t\t);\n\t\tconst widthsDistance = widths.slice( 0, index );\n\t\tconst widthsDistanceSum = widthsDistance.reduce(\n\t\t\t( sum, n ) => sum + n,\n\t\t\t0\n\t\t);\n\n\t\tconst endValue = index === 0 ? 0 : widthsDistanceSum;\n\t\treturn endValue + offset;\n\t}\n\n\tfunction onHandlePress( segment, index ) {\n\t\tperformLayoutAnimation( ANIMATION_DURATION );\n\t\tsetActiveSegmentIndex( index );\n\t\tsegmentHandler( segment );\n\t\tperformSwatchAnimation( index );\n\t}\n\n\tfunction segmentOnLayout( event, index ) {\n\t\tconst { width, height } = event.nativeEvent.layout;\n\n\t\tsetSegmentsDimensions( {\n\t\t\t...segmentsDimensions,\n\t\t\t[ index ]: { width, height },\n\t\t} );\n\t}\n\n\tconst selectedStyle = usePreferredColorSchemeStyle(\n\t\tstyles.selected,\n\t\tstyles.selectedDark\n\t);\n\n\tconst width = segmentsDimensions[ activeSegmentIndex ]?.width;\n\tconst height = segmentsDimensions[ activeSegmentIndex ]?.height;\n\n\tconst outlineStyle = [ styles.outline, isIOS && styles.outlineIOS ];\n\n\treturn (\n\t\t<View style={ styles.row }>\n\t\t\t<View style={ styles.flex }>{ addonLeft }</View>\n\t\t\t<View style={ [ containerStyle, isIOS && styles.containerIOS ] }>\n\t\t\t\t{ segments.map( ( segment, index ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Segment\n\t\t\t\t\t\t\ttitle={ segment }\n\t\t\t\t\t\t\tonPress={ () => onHandlePress( segment, index ) }\n\t\t\t\t\t\t\tisSelected={ activeSegmentIndex === index }\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonLayout={ ( event ) =>\n\t\t\t\t\t\t\t\tsegmentOnLayout( event, index )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\tselected: activeSegmentIndex === index,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\taccessibilityLabel={ segment }\n\t\t\t\t\t\t\taccessibilityHint={ `${ index + 1 } on ${\n\t\t\t\t\t\t\t\tsegments.length\n\t\t\t\t\t\t\t}` }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t<Animated.View\n\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\tleft: positionAnimationValue,\n\t\t\t\t\t\t\theight,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tselectedStyle,\n\t\t\t\t\t\toutlineStyle,\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t\t<View style={ styles.flex }>{ addonRight }</View>\n\t\t</View>\n\t);\n};\n\nexport default SegmentedControls;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/segmented-control/index.native.js"],"names":["ANIMATION_DURATION","isIOS","Platform","OS","Segment","isSelected","title","onPress","onLayout","props","isSelectedIOS","segmentStyle","styles","segment","segmentIOS","textStyle","buttonTextDefault","buttonTextDefaultDark","selectedTextStyle","buttonTextSelected","buttonTextSelectedDark","shadowStyle","shadowIOS","SegmentedControls","segments","segmentHandler","selectedIndex","addonLeft","addonRight","selectedSegmentIndex","activeSegmentIndex","setActiveSegmentIndex","segmentsDimensions","setSegmentsDimensions","width","height","positionAnimationValue","Animated","Value","setValue","calculateEndValue","containerStyle","container","containerDark","performSwatchAnimation","index","timing","toValue","duration","easing","Easing","ease","useNativeDriver","start","paddingLeft","offset","containerIOS","widths","Object","values","map","dimension","widthsDistance","slice","widthsDistanceSum","reduce","sum","n","endValue","onHandlePress","segmentOnLayout","event","nativeEvent","layout","selectedStyle","selected","selectedDark","outlineStyle","outline","outlineIOS","row","flex","length","left"],"mappings":";;;;;;;;;AAcA;;AAXA;;AAYA;;AAKA;;AACA;;AArBA;AACA;AACA;;AASA;AACA;AACA;;AAIA;AACA;AACA;AAIA,MAAMA,kBAAkB,GAAG,GAA3B;AAEA,MAAMC,KAAK,GAAGC,sBAASC,EAAT,KAAgB,KAA9B;;AAEA,MAAMC,OAAO,GAAG,CAAE;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,KAAd;AAAqBC,EAAAA,OAArB;AAA8BC,EAAAA,QAA9B;AAAwC,KAAGC;AAA3C,CAAF,KAA0D;AACzE,QAAMC,aAAa,GAAGT,KAAK,IAAII,UAA/B;AAEA,QAAMM,YAAY,GAAG,CAAEC,eAAOC,OAAT,EAAkBZ,KAAK,IAAIW,eAAOE,UAAlC,CAArB;AAEA,QAAMC,SAAS,GAAG,2CACjBH,eAAOI,iBADU,EAEjBJ,eAAOK,qBAFU,CAAlB;AAIA,QAAMC,iBAAiB,GAAG,2CACzBN,eAAOO,kBADkB,EAEzBP,eAAOQ,sBAFkB,CAA1B;AAIA,QAAMC,WAAW,GAAG,2CAA8BT,eAAOU,SAArC,EAAgD,EAAhD,CAApB;AAEA,SACC,4BAAC,iBAAD;AAAM,I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ARtB;AAWC,MAAA,iBAAiB,EAAG,QAXrB;AAYC,MAAA,kBAAkB,EAAGhC,OAZtB;AAaC,MAAA,iBAAiB,EAAI,GAAGgC,KAAK,GAAG,CAAG,OAClCrB,QAAQ,CAAC0D,MACT;AAfF,MADD;AAmBA,GApBC,CADH,EAsBC,4BAAC,qBAAD,CAAU,IAAV;AACC,IAAA,KAAK,EAAG,CACP;AACChD,MAAAA,KADD;AAECiD,MAAAA,IAAI,EAAE/C,sBAFP;AAGCD,MAAAA;AAHD,KADO,EAMPuC,aANO,EAOPG,YAPO;AADT,IAtBD,CAFD,EAoCC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGjE,eAAOqE;AAArB,KAA8BrD,UAA9B,CApCD,CADD;AAwCA,CAjID;;eAmIeL,iB","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tView,\n\tTouchableWithoutFeedback,\n\tText,\n\tPlatform,\n\tAnimated,\n\tEasing,\n} from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { performLayoutAnimation } from '../layout-animation';\nimport styles from './style.scss';\n\nconst ANIMATION_DURATION = 200;\n\nconst isIOS = Platform.OS === 'ios';\n\nconst Segment = ( { isSelected, title, onPress, onLayout, ...props } ) => {\n\tconst isSelectedIOS = isIOS && isSelected;\n\n\tconst segmentStyle = [ styles.segment, isIOS && styles.segmentIOS ];\n\n\tconst textStyle = usePreferredColorSchemeStyle(\n\t\tstyles.buttonTextDefault,\n\t\tstyles.buttonTextDefaultDark\n\t);\n\tconst selectedTextStyle = usePreferredColorSchemeStyle(\n\t\tstyles.buttonTextSelected,\n\t\tstyles.buttonTextSelectedDark\n\t);\n\tconst shadowStyle = usePreferredColorSchemeStyle( styles.shadowIOS, {} );\n\n\treturn (\n\t\t<View style={ isSelectedIOS && shadowStyle }>\n\t\t\t<TouchableWithoutFeedback onPress={ onPress }>\n\t\t\t\t<View style={ segmentStyle } onLayout={ onLayout } { ...props }>\n\t\t\t\t\t<Text\n\t\t\t\t\t\tstyle={ [ textStyle, isSelected && selectedTextStyle ] }\n\t\t\t\t\t\tmaxFontSizeMultiplier={ 2 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t</View>\n\t);\n};\n\nconst SegmentedControls = ( {\n\tsegments,\n\tsegmentHandler,\n\tselectedIndex,\n\taddonLeft,\n\taddonRight,\n} ) => {\n\tconst selectedSegmentIndex = selectedIndex || 0;\n\tconst [ activeSegmentIndex, setActiveSegmentIndex ] =\n\t\tuseState( selectedSegmentIndex );\n\tconst [ segmentsDimensions, setSegmentsDimensions ] = useState( {\n\t\t[ activeSegmentIndex ]: { width: 0, height: 0 },\n\t} );\n\tconst [ positionAnimationValue ] = useState( new Animated.Value( 0 ) );\n\n\tuseEffect( () => {\n\t\tsetActiveSegmentIndex( selectedSegmentIndex );\n\t\tsegmentHandler( segments[ selectedSegmentIndex ] );\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tpositionAnimationValue.setValue(\n\t\t\tcalculateEndValue( activeSegmentIndex )\n\t\t);\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ segmentsDimensions ] );\n\n\tconst containerStyle = usePreferredColorSchemeStyle(\n\t\tstyles.container,\n\t\tstyles.containerDark\n\t);\n\n\tfunction performSwatchAnimation( index ) {\n\t\tAnimated.timing( positionAnimationValue, {\n\t\t\ttoValue: calculateEndValue( index ),\n\t\t\tduration: ANIMATION_DURATION,\n\t\t\teasing: Easing.ease,\n\t\t\tuseNativeDriver: false,\n\t\t} ).start();\n\t}\n\n\tfunction calculateEndValue( index ) {\n\t\tconst { paddingLeft: offset } = isIOS\n\t\t\t? styles.containerIOS\n\t\t\t: styles.container;\n\t\tconst widths = Object.values( segmentsDimensions ).map(\n\t\t\t( dimension ) => dimension.width\n\t\t);\n\t\tconst widthsDistance = widths.slice( 0, index );\n\t\tconst widthsDistanceSum = widthsDistance.reduce(\n\t\t\t( sum, n ) => sum + n,\n\t\t\t0\n\t\t);\n\n\t\tconst endValue = index === 0 ? 0 : widthsDistanceSum;\n\t\treturn endValue + offset;\n\t}\n\n\tfunction onHandlePress( segment, index ) {\n\t\tperformLayoutAnimation( ANIMATION_DURATION );\n\t\tsetActiveSegmentIndex( index );\n\t\tsegmentHandler( segment );\n\t\tperformSwatchAnimation( index );\n\t}\n\n\tfunction segmentOnLayout( event, index ) {\n\t\tconst { width, height } = event.nativeEvent.layout;\n\n\t\tsetSegmentsDimensions( {\n\t\t\t...segmentsDimensions,\n\t\t\t[ index ]: { width, height },\n\t\t} );\n\t}\n\n\tconst selectedStyle = usePreferredColorSchemeStyle(\n\t\tstyles.selected,\n\t\tstyles.selectedDark\n\t);\n\n\tconst width = segmentsDimensions[ activeSegmentIndex ]?.width;\n\tconst height = segmentsDimensions[ activeSegmentIndex ]?.height;\n\n\tconst outlineStyle = [ styles.outline, isIOS && styles.outlineIOS ];\n\n\treturn (\n\t\t<View style={ styles.row }>\n\t\t\t<View style={ styles.flex }>{ addonLeft }</View>\n\t\t\t<View style={ [ containerStyle, isIOS && styles.containerIOS ] }>\n\t\t\t\t{ segments.map( ( segment, index ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Segment\n\t\t\t\t\t\t\ttitle={ segment }\n\t\t\t\t\t\t\tonPress={ () => onHandlePress( segment, index ) }\n\t\t\t\t\t\t\tisSelected={ activeSegmentIndex === index }\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonLayout={ ( event ) =>\n\t\t\t\t\t\t\t\tsegmentOnLayout( event, index )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\tselected: activeSegmentIndex === index,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\taccessibilityLabel={ segment }\n\t\t\t\t\t\t\taccessibilityHint={ `${ index + 1 } on ${\n\t\t\t\t\t\t\t\tsegments.length\n\t\t\t\t\t\t\t}` }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t<Animated.View\n\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\tleft: positionAnimationValue,\n\t\t\t\t\t\t\theight,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tselectedStyle,\n\t\t\t\t\t\toutlineStyle,\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t\t<View style={ styles.flex }>{ addonRight }</View>\n\t\t</View>\n\t);\n};\n\nexport default SegmentedControls;\n"]}
|
package/build/modal/index.js
CHANGED
|
@@ -9,8 +9,6 @@ exports.default = exports.Modal = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
13
|
|
|
16
14
|
var _compose = require("@wordpress/compose");
|
|
@@ -164,7 +162,7 @@ function UnforwardedModal(props, forwardedRef) {
|
|
|
164
162
|
onKeyDown: handleEscapeKeyDown
|
|
165
163
|
}, (0, _element.createElement)(_styleProvider.default, {
|
|
166
164
|
document: document
|
|
167
|
-
}, (0, _element.createElement)("div",
|
|
165
|
+
}, (0, _element.createElement)("div", {
|
|
168
166
|
className: (0, _classnames.default)('components-modal__frame', className, {
|
|
169
167
|
'is-full-screen': isFullScreen
|
|
170
168
|
}),
|
|
@@ -174,10 +172,10 @@ function UnforwardedModal(props, forwardedRef) {
|
|
|
174
172
|
"aria-label": contentLabel,
|
|
175
173
|
"aria-labelledby": contentLabel ? undefined : headingId,
|
|
176
174
|
"aria-describedby": aria.describedby,
|
|
177
|
-
tabIndex: -1
|
|
178
|
-
|
|
175
|
+
tabIndex: -1,
|
|
176
|
+
...(shouldCloseOnClickOutside ? focusOutsideProps : {}),
|
|
179
177
|
onKeyDown: onKeyDown
|
|
180
|
-
}
|
|
178
|
+
}, (0, _element.createElement)("div", {
|
|
181
179
|
className: (0, _classnames.default)('components-modal__content', {
|
|
182
180
|
'hide-header': __experimentalHideHeader,
|
|
183
181
|
'is-scrollable': hasScrollableContent,
|
package/build/modal/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/modal/index.tsx"],"names":["openModalCount","UnforwardedModal","props","forwardedRef","bodyOpenClassName","role","title","focusOnMount","shouldCloseOnEsc","shouldCloseOnClickOutside","isDismissible","aria","labelledby","undefined","describedby","onRequestClose","icon","closeButtonLabel","children","style","overlayClassName","className","contentLabel","onKeyDown","isFullScreen","__experimentalHideHeader","ref","instanceId","Modal","headingId","focusOnMountRef","constrainedTabbingRef","focusReturnRef","focusOutsideProps","contentRef","childrenContainerRef","hasScrolledContent","setHasScrolledContent","hasScrollableContent","setHasScrollableContent","isContentScrollable","current","closestScrollContainer","ariaHelper","hideApp","document","body","classList","add","remove","showApp","window","ResizeObserver","resizeObserver","observe","disconnect","handleEscapeKeyDown","event","nativeEvent","isComposing","keyCode","code","defaultPrevented","preventDefault","onContentContainerScroll","e","scrollY","currentTarget","scrollTop","close"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAeA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;;;;;AAnCA;AACA;AACA;;AAIA;AACA;AACA;;AAsBA;AACA;AACA;AAMA;AACA,IAAIA,cAAc,GAAG,CAArB;;AAEA,SAASC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vFH,CAAP;AAyFA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMlB,KAAK,GAAG,yBAAY3B,gBAAZ,CAAd;;eAEQ2B,K","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ForwardedRef, KeyboardEvent, UIEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreatePortal,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n\tforwardRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport {\n\tuseInstanceId,\n\tuseFocusReturn,\n\tuseFocusOnMount,\n\t__experimentalUseFocusOutside as useFocusOutside,\n\tuseConstrainedTabbing,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { close } from '@wordpress/icons';\nimport { getScrollContainer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport * as ariaHelper from './aria-helper';\nimport Button from '../button';\nimport StyleProvider from '../style-provider';\nimport type { ModalProps } from './types';\n\n// Used to count the number of open modals.\nlet openModalCount = 0;\n\nfunction UnforwardedModal(\n\tprops: ModalProps,\n\tforwardedRef: ForwardedRef< HTMLDivElement >\n) {\n\tconst {\n\t\tbodyOpenClassName = 'modal-open',\n\t\trole = 'dialog',\n\t\ttitle = null,\n\t\tfocusOnMount = true,\n\t\tshouldCloseOnEsc = true,\n\t\tshouldCloseOnClickOutside = true,\n\t\tisDismissible = true,\n\t\t/* Accessibility. */\n\t\taria = {\n\t\t\tlabelledby: undefined,\n\t\t\tdescribedby: undefined,\n\t\t},\n\t\tonRequestClose,\n\t\ticon,\n\t\tcloseButtonLabel,\n\t\tchildren,\n\t\tstyle,\n\t\toverlayClassName,\n\t\tclassName,\n\t\tcontentLabel,\n\t\tonKeyDown,\n\t\tisFullScreen = false,\n\t\t__experimentalHideHeader = false,\n\t} = props;\n\n\tconst ref = useRef< HTMLDivElement >();\n\tconst instanceId = useInstanceId( Modal );\n\tconst headingId = title\n\t\t? `components-modal-header-${ instanceId }`\n\t\t: aria.labelledby;\n\tconst focusOnMountRef = useFocusOnMount( focusOnMount );\n\tconst constrainedTabbingRef = useConstrainedTabbing();\n\tconst focusReturnRef = useFocusReturn();\n\tconst focusOutsideProps = useFocusOutside( onRequestClose );\n\tconst contentRef = useRef< HTMLDivElement >( null );\n\tconst childrenContainerRef = useRef< HTMLDivElement >( null );\n\n\tconst [ hasScrolledContent, setHasScrolledContent ] = useState( false );\n\tconst [ hasScrollableContent, setHasScrollableContent ] = useState( false );\n\n\t// Determines whether the Modal content is scrollable and updates the state.\n\tconst isContentScrollable = useCallback( () => {\n\t\tif ( ! contentRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst closestScrollContainer = getScrollContainer( contentRef.current );\n\n\t\tif ( contentRef.current === closestScrollContainer ) {\n\t\t\tsetHasScrollableContent( true );\n\t\t} else {\n\t\t\tsetHasScrollableContent( false );\n\t\t}\n\t}, [ contentRef ] );\n\n\tuseEffect( () => {\n\t\topenModalCount++;\n\n\t\tif ( openModalCount === 1 ) {\n\t\t\tariaHelper.hideApp( ref.current );\n\t\t\tdocument.body.classList.add( bodyOpenClassName );\n\t\t}\n\n\t\treturn () => {\n\t\t\topenModalCount--;\n\n\t\t\tif ( openModalCount === 0 ) {\n\t\t\t\tdocument.body.classList.remove( bodyOpenClassName );\n\t\t\t\tariaHelper.showApp();\n\t\t\t}\n\t\t};\n\t}, [ bodyOpenClassName ] );\n\n\t// Calls the isContentScrollable callback when the Modal children container resizes.\n\tuseLayoutEffect( () => {\n\t\tif ( ! window.ResizeObserver || ! childrenContainerRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst resizeObserver = new ResizeObserver( isContentScrollable );\n\t\tresizeObserver.observe( childrenContainerRef.current );\n\n\t\tisContentScrollable();\n\n\t\treturn () => {\n\t\t\tresizeObserver.disconnect();\n\t\t};\n\t}, [ isContentScrollable, childrenContainerRef ] );\n\n\tfunction handleEscapeKeyDown( event: KeyboardEvent< HTMLDivElement > ) {\n\t\tif (\n\t\t\t// Ignore keydowns from IMEs\n\t\t\tevent.nativeEvent.isComposing ||\n\t\t\t// Workaround for Mac Safari where the final Enter/Backspace of an IME composition\n\t\t\t// is `isComposing=false`, even though it's technically still part of the composition.\n\t\t\t// These can only be detected by keyCode.\n\t\t\tevent.keyCode === 229\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tshouldCloseOnEsc &&\n\t\t\tevent.code === 'Escape' &&\n\t\t\t! event.defaultPrevented\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\tif ( onRequestClose ) {\n\t\t\t\tonRequestClose( event );\n\t\t\t}\n\t\t}\n\t}\n\n\tconst onContentContainerScroll = useCallback(\n\t\t( e: UIEvent< HTMLDivElement > ) => {\n\t\t\tconst scrollY = e?.currentTarget?.scrollTop ?? -1;\n\n\t\t\tif ( ! hasScrolledContent && scrollY > 0 ) {\n\t\t\t\tsetHasScrolledContent( true );\n\t\t\t} else if ( hasScrolledContent && scrollY <= 0 ) {\n\t\t\t\tsetHasScrolledContent( false );\n\t\t\t}\n\t\t},\n\t\t[ hasScrolledContent ]\n\t);\n\n\treturn createPortal(\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tref={ useMergeRefs( [ ref, forwardedRef ] ) }\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-modal__screen-overlay',\n\t\t\t\toverlayClassName\n\t\t\t) }\n\t\t\tonKeyDown={ handleEscapeKeyDown }\n\t\t>\n\t\t\t<StyleProvider document={ document }>\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'components-modal__frame',\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-full-screen': isFullScreen,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ style }\n\t\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\t\tconstrainedTabbingRef,\n\t\t\t\t\t\tfocusReturnRef,\n\t\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t\t] ) }\n\t\t\t\t\trole={ role }\n\t\t\t\t\taria-label={ contentLabel }\n\t\t\t\t\taria-labelledby={ contentLabel ? undefined : headingId }\n\t\t\t\t\taria-describedby={ aria.describedby }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t{ ...( shouldCloseOnClickOutside\n\t\t\t\t\t\t? focusOutsideProps\n\t\t\t\t\t\t: {} ) }\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( 'components-modal__content', {\n\t\t\t\t\t\t\t'hide-header': __experimentalHideHeader,\n\t\t\t\t\t\t\t'is-scrollable': hasScrollableContent,\n\t\t\t\t\t\t\t'has-scrolled-content': hasScrolledContent,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\trole=\"document\"\n\t\t\t\t\t\tonScroll={ onContentContainerScroll }\n\t\t\t\t\t\tref={ contentRef }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\thasScrollableContent\n\t\t\t\t\t\t\t\t? __( 'Scrollable section' )\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttabIndex={ hasScrollableContent ? 0 : undefined }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! __experimentalHideHeader && (\n\t\t\t\t\t\t\t<div className=\"components-modal__header\">\n\t\t\t\t\t\t\t\t<div className=\"components-modal__header-heading-container\">\n\t\t\t\t\t\t\t\t\t{ icon && (\n\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-modal__icon-container\"\n\t\t\t\t\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ icon }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ title && (\n\t\t\t\t\t\t\t\t\t\t<h1\n\t\t\t\t\t\t\t\t\t\t\tid={ headingId }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-modal__header-heading\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t{ isDismissible && (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tonClick={ onRequestClose }\n\t\t\t\t\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\tcloseButtonLabel || __( 'Close' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<div ref={ childrenContainerRef }>{ children }</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</StyleProvider>\n\t\t</div>,\n\t\tdocument.body\n\t);\n}\n\n/**\n * Modals give users information and choices related to a task they’re trying to\n * accomplish. They can contain critical information, require decisions, or\n * involve multiple tasks.\n *\n * ```jsx\n * import { Button, Modal } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyModal = () => {\n * const [ isOpen, setOpen ] = useState( false );\n * const openModal = () => setOpen( true );\n * const closeModal = () => setOpen( false );\n *\n * return (\n * <>\n * <Button variant=\"secondary\" onClick={ openModal }>\n * Open Modal\n * </Button>\n * { isOpen && (\n * <Modal title=\"This is my modal\" onRequestClose={ closeModal }>\n * <Button variant=\"secondary\" onClick={ closeModal }>\n * My custom close button\n * </Button>\n * </Modal>\n * ) }\n * </>\n * );\n * };\n * ```\n */\nexport const Modal = forwardRef( UnforwardedModal );\n\nexport default Modal;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/modal/index.tsx"],"names":["openModalCount","UnforwardedModal","props","forwardedRef","bodyOpenClassName","role","title","focusOnMount","shouldCloseOnEsc","shouldCloseOnClickOutside","isDismissible","aria","labelledby","undefined","describedby","onRequestClose","icon","closeButtonLabel","children","style","overlayClassName","className","contentLabel","onKeyDown","isFullScreen","__experimentalHideHeader","ref","instanceId","Modal","headingId","focusOnMountRef","constrainedTabbingRef","focusReturnRef","focusOutsideProps","contentRef","childrenContainerRef","hasScrolledContent","setHasScrolledContent","hasScrollableContent","setHasScrollableContent","isContentScrollable","current","closestScrollContainer","ariaHelper","hideApp","document","body","classList","add","remove","showApp","window","ResizeObserver","resizeObserver","observe","disconnect","handleEscapeKeyDown","event","nativeEvent","isComposing","keyCode","code","defaultPrevented","preventDefault","onContentContainerScroll","e","scrollY","currentTarget","scrollTop","close"],"mappings":";;;;;;;;;AASA;;AANA;;AAeA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;;;;;AAnCA;AACA;AACA;;AAIA;AACA;AACA;;AAsBA;AACA;AACA;AAMA;AACA,IAAIA,cAAc,GAAG,CAArB;;AAEA,SAASC,gBAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AACLC,IAAAA,iBAAiB,GAAG,YADf;AAELC,IAAAA,IAAI,GAAG,QAFF;AAGLC,IAAAA,KAAK,GAAG,IAHH;AAILC,IAAAA,YAAY,GAAG,IAJV;AAKLC,IAAAA,gBAAgB,GAAG,IALd;AAMLC,IAAAA,yBAAyB,GAAG,IANvB;AAOLC,IAAAA,aAAa,GAAG,IAPX;;AAQL;AACAC,IAAAA,IAAI,GAAG;AACNC,MAAAA,UAAU,EAAEC,SADN;AAENC,MAAAA,WAAW,EAAED;AAFP,KATF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,EAAyC;AACpD,qBAAeE,wBADqC;AAEpD,uBAAiBa,oBAFmC;AAGpD,8BAAwBF;AAH4B,KAAzC,CADb;AAMC,IAAA,IAAI,EAAC,UANN;AAOC,IAAA,QAAQ,EAAG4B,wBAPZ;AAQC,IAAA,GAAG,EAAG9B,UARP;AASC,kBACCI,oBAAoB,GACjB,cAAI,oBAAJ,CADiB,GAEjBzB,SAZL;AAcC,IAAA,QAAQ,EAAGyB,oBAAoB,GAAG,CAAH,GAAOzB;AAdvC,KAgBG,CAAEY,wBAAF,IACD;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGT,IAAI,IACL;AACC,IAAA,SAAS,EAAC,kCADX;AAEC;AAFD,KAIGA,IAJH,CAFF,EASGV,KAAK,IACN;AACC,IAAA,EAAE,EAAGuB,SADN;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGvB,KAJH,CAVF,CADD,EAmBGI,aAAa,IACd,4BAAC,eAAD;AACC,IAAA,OAAO,EAAGK,cADX;AAEC,IAAA,IAAI,EAAGsD,YAFR;AAGC,IAAA,KAAK,EACJpD,gBAAgB,IAAI,cAAI,OAAJ;AAJtB,IApBF,CAjBF,EA+CC;AAAK,IAAA,GAAG,EAAGkB;AAAX,KAAoCjB,QAApC,CA/CD,CAxBD,CADD,CARD,CAFM,EAuFN2B,QAAQ,CAACC,IAvFH,CAAP;AAyFA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMlB,KAAK,GAAG,yBAAY3B,gBAAZ,CAAd;;eAEQ2B,K","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ForwardedRef, KeyboardEvent, UIEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreatePortal,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n\tforwardRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport {\n\tuseInstanceId,\n\tuseFocusReturn,\n\tuseFocusOnMount,\n\t__experimentalUseFocusOutside as useFocusOutside,\n\tuseConstrainedTabbing,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { close } from '@wordpress/icons';\nimport { getScrollContainer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport * as ariaHelper from './aria-helper';\nimport Button from '../button';\nimport StyleProvider from '../style-provider';\nimport type { ModalProps } from './types';\n\n// Used to count the number of open modals.\nlet openModalCount = 0;\n\nfunction UnforwardedModal(\n\tprops: ModalProps,\n\tforwardedRef: ForwardedRef< HTMLDivElement >\n) {\n\tconst {\n\t\tbodyOpenClassName = 'modal-open',\n\t\trole = 'dialog',\n\t\ttitle = null,\n\t\tfocusOnMount = true,\n\t\tshouldCloseOnEsc = true,\n\t\tshouldCloseOnClickOutside = true,\n\t\tisDismissible = true,\n\t\t/* Accessibility. */\n\t\taria = {\n\t\t\tlabelledby: undefined,\n\t\t\tdescribedby: undefined,\n\t\t},\n\t\tonRequestClose,\n\t\ticon,\n\t\tcloseButtonLabel,\n\t\tchildren,\n\t\tstyle,\n\t\toverlayClassName,\n\t\tclassName,\n\t\tcontentLabel,\n\t\tonKeyDown,\n\t\tisFullScreen = false,\n\t\t__experimentalHideHeader = false,\n\t} = props;\n\n\tconst ref = useRef< HTMLDivElement >();\n\tconst instanceId = useInstanceId( Modal );\n\tconst headingId = title\n\t\t? `components-modal-header-${ instanceId }`\n\t\t: aria.labelledby;\n\tconst focusOnMountRef = useFocusOnMount( focusOnMount );\n\tconst constrainedTabbingRef = useConstrainedTabbing();\n\tconst focusReturnRef = useFocusReturn();\n\tconst focusOutsideProps = useFocusOutside( onRequestClose );\n\tconst contentRef = useRef< HTMLDivElement >( null );\n\tconst childrenContainerRef = useRef< HTMLDivElement >( null );\n\n\tconst [ hasScrolledContent, setHasScrolledContent ] = useState( false );\n\tconst [ hasScrollableContent, setHasScrollableContent ] = useState( false );\n\n\t// Determines whether the Modal content is scrollable and updates the state.\n\tconst isContentScrollable = useCallback( () => {\n\t\tif ( ! contentRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst closestScrollContainer = getScrollContainer( contentRef.current );\n\n\t\tif ( contentRef.current === closestScrollContainer ) {\n\t\t\tsetHasScrollableContent( true );\n\t\t} else {\n\t\t\tsetHasScrollableContent( false );\n\t\t}\n\t}, [ contentRef ] );\n\n\tuseEffect( () => {\n\t\topenModalCount++;\n\n\t\tif ( openModalCount === 1 ) {\n\t\t\tariaHelper.hideApp( ref.current );\n\t\t\tdocument.body.classList.add( bodyOpenClassName );\n\t\t}\n\n\t\treturn () => {\n\t\t\topenModalCount--;\n\n\t\t\tif ( openModalCount === 0 ) {\n\t\t\t\tdocument.body.classList.remove( bodyOpenClassName );\n\t\t\t\tariaHelper.showApp();\n\t\t\t}\n\t\t};\n\t}, [ bodyOpenClassName ] );\n\n\t// Calls the isContentScrollable callback when the Modal children container resizes.\n\tuseLayoutEffect( () => {\n\t\tif ( ! window.ResizeObserver || ! childrenContainerRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst resizeObserver = new ResizeObserver( isContentScrollable );\n\t\tresizeObserver.observe( childrenContainerRef.current );\n\n\t\tisContentScrollable();\n\n\t\treturn () => {\n\t\t\tresizeObserver.disconnect();\n\t\t};\n\t}, [ isContentScrollable, childrenContainerRef ] );\n\n\tfunction handleEscapeKeyDown( event: KeyboardEvent< HTMLDivElement > ) {\n\t\tif (\n\t\t\t// Ignore keydowns from IMEs\n\t\t\tevent.nativeEvent.isComposing ||\n\t\t\t// Workaround for Mac Safari where the final Enter/Backspace of an IME composition\n\t\t\t// is `isComposing=false`, even though it's technically still part of the composition.\n\t\t\t// These can only be detected by keyCode.\n\t\t\tevent.keyCode === 229\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tshouldCloseOnEsc &&\n\t\t\tevent.code === 'Escape' &&\n\t\t\t! event.defaultPrevented\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\tif ( onRequestClose ) {\n\t\t\t\tonRequestClose( event );\n\t\t\t}\n\t\t}\n\t}\n\n\tconst onContentContainerScroll = useCallback(\n\t\t( e: UIEvent< HTMLDivElement > ) => {\n\t\t\tconst scrollY = e?.currentTarget?.scrollTop ?? -1;\n\n\t\t\tif ( ! hasScrolledContent && scrollY > 0 ) {\n\t\t\t\tsetHasScrolledContent( true );\n\t\t\t} else if ( hasScrolledContent && scrollY <= 0 ) {\n\t\t\t\tsetHasScrolledContent( false );\n\t\t\t}\n\t\t},\n\t\t[ hasScrolledContent ]\n\t);\n\n\treturn createPortal(\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tref={ useMergeRefs( [ ref, forwardedRef ] ) }\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-modal__screen-overlay',\n\t\t\t\toverlayClassName\n\t\t\t) }\n\t\t\tonKeyDown={ handleEscapeKeyDown }\n\t\t>\n\t\t\t<StyleProvider document={ document }>\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'components-modal__frame',\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-full-screen': isFullScreen,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ style }\n\t\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\t\tconstrainedTabbingRef,\n\t\t\t\t\t\tfocusReturnRef,\n\t\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t\t] ) }\n\t\t\t\t\trole={ role }\n\t\t\t\t\taria-label={ contentLabel }\n\t\t\t\t\taria-labelledby={ contentLabel ? undefined : headingId }\n\t\t\t\t\taria-describedby={ aria.describedby }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t{ ...( shouldCloseOnClickOutside\n\t\t\t\t\t\t? focusOutsideProps\n\t\t\t\t\t\t: {} ) }\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( 'components-modal__content', {\n\t\t\t\t\t\t\t'hide-header': __experimentalHideHeader,\n\t\t\t\t\t\t\t'is-scrollable': hasScrollableContent,\n\t\t\t\t\t\t\t'has-scrolled-content': hasScrolledContent,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\trole=\"document\"\n\t\t\t\t\t\tonScroll={ onContentContainerScroll }\n\t\t\t\t\t\tref={ contentRef }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\thasScrollableContent\n\t\t\t\t\t\t\t\t? __( 'Scrollable section' )\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttabIndex={ hasScrollableContent ? 0 : undefined }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! __experimentalHideHeader && (\n\t\t\t\t\t\t\t<div className=\"components-modal__header\">\n\t\t\t\t\t\t\t\t<div className=\"components-modal__header-heading-container\">\n\t\t\t\t\t\t\t\t\t{ icon && (\n\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-modal__icon-container\"\n\t\t\t\t\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ icon }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ title && (\n\t\t\t\t\t\t\t\t\t\t<h1\n\t\t\t\t\t\t\t\t\t\t\tid={ headingId }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-modal__header-heading\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t{ isDismissible && (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tonClick={ onRequestClose }\n\t\t\t\t\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\tcloseButtonLabel || __( 'Close' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<div ref={ childrenContainerRef }>{ children }</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</StyleProvider>\n\t\t</div>,\n\t\tdocument.body\n\t);\n}\n\n/**\n * Modals give users information and choices related to a task they’re trying to\n * accomplish. They can contain critical information, require decisions, or\n * involve multiple tasks.\n *\n * ```jsx\n * import { Button, Modal } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyModal = () => {\n * const [ isOpen, setOpen ] = useState( false );\n * const openModal = () => setOpen( true );\n * const closeModal = () => setOpen( false );\n *\n * return (\n * <>\n * <Button variant=\"secondary\" onClick={ openModal }>\n * Open Modal\n * </Button>\n * { isOpen && (\n * <Modal title=\"This is my modal\" onRequestClose={ closeModal }>\n * <Button variant=\"secondary\" onClick={ closeModal }>\n * My custom close button\n * </Button>\n * </Modal>\n * ) }\n * </>\n * );\n * };\n * ```\n */\nexport const Modal = forwardRef( UnforwardedModal );\n\nexport default Modal;\n"]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -9,8 +7,6 @@ exports.default = void 0;
|
|
|
9
7
|
|
|
10
8
|
var _element = require("@wordpress/element");
|
|
11
9
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _dom = require("@wordpress/dom");
|
|
15
11
|
|
|
16
12
|
/**
|
|
@@ -182,17 +178,18 @@ class NavigableContainer extends _element.Component {
|
|
|
182
178
|
forwardedRef,
|
|
183
179
|
...restProps
|
|
184
180
|
} = this.props;
|
|
185
|
-
return (0, _element.createElement)("div",
|
|
186
|
-
ref: this.bindContainer
|
|
187
|
-
|
|
181
|
+
return (0, _element.createElement)("div", {
|
|
182
|
+
ref: this.bindContainer,
|
|
183
|
+
...restProps
|
|
184
|
+
}, children);
|
|
188
185
|
}
|
|
189
186
|
|
|
190
187
|
}
|
|
191
188
|
|
|
192
189
|
const forwardedNavigableContainer = (props, ref) => {
|
|
193
|
-
return (0, _element.createElement)(NavigableContainer,
|
|
190
|
+
return (0, _element.createElement)(NavigableContainer, { ...props,
|
|
194
191
|
forwardedRef: ref
|
|
195
|
-
})
|
|
192
|
+
});
|
|
196
193
|
};
|
|
197
194
|
|
|
198
195
|
forwardedNavigableContainer.displayName = 'NavigableContainer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigable-container/container.tsx"],"names":["noop","MENU_ITEM_ROLES","cycleValue","value","total","offset","nextValue","NavigableContainer","Component","constructor","args","onKeyDown","bind","bindContainer","getFocusableContext","getFocusableIndex","componentDidMount","container","addEventListener","componentWillUnmount","removeEventListener","ref","forwardedRef","props","current","target","onlyBrowserTabstops","finder","focus","tabbable","focusable","focusables","find","index","indexOf","event","cycle","eventToOffset","onNavigate","stopNavigationEvents","undefined","stopImmediatePropagation","targetRole","getAttribute","targetHasMenuItemRole","includes","preventDefault","activeElement","ownerDocument","context","nextIndex","length","code","render","children","restProps","forwardedNavigableContainer","displayName"],"mappings":";;;;;;;;;AAQA;;;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AAC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,IAAN,KAAe,KAApB,EAA4B;AAC3BjB,QAAAA,KAAK,CAACW,cAAN;AACA;AACD;AACD;;AAEDO,EAAAA,MAAM,GAAG;AACR,UAAM;AACLC,MAAAA,QADK;AAELf,MAAAA,oBAFK;AAGLF,MAAAA,aAHK;AAILC,MAAAA,UAJK;AAKL3B,MAAAA,SALK;AAMLyB,MAAAA,KANK;AAOLV,MAAAA,mBAPK;AAQLJ,MAAAA,YARK;AASL,SAAGiC;AATE,QAUF,KAAKhC,KAVT;AAWA,WACC;AAAK,MAAA,GAAG,EAAG,KAAKV;AAAhB,OAAqC0C,SAArC,GACGD,QADH,CADD;AAKA;;AApJoE;;AAuJtE,MAAME,2BAA2B,GAAG,CACnCjC,KADmC,EAEnCF,GAFmC,KAG/B;AACJ,SAAO,4BAAC,kBAAD,6BAAyBE,KAAzB;AAAiC,IAAA,YAAY,EAAGF;AAAhD,KAAP;AACA,CALD;;AAMAmC,2BAA2B,CAACC,WAA5B,GAA0C,oBAA1C;;eAEe,yBAAYD,2BAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Component, forwardRef } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport type { NavigableContainerProps } from './types';\n\nconst noop = () => {};\nconst MENU_ITEM_ROLES = [ 'menuitem', 'menuitemradio', 'menuitemcheckbox' ];\n\nfunction cycleValue( value: number, total: number, offset: number ) {\n\tconst nextValue = value + offset;\n\tif ( nextValue < 0 ) {\n\t\treturn total + nextValue;\n\t} else if ( nextValue >= total ) {\n\t\treturn nextValue - total;\n\t}\n\n\treturn nextValue;\n}\n\nclass NavigableContainer extends Component< NavigableContainerProps > {\n\tcontainer?: HTMLDivElement;\n\n\tconstructor( args: NavigableContainerProps ) {\n\t\tsuper( args );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.bindContainer = this.bindContainer.bind( this );\n\n\t\tthis.getFocusableContext = this.getFocusableContext.bind( this );\n\t\tthis.getFocusableIndex = this.getFocusableIndex.bind( this );\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( ! this.container ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We use DOM event listeners instead of React event listeners\n\t\t// because we want to catch events from the underlying DOM tree\n\t\t// The React Tree can be different from the DOM tree when using\n\t\t// portals. Block Toolbars for instance are rendered in a separate\n\t\t// React Trees.\n\t\tthis.container.addEventListener( 'keydown', this.onKeyDown );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( ! this.container ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.container.removeEventListener( 'keydown', this.onKeyDown );\n\t}\n\n\tbindContainer( ref: HTMLDivElement ) {\n\t\tconst { forwardedRef } = this.props;\n\t\tthis.container = ref;\n\n\t\tif ( typeof forwardedRef === 'function' ) {\n\t\t\tforwardedRef( ref );\n\t\t} else if ( forwardedRef && 'current' in forwardedRef ) {\n\t\t\tforwardedRef.current = ref;\n\t\t}\n\t}\n\n\tgetFocusableContext( target: Element ) {\n\t\tif ( ! this.container ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { onlyBrowserTabstops } = this.props;\n\t\tconst finder = onlyBrowserTabstops ? focus.tabbable : focus.focusable;\n\t\tconst focusables = finder.find( this.container ) as HTMLElement[];\n\n\t\tconst index = this.getFocusableIndex( focusables, target );\n\t\tif ( index > -1 && target ) {\n\t\t\treturn { index, target, focusables };\n\t\t}\n\t\treturn null;\n\t}\n\n\tgetFocusableIndex( focusables: Element[], target: Element ) {\n\t\treturn focusables.indexOf( target );\n\t}\n\n\tonKeyDown( event: KeyboardEvent ) {\n\t\tif ( this.props.onKeyDown ) {\n\t\t\tthis.props.onKeyDown( event );\n\t\t}\n\n\t\tconst { getFocusableContext } = this;\n\t\tconst {\n\t\t\tcycle = true,\n\t\t\teventToOffset,\n\t\t\tonNavigate = noop,\n\t\t\tstopNavigationEvents,\n\t\t} = this.props;\n\n\t\tconst offset = eventToOffset( event );\n\n\t\t// eventToOffset returns undefined if the event is not handled by the component.\n\t\tif ( offset !== undefined && stopNavigationEvents ) {\n\t\t\t// Prevents arrow key handlers bound to the document directly interfering.\n\t\t\tevent.stopImmediatePropagation();\n\n\t\t\t// When navigating a collection of items, prevent scroll containers\n\t\t\t// from scrolling. The preventDefault also prevents Voiceover from\n\t\t\t// 'handling' the event, as voiceover will try to use arrow keys\n\t\t\t// for highlighting text.\n\t\t\tconst targetRole = (\n\t\t\t\tevent.target as HTMLDivElement | null\n\t\t\t )?.getAttribute( 'role' );\n\t\t\tconst targetHasMenuItemRole =\n\t\t\t\t!! targetRole && MENU_ITEM_ROLES.includes( targetRole );\n\n\t\t\tif ( targetHasMenuItemRole ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tif ( ! offset ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst activeElement = ( event.target as HTMLElement | null )\n\t\t\t?.ownerDocument?.activeElement;\n\t\tif ( ! activeElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst context = getFocusableContext( activeElement );\n\t\tif ( ! context ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { index, focusables } = context;\n\t\tconst nextIndex = cycle\n\t\t\t? cycleValue( index, focusables.length, offset )\n\t\t\t: index + offset;\n\n\t\tif ( nextIndex >= 0 && nextIndex < focusables.length ) {\n\t\t\tfocusables[ nextIndex ].focus();\n\t\t\tonNavigate( nextIndex, focusables[ nextIndex ] );\n\n\t\t\t// `preventDefault()` on tab to avoid having the browser move the focus\n\t\t\t// after this component has already moved it.\n\t\t\tif ( event.code === 'Tab' ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tchildren,\n\t\t\tstopNavigationEvents,\n\t\t\teventToOffset,\n\t\t\tonNavigate,\n\t\t\tonKeyDown,\n\t\t\tcycle,\n\t\t\tonlyBrowserTabstops,\n\t\t\tforwardedRef,\n\t\t\t...restProps\n\t\t} = this.props;\n\t\treturn (\n\t\t\t<div ref={ this.bindContainer } { ...restProps }>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nconst forwardedNavigableContainer = (\n\tprops: NavigableContainerProps,\n\tref: ForwardedRef< HTMLDivElement >\n) => {\n\treturn <NavigableContainer { ...props } forwardedRef={ ref } />;\n};\nforwardedNavigableContainer.displayName = 'NavigableContainer';\n\nexport default forwardRef( forwardedNavigableContainer );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigable-container/container.tsx"],"names":["noop","MENU_ITEM_ROLES","cycleValue","value","total","offset","nextValue","NavigableContainer","Component","constructor","args","onKeyDown","bind","bindContainer","getFocusableContext","getFocusableIndex","componentDidMount","container","addEventListener","componentWillUnmount","removeEventListener","ref","forwardedRef","props","current","target","onlyBrowserTabstops","finder","focus","tabbable","focusable","focusables","find","index","indexOf","event","cycle","eventToOffset","onNavigate","stopNavigationEvents","undefined","stopImmediatePropagation","targetRole","getAttribute","targetHasMenuItemRole","includes","preventDefault","activeElement","ownerDocument","context","nextIndex","length","code","render","children","restProps","forwardedNavigableContainer","displayName"],"mappings":";;;;;;;AAQA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AASA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,eAAe,GAAG,CAAE,UAAF,EAAc,eAAd,EAA+B,kBAA/B,CAAxB;;AAEA,SAASC,UAAT,CAAqBC,KAArB,EAAoCC,KAApC,EAAmDC,MAAnD,EAAoE;AACnE,QAAMC,SAAS,GAAGH,KAAK,GAAGE,MAA1B;;AACA,MAAKC,SAAS,GAAG,CAAjB,EAAqB;AACpB,WAAOF,KAAK,GAAGE,SAAf;AACA,GAFD,MAEO,IAAKA,SAAS,IAAIF,KAAlB,EAA0B;AAChC,WAAOE,SAAS,GAAGF,KAAnB;AACA;;AAED,SAAOE,SAAP;AACA;;AAED,MAAMC,kBAAN,SAAiC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nCjC,KADmC,EAEnCF,GAFmC,KAG/B;AACJ,SAAO,4BAAC,kBAAD,OAAyBE,KAAzB;AAAiC,IAAA,YAAY,EAAGF;AAAhD,IAAP;AACA,CALD;;AAMAmC,2BAA2B,CAACC,WAA5B,GAA0C,oBAA1C;;eAEe,yBAAYD,2BAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Component, forwardRef } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport type { NavigableContainerProps } from './types';\n\nconst noop = () => {};\nconst MENU_ITEM_ROLES = [ 'menuitem', 'menuitemradio', 'menuitemcheckbox' ];\n\nfunction cycleValue( value: number, total: number, offset: number ) {\n\tconst nextValue = value + offset;\n\tif ( nextValue < 0 ) {\n\t\treturn total + nextValue;\n\t} else if ( nextValue >= total ) {\n\t\treturn nextValue - total;\n\t}\n\n\treturn nextValue;\n}\n\nclass NavigableContainer extends Component< NavigableContainerProps > {\n\tcontainer?: HTMLDivElement;\n\n\tconstructor( args: NavigableContainerProps ) {\n\t\tsuper( args );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.bindContainer = this.bindContainer.bind( this );\n\n\t\tthis.getFocusableContext = this.getFocusableContext.bind( this );\n\t\tthis.getFocusableIndex = this.getFocusableIndex.bind( this );\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( ! this.container ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We use DOM event listeners instead of React event listeners\n\t\t// because we want to catch events from the underlying DOM tree\n\t\t// The React Tree can be different from the DOM tree when using\n\t\t// portals. Block Toolbars for instance are rendered in a separate\n\t\t// React Trees.\n\t\tthis.container.addEventListener( 'keydown', this.onKeyDown );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( ! this.container ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.container.removeEventListener( 'keydown', this.onKeyDown );\n\t}\n\n\tbindContainer( ref: HTMLDivElement ) {\n\t\tconst { forwardedRef } = this.props;\n\t\tthis.container = ref;\n\n\t\tif ( typeof forwardedRef === 'function' ) {\n\t\t\tforwardedRef( ref );\n\t\t} else if ( forwardedRef && 'current' in forwardedRef ) {\n\t\t\tforwardedRef.current = ref;\n\t\t}\n\t}\n\n\tgetFocusableContext( target: Element ) {\n\t\tif ( ! this.container ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { onlyBrowserTabstops } = this.props;\n\t\tconst finder = onlyBrowserTabstops ? focus.tabbable : focus.focusable;\n\t\tconst focusables = finder.find( this.container ) as HTMLElement[];\n\n\t\tconst index = this.getFocusableIndex( focusables, target );\n\t\tif ( index > -1 && target ) {\n\t\t\treturn { index, target, focusables };\n\t\t}\n\t\treturn null;\n\t}\n\n\tgetFocusableIndex( focusables: Element[], target: Element ) {\n\t\treturn focusables.indexOf( target );\n\t}\n\n\tonKeyDown( event: KeyboardEvent ) {\n\t\tif ( this.props.onKeyDown ) {\n\t\t\tthis.props.onKeyDown( event );\n\t\t}\n\n\t\tconst { getFocusableContext } = this;\n\t\tconst {\n\t\t\tcycle = true,\n\t\t\teventToOffset,\n\t\t\tonNavigate = noop,\n\t\t\tstopNavigationEvents,\n\t\t} = this.props;\n\n\t\tconst offset = eventToOffset( event );\n\n\t\t// eventToOffset returns undefined if the event is not handled by the component.\n\t\tif ( offset !== undefined && stopNavigationEvents ) {\n\t\t\t// Prevents arrow key handlers bound to the document directly interfering.\n\t\t\tevent.stopImmediatePropagation();\n\n\t\t\t// When navigating a collection of items, prevent scroll containers\n\t\t\t// from scrolling. The preventDefault also prevents Voiceover from\n\t\t\t// 'handling' the event, as voiceover will try to use arrow keys\n\t\t\t// for highlighting text.\n\t\t\tconst targetRole = (\n\t\t\t\tevent.target as HTMLDivElement | null\n\t\t\t )?.getAttribute( 'role' );\n\t\t\tconst targetHasMenuItemRole =\n\t\t\t\t!! targetRole && MENU_ITEM_ROLES.includes( targetRole );\n\n\t\t\tif ( targetHasMenuItemRole ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tif ( ! offset ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst activeElement = ( event.target as HTMLElement | null )\n\t\t\t?.ownerDocument?.activeElement;\n\t\tif ( ! activeElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst context = getFocusableContext( activeElement );\n\t\tif ( ! context ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { index, focusables } = context;\n\t\tconst nextIndex = cycle\n\t\t\t? cycleValue( index, focusables.length, offset )\n\t\t\t: index + offset;\n\n\t\tif ( nextIndex >= 0 && nextIndex < focusables.length ) {\n\t\t\tfocusables[ nextIndex ].focus();\n\t\t\tonNavigate( nextIndex, focusables[ nextIndex ] );\n\n\t\t\t// `preventDefault()` on tab to avoid having the browser move the focus\n\t\t\t// after this component has already moved it.\n\t\t\tif ( event.code === 'Tab' ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tchildren,\n\t\t\tstopNavigationEvents,\n\t\t\teventToOffset,\n\t\t\tonNavigate,\n\t\t\tonKeyDown,\n\t\t\tcycle,\n\t\t\tonlyBrowserTabstops,\n\t\t\tforwardedRef,\n\t\t\t...restProps\n\t\t} = this.props;\n\t\treturn (\n\t\t\t<div ref={ this.bindContainer } { ...restProps }>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nconst forwardedNavigableContainer = (\n\tprops: NavigableContainerProps,\n\tref: ForwardedRef< HTMLDivElement >\n) => {\n\treturn <NavigableContainer { ...props } forwardedRef={ ref } />;\n};\nforwardedNavigableContainer.displayName = 'NavigableContainer';\n\nexport default forwardRef( forwardedNavigableContainer );\n"]}
|
|
@@ -11,8 +11,6 @@ exports.default = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _element = require("@wordpress/element");
|
|
13
13
|
|
|
14
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
-
|
|
16
14
|
var _container = _interopRequireDefault(require("./container"));
|
|
17
15
|
|
|
18
16
|
/**
|
|
@@ -62,14 +60,15 @@ function UnforwardedNavigableMenu({
|
|
|
62
60
|
return undefined;
|
|
63
61
|
};
|
|
64
62
|
|
|
65
|
-
return (0, _element.createElement)(_container.default,
|
|
63
|
+
return (0, _element.createElement)(_container.default, {
|
|
66
64
|
ref: ref,
|
|
67
65
|
stopNavigationEvents: true,
|
|
68
66
|
onlyBrowserTabstops: false,
|
|
69
67
|
role: role,
|
|
70
68
|
"aria-orientation": role !== 'presentation' && (orientation === 'vertical' || orientation === 'horizontal') ? orientation : undefined,
|
|
71
|
-
eventToOffset: eventToOffset
|
|
72
|
-
|
|
69
|
+
eventToOffset: eventToOffset,
|
|
70
|
+
...rest
|
|
71
|
+
});
|
|
73
72
|
}
|
|
74
73
|
/**
|
|
75
74
|
* A container for a navigable menu.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigable-container/menu.tsx"],"names":["UnforwardedNavigableMenu","role","orientation","rest","ref","eventToOffset","evt","code","next","previous","includes","undefined","NavigableMenu"],"mappings":";;;;;;;;;;;AAQA
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigable-container/menu.tsx"],"names":["UnforwardedNavigableMenu","role","orientation","rest","ref","eventToOffset","evt","code","next","previous","includes","undefined","NavigableMenu"],"mappings":";;;;;;;;;;;AAQA;;AAKA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAIO,SAASA,wBAAT,CACN;AAAEC,EAAAA,IAAI,GAAG,MAAT;AAAiBC,EAAAA,WAAW,GAAG,UAA/B;AAA2C,KAAGC;AAA9C,CADM,EAENC,GAFM,EAGL;AACD,QAAMC,aAAa,GAAKC,GAAF,IAA0B;AAC/C,UAAM;AAAEC,MAAAA;AAAF,QAAWD,GAAjB;AAEA,QAAIE,IAAI,GAAG,CAAE,WAA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type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport NavigableContainer from './container';\nimport type { NavigableMenuProps } from './types';\n\nexport function UnforwardedNavigableMenu(\n\t{ role = 'menu', orientation = 'vertical', ...rest }: NavigableMenuProps,\n\tref: ForwardedRef< any >\n) {\n\tconst eventToOffset = ( evt: KeyboardEvent ) => {\n\t\tconst { code } = evt;\n\n\t\tlet next = [ 'ArrowDown' ];\n\t\tlet previous = [ 'ArrowUp' ];\n\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\tnext = [ 'ArrowRight' ];\n\t\t\tprevious = [ 'ArrowLeft' ];\n\t\t}\n\n\t\tif ( orientation === 'both' ) {\n\t\t\tnext = [ 'ArrowRight', 'ArrowDown' ];\n\t\t\tprevious = [ 'ArrowLeft', 'ArrowUp' ];\n\t\t}\n\n\t\tif ( next.includes( code ) ) {\n\t\t\treturn 1;\n\t\t} else if ( previous.includes( code ) ) {\n\t\t\treturn -1;\n\t\t} else if (\n\t\t\t[ 'ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight' ].includes(\n\t\t\t\tcode\n\t\t\t)\n\t\t) {\n\t\t\t// Key press should be handled, e.g. have event propagation and\n\t\t\t// default behavior handled by NavigableContainer but not result\n\t\t\t// in an offset.\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn undefined;\n\t};\n\n\treturn (\n\t\t<NavigableContainer\n\t\t\tref={ ref }\n\t\t\tstopNavigationEvents\n\t\t\tonlyBrowserTabstops={ false }\n\t\t\trole={ role }\n\t\t\taria-orientation={\n\t\t\t\trole !== 'presentation' &&\n\t\t\t\t( orientation === 'vertical' || orientation === 'horizontal' )\n\t\t\t\t\t? orientation\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\teventToOffset={ eventToOffset }\n\t\t\t{ ...rest }\n\t\t/>\n\t);\n}\n\n/**\n * A container for a navigable menu.\n *\n * ```jsx\n * import {\n * NavigableMenu,\n * Button,\n * } from '@wordpress/components';\n *\n * function onNavigate( index, target ) {\n * console.log( `Navigates to ${ index }`, target );\n * }\n *\n * const MyNavigableContainer = () => (\n * <div>\n * <span>Navigable Menu:</span>\n * <NavigableMenu onNavigate={ onNavigate } orientation=\"horizontal\">\n * <Button variant=\"secondary\">Item 1</Button>\n * <Button variant=\"secondary\">Item 2</Button>\n * <Button variant=\"secondary\">Item 3</Button>\n * </NavigableMenu>\n * </div>\n * );\n * ```\n */\nexport const NavigableMenu = forwardRef( UnforwardedNavigableMenu );\n\nexport default NavigableMenu;\n"]}
|
|
@@ -11,8 +11,6 @@ exports.default = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _element = require("@wordpress/element");
|
|
13
13
|
|
|
14
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
-
|
|
16
14
|
var _container = _interopRequireDefault(require("./container"));
|
|
17
15
|
|
|
18
16
|
/**
|
|
@@ -58,12 +56,13 @@ function UnforwardedTabbableContainer({
|
|
|
58
56
|
return undefined;
|
|
59
57
|
};
|
|
60
58
|
|
|
61
|
-
return (0, _element.createElement)(_container.default,
|
|
59
|
+
return (0, _element.createElement)(_container.default, {
|
|
62
60
|
ref: ref,
|
|
63
61
|
stopNavigationEvents: true,
|
|
64
62
|
onlyBrowserTabstops: true,
|
|
65
|
-
eventToOffset: innerEventToOffset
|
|
66
|
-
|
|
63
|
+
eventToOffset: innerEventToOffset,
|
|
64
|
+
...props
|
|
65
|
+
});
|
|
67
66
|
}
|
|
68
67
|
/**
|
|
69
68
|
* A container for tabbable elements.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigable-container/tabbable.tsx"],"names":["UnforwardedTabbableContainer","eventToOffset","props","ref","innerEventToOffset","evt","code","shiftKey","undefined","TabbableContainer"],"mappings":";;;;;;;;;;;AAQA
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigable-container/tabbable.tsx"],"names":["UnforwardedTabbableContainer","eventToOffset","props","ref","innerEventToOffset","evt","code","shiftKey","undefined","TabbableContainer"],"mappings":";;;;;;;;;;;AAQA;;AAKA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAIO,SAASA,4BAAT,CACN;AAAEC,EAAAA,aAAF;AAAiB,KAAGC;AAApB,CADM,EAENC,GAFM,EAGL;AACD,QAAMC,kBAAkB,GAAKC,GAAF,IAA0B;AACpD,UAAM;AAAEC,MAAAA,IAAF;AAAQC,MAAAA;AAAR,QAAqBF,GAA3B;;AACA,QAAK,UAAUC,IAAf,EAAsB;AACrB,aAAOC,QAAQ,GAAG,CAAC,CAAJ,GAAQ,CAAvB;AACA,KAJmD,CAMpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,QAAKN,aAAL,EAAqB;AACpB,aAAOA,aAAa,CAAEI,GAAF,CAApB;AACA;;AAED,WAAOG,SAAP;AACA,GAtBD;;AAwBA,SACC,4BAAC,kBAAD;AACC,IAAA,GAAG,EAAGL,GADP;AAEC,IAAA,oBAAoB,MAFrB;AAGC,IAAA,mBAAmB,MAHpB;AAIC,IAAA,aAAa,EAAGC,kBAJjB;AAAA,OAKMF;AALN,IADD;AASA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMO,iBAAiB,GAAG,yBAAYT,4BAAZ,CAA1B;;eAEQS,iB","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport NavigableContainer from './container';\nimport type { TabbableContainerProps } from './types';\n\nexport function UnforwardedTabbableContainer(\n\t{ eventToOffset, ...props }: TabbableContainerProps,\n\tref: ForwardedRef< any >\n) {\n\tconst innerEventToOffset = ( evt: KeyboardEvent ) => {\n\t\tconst { code, shiftKey } = evt;\n\t\tif ( 'Tab' === code ) {\n\t\t\treturn shiftKey ? -1 : 1;\n\t\t}\n\n\t\t// Allow custom handling of keys besides Tab.\n\t\t//\n\t\t// By default, TabbableContainer will move focus forward on Tab and\n\t\t// backward on Shift+Tab. The handler below will be used for all other\n\t\t// events. The semantics for `eventToOffset`'s return\n\t\t// values are the following:\n\t\t//\n\t\t// - +1: move focus forward\n\t\t// - -1: move focus backward\n\t\t// - 0: don't move focus, but acknowledge event and thus stop it\n\t\t// - undefined: do nothing, let the event propagate.\n\t\tif ( eventToOffset ) {\n\t\t\treturn eventToOffset( evt );\n\t\t}\n\n\t\treturn undefined;\n\t};\n\n\treturn (\n\t\t<NavigableContainer\n\t\t\tref={ ref }\n\t\t\tstopNavigationEvents\n\t\t\tonlyBrowserTabstops\n\t\t\teventToOffset={ innerEventToOffset }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\n/**\n * A container for tabbable elements.\n *\n * ```jsx\n * import {\n * TabbableContainer,\n * Button,\n * } from '@wordpress/components';\n *\n * function onNavigate( index, target ) {\n * console.log( `Navigates to ${ index }`, target );\n * }\n *\n * const MyTabbableContainer = () => (\n * <div>\n * <span>Tabbable Container:</span>\n * <TabbableContainer onNavigate={ onNavigate }>\n * <Button variant=\"secondary\" tabIndex=\"0\">\n * Section 1\n * </Button>\n * <Button variant=\"secondary\" tabIndex=\"0\">\n * Section 2\n * </Button>\n * <Button variant=\"secondary\" tabIndex=\"0\">\n * Section 3\n * </Button>\n * <Button variant=\"secondary\" tabIndex=\"0\">\n * Section 4\n * </Button>\n * </TabbableContainer>\n * </div>\n * );\n * ```\n */\nexport const TabbableContainer = forwardRef( UnforwardedTabbableContainer );\n\nexport default TabbableContainer;\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = NavigationItemBase;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
13
|
|
|
16
14
|
var _context = require("../context");
|
|
@@ -52,8 +50,9 @@ function NavigationItemBase(props) {
|
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
const classes = (0, _classnames.default)('components-navigation__item', className);
|
|
55
|
-
return (0, _element.createElement)(_navigationStyles.ItemBaseUI,
|
|
56
|
-
className: classes
|
|
57
|
-
|
|
53
|
+
return (0, _element.createElement)(_navigationStyles.ItemBaseUI, {
|
|
54
|
+
className: classes,
|
|
55
|
+
...restProps
|
|
56
|
+
}, children);
|
|
58
57
|
}
|
|
59
58
|
//# sourceMappingURL=base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigation/item/base.tsx"],"names":["uniqueId","NavigationItemBase","props","children","className","title","href","restProps","itemId","navigationTree","getItem","_isVisible","classes"],"mappings":";;;;;;;;;AAQA
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigation/item/base.tsx"],"names":["uniqueId","NavigationItemBase","props","children","className","title","href","restProps","itemId","navigationTree","getItem","_isVisible","classes"],"mappings":";;;;;;;;;AAQA;;AALA;;AAUA;;AACA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAOA,IAAIA,QAAQ,GAAG,CAAf;;AAEe,SAASC,kBAAT,CAA6BC,KAA7B,EAA8D;AAC5E;AACA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA,KAAvB;AAA8BC,IAAAA,IAA9B;AAAoC,OAAGC;AAAvC,MAAqDL,KAA3D;AAEA,QAAM,CAAEM,MAAF,IAAa,uBAAW,QAAQ,EAAER,QAAU,EAA/B,CAAnB;AAEA,oDAAuBQ,MAAvB,EAA+BN,KAA/B;AACA,QAAM;AAAEO,IAAAA;AAAF,MAAqB,oCAA3B;;AAEA,MAAK,CAAEA,cAAc,CAACC,OAAf,CAAwBF,MAAxB,GAAkCG,UAAzC,EAAsD;AACrD,WAAO,IAAP;AACA;;AAED,QAAMC,OAAO,GAAG,yBAAY,6BAAZ,EAA2CR,SAA3C,CAAhB;AAEA,SACC,4BAAC,4BAAD;AAAY,IAAA,SAAS,EAAGQ,OAAxB;AAAA,OAAuCL;AAAvC,KACGJ,QADH,CADD;AAKA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useNavigationContext } from '../context';\nimport { useNavigationTreeItem } from './use-navigation-tree-item';\nimport { ItemBaseUI } from '../styles/navigation-styles';\n\nimport type { NavigationItemBaseProps } from '../types';\n\nlet uniqueId = 0;\n\nexport default function NavigationItemBase( props: NavigationItemBaseProps ) {\n\t// Also avoid to pass the `title` and `href` props to the ItemBaseUI styled component.\n\tconst { children, className, title, href, ...restProps } = props;\n\n\tconst [ itemId ] = useState( `item-${ ++uniqueId }` );\n\n\tuseNavigationTreeItem( itemId, props );\n\tconst { navigationTree } = useNavigationContext();\n\n\tif ( ! navigationTree.getItem( itemId )?._isVisible ) {\n\t\treturn null;\n\t}\n\n\tconst classes = classnames( 'components-navigation__item', className );\n\n\treturn (\n\t\t<ItemBaseUI className={ classes } { ...restProps }>\n\t\t\t{ children }\n\t\t</ItemBaseUI>\n\t);\n}\n"]}
|
|
@@ -10,8 +10,6 @@ exports.default = void 0;
|
|
|
10
10
|
|
|
11
11
|
var _element = require("@wordpress/element");
|
|
12
12
|
|
|
13
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
|
-
|
|
15
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
14
|
|
|
17
15
|
var _icons = require("@wordpress/icons");
|
|
@@ -94,9 +92,10 @@ function NavigationItem(props) {
|
|
|
94
92
|
'aria-current': isActive ? 'page' : undefined,
|
|
95
93
|
...restProps
|
|
96
94
|
};
|
|
97
|
-
return (0, _element.createElement)(_base.default,
|
|
95
|
+
return (0, _element.createElement)(_base.default, { ...baseProps,
|
|
98
96
|
className: classes
|
|
99
|
-
}
|
|
97
|
+
}, children || (0, _element.createElement)(_navigationStyles.ItemUI, { ...itemProps
|
|
98
|
+
}, icon && (0, _element.createElement)(_navigationStyles.ItemIconUI, null, (0, _element.createElement)(_icons.Icon, {
|
|
100
99
|
icon: icon
|
|
101
100
|
})), (0, _element.createElement)(_baseContent.default, {
|
|
102
101
|
title: title,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigation/item/index.tsx"],"names":["noop","NavigationItem","props","badge","children","className","href","item","navigateToMenu","onClick","title","icon","hideIfTargetMenuEmpty","isText","restProps","activeItem","setActiveMenu","navigationTree","isMenuEmpty","isActive","classes","onItemClick","event","navigationIcon","chevronLeft","chevronRight","baseProps","undefined","itemProps","as","Button"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigation/item/index.tsx"],"names":["noop","NavigationItem","props","badge","children","className","href","item","navigateToMenu","onClick","title","icon","hideIfTargetMenuEmpty","isText","restProps","activeItem","setActiveMenu","navigationTree","isMenuEmpty","isActive","classes","onItemClick","event","navigationIcon","chevronLeft","chevronRight","baseProps","undefined","itemProps","as","Button"],"mappings":";;;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AASA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEO,SAASC,cAAT,CAAyBC,KAAzB,EAAsD;AAC5D,QAAM;AACLC,IAAAA,KADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,SAHK;AAILC,IAAAA,IAJK;AAKLC,IAAAA,IALK;AAMLC,IAAAA,cANK;AAO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AC,WAAD;AAAM,IAAA,IAAI,EAAGA;AAAb,IADD,CAFF,EAOC,4BAAC,oBAAD;AACC,IAAA,KAAK,EAAGD,KADT;AAEC,IAAA,KAAK,EAAGP;AAFT,IAPD,EAYGK,cAAc,IAAI,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAGe;AAAb,IAZrB,CAFF,CADD;AAoBA;;eAEctB,c","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Icon, chevronLeft, chevronRight } from '@wordpress/icons';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport { useNavigationContext } from '../context';\nimport { ItemUI, ItemIconUI } from '../styles/navigation-styles';\nimport NavigationItemBaseContent from './base-content';\nimport NavigationItemBase from './base';\n\nimport type { NavigationItemProps } from '../types';\n\nconst noop = () => {};\n\nexport function NavigationItem( props: NavigationItemProps ) {\n\tconst {\n\t\tbadge,\n\t\tchildren,\n\t\tclassName,\n\t\thref,\n\t\titem,\n\t\tnavigateToMenu,\n\t\tonClick = noop,\n\t\ttitle,\n\t\ticon,\n\t\thideIfTargetMenuEmpty,\n\t\tisText,\n\t\t...restProps\n\t} = props;\n\n\tconst {\n\t\tactiveItem,\n\t\tsetActiveMenu,\n\t\tnavigationTree: { isMenuEmpty },\n\t} = useNavigationContext();\n\n\t// If hideIfTargetMenuEmpty prop is true\n\t// And the menu we are supposed to navigate to\n\t// Is marked as empty, then we skip rendering the item.\n\tif (\n\t\thideIfTargetMenuEmpty &&\n\t\tnavigateToMenu &&\n\t\tisMenuEmpty( navigateToMenu )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst isActive = item && activeItem === item;\n\n\tconst classes = classnames( className, {\n\t\t'is-active': isActive,\n\t} );\n\n\tconst onItemClick: React.MouseEventHandler<\n\t\tHTMLButtonElement | HTMLAnchorElement\n\t> = ( event ) => {\n\t\tif ( navigateToMenu ) {\n\t\t\tsetActiveMenu( navigateToMenu );\n\t\t}\n\n\t\tonClick( event );\n\t};\n\tconst navigationIcon = isRTL() ? chevronLeft : chevronRight;\n\tconst baseProps = children ? props : { ...props, onClick: undefined };\n\tconst itemProps = isText\n\t\t? restProps\n\t\t: {\n\t\t\t\tas: Button,\n\t\t\t\thref,\n\t\t\t\tonClick: onItemClick,\n\t\t\t\t'aria-current': isActive ? 'page' : undefined,\n\t\t\t\t...restProps,\n\t\t };\n\n\treturn (\n\t\t<NavigationItemBase { ...baseProps } className={ classes }>\n\t\t\t{ children || (\n\t\t\t\t<ItemUI { ...itemProps }>\n\t\t\t\t\t{ icon && (\n\t\t\t\t\t\t<ItemIconUI>\n\t\t\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t\t\t</ItemIconUI>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<NavigationItemBaseContent\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\tbadge={ badge }\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ navigateToMenu && <Icon icon={ navigationIcon } /> }\n\t\t\t\t</ItemUI>\n\t\t\t) }\n\t\t</NavigationItemBase>\n\t);\n}\n\nexport default NavigationItem;\n"]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -9,8 +7,6 @@ exports.default = exports.NavigatorBackButton = void 0;
|
|
|
9
7
|
|
|
10
8
|
var _element = require("@wordpress/element");
|
|
11
9
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _context = require("../../ui/context");
|
|
15
11
|
|
|
16
12
|
var _view = require("../../view");
|
|
@@ -26,9 +22,10 @@ var _hook = require("./hook");
|
|
|
26
22
|
*/
|
|
27
23
|
function UnconnectedNavigatorBackButton(props, forwardedRef) {
|
|
28
24
|
const navigatorBackButtonProps = (0, _hook.useNavigatorBackButton)(props);
|
|
29
|
-
return (0, _element.createElement)(_view.View,
|
|
30
|
-
ref: forwardedRef
|
|
31
|
-
|
|
25
|
+
return (0, _element.createElement)(_view.View, {
|
|
26
|
+
ref: forwardedRef,
|
|
27
|
+
...navigatorBackButtonProps
|
|
28
|
+
});
|
|
32
29
|
}
|
|
33
30
|
/**
|
|
34
31
|
* The `NavigatorBackButton` component can be used to navigate to a screen and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-back-button/component.tsx"],"names":["UnconnectedNavigatorBackButton","props","forwardedRef","navigatorBackButtonProps","NavigatorBackButton"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-back-button/component.tsx"],"names":["UnconnectedNavigatorBackButton","props","forwardedRef","navigatorBackButtonProps","NavigatorBackButton"],"mappings":";;;;;;;;;AAQA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAMA,SAASA,8BAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,wBAAwB,GAAG,kCAAwBF,KAAxB,CAAjC;AAEA,SAAO,4BAAC,UAAD;AAAM,IAAA,GAAG,EAAGC,YAAZ;AAAA,OAAgCC;AAAhC,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,mBAAmB,GAAG,6BAClCJ,8BADkC,EAElC,qBAFkC,CAA5B;;eAKQI,mB","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport { View } from '../../view';\nimport { useNavigatorBackButton } from './hook';\nimport type { NavigatorBackButtonProps } from '../types';\n\nfunction UnconnectedNavigatorBackButton(\n\tprops: WordPressComponentProps< NavigatorBackButtonProps, 'button' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst navigatorBackButtonProps = useNavigatorBackButton( props );\n\n\treturn <View ref={ forwardedRef } { ...navigatorBackButtonProps } />;\n}\n\n/**\n * The `NavigatorBackButton` component can be used to navigate to a screen and\n * should be used in combination with the `NavigatorProvider`, the\n * `NavigatorScreen` and the `NavigatorButton` components (or the `useNavigator`\n * hook).\n *\n * @example\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalNavigatorButton as NavigatorButton,\n * __experimentalNavigatorBackButton as NavigatorBackButton,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>\n * Go back\n * </NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */\nexport const NavigatorBackButton = contextConnect(\n\tUnconnectedNavigatorBackButton,\n\t'NavigatorBackButton'\n);\n\nexport default NavigatorBackButton;\n"]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -9,8 +7,6 @@ exports.default = exports.NavigatorButton = void 0;
|
|
|
9
7
|
|
|
10
8
|
var _element = require("@wordpress/element");
|
|
11
9
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _context = require("../../ui/context");
|
|
15
11
|
|
|
16
12
|
var _view = require("../../view");
|
|
@@ -26,9 +22,10 @@ var _hook = require("./hook");
|
|
|
26
22
|
*/
|
|
27
23
|
function UnconnectedNavigatorButton(props, forwardedRef) {
|
|
28
24
|
const navigatorButtonProps = (0, _hook.useNavigatorButton)(props);
|
|
29
|
-
return (0, _element.createElement)(_view.View,
|
|
30
|
-
ref: forwardedRef
|
|
31
|
-
|
|
25
|
+
return (0, _element.createElement)(_view.View, {
|
|
26
|
+
ref: forwardedRef,
|
|
27
|
+
...navigatorButtonProps
|
|
28
|
+
});
|
|
32
29
|
}
|
|
33
30
|
/**
|
|
34
31
|
* The `NavigatorButton` component can be used to navigate to a screen and should
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-button/component.tsx"],"names":["UnconnectedNavigatorButton","props","forwardedRef","navigatorButtonProps","NavigatorButton"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-button/component.tsx"],"names":["UnconnectedNavigatorButton","props","forwardedRef","navigatorButtonProps","NavigatorButton"],"mappings":";;;;;;;;;AAQA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAMA,SAASA,0BAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,oBAAoB,GAAG,8BAAoBF,KAApB,CAA7B;AAEA,SAAO,4BAAC,UAAD;AAAM,IAAA,GAAG,EAAGC,YAAZ;AAAA,OAAgCC;AAAhC,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,eAAe,GAAG,6BAC9BJ,0BAD8B,EAE9B,iBAF8B,CAAxB;;eAKQI,e","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport { View } from '../../view';\nimport { useNavigatorButton } from './hook';\nimport type { NavigatorButtonProps } from '../types';\n\nfunction UnconnectedNavigatorButton(\n\tprops: WordPressComponentProps< NavigatorButtonProps, 'button' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst navigatorButtonProps = useNavigatorButton( props );\n\n\treturn <View ref={ forwardedRef } { ...navigatorButtonProps } />;\n}\n\n/**\n * The `NavigatorButton` component can be used to navigate to a screen and should\n * be used in combination with the `NavigatorProvider`, the `NavigatorScreen`\n * and the `NavigatorBackButton` components (or the `useNavigator` hook).\n *\n * @example\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalNavigatorButton as NavigatorButton,\n * __experimentalNavigatorBackButton as NavigatorBackButton,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>\n * Go back\n * </NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */\nexport const NavigatorButton = contextConnect(\n\tUnconnectedNavigatorButton,\n\t'NavigatorButton'\n);\n\nexport default NavigatorButton;\n"]}
|