-
Notifications
You must be signed in to change notification settings - Fork 31
/
23644.8038a807.iframe.bundle.js
1 lines (1 loc) · 16.4 KB
/
23644.8038a807.iframe.bundle.js
1
"use strict";(globalThis.webpackChunkmetamask_crx=globalThis.webpackChunkmetamask_crx||[]).push([[23644],{"./ui/components/ui/box/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Ay:()=>_box__WEBPACK_IMPORTED_MODULE_0__.Ay,Ve:()=>_box__WEBPACK_IMPORTED_MODULE_0__.Ve});var _box__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./ui/components/ui/box/box.js")},"./ui/components/ui/popover/popover.component.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>PopoverPortal});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),react_dom__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react-dom/index.js"),react_dom__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__),prop_types__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/prop-types/index.js"),prop_types__WEBPACK_IMPORTED_MODULE_7___default=__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_7__),classnames__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__),_hooks_useI18nContext__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./ui/hooks/useI18nContext.js"),_box__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./ui/components/ui/box/index.js"),_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./ui/helpers/constants/design-system.ts"),_component_library__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./ui/components/component-library/index.ts");function _assert_this_initialized(self){if(void 0===self)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor))throw 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||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _get_prototype_of(o){return(_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_set_prototype_of(subClass,superClass)}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){return source=null!=source?source:{},Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}),target}function _possible_constructor_return(self,call){return call&&("object"===_type_of(call)||"function"==typeof call)?call:_assert_this_initialized(self)}function _set_prototype_of(o,p){return(_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){return o.__proto__=p,o})(o,p)}function _type_of(obj){return obj&&"undefined"!=typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj}function _is_native_reflect_construct(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _create_super(Derived){var hasNativeReflectConstruct=_is_native_reflect_construct();return function _createSuperInternal(){var result,Super=_get_prototype_of(Derived);return result=hasNativeReflectConstruct?Reflect.construct(Super,arguments,_get_prototype_of(this).constructor):Super.apply(this,arguments),_possible_constructor_return(this,result)}}var defaultHeaderProps={padding:[6,4,4],display:"flex",flexDirection:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.GO.COLUMN,backgroundColor:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.i0.backgroundDefault,borderRadius:"xl"},defaultContentProps={display:"flex",flexDirection:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.GO.COLUMN,justifyContent:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.A9.flexStart,alignItems:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.k2.stretch,borderRadius:"xl"},defaultFooterProps={display:"flex",justifyContent:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.A9.spaceBetween,padding:[4,6,6]},Popover=function(param){var title=param.title,_param_subtitle=param.subtitle,subtitle=void 0===_param_subtitle?"":_param_subtitle,children=param.children,footer=param.footer,footerClassName=param.footerClassName,onBack=param.onBack,onClose=param.onClose,onScroll=param.onScroll,className=param.className,contentClassName=param.contentClassName,showArrow=param.showArrow,CustomBackground=param.CustomBackground,popoverRef=param.popoverRef,showScrollDown=param.showScrollDown,onScrollDownButtonClick=param.onScrollDownButtonClick,centerTitle=param.centerTitle,wrapTitle=param.wrapTitle,_param_headerProps=param.headerProps,headerProps=void 0===_param_headerProps?defaultHeaderProps:_param_headerProps,_param_contentProps=param.contentProps,contentProps=void 0===_param_contentProps?defaultContentProps:_param_contentProps,_param_footerProps=param.footerProps,footerProps=void 0===_param_footerProps?defaultFooterProps:_param_footerProps,t=(0,_hooks_useI18nContext__WEBPACK_IMPORTED_MODULE_3__.P)(),showHeader=title||onBack||subtitle||onClose;return react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"popover-container"},CustomBackground?react__WEBPACK_IMPORTED_MODULE_0__.createElement(CustomBackground,{onClose:onClose}):react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"popover-bg",onClick:onClose}),react__WEBPACK_IMPORTED_MODULE_0__.createElement("section",{className:classnames__WEBPACK_IMPORTED_MODULE_2___default()("popover-wrap",className),ref:popoverRef},showArrow?react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"popover-arrow"}):null,showHeader&&react__WEBPACK_IMPORTED_MODULE_0__.createElement(function(){return react__WEBPACK_IMPORTED_MODULE_0__.createElement(_box__WEBPACK_IMPORTED_MODULE_4__.Ay,_object_spread_props(_object_spread({},defaultHeaderProps,headerProps),{className:"popover-header"}),react__WEBPACK_IMPORTED_MODULE_0__.createElement(_box__WEBPACK_IMPORTED_MODULE_4__.Ay,{display:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.Nu.FLEX,alignItems:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.k2.center,justifyContent:centerTitle?null:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.A9.spaceBetween,className:classnames__WEBPACK_IMPORTED_MODULE_2___default()("popover-header__title",{"popover-header__title--center":centerTitle}),marginBottom:2},onBack?react__WEBPACK_IMPORTED_MODULE_0__.createElement(_component_library__WEBPACK_IMPORTED_MODULE_6__.a2,{iconName:_component_library__WEBPACK_IMPORTED_MODULE_6__.$M.ArrowLeft,ariaLabel:t("back"),onClick:onBack,color:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.Q1.iconDefault,size:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.or.SM}):null,react__WEBPACK_IMPORTED_MODULE_0__.createElement(_component_library__WEBPACK_IMPORTED_MODULE_6__.EY,{textAlign:centerTitle?_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.nO.Center:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.nO.Start,className:wrapTitle?"popover-header__title-wrap":null,ellipsis:!0,variant:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.J3.headingSm,as:"h2",width:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.VH.FULL},title),onClose?react__WEBPACK_IMPORTED_MODULE_0__.createElement(_component_library__WEBPACK_IMPORTED_MODULE_6__.a2,{iconName:_component_library__WEBPACK_IMPORTED_MODULE_6__.$M.Close,ariaLabel:t("close"),"data-testid":"popover-close",onClick:onClose,size:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.or.SM}):null),subtitle?react__WEBPACK_IMPORTED_MODULE_0__.createElement(_component_library__WEBPACK_IMPORTED_MODULE_6__.EY,{variant:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.J3.bodySm},subtitle):null)},null),children?react__WEBPACK_IMPORTED_MODULE_0__.createElement(_box__WEBPACK_IMPORTED_MODULE_4__.Ay,_object_spread({className:classnames__WEBPACK_IMPORTED_MODULE_2___default()("popover-content",contentClassName),onScroll:onScroll},defaultContentProps,contentProps),children):null,showScrollDown?react__WEBPACK_IMPORTED_MODULE_0__.createElement(_box__WEBPACK_IMPORTED_MODULE_4__.Ay,{display:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.Nu.FLEX,alignItems:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.k2.center,justifyContent:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.A9.center,borderColor:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.cG.borderDefault,backgroundColor:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.i0.backgroundDefault,color:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.Q1.iconDefault,onClick:onScrollDownButtonClick,className:"popover-scroll-button",style:{bottom:footer?"140px":"12px"},"data-testid":"popover-scroll-button"},react__WEBPACK_IMPORTED_MODULE_0__.createElement(_component_library__WEBPACK_IMPORTED_MODULE_6__.In,{name:_component_library__WEBPACK_IMPORTED_MODULE_6__.$M.ArrowDown,color:_helpers_constants_design_system__WEBPACK_IMPORTED_MODULE_5__.Li.primaryDefault,size:_component_library__WEBPACK_IMPORTED_MODULE_6__.lK.Md,"aria-label":t("scrollDown")})):null,footer?react__WEBPACK_IMPORTED_MODULE_0__.createElement(_box__WEBPACK_IMPORTED_MODULE_4__.Ay,_object_spread({className:classnames__WEBPACK_IMPORTED_MODULE_2___default()("popover-footer",footerClassName)},defaultFooterProps,footerProps),footer):null))};Popover.propTypes={wrapTitle:prop_types__WEBPACK_IMPORTED_MODULE_7___default().bool,title:prop_types__WEBPACK_IMPORTED_MODULE_7___default().node,subtitle:prop_types__WEBPACK_IMPORTED_MODULE_7___default().string,children:prop_types__WEBPACK_IMPORTED_MODULE_7___default().node,footer:prop_types__WEBPACK_IMPORTED_MODULE_7___default().node,footerClassName:prop_types__WEBPACK_IMPORTED_MODULE_7___default().string,onBack:prop_types__WEBPACK_IMPORTED_MODULE_7___default().func,onClose:prop_types__WEBPACK_IMPORTED_MODULE_7___default().func,onScroll:prop_types__WEBPACK_IMPORTED_MODULE_7___default().func,CustomBackground:prop_types__WEBPACK_IMPORTED_MODULE_7___default().func,contentClassName:prop_types__WEBPACK_IMPORTED_MODULE_7___default().string,className:prop_types__WEBPACK_IMPORTED_MODULE_7___default().string,showArrow:prop_types__WEBPACK_IMPORTED_MODULE_7___default().bool,popoverRef:prop_types__WEBPACK_IMPORTED_MODULE_7___default().shape({current:prop_types__WEBPACK_IMPORTED_MODULE_7___default().instanceOf(window.Element)}),showScrollDown:prop_types__WEBPACK_IMPORTED_MODULE_7___default().bool,onScrollDownButtonClick:prop_types__WEBPACK_IMPORTED_MODULE_7___default().func,centerTitle:prop_types__WEBPACK_IMPORTED_MODULE_7___default().bool,headerProps:prop_types__WEBPACK_IMPORTED_MODULE_7___default().shape(_object_spread({},_box__WEBPACK_IMPORTED_MODULE_4__.Ay.propTypes)),contentProps:prop_types__WEBPACK_IMPORTED_MODULE_7___default().shape(_object_spread({},_box__WEBPACK_IMPORTED_MODULE_4__.Ay.propTypes)),footerProps:prop_types__WEBPACK_IMPORTED_MODULE_7___default().shape(_object_spread({},_box__WEBPACK_IMPORTED_MODULE_4__.Ay.propTypes))};var PopoverPortal=function(PureComponent){_inherits(PopoverPortal,PureComponent);var _super=_create_super(PopoverPortal);function PopoverPortal(){var _this;return _class_call_check(this,PopoverPortal),_this=_super.apply(this,arguments),_define_property(_assert_this_initialized(_this),"rootNode",document.getElementById("popover-content")),_define_property(_assert_this_initialized(_this),"instanceNode",document.createElement("div")),_this}return _create_class(PopoverPortal,[{key:"componentDidMount",value:function componentDidMount(){this.rootNode&&this.rootNode.appendChild(this.instanceNode)}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.rootNode&&this.rootNode.removeChild(this.instanceNode)}},{key:"render",value:function render(){var children=react__WEBPACK_IMPORTED_MODULE_0__.createElement(Popover,this.props);return this.rootNode?react_dom__WEBPACK_IMPORTED_MODULE_1___default().createPortal(children,this.instanceNode):children}}]),PopoverPortal}(react__WEBPACK_IMPORTED_MODULE_0__.PureComponent);_define_property(PopoverPortal,"propTypes",Popover.propTypes),PopoverPortal.__docgenInfo={description:"@deprecated The `<Popover>` component has been deprecated in favor of the new `<Modal>` component from the component-library.\nPlease update your code to use the new `<Modal>` component instead, which can be found at ui/components/component-library/modal/modal.tsx.\nYou can find documentation for the new Modal component in the MetaMask Storybook:\n{@link https://metamask.github.io/metamask-storybook/?path=/docs/components-componentlibrary-modal--docs}\nIf you would like to help with the replacement of the old Modal component, please submit a pull request against this GitHub issue:\n{@link https://github.com/MetaMask/metamask-extension/issues/19555}",methods:[],displayName:"PopoverPortal",props:{wrapTitle:{description:"Avoid wrapping title",type:{name:"bool"},required:!1},title:{description:"Show title of the popover",type:{name:"node"},required:!1},subtitle:{description:"Show subtitle label on popover",type:{name:"string"},required:!1},children:{description:"Show children content could be react child or text",type:{name:"node"},required:!1},footer:{description:"Show footer content could be react child or text",type:{name:"node"},required:!1},footerClassName:{description:"Add custom CSS class for footer",type:{name:"string"},required:!1},onBack:{description:"onBack handler",type:{name:"func"},required:!1},onClose:{description:"onClose handler",type:{name:"func"},required:!1},onScroll:{description:"onScroll handler",type:{name:"func"},required:!1},CustomBackground:{description:"",type:{name:"func"},required:!1},contentClassName:{description:"Add custom CSS class for content",type:{name:"string"},required:!1},className:{description:"Add custom CSS class",type:{name:"string"},required:!1},showArrow:{description:"Check if component would show arror",type:{name:"bool"},required:!1},popoverRef:{description:"The ref of the popover-wrap element",type:{name:"shape",value:{current:{name:"instanceOf",value:"window.Element",required:!1}}},required:!1},showScrollDown:{description:"Show title of the popover",type:{name:"bool"},required:!1},onScrollDownButtonClick:{description:"ScrollDown handler",type:{name:"func"},required:!1},centerTitle:{description:"Check if use centered title",type:{name:"bool"},required:!1},headerProps:{description:"Box props for the header",type:{name:"shape",value:{}},required:!1},contentProps:{description:"Box props for the content",type:{name:"shape",value:{}},required:!1},footerProps:{description:"Box props for the footer",type:{name:"shape",value:{}},required:!1}}}}}]);