2 lines
6.4 KiB
JavaScript
2 lines
6.4 KiB
JavaScript
/*! For license information please see rating-stories-rating-story.2334d125.iframe.bundle.js.LICENSE.txt */
|
|
(self.webpackChunk_woocommerce_storybook=self.webpackChunk_woocommerce_storybook||[]).push([[1346],{"../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js":(module,exports)=>{var __WEBPACK_AMD_DEFINE_RESULT__;!function(){"use strict";var hasOwn={}.hasOwnProperty;function classNames(){for(var classes=[],i=0;i<arguments.length;i++){var arg=arguments[i];if(arg){var argType=typeof arg;if("string"===argType||"number"===argType)classes.push(arg);else if(Array.isArray(arg)){if(arg.length){var inner=classNames.apply(null,arg);inner&&classes.push(inner)}}else if("object"===argType){if(arg.toString!==Object.prototype.toString&&!arg.toString.toString().includes("[native code]")){classes.push(arg.toString());continue}for(var key in arg)hasOwn.call(arg,key)&&arg[key]&&classes.push(key)}}}return classes.join(" ")}module.exports?(classNames.default=classNames,module.exports=classNames):void 0===(__WEBPACK_AMD_DEFINE_RESULT__=function(){return classNames}.apply(exports,[]))||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)}()},"../../node_modules/.pnpm/gridicons@3.4.2_react@17.0.2/node_modules/gridicons/dist/star.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";exports.A=function _default(a){var b=a.size,c=void 0===b?24:b,d=a.onClick,f=(a.icon,a.className),g=function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}(a,_excluded),h=["gridicon","gridicons-star",f,!!function isModulo18(a){return 0==a%18}(c)&&"needs-offset",!1,!1].filter(Boolean).join(" ");return _react.default.createElement("svg",_extends({className:h,height:c,width:c,onClick:d},g,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),_react.default.createElement("g",null,_react.default.createElement("path",{d:"M12 2l2.582 6.953L22 9.257l-5.822 4.602L18.18 21 12 16.891 5.82 21l2.002-7.141L2 9.257l7.418-.304z"})))};var _react=function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}(__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js")),_excluded=["size","onClick","icon","className"];function _extends(){return _extends=Object.assign?Object.assign.bind():function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c])Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}},"../../packages/js/components/src/rating/stories/rating.story.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,default:()=>rating_story});var react=__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"),build_module=__webpack_require__("../../node_modules/.pnpm/@wordpress+i18n@4.6.1/node_modules/@wordpress/i18n/build-module/index.js"),classnames=__webpack_require__("../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),star=__webpack_require__("../../node_modules/.pnpm/gridicons@3.4.2_react@17.0.2/node_modules/gridicons/dist/star.js");const src_rating=function Rating(_ref){var _ref$rating=_ref.rating,rating=void 0===_ref$rating?0:_ref$rating,_ref$totalStars=_ref.totalStars,totalStars=void 0===_ref$totalStars?5:_ref$totalStars,_ref$size=_ref.size,size=void 0===_ref$size?18:_ref$size,className=_ref.className,icon=_ref.icon,outlineIcon=_ref.outlineIcon,stars=function stars(_icon){for(var starStyles={width:size+"px",height:size+"px"},_stars=[],i=0;i<totalStars;i++){var Icon=_icon||star.A;_stars.push((0,react.createElement)(Icon,{key:"star-"+i,style:starStyles}))}return _stars},classes=classnames_default()("woocommerce-rating",className),perStar=100/totalStars,outlineStyles={width:Math.round(perStar*rating)+"%"},label=(0,build_module.nv)((0,build_module.__)("%1$s out of %2$s stars.","woocommerce"),rating,totalStars);return(0,react.createElement)("div",{className:classes,"aria-label":label},stars(icon),(0,react.createElement)("div",{className:"woocommerce-rating__star-outline",style:outlineStyles},stars(outlineIcon||icon)))};try{rating.displayName="rating",rating.__docgenInfo={description:"Use `Rating` to display a set of stars, filled, empty or half-filled, that represents a\nrating in a scale between 0 and the prop `totalStars` (default 5).",displayName:"rating",props:{rating:{defaultValue:{value:"0"},description:"",name:"rating",required:!1,type:{name:"number"}},totalStars:{defaultValue:{value:"5"},description:"",name:"totalStars",required:!1,type:{name:"number"}},size:{defaultValue:{value:"18"},description:"",name:"size",required:!1,type:{name:"number"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},outlineIcon:{defaultValue:null,description:"",name:"outlineIcon",required:!1,type:{name:"ReactNode"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../packages/js/components/src/rating/index.tsx#rating"]={docgenInfo:rating.__docgenInfo,name:"rating",path:"../../packages/js/components/src/rating/index.tsx#rating"})}catch(__react_docgen_typescript_loader_error){}const rating_story={title:"WooCommerce Admin/components/Rating",component:src_rating,args:{rating:4.5,totalStars:5,size:18}};var Default=function Default(args){return(0,react.createElement)(src_rating,args)};Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => <Rating {...args} />",...Default.parameters?.docs?.source}}};try{Default.displayName="Default",Default.__docgenInfo={description:"",displayName:"Default",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../packages/js/components/src/rating/stories/rating.story.tsx#Default"]={docgenInfo:Default.__docgenInfo,name:"Default",path:"../../packages/js/components/src/rating/stories/rating.story.tsx#Default"})}catch(__react_docgen_typescript_loader_error){}}}]); |