sit-onyx 1.0.0-alpha.32 → 1.0.0-alpha.34

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.
@@ -1,6 +1,5 @@
1
1
  import type { OnyxButtonProps } from "./types";
2
2
  declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxButtonProps>, {
3
- label: string;
4
3
  disabled: boolean;
5
4
  type: string;
6
5
  variation: string;
@@ -9,7 +8,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
9
8
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
9
  click: () => void;
11
10
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxButtonProps>, {
12
- label: string;
13
11
  disabled: boolean;
14
12
  type: string;
15
13
  variation: string;
@@ -19,7 +17,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
19
17
  onClick?: (() => any) | undefined;
20
18
  }, {
21
19
  type: "button" | "submit" | "reset";
22
- label: string;
23
20
  disabled: boolean;
24
21
  variation: "primary" | "secondary" | "danger";
25
22
  mode: "default" | "outline" | "plain";
@@ -0,0 +1,25 @@
1
+ import type { Meta } from "@storybook/vue3";
2
+ import OnyxInput from "./OnyxInput.vue";
3
+ /**
4
+ * Text inputs are essential UI elements where users can enter textual information.
5
+ * These components play a fundamental role in facilitating user interactions and data input within applications and websites.
6
+ */
7
+ declare const meta: Meta<typeof OnyxInput>;
8
+ export default meta;
9
+ /**
10
+ * This example shows a default input.
11
+ */
12
+ export declare const Default: {
13
+ args: {
14
+ label: string;
15
+ };
16
+ };
17
+ /**
18
+ * This example shows a input with a placeholder.
19
+ */
20
+ export declare const Placeholder: {
21
+ args: {
22
+ label: string;
23
+ placeholder: string;
24
+ };
25
+ };
@@ -0,0 +1,39 @@
1
+ import type { OnyxInputProps } from "./types";
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxInputProps>, {
3
+ modelValue: string;
4
+ type: string;
5
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ "update:modelValue": (value: string) => void;
7
+ blur: () => void;
8
+ change: (value: string) => void;
9
+ focus: () => void;
10
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxInputProps>, {
11
+ modelValue: string;
12
+ type: string;
13
+ }>>> & {
14
+ onFocus?: (() => any) | undefined;
15
+ onBlur?: (() => any) | undefined;
16
+ onChange?: ((value: string) => any) | undefined;
17
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
18
+ }, {
19
+ type: "search" | "text" | "email" | "password" | "tel" | "url";
20
+ modelValue: string;
21
+ }, {}>;
22
+ export default _default;
23
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
24
+ type __VLS_TypePropsToRuntimeProps<T> = {
25
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
26
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
27
+ } : {
28
+ type: import('vue').PropType<T[K]>;
29
+ required: true;
30
+ };
31
+ };
32
+ type __VLS_WithDefaults<P, D> = {
33
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
34
+ default: D[K];
35
+ }> : P[K];
36
+ };
37
+ type __VLS_Prettify<T> = {
38
+ [K in keyof T]: T[K];
39
+ } & {};
@@ -0,0 +1,20 @@
1
+ export type OnyxInputProps = {
2
+ /**
3
+ * Label to show above the input.
4
+ */
5
+ label: string;
6
+ /**
7
+ * Current value of the input.
8
+ */
9
+ modelValue?: string;
10
+ /**
11
+ * Input type.
12
+ */
13
+ type?: InputType;
14
+ /**
15
+ * Placeholder to show when the value is empty.
16
+ */
17
+ placeholder?: string;
18
+ };
19
+ export declare const INPUT_TYPES: readonly ["email", "password", "search", "tel", "text", "url"];
20
+ export type InputType = (typeof INPUT_TYPES)[number];
@@ -8,11 +8,13 @@ import OnyxLoadingIndicator from "./OnyxLoadingIndicator.vue";
8
8
  */
9
9
  declare const meta: Meta<typeof OnyxLoadingIndicator>;
10
10
  export default meta;
11
- export declare const Circle: {
12
- args: {};
13
- };
14
11
  export declare const Dots: {
15
12
  args: {
16
13
  type: "dots";
17
14
  };
18
15
  };
16
+ export declare const Circle: {
17
+ args: {
18
+ type: "circle";
19
+ };
20
+ };
@@ -1,4 +1,4 @@
1
- import { type InputType } from "./types";
1
+ import type { InputType } from "../OnyxInput/types";
2
2
  export type TestInputProps = {
3
3
  /**
4
4
  * The current input value
@@ -18,7 +18,7 @@ export type TestInputProps = {
18
18
  /** For validation: The pattern that the value must match */
19
19
  pattern?: string;
20
20
  /** For validation: The expected type of the input's value */
21
- type?: InputType;
21
+ type?: InputType | "number";
22
22
  /** For validation: The upper limit of a number value */
23
23
  max?: number;
24
24
  /**
@@ -55,7 +55,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
55
55
  "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
56
56
  onValidityChange?: ((state: ValidityState) => any) | undefined;
57
57
  }, {
58
- type: "number" | "text" | "email" | "password" | "search" | "tel" | "url";
58
+ type: "number" | "search" | "text" | "email" | "password" | "tel" | "url";
59
59
  label: string;
60
60
  modelValue: string | number;
61
61
  }, {}>;
@@ -1,5 +1,3 @@
1
- export declare const INPUT_TYPES: readonly ["email", "number", "password", "search", "tel", "text", "url"];
2
- export type InputType = (typeof INPUT_TYPES)[number];
3
1
  /**
4
2
  * Input types that have a translation for their validation error message.
5
3
  */
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),T={key:0,class:"onyx-app__nav"},L={class:"onyx-app__page"},I={key:1,class:"onyx-app__page-overlay"},M={key:2,class:"onyx-app__app-overlay"},z=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",T,[e.renderSlot(l.$slots,"navBar")])):e.createCommentVNode("",!0),e.createElementVNode("div",L,[e.renderSlot(l.$slots,"default")]),e.unref(t).pageOverlay?(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(l.$slots,"pageOverlay")])):e.createCommentVNode("",!0),e.unref(t).appOverlay?(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(l.$slots,"appOverlay")])):e.createCommentVNode("",!0)],2))}}),q=["button","submit","reset"],P=["primary","secondary","danger"],A=["default","outline","plain"],U=["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,U))}}),k=(n,o)=>{const t=n.__vccOpts||n;for(const[l,a]of o)t[l]=a;return t},D={},R={class:"onyx-skeleton"};function Y(n,o){return e.openBlock(),e.createElementBlock("figure",R)}const y=k(D,[["render",Y]]),G=["disabled"],H={class:"onyx-button__label onyx-truncation-ellipsis"},j=e.defineComponent({__name:"OnyxButton",props:{label:{default:""},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(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:r[0]||(r[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",H,e.toDisplayString(t.label),1)],10,G))}}),X=["horizontal","vertical"],K="(optional)",F={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:K,validations:F,selectAll:Z},S=Symbol(),$=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 c=C(a,t.value)??C(a,x)??"";const s=typeof r.n=="number"?r.n:void 0;return c=W(c,s),Q(c,r)});return{locale:o,t:l}},J=(n,o)=>n.provide(S,$(o)),v=()=>e.inject(S,()=>$(),!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"],E=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:c=>l("update:modelValue",c)}),r=e.ref(!1);return(c,s)=>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":s[0]||(s[0]=d=>a.value=d),"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:s[1]||(s[1]=d=>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}},emits:["update:modelValue"],setup(n,{emit:o}){const t=n,l=o,{t:a}=v(),r=(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)),s=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(g),{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(E,e.mergeProps({key:0},d.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,u=>(e.openBlock(),e.createBlock(E,e.mergeProps({key:u.id.toString()},u,{"model-value":t.modelValue.includes(u.id),"onUpdate:modelValue":f=>r(u.id,f)}),null,16,["model-value","onUpdate:modelValue"]))),128))],2)],8,ne))}}),re=["h1","h2","h3","h4","h5","h6"],g=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=["12px","16px","24px","32px","48px","64px","96px"],ce=["_self","_blank","_parent","_top"],ie='<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>',de=n=>/^http(s?):\/\//.test(n),ue=["href","target","rel"],pe=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:de(t.href));return(r,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]=s=>l("click"))},[e.renderSlot(r.$slots,"default"),a.value?(e.openBlock(),e.createBlock(h,{key:0,class:"onyx-link__icon",icon:e.unref(ie),size:"16px"},null,8,["icon"])):e.createCommentVNode("",!0)],8,ue))}}),me={},_e={class:"onyx-circle-spinner",viewBox:"0 0 50 50"},ye=e.createElementVNode("circle",{class:"onyx-circle-spinner__circle",cx:"50%",cy:"50%",r:"45%"},null,-1),fe=[ye];function he(n,o){return e.openBlock(),e.createElementBlock("svg",_e,fe)}const xe=k(me,[["render",he]]),ke={},ve={class:"onyx-loading-dots"},ge=e.createElementVNode("span",{class:"onyx-loading-dots__center"},null,-1),be=[ge];function Be(n,o){return e.openBlock(),e.createElementBlock("div",ve,be)}const Ve=k(ke,[["render",Be]]),Ce=e.defineComponent({__name:"OnyxLoadingIndicator",props:{type:{default:"circle"}},setup(n){const o=n;return(t,l)=>o.type==="circle"?(e.openBlock(),e.createBlock(xe,{key:0})):o.type==="dots"?(e.openBlock(),e.createBlock(Ve,{key:1})):e.createCommentVNode("",!0)}}),Ee={key:0,class:"onyx-page__sidebar"},Se={class:"onyx-page__main"},$e={key:1,class:"onyx-page__footer"},Oe={key:2,class:"onyx-page__toasts"},Ne=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",Ee,[e.renderSlot(a.$slots,"sidebar")])):e.createCommentVNode("",!0),e.createElementVNode("main",Se,[e.renderSlot(a.$slots,"default")]),e.unref(t).footer?(e.openBlock(),e.createElementBlock("footer",$e,[e.renderSlot(a.$slots,"footer")])):e.createCommentVNode("",!0),e.unref(t).toasts?(e.openBlock(),e.createElementBlock("div",Oe,[e.renderSlot(a.$slots,"toasts")])):e.createCommentVNode("",!0)],2))}}),we=(()=>{let n=0;return()=>n++})(),Te=n=>`${n}-${we()}`,Le={key:0,class:"onyx-radio-button-skeleton"},Ie=["title"],Me=["required","name","value","checked","disabled"],ze=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",Le,[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: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,Me),e.createElementVNode("span",{class:e.normalizeClass(["onyx-radio-button__label",[`onyx-truncation-${o.truncation}`]])},e.toDisplayString(o.label),3)],8,Ie))}}),qe=["disabled"],Pe={key:0,class:"onyx-radio-button-group__headline"},Ae=e.defineComponent({__name:"OnyxRadioButtonGroup",props:{name:{default:()=>Te("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(n,{emit:o}){const t=n,l=o,a=r=>l("update:modelValue",t.options.find(({id:c})=>r.target.value===c));return(r,c)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"onyx-radio-button-group",disabled:t.disabled,onChange:c[0]||(c[0]=s=>a(s))},[t.headline?(e.openBlock(),e.createElementBlock("legend",Pe,[e.createVNode(g,{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 d;return e.openBlock(),e.createBlock(ze,e.mergeProps({key:s.id},s,{name:t.name,"error-message":t.errorMessage,selected:s.id===((d=t.modelValue)==null?void 0:d.id),required:t.required}),null,16,["name","error-message","selected","required"])}),128))],2)],40,qe))}}),O=(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])},N=()=>Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([n,o])=>o.enumerable).map(([n])=>n),w=n=>N().reduce((o,t)=>(o[t]=n[t],o),{}),Ue=n=>{if(n.valueMissing)return"valueMissing";const o=N().filter(t=>t!=="valid").sort();for(const t of o)if(t in n&&n[t])return t},De=Object.keys(x.validations.typeMismatch),Re={key:0,class:"onyx-input__error","aria-live":"polite"},Ye={class:"onyx-input__info"},Ge=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 f;const t=n,l=o,{t:a}=v(),{errorMessage:r}=e.toRefs(t),c=e.ref(!1),s=e.ref(null),d=e.ref((f=s.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=Ue(d.value);if(t.errorMessage||m==="customError")return t.errorMessage;if(!m)return"";if(m==="typeMismatch"){const _=De.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([s,r],()=>{s.value&&s.value.setCustomValidity(t.errorMessage||"")}),e.watch([s,i,r],()=>{if(!s.value)return;const m=w(s.value.validity);(!d.value||!O(m,d.value))&&(d.value=m,l("validityChange",d.value))},{immediate:!0}),(m,_)=>{var b,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:u,onBlur:_[1]||(_[1]=V=>c.value=!0)}),null,16),[[e.vModelDynamic,i.value]]),c.value&&!((b=d.value)!=null&&b.valid)?(e.openBlock(),e.createElementBlock("p",Re,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("p",Ye,'Model value: "'+e.toDisplayString(i.value)+'", is valid: '+e.toDisplayString((B=d.value)==null?void 0:B.valid),1)],2)}}}),He='<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>',je='<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>',Xe={key:0,class:"onyx-switch-skeleton"},Ke=["aria-label","disabled","required"],Fe={class:"onyx-switch__container"},Ze={class:"onyx-switch__icon"},Je=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 d;const t=n,l=o,{errorMessage:a}=e.toRefs(t),r=e.ref(),c=e.ref((d=r.value)==null?void 0:d.validity),s=e.computed({get:()=>t.modelValue,set:i=>{l("update:modelValue",i)}});return e.watch([r,a],()=>{r.value&&r.value.setCustomValidity(t.errorMessage||"")}),e.watch([r,s,a],()=>{if(!r.value)return;const i=w(r.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",Xe,[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:r,"onUpdate:modelValue":p[0]||(p[0]=u=>s.value=u),class:"onyx-switch__input",type:"checkbox","aria-label":t.hideLabel?t.label:void 0,disabled:t.disabled,required:t.required},null,8,Ke),[[e.vModelCheckbox,s.value]]),e.createElementVNode("span",Fe,[e.createElementVNode("span",Ze,[e.createVNode(e.unref(h),{icon:s.value?e.unref(He):e.unref(je),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))}}),We=["primary","secondary","neutral","danger","warning","success","info"],Qe=["small","default","large"],et=["ellipsis","multiline"],tt=n=>({install:o=>{J(o,n.i18n);const t=o.runWithContext(()=>v());e.watchEffect(()=>ot(t.t.value("optional")))}}),ot=n=>globalThis.document.body.style.setProperty("--onyx-global-optional-text",n);exports.BUTTON_MODES=A;exports.BUTTON_TYPES=q;exports.BUTTON_VARIATIONS=P;exports.CHECKBOX_GROUP_DIRECTIONS=X;exports.HEADLINE_TYPES=re;exports.ICON_SIZES=se;exports.LINK_TARGETS=ce;exports.ONYX_COLORS=We;exports.OnyxAppLayout=z;exports.OnyxButton=j;exports.OnyxCheckboxGroup=ae;exports.OnyxHeadline=g;exports.OnyxIcon=h;exports.OnyxLink=pe;exports.OnyxLoadingIndicator=Ce;exports.OnyxPageLayout=Ne;exports.OnyxRadioButtonGroup=Ae;exports.OnyxSkeleton=y;exports.OnyxSwitch=Je;exports.TEXT_SIZES=Qe;exports.TRUNCATION_TYPES=et;exports.TestInput=Ge;exports.createOnyx=tt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),w={key:0,class:"onyx-app__nav"},L={class:"onyx-app__page"},I={key:1,class:"onyx-app__page-overlay"},M={key:2,class:"onyx-app__app-overlay"},z=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",w,[e.renderSlot(l.$slots,"navBar")])):e.createCommentVNode("",!0),e.createElementVNode("div",L,[e.renderSlot(l.$slots,"default")]),e.unref(t).pageOverlay?(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(l.$slots,"pageOverlay")])):e.createCommentVNode("",!0),e.unref(t).appOverlay?(e.openBlock(),e.createElementBlock("div",M,[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))}}),k=(n,o)=>{const t=n.__vccOpts||n;for(const[l,a]of o)t[l]=a;return t},P={},U={class:"onyx-skeleton"};function D(n,o){return e.openBlock(),e.createElementBlock("figure",U)}const y=k(P,[["render",D]]),A=["disabled"],R={class:"onyx-button__label onyx-truncation-ellipsis"},Y=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,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",R,e.toDisplayString(t.label),1)],10,A))}}),G=["button","submit","reset"],H=["primary","secondary","danger"],j=["default","outline","plain"],X="(optional)",F={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:F,selectAll:K},S=Symbol(),$=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,s={})=>{let c=E(a,t.value)??E(a,x)??"";const r=typeof s.n=="number"?s.n:void 0;return c=J(c,r),W(c,s)});return{locale:o,t:l}},Z=(n,o)=>n.provide(S,$(o)),v=()=>e.inject(S,()=>$(),!0),E=(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},J=(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]},W=(n,o)=>o?Object.entries(o).reduce((l,[a,s])=>s===void 0?l:l.replace(new RegExp(`{${a}}`,"gi"),s.toString()),n).replace(/\s?{.*}\s?/gi,""):n,Q={key:0,class:"onyx-checkbox-skeleton"},ee={class:"onyx-checkbox__container"},te=["aria-label","indeterminate","disabled","required"],C=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:c=>l("update:modelValue",c)}),s=e.ref(!1);return(c,r)=>t.skeleton?(e.openBlock(),e.createElementBlock("div",Q,[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",ee,[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,te),[[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"],ne={key:0,class:"onyx-checkbox-group__label"},le=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(n,{emit:o}){const t=n,l=o,{t:a}=v(),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",ne,[e.createVNode(e.unref(g),{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},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(C,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))],2)],8,oe))}}),ae=["horizontal","vertical"],g=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"],re=["12px","16px","24px","32px","48px","64px","96px"],ce={class:"onyx-input"},ie={class:"onyx-input__label onyx-text--small onyx-truncation-ellipsis"},de={class:"onyx-input__wrapper"},ue=["placeholder","type"],pe=e.defineComponent({__name:"OnyxInput",props:{label:{},modelValue:{default:""},type:{default:"text"},placeholder:{}},emits:["update:modelValue","change","focus","blur"],setup(n,{emit:o}){const t=n,l=o,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",ce,[e.createElementVNode("span",ie,e.toDisplayString(t.label),1),e.createElementVNode("div",de,[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,ue),[[e.vModelDynamic,a.value]])])]))}}),me=["email","password","search","tel","text","url"],_e='<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>',ye=n=>/^http(s?):\/\//.test(n),fe=["href","target","rel"],he=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:ye(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(_e),size:"16px"},null,8,["icon"])):e.createCommentVNode("",!0)],8,fe))}}),xe=["_self","_blank","_parent","_top"],ke={},ve={class:"onyx-circle-spinner",viewBox:"0 0 50 50"},ge=e.createElementVNode("circle",{class:"onyx-circle-spinner__circle",cx:"50%",cy:"50%",r:"45%"},null,-1),be=[ge];function Be(n,o){return e.openBlock(),e.createElementBlock("svg",ve,be)}const Ve=k(ke,[["render",Be]]),Ee={},Ce={class:"onyx-loading-dots"},Se=e.createElementVNode("span",{class:"onyx-loading-dots__center"},null,-1),$e=[Se];function Ne(n,o){return e.openBlock(),e.createElementBlock("div",Ce,$e)}const Oe=k(Ee,[["render",Ne]]),Te=e.defineComponent({__name:"OnyxLoadingIndicator",props:{type:{default:"dots"}},setup(n){const o=n;return(t,l)=>o.type==="circle"?(e.openBlock(),e.createBlock(Ve,{key:0})):o.type==="dots"?(e.openBlock(),e.createBlock(Oe,{key:1})):e.createCommentVNode("",!0)}}),we={key:0,class:"onyx-page__sidebar"},Le={class:"onyx-page__main"},Ie={key:1,class:"onyx-page__footer"},Me={key:2,class:"onyx-page__toasts"},ze=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,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["onyx-page",l.value])},[e.unref(t).sidebar&&!o.hideSidebar?(e.openBlock(),e.createElementBlock("aside",we,[e.renderSlot(a.$slots,"sidebar")])):e.createCommentVNode("",!0),e.createElementVNode("main",Le,[e.renderSlot(a.$slots,"default")]),e.unref(t).footer?(e.openBlock(),e.createElementBlock("footer",Ie,[e.renderSlot(a.$slots,"footer")])):e.createCommentVNode("",!0),e.unref(t).toasts?(e.openBlock(),e.createElementBlock("div",Me,[e.renderSlot(a.$slots,"toasts")])):e.createCommentVNode("",!0)],2))}}),qe=(()=>{let n=0;return()=>n++})(),Pe=n=>`${n}-${qe()}`,Ue={key:0,class:"onyx-radio-button-skeleton"},De=["title"],Ae=["required","name","value","checked","disabled"],Re=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",Ue,[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: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,Ae),e.createElementVNode("span",{class:e.normalizeClass(["onyx-radio-button__label",[`onyx-truncation-${o.truncation}`]])},e.toDisplayString(o.label),3)],8,De))}}),Ye=["disabled"],Ge={key:0,class:"onyx-radio-button-group__headline"},He=e.defineComponent({__name:"OnyxRadioButtonGroup",props:{name:{default:()=>Pe("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(n,{emit:o}){const t=n,l=o,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(g,{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,r=>{var d;return e.openBlock(),e.createBlock(Re,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))],2)],40,Ye))}}),N=(n,o)=>{const t=Object.entries(n).filter(([a,s])=>s!==void 0),l=Object.entries(o).filter(([a,s])=>s!==void 0);return t.length!==l.length?!1:t.every(([a,s])=>s===o[a])},O=()=>Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([n,o])=>o.enumerable).map(([n])=>n),T=n=>O().reduce((o,t)=>(o[t]=n[t],o),{}),je=n=>{if(n.valueMissing)return"valueMissing";const o=O().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>',Fe='<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(n,{emit:o}){var d;const t=n,l=o,{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=T(s.value.validity);(!c.value||!N(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(Xe):e.unref(Fe),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"},ot={class:"onyx-test-input__info"},nt=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 f;const t=n,l=o,{t:a}=v(),{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=je(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=T(r.value.validity);(!d.value||!N(m,d.value))&&(d.value=m,l("validityChange",d.value))},{immediate:!0}),(m,_)=>{var b,B;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]=V=>i.value=V),onChange:u,onBlur:_[1]||(_[1]=V=>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",ot,' Model value: "'+e.toDisplayString(i.value)+'", is valid: '+e.toDisplayString((B=d.value)==null?void 0:B.valid),1)],2)}}}),lt=["primary","secondary","neutral","danger","warning","success","info"],at=["small","default","large"],st=["ellipsis","multiline"],rt=n=>({install:o=>{Z(o,n.i18n);const t=o.runWithContext(()=>v());e.watchEffect(()=>ct(t.t.value("optional")))}}),ct=n=>globalThis.document.body.style.setProperty("--onyx-global-optional-text",n);exports.BUTTON_MODES=j;exports.BUTTON_TYPES=G;exports.BUTTON_VARIATIONS=H;exports.CHECKBOX_GROUP_DIRECTIONS=ae;exports.HEADLINE_TYPES=se;exports.ICON_SIZES=re;exports.INPUT_TYPES=me;exports.LINK_TARGETS=xe;exports.ONYX_COLORS=lt;exports.OnyxAppLayout=z;exports.OnyxButton=Y;exports.OnyxCheckboxGroup=le;exports.OnyxHeadline=g;exports.OnyxIcon=h;exports.OnyxInput=pe;exports.OnyxLink=he;exports.OnyxLoadingIndicator=Te;exports.OnyxPageLayout=ze;exports.OnyxRadioButtonGroup=He;exports.OnyxSkeleton=y;exports.OnyxSwitch=Qe;exports.TEXT_SIZES=at;exports.TRUNCATION_TYPES=st;exports.TestInput=nt;exports.createOnyx=rt;
package/dist/index.d.ts CHANGED
@@ -1,26 +1,28 @@
1
- export * from './components/OnyxAppLayout/types';
2
1
  export { default as OnyxAppLayout } from './components/OnyxAppLayout/OnyxAppLayout.vue';
3
- export * from './components/OnyxButton/types';
2
+ export * from './components/OnyxAppLayout/types';
4
3
  export { default as OnyxButton } from './components/OnyxButton/OnyxButton.vue';
4
+ export * from './components/OnyxButton/types';
5
5
  export * from './components/OnyxCheckbox/types';
6
- export * from './components/OnyxCheckboxGroup/types';
7
6
  export { default as OnyxCheckboxGroup } from './components/OnyxCheckboxGroup/OnyxCheckboxGroup.vue';
8
- export * from './components/OnyxHeadline/types';
7
+ export * from './components/OnyxCheckboxGroup/types';
9
8
  export { default as OnyxHeadline } from './components/OnyxHeadline/OnyxHeadline.vue';
10
- export * from './components/OnyxIcon/types';
9
+ export * from './components/OnyxHeadline/types';
11
10
  export { default as OnyxIcon } from './components/OnyxIcon/OnyxIcon.vue';
12
- export * from './components/OnyxLink/types';
11
+ export * from './components/OnyxIcon/types';
12
+ export { default as OnyxInput } from './components/OnyxInput/OnyxInput.vue';
13
+ export * from './components/OnyxInput/types';
13
14
  export { default as OnyxLink } from './components/OnyxLink/OnyxLink.vue';
14
- export * from './components/OnyxLoadingIndicator/types';
15
+ export * from './components/OnyxLink/types';
15
16
  export { default as OnyxLoadingIndicator } from './components/OnyxLoadingIndicator/OnyxLoadingIndicator.vue';
16
- export * from './components/OnyxPageLayout/types';
17
+ export * from './components/OnyxLoadingIndicator/types';
17
18
  export { default as OnyxPageLayout } from './components/OnyxPageLayout/OnyxPageLayout.vue';
19
+ export * from './components/OnyxPageLayout/types';
18
20
  export * from './components/OnyxRadioButton/types';
19
21
  export { default as OnyxRadioButtonGroup } from './components/OnyxRadioButtonGroup/OnyxRadioButtonGroup.vue';
20
22
  export { default as OnyxSkeleton } from './components/OnyxSkeleton/OnyxSkeleton.vue';
21
- export { default as TestInput } from './components/TestInput/TestInput.vue';
22
- export * from './components/OnyxSwitch/types';
23
23
  export { default as OnyxSwitch } from './components/OnyxSwitch/OnyxSwitch.vue';
24
+ export * from './components/OnyxSwitch/types';
25
+ export { default as TestInput } from './components/TestInput/TestInput.vue';
24
26
  export type { OnyxTranslations, ProvideI18nOptions } from './i18n';
25
27
  export * from './types/colors';
26
28
  export * from './types/fonts';