sit-onyx 1.0.0-alpha.35 → 1.0.0-alpha.37
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/components/OnyxInput/OnyxInput.vue.d.ts +3 -0
- package/dist/components/OnyxInput/types.d.ts +46 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +203 -193
- package/dist/style.css +1 -1
- package/package.json +2 -1
- package/src/styles/fonts.scss +1 -0
|
@@ -2,6 +2,7 @@ import type { OnyxInputProps } from "./types";
|
|
|
2
2
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxInputProps>, {
|
|
3
3
|
modelValue: string;
|
|
4
4
|
type: string;
|
|
5
|
+
autocapitalize: string;
|
|
5
6
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
7
|
"update:modelValue": (value: string) => void;
|
|
7
8
|
blur: () => void;
|
|
@@ -10,6 +11,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
10
11
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxInputProps>, {
|
|
11
12
|
modelValue: string;
|
|
12
13
|
type: string;
|
|
14
|
+
autocapitalize: string;
|
|
13
15
|
}>>> & {
|
|
14
16
|
onFocus?: (() => any) | undefined;
|
|
15
17
|
onBlur?: (() => any) | undefined;
|
|
@@ -18,6 +20,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
18
20
|
}, {
|
|
19
21
|
type: "search" | "text" | "email" | "password" | "tel" | "url";
|
|
20
22
|
modelValue: string;
|
|
23
|
+
autocapitalize: "none" | "sentences" | "words" | "characters";
|
|
21
24
|
}, {}>;
|
|
22
25
|
export default _default;
|
|
23
26
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -15,6 +15,52 @@ export type OnyxInputProps = {
|
|
|
15
15
|
* Placeholder to show when the value is empty.
|
|
16
16
|
*/
|
|
17
17
|
placeholder?: string;
|
|
18
|
+
/**
|
|
19
|
+
* If and how text should be automatically be capitalized when using non-physical keyboards
|
|
20
|
+
* (such as virtual keyboard on mobile devices or voice input).
|
|
21
|
+
*
|
|
22
|
+
* Has no effect when `type` is set to "url", "email" or "password".
|
|
23
|
+
*
|
|
24
|
+
* @see [MDN autocapitalize](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize)
|
|
25
|
+
*/
|
|
26
|
+
autocapitalize?: Autocapitalize;
|
|
27
|
+
/**
|
|
28
|
+
* Specify how to provide automated assistance in filling out the input.
|
|
29
|
+
* Some autocomplete values might required specific browser permissions to be allowed by the user.
|
|
30
|
+
* Also browsers might require a `name` property.
|
|
31
|
+
*
|
|
32
|
+
* @see [MDN autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete)
|
|
33
|
+
*/
|
|
34
|
+
autocomplete?: Autocomplete;
|
|
35
|
+
/**
|
|
36
|
+
* Whether to focus the input on page load or when dialog/popover become shown if used inside a dialog/popover.
|
|
37
|
+
* Can only be enabled for one element inside a page/dialog/popover.
|
|
38
|
+
* Note: Has no effect when set after the component has been mounted.
|
|
39
|
+
*
|
|
40
|
+
* **UX / Accessibility**: autofocus should be used carefully since it can reduce usability and accessibility for users.
|
|
41
|
+
*/
|
|
42
|
+
autofocus?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Same as the native `name` attribute of `<input>`.
|
|
45
|
+
* Used to reference the input in JavaScript or in submitted form data.
|
|
46
|
+
*/
|
|
47
|
+
name?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Pattern the value must match to be valid.
|
|
50
|
+
*/
|
|
51
|
+
pattern?: string | RegExp;
|
|
18
52
|
};
|
|
19
53
|
export declare const INPUT_TYPES: readonly ["email", "password", "search", "tel", "text", "url"];
|
|
20
54
|
export type InputType = (typeof INPUT_TYPES)[number];
|
|
55
|
+
/**
|
|
56
|
+
* @see [MDN autocapitalize](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize)
|
|
57
|
+
*/
|
|
58
|
+
export declare const AUTOCAPITALIZE: readonly ["none", "sentences", "words", "characters"];
|
|
59
|
+
export type Autocapitalize = (typeof AUTOCAPITALIZE)[number];
|
|
60
|
+
/**
|
|
61
|
+
* Same as TypeScript native "Autofill" type but without "AutoFillSection" because
|
|
62
|
+
* the Vue compiler currently can not handle it (too complex union type).
|
|
63
|
+
*
|
|
64
|
+
* @since TypeScript version 5.2
|
|
65
|
+
*/
|
|
66
|
+
export type Autocomplete = Exclude<AutoFill, AutoFillSection | "">;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),L={key:0,class:"onyx-app__nav"},I={class:"onyx-app__page"},M={key:1,class:"onyx-app__page-overlay"},z={key:2,class:"onyx-app__app-overlay"},q=e.defineComponent({__name:"OnyxAppLayout",props:{navBarAlignment:{default:"top"}},setup(o){const n=o,t=e.useSlots();return(l,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["onyx-app",{"onyx-app--horizontal":n.navBarAlignment==="left"}])},[e.unref(t).navBar?(e.openBlock(),e.createElementBlock("nav",L,[e.renderSlot(l.$slots,"navBar")])):e.createCommentVNode("",!0),e.createElementVNode("div",I,[e.renderSlot(l.$slots,"default")]),e.unref(t).pageOverlay?(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(l.$slots,"pageOverlay")])):e.createCommentVNode("",!0),e.unref(t).appOverlay?(e.openBlock(),e.createElementBlock("div",z,[e.renderSlot(l.$slots,"appOverlay")])):e.createCommentVNode("",!0)],2))}}),P=["innerHTML"],h=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,P))}}),v=(o,n)=>{const t=o.__vccOpts||o;for(const[l,a]of n)t[l]=a;return t},U={},D={class:"onyx-skeleton"};function A(o,n){return e.openBlock(),e.createElementBlock("figure",D)}const y=v(U,[["render",A]]),R=["disabled"],Y={class:"onyx-button__label onyx-truncation-ellipsis"},G=e.defineComponent({__name:"OnyxButton",props:{label:{},disabled:{type:Boolean,default:!1},type:{default:"button"},variation:{default:"primary"},mode:{default:"default"},icon:{},skeleton:{type:Boolean,default:!1}},emits:["click"],setup(o,{emit:n}){const t=o,l=n;return(a,s)=>t.skeleton?(e.openBlock(),e.createBlock(y,{key:0,class:"onyx-button-skeleton"})):(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["onyx-button",[`onyx-button--${t.variation}`,`onyx-button--${t.mode}`]]),disabled:t.disabled,onClick:s[0]||(s[0]=c=>l("click"))},[t.icon?(e.openBlock(),e.createBlock(h,{key:0,icon:t.icon,size:"24px"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",Y,e.toDisplayString(t.label),1)],10,R))}}),F=["button","submit","reset"],H=["primary","secondary","danger"],j=["default","outline","plain"],X="(optional)",K={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",x={optional:X,validations:K,selectAll:Z},$=Symbol(),N=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]:x),l=e.computed(()=>(a,s={})=>{let c=C(a,t.value)??C(a,x)??"";const r=typeof s.n=="number"?s.n:void 0;return c=W(c,r),Q(c,s)});return{locale:n,t:l}},J=(o,n)=>o.provide($,N(n)),g=()=>e.inject($,()=>N(),!0),C=(o,n)=>{const t=o.split(".").reduce((l,a)=>!l||typeof l=="string"?l:l[a],n);return t&&typeof t=="string"?t:void 0},W=(o,n)=>{const t=o.split(" | ").map(a=>a.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]},Q=(o,n)=>n?Object.entries(n).reduce((l,[a,s])=>s===void 0?l:l.replace(new RegExp(`{${a}}`,"gi"),s.toString()),o).replace(/\s?{.*}\s?/gi,""):o,ee={key:0,class:"onyx-checkbox-skeleton"},te={class:"onyx-checkbox__container"},ne=["aria-label","indeterminate","disabled","required"],k=e.defineComponent({__name:"OnyxCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{},indeterminate:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},hideLabel:{type:Boolean},truncation:{default:"ellipsis"},skeleton:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(o,{emit:n}){const t=o,l=n,a=e.computed({get:()=>t.modelValue,set:c=>l("update:modelValue",c)}),s=e.ref(!1);return(c,r)=>t.skeleton?(e.openBlock(),e.createElementBlock("div",ee,[e.createVNode(y,{class:"onyx-checkbox-skeleton__input"}),t.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(y,{key:0,class:"onyx-checkbox-skeleton__label"}))])):(e.openBlock(),e.createElementBlock("label",{key:1,class:e.normalizeClass(["onyx-checkbox",{"onyx-required-marker":t.required,"onyx-optional-marker":!t.required}])},[e.createElementVNode("div",te,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=d=>a.value=d),"aria-label":t.hideLabel?t.label:void 0,class:e.normalizeClass(["onyx-checkbox__input",{"onyx-checkbox__input--touched":s.value}]),type:"checkbox",indeterminate:t.indeterminate,disabled:t.disabled,required:t.required,onBlur:r[1]||(r[1]=d=>s.value=!0)},null,42,ne),[[e.vModelCheckbox,a.value]])]),t.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("p",{key:0,class:e.normalizeClass(["onyx-checkbox__label",[`onyx-truncation-${t.truncation}`]])},e.toDisplayString(t.label),3))],2))}}),oe=["disabled"],le={key:0,class:"onyx-checkbox-group__label"},ae=e.defineComponent({__name:"OnyxCheckboxGroup",props:{options:{},modelValue:{default:()=>[]},headline:{},direction:{default:"vertical"},withCheckAll:{type:Boolean,default:!1},checkAllLabel:{},disabled:{type:Boolean,default:!1},skeleton:{}},emits:["update:modelValue"],setup(o,{emit:n}){const t=o,l=n,{t:a}=g(),s=(i,p)=>{const u=p?[...t.modelValue,i]:t.modelValue.filter(f=>f!==i);l("update:modelValue",u)},c=e.computed(()=>t.options.filter(i=>!i.disabled&&!i.skeleton)),r=i=>{const p=i?c.value.map(({id:u})=>u):[];l("update:modelValue",p)},d=e.computed(()=>{const i=c.value.map(({id:u})=>u),p=t.modelValue.filter(u=>i.includes(u));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",le,[e.createVNode(e.unref(b),{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.skeleton===void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.withCheckAll?(e.openBlock(),e.createBlock(k,e.mergeProps({key:0},d.value,{label:t.checkAllLabel||e.unref(a)("selectAll"),"onUpdate:modelValue":r}),null,16,["label"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,u=>(e.openBlock(),e.createBlock(k,e.mergeProps({key:u.id.toString()},u,{"model-value":t.modelValue.includes(u.id),"onUpdate:modelValue":f=>s(u.id,f)}),null,16,["model-value","onUpdate:modelValue"]))),128))],64)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.skeleton,u=>(e.openBlock(),e.createBlock(k,{key:u,label:`Skeleton ${u}`,skeleton:""},null,8,["label"]))),128))],2)],8,oe))}}),re=["horizontal","vertical"],b=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"]))}}),se=["h1","h2","h3","h4","h5","h6"],ce=["12px","16px","24px","32px","48px","64px","96px"],ie={class:"onyx-input"},de={class:"onyx-input__label onyx-text--small onyx-truncation-ellipsis"},ue={class:"onyx-input__wrapper"},pe=["placeholder","type"],me=e.defineComponent({__name:"OnyxInput",props:{label:{},modelValue:{default:""},type:{default:"text"},placeholder:{}},emits:["update:modelValue","change","focus","blur"],setup(o,{emit:n}){const t=o,l=n,a=e.computed({get:()=>t.modelValue,set:c=>l("update:modelValue",c)}),s=c=>{const r=c.target.value;l("change",r)};return(c,r)=>(e.openBlock(),e.createElementBlock("label",ie,[e.createElementVNode("span",de,e.toDisplayString(t.label),1),e.createElementVNode("div",ue,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=d=>a.value=d),class:"onyx-input__native",placeholder:t.placeholder,type:t.type,onChange:s,onFocus:r[1]||(r[1]=d=>l("focus")),onBlur:r[2]||(r[2]=d=>l("blur"))},null,40,pe),[[e.vModelDynamic,a.value]])])]))}}),_e=["email","password","search","tel","text","url"],ye='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 32 32"><path d="M12.2 10.55v2h5.836l-8.193 8.193 1.414 1.414 8.193-8.193V19.8h2v-9.25z"/></svg>',fe=o=>/^http(s?):\/\//.test(o),he=["href","target","rel"],ke=e.defineComponent({__name:"OnyxLink",props:{href:{},target:{default:"_self"},withExternalIcon:{type:[Boolean,String],default:"auto"}},emits:["click"],setup(o,{emit:n}){const t=o,l=n,a=e.computed(()=>t.withExternalIcon!=="auto"?t.withExternalIcon:fe(t.href));return(s,c)=>(e.openBlock(),e.createElementBlock("a",{class:"onyx-link",href:t.href,target:t.target,rel:t.target==="_blank"?"noreferrer":void 0,onClick:c[0]||(c[0]=r=>l("click"))},[e.renderSlot(s.$slots,"default"),a.value?(e.openBlock(),e.createBlock(h,{key:0,class:"onyx-link__icon",icon:e.unref(ye),size:"16px"},null,8,["icon"])):e.createCommentVNode("",!0)],8,he))}}),xe=["_self","_blank","_parent","_top"],ve={},ge={class:"onyx-circle-spinner",viewBox:"0 0 50 50"},be=e.createElementVNode("circle",{class:"onyx-circle-spinner__circle",cx:"50%",cy:"50%",r:"45%"},null,-1),Be=[be];function Ve(o,n){return e.openBlock(),e.createElementBlock("svg",ge,Be)}const Ee=v(ve,[["render",Ve]]),Ce={},Se={class:"onyx-loading-dots"},$e=e.createElementVNode("span",{class:"onyx-loading-dots__center"},null,-1),Ne=[$e];function Oe(o,n){return e.openBlock(),e.createElementBlock("div",Se,Ne)}const Te=v(Ce,[["render",Oe]]),we=e.defineComponent({__name:"OnyxLoadingIndicator",props:{type:{default:"dots"}},setup(o){const n=o;return(t,l)=>n.type==="circle"?(e.openBlock(),e.createBlock(Ee,{key:0})):n.type==="dots"?(e.openBlock(),e.createBlock(Te,{key:1})):e.createCommentVNode("",!0)}}),Le={key:0,class:"onyx-page__sidebar"},Ie={class:"onyx-page__main"},Me={key:1,class:"onyx-page__footer"},ze={key:2,class:"onyx-page__toasts"},qe=e.defineComponent({__name:"OnyxPageLayout",props:{footerAsideSidebar:{type:Boolean},hideSidebar:{type:Boolean}},setup(o){const n=o,t=e.useSlots(),l=e.computed(()=>{let a="";return!t.footer&&t.sidebar&&(a="onyx-page--side-main"),t.footer&&(!t.sidebar||n.hideSidebar)&&(a="onyx-page--main-footer"),t.footer&&t.sidebar&&(n.footerAsideSidebar?a="onyx-page--side-main-footer-partial":a="onyx-page--side-main-footer-full"),a});return(a,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["onyx-page",l.value])},[e.unref(t).sidebar&&!n.hideSidebar?(e.openBlock(),e.createElementBlock("aside",Le,[e.renderSlot(a.$slots,"sidebar")])):e.createCommentVNode("",!0),e.createElementVNode("main",Ie,[e.renderSlot(a.$slots,"default")]),e.unref(t).footer?(e.openBlock(),e.createElementBlock("footer",Me,[e.renderSlot(a.$slots,"footer")])):e.createCommentVNode("",!0),e.unref(t).toasts?(e.openBlock(),e.createElementBlock("div",ze,[e.renderSlot(a.$slots,"toasts")])):e.createCommentVNode("",!0)],2))}}),Pe=(()=>{let o=0;return()=>o++})(),Ue=o=>`${o}-${Pe()}`,De={key:0,class:"onyx-radio-button-skeleton"},Ae=["title"],Re=["required","name","value","checked","disabled"],S=e.defineComponent({__name:"OnyxRadioButton",props:{id:{},label:{},value:{},disabled:{type:Boolean,default:!1},truncation:{default:"ellipsis"},skeleton:{type:Boolean},selected:{type:Boolean,default:!1},name:{},required:{type:Boolean,default:!1},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,a)=>n.skeleton?(e.openBlock(),e.createElementBlock("div",De,[e.createVNode(y,{class:"onyx-radio-button-skeleton__input"}),e.createVNode(y,{class:"onyx-radio-button-skeleton__label"})])):(e.openBlock(),e.createElementBlock("label",{key:1,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,Re),e.createElementVNode("span",{class:e.normalizeClass(["onyx-radio-button__label",[`onyx-truncation-${n.truncation}`]])},e.toDisplayString(n.label),3)],8,Ae))}}),Ye=["disabled"],Ge={key:0,class:"onyx-radio-button-group__headline"},Fe=e.defineComponent({__name:"OnyxRadioButtonGroup",props:{name:{default:()=>Ue("radio-button-group-name")},modelValue:{},headline:{default:""},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},errorMessage:{default:""},direction:{default:"vertical"},options:{},skeleton:{}},emits:["update:modelValue"],setup(o,{emit:n}){const t=o,l=n,a=s=>l("update:modelValue",t.options.find(({id:c})=>s.target.value===c));return(s,c)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"onyx-radio-button-group",disabled:t.disabled,onChange:c[0]||(c[0]=r=>a(r))},[t.headline?(e.openBlock(),e.createElementBlock("legend",Ge,[e.createVNode(b,{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"}])},[t.skeleton===void 0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,r=>{var d;return e.openBlock(),e.createBlock(S,e.mergeProps({key:r.id},r,{name:t.name,"error-message":t.errorMessage,selected:r.id===((d=t.modelValue)==null?void 0:d.id),required:t.required}),null,16,["name","error-message","selected","required"])}),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.skeleton,r=>(e.openBlock(),e.createBlock(S,{id:`skeleton-${r}`,key:r,label:"Skeleton ${i}",name:t.name,skeleton:""},null,8,["id","name"]))),128))],2)],40,Ye))}}),O=(o,n)=>{const t=Object.entries(o).filter(([a,s])=>s!==void 0),l=Object.entries(n).filter(([a,s])=>s!==void 0);return t.length!==l.length?!1:t.every(([a,s])=>s===n[a])},T=()=>Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([o,n])=>n.enumerable).map(([o])=>o),w=o=>T().reduce((n,t)=>(n[t]=o[t],n),{}),He=o=>{if(o.valueMissing)return"valueMissing";const n=T().filter(t=>t!=="valid").sort();for(const t of n)if(t in o&&o[t])return t},je='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 32 32"><path d="m21.311 10.793-8.293 8.293-3.291-3.292-1.415 1.415 4.706 4.705 9.707-9.707z"/></svg>',Xe='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 32 32"><path d="m22.707 10.707-1.414-1.414L16 14.586l-5.293-5.293-1.414 1.414L14.586 16l-5.293 5.293 1.414 1.414L16 17.414l5.293 5.293 1.414-1.414L17.414 16z"/></svg>',Ke={key:0,class:"onyx-switch-skeleton"},Ze=["aria-label","disabled","required"],Je={class:"onyx-switch__container"},We={class:"onyx-switch__icon"},Qe=e.defineComponent({__name:"OnyxSwitch",props:{modelValue:{type:Boolean,default:!1},label:{},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},errorMessage:{},hideLabel:{type:Boolean},truncation:{default:"ellipsis"},skeleton:{type:Boolean,default:!1}},emits:["update:modelValue","validityChange"],setup(o,{emit:n}){var d;const t=o,l=n,{errorMessage:a}=e.toRefs(t),s=e.ref(),c=e.ref((d=s.value)==null?void 0:d.validity),r=e.computed({get:()=>t.modelValue,set:i=>{l("update:modelValue",i)}});return e.watch([s,a],()=>{s.value&&s.value.setCustomValidity(t.errorMessage||"")}),e.watch([s,r,a],()=>{if(!s.value)return;const i=w(s.value.validity);(!c.value||!O(i,c.value))&&(c.value=i,l("validityChange",c.value))},{immediate:!0}),(i,p)=>t.skeleton?(e.openBlock(),e.createElementBlock("div",Ke,[e.createVNode(y,{class:"onyx-switch-skeleton__input"}),t.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(y,{key:0,class:"onyx-switch-skeleton__label"}))])):(e.openBlock(),e.createElementBlock("label",{key:1,class:e.normalizeClass(["onyx-switch",{"onyx-required-marker":t.required,"onyx-optional-marker":!t.required}])},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputElement",ref:s,"onUpdate:modelValue":p[0]||(p[0]=u=>r.value=u),class:"onyx-switch__input",type:"checkbox","aria-label":t.hideLabel?t.label:void 0,disabled:t.disabled,required:t.required},null,8,Ze),[[e.vModelCheckbox,r.value]]),e.createElementVNode("span",Je,[e.createElementVNode("span",We,[e.createVNode(e.unref(h),{icon:r.value?e.unref(je):e.unref(Xe),size:"24px"},null,8,["icon"])])]),t.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["onyx-switch__label",[`onyx-truncation-${t.truncation}`]])},e.toDisplayString(t.label),3))],2))}}),et=Object.keys(x.validations.typeMismatch),tt={key:0,class:"onyx-test-input__error","aria-live":"polite"},nt={class:"onyx-test-input__info"},ot=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:a}=g(),{errorMessage:s}=e.toRefs(t),c=e.ref(!1),r=e.ref(null),d=e.ref((f=r.value)==null?void 0:f.validity),i=e.computed({get:()=>t.modelValue,set:m=>l("update:modelValue",m)}),p=e.computed(()=>{if(!d.value||d.value.valid)return"";const m=He(d.value);if(t.errorMessage||m==="customError")return t.errorMessage;if(!m)return"";if(m==="typeMismatch"){const _=et.includes(t.type)?t.type:"generic";return a.value(`validations.typeMismatch.${_}`,{value:i.value})}return a.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})}),u=m=>{const _=m.target;l("change",_.value)};return e.watch([r,s],()=>{r.value&&r.value.setCustomValidity(t.errorMessage||"")}),e.watch([r,i,s],()=>{if(!r.value)return;const m=w(r.value.validity);(!d.value||!O(m,d.value))&&(d.value=m,l("validityChange",d.value))},{immediate:!0}),(m,_)=>{var B,V;return e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["onyx-test-input",{"onyx-test-input--touched":c.value}])},[e.createElementVNode("span",{class:e.normalizeClass(["onyx-test-input__label",{"onyx-test-input__label--required":t.required}])},e.toDisplayString(t.label),3),e.withDirectives(e.createElementVNode("input",e.mergeProps(t,{ref_key:"inputElement",ref:r,"onUpdate:modelValue":_[0]||(_[0]=E=>i.value=E),onChange:u,onBlur:_[1]||(_[1]=E=>c.value=!0)}),null,16),[[e.vModelDynamic,i.value]]),c.value&&!((B=d.value)!=null&&B.valid)?(e.openBlock(),e.createElementBlock("p",tt,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("p",nt,' Model value: "'+e.toDisplayString(i.value)+'", is valid: '+e.toDisplayString((V=d.value)==null?void 0:V.valid),1)],2)}}}),lt=["primary","secondary","neutral","danger","warning","success","info"],at=["small","default","large"],rt=["ellipsis","multiline"],st=o=>({install:n=>{J(n,o.i18n);const t=n.runWithContext(()=>g());e.watchEffect(()=>ct(t.t.value("optional")))}}),ct=o=>globalThis.document.body.style.setProperty("--onyx-global-optional-text",o);exports.BUTTON_MODES=j;exports.BUTTON_TYPES=F;exports.BUTTON_VARIATIONS=H;exports.CHECKBOX_GROUP_DIRECTIONS=re;exports.HEADLINE_TYPES=se;exports.ICON_SIZES=ce;exports.INPUT_TYPES=_e;exports.LINK_TARGETS=xe;exports.ONYX_COLORS=lt;exports.OnyxAppLayout=q;exports.OnyxButton=G;exports.OnyxCheckboxGroup=ae;exports.OnyxHeadline=b;exports.OnyxIcon=h;exports.OnyxInput=me;exports.OnyxLink=ke;exports.OnyxLoadingIndicator=we;exports.OnyxPageLayout=qe;exports.OnyxRadioButtonGroup=Fe;exports.OnyxSkeleton=y;exports.OnyxSwitch=Qe;exports.TEXT_SIZES=at;exports.TRUNCATION_TYPES=rt;exports.TestInput=ot;exports.createOnyx=st;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),L={key:0,class:"onyx-app__nav"},I={class:"onyx-app__page"},M={key:1,class:"onyx-app__page-overlay"},z={key:2,class:"onyx-app__app-overlay"},P=e.defineComponent({__name:"OnyxAppLayout",props:{navBarAlignment:{default:"top"}},setup(n){const o=n,t=e.useSlots();return(l,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["onyx-app",{"onyx-app--horizontal":o.navBarAlignment==="left"}])},[e.unref(t).navBar?(e.openBlock(),e.createElementBlock("nav",L,[e.renderSlot(l.$slots,"navBar")])):e.createCommentVNode("",!0),e.createElementVNode("div",I,[e.renderSlot(l.$slots,"default")]),e.unref(t).pageOverlay?(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(l.$slots,"pageOverlay")])):e.createCommentVNode("",!0),e.unref(t).appOverlay?(e.openBlock(),e.createElementBlock("div",z,[e.renderSlot(l.$slots,"appOverlay")])):e.createCommentVNode("",!0)],2))}}),q=["innerHTML"],h=e.defineComponent({__name:"OnyxIcon",props:{icon:{},size:{default:"24px"},color:{default:"currentColor"}},setup(n){const o=n;return(t,l)=>(e.openBlock(),e.createElementBlock("figure",{class:e.normalizeClass(["onyx-icon",[o.size!=="24px"?`onyx-icon--${o.size}`:"",o.color!=="currentColor"?`onyx-icon--${o.color}`:""]]),"aria-hidden":"true",innerHTML:o.icon},null,10,q))}}),v=(n,o)=>{const t=n.__vccOpts||n;for(const[l,a]of o)t[l]=a;return t},A={},U={class:"onyx-skeleton"};function D(n,o){return e.openBlock(),e.createElementBlock("figure",U)}const f=v(A,[["render",D]]),R=["disabled"],Y={class:"onyx-button__label onyx-truncation-ellipsis"},G=e.defineComponent({__name:"OnyxButton",props:{label:{},disabled:{type:Boolean,default:!1},type:{default:"button"},variation:{default:"primary"},mode:{default:"default"},icon:{},skeleton:{type:Boolean,default:!1}},emits:["click"],setup(n,{emit:o}){const t=n,l=o;return(a,r)=>t.skeleton?(e.openBlock(),e.createBlock(f,{key:0,class:"onyx-button-skeleton"})):(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["onyx-button",[`onyx-button--${t.variation}`,`onyx-button--${t.mode}`]]),disabled:t.disabled,onClick:r[0]||(r[0]=u=>l("click"))},[t.icon?(e.openBlock(),e.createBlock(h,{key:0,icon:t.icon,size:"24px"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",Y,e.toDisplayString(t.label),1)],10,R))}}),F=["button","submit","reset"],H=["primary","secondary","danger"],j=["default","outline","plain"],X="(optional)",Z={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.'}},K="Select all",x={optional:X,validations:Z,selectAll:K},S=Symbol(),O=n=>{const o=e.computed(()=>e.unref(n==null?void 0:n.locale)??"en-US"),t=e.computed(()=>n!=null&&n.messages&&o.value in n.messages?n.messages[o.value]:x),l=e.computed(()=>(a,r={})=>{let u=C(a,t.value)??C(a,x)??"";const s=typeof r.n=="number"?r.n:void 0;return u=W(u,s),Q(u,r)});return{locale:o,t:l}},J=(n,o)=>n.provide(S,O(o)),g=()=>e.inject(S,()=>O(),!0),C=(n,o)=>{const t=n.split(".").reduce((l,a)=>!l||typeof l=="string"?l:l[a],o);return t&&typeof t=="string"?t:void 0},W=(n,o)=>{const t=n.split(" | ").map(a=>a.trim());if(t.length<=1)return n;let l=1;return o===0&&(l=0),o&&(o<=0||o>1)&&(l=2),t.length===2?l===1?t[0]:t[1]:t[l]},Q=(n,o)=>o?Object.entries(o).reduce((l,[a,r])=>r===void 0?l:l.replace(new RegExp(`{${a}}`,"gi"),r.toString()),n).replace(/\s?{.*}\s?/gi,""):n,ee={key:0,class:"onyx-checkbox-skeleton"},te={class:"onyx-checkbox__container"},oe=["aria-label","indeterminate","disabled","required"],k=e.defineComponent({__name:"OnyxCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{},indeterminate:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},hideLabel:{type:Boolean},truncation:{default:"ellipsis"},skeleton:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(n,{emit:o}){const t=n,l=o,a=e.computed({get:()=>t.modelValue,set:s=>l("update:modelValue",s)}),r=e.ref(!1),u=e.computed(()=>t.hideLabel?"":`onyx-${t.required?"required":"optional"}-marker`);return(s,c)=>t.skeleton?(e.openBlock(),e.createElementBlock("div",ee,[e.createVNode(f,{class:"onyx-checkbox-skeleton__input"}),t.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(f,{key:0,class:"onyx-checkbox-skeleton__label"}))])):(e.openBlock(),e.createElementBlock("label",{key:1,class:e.normalizeClass(["onyx-checkbox",[u.value]])},[e.createElementVNode("div",te,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c[0]||(c[0]=i=>a.value=i),"aria-label":t.hideLabel?t.label:void 0,class:e.normalizeClass(["onyx-checkbox__input",{"onyx-checkbox__input--touched":r.value}]),type:"checkbox",indeterminate:t.indeterminate,disabled:t.disabled,required:t.required,onBlur:c[1]||(c[1]=i=>r.value=!0)},null,42,oe),[[e.vModelCheckbox,a.value]])]),t.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("p",{key:0,class:e.normalizeClass(["onyx-checkbox__label",[`onyx-truncation-${t.truncation}`]])},e.toDisplayString(t.label),3))],2))}}),ne=["disabled"],le={key:0,class:"onyx-checkbox-group__label"},ae=e.defineComponent({__name:"OnyxCheckboxGroup",props:{options:{},modelValue:{default:()=>[]},headline:{},direction:{default:"vertical"},withCheckAll:{type:Boolean,default:!1},checkAllLabel:{},disabled:{type:Boolean,default:!1},skeleton:{}},emits:["update:modelValue"],setup(n,{emit:o}){const t=n,l=o,{t:a}=g(),r=(i,p)=>{const d=p?[...t.modelValue,i]:t.modelValue.filter(_=>_!==i);l("update:modelValue",d)},u=e.computed(()=>t.options.filter(i=>!i.disabled&&!i.skeleton)),s=i=>{const p=i?u.value.map(({id:d})=>d):[];l("update:modelValue",p)},c=e.computed(()=>{const i=u.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",le,[e.createVNode(e.unref(b),{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.skeleton===void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.withCheckAll?(e.openBlock(),e.createBlock(k,e.mergeProps({key:0},c.value,{label:t.checkAllLabel||e.unref(a)("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(k,e.mergeProps({key:d.id.toString()},d,{"model-value":t.modelValue.includes(d.id),"onUpdate:modelValue":_=>r(d.id,_)}),null,16,["model-value","onUpdate:modelValue"]))),128))],64)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.skeleton,d=>(e.openBlock(),e.createBlock(k,{key:d,label:`Skeleton ${d}`,skeleton:""},null,8,["label"]))),128))],2)],8,ne))}}),re=["horizontal","vertical"],b=e.defineComponent({__name:"OnyxHeadline",props:{is:{},monospace:{type:Boolean,default:!1}},setup(n){const o=n;return(t,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.is),{class:e.normalizeClass(["onyx-headline",`onyx-headline--${o.is}`,o.monospace?"onyx-headline--monospace":""])},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},8,["class"]))}}),se=["h1","h2","h3","h4","h5","h6"],ce=["12px","16px","24px","32px","48px","64px","96px"],ie={class:"onyx-input"},ue={class:"onyx-input__label onyx-text--small onyx-truncation-ellipsis"},de={class:"onyx-input__wrapper"},pe=["placeholder","type","autocapitalize","autocomplete","autofocus","name","pattern"],me=e.defineComponent({__name:"OnyxInput",props:{label:{},modelValue:{default:""},type:{default:"text"},placeholder:{},autocapitalize:{default:"sentences"},autocomplete:{},autofocus:{type:Boolean},name:{},pattern:{}},emits:["update:modelValue","change","focus","blur"],setup(n,{emit:o}){const t=n,l=o,a=e.computed({get:()=>t.modelValue,set:s=>l("update:modelValue",s)}),r=s=>{const c=s.target.value;l("change",c)},u=e.computed(()=>t.pattern instanceof RegExp?t.pattern.source:t.pattern);return(s,c)=>(e.openBlock(),e.createElementBlock("label",ie,[e.createElementVNode("span",ue,e.toDisplayString(t.label),1),e.createElementVNode("div",de,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c[0]||(c[0]=i=>a.value=i),class:"onyx-input__native",placeholder:t.placeholder,type:t.type,autocapitalize:t.autocapitalize,autocomplete:t.autocomplete,autofocus:t.autofocus,name:t.name,pattern:u.value,onChange:r,onFocus:c[1]||(c[1]=i=>l("focus")),onBlur:c[2]||(c[2]=i=>l("blur"))},null,40,pe),[[e.vModelDynamic,a.value]])])]))}}),_e=["email","password","search","tel","text","url"],ye=["none","sentences","words","characters"],fe='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 32 32"><path d="M12.2 10.55v2h5.836l-8.193 8.193 1.414 1.414 8.193-8.193V19.8h2v-9.25z"/></svg>',he=n=>/^http(s?):\/\//.test(n),ke=["href","target","rel"],xe=e.defineComponent({__name:"OnyxLink",props:{href:{},target:{default:"_self"},withExternalIcon:{type:[Boolean,String],default:"auto"}},emits:["click"],setup(n,{emit:o}){const t=n,l=o,a=e.computed(()=>t.withExternalIcon!=="auto"?t.withExternalIcon:he(t.href));return(r,u)=>(e.openBlock(),e.createElementBlock("a",{class:"onyx-link",href:t.href,target:t.target,rel:t.target==="_blank"?"noreferrer":void 0,onClick:u[0]||(u[0]=s=>l("click"))},[e.renderSlot(r.$slots,"default"),a.value?(e.openBlock(),e.createBlock(h,{key:0,class:"onyx-link__icon",icon:e.unref(fe),size:"16px"},null,8,["icon"])):e.createCommentVNode("",!0)],8,ke))}}),ve=["_self","_blank","_parent","_top"],ge={},be={class:"onyx-circle-spinner",viewBox:"0 0 50 50"},Be=e.createElementVNode("circle",{class:"onyx-circle-spinner__circle",cx:"50%",cy:"50%",r:"45%"},null,-1),Ee=[Be];function Ve(n,o){return e.openBlock(),e.createElementBlock("svg",be,Ee)}const Ce=v(ge,[["render",Ve]]),$e={},Se={class:"onyx-loading-dots"},Oe=e.createElementVNode("span",{class:"onyx-loading-dots__center"},null,-1),Ne=[Oe];function Te(n,o){return e.openBlock(),e.createElementBlock("div",Se,Ne)}const we=v($e,[["render",Te]]),Le=e.defineComponent({__name:"OnyxLoadingIndicator",props:{type:{default:"dots"}},setup(n){const o=n;return(t,l)=>o.type==="circle"?(e.openBlock(),e.createBlock(Ce,{key:0})):o.type==="dots"?(e.openBlock(),e.createBlock(we,{key:1})):e.createCommentVNode("",!0)}}),Ie={key:0,class:"onyx-page__sidebar"},Me={class:"onyx-page__main"},ze={key:1,class:"onyx-page__footer"},Pe={key:2,class:"onyx-page__toasts"},qe=e.defineComponent({__name:"OnyxPageLayout",props:{footerAsideSidebar:{type:Boolean},hideSidebar:{type:Boolean}},setup(n){const o=n,t=e.useSlots(),l=e.computed(()=>{let a="";return!t.footer&&t.sidebar&&(a="onyx-page--side-main"),t.footer&&(!t.sidebar||o.hideSidebar)&&(a="onyx-page--main-footer"),t.footer&&t.sidebar&&(o.footerAsideSidebar?a="onyx-page--side-main-footer-partial":a="onyx-page--side-main-footer-full"),a});return(a,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["onyx-page",l.value])},[e.unref(t).sidebar&&!o.hideSidebar?(e.openBlock(),e.createElementBlock("aside",Ie,[e.renderSlot(a.$slots,"sidebar")])):e.createCommentVNode("",!0),e.createElementVNode("main",Me,[e.renderSlot(a.$slots,"default")]),e.unref(t).footer?(e.openBlock(),e.createElementBlock("footer",ze,[e.renderSlot(a.$slots,"footer")])):e.createCommentVNode("",!0),e.unref(t).toasts?(e.openBlock(),e.createElementBlock("div",Pe,[e.renderSlot(a.$slots,"toasts")])):e.createCommentVNode("",!0)],2))}}),Ae=(()=>{let n=0;return()=>n++})(),Ue=n=>`${n}-${Ae()}`,De={key:0,class:"onyx-radio-button-skeleton"},Re=["title"],Ye=["required","name","value","checked","disabled"],$=e.defineComponent({__name:"OnyxRadioButton",props:{id:{},label:{},value:{},disabled:{type:Boolean,default:!1},truncation:{default:"ellipsis"},skeleton:{type:Boolean},selected:{type:Boolean,default:!1},name:{},required:{type:Boolean,default:!1},errorMessage:{}},setup(n){const o=n,t=e.ref();return e.watchEffect(()=>{var l;return(l=t.value)==null?void 0:l.setCustomValidity(o.errorMessage??"")}),(l,a)=>o.skeleton?(e.openBlock(),e.createElementBlock("div",De,[e.createVNode(f,{class:"onyx-radio-button-skeleton__input"}),e.createVNode(f,{class:"onyx-radio-button-skeleton__label"})])):(e.openBlock(),e.createElementBlock("label",{key:1,class:"onyx-radio-button",title:o.errorMessage},[e.createElementVNode("input",{ref_key:"selectorRef",ref:t,class:"onyx-radio-button__selector",type:"radio",required:o.required,name:o.name,value:o.id,checked:o.selected,disabled:o.disabled},null,8,Ye),e.createElementVNode("span",{class:e.normalizeClass(["onyx-radio-button__label",[`onyx-truncation-${o.truncation}`]])},e.toDisplayString(o.label),3)],8,Re))}}),Ge=["disabled"],Fe={key:0,class:"onyx-radio-button-group__headline"},He=e.defineComponent({__name:"OnyxRadioButtonGroup",props:{name:{default:()=>Ue("radio-button-group-name")},modelValue:{},headline:{default:""},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},errorMessage:{default:""},direction:{default:"vertical"},options:{},skeleton:{}},emits:["update:modelValue"],setup(n,{emit:o}){const t=n,l=o,a=r=>l("update:modelValue",t.options.find(({id:u})=>r.target.value===u));return(r,u)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"onyx-radio-button-group",disabled:t.disabled,onChange:u[0]||(u[0]=s=>a(s))},[t.headline?(e.openBlock(),e.createElementBlock("legend",Fe,[e.createVNode(b,{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"}])},[t.skeleton===void 0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,s=>{var c;return e.openBlock(),e.createBlock($,e.mergeProps({key:s.id},s,{name:t.name,"error-message":t.errorMessage,selected:s.id===((c=t.modelValue)==null?void 0:c.id),required:t.required}),null,16,["name","error-message","selected","required"])}),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.skeleton,s=>(e.openBlock(),e.createBlock($,{id:`skeleton-${s}`,key:s,label:"Skeleton ${i}",name:t.name,skeleton:""},null,8,["id","name"]))),128))],2)],40,Ge))}}),N=(n,o)=>{const t=Object.entries(n).filter(([a,r])=>r!==void 0),l=Object.entries(o).filter(([a,r])=>r!==void 0);return t.length!==l.length?!1:t.every(([a,r])=>r===o[a])},T=()=>Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([n,o])=>o.enumerable).map(([n])=>n),w=n=>T().reduce((o,t)=>(o[t]=n[t],o),{}),je=n=>{if(n.valueMissing)return"valueMissing";const o=T().filter(t=>t!=="valid").sort();for(const t of o)if(t in n&&n[t])return t},Xe='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 32 32"><path d="m21.311 10.793-8.293 8.293-3.291-3.292-1.415 1.415 4.706 4.705 9.707-9.707z"/></svg>',Ze='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 32 32"><path d="m22.707 10.707-1.414-1.414L16 14.586l-5.293-5.293-1.414 1.414L14.586 16l-5.293 5.293 1.414 1.414L16 17.414l5.293 5.293 1.414-1.414L17.414 16z"/></svg>',Ke={key:0,class:"onyx-switch-skeleton"},Je=["aria-label","disabled","required"],We={class:"onyx-switch__container"},Qe={class:"onyx-switch__icon"},et=e.defineComponent({__name:"OnyxSwitch",props:{modelValue:{type:Boolean,default:!1},label:{},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},errorMessage:{},hideLabel:{type:Boolean},truncation:{default:"ellipsis"},skeleton:{type:Boolean,default:!1}},emits:["update:modelValue","validityChange"],setup(n,{emit:o}){var i;const t=n,l=o,{errorMessage:a}=e.toRefs(t),r=e.ref(),u=e.ref((i=r.value)==null?void 0:i.validity),s=e.computed({get:()=>t.modelValue,set:p=>{l("update:modelValue",p)}});e.watch([r,a],()=>{r.value&&r.value.setCustomValidity(t.errorMessage||"")}),e.watch([r,s,a],()=>{if(!r.value)return;const p=w(r.value.validity);(!u.value||!N(p,u.value))&&(u.value=p,l("validityChange",u.value))},{immediate:!0});const c=e.computed(()=>t.hideLabel?"":`onyx-${t.required?"required":"optional"}-marker`);return(p,d)=>t.skeleton?(e.openBlock(),e.createElementBlock("div",Ke,[e.createVNode(f,{class:"onyx-switch-skeleton__input"}),t.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(f,{key:0,class:"onyx-switch-skeleton__label"}))])):(e.openBlock(),e.createElementBlock("label",{key:1,class:e.normalizeClass(["onyx-switch",[c.value]])},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputElement",ref:r,"onUpdate:modelValue":d[0]||(d[0]=_=>s.value=_),class:"onyx-switch__input",type:"checkbox","aria-label":t.hideLabel?t.label:void 0,disabled:t.disabled,required:t.required},null,8,Je),[[e.vModelCheckbox,s.value]]),e.createElementVNode("span",We,[e.createElementVNode("span",Qe,[e.createVNode(e.unref(h),{icon:s.value?e.unref(Xe):e.unref(Ze),size:"24px"},null,8,["icon"])])]),t.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["onyx-switch__label",[`onyx-truncation-${t.truncation}`]])},e.toDisplayString(t.label),3))],2))}}),tt=Object.keys(x.validations.typeMismatch),ot={key:0,class:"onyx-test-input__error","aria-live":"polite"},nt={class:"onyx-test-input__info"},lt=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(n,{emit:o}){var _;const t=n,l=o,{t:a}=g(),{errorMessage:r}=e.toRefs(t),u=e.ref(!1),s=e.ref(null),c=e.ref((_=s.value)==null?void 0:_.validity),i=e.computed({get:()=>t.modelValue,set:m=>l("update:modelValue",m)}),p=e.computed(()=>{if(!c.value||c.value.valid)return"";const m=je(c.value);if(t.errorMessage||m==="customError")return t.errorMessage;if(!m)return"";if(m==="typeMismatch"){const y=tt.includes(t.type)?t.type:"generic";return a.value(`validations.typeMismatch.${y}`,{value:i.value})}return a.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 y=m.target;l("change",y.value)};return e.watch([s,r],()=>{s.value&&s.value.setCustomValidity(t.errorMessage||"")}),e.watch([s,i,r],()=>{if(!s.value)return;const m=w(s.value.validity);(!c.value||!N(m,c.value))&&(c.value=m,l("validityChange",c.value))},{immediate:!0}),(m,y)=>{var B,E;return e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["onyx-test-input",{"onyx-test-input--touched":u.value}])},[e.createElementVNode("span",{class:e.normalizeClass(["onyx-test-input__label",{"onyx-test-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":y[0]||(y[0]=V=>i.value=V),onChange:d,onBlur:y[1]||(y[1]=V=>u.value=!0)}),null,16),[[e.vModelDynamic,i.value]]),u.value&&!((B=c.value)!=null&&B.valid)?(e.openBlock(),e.createElementBlock("p",ot,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("p",nt,' Model value: "'+e.toDisplayString(i.value)+'", is valid: '+e.toDisplayString((E=c.value)==null?void 0:E.valid),1)],2)}}}),at=["primary","secondary","neutral","danger","warning","success","info"],rt=["small","default","large"],st=["ellipsis","multiline"],ct=n=>({install:o=>{J(o,n.i18n);const t=o.runWithContext(()=>g());e.watchEffect(()=>it(t.t.value("optional")))}}),it=n=>globalThis.document.body.style.setProperty("--onyx-global-optional-text",n);exports.AUTOCAPITALIZE=ye;exports.BUTTON_MODES=j;exports.BUTTON_TYPES=F;exports.BUTTON_VARIATIONS=H;exports.CHECKBOX_GROUP_DIRECTIONS=re;exports.HEADLINE_TYPES=se;exports.ICON_SIZES=ce;exports.INPUT_TYPES=_e;exports.LINK_TARGETS=ve;exports.ONYX_COLORS=at;exports.OnyxAppLayout=P;exports.OnyxButton=G;exports.OnyxCheckboxGroup=ae;exports.OnyxHeadline=b;exports.OnyxIcon=h;exports.OnyxInput=me;exports.OnyxLink=xe;exports.OnyxLoadingIndicator=Le;exports.OnyxPageLayout=qe;exports.OnyxRadioButtonGroup=He;exports.OnyxSkeleton=f;exports.OnyxSwitch=et;exports.TEXT_SIZES=rt;exports.TRUNCATION_TYPES=st;exports.TestInput=lt;exports.createOnyx=ct;
|