sit-onyx 1.0.0-alpha.21 → 1.0.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +129 -108
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),S=["disabled"],T={class:"onyx-button__label"},N=e.defineComponent({__name:"OnyxButton",props:{label:{default:""},disabled:{type:Boolean,default:!1},type:{default:"button"},variation:{default:"primary"},mode:{default:"default"},icon:{}},emits:["click"],setup(o,{emit:n}){const t=o,l=n;return(r,a)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["onyx-button",[`onyx-button--${t.variation}`,`onyx-button--${t.mode}`]]),disabled:t.disabled,onClick:a[0]||(a[0]=c=>l("click"))},[t.icon?(e.openBlock(),e.createBlock(e.unref(g),{key:0,icon:t.icon,size:"24px"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",T,e.toDisplayString(t.label),1)],10,S))}}),$=["button","submit","reset"],I=["primary","secondary","danger"],L=["default","outline","plain"],M="(optional)",q={tooShort:"Please lengthen this text to {minLength} characters or more (you are currently using 1 character) | Please lengthen this text to {minLength} characters or more (you are currently using {n} characters)",tooLong:"Please shorten this text to {maxLength} characters or less (you are currently using 1 character) | Please shorten this text to {maxLength} characters or less (you are currently using {n} characters)",rangeUnderflow:"Value must be greater than or equal to {min}",rangeOverflow:"Value must be less than or equal to {max}",patternMismatch:"Please match the format requested.",valueMissing:"Please fill in this field.",stepMismatch:"Please enter a value that is a multiple of {step}.",badInput:'"{value}" does not match the expected type.',typeMismatch:{generic:'"{value}" does not match the expected type.',email:'"{value}" must be a valid email address.',number:'"{value}" must be a number.',tel:'"{value}" must be a valid phone number.',url:'"{value}" must a valid URL.'}},w="Select all",y={optional:M,validations:q,selectAll:w},V=Symbol(),E=o=>{const n=e.computed(()=>e.unref(o==null?void 0:o.locale)??"en-US"),t=e.computed(()=>o!=null&&o.messages&&n.value in o.messages?o.messages[n.value]:y),l=e.computed(()=>(r,a={})=>{let c=B(r,t.value)??B(r,y)??"";const s=typeof a.n=="number"?a.n:void 0;return c=D(c,s),z(c,a)});return{locale:n,t:l}},P=(o,n)=>o.provide(V,E(n)),h=()=>e.inject(V,()=>E(),!0),B=(o,n)=>{const t=o.split(".").reduce((l,r)=>!l||typeof l=="string"?l:l[r],n);return t&&typeof t=="string"?t:void 0},D=(o,n)=>{const t=o.split(" | ").map(r=>r.trim());if(t.length<=1)return o;let l=1;return n===0&&(l=0),n&&(n<=0||n>1)&&(l=2),t.length===2?l===1?t[0]:t[1]:t[l]},z=(o,n)=>n?Object.entries(n).reduce((l,[r,a])=>a===void 0?l:l.replace(new RegExp(`{${r}}`,"gi"),a.toString()),o).replace(/\s?{.*}\s?/gi,""):o,U={class:"onyx-checkbox__container"},R=["aria-label","indeterminate","disabled","required"],A={key:0,class:"onyx-checkbox__label"},C=e.defineComponent({__name:"OnyxCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{default:""},indeterminate:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},hideLabel:{type:Boolean}},emits:["update:modelValue"],setup(o,{emit:n}){const t=o,l=n,r=e.computed({get:()=>t.modelValue,set:c=>l("update:modelValue",c)}),a=e.ref(!1);return(c,s)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["onyx-checkbox",{"onyx-required-marker":t.required,"onyx-optional-marker":!t.required}])},[e.createElementVNode("div",U,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=u=>r.value=u),"aria-label":t.hideLabel?t.label:void 0,class:e.normalizeClass(["onyx-checkbox__input",{"onyx-checkbox__input--touched":a.value}]),type:"checkbox",indeterminate:t.indeterminate,disabled:t.disabled,required:t.required,onBlur:s[1]||(s[1]=u=>a.value=!0)},null,42,R),[[e.vModelCheckbox,r.value]])]),t.label&&!t.hideLabel?(e.openBlock(),e.createElementBlock("p",A,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0)],2))}}),G=["disabled"],H={key:0,class:"onyx-checkbox-group__label"},Y=e.defineComponent({__name:"OnyxCheckboxGroup",props:{options:{},modelValue:{default:()=>[]},headline:{},direction:{default:"vertical"},withCheckAll:{type:Boolean,default:!1},checkAllLabel:{},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(o,{emit:n}){const t=o,l=n,{t:r}=h(),a=(i,m)=>{const d=m?[...t.modelValue,i]:t.modelValue.filter(f=>f!==i);l("update:modelValue",d)},c=e.computed(()=>t.options.filter(i=>!i.disabled)),s=i=>{const m=i?c.value.map(({id:d})=>d):[];l("update:modelValue",m)},u=e.computed(()=>{const i=c.value.map(({id:d})=>d),m=t.modelValue.filter(d=>i.includes(d));return!i.length||!m.length?{modelValue:!1}:m.length===i.length?{modelValue:!0}:{indeterminate:!0,modelValue:!1}});return(i,m)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"onyx-checkbox-group",disabled:t.disabled},[t.headline?(e.openBlock(),e.createElementBlock("legend",H,[e.createVNode(e.unref(x),{is:"h3"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.headline),1)]),_:1})])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["onyx-checkbox-group__content",{"onyx-checkbox-group__content--horizontal":t.direction==="horizontal"}])},[t.withCheckAll?(e.openBlock(),e.createBlock(C,e.mergeProps({key:0},u.value,{label:t.checkAllLabel||e.unref(r)("selectAll"),"onUpdate:modelValue":s}),null,16,["label"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,d=>(e.openBlock(),e.createBlock(C,e.mergeProps({key:d.id.toString()},d,{"model-value":t.modelValue.includes(d.id),"onUpdate:modelValue":f=>a(d.id,f)}),null,16,["model-value","onUpdate:modelValue"]))),128))],2)],8,G))}}),j=["horizontal","vertical"],x=e.defineComponent({__name:"OnyxHeadline",props:{is:{},monospace:{type:Boolean,default:!1}},setup(o){const n=o;return(t,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.is),{class:e.normalizeClass(["onyx-headline",`onyx-headline--${n.is}`,n.monospace?"onyx-headline--monospace":""])},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},8,["class"]))}}),X=["h1","h2","h3","h4","h5","h6"],K=["innerHTML"],g=e.defineComponent({__name:"OnyxIcon",props:{icon:{},size:{default:"24px"},color:{default:"currentColor"}},setup(o){const n=o;return(t,l)=>(e.openBlock(),e.createElementBlock("figure",{class:e.normalizeClass(["onyx-icon",[n.size!=="24px"?`onyx-icon--${n.size}`:"",n.color!=="currentColor"?`onyx-icon--${n.color}`:""]]),"aria-hidden":"true",innerHTML:n.icon},null,10,K))}}),F=["12px","16px","24px","32px","48px","64px","96px"],Z=["href","target","rel"],J=e.defineComponent({__name:"OnyxLink",props:{href:{},target:{default:"_self"}},emits:["click"],setup(o,{emit:n}){const t=o,l=n;return(r,a)=>(e.openBlock(),e.createElementBlock("a",{class:"onyx-link",href:t.href,target:t.target,rel:t.target==="_blank"?"noopener noreferrer":void 0,onClick:a[0]||(a[0]=c=>l("click"))},[e.renderSlot(r.$slots,"default")],8,Z))}}),W=["_self","_blank","_parent","_top"],Q=(o,n)=>{const t=o.__vccOpts||o;for(const[l,r]of n)t[l]=r;return t},ee={},te={class:"onyx-circle-spinner",viewBox:"0 0 50 50"},ne=e.createElementVNode("circle",{class:"onyx-circle-spinner__circle",cx:"50%",cy:"50%",r:"45%"},null,-1),oe=[ne];function le(o,n){return e.openBlock(),e.createElementBlock("svg",te,oe)}const ae=Q(ee,[["render",le]]),re='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 32 32"><circle cx="27" cy="16" r="3"/><circle cx="16" cy="16" r="2"/><circle cx="5" cy="16" r="3"/></svg>',se=e.defineComponent({__name:"LoadingDots",setup(o){return(n,t)=>(e.openBlock(),e.createBlock(g,{icon:e.unref(re)},null,8,["icon"]))}}),ce=e.defineComponent({__name:"OnyxLoadingIndicator",props:{type:{default:"circle"}},setup(o){const n=o;return(t,l)=>n.type==="circle"?(e.openBlock(),e.createBlock(ae,{key:0})):n.type==="dots"?(e.openBlock(),e.createBlock(se,{key:1})):e.createCommentVNode("",!0)}}),ie=["title"],ue=["required","name","value","checked","disabled"],de={class:"onyx-radio-button__label"},pe=e.defineComponent({__name:"OnyxRadioButton",props:{id:{},label:{},value:{},disabled:{type:Boolean},selected:{type:Boolean},name:{},required:{type:Boolean},errorMessage:{}},setup(o){const n=o,t=e.ref();return e.watchEffect(()=>{var l;return(l=t.value)==null?void 0:l.setCustomValidity(n.errorMessage??"")}),(l,r)=>(e.openBlock(),e.createElementBlock("label",{class:"onyx-radio-button",title:n.errorMessage},[e.createElementVNode("input",{ref_key:"selectorRef",ref:t,class:"onyx-radio-button__selector",type:"radio",required:n.required,name:n.name,value:n.id,checked:n.selected,disabled:n.disabled},null,8,ue),e.createElementVNode("span",de,e.toDisplayString(n.label),1)],8,ie))}}),me=(()=>{let o=0;return()=>o++})(),_e=o=>`${o}-${me()}`,fe=["disabled"],ye={key:0,class:"onyx-radio-button-group__headline"},he=e.defineComponent({__name:"OnyxRadioButtonGroup",props:{name:{default:()=>_e("radio-button-group-name")},modelValue:{},headline:{default:""},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},errorMessage:{default:""},direction:{default:"vertical"},options:{}},emits:["update:modelValue"],setup(o,{emit:n}){const t=o,l=n,r=a=>l("update:modelValue",t.options.find(({id:c})=>a.target.value===c));return(a,c)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"onyx-radio-button-group",disabled:t.disabled,onChange:c[0]||(c[0]=s=>r(s))},[t.headline?(e.openBlock(),e.createElementBlock("legend",ye,[e.createVNode(x,{is:"h3",class:e.normalizeClass({"onyx-required-marker":t.required,"onyx-optional-marker":!t.required})},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.headline),1)]),_:1},8,["class"])])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["onyx-radio-button-group__content",{"onyx-radio-button-group__content--horizontal":t.direction==="horizontal"}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,s=>{var u;return e.openBlock(),e.createBlock(pe,{id:s.id,key:s.id,name:t.name,label:s.label,value:s.value,"error-message":t.errorMessage,selected:s.id===((u=t.modelValue)==null?void 0:u.id),disabled:s.disabled,required:t.required},null,8,["id","name","label","value","error-message","selected","disabled","required"])}),128))],2)],40,fe))}}),xe=(o,n)=>{const t=Object.entries(o).filter(([r,a])=>a!==void 0),l=Object.entries(n).filter(([r,a])=>a!==void 0);return t.length!==l.length?!1:t.every(([r,a])=>a===n[r])},O=()=>Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([o,n])=>n.enumerable).map(([o])=>o),ge=o=>O().reduce((n,t)=>(n[t]=o[t],n),{}),ve=o=>{if(o.valueMissing)return"valueMissing";const n=O().filter(t=>t!=="valid").sort();for(const t of n)if(t in o&&o[t])return t},be=Object.keys(y.validations.typeMismatch),ke={key:0,class:"onyx-input__error","aria-live":"polite"},Be={class:"onyx-input__info"},Ce=e.defineComponent({__name:"TestInput",props:{modelValue:{default:""},label:{default:""},errorMessage:{},required:{type:Boolean},pattern:{},type:{default:"text"},max:{},maxLength:{},min:{},step:{},minLength:{}},emits:["update:modelValue","change","validityChange"],setup(o,{emit:n}){var f;const t=o,l=n,{t:r}=h(),{errorMessage:a}=e.toRefs(t),c=e.ref(!1),s=e.ref(null),u=e.ref((f=s.value)==null?void 0:f.validity),i=e.computed({get:()=>t.modelValue,set:p=>l("update:modelValue",p)}),m=e.computed(()=>{if(!u.value||u.value.valid)return"";const p=ve(u.value);if(t.errorMessage||p==="customError")return t.errorMessage;if(!p)return"";if(p==="typeMismatch"){const _=be.includes(t.type)?t.type:"generic";return r.value(`validations.typeMismatch.${_}`,{value:i.value})}return r.value(`validations.${p}`,{value:i.value,n:i.value.toString().length,minLength:t.minLength,maxLength:t.maxLength,min:t.min,max:t.max,step:t.step})}),d=p=>{const _=p.target;l("change",_.value)};return e.watch([s,a],()=>{s.value&&s.value.setCustomValidity(t.errorMessage||"")}),e.watch([s,i,a],()=>{if(!s.value)return;const p=ge(s.value.validity);(!u.value||!xe(p,u.value))&&(u.value=p,l("validityChange",u.value))},{immediate:!0}),(p,_)=>{var v,b;return e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["onyx-input",{"onyx-input--touched":c.value}])},[e.createElementVNode("span",{class:e.normalizeClass(["onyx-input__label",{"onyx-input__label--required":t.required}])},e.toDisplayString(t.label),3),e.withDirectives(e.createElementVNode("input",e.mergeProps(t,{ref_key:"inputElement",ref:s,"onUpdate:modelValue":_[0]||(_[0]=k=>i.value=k),onChange:d,onBlur:_[1]||(_[1]=k=>c.value=!0)}),null,16),[[e.vModelDynamic,i.value]]),c.value&&!((v=u.value)!=null&&v.valid)?(e.openBlock(),e.createElementBlock("p",ke,e.toDisplayString(m.value),1)):e.createCommentVNode("",!0),e.createElementVNode("p",Be,'Model value: "'+e.toDisplayString(i.value)+'", is valid: '+e.toDisplayString((b=u.value)==null?void 0:b.valid),1)],2)}}}),Ve=["primary","secondary","neutral","danger","warning","success","info"],Ee=["small","default","large"],Oe=o=>({install:n=>{P(n,o.i18n);const t=n.runWithContext(()=>h());e.watchEffect(()=>Se(t.t.value("optional")))}}),Se=o=>globalThis.document.body.style.setProperty("--onyx-global-optional-text",o);exports.BUTTON_MODES=L;exports.BUTTON_TYPES=$;exports.BUTTON_VARIATIONS=I;exports.CHECKBOX_GROUP_DIRECTIONS=j;exports.HEADLINE_TYPES=X;exports.ICON_SIZES=F;exports.LINK_TARGETS=W;exports.ONYX_COLORS=Ve;exports.OnyxButton=N;exports.OnyxCheckboxGroup=Y;exports.OnyxHeadline=x;exports.OnyxIcon=g;exports.OnyxLink=J;exports.OnyxLoadingIndicator=ce;exports.OnyxRadioButtonGroup=he;exports.TEXT_SIZES=Ee;exports.TestInput=Ce;exports.createOnyx=Oe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),N=["disabled"],T={class:"onyx-button__label"},$=e.defineComponent({__name:"OnyxButton",props:{label:{default:""},disabled:{type:Boolean,default:!1},type:{default:"button"},variation:{default:"primary"},mode:{default:"default"},icon:{}},emits:["click"],setup(o,{emit:n}){const t=o,l=n;return(r,a)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["onyx-button",[`onyx-button--${t.variation}`,`onyx-button--${t.mode}`]]),disabled:t.disabled,onClick:a[0]||(a[0]=c=>l("click"))},[t.icon?(e.openBlock(),e.createBlock(e.unref(E),{key:0,icon:t.icon,size:"24px"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",T,e.toDisplayString(t.label),1)],10,N))}}),I=["button","submit","reset"],L=["primary","secondary","danger"],M=["default","outline","plain"],q="(optional)",P={tooShort:"Please lengthen this text to {minLength} characters or more (you are currently using 1 character) | Please lengthen this text to {minLength} characters or more (you are currently using {n} characters)",tooLong:"Please shorten this text to {maxLength} characters or less (you are currently using 1 character) | Please shorten this text to {maxLength} characters or less (you are currently using {n} characters)",rangeUnderflow:"Value must be greater than or equal to {min}",rangeOverflow:"Value must be less than or equal to {max}",patternMismatch:"Please match the format requested.",valueMissing:"Please fill in this field.",stepMismatch:"Please enter a value that is a multiple of {step}.",badInput:'"{value}" does not match the expected type.',typeMismatch:{generic:'"{value}" does not match the expected type.',email:'"{value}" must be a valid email address.',number:'"{value}" must be a number.',tel:'"{value}" must be a valid phone number.',url:'"{value}" must a valid URL.'}},z="Select all",h={optional:q,validations:P,selectAll:z},V=Symbol(),C=o=>{const n=e.computed(()=>e.unref(o==null?void 0:o.locale)??"en-US"),t=e.computed(()=>o!=null&&o.messages&&n.value in o.messages?o.messages[n.value]:h),l=e.computed(()=>(r,a={})=>{let c=k(r,t.value)??k(r,h)??"";const s=typeof a.n=="number"?a.n:void 0;return c=w(c,s),U(c,a)});return{locale:n,t:l}},D=(o,n)=>o.provide(V,C(n)),f=()=>e.inject(V,()=>C(),!0),k=(o,n)=>{const t=o.split(".").reduce((l,r)=>!l||typeof l=="string"?l:l[r],n);return t&&typeof t=="string"?t:void 0},w=(o,n)=>{const t=o.split(" | ").map(r=>r.trim());if(t.length<=1)return o;let l=1;return n===0&&(l=0),n&&(n<=0||n>1)&&(l=2),t.length===2?l===1?t[0]:t[1]:t[l]},U=(o,n)=>n?Object.entries(n).reduce((l,[r,a])=>a===void 0?l:l.replace(new RegExp(`{${r}}`,"gi"),a.toString()),o).replace(/\s?{.*}\s?/gi,""):o,R={class:"onyx-checkbox__container"},A=["aria-label","indeterminate","disabled","required"],G={key:0,class:"onyx-checkbox__label"},B=e.defineComponent({__name:"OnyxCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{default:""},indeterminate:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},hideLabel:{type:Boolean}},emits:["update:modelValue"],setup(o,{emit:n}){const t=o,l=n,r=e.computed({get:()=>t.modelValue,set:c=>l("update:modelValue",c)}),a=e.ref(!1);return(c,s)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["onyx-checkbox",{"onyx-required-marker":t.required,"onyx-optional-marker":!t.required}])},[e.createElementVNode("div",R,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=u=>r.value=u),"aria-label":t.hideLabel?t.label:void 0,class:e.normalizeClass(["onyx-checkbox__input",{"onyx-checkbox__input--touched":a.value}]),type:"checkbox",indeterminate:t.indeterminate,disabled:t.disabled,required:t.required,onBlur:s[1]||(s[1]=u=>a.value=!0)},null,42,A),[[e.vModelCheckbox,r.value]])]),t.label&&!t.hideLabel?(e.openBlock(),e.createElementBlock("p",G,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0)],2))}}),H=["disabled"],Y={key:0,class:"onyx-checkbox-group__label"},j=e.defineComponent({__name:"OnyxCheckboxGroup",props:{options:{},modelValue:{default:()=>[]},headline:{},direction:{default:"vertical"},withCheckAll:{type:Boolean,default:!1},checkAllLabel:{},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(o,{emit:n}){const t=o,l=n,{t:r}=f(),a=(i,p)=>{const d=p?[...t.modelValue,i]:t.modelValue.filter(y=>y!==i);l("update:modelValue",d)},c=e.computed(()=>t.options.filter(i=>!i.disabled)),s=i=>{const p=i?c.value.map(({id:d})=>d):[];l("update:modelValue",p)},u=e.computed(()=>{const i=c.value.map(({id:d})=>d),p=t.modelValue.filter(d=>i.includes(d));return!i.length||!p.length?{modelValue:!1}:p.length===i.length?{modelValue:!0}:{indeterminate:!0,modelValue:!1}});return(i,p)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"onyx-checkbox-group",disabled:t.disabled},[t.headline?(e.openBlock(),e.createElementBlock("legend",Y,[e.createVNode(e.unref(x),{is:"h3"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.headline),1)]),_:1})])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["onyx-checkbox-group__content",{"onyx-checkbox-group__content--horizontal":t.direction==="horizontal"}])},[t.withCheckAll?(e.openBlock(),e.createBlock(B,e.mergeProps({key:0},u.value,{label:t.checkAllLabel||e.unref(r)("selectAll"),"onUpdate:modelValue":s}),null,16,["label"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,d=>(e.openBlock(),e.createBlock(B,e.mergeProps({key:d.id.toString()},d,{"model-value":t.modelValue.includes(d.id),"onUpdate:modelValue":y=>a(d.id,y)}),null,16,["model-value","onUpdate:modelValue"]))),128))],2)],8,H))}}),X=["horizontal","vertical"],x=e.defineComponent({__name:"OnyxHeadline",props:{is:{},monospace:{type:Boolean,default:!1}},setup(o){const n=o;return(t,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.is),{class:e.normalizeClass(["onyx-headline",`onyx-headline--${n.is}`,n.monospace?"onyx-headline--monospace":""])},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},8,["class"]))}}),K=["h1","h2","h3","h4","h5","h6"],F=["innerHTML"],E=e.defineComponent({__name:"OnyxIcon",props:{icon:{},size:{default:"24px"},color:{default:"currentColor"}},setup(o){const n=o;return(t,l)=>(e.openBlock(),e.createElementBlock("figure",{class:e.normalizeClass(["onyx-icon",[n.size!=="24px"?`onyx-icon--${n.size}`:"",n.color!=="currentColor"?`onyx-icon--${n.color}`:""]]),"aria-hidden":"true",innerHTML:n.icon},null,10,F))}}),Z=["12px","16px","24px","32px","48px","64px","96px"],J=["href","target","rel"],W=e.defineComponent({__name:"OnyxLink",props:{href:{},target:{default:"_self"}},emits:["click"],setup(o,{emit:n}){const t=o,l=n;return(r,a)=>(e.openBlock(),e.createElementBlock("a",{class:"onyx-link",href:t.href,target:t.target,rel:t.target==="_blank"?"noopener noreferrer":void 0,onClick:a[0]||(a[0]=c=>l("click"))},[e.renderSlot(r.$slots,"default")],8,J))}}),Q=["_self","_blank","_parent","_top"],O=(o,n)=>{const t=o.__vccOpts||o;for(const[l,r]of n)t[l]=r;return t},ee={},te={class:"onyx-circle-spinner",viewBox:"0 0 50 50"},ne=e.createElementVNode("circle",{class:"onyx-circle-spinner__circle",cx:"50%",cy:"50%",r:"45%"},null,-1),oe=[ne];function le(o,n){return e.openBlock(),e.createElementBlock("svg",te,oe)}const ae=O(ee,[["render",le]]),re={},se={class:"onyx-loading-dots",viewBox:"0 0 32 32"},ce=e.createElementVNode("circle",{class:"onyx-loading-dots__circle",cx:"5",cy:"16",r:"3"},null,-1),ie=e.createElementVNode("circle",{class:"onyx-loading-dots__circle",cx:"16",cy:"16",r:"2"},null,-1),ue=e.createElementVNode("circle",{class:"onyx-loading-dots__circle",cx:"27",cy:"16",r:"3"},null,-1),de=[ce,ie,ue];function me(o,n){return e.openBlock(),e.createElementBlock("svg",se,de)}const pe=O(re,[["render",me]]),_e=e.defineComponent({__name:"OnyxLoadingIndicator",props:{type:{default:"circle"}},setup(o){const n=o;return(t,l)=>n.type==="circle"?(e.openBlock(),e.createBlock(ae,{key:0})):n.type==="dots"?(e.openBlock(),e.createBlock(pe,{key:1})):e.createCommentVNode("",!0)}}),ye=["title"],he=["required","name","value","checked","disabled"],fe={class:"onyx-radio-button__label"},xe=e.defineComponent({__name:"OnyxRadioButton",props:{id:{},label:{},value:{},disabled:{type:Boolean},selected:{type:Boolean},name:{},required:{type:Boolean},errorMessage:{}},setup(o){const n=o,t=e.ref();return e.watchEffect(()=>{var l;return(l=t.value)==null?void 0:l.setCustomValidity(n.errorMessage??"")}),(l,r)=>(e.openBlock(),e.createElementBlock("label",{class:"onyx-radio-button",title:n.errorMessage},[e.createElementVNode("input",{ref_key:"selectorRef",ref:t,class:"onyx-radio-button__selector",type:"radio",required:n.required,name:n.name,value:n.id,checked:n.selected,disabled:n.disabled},null,8,he),e.createElementVNode("span",fe,e.toDisplayString(n.label),1)],8,ye))}}),ge=(()=>{let o=0;return()=>o++})(),be=o=>`${o}-${ge()}`,ve=["disabled"],ke={key:0,class:"onyx-radio-button-group__headline"},Be=e.defineComponent({__name:"OnyxRadioButtonGroup",props:{name:{default:()=>be("radio-button-group-name")},modelValue:{},headline:{default:""},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},errorMessage:{default:""},direction:{default:"vertical"},options:{}},emits:["update:modelValue"],setup(o,{emit:n}){const t=o,l=n,r=a=>l("update:modelValue",t.options.find(({id:c})=>a.target.value===c));return(a,c)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"onyx-radio-button-group",disabled:t.disabled,onChange:c[0]||(c[0]=s=>r(s))},[t.headline?(e.openBlock(),e.createElementBlock("legend",ke,[e.createVNode(x,{is:"h3",class:e.normalizeClass({"onyx-required-marker":t.required,"onyx-optional-marker":!t.required})},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.headline),1)]),_:1},8,["class"])])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["onyx-radio-button-group__content",{"onyx-radio-button-group__content--horizontal":t.direction==="horizontal"}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,s=>{var u;return e.openBlock(),e.createBlock(xe,{id:s.id,key:s.id,name:t.name,label:s.label,value:s.value,"error-message":t.errorMessage,selected:s.id===((u=t.modelValue)==null?void 0:u.id),disabled:s.disabled,required:t.required},null,8,["id","name","label","value","error-message","selected","disabled","required"])}),128))],2)],40,ve))}}),Ve=(o,n)=>{const t=Object.entries(o).filter(([r,a])=>a!==void 0),l=Object.entries(n).filter(([r,a])=>a!==void 0);return t.length!==l.length?!1:t.every(([r,a])=>a===n[r])},S=()=>Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([o,n])=>n.enumerable).map(([o])=>o),Ce=o=>S().reduce((n,t)=>(n[t]=o[t],n),{}),Ee=o=>{if(o.valueMissing)return"valueMissing";const n=S().filter(t=>t!=="valid").sort();for(const t of n)if(t in o&&o[t])return t},Oe=Object.keys(h.validations.typeMismatch),Se={key:0,class:"onyx-input__error","aria-live":"polite"},Ne={class:"onyx-input__info"},Te=e.defineComponent({__name:"TestInput",props:{modelValue:{default:""},label:{default:""},errorMessage:{},required:{type:Boolean},pattern:{},type:{default:"text"},max:{},maxLength:{},min:{},step:{},minLength:{}},emits:["update:modelValue","change","validityChange"],setup(o,{emit:n}){var y;const t=o,l=n,{t:r}=f(),{errorMessage:a}=e.toRefs(t),c=e.ref(!1),s=e.ref(null),u=e.ref((y=s.value)==null?void 0:y.validity),i=e.computed({get:()=>t.modelValue,set:m=>l("update:modelValue",m)}),p=e.computed(()=>{if(!u.value||u.value.valid)return"";const m=Ee(u.value);if(t.errorMessage||m==="customError")return t.errorMessage;if(!m)return"";if(m==="typeMismatch"){const _=Oe.includes(t.type)?t.type:"generic";return r.value(`validations.typeMismatch.${_}`,{value:i.value})}return r.value(`validations.${m}`,{value:i.value,n:i.value.toString().length,minLength:t.minLength,maxLength:t.maxLength,min:t.min,max:t.max,step:t.step})}),d=m=>{const _=m.target;l("change",_.value)};return e.watch([s,a],()=>{s.value&&s.value.setCustomValidity(t.errorMessage||"")}),e.watch([s,i,a],()=>{if(!s.value)return;const m=Ce(s.value.validity);(!u.value||!Ve(m,u.value))&&(u.value=m,l("validityChange",u.value))},{immediate:!0}),(m,_)=>{var g,b;return e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["onyx-input",{"onyx-input--touched":c.value}])},[e.createElementVNode("span",{class:e.normalizeClass(["onyx-input__label",{"onyx-input__label--required":t.required}])},e.toDisplayString(t.label),3),e.withDirectives(e.createElementVNode("input",e.mergeProps(t,{ref_key:"inputElement",ref:s,"onUpdate:modelValue":_[0]||(_[0]=v=>i.value=v),onChange:d,onBlur:_[1]||(_[1]=v=>c.value=!0)}),null,16),[[e.vModelDynamic,i.value]]),c.value&&!((g=u.value)!=null&&g.valid)?(e.openBlock(),e.createElementBlock("p",Se,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("p",Ne,'Model value: "'+e.toDisplayString(i.value)+'", is valid: '+e.toDisplayString((b=u.value)==null?void 0:b.valid),1)],2)}}}),$e=["primary","secondary","neutral","danger","warning","success","info"],Ie=["small","default","large"],Le=o=>({install:n=>{D(n,o.i18n);const t=n.runWithContext(()=>f());e.watchEffect(()=>Me(t.t.value("optional")))}}),Me=o=>globalThis.document.body.style.setProperty("--onyx-global-optional-text",o);exports.BUTTON_MODES=M;exports.BUTTON_TYPES=I;exports.BUTTON_VARIATIONS=L;exports.CHECKBOX_GROUP_DIRECTIONS=X;exports.HEADLINE_TYPES=K;exports.ICON_SIZES=Z;exports.LINK_TARGETS=Q;exports.ONYX_COLORS=$e;exports.OnyxButton=$;exports.OnyxCheckboxGroup=j;exports.OnyxHeadline=x;exports.OnyxIcon=E;exports.OnyxLink=W;exports.OnyxLoadingIndicator=_e;exports.OnyxRadioButtonGroup=Be;exports.TEXT_SIZES=Ie;exports.TestInput=Te;exports.createOnyx=Le;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const Q = ["disabled"], ee = { class: "onyx-button__label" },
|
|
1
|
+
import { defineComponent as y, openBlock as s, createElementBlock as d, normalizeClass as h, createBlock as v, unref as O, createCommentVNode as k, createElementVNode as m, toDisplayString as x, inject as K, computed as b, ref as V, withDirectives as P, vModelCheckbox as X, createVNode as U, withCtx as B, createTextVNode as w, mergeProps as C, Fragment as R, renderList as z, resolveDynamicComponent as Z, renderSlot as A, watchEffect as D, toRefs as J, watch as E, vModelDynamic as W } from "vue";
|
|
2
|
+
const Q = ["disabled"], ee = { class: "onyx-button__label" }, He = /* @__PURE__ */ y({
|
|
3
3
|
__name: "OnyxButton",
|
|
4
4
|
props: {
|
|
5
5
|
label: { default: "" },
|
|
@@ -13,19 +13,19 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
13
13
|
setup(n, { emit: t }) {
|
|
14
14
|
const e = n, a = t;
|
|
15
15
|
return (o, l) => (s(), d("button", {
|
|
16
|
-
class:
|
|
16
|
+
class: h(["onyx-button", [`onyx-button--${e.variation}`, `onyx-button--${e.mode}`]]),
|
|
17
17
|
disabled: e.disabled,
|
|
18
18
|
onClick: l[0] || (l[0] = (i) => a("click"))
|
|
19
19
|
}, [
|
|
20
|
-
e.icon ? (s(),
|
|
20
|
+
e.icon ? (s(), v(O(me), {
|
|
21
21
|
key: 0,
|
|
22
22
|
icon: e.icon,
|
|
23
23
|
size: "24px"
|
|
24
24
|
}, null, 8, ["icon"])) : k("", !0),
|
|
25
|
-
|
|
25
|
+
m("span", ee, x(e.label), 1)
|
|
26
26
|
], 10, Q));
|
|
27
27
|
}
|
|
28
|
-
}),
|
|
28
|
+
}), Ye = ["button", "submit", "reset"], Fe = ["primary", "secondary", "danger"], Ke = ["default", "outline", "plain"], te = "(optional)", ne = {
|
|
29
29
|
tooShort: "Please lengthen this text to {minLength} characters or more (you are currently using 1 character) | Please lengthen this text to {minLength} characters or more (you are currently using {n} characters)",
|
|
30
30
|
tooLong: "Please shorten this text to {maxLength} characters or less (you are currently using 1 character) | Please shorten this text to {maxLength} characters or less (you are currently using {n} characters)",
|
|
31
31
|
rangeUnderflow: "Value must be greater than or equal to {min}",
|
|
@@ -46,7 +46,7 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
46
46
|
validations: ne,
|
|
47
47
|
selectAll: ae
|
|
48
48
|
}, G = Symbol(), j = (n) => {
|
|
49
|
-
const t =
|
|
49
|
+
const t = b(() => O(n == null ? void 0 : n.locale) ?? "en-US"), e = b(() => n != null && n.messages && t.value in n.messages ? n.messages[t.value] : T), a = b(() => (o, l = {}) => {
|
|
50
50
|
let i = q(o, e.value) ?? q(o, T) ?? "";
|
|
51
51
|
const r = typeof l.n == "number" ? l.n : void 0;
|
|
52
52
|
return i = oe(i, r), re(i, l);
|
|
@@ -64,7 +64,7 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
64
64
|
}, re = (n, t) => t ? Object.entries(t).reduce((a, [o, l]) => l === void 0 ? a : a.replace(new RegExp(`{${o}}`, "gi"), l.toString()), n).replace(/\s?{.*}\s?/gi, "") : n, se = { class: "onyx-checkbox__container" }, ie = ["aria-label", "indeterminate", "disabled", "required"], ce = {
|
|
65
65
|
key: 0,
|
|
66
66
|
class: "onyx-checkbox__label"
|
|
67
|
-
},
|
|
67
|
+
}, N = /* @__PURE__ */ y({
|
|
68
68
|
__name: "OnyxCheckbox",
|
|
69
69
|
props: {
|
|
70
70
|
modelValue: { type: Boolean, default: !1 },
|
|
@@ -76,21 +76,21 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
76
76
|
},
|
|
77
77
|
emits: ["update:modelValue"],
|
|
78
78
|
setup(n, { emit: t }) {
|
|
79
|
-
const e = n, a = t, o =
|
|
79
|
+
const e = n, a = t, o = b({
|
|
80
80
|
get: () => e.modelValue,
|
|
81
81
|
set: (i) => a("update:modelValue", i)
|
|
82
|
-
}), l =
|
|
82
|
+
}), l = V(!1);
|
|
83
83
|
return (i, r) => (s(), d("label", {
|
|
84
|
-
class:
|
|
84
|
+
class: h(["onyx-checkbox", {
|
|
85
85
|
"onyx-required-marker": e.required,
|
|
86
86
|
"onyx-optional-marker": !e.required
|
|
87
87
|
}])
|
|
88
88
|
}, [
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
m("div", se, [
|
|
90
|
+
P(m("input", {
|
|
91
91
|
"onUpdate:modelValue": r[0] || (r[0] = (u) => o.value = u),
|
|
92
92
|
"aria-label": e.hideLabel ? e.label : void 0,
|
|
93
|
-
class:
|
|
93
|
+
class: h(["onyx-checkbox__input", { "onyx-checkbox__input--touched": l.value }]),
|
|
94
94
|
type: "checkbox",
|
|
95
95
|
indeterminate: e.indeterminate,
|
|
96
96
|
disabled: e.disabled,
|
|
@@ -106,7 +106,7 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
106
106
|
}), ue = ["disabled"], de = {
|
|
107
107
|
key: 0,
|
|
108
108
|
class: "onyx-checkbox-group__label"
|
|
109
|
-
},
|
|
109
|
+
}, Xe = /* @__PURE__ */ y({
|
|
110
110
|
__name: "OnyxCheckboxGroup",
|
|
111
111
|
props: {
|
|
112
112
|
options: {},
|
|
@@ -120,12 +120,12 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
120
120
|
emits: ["update:modelValue"],
|
|
121
121
|
setup(n, { emit: t }) {
|
|
122
122
|
const e = n, a = t, { t: o } = L(), l = (c, f) => {
|
|
123
|
-
const p = f ? [...e.modelValue, c] : e.modelValue.filter((
|
|
123
|
+
const p = f ? [...e.modelValue, c] : e.modelValue.filter(($) => $ !== c);
|
|
124
124
|
a("update:modelValue", p);
|
|
125
|
-
}, i =
|
|
125
|
+
}, i = b(() => e.options.filter((c) => !c.disabled)), r = (c) => {
|
|
126
126
|
const f = c ? i.value.map(({ id: p }) => p) : [];
|
|
127
127
|
a("update:modelValue", f);
|
|
128
|
-
}, u =
|
|
128
|
+
}, u = b(() => {
|
|
129
129
|
const c = i.value.map(({ id: p }) => p), f = e.modelValue.filter((p) => c.includes(p));
|
|
130
130
|
return !c.length || !f.length ? { modelValue: !1 } : f.length === c.length ? { modelValue: !0 } : { indeterminate: !0, modelValue: !1 };
|
|
131
131
|
});
|
|
@@ -134,30 +134,30 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
134
134
|
disabled: e.disabled
|
|
135
135
|
}, [
|
|
136
136
|
e.headline ? (s(), d("legend", de, [
|
|
137
|
-
|
|
137
|
+
U(O(H), { is: "h3" }, {
|
|
138
138
|
default: B(() => [
|
|
139
|
-
|
|
139
|
+
w(x(e.headline), 1)
|
|
140
140
|
]),
|
|
141
141
|
_: 1
|
|
142
142
|
})
|
|
143
143
|
])) : k("", !0),
|
|
144
|
-
|
|
145
|
-
class:
|
|
144
|
+
m("div", {
|
|
145
|
+
class: h(["onyx-checkbox-group__content", { "onyx-checkbox-group__content--horizontal": e.direction === "horizontal" }])
|
|
146
146
|
}, [
|
|
147
|
-
e.withCheckAll ? (s(),
|
|
148
|
-
label: e.checkAllLabel ||
|
|
147
|
+
e.withCheckAll ? (s(), v(N, C({ key: 0 }, u.value, {
|
|
148
|
+
label: e.checkAllLabel || O(o)("selectAll"),
|
|
149
149
|
"onUpdate:modelValue": r
|
|
150
150
|
}), null, 16, ["label"])) : k("", !0),
|
|
151
|
-
(s(!0), d(R, null, z(e.options, (p) => (s(),
|
|
151
|
+
(s(!0), d(R, null, z(e.options, (p) => (s(), v(N, C({
|
|
152
152
|
key: p.id.toString()
|
|
153
153
|
}, p, {
|
|
154
154
|
"model-value": e.modelValue.includes(p.id),
|
|
155
|
-
"onUpdate:modelValue": (
|
|
155
|
+
"onUpdate:modelValue": ($) => l(p.id, $)
|
|
156
156
|
}), null, 16, ["model-value", "onUpdate:modelValue"]))), 128))
|
|
157
157
|
], 2)
|
|
158
158
|
], 8, ue));
|
|
159
159
|
}
|
|
160
|
-
}),
|
|
160
|
+
}), Ze = ["horizontal", "vertical"], H = /* @__PURE__ */ y({
|
|
161
161
|
__name: "OnyxHeadline",
|
|
162
162
|
props: {
|
|
163
163
|
is: {},
|
|
@@ -165,8 +165,8 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
165
165
|
},
|
|
166
166
|
setup(n) {
|
|
167
167
|
const t = n;
|
|
168
|
-
return (e, a) => (s(),
|
|
169
|
-
class:
|
|
168
|
+
return (e, a) => (s(), v(Z(t.is), {
|
|
169
|
+
class: h([
|
|
170
170
|
"onyx-headline",
|
|
171
171
|
`onyx-headline--${t.is}`,
|
|
172
172
|
t.monospace ? "onyx-headline--monospace" : ""
|
|
@@ -178,7 +178,7 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
178
178
|
_: 3
|
|
179
179
|
}, 8, ["class"]));
|
|
180
180
|
}
|
|
181
|
-
}),
|
|
181
|
+
}), Je = ["h1", "h2", "h3", "h4", "h5", "h6"], pe = ["innerHTML"], me = /* @__PURE__ */ y({
|
|
182
182
|
__name: "OnyxIcon",
|
|
183
183
|
props: {
|
|
184
184
|
icon: {},
|
|
@@ -188,7 +188,7 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
188
188
|
setup(n) {
|
|
189
189
|
const t = n;
|
|
190
190
|
return (e, a) => (s(), d("figure", {
|
|
191
|
-
class:
|
|
191
|
+
class: h(["onyx-icon", [
|
|
192
192
|
t.size !== "24px" ? `onyx-icon--${t.size}` : "",
|
|
193
193
|
t.color !== "currentColor" ? `onyx-icon--${t.color}` : ""
|
|
194
194
|
]]),
|
|
@@ -196,7 +196,7 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
196
196
|
innerHTML: t.icon
|
|
197
197
|
}, null, 10, pe));
|
|
198
198
|
}
|
|
199
|
-
}),
|
|
199
|
+
}), We = ["12px", "16px", "24px", "32px", "48px", "64px", "96px"], _e = ["href", "target", "rel"], Qe = /* @__PURE__ */ y({
|
|
200
200
|
__name: "OnyxLink",
|
|
201
201
|
props: {
|
|
202
202
|
href: {},
|
|
@@ -213,9 +213,9 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
213
213
|
onClick: l[0] || (l[0] = (i) => a("click"))
|
|
214
214
|
}, [
|
|
215
215
|
A(o.$slots, "default")
|
|
216
|
-
], 8,
|
|
216
|
+
], 8, _e));
|
|
217
217
|
}
|
|
218
|
-
}),
|
|
218
|
+
}), et = ["_self", "_blank", "_parent", "_top"], Y = (n, t) => {
|
|
219
219
|
const e = n.__vccOpts || n;
|
|
220
220
|
for (const [a, o] of t)
|
|
221
221
|
e[a] = o;
|
|
@@ -223,7 +223,7 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
223
223
|
}, he = {}, ye = {
|
|
224
224
|
class: "onyx-circle-spinner",
|
|
225
225
|
viewBox: "0 0 50 50"
|
|
226
|
-
}, fe = /* @__PURE__ */
|
|
226
|
+
}, fe = /* @__PURE__ */ m("circle", {
|
|
227
227
|
class: "onyx-circle-spinner__circle",
|
|
228
228
|
cx: "50%",
|
|
229
229
|
cy: "50%",
|
|
@@ -234,21 +234,42 @@ const Q = ["disabled"], ee = { class: "onyx-button__label" }, Re = /* @__PURE__
|
|
|
234
234
|
function ge(n, t) {
|
|
235
235
|
return s(), d("svg", ye, xe);
|
|
236
236
|
}
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
237
|
+
const be = /* @__PURE__ */ Y(he, [["render", ge]]), ve = {}, ke = {
|
|
238
|
+
class: "onyx-loading-dots",
|
|
239
|
+
viewBox: "0 0 32 32"
|
|
240
|
+
}, $e = /* @__PURE__ */ m("circle", {
|
|
241
|
+
class: "onyx-loading-dots__circle",
|
|
242
|
+
cx: "5",
|
|
243
|
+
cy: "16",
|
|
244
|
+
r: "3"
|
|
245
|
+
}, null, -1), Ve = /* @__PURE__ */ m("circle", {
|
|
246
|
+
class: "onyx-loading-dots__circle",
|
|
247
|
+
cx: "16",
|
|
248
|
+
cy: "16",
|
|
249
|
+
r: "2"
|
|
250
|
+
}, null, -1), Oe = /* @__PURE__ */ m("circle", {
|
|
251
|
+
class: "onyx-loading-dots__circle",
|
|
252
|
+
cx: "27",
|
|
253
|
+
cy: "16",
|
|
254
|
+
r: "3"
|
|
255
|
+
}, null, -1), Ce = [
|
|
256
|
+
$e,
|
|
257
|
+
Ve,
|
|
258
|
+
Oe
|
|
259
|
+
];
|
|
260
|
+
function Te(n, t) {
|
|
261
|
+
return s(), d("svg", ke, Ce);
|
|
262
|
+
}
|
|
263
|
+
const Be = /* @__PURE__ */ Y(ve, [["render", Te]]), tt = /* @__PURE__ */ y({
|
|
243
264
|
__name: "OnyxLoadingIndicator",
|
|
244
265
|
props: {
|
|
245
266
|
type: { default: "circle" }
|
|
246
267
|
},
|
|
247
268
|
setup(n) {
|
|
248
269
|
const t = n;
|
|
249
|
-
return (e, a) => t.type === "circle" ? (s(),
|
|
270
|
+
return (e, a) => t.type === "circle" ? (s(), v(be, { key: 0 })) : t.type === "dots" ? (s(), v(Be, { key: 1 })) : k("", !0);
|
|
250
271
|
}
|
|
251
|
-
}),
|
|
272
|
+
}), Le = ["title"], Me = ["required", "name", "value", "checked", "disabled"], Se = { class: "onyx-radio-button__label" }, Ie = /* @__PURE__ */ y({
|
|
252
273
|
__name: "OnyxRadioButton",
|
|
253
274
|
props: {
|
|
254
275
|
id: {},
|
|
@@ -261,7 +282,7 @@ const ve = /* @__PURE__ */ _e(he, [["render", ge]]), be = '<svg xmlns="http://ww
|
|
|
261
282
|
errorMessage: {}
|
|
262
283
|
},
|
|
263
284
|
setup(n) {
|
|
264
|
-
const t = n, e =
|
|
285
|
+
const t = n, e = V();
|
|
265
286
|
return D(() => {
|
|
266
287
|
var a;
|
|
267
288
|
return (a = e.value) == null ? void 0 : a.setCustomValidity(t.errorMessage ?? "");
|
|
@@ -269,7 +290,7 @@ const ve = /* @__PURE__ */ _e(he, [["render", ge]]), be = '<svg xmlns="http://ww
|
|
|
269
290
|
class: "onyx-radio-button",
|
|
270
291
|
title: t.errorMessage
|
|
271
292
|
}, [
|
|
272
|
-
|
|
293
|
+
m("input", {
|
|
273
294
|
ref_key: "selectorRef",
|
|
274
295
|
ref: e,
|
|
275
296
|
class: "onyx-radio-button__selector",
|
|
@@ -279,20 +300,20 @@ const ve = /* @__PURE__ */ _e(he, [["render", ge]]), be = '<svg xmlns="http://ww
|
|
|
279
300
|
value: t.id,
|
|
280
301
|
checked: t.selected,
|
|
281
302
|
disabled: t.disabled
|
|
282
|
-
}, null, 8,
|
|
283
|
-
|
|
284
|
-
], 8,
|
|
303
|
+
}, null, 8, Me),
|
|
304
|
+
m("span", Se, x(t.label), 1)
|
|
305
|
+
], 8, Le));
|
|
285
306
|
}
|
|
286
|
-
}),
|
|
307
|
+
}), Ee = /* @__PURE__ */ (() => {
|
|
287
308
|
let n = 0;
|
|
288
309
|
return () => n++;
|
|
289
|
-
})(),
|
|
310
|
+
})(), qe = (n) => `${n}-${Ee()}`, Ne = ["disabled"], Pe = {
|
|
290
311
|
key: 0,
|
|
291
312
|
class: "onyx-radio-button-group__headline"
|
|
292
|
-
},
|
|
313
|
+
}, nt = /* @__PURE__ */ y({
|
|
293
314
|
__name: "OnyxRadioButtonGroup",
|
|
294
315
|
props: {
|
|
295
|
-
name: { default: () =>
|
|
316
|
+
name: { default: () => qe("radio-button-group-name") },
|
|
296
317
|
modelValue: {},
|
|
297
318
|
headline: { default: "" },
|
|
298
319
|
required: { type: Boolean, default: !1 },
|
|
@@ -309,26 +330,26 @@ const ve = /* @__PURE__ */ _e(he, [["render", ge]]), be = '<svg xmlns="http://ww
|
|
|
309
330
|
disabled: e.disabled,
|
|
310
331
|
onChange: i[0] || (i[0] = (r) => o(r))
|
|
311
332
|
}, [
|
|
312
|
-
e.headline ? (s(), d("legend",
|
|
313
|
-
|
|
333
|
+
e.headline ? (s(), d("legend", Pe, [
|
|
334
|
+
U(H, {
|
|
314
335
|
is: "h3",
|
|
315
|
-
class:
|
|
336
|
+
class: h({
|
|
316
337
|
"onyx-required-marker": e.required,
|
|
317
338
|
"onyx-optional-marker": !e.required
|
|
318
339
|
})
|
|
319
340
|
}, {
|
|
320
341
|
default: B(() => [
|
|
321
|
-
|
|
342
|
+
w(x(e.headline), 1)
|
|
322
343
|
]),
|
|
323
344
|
_: 1
|
|
324
345
|
}, 8, ["class"])
|
|
325
346
|
])) : k("", !0),
|
|
326
|
-
|
|
327
|
-
class:
|
|
347
|
+
m("div", {
|
|
348
|
+
class: h(["onyx-radio-button-group__content", { "onyx-radio-button-group__content--horizontal": e.direction === "horizontal" }])
|
|
328
349
|
}, [
|
|
329
350
|
(s(!0), d(R, null, z(e.options, (r) => {
|
|
330
351
|
var u;
|
|
331
|
-
return s(),
|
|
352
|
+
return s(), v(Ie, {
|
|
332
353
|
id: r.id,
|
|
333
354
|
key: r.id,
|
|
334
355
|
name: e.name,
|
|
@@ -341,28 +362,28 @@ const ve = /* @__PURE__ */ _e(he, [["render", ge]]), be = '<svg xmlns="http://ww
|
|
|
341
362
|
}, null, 8, ["id", "name", "label", "value", "error-message", "selected", "disabled", "required"]);
|
|
342
363
|
}), 128))
|
|
343
364
|
], 2)
|
|
344
|
-
], 40,
|
|
365
|
+
], 40, Ne));
|
|
345
366
|
}
|
|
346
|
-
}),
|
|
367
|
+
}), Ue = (n, t) => {
|
|
347
368
|
const e = Object.entries(n).filter(([o, l]) => l !== void 0), a = Object.entries(t).filter(([o, l]) => l !== void 0);
|
|
348
369
|
return e.length !== a.length ? !1 : e.every(([o, l]) => l === t[o]);
|
|
349
|
-
}, F = () => Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([n, t]) => t.enumerable).map(([n]) => n),
|
|
370
|
+
}, F = () => Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([n, t]) => t.enumerable).map(([n]) => n), we = (n) => F().reduce(
|
|
350
371
|
(t, e) => (t[e] = n[e], t),
|
|
351
372
|
{}
|
|
352
|
-
),
|
|
373
|
+
), Re = (n) => {
|
|
353
374
|
if (n.valueMissing)
|
|
354
375
|
return "valueMissing";
|
|
355
376
|
const t = F().filter((e) => e !== "valid").sort();
|
|
356
377
|
for (const e of t)
|
|
357
378
|
if (e in n && n[e])
|
|
358
379
|
return e;
|
|
359
|
-
},
|
|
380
|
+
}, ze = Object.keys(
|
|
360
381
|
T.validations.typeMismatch
|
|
361
|
-
),
|
|
382
|
+
), Ae = {
|
|
362
383
|
key: 0,
|
|
363
384
|
class: "onyx-input__error",
|
|
364
385
|
"aria-live": "polite"
|
|
365
|
-
},
|
|
386
|
+
}, De = { class: "onyx-input__info" }, at = /* @__PURE__ */ y({
|
|
366
387
|
__name: "TestInput",
|
|
367
388
|
props: {
|
|
368
389
|
modelValue: { default: "" },
|
|
@@ -379,23 +400,23 @@ const ve = /* @__PURE__ */ _e(he, [["render", ge]]), be = '<svg xmlns="http://ww
|
|
|
379
400
|
},
|
|
380
401
|
emits: ["update:modelValue", "change", "validityChange"],
|
|
381
402
|
setup(n, { emit: t }) {
|
|
382
|
-
var
|
|
383
|
-
const e = n, a = t, { t: o } = L(), { errorMessage: l } = J(e), i =
|
|
403
|
+
var $;
|
|
404
|
+
const e = n, a = t, { t: o } = L(), { errorMessage: l } = J(e), i = V(!1), r = V(null), u = V(($ = r.value) == null ? void 0 : $.validity), c = b({
|
|
384
405
|
get: () => e.modelValue,
|
|
385
|
-
set: (
|
|
386
|
-
}), f =
|
|
406
|
+
set: (_) => a("update:modelValue", _)
|
|
407
|
+
}), f = b(() => {
|
|
387
408
|
if (!u.value || u.value.valid)
|
|
388
409
|
return "";
|
|
389
|
-
const
|
|
390
|
-
if (e.errorMessage ||
|
|
410
|
+
const _ = Re(u.value);
|
|
411
|
+
if (e.errorMessage || _ === "customError")
|
|
391
412
|
return e.errorMessage;
|
|
392
|
-
if (!
|
|
413
|
+
if (!_)
|
|
393
414
|
return "";
|
|
394
|
-
if (
|
|
395
|
-
const g =
|
|
415
|
+
if (_ === "typeMismatch") {
|
|
416
|
+
const g = ze.includes(e.type) ? e.type : "generic";
|
|
396
417
|
return o.value(`validations.typeMismatch.${g}`, { value: c.value });
|
|
397
418
|
}
|
|
398
|
-
return o.value(`validations.${
|
|
419
|
+
return o.value(`validations.${_}`, {
|
|
399
420
|
value: c.value,
|
|
400
421
|
n: c.value.toString().length,
|
|
401
422
|
minLength: e.minLength,
|
|
@@ -404,8 +425,8 @@ const ve = /* @__PURE__ */ _e(he, [["render", ge]]), be = '<svg xmlns="http://ww
|
|
|
404
425
|
max: e.max,
|
|
405
426
|
step: e.step
|
|
406
427
|
});
|
|
407
|
-
}), p = (
|
|
408
|
-
const g =
|
|
428
|
+
}), p = (_) => {
|
|
429
|
+
const g = _.target;
|
|
409
430
|
a("change", g.value);
|
|
410
431
|
};
|
|
411
432
|
return E([r, l], () => {
|
|
@@ -415,19 +436,19 @@ const ve = /* @__PURE__ */ _e(he, [["render", ge]]), be = '<svg xmlns="http://ww
|
|
|
415
436
|
() => {
|
|
416
437
|
if (!r.value)
|
|
417
438
|
return;
|
|
418
|
-
const
|
|
419
|
-
(!u.value || !
|
|
439
|
+
const _ = we(r.value.validity);
|
|
440
|
+
(!u.value || !Ue(_, u.value)) && (u.value = _, a("validityChange", u.value));
|
|
420
441
|
},
|
|
421
442
|
{ immediate: !0 }
|
|
422
|
-
), (
|
|
443
|
+
), (_, g) => {
|
|
423
444
|
var M, S;
|
|
424
445
|
return s(), d("label", {
|
|
425
|
-
class:
|
|
446
|
+
class: h(["onyx-input", { "onyx-input--touched": i.value }])
|
|
426
447
|
}, [
|
|
427
|
-
|
|
428
|
-
class:
|
|
448
|
+
m("span", {
|
|
449
|
+
class: h(["onyx-input__label", { "onyx-input__label--required": e.required }])
|
|
429
450
|
}, x(e.label), 3),
|
|
430
|
-
|
|
451
|
+
P(m("input", C(e, {
|
|
431
452
|
ref_key: "inputElement",
|
|
432
453
|
ref: r,
|
|
433
454
|
"onUpdate:modelValue": g[0] || (g[0] = (I) => c.value = I),
|
|
@@ -436,12 +457,12 @@ const ve = /* @__PURE__ */ _e(he, [["render", ge]]), be = '<svg xmlns="http://ww
|
|
|
436
457
|
}), null, 16), [
|
|
437
458
|
[W, c.value]
|
|
438
459
|
]),
|
|
439
|
-
i.value && !((M = u.value) != null && M.valid) ? (s(), d("p",
|
|
440
|
-
|
|
460
|
+
i.value && !((M = u.value) != null && M.valid) ? (s(), d("p", Ae, x(f.value), 1)) : k("", !0),
|
|
461
|
+
m("p", De, 'Model value: "' + x(c.value) + '", is valid: ' + x((S = u.value) == null ? void 0 : S.valid), 1)
|
|
441
462
|
], 2);
|
|
442
463
|
};
|
|
443
464
|
}
|
|
444
|
-
}),
|
|
465
|
+
}), lt = [
|
|
445
466
|
"primary",
|
|
446
467
|
"secondary",
|
|
447
468
|
"neutral",
|
|
@@ -449,30 +470,30 @@ const ve = /* @__PURE__ */ _e(he, [["render", ge]]), be = '<svg xmlns="http://ww
|
|
|
449
470
|
"warning",
|
|
450
471
|
"success",
|
|
451
472
|
"info"
|
|
452
|
-
],
|
|
473
|
+
], ot = ["small", "default", "large"], rt = (n) => ({
|
|
453
474
|
install: (t) => {
|
|
454
475
|
le(t, n.i18n);
|
|
455
476
|
const e = t.runWithContext(() => L());
|
|
456
|
-
D(() =>
|
|
477
|
+
D(() => Ge(e.t.value("optional")));
|
|
457
478
|
}
|
|
458
|
-
}),
|
|
479
|
+
}), Ge = (n) => globalThis.document.body.style.setProperty("--onyx-global-optional-text", n);
|
|
459
480
|
export {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
481
|
+
Ke as BUTTON_MODES,
|
|
482
|
+
Ye as BUTTON_TYPES,
|
|
483
|
+
Fe as BUTTON_VARIATIONS,
|
|
484
|
+
Ze as CHECKBOX_GROUP_DIRECTIONS,
|
|
485
|
+
Je as HEADLINE_TYPES,
|
|
486
|
+
We as ICON_SIZES,
|
|
487
|
+
et as LINK_TARGETS,
|
|
488
|
+
lt as ONYX_COLORS,
|
|
489
|
+
He as OnyxButton,
|
|
490
|
+
Xe as OnyxCheckboxGroup,
|
|
470
491
|
H as OnyxHeadline,
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
492
|
+
me as OnyxIcon,
|
|
493
|
+
Qe as OnyxLink,
|
|
494
|
+
tt as OnyxLoadingIndicator,
|
|
495
|
+
nt as OnyxRadioButtonGroup,
|
|
496
|
+
ot as TEXT_SIZES,
|
|
497
|
+
at as TestInput,
|
|
498
|
+
rt as createOnyx
|
|
478
499
|
};
|