UNPKG

@10up/block-components

Version:

10up Components built for the WordPress Block Editor.

2 lines 6.83 kB
!function(){var t={161:function(t,e,n){"use strict";n.d(e,{Zm:function(){return i}});var r=n(7966);const o={postId:void 0,postType:void 0,isEditable:void 0},s=(0,r.createContext)(o),i=()=>(0,r.useContext)(s)},5472:function(t,e,n){"use strict";n.d(e,{PostPrimaryTerm:function(){return u}});var r=n(7966),o=n(8450),s=n(2413),i=n(283);const u=({taxonomyName:t="category",placeholder:e=(0,o.__)("Select a term","tenup"),isLink:n=!0,...u})=>{const[c,a]=(0,i.wJ)(t),f=!!c,l=f?c.name:e,p=f?c.link:"#";if(!a)return null;const d=n?"a":"span",y={...u};return n&&(y.href=p),(0,r.createElement)(d,y,(0,s.decodeEntities)(l))}},283:function(t,e,n){"use strict";n.d(e,{wJ:function(){return r.usePrimaryTerm}});n(3505),n(1210),n(1740),n(4512),n(6186),n(2516),n(2312),n(4275),n(2131),n(703),n(8857),n(6856),n(687);var r=n(1461);n(989),n(8021),n(8474),n(3445),n(2737),n(4449),n(3227)},2131:function(t,e,n){"use strict";n(5214),n(7816)},2516:function(t,e,n){"use strict";n(5214),n(2627)},4512:function(t,e,n){"use strict";n(7966);var r=require("@leeoniya/ufuzzy");new(n.n(r)())},4449:function(t,e,n){"use strict";n(2627),n(5214)},3505:function(t,e,n){"use strict";n(5214),n(2627)},1740:function(t,e,n){"use strict";n(5214),n(7966),n(8475)},687:function(t,e,n){"use strict";n.d(e,{useIsPluginActive:function(){return i}});var r=n(5214),o=n(7816);const s=["active","network-active"],i=t=>(0,r.useSelect)(e=>{const n=e(o.store),r=n.getPlugin(t),i=n.hasFinishedResolution("getPlugin",[t]);return[s.includes(r?.status),i]},[t])},2737:function(t,e,n){"use strict";n(7816),n(2312)},4275:function(t,e,n){"use strict";n.d(e,{useIsSupportedTaxonomy:function(){return s}});var r=n(5214),o=n(7816);const s=(t,e)=>(0,r.useSelect)(n=>{const{getPostType:r,hasFinishedResolution:s}=n(o.store),i=r(t),u=s("getPostType",[t]),c=i?.taxonomies?.some(t=>t===e);return[!!c,u]},[t,e])},6186:function(t,e,n){"use strict";n(5214),n(7816)},763:function(t,e,n){"use strict";n(6314)},989:function(t,e,n){"use strict";n(7966),n(2050),n(763)},8474:function(t,e,n){"use strict";n(7816),n(2312)},2312:function(t,e,n){"use strict";n.d(e,{usePost:function(){return i}});var r=n(5214),o=n(4951),s=n(161);function i(){const{postId:t,postType:e,isEditable:n}=(0,s.Zm)(),{globalPostId:i,globalPostType:u}=(0,r.useSelect)(t=>({globalPostId:t(o.store).getCurrentPostId(),globalPostType:t(o.store).getCurrentPostType()}),[]);return{postId:t||i,postType:e||u,isEditable:!(!!t&&!!e)||n}}},1461:function(t,e,n){"use strict";n.d(e,{usePrimaryTerm:function(){return a}});var r=n(5214),o=n(8450),s=n(7816),i=n(2312),u=n(687),c=n(4275);const a=t=>{const{postType:e,isEditable:n}=(0,i.usePost)(),[a,f]=(0,u.useIsPluginActive)("wordpress-seo/wp-seo"),[l,p]=(0,c.useIsSupportedTaxonomy)(e,t),d=(0,r.useSelect)(n=>{if(!p||!f)return null;if(!a&&f)return console.error("Yoast SEO is not active. Please install and activate Yoast SEO to use the PostPrimaryCategory component."),null;if(!l&&p)return console.error(`The taxonomy "${t}" is not supported for the post type "${e}". Please use a supported taxonomy.`),null;return n("yoast-seo/editor")?n("yoast-seo/editor").getPrimaryTaxonomyId(t):(console.error("The yoast-seo/editor store does is not available."),null)},[t,a,l,p,f]),y=(0,r.useSelect)(e=>{if(!d)return null;const{getEntityRecord:n}=e(s.store);return n("taxonomy",t,d)},[d]);return[n?y:{name:(0,o.__)("Primary Term","tenup"),link:"#"},l]}},3227:function(t,e,n){"use strict";n(5214),n(2627)},1210:function(t,e,n){"use strict";n(3805),n(7816),n(5214)},8021:function(t,e,n){"use strict";n(7966)},703:function(t,e,n){"use strict";n(4951),n(5214),n(7816)},6856:function(t,e,n){"use strict";n(5214),n(7816)},8857:function(t,e,n){"use strict";n(2312),n(4275),n(2131),n(703),n(6856)},3445:function(t,e,n){"use strict";n(5214),n(7816)},7785:function(t,e,n){"use strict";var r={};n.r(r),n.d(r,{getIcon:function(){return a},getIconSet:function(){return u},getIconSets:function(){return i},getIcons:function(){return c}});var o={};n.r(o),n.d(o,{registerIconSet:function(){return f},removeIconSet:function(){return l}});var s=n(5214);function i(t){const{iconSets:e}=t;return Object.values(e)}function u(t,e){const{iconSets:n}=t;return n[e]??[]}function c(t,e){const{iconSets:n}=t;return n?.hasOwnProperty(e)?n[e]?.icons??[]:[]}function a(t,e,n){const{iconSets:r}=t;return r?.hasOwnProperty(e)?r[e]?.icons?.find(t=>t.name===n)??[]:void 0}function f(t){return{type:"REGISTER_ICON_SET",iconSet:t}}function l(t){return{type:"REMOVE_ICON_SET",name:t}}const p="tenup/icons",d=(0,s.createReduxStore)(p,{reducer:function(t={iconSets:{}},e){switch(e.type){case"REGISTER_ICON_SET":return{...t,iconSets:{...t.iconSets,[e.iconSet.name]:e.iconSet}};case"REMOVE_ICON_SET":if(t.iconSets.hasOwnProperty(e.name)){const n={...t};return delete n.iconSets[e.name],n}return t;default:return t}},selectors:r,actions:o});!!(0,s.select)(p)||(0,s.register)(d)},8475:function(t,e,n){"use strict";n(7785)},3805:function(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},2627:function(t){"use strict";t.exports=require("@wordpress/block-editor")},2050:function(t){"use strict";t.exports=require("@wordpress/components")},6314:function(t){"use strict";t.exports=require("@wordpress/compose")},7816:function(t){"use strict";t.exports=require("@wordpress/core-data")},5214:function(t){"use strict";t.exports=require("@wordpress/data")},4951:function(t){"use strict";t.exports=require("@wordpress/editor")},7966:function(t){"use strict";t.exports=require("@wordpress/element")},2413:function(t){"use strict";t.exports=require("@wordpress/html-entities")},8450:function(t){"use strict";t.exports=require("@wordpress/i18n")}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var s=e[r]={exports:{}};return t[r](s,s.exports,n),s.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};!function(){"use strict";n.r(r),n.d(r,{PostPrimaryCategory:function(){return i}});var t=n(7966),e=n(8450),o=n(5472);function s(){return s=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s.apply(null,arguments)}const i=({placeholder:n=(0,e.__)("Select a category","tenup"),taxonomyName:r="category",isLink:i=!0,...u})=>(0,t.createElement)(o.PostPrimaryTerm,s({placeholder:n,taxonomyName:r,isLink:i},u))}(),module.exports=r}(); //# sourceMappingURL=index.js.map