woocommerce/search-stories-search-story...

1 line
8.8 KiB
JavaScript

"use strict";(self.webpackChunk_woocommerce_storybook=self.webpackChunk_woocommerce_storybook||[]).push([[5072],{"../../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){}},"../../packages/js/components/src/section/section.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{w:()=>Section});var _babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),_wordpress_element__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"),_context__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("../../packages/js/components/src/section/context.tsx"),_excluded=["component","children"],Section=function Section(_ref){var component=_ref.component,children=_ref.children,props=(0,_babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_0__.A)(_ref,_excluded),Component=component||"div";return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(_context__WEBPACK_IMPORTED_MODULE_2__.$.Consumer,null,(function(level){return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(_context__WEBPACK_IMPORTED_MODULE_2__.$.Provider,{value:level+1},!1===component?children:(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(Component,props,children))}))};try{Section.displayName="Section",Section.__docgenInfo={description:"The section wrapper, used to indicate a sub-section (and change the header level context).",displayName:"Section",props:{component:{defaultValue:null,description:"The wrapper component for this section. Optional, defaults to `div`. If passed false, no wrapper is used. Additional props passed to Section are passed on to the component.",name:"component",required:!1,type:{name:"string | false | ComponentType<{}>"}},className:{defaultValue:null,description:"Optional classname",name:"className",required:!1,type:{name:"string"}},children:{defaultValue:null,description:"The children inside this section, rendered in the `component`. This increases the context level for the next heading used.",name:"children",required:!0,type:{name:"ReactNode"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../packages/js/components/src/section/section.tsx#Section"]={docgenInfo:Section.__docgenInfo,name:"Section",path:"../../packages/js/components/src/section/section.tsx#Section"})}catch(__react_docgen_typescript_loader_error){}},"../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.array.join.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"),uncurryThis=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js"),IndexedObject=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/indexed-object.js"),toIndexedObject=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/to-indexed-object.js"),arrayMethodIsStrict=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-method-is-strict.js"),nativeJoin=uncurryThis([].join);$({target:"Array",proto:!0,forced:IndexedObject!==Object||!arrayMethodIsStrict("join",",")},{join:function join(separator){return nativeJoin(toIndexedObject(this),void 0===separator?",":separator)}})},"../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.date.to-string.js":(__unused_webpack_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"),defineBuiltIn=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/define-built-in.js"),DatePrototype=Date.prototype,nativeDateToString=uncurryThis(DatePrototype.toString),thisTimeValue=uncurryThis(DatePrototype.getTime);"Invalid Date"!==String(new Date(NaN))&&defineBuiltIn(DatePrototype,"toString",(function toString(){var value=thisTimeValue(this);return value==value?nativeDateToString(this):"Invalid Date"}))},"../../packages/js/components/src/search/stories/search.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 _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),_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_2__=__webpack_require__("../../packages/js/components/src/section/header.tsx"),_woocommerce_components__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("../../packages/js/components/src/section/section.tsx"),_woocommerce_components__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("../../packages/js/components/src/search/index.tsx"),SearchExample=function SearchExample(){var _useState=(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)([]),_useState2=(0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__.A)(_useState,2),selected=_useState2[0],setSelected=_useState2[1],_useState3=(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)([]),_useState4=(0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__.A)(_useState3,2),inlineSelected=_useState4[0],setInlineSelect=_useState4[1];return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div",null,(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_components__WEBPACK_IMPORTED_MODULE_2__.H,null,"Tags Below Input"),(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_components__WEBPACK_IMPORTED_MODULE_3__.w,{component:!1},(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_components__WEBPACK_IMPORTED_MODULE_4__.A,{type:"products",placeholder:"Search for a product",selected,onChange:function onChange(items){return setSelected(items)}})),(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_components__WEBPACK_IMPORTED_MODULE_2__.H,null,"Tags Inline with Input"),(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_components__WEBPACK_IMPORTED_MODULE_3__.w,{component:!1},(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_components__WEBPACK_IMPORTED_MODULE_4__.A,{type:"products",placeholder:"Search for a product",selected:inlineSelected,onChange:function onChange(items){return setInlineSelect(items)},inlineTags:!0})))},Basic=function Basic(){return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(SearchExample,null)};const __WEBPACK_DEFAULT_EXPORT__={title:"WooCommerce Admin/components/Search",component:_woocommerce_components__WEBPACK_IMPORTED_MODULE_4__.A};Basic.parameters={...Basic.parameters,docs:{...Basic.parameters?.docs,source:{originalSource:"() => <SearchExample />",...Basic.parameters?.docs?.source}}}}}]);