woocommerce/empty-content-stories-empty...

1 line
21 KiB
JavaScript

"use strict";(self.webpackChunk_woocommerce_storybook=self.webpackChunk_woocommerce_storybook||[]).push([[4318],{"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}__webpack_require__.d(__webpack_exports__,{A:()=>_assertThisInitialized})},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/classCallCheck.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}__webpack_require__.d(__webpack_exports__,{A:()=>_classCallCheck})},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/createClass.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>_createClass});var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");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,(0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__.A)(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function _getPrototypeOf(o){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)},_getPrototypeOf(o)}__webpack_require__.d(__webpack_exports__,{A:()=>_getPrototypeOf})},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/inherits.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>_inherits});var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js");function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&(0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__.A)(subClass,superClass)}},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>_possibleConstructorReturn});var _typeof_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/typeof.js"),_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");function _possibleConstructorReturn(self,call){if(call&&("object"===(0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__.A)(call)||"function"==typeof call))return call;if(void 0!==call)throw new TypeError("Derived constructors may only return object or undefined");return(0,_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__.A)(self)}},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},_setPrototypeOf(o,p)}__webpack_require__.d(__webpack_exports__,{A:()=>_setPrototypeOf})},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>_toPropertyKey});var esm_typeof=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/typeof.js");function _toPropertyKey(arg){var key=function _toPrimitive(input,hint){if("object"!==(0,esm_typeof.A)(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!==(0,esm_typeof.A)(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"===(0,esm_typeof.A)(key)?key:String(key)}},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/typeof.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function _typeof(o){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}__webpack_require__.d(__webpack_exports__,{A:()=>_typeof})},"../../packages/js/components/src/empty-content/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.object.to-string.js"),__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.reflect.construct.js");var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/classCallCheck.js"),_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/createClass.js"),_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/inherits.js"),_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js"),_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js"),_wordpress_components__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("../../node_modules/.pnpm/@wordpress+components@19.8.5_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react-with-d_oli5xz3n7pc4ztqokra47llglu/node_modules/@wordpress/components/build-module/button/index.js"),_wordpress_element__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),prop_types__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("../../node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js"),prop_types__WEBPACK_IMPORTED_MODULE_11___default=__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_11__),_section__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("../../packages/js/components/src/section/header.tsx");function _createSuper(Derived){var hasNativeReflectConstruct=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(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}}();return function _createSuperInternal(){var result,Super=(0,_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_2__.A)(Derived);if(hasNativeReflectConstruct){var NewTarget=(0,_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_2__.A)(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return(0,_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__.A)(this,result)}}var EmptyContent=function(_Component){(0,_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_5__.A)(EmptyContent,_Component);var _super=_createSuper(EmptyContent);function EmptyContent(){return(0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_6__.A)(this,EmptyContent),_super.apply(this,arguments)}return(0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_7__.A)(EmptyContent,[{key:"renderIllustration",value:function renderIllustration(){var _this$props=this.props,illustrationWidth=_this$props.illustrationWidth,illustrationHeight=_this$props.illustrationHeight,illustration=_this$props.illustration;return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)("img",{alt:"",src:illustration,width:illustrationWidth,height:illustrationHeight,className:"woocommerce-empty-content__illustration"})}},{key:"renderActionButtons",value:function renderActionButtons(type){var actionLabel="secondary"===type?this.props.secondaryActionLabel:this.props.actionLabel,actionURL="secondary"===type?this.props.secondaryActionURL:this.props.actionURL,actionCallback="secondary"===type?this.props.secondaryActionCallback:this.props.actionCallback,buttonVariant="secondary"!==type?"primary":"secondary";return actionURL&&actionCallback?(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__.A,{className:"woocommerce-empty-content__action",variant:buttonVariant,onClick:actionCallback,href:actionURL},actionLabel):actionURL?(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__.A,{className:"woocommerce-empty-content__action",variant:buttonVariant,href:actionURL},actionLabel):actionCallback?(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__.A,{className:"woocommerce-empty-content__action",variant:buttonVariant,onClick:actionCallback},actionLabel):null}},{key:"renderActions",value:function renderActions(){var _this$props2=this.props,actionLabel=_this$props2.actionLabel,secondaryActionLabel=_this$props2.secondaryActionLabel;return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)("div",{className:"woocommerce-empty-content__actions"},actionLabel&&this.renderActionButtons("primary"),secondaryActionLabel&&this.renderActionButtons("secondary"))}},{key:"render",value:function render(){var _this$props3=this.props,className=_this$props3.className,title=_this$props3.title,message=_this$props3.message,illustration=_this$props3.illustration;return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("woocommerce-empty-content",className)},illustration&&this.renderIllustration(),title?(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)(_section__WEBPACK_IMPORTED_MODULE_10__.H,{className:"woocommerce-empty-content__title"},title):null,message?(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)("p",{className:"woocommerce-empty-content__message"},message):null,this.renderActions())}}]),EmptyContent}(_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.Component);EmptyContent.propTypes={title:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string.isRequired,message:prop_types__WEBPACK_IMPORTED_MODULE_11___default().node,illustration:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string,illustrationHeight:prop_types__WEBPACK_IMPORTED_MODULE_11___default().number,illustrationWidth:prop_types__WEBPACK_IMPORTED_MODULE_11___default().number,actionLabel:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string.isRequired,actionURL:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string,actionCallback:prop_types__WEBPACK_IMPORTED_MODULE_11___default().func,secondaryActionLabel:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string,secondaryActionURL:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string,secondaryActionCallback:prop_types__WEBPACK_IMPORTED_MODULE_11___default().func,className:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string},EmptyContent.defaultProps={illustration:'data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400"%3E%3Cpath d="M226.153073,88.3099993 L355.380187,301.446227 C363.970299,315.614028 359.448689,334.062961 345.280888,342.653073 C340.591108,345.496544 335.21158,347 329.727115,347 L71.2728854,347 C54.7043429,347 41.2728854,333.568542 41.2728854,317 C41.2728854,311.515534 42.7763415,306.136007 45.6198127,301.446227 L174.846927,88.3099993 C183.437039,74.1421985 201.885972,69.6205881 216.053773,78.2106999 C220.184157,80.7150022 223.64877,84.1796157 226.153073,88.3099993 Z M184.370159,153 L186.899684,255.024156 L213.459691,255.024156 L215.989216,153 L184.370159,153 Z M200.179688,307.722584 C209.770801,307.722584 217.359375,300.450201 217.359375,291.175278 C217.359375,281.900355 209.770801,274.627972 200.179688,274.627972 C190.588574,274.627972 183,281.900355 183,291.175278 C183,300.450201 190.588574,307.722584 200.179688,307.722584 Z" id="Combined-Shape" stroke="%23c0c0c0" fill="%23c0c0c0" fill-rule="nonzero"%3E%3C/path%3E%3C/svg%3E',illustrationWidth:100};const __WEBPACK_DEFAULT_EXPORT__=EmptyContent},"../../packages/js/components/src/section/context.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{$:()=>Level});var Level=(0,__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js").createContext)(2)},"../../packages/js/components/src/section/header.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{H:()=>H});var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"),_context__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../packages/js/components/src/section/context.tsx");function H(props){var level=(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useContext)(_context__WEBPACK_IMPORTED_MODULE_1__.$),Heading="h"+Math.min(level,6);return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Heading,props)}try{H.displayName="H",H.__docgenInfo={description:'These components are used to frame out the page content for accessible heading hierarchy. Instead of defining fixed heading levels\n(`h2`, `h3`, …) you can use `<H />` to create "section headings", which look to the parent `<Section />`s for the appropriate\nheading level.',displayName:"H",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../packages/js/components/src/section/header.tsx#H"]={docgenInfo:H.__docgenInfo,name:"H",path:"../../packages/js/components/src/section/header.tsx#H"})}catch(__react_docgen_typescript_loader_error){}},"../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-bind.js":(module,__unused_webpack_exports,__webpack_require__)=>{var uncurryThis=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js"),aCallable=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/a-callable.js"),isObject=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-object.js"),hasOwn=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/has-own-property.js"),arraySlice=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-slice.js"),NATIVE_BIND=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-bind-native.js"),$Function=Function,concat=uncurryThis([].concat),join=uncurryThis([].join),factories={};module.exports=NATIVE_BIND?$Function.bind:function bind(that){var F=aCallable(this),Prototype=F.prototype,partArgs=arraySlice(arguments,1),boundFunction=function bound(){var args=concat(partArgs,arraySlice(arguments));return this instanceof boundFunction?function(C,argsLength,args){if(!hasOwn(factories,argsLength)){for(var list=[],i=0;i<argsLength;i++)list[i]="a["+i+"]";factories[argsLength]=$Function("C,a","return new C("+join(list,",")+")")}return factories[argsLength](C,args)}(F,args.length,args):F.apply(that,args)};return isObject(Prototype)&&(boundFunction.prototype=Prototype),boundFunction}},"../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.reflect.construct.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{var $=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js"),getBuiltIn=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/get-built-in.js"),apply=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-apply.js"),bind=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-bind.js"),aConstructor=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/a-constructor.js"),anObject=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/an-object.js"),isObject=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-object.js"),create=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/object-create.js"),fails=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/fails.js"),nativeConstruct=getBuiltIn("Reflect","construct"),ObjectPrototype=Object.prototype,push=[].push,NEW_TARGET_BUG=fails((function(){function F(){}return!(nativeConstruct((function(){}),[],F)instanceof F)})),ARGS_BUG=!fails((function(){nativeConstruct((function(){}))})),FORCED=NEW_TARGET_BUG||ARGS_BUG;$({target:"Reflect",stat:!0,forced:FORCED,sham:FORCED},{construct:function construct(Target,args){aConstructor(Target),anObject(args);var newTarget=arguments.length<3?Target:aConstructor(arguments[2]);if(ARGS_BUG&&!NEW_TARGET_BUG)return nativeConstruct(Target,args,newTarget);if(Target===newTarget){switch(args.length){case 0:return new Target;case 1:return new Target(args[0]);case 2:return new Target(args[0],args[1]);case 3:return new Target(args[0],args[1],args[2]);case 4:return new Target(args[0],args[1],args[2],args[3])}var $args=[null];return apply(push,$args,args),new(apply(bind,Target,$args))}var proto=newTarget.prototype,instance=create(isObject(proto)?proto:ObjectPrototype),result=apply(Target,instance,args);return isObject(result)?result:instance}})},"../../packages/js/components/src/empty-content/stories/empty-content.story.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Basic:()=>Basic,default:()=>__WEBPACK_DEFAULT_EXPORT__});var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"),_woocommerce_components__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../packages/js/components/src/empty-content/index.js"),Basic=function Basic(){return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_components__WEBPACK_IMPORTED_MODULE_1__.A,{title:"Nothing here",message:"Some descriptive text",actionLabel:"Reload page",actionURL:"#"})};const __WEBPACK_DEFAULT_EXPORT__={title:"WooCommerce Admin/components/EmptyContent",component:_woocommerce_components__WEBPACK_IMPORTED_MODULE_1__.A};Basic.parameters={...Basic.parameters,docs:{...Basic.parameters?.docs,source:{originalSource:'() => <EmptyContent title="Nothing here" message="Some descriptive text" actionLabel="Reload page" actionURL="#" />',...Basic.parameters?.docs?.source}}}}}]);