UNPKG

@wikimedia/codex

Version:

Codex Design System for Wikimedia

2 lines (1 loc) 4.61 kB
"use strict";const e=require("vue"),v=require("./useComputedDirection.cjs"),m=require("./useComputedLanguage.cjs"),u=require("./constants.js"),z=require("./_plugin-vue_export-helper.js"),g='<path d="M11.53 2.3A1.85 1.85 0 0010 1.21 1.85 1.85 0 008.48 2.3L.36 16.36C-.48 17.81.21 19 1.88 19h16.24c1.67 0 2.36-1.19 1.52-2.64zM11 16H9v-2h2zm0-4H9V6h2z"/>',M='<path d="M12.43 14.34A5 5 0 0110 15a5 5 0 113.95-2L17 16.09V3a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h10a2 2 0 001.45-.63z"/><circle cx="10" cy="10" r="3"/>',f='<path d="M7 14.17 2.83 10l-1.41 1.41L7 17 19 5l-1.41-1.42z"/>',L='<path d="M10 0a10 10 0 1010 10A10 10 0 0010 0m5.66 14.24-1.41 1.41L10 11.41l-4.24 4.25-1.42-1.42L8.59 10 4.34 5.76l1.42-1.42L10 8.59l4.24-4.24 1.41 1.41L11.41 10z"/>',C='<path d="m4.34 2.93 12.73 12.73-1.41 1.41L2.93 4.35z"/><path d="M17.07 4.34 4.34 17.07l-1.41-1.41L15.66 2.93z"/>',y='<path d="M10 15 2 5h16z"/>',H='<path d="M13.728 1H6.272L1 6.272v7.456L6.272 19h7.456L19 13.728V6.272zM11 15H9v-2h2zm0-4H9V5h2z"/>',k='<path d="m17.5 4.75-7.5 7.5-7.5-7.5L1 6.25l9 9 9-9z"/>',S='<path d="M2 2a2 2 0 00-2 2v12a2 2 0 002 2h16a2 2 0 002-2V4a2 2 0 00-2-2zm-.17 13 4.09-5.25 2.92 3.51L12.92 8l5.25 7z"/>',_='<path d="M19 3H1v14h18zM3 14l3.5-4.5 2.5 3L12.5 8l4.5 6z"/><path d="M19 5H1V3h18zm0 12H1v-2h18z"/>',V='<path d="M8 19a1 1 0 001 1h2a1 1 0 001-1v-1H8zm9-12a7 7 0 10-12 4.9S7 14 7 15v1a1 1 0 001 1h4a1 1 0 001-1v-1c0-1 2-3.1 2-3.1A7 7 0 0017 7"/>',B='<path d="M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0M9 5h2v2H9zm0 4h2v6H9z"/>',E='<path d="M3 1h2v18H3zm13.5 1.5L15 1l-9 9 9 9 1.5-1.5L9 10z"/>',F='<path d="M15 1h2v18h-2zM3.5 2.5 11 10l-7.5 7.5L5 19l9-9-9-9z"/>',x='<path d="M7 1 5.6 2.5 13 10l-7.4 7.5L7 19l9-9z"/>',I='<path d="m4 10 9 9 1.4-1.5L7 10l7.4-7.5L13 1z"/>',b='<path d="M12.2 13.6a7 7 0 111.4-1.4l5.4 5.4-1.4 1.4zM3 8a5 5 0 1010 0A5 5 0 003 8"/>',A='<path d="M10 0 3 8h14zm0 18-7-8h14z"/>',w='<path d="M10 20a10 10 0 010-20 10 10 0 110 20m-2-5 9-8.5L15.5 5 8 12 4.5 8.5 3 10z"/>',q='<path d="m10 5 8 10H2z"/>',$=g,D=M,T=f,Z=L,G=C,O=y,P=H,Q=k,R=S,j=_,N={langCodeMap:{ar:V},default:B},X={ltr:E,shouldFlip:!0},J={ltr:F,shouldFlip:!0},K={ltr:x,shouldFlip:!0},U={ltr:I,shouldFlip:!0},W=b,Y=A,t1=w,e1=q;function n1(t,n,o){if(typeof t=="string"||"path"in t)return t;if("shouldFlip"in t)return t.ltr;if("rtl"in t)return o==="rtl"?t.rtl:t.ltr;const a=n in t.langCodeMap?t.langCodeMap[n]:t.default;return typeof a=="string"||"path"in a?a:a.ltr}function o1(t,n){if(typeof t=="string")return!1;if("langCodeMap"in t){const o=n in t.langCodeMap?t.langCodeMap[n]:t.default;if(typeof o=="string")return!1;t=o}if("shouldFlipExceptions"in t&&Array.isArray(t.shouldFlipExceptions)){const o=t.shouldFlipExceptions.indexOf(n);return o===void 0||o===-1}return"shouldFlip"in t?t.shouldFlip:!1}const l1=u.makeStringTypeValidator(u.IconSizes),a1=e.defineComponent({name:"CdxIcon",props:{icon:{type:[String,Object],required:!0},iconLabel:{type:String,default:""},lang:{type:String,default:null},dir:{type:String,default:null},size:{type:String,default:"medium",validator:l1}},setup(t){const n=e.ref(),o=v(n),a=m(n),d=e.computed(()=>{var l;return(l=t.dir)!=null?l:o.value}),i=e.computed(()=>{var l;return(l=t.lang)!=null?l:a.value}),s=e.computed(()=>({"cdx-icon--flipped":d.value==="rtl"&&i.value!==null&&o1(t.icon,i.value),["cdx-icon--".concat(t.size)]:!0})),r=e.computed(()=>{var l,p;return n1(t.icon,(l=i.value)!=null?l:"",(p=d.value)!=null?p:"ltr")}),c=e.computed(()=>typeof r.value=="string"?r.value:""),h=e.computed(()=>typeof r.value!="string"?r.value.path:"");return{rootElement:n,rootClasses:s,iconSvg:c,iconPath:h}}}),i1=["aria-hidden"],r1={key:0},d1=["innerHTML"],p1=["d"];function u1(t,n,o,a,d,i){return e.openBlock(),e.createElementBlock("span",{ref:"rootElement",class:e.normalizeClass(["cdx-icon",t.rootClasses])},[(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20","aria-hidden":t.iconLabel?void 0:!0},[t.iconLabel?(e.openBlock(),e.createElementBlock("title",r1,e.toDisplayString(t.iconLabel),1)):e.createCommentVNode("v-if",!0),t.iconSvg?(e.openBlock(),e.createElementBlock("g",{key:1,innerHTML:t.iconSvg},null,8,d1)):(e.openBlock(),e.createElementBlock("path",{key:2,d:t.iconPath},null,8,p1))],8,i1))],2)}const s1=z._export_sfc(a1,[["render",u1]]);exports.C4=Q;exports.CdxIcon=s1;exports.G4=R;exports.I3=$;exports.I4=P;exports.M4=O;exports.Q7=Y;exports.R3=D;exports.V7=U;exports.Z7=W;exports._4=j;exports.a7=J;exports.b8=e1;exports.c7=X;exports.l4=G;exports.l6=N;exports.o4=Z;exports.t4=T;exports.t8=t1;exports.v7=K;