"use strict";(self.webpackChunk_woocommerce_storybook=self.webpackChunk_woocommerce_storybook||[]).push([[670],{"../../packages/js/components/src/tour-kit/stories/tour-kit.story.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{AutoScroll:()=>AutoScroll,NoEffects:()=>NoEffects,Overlay:()=>Overlay,Placement:()=>Placement,Spotlight:()=>Spotlight,SpotlightInteractivity:()=>SpotlightInteractivity,default:()=>tour_kit_story});__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.object.keys.js"),__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.symbol.js"),__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.array.filter.js"),__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.object.get-own-property-descriptor.js"),__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.array.for-each.js"),__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/web.dom-collections.for-each.js"),__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.object.get-own-property-descriptors.js"),__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.object.define-properties.js"),__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.object.define-property.js");var slicedToArray=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),defineProperty=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/defineProperty.js"),react=__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"),tour_kit=__webpack_require__("../../node_modules/.pnpm/@automattic+tour-kit@1.1.3_@types+react@17.0.71_@wordpress+data@10.6.0_react@17.0.2__react-do_wpr2orkhsavt4ls5ttip2qkwai/node_modules/@automattic/tour-kit/dist/esm/components/tour-kit.js"),build_module=__webpack_require__("../../node_modules/.pnpm/@wordpress+viewport@4.20.0_react@17.0.2/node_modules/@wordpress/viewport/build-module/index.js"),component=__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/card/card/component.js"),card_header_component=__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/card/card-header/component.js"),card_body_component=__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/card/card-body/component.js"),card_footer_component=__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/card/card-footer/component.js"),build_module_button=__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"),i18n_build_module=__webpack_require__("../../node_modules/.pnpm/@wordpress+i18n@4.6.1/node_modules/@wordpress/i18n/build-module/index.js");const step_navigation=function StepNavigation(_ref){var currentStepIndex=_ref.currentStepIndex,onNextStep=_ref.onNextStep,onPreviousStep=_ref.onPreviousStep,onDismiss=_ref.onDismiss,steps=_ref.steps,isFirstStep=0===currentStepIndex,isLastStep=currentStepIndex===steps.length-1,_steps$currentStepInd=steps[currentStepIndex].meta.primaryButton,primaryButton=void 0===_steps$currentStepInd?{text:"",isDisabled:!1,isHidden:!1}:_steps$currentStepInd,_steps$currentStepInd2=steps[currentStepIndex].meta.secondaryButton,secondaryButton=void 0===_steps$currentStepInd2?{text:""}:_steps$currentStepInd2,_steps$currentStepInd3=steps[currentStepIndex].meta.skipButton,skipButton=void 0===_steps$currentStepInd3?{text:"",isVisible:!1}:_steps$currentStepInd3,SkipButton=(0,react.createElement)(build_module_button.A,{className:"woocommerce-tour-kit-step-navigation__skip-btn",variant:"tertiary",onClick:onDismiss("skip-btn")},skipButton.text||(0,i18n_build_module.__)("Skip","woocommerce")),NextButton=(0,react.createElement)(build_module_button.A,{className:"woocommerce-tour-kit-step-navigation__next-btn",variant:"primary",disabled:primaryButton.isDisabled,onClick:onNextStep},primaryButton.text||(0,i18n_build_module.__)("Next","woocommerce")),BackButton=(0,react.createElement)(build_module_button.A,{className:"woocommerce-tour-kit-step-navigation__back-btn",variant:"secondary",onClick:onPreviousStep},secondaryButton.text||(0,i18n_build_module.__)("Back","woocommerce"));return primaryButton.isHidden?null:(0,react.createElement)("div",{className:"woocommerce-tour-kit-step-navigation"},(0,react.createElement)("div",{className:"woocommerce-tour-kit-step-navigation__step"},steps.length>1?(0,i18n_build_module.nv)((0,i18n_build_module.__)("Step %1$d of %2$d","woocommerce"),currentStepIndex+1,steps.length):null),function renderButtons(){return isLastStep?(0,react.createElement)("div",null,skipButton.isVisible?SkipButton:null,isFirstStep?null:BackButton,(0,react.createElement)(build_module_button.A,{variant:"primary",disabled:primaryButton.isDisabled,className:"woocommerce-tour-kit-step-navigation__done-btn",onClick:onDismiss("done-btn")},primaryButton.text||(0,i18n_build_module.__)("Done","woocommerce"))):isFirstStep?(0,react.createElement)("div",null,skipButton.isVisible?SkipButton:null,NextButton):(0,react.createElement)("div",null,skipButton.isVisible?SkipButton:null,BackButton,NextButton)}())};try{stepnavigation.displayName="stepnavigation",stepnavigation.__docgenInfo={description:"",displayName:"stepnavigation",props:{steps:{defaultValue:null,description:"",name:"steps",required:!0,type:{name:"WooStep[]"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../packages/js/components/src/tour-kit/components/step-navigation.tsx#stepnavigation"]={docgenInfo:stepnavigation.__docgenInfo,name:"stepnavigation",path:"../../packages/js/components/src/tour-kit/components/step-navigation.tsx#stepnavigation"})}catch(__react_docgen_typescript_loader_error){}var flex_component=__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/flex/flex/component.js"),icon=__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/icon/index.js"),close_small=__webpack_require__("../../node_modules/.pnpm/@wordpress+icons@8.2.3/node_modules/@wordpress/icons/build-module/library/close-small.js");const step_controls=function StepControls(_ref){var onDismiss=_ref.onDismiss;return(0,react.createElement)(flex_component.A,{className:"woocommerce-tour-kit-step-controls",justify:"flex-end"},(0,react.createElement)(build_module_button.A,{className:"woocommerce-tour-kit-step-controls__close-btn",label:(0,i18n_build_module.__)("Close Tour","woocommerce"),icon:(0,react.createElement)(icon.A,{icon:close_small.A,viewBox:"6 4 12 14"}),iconSize:16,size:16,onClick:onDismiss("close-btn")}))};try{stepcontrols.displayName="stepcontrols",stepcontrols.__docgenInfo={description:"",displayName:"stepcontrols",props:{onDismiss:{defaultValue:null,description:"",name:"onDismiss",required:!0,type:{name:"(source: string) => () => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../packages/js/components/src/tour-kit/components/step-controls.tsx#stepcontrols"]={docgenInfo:stepcontrols.__docgenInfo,name:"stepcontrols",path:"../../packages/js/components/src/tour-kit/components/step-controls.tsx#stepcontrols"})}catch(__react_docgen_typescript_loader_error){}const step=(0,build_module.uE)({isViewportMobile:"< medium"})((function Step(_ref){var _descriptions,_steps$currentStepInd2,_steps$currentStepInd3,steps=_ref.steps,currentStepIndex=_ref.currentStepIndex,onDismiss=_ref.onDismiss,onNextStep=_ref.onNextStep,onPreviousStep=_ref.onPreviousStep,setInitialFocusedElement=_ref.setInitialFocusedElement,onGoToStep=_ref.onGoToStep,isViewportMobile=_ref.isViewportMobile,_steps$currentStepInd=steps[currentStepIndex].meta,descriptions=_steps$currentStepInd.descriptions,heading=_steps$currentStepInd.heading,description=null!==(_descriptions=descriptions[isViewportMobile?"mobile":"desktop"])&&void 0!==_descriptions?_descriptions:descriptions.desktop,stepRef=(0,react.useRef)(),focusElement=function getFocusElement(focusElementSelector,iframeSelector){if(!focusElementSelector)return null;if(iframeSelector){var iframeElement=document.querySelector(iframeSelector);if(!iframeElement)return null;var innerDoc=iframeElement.contentDocument||iframeElement.contentWindow&&iframeElement.contentWindow.document;return innerDoc?innerDoc.querySelector(focusElementSelector):null}return document.querySelector(focusElementSelector)}((null===(_steps$currentStepInd2=steps[currentStepIndex].focusElement)||void 0===_steps$currentStepInd2?void 0:_steps$currentStepInd2[isViewportMobile?"mobile":"desktop"])||null,(null===(_steps$currentStepInd3=steps[currentStepIndex].focusElement)||void 0===_steps$currentStepInd3?void 0:_steps$currentStepInd3.iframe)||null);return(0,react.useEffect)((function(){if(focusElement)setInitialFocusedElement(focusElement);else{var _stepRef$current,buttons=null===(_stepRef$current=stepRef.current)||void 0===_stepRef$current?void 0:_stepRef$current.querySelectorAll("button");buttons&&buttons.length&&setInitialFocusedElement(buttons[buttons.length-1])}}),[focusElement,setInitialFocusedElement]),(0,react.createElement)(component.A,{ref:stepRef,className:"woocommerce-tour-kit-step",elevation:2},(0,react.createElement)(card_header_component.A,{isBorderless:!0,size:"small"},(0,react.createElement)(step_controls,{onDismiss})),(0,react.createElement)(card_body_component.A,{className:"woocommerce-tour-kit-step__body",size:"small"},(0,react.createElement)("h2",{className:"woocommerce-tour-kit-step__heading"},heading),(0,react.createElement)("p",{className:"woocommerce-tour-kit-step__description"},description)),(0,react.createElement)(card_footer_component.A,{isBorderless:!0,size:"small"},(0,react.createElement)(step_navigation,{currentStepIndex,onGoToStep,onNextStep,onPreviousStep,onDismiss,steps})))}));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 ",...NoEffects.parameters?.docs?.source}}},Spotlight.parameters={...Spotlight.parameters,docs:{...Spotlight.parameters?.docs,source:{originalSource:"() => ",...Spotlight.parameters?.docs?.source}}},Overlay.parameters={...Overlay.parameters,docs:{...Overlay.parameters?.docs,source:{originalSource:"() => ",...Overlay.parameters?.docs?.source}}},SpotlightInteractivity.parameters={...SpotlightInteractivity.parameters,docs:{...SpotlightInteractivity.parameters?.docs,source:{originalSource:"() => ",...SpotlightInteractivity.parameters?.docs?.source}}},AutoScroll.parameters={...AutoScroll.parameters,docs:{...AutoScroll.parameters?.docs,source:{originalSource:"() => <>\n
\n \n ",...AutoScroll.parameters?.docs?.source}}},Placement.parameters={...Placement.parameters,docs:{...Placement.parameters?.docs,source:{originalSource:"() => ",...Placement.parameters?.docs?.source}}}}}]);