UNPKG

@enact/sandstone

Version:

Large-screen/TV support library for Enact, containing a variety of UI components.

686 lines (677 loc) 29.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = exports.PopupBase = exports.Popup = void 0; var _keymap = require("@enact/core/keymap"); var _dispatcher = require("@enact/core/dispatcher"); var _FloatingLayer = _interopRequireDefault(require("@enact/ui/FloatingLayer")); var _kind = _interopRequireDefault(require("@enact/core/kind")); var _react = require("react"); var _propTypes = _interopRequireDefault(require("prop-types")); var _spotlight = _interopRequireWildcard(require("@enact/spotlight")); var _Pause = _interopRequireDefault(require("@enact/spotlight/Pause")); var _SpotlightContainerDecorator = _interopRequireDefault(require("@enact/spotlight/SpotlightContainerDecorator")); var _container = require("@enact/spotlight/src/container"); var _Transition = _interopRequireDefault(require("@enact/ui/Transition")); var _handle = require("@enact/core/handle"); var _warning = _interopRequireDefault(require("warning")); var _Skinnable = _interopRequireDefault(require("../Skinnable")); var _PopupModule = _interopRequireDefault(require("./Popup.module.css")); var _jsxRuntime = require("react/jsx-runtime"); var _excluded = ["children", "css", "direction", "noAnimation", "onHide", "onShow", "open", "position", "spotlightId", "spotlightRestrict", "transitionContainerClassName"], _excluded2 = ["noAutoDismiss", "scrimType"]; /** * Modal component that appears at the bottom of the screen and takes up the full screen width. * * @example * <Popup open>Hello!</Popup> * * @module sandstone/Popup * @exports Popup * @exports PopupBase */ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); } function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } var isDown = (0, _keymap.is)('down'); var isLeft = (0, _keymap.is)('left'); var isRight = (0, _keymap.is)('right'); var isUp = (0, _keymap.is)('up'); var TransitionContainer = (0, _SpotlightContainerDecorator["default"])({ enterTo: 'default-element', preserveId: true }, _Transition["default"]); var getContainerNode = function getContainerNode(containerId) { return document.querySelector("[data-spotlight-id='".concat(containerId, "']")); }; var forwardHide = (0, _handle.forward)('onHide'); var forwardShow = (0, _handle.forward)('onShow'); var transitionDirection = { bottom: 'down', center: 'down', fullscreen: 'down', left: 'left', right: 'right', top: 'up' }; /** * The base popup component. * * @class PopupBase * @memberof sandstone/Popup * @ui * @public */ var PopupBase = exports.PopupBase = (0, _kind["default"])({ name: 'PopupBase', propTypes: /** @lends sandstone/Popup.PopupBase.prototype */{ /** * The contents to be displayed in the body of the popup. * * @type {Node} * @required * @public */ children: _propTypes["default"].node.isRequired, /** * Set the priority with which screen reader should treat updates to live regions for the Popup. * * @type {String|Object} * @public */ 'aria-live': _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]), /** * Customizes the component by mapping the supplied collection of CSS class names to the * corresponding internal elements and states of this component. * * The following classes are supported: * * * `popup` - The root class name * * `body` - Applied to the body content container * * `popupTransitionContainer` - Applied to the Popup's outermost container. Sizing can be * applied here for percentage-of-screen values. * * `top` - Applied when the `position` is 'top' * * `right` - Applied when the `position` is 'right' * * `bottom` - Applied when the `position` is 'bottom' * * `left` - Applied when the `position` is 'left' * * @type {Object} * @private */ css: _propTypes["default"].object, /** * Support accessibility options. * * If true, the aria-live and role in Popup are `null`. * * @type {Boolean} * @default false * @private */ noAlertRole: _propTypes["default"].bool, /** * Disables transition animation. * * @type {Boolean} * @default false * @public */ noAnimation: _propTypes["default"].bool, /** * Disables the outline in high contrast mode. * * @type {Boolean} * @default false * @private */ noOutline: _propTypes["default"].bool, /** * Called after the popup's "hide" transition finishes. * * @type {Function} * @public */ onHide: _propTypes["default"].func, /** * Called after the popup's "show" transition finishes. * * @type {Function} * @public */ onShow: _propTypes["default"].func, /** * Controls the visibility of the Popup. * * By default, the Popup and its contents are not rendered until `open`. * * @type {Boolean} * @default false * @public */ open: _propTypes["default"].bool, /** * Position of the Popup on the screen. * * @type {('bottom'|'center'|'fullscreen'|'left'|'right'|'top')} * @default 'bottom' * @public */ position: _propTypes["default"].oneOf(['bottom', 'center', 'fullscreen', 'left', 'right', 'top']), /** * The ARIA role for the Popup. * * @type {String|Object} * @public */ role: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]), /** * The container id for {@link spotlight/SpotlightContainerDecorator/#SpotlightContainerDecorator.spotlightId|Spotlight container}. * * @type {String} * @default null * @public */ spotlightId: _propTypes["default"].string, /** * Restricts or prioritizes navigation when focus attempts to leave the popup. * * It can be either `'none'`, `'self-first'`, or `'self-only'`. * * Note: The ready-to-use {@link sandstone/Popup.Popup|Popup} component only supports * `'self-first'` and `'self-only'`. * * @type {('none'|'self-first'|'self-only')} * @default 'self-only' * @public */ spotlightRestrict: _propTypes["default"].oneOf(['none', 'self-first', 'self-only']) }, defaultProps: { noAlertRole: false, noAnimation: false, open: false, position: 'bottom', spotlightRestrict: 'self-only' }, styles: { css: _PopupModule["default"], className: 'popup', publicClassNames: ['popup', 'body', 'popupTransitionContainer', 'top', 'right', 'bottom', 'left'] }, computed: { // When passing `aria-live` prop to the Popup, the prop should work first. // If `noAlertRole` is true, alert role and aria-live will be removed. Contents of the popup won't be read automatically when opened. // Otherwise, `aria-live` will be usually `off`. 'aria-live': function ariaLive(_ref) { var live = _ref['aria-live'], noAlertRole = _ref.noAlertRole; return typeof live !== 'undefined' ? live : !noAlertRole && 'off' || null; }, className: function className(_ref2) { var noOutline = _ref2.noOutline, position = _ref2.position, styler = _ref2.styler; return styler.append(position, position === 'fullscreen' || noOutline ? null : _PopupModule["default"].outline); }, direction: function direction(_ref3) { var position = _ref3.position; return transitionDirection[position]; }, // When passing `role` prop to the Popup, the prop should work first. // If `noAlertRole` is true, alert role and aria-live will be removed. Contents of the popup won't be read automatically when opened. // Otherwise, `role` will be usually `alert`. role: function role(_ref4) { var noAlertRole = _ref4.noAlertRole, _role = _ref4.role; return typeof _role !== 'undefined' ? _role : !noAlertRole && 'alert' || null; }, transitionContainerClassName: function transitionContainerClassName(_ref5) { var css = _ref5.css, position = _ref5.position, styler = _ref5.styler; return styler.join(css.popupTransitionContainer, position); } }, render: function render(_ref6) { var children = _ref6.children, css = _ref6.css, direction = _ref6.direction, noAnimation = _ref6.noAnimation, onHide = _ref6.onHide, onShow = _ref6.onShow, open = _ref6.open, position = _ref6.position, spotlightId = _ref6.spotlightId, spotlightRestrict = _ref6.spotlightRestrict, transitionContainerClassName = _ref6.transitionContainerClassName, rest = _objectWithoutProperties(_ref6, _excluded); delete rest.noAlertRole; delete rest.noOutline; return /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionContainer, { className: transitionContainerClassName, css: css, direction: direction, duration: "short", noAnimation: position === 'fullscreen' ? true : noAnimation, onHide: onHide, onShow: onShow, spotlightDisabled: !open, spotlightId: spotlightId, spotlightRestrict: spotlightRestrict, type: "slide", visible: open, children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, rest), {}, { children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", { className: css.body, children: children }) })) }); } }); var SkinnedPopupBase = (0, _Skinnable["default"])(PopupBase); // Deprecate using scrimType 'none' with spotlightRestrict of 'self-only' var checkScrimNone = function checkScrimNone(props) { var validScrim = !(props.scrimType === 'none' && props.spotlightRestrict === 'self-only'); process.env.NODE_ENV !== "production" ? (0, _warning["default"])(validScrim, "Using 'spotlightRestrict' of 'self-only' without a scrim " + 'is not supported. Use a transparent scrim to prevent spotlight focus outside of the popup') : void 0; }; var OpenState = { CLOSED: 0, OPENING: 1, OPEN: 2 }; /** * A stateful component that renders a popup in a * {@link ui/FloatingLayer.FloatingLayer|FloatingLayer}. * * @class Popup * @memberof sandstone/Popup * @extends sandstone/Popup.PopupBase * @ui * @public */ var Popup = exports.Popup = /*#__PURE__*/function (_Component) { _inherits(Popup, _Component); var _super = _createSuper(Popup); function Popup(props) { var _this; _classCallCheck(this, Popup); _this = _super.call(this, props); _this.handleFloatingLayerOpen = function () { if (!_this.props.noAnimation && _this.state.popupOpen !== OpenState.OPEN) { _this.setState({ popupOpen: OpenState.OPENING }); } else if (_this.state.popupOpen === OpenState.OPEN && _this.props.open) { _this.spotPopupContent(); } }; _this.handleKeyDown = function (ev) { var _this$props = _this.props, onClose = _this$props.onClose, no5WayClose = _this$props.no5WayClose, position = _this$props.position, spotlightRestrict = _this$props.spotlightRestrict; if (no5WayClose) return; var containerId = _this.state.containerId; var keyCode = ev.keyCode; var direction = (0, _spotlight.getDirection)(keyCode); var spottables = _spotlight["default"].getSpottableDescendants(containerId).length; var current = _spotlight["default"].getCurrent(); if (direction && (!spottables || current && getContainerNode(containerId).contains(current))) { // explicitly restrict navigation in order to manage focus state when attempting to leave the popup _spotlight["default"].set(containerId, { restrict: 'self-only' }); if (onClose) { var focusChanged; if (spottables && current && spotlightRestrict !== 'self-only') { focusChanged = _spotlight["default"].move(direction); if (focusChanged) { // stop propagation to prevent default spotlight behavior ev.stopPropagation(); } } if (!spottables || focusChanged === false && (position === 'center' || isUp(keyCode) && position === 'bottom' || isDown(keyCode) && position === 'top' || isRight(keyCode) && position === 'left' || isLeft(keyCode) && position === 'right')) { // prevent default page scrolling ev.preventDefault(); // stop propagation to prevent default spotlight behavior ev.stopPropagation(); // set the pointer mode to false on keydown _spotlight["default"].setPointerMode(false); (0, _handle.forwardCustom)('onClose')(null, _this.props); } } } }; _this.handleDismiss = function (ev) { (0, _handle.forwardCustom)('onClose', function () { return { detail: ev === null || ev === void 0 ? void 0 : ev.detail }; })(null, _this.props); }; _this.handlePopupHide = function (ev) { forwardHide(ev, _this.props); _this.setState({ floatLayerOpen: false, activator: null }); if (!ev.currentTarget || ev.currentTarget.getAttribute('data-spotlight-id') === _this.state.containerId) { _this.spotActivator(_this.state.activator); } }; _this.handlePopupShow = function (ev) { forwardShow(ev, _this.props); _this.setState({ popupOpen: OpenState.OPEN }); if (!ev.currentTarget || ev.currentTarget.getAttribute('data-spotlight-id') === _this.state.containerId) { _this.spotPopupContent(); } }; _this.spotActivator = function (activator) { _this.paused.resume(); // only spot the activator if the popup is closed if (_this.props.open) return; var current = _spotlight["default"].getCurrent(); var containerNode = getContainerNode(_this.state.containerId); var lastContainerId = (0, _container.getLastContainer)(); (0, _dispatcher.off)('keydown', _this.handleKeyDown); // if there is no currently-spotted control or it is wrapped by the popup's container, we // know it's safe to change focus if (!current || containerNode && containerNode.contains(current)) { // attempt to set focus to the activator, if available if (!_spotlight["default"].isPaused()) { if (activator) { if (!_spotlight["default"].focus(activator)) { _spotlight["default"].focus(); } } else { _spotlight["default"].disableSelector(lastContainerId); _spotlight["default"].focus(); _spotlight["default"].enableSelector(lastContainerId); } } } }; _this.spotPopupContent = function () { _this.paused.resume(); // only spot the activator if the popup is open if (!_this.props.open) return; var containerId = _this.state.containerId; (0, _dispatcher.on)('keydown', _this.handleKeyDown); if (!_spotlight["default"].isPaused() && !_spotlight["default"].focus(containerId)) { var current = _spotlight["default"].getCurrent(); // In cases where the container contains no spottable controls or we're in pointer-mode, focus // cannot inherently set the active container or blur the active control, so we must do that // here. if (current) { current.blur(); } _spotlight["default"].setActiveContainer(containerId); } }; _this.paused = new _Pause["default"]('Popup'); _this.state = { floatLayerOpen: _this.props.open, popupOpen: _this.props.open ? OpenState.OPEN : OpenState.CLOSED, prevOpen: _this.props.open, containerId: _spotlight["default"].add(), activator: null }; checkScrimNone(_this.props); return _this; } // Spot the content after it's mounted. _createClass(Popup, [{ key: "componentDidMount", value: function componentDidMount() { if (this.props.open) { // If the popup is open on mount, we need to pause spotlight so nothing steals focus // while the popup is rendering. this.paused.pause(); if (getContainerNode(this.state.containerId)) { this.spotPopupContent(); } } } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps, prevState) { if (this.props.open !== prevProps.open) { if (!this.props.noAnimation) { if (!this.props.open && this.state.popupOpen === OpenState.CLOSED) { // If the popup is supposed to be closed (!this.props.open) and is actually // fully closed (OpenState.CLOSED), we must resume spotlight navigation. This // can occur when quickly toggling a Popup open and closed. this.paused.resume(); } else { // Otherwise, we pause spotlight so it is locked until the popup is ready this.paused.pause(); } } else if (this.props.open) { forwardShow(null, this.props); this.spotPopupContent(); } else if (prevProps.open) { forwardHide(null, this.props); this.spotActivator(prevState.activator); } } checkScrimNone(this.props); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { if (this.props.open) { (0, _dispatcher.off)('keydown', this.handleKeyDown); } _spotlight["default"].remove(this.state.containerId); } }, { key: "render", value: function render() { var _this$props2 = this.props, noAutoDismiss = _this$props2.noAutoDismiss, scrimType = _this$props2.scrimType, rest = _objectWithoutProperties(_this$props2, _excluded2); delete rest.no5WayClose; delete rest.onClose; return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FloatingLayer["default"], { noAutoDismiss: noAutoDismiss, open: this.state.floatLayerOpen, onOpen: this.handleFloatingLayerOpen, onDismiss: this.handleDismiss, scrimType: scrimType, children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SkinnedPopupBase, _objectSpread(_objectSpread({}, rest), {}, { "data-webos-voice-exclusive": true, onHide: this.handlePopupHide, onShow: this.handlePopupShow, open: this.state.popupOpen >= OpenState.OPENING, spotlightId: this.state.containerId })) }); } }], [{ key: "getDerivedStateFromProps", value: function getDerivedStateFromProps(props, state) { if (props.open !== state.prevOpen) { if (props.open) { return { popupOpen: props.noAnimation || state.floatLayerOpen ? OpenState.OPEN : OpenState.CLOSED, floatLayerOpen: true, activator: _spotlight["default"].getCurrent(), prevOpen: props.open }; } else { // Disables the spotlight conatiner of popup when `noAnimation` set if (props.noAnimation) { var node = getContainerNode(state.containerId); if (node) { node.dataset['spotlightContainerDisabled'] = true; } } return { popupOpen: OpenState.CLOSED, floatLayerOpen: state.popupOpen === OpenState.OPEN ? !props.noAnimation : false, activator: props.noAnimation ? null : state.activator, prevOpen: props.open }; } } return null; } }]); return Popup; }(_react.Component); Popup.propTypes = /** @lends sandstone/Popup.Popup.prototype */{ /** * Prevents closing the popup via 5-way navigation out of the content. * * @type {Boolean} * @default false * @private */ no5WayClose: _propTypes["default"].bool, /** * Disables transition animation. * * @type {Boolean} * @default false * @public */ noAnimation: _propTypes["default"].bool, /** * Indicates that the popup will not trigger `onClose` when the user presses the cancel/back (e.g. `ESC`) key or * taps outside of the popup. * * @type {Boolean} * @default false * @public */ noAutoDismiss: _propTypes["default"].bool, /** * Called on: * * * pressing `ESC` key, * * clicking on outside the boundary of the popup, or * * moving spotlight focus outside the boundary of the popup when `spotlightRestrict` is * `'self-first'`. * * Event payload: * * * pressing `ESC` key, carries `detail` property containing `inputType` value of `'key'`. * * clicking outside the boundary of the popup, carries `detail` property containing * `inputType` value of `'click'`. * * It is the responsibility of the callback to set the `open` property to `false`. * * @type {Function} * @public */ onClose: _propTypes["default"].func, /** * Called after hide transition has completed, and immediately with no transition. * * @type {Function} * @public */ onHide: _propTypes["default"].func, /** * Called when a key is pressed. * * @type {Function} * @public */ onKeyDown: _propTypes["default"].func, /** * Called after show transition has completed, and immediately with no transition. * * Note: The function does not run if Popup is initially opened and * {@link sandstone/Popup.PopupBase.noAnimation|noAnimation} is `true`. * * @type {Function} * @public */ onShow: _propTypes["default"].func, /** * Controls the visibility of the Popup. * * By default, the Popup and its contents are not rendered until `open`. * * @type {Boolean} * @default false * @public */ open: _propTypes["default"].bool, /** * Position of the Popup on the screen. * * @type {('bottom'|'center'|'fullscreen'|'left'|'right'|'top')} * @default 'bottom' * @public */ position: _propTypes["default"].oneOf(['bottom', 'center', 'fullscreen', 'left', 'right', 'top']), /** * Scrim type. * * * Values: `'transparent'`, `'translucent'`, or `'none'`. * * `'none'` is not compatible with `spotlightRestrict` of `'self-only'`, use a transparent scrim * to prevent mouse focus when using popup. * * @type {('transparent'|'translucent'|'none')} * @default 'translucent' * @public */ scrimType: _propTypes["default"].oneOf(['transparent', 'translucent', 'none']), /** * Restricts or prioritizes navigation when focus attempts to leave the popup. * * * Values: `'self-first'`, or `'self-only'`. * * When using `self-first`, attempts to leave the popup via 5-way will fire `onClose` based * on the following values of `position`: * * * `'bottom'` - When leaving via 5-way up * * `'top'` - When leaving via 5-way down * * `'left'` - When leaving via 5-way right * * `'right'` - When leaving via 5-way left * * `'center'` - When leaving via any 5-way direction * * Note: If `onClose` is not set, then this has no effect on 5-way navigation. If the popup * has no spottable children, 5-way navigation will cause the Popup to fire `onClose`. * * @type {('self-first'|'self-only')} * @default 'self-only' * @public */ spotlightRestrict: _propTypes["default"].oneOf(['self-first', 'self-only']) }; Popup.defaultProps = { noAnimation: false, noAutoDismiss: false, open: false, position: 'bottom', scrimType: 'translucent', spotlightRestrict: 'self-only' }; var _default = exports["default"] = Popup;