sit-onyx 1.0.0-alpha.34 → 1.0.0-alpha.35
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/OnyxCheckboxGroup/OnyxCheckboxGroup.stories.d.ts +27 -36
- package/dist/components/OnyxCheckboxGroup/OnyxCheckboxGroup.vue.d.ts +3 -0
- package/dist/components/OnyxCheckboxGroup/types.d.ts +4 -0
- package/dist/components/OnyxRadioButtonGroup/OnyxRadioButtonGroup.stories.d.ts +13 -1
- package/dist/components/OnyxRadioButtonGroup/OnyxRadioButtonGroup.vue.d.ts +3 -0
- package/dist/components/OnyxRadioButtonGroup/types.d.ts +4 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +255 -241
- package/package.json +1 -1
|
@@ -18,25 +18,16 @@ export declare const Default: {
|
|
|
18
18
|
id: string;
|
|
19
19
|
required?: undefined;
|
|
20
20
|
disabled?: undefined;
|
|
21
|
-
skeleton?: undefined;
|
|
22
21
|
} | {
|
|
23
22
|
label: string;
|
|
24
23
|
id: string;
|
|
25
24
|
required: true;
|
|
26
25
|
disabled?: undefined;
|
|
27
|
-
skeleton?: undefined;
|
|
28
26
|
} | {
|
|
29
27
|
label: string;
|
|
30
28
|
id: string;
|
|
31
29
|
disabled: true;
|
|
32
30
|
required?: undefined;
|
|
33
|
-
skeleton?: undefined;
|
|
34
|
-
} | {
|
|
35
|
-
label: string;
|
|
36
|
-
id: string;
|
|
37
|
-
skeleton: true;
|
|
38
|
-
required?: undefined;
|
|
39
|
-
disabled?: undefined;
|
|
40
31
|
})[];
|
|
41
32
|
};
|
|
42
33
|
};
|
|
@@ -53,25 +44,16 @@ export declare const Horizontal: {
|
|
|
53
44
|
id: string;
|
|
54
45
|
required?: undefined;
|
|
55
46
|
disabled?: undefined;
|
|
56
|
-
skeleton?: undefined;
|
|
57
47
|
} | {
|
|
58
48
|
label: string;
|
|
59
49
|
id: string;
|
|
60
50
|
required: true;
|
|
61
51
|
disabled?: undefined;
|
|
62
|
-
skeleton?: undefined;
|
|
63
52
|
} | {
|
|
64
53
|
label: string;
|
|
65
54
|
id: string;
|
|
66
55
|
disabled: true;
|
|
67
56
|
required?: undefined;
|
|
68
|
-
skeleton?: undefined;
|
|
69
|
-
} | {
|
|
70
|
-
label: string;
|
|
71
|
-
id: string;
|
|
72
|
-
skeleton: true;
|
|
73
|
-
required?: undefined;
|
|
74
|
-
disabled?: undefined;
|
|
75
57
|
})[];
|
|
76
58
|
};
|
|
77
59
|
};
|
|
@@ -88,25 +70,16 @@ export declare const WithCheckAll: {
|
|
|
88
70
|
id: string;
|
|
89
71
|
required?: undefined;
|
|
90
72
|
disabled?: undefined;
|
|
91
|
-
skeleton?: undefined;
|
|
92
73
|
} | {
|
|
93
74
|
label: string;
|
|
94
75
|
id: string;
|
|
95
76
|
required: true;
|
|
96
77
|
disabled?: undefined;
|
|
97
|
-
skeleton?: undefined;
|
|
98
78
|
} | {
|
|
99
79
|
label: string;
|
|
100
80
|
id: string;
|
|
101
81
|
disabled: true;
|
|
102
82
|
required?: undefined;
|
|
103
|
-
skeleton?: undefined;
|
|
104
|
-
} | {
|
|
105
|
-
label: string;
|
|
106
|
-
id: string;
|
|
107
|
-
skeleton: true;
|
|
108
|
-
required?: undefined;
|
|
109
|
-
disabled?: undefined;
|
|
110
83
|
})[];
|
|
111
84
|
};
|
|
112
85
|
};
|
|
@@ -123,25 +96,16 @@ export declare const Disabled: {
|
|
|
123
96
|
id: string;
|
|
124
97
|
required?: undefined;
|
|
125
98
|
disabled?: undefined;
|
|
126
|
-
skeleton?: undefined;
|
|
127
99
|
} | {
|
|
128
100
|
label: string;
|
|
129
101
|
id: string;
|
|
130
102
|
required: true;
|
|
131
103
|
disabled?: undefined;
|
|
132
|
-
skeleton?: undefined;
|
|
133
104
|
} | {
|
|
134
105
|
label: string;
|
|
135
106
|
id: string;
|
|
136
107
|
disabled: true;
|
|
137
108
|
required?: undefined;
|
|
138
|
-
skeleton?: undefined;
|
|
139
|
-
} | {
|
|
140
|
-
label: string;
|
|
141
|
-
id: string;
|
|
142
|
-
skeleton: true;
|
|
143
|
-
required?: undefined;
|
|
144
|
-
disabled?: undefined;
|
|
145
109
|
})[];
|
|
146
110
|
};
|
|
147
111
|
};
|
|
@@ -172,3 +136,30 @@ export declare const WithTruncation: {
|
|
|
172
136
|
};
|
|
173
137
|
decorators: import("@storybook/vue3").Decorator[];
|
|
174
138
|
};
|
|
139
|
+
/**
|
|
140
|
+
* This example shows a skeleton checkbox group.
|
|
141
|
+
* The number of skeleton options shown can be set via the `skeleton` property.
|
|
142
|
+
*/
|
|
143
|
+
export declare const Skeleton: {
|
|
144
|
+
args: {
|
|
145
|
+
skeleton: number;
|
|
146
|
+
headline: string;
|
|
147
|
+
modelValue: string[];
|
|
148
|
+
options: ({
|
|
149
|
+
label: string;
|
|
150
|
+
id: string;
|
|
151
|
+
required?: undefined;
|
|
152
|
+
disabled?: undefined;
|
|
153
|
+
} | {
|
|
154
|
+
label: string;
|
|
155
|
+
id: string;
|
|
156
|
+
required: true;
|
|
157
|
+
disabled?: undefined;
|
|
158
|
+
} | {
|
|
159
|
+
label: string;
|
|
160
|
+
id: string;
|
|
161
|
+
disabled: true;
|
|
162
|
+
required?: undefined;
|
|
163
|
+
})[];
|
|
164
|
+
};
|
|
165
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare const _default: <TValue extends string | number | boolean>(__VLS_props: {
|
|
2
2
|
disabled?: boolean | undefined;
|
|
3
|
+
skeleton?: number | undefined;
|
|
3
4
|
modelValue?: TValue[] | undefined;
|
|
4
5
|
"onUpdate:modelValue"?: ((value: TValue[]) => any) | undefined;
|
|
5
6
|
headline?: string | undefined;
|
|
@@ -14,6 +15,7 @@ declare const _default: <TValue extends string | number | boolean>(__VLS_props:
|
|
|
14
15
|
} | undefined, __VLS_expose?: ((exposed: import('vue').ShallowUnwrapRef<{}>) => void) | undefined, __VLS_setup?: Promise<{
|
|
15
16
|
props: {
|
|
16
17
|
disabled?: boolean | undefined;
|
|
18
|
+
skeleton?: number | undefined;
|
|
17
19
|
modelValue?: TValue[] | undefined;
|
|
18
20
|
"onUpdate:modelValue"?: ((value: TValue[]) => any) | undefined;
|
|
19
21
|
headline?: string | undefined;
|
|
@@ -32,6 +34,7 @@ declare const _default: <TValue extends string | number | boolean>(__VLS_props:
|
|
|
32
34
|
__ctx?: {
|
|
33
35
|
props: {
|
|
34
36
|
disabled?: boolean | undefined;
|
|
37
|
+
skeleton?: number | undefined;
|
|
35
38
|
modelValue?: TValue[] | undefined;
|
|
36
39
|
"onUpdate:modelValue"?: ((value: TValue[]) => any) | undefined;
|
|
37
40
|
headline?: string | undefined;
|
|
@@ -30,6 +30,10 @@ export type OnyxCheckboxGroupProps<TValue extends string | number | boolean = st
|
|
|
30
30
|
* Whether all checkboxes should be disabled.
|
|
31
31
|
*/
|
|
32
32
|
disabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* If set, the specified number of skeleton radio buttons will be shown.
|
|
35
|
+
*/
|
|
36
|
+
skeleton?: number;
|
|
33
37
|
};
|
|
34
38
|
export type CheckboxGroupOption<T extends string | number | boolean> = Omit<OnyxCheckboxProps, "modelValue" | "indeterminate"> & {
|
|
35
39
|
id: T;
|
|
@@ -29,7 +29,7 @@ export declare const Disabled: {
|
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
|
-
* This example shows radio button group thats layed out vertically.
|
|
32
|
+
* This example shows a radio button group thats layed out vertically.
|
|
33
33
|
*/
|
|
34
34
|
export declare const Horizontal: {
|
|
35
35
|
args: {
|
|
@@ -59,3 +59,15 @@ export declare const WithTruncation: {
|
|
|
59
59
|
};
|
|
60
60
|
decorators: import("@storybook/vue3").Decorator[];
|
|
61
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* This example shows a skeleton radio button group.
|
|
64
|
+
* The number of skeleton options shown can be set via the `skeleton` property.
|
|
65
|
+
*/
|
|
66
|
+
export declare const Skeleton: {
|
|
67
|
+
args: {
|
|
68
|
+
skeleton: number;
|
|
69
|
+
headline: string;
|
|
70
|
+
options: SelectionOption<string>[];
|
|
71
|
+
modelValue: SelectionOption<string>;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
@@ -2,6 +2,7 @@ import type { SelectionOption } from "../OnyxRadioButton/types";
|
|
|
2
2
|
declare const _default: <TValue>(__VLS_props: {
|
|
3
3
|
required?: boolean | undefined;
|
|
4
4
|
disabled?: boolean | undefined;
|
|
5
|
+
skeleton?: number | undefined;
|
|
5
6
|
modelValue?: SelectionOption<TValue> | undefined;
|
|
6
7
|
"onUpdate:modelValue"?: ((selected: SelectionOption<TValue>) => any) | undefined;
|
|
7
8
|
name?: string | undefined;
|
|
@@ -17,6 +18,7 @@ declare const _default: <TValue>(__VLS_props: {
|
|
|
17
18
|
props: {
|
|
18
19
|
required?: boolean | undefined;
|
|
19
20
|
disabled?: boolean | undefined;
|
|
21
|
+
skeleton?: number | undefined;
|
|
20
22
|
modelValue?: SelectionOption<TValue> | undefined;
|
|
21
23
|
"onUpdate:modelValue"?: ((selected: SelectionOption<TValue>) => any) | undefined;
|
|
22
24
|
name?: string | undefined;
|
|
@@ -36,6 +38,7 @@ declare const _default: <TValue>(__VLS_props: {
|
|
|
36
38
|
props: {
|
|
37
39
|
required?: boolean | undefined;
|
|
38
40
|
disabled?: boolean | undefined;
|
|
41
|
+
skeleton?: number | undefined;
|
|
39
42
|
modelValue?: SelectionOption<TValue> | undefined;
|
|
40
43
|
"onUpdate:modelValue"?: ((selected: SelectionOption<TValue>) => any) | undefined;
|
|
41
44
|
name?: string | undefined;
|
|
@@ -36,6 +36,10 @@ export type OnyxRadioButtonGroupProps<TValue> = {
|
|
|
36
36
|
* Options for the individual radio buttons of the group.
|
|
37
37
|
*/
|
|
38
38
|
options: SelectionOption<TValue>[];
|
|
39
|
+
/**
|
|
40
|
+
* If set, the specified number of skeleton radio buttons will be shown.
|
|
41
|
+
*/
|
|
42
|
+
skeleton?: number;
|
|
39
43
|
};
|
|
40
44
|
export declare const RADIO_BUTTON_GROUP_DIRECTIONS: readonly ["horizontal", "vertical"];
|
|
41
45
|
export type RadioButtonGroupDirection = (typeof RADIO_BUTTON_GROUP_DIRECTIONS)[number];
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as h, useSlots as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as h, useSlots as j, openBlock as o, createElementBlock as i, normalizeClass as m, unref as f, renderSlot as $, createCommentVNode as y, createElementVNode as p, createBlock as x, toDisplayString as k, inject as ae, computed as b, ref as O, createVNode as B, withDirectives as I, vModelCheckbox as H, withCtx as P, createTextVNode as F, Fragment as L, mergeProps as C, renderList as T, resolveDynamicComponent as oe, vModelDynamic as K, watchEffect as X, toRefs as Z, watch as E } from "vue";
|
|
2
|
+
const le = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "onyx-app__nav"
|
|
5
|
-
},
|
|
5
|
+
}, se = { class: "onyx-app__page" }, re = {
|
|
6
6
|
key: 1,
|
|
7
7
|
class: "onyx-app__page-overlay"
|
|
8
|
-
},
|
|
8
|
+
}, ie = {
|
|
9
9
|
key: 2,
|
|
10
10
|
class: "onyx-app__app-overlay"
|
|
11
11
|
}, yt = /* @__PURE__ */ h({
|
|
@@ -14,25 +14,25 @@ const oe = {
|
|
|
14
14
|
navBarAlignment: { default: "top" }
|
|
15
15
|
},
|
|
16
16
|
setup(n) {
|
|
17
|
-
const t = n, e =
|
|
18
|
-
return (a,
|
|
17
|
+
const t = n, e = j();
|
|
18
|
+
return (a, l) => (o(), i("div", {
|
|
19
19
|
class: m(["onyx-app", { "onyx-app--horizontal": t.navBarAlignment === "left" }])
|
|
20
20
|
}, [
|
|
21
|
-
f(e).navBar ? (
|
|
21
|
+
f(e).navBar ? (o(), i("nav", le, [
|
|
22
22
|
$(a.$slots, "navBar")
|
|
23
|
-
])) :
|
|
24
|
-
p("div",
|
|
23
|
+
])) : y("", !0),
|
|
24
|
+
p("div", se, [
|
|
25
25
|
$(a.$slots, "default")
|
|
26
26
|
]),
|
|
27
|
-
f(e).pageOverlay ? (
|
|
27
|
+
f(e).pageOverlay ? (o(), i("div", re, [
|
|
28
28
|
$(a.$slots, "pageOverlay")
|
|
29
|
-
])) :
|
|
30
|
-
f(e).appOverlay ? (
|
|
29
|
+
])) : y("", !0),
|
|
30
|
+
f(e).appOverlay ? (o(), i("div", ie, [
|
|
31
31
|
$(a.$slots, "appOverlay")
|
|
32
|
-
])) :
|
|
32
|
+
])) : y("", !0)
|
|
33
33
|
], 2));
|
|
34
34
|
}
|
|
35
|
-
}),
|
|
35
|
+
}), ue = ["innerHTML"], U = /* @__PURE__ */ h({
|
|
36
36
|
__name: "OnyxIcon",
|
|
37
37
|
props: {
|
|
38
38
|
icon: {},
|
|
@@ -41,25 +41,25 @@ const oe = {
|
|
|
41
41
|
},
|
|
42
42
|
setup(n) {
|
|
43
43
|
const t = n;
|
|
44
|
-
return (e, a) => (
|
|
44
|
+
return (e, a) => (o(), i("figure", {
|
|
45
45
|
class: m(["onyx-icon", [
|
|
46
46
|
t.size !== "24px" ? `onyx-icon--${t.size}` : "",
|
|
47
47
|
t.color !== "currentColor" ? `onyx-icon--${t.color}` : ""
|
|
48
48
|
]]),
|
|
49
49
|
"aria-hidden": "true",
|
|
50
50
|
innerHTML: t.icon
|
|
51
|
-
}, null, 10,
|
|
51
|
+
}, null, 10, ue));
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
53
|
+
}), N = (n, t) => {
|
|
54
54
|
const e = n.__vccOpts || n;
|
|
55
|
-
for (const [a,
|
|
56
|
-
e[a] =
|
|
55
|
+
for (const [a, l] of t)
|
|
56
|
+
e[a] = l;
|
|
57
57
|
return e;
|
|
58
|
-
},
|
|
59
|
-
function
|
|
60
|
-
return
|
|
58
|
+
}, ce = {}, de = { class: "onyx-skeleton" };
|
|
59
|
+
function pe(n, t) {
|
|
60
|
+
return o(), i("figure", de);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const S = /* @__PURE__ */ N(ce, [["render", pe]]), _e = ["disabled"], ye = { class: "onyx-button__label onyx-truncation-ellipsis" }, mt = /* @__PURE__ */ h({
|
|
63
63
|
__name: "OnyxButton",
|
|
64
64
|
props: {
|
|
65
65
|
label: {},
|
|
@@ -73,24 +73,24 @@ const w = /* @__PURE__ */ q(ue, [["render", de]]), pe = ["disabled"], _e = { cla
|
|
|
73
73
|
emits: ["click"],
|
|
74
74
|
setup(n, { emit: t }) {
|
|
75
75
|
const e = n, a = t;
|
|
76
|
-
return (
|
|
76
|
+
return (l, r) => e.skeleton ? (o(), x(S, {
|
|
77
77
|
key: 0,
|
|
78
78
|
class: "onyx-button-skeleton"
|
|
79
|
-
})) : (
|
|
79
|
+
})) : (o(), i("button", {
|
|
80
80
|
key: 1,
|
|
81
81
|
class: m(["onyx-button", [`onyx-button--${e.variation}`, `onyx-button--${e.mode}`]]),
|
|
82
82
|
disabled: e.disabled,
|
|
83
|
-
onClick:
|
|
83
|
+
onClick: r[0] || (r[0] = (u) => a("click"))
|
|
84
84
|
}, [
|
|
85
|
-
e.icon ? (
|
|
85
|
+
e.icon ? (o(), x(U, {
|
|
86
86
|
key: 0,
|
|
87
87
|
icon: e.icon,
|
|
88
88
|
size: "24px"
|
|
89
|
-
}, null, 8, ["icon"])) :
|
|
90
|
-
p("span",
|
|
91
|
-
], 10,
|
|
89
|
+
}, null, 8, ["icon"])) : y("", !0),
|
|
90
|
+
p("span", ye, k(e.label), 1)
|
|
91
|
+
], 10, _e));
|
|
92
92
|
}
|
|
93
|
-
}), ht = ["button", "submit", "reset"], ft = ["primary", "secondary", "danger"], xt = ["default", "outline", "plain"],
|
|
93
|
+
}), ht = ["button", "submit", "reset"], ft = ["primary", "secondary", "danger"], xt = ["default", "outline", "plain"], me = "(optional)", he = {
|
|
94
94
|
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)",
|
|
95
95
|
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)",
|
|
96
96
|
rangeUnderflow: "Value must be greater than or equal to {min}",
|
|
@@ -106,30 +106,30 @@ const w = /* @__PURE__ */ q(ue, [["render", de]]), pe = ["disabled"], _e = { cla
|
|
|
106
106
|
tel: '"{value}" must be a valid phone number.',
|
|
107
107
|
url: '"{value}" must a valid URL.'
|
|
108
108
|
}
|
|
109
|
-
},
|
|
110
|
-
optional:
|
|
111
|
-
validations:
|
|
112
|
-
selectAll:
|
|
113
|
-
},
|
|
114
|
-
const t =
|
|
115
|
-
let
|
|
116
|
-
const
|
|
117
|
-
return
|
|
109
|
+
}, fe = "Select all", q = {
|
|
110
|
+
optional: me,
|
|
111
|
+
validations: he,
|
|
112
|
+
selectAll: fe
|
|
113
|
+
}, J = Symbol(), W = (n) => {
|
|
114
|
+
const t = b(() => f(n == null ? void 0 : n.locale) ?? "en-US"), e = b(() => n != null && n.messages && t.value in n.messages ? n.messages[t.value] : q), a = b(() => (l, r = {}) => {
|
|
115
|
+
let u = G(l, e.value) ?? G(l, q) ?? "";
|
|
116
|
+
const s = typeof r.n == "number" ? r.n : void 0;
|
|
117
|
+
return u = ve(u, s), ge(u, r);
|
|
118
118
|
});
|
|
119
119
|
return { locale: t, t: a };
|
|
120
|
-
},
|
|
121
|
-
const e = n.split(".").reduce((a,
|
|
120
|
+
}, xe = (n, t) => n.provide(J, W(t)), A = () => ae(J, () => W(), !0), G = (n, t) => {
|
|
121
|
+
const e = n.split(".").reduce((a, l) => !a || typeof a == "string" ? a : a[l], t);
|
|
122
122
|
return e && typeof e == "string" ? e : void 0;
|
|
123
|
-
},
|
|
124
|
-
const e = n.split(" | ").map((
|
|
123
|
+
}, ve = (n, t) => {
|
|
124
|
+
const e = n.split(" | ").map((l) => l.trim());
|
|
125
125
|
if (e.length <= 1)
|
|
126
126
|
return n;
|
|
127
127
|
let a = 1;
|
|
128
128
|
return t === 0 && (a = 0), t && (t <= 0 || t > 1) && (a = 2), e.length === 2 ? a === 1 ? e[0] : e[1] : e[a];
|
|
129
|
-
},
|
|
129
|
+
}, ge = (n, t) => t ? Object.entries(t).reduce((a, [l, r]) => r === void 0 ? a : a.replace(new RegExp(`{${l}}`, "gi"), r.toString()), n).replace(/\s?{.*}\s?/gi, "") : n, be = {
|
|
130
130
|
key: 0,
|
|
131
131
|
class: "onyx-checkbox-skeleton"
|
|
132
|
-
},
|
|
132
|
+
}, ke = { class: "onyx-checkbox__container" }, $e = ["aria-label", "indeterminate", "disabled", "required"], M = /* @__PURE__ */ h({
|
|
133
133
|
__name: "OnyxCheckbox",
|
|
134
134
|
props: {
|
|
135
135
|
modelValue: { type: Boolean, default: !1 },
|
|
@@ -143,46 +143,46 @@ const w = /* @__PURE__ */ q(ue, [["render", de]]), pe = ["disabled"], _e = { cla
|
|
|
143
143
|
},
|
|
144
144
|
emits: ["update:modelValue"],
|
|
145
145
|
setup(n, { emit: t }) {
|
|
146
|
-
const e = n, a = t,
|
|
146
|
+
const e = n, a = t, l = b({
|
|
147
147
|
get: () => e.modelValue,
|
|
148
|
-
set: (
|
|
149
|
-
}),
|
|
150
|
-
return (
|
|
151
|
-
B(
|
|
152
|
-
e.hideLabel ?
|
|
148
|
+
set: (u) => a("update:modelValue", u)
|
|
149
|
+
}), r = O(!1);
|
|
150
|
+
return (u, s) => e.skeleton ? (o(), i("div", be, [
|
|
151
|
+
B(S, { class: "onyx-checkbox-skeleton__input" }),
|
|
152
|
+
e.hideLabel ? y("", !0) : (o(), x(S, {
|
|
153
153
|
key: 0,
|
|
154
154
|
class: "onyx-checkbox-skeleton__label"
|
|
155
155
|
}))
|
|
156
|
-
])) : (
|
|
156
|
+
])) : (o(), i("label", {
|
|
157
157
|
key: 1,
|
|
158
158
|
class: m(["onyx-checkbox", {
|
|
159
159
|
"onyx-required-marker": e.required,
|
|
160
160
|
"onyx-optional-marker": !e.required
|
|
161
161
|
}])
|
|
162
162
|
}, [
|
|
163
|
-
p("div",
|
|
164
|
-
|
|
165
|
-
"onUpdate:modelValue":
|
|
163
|
+
p("div", ke, [
|
|
164
|
+
I(p("input", {
|
|
165
|
+
"onUpdate:modelValue": s[0] || (s[0] = (d) => l.value = d),
|
|
166
166
|
"aria-label": e.hideLabel ? e.label : void 0,
|
|
167
167
|
class: m(["onyx-checkbox__input", {
|
|
168
|
-
"onyx-checkbox__input--touched":
|
|
168
|
+
"onyx-checkbox__input--touched": r.value
|
|
169
169
|
}]),
|
|
170
170
|
type: "checkbox",
|
|
171
171
|
indeterminate: e.indeterminate,
|
|
172
172
|
disabled: e.disabled,
|
|
173
173
|
required: e.required,
|
|
174
|
-
onBlur:
|
|
175
|
-
}, null, 42,
|
|
176
|
-
[
|
|
174
|
+
onBlur: s[1] || (s[1] = (d) => r.value = !0)
|
|
175
|
+
}, null, 42, $e), [
|
|
176
|
+
[H, l.value]
|
|
177
177
|
])
|
|
178
178
|
]),
|
|
179
|
-
e.hideLabel ?
|
|
179
|
+
e.hideLabel ? y("", !0) : (o(), i("p", {
|
|
180
180
|
key: 0,
|
|
181
181
|
class: m(["onyx-checkbox__label", [`onyx-truncation-${e.truncation}`]])
|
|
182
|
-
},
|
|
182
|
+
}, k(e.label), 3))
|
|
183
183
|
], 2));
|
|
184
184
|
}
|
|
185
|
-
}),
|
|
185
|
+
}), Ve = ["disabled"], Oe = {
|
|
186
186
|
key: 0,
|
|
187
187
|
class: "onyx-checkbox-group__label"
|
|
188
188
|
}, vt = /* @__PURE__ */ h({
|
|
@@ -194,49 +194,56 @@ const w = /* @__PURE__ */ q(ue, [["render", de]]), pe = ["disabled"], _e = { cla
|
|
|
194
194
|
direction: { default: "vertical" },
|
|
195
195
|
withCheckAll: { type: Boolean, default: !1 },
|
|
196
196
|
checkAllLabel: {},
|
|
197
|
-
disabled: { type: Boolean, default: !1 }
|
|
197
|
+
disabled: { type: Boolean, default: !1 },
|
|
198
|
+
skeleton: {}
|
|
198
199
|
},
|
|
199
200
|
emits: ["update:modelValue"],
|
|
200
201
|
setup(n, { emit: t }) {
|
|
201
|
-
const e = n, a = t, { t:
|
|
202
|
-
const
|
|
203
|
-
a("update:modelValue",
|
|
204
|
-
},
|
|
205
|
-
const
|
|
206
|
-
a("update:modelValue",
|
|
207
|
-
}, d =
|
|
208
|
-
const c =
|
|
209
|
-
return !c.length || !
|
|
202
|
+
const e = n, a = t, { t: l } = A(), r = (c, v) => {
|
|
203
|
+
const _ = v ? [...e.modelValue, c] : e.modelValue.filter((w) => w !== c);
|
|
204
|
+
a("update:modelValue", _);
|
|
205
|
+
}, u = b(() => e.options.filter((c) => !c.disabled && !c.skeleton)), s = (c) => {
|
|
206
|
+
const v = c ? u.value.map(({ id: _ }) => _) : [];
|
|
207
|
+
a("update:modelValue", v);
|
|
208
|
+
}, d = b(() => {
|
|
209
|
+
const c = u.value.map(({ id: _ }) => _), v = e.modelValue.filter((_) => c.includes(_));
|
|
210
|
+
return !c.length || !v.length ? { modelValue: !1 } : v.length === c.length ? { modelValue: !0 } : { indeterminate: !0, modelValue: !1 };
|
|
210
211
|
});
|
|
211
|
-
return (c,
|
|
212
|
+
return (c, v) => (o(), i("fieldset", {
|
|
212
213
|
class: "onyx-checkbox-group",
|
|
213
214
|
disabled: e.disabled
|
|
214
215
|
}, [
|
|
215
|
-
e.headline ? (
|
|
216
|
-
B(f(
|
|
217
|
-
default:
|
|
218
|
-
|
|
216
|
+
e.headline ? (o(), i("legend", Oe, [
|
|
217
|
+
B(f(Q), { is: "h3" }, {
|
|
218
|
+
default: P(() => [
|
|
219
|
+
F(k(e.headline), 1)
|
|
219
220
|
]),
|
|
220
221
|
_: 1
|
|
221
222
|
})
|
|
222
|
-
])) :
|
|
223
|
+
])) : y("", !0),
|
|
223
224
|
p("div", {
|
|
224
225
|
class: m(["onyx-checkbox-group__content", { "onyx-checkbox-group__content--horizontal": e.direction === "horizontal" }])
|
|
225
226
|
}, [
|
|
226
|
-
e.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
227
|
+
e.skeleton === void 0 ? (o(), i(L, { key: 0 }, [
|
|
228
|
+
e.withCheckAll ? (o(), x(M, C({ key: 0 }, d.value, {
|
|
229
|
+
label: e.checkAllLabel || f(l)("selectAll"),
|
|
230
|
+
"onUpdate:modelValue": s
|
|
231
|
+
}), null, 16, ["label"])) : y("", !0),
|
|
232
|
+
(o(!0), i(L, null, T(e.options, (_) => (o(), x(M, C({
|
|
233
|
+
key: _.id.toString()
|
|
234
|
+
}, _, {
|
|
235
|
+
"model-value": e.modelValue.includes(_.id),
|
|
236
|
+
"onUpdate:modelValue": (w) => r(_.id, w)
|
|
237
|
+
}), null, 16, ["model-value", "onUpdate:modelValue"]))), 128))
|
|
238
|
+
], 64)) : (o(!0), i(L, { key: 1 }, T(e.skeleton, (_) => (o(), x(M, {
|
|
239
|
+
key: _,
|
|
240
|
+
label: `Skeleton ${_}`,
|
|
241
|
+
skeleton: ""
|
|
242
|
+
}, null, 8, ["label"]))), 128))
|
|
236
243
|
], 2)
|
|
237
|
-
], 8,
|
|
244
|
+
], 8, Ve));
|
|
238
245
|
}
|
|
239
|
-
}), gt = ["horizontal", "vertical"],
|
|
246
|
+
}), gt = ["horizontal", "vertical"], Q = /* @__PURE__ */ h({
|
|
240
247
|
__name: "OnyxHeadline",
|
|
241
248
|
props: {
|
|
242
249
|
is: {},
|
|
@@ -244,20 +251,20 @@ const w = /* @__PURE__ */ q(ue, [["render", de]]), pe = ["disabled"], _e = { cla
|
|
|
244
251
|
},
|
|
245
252
|
setup(n) {
|
|
246
253
|
const t = n;
|
|
247
|
-
return (e, a) => (
|
|
254
|
+
return (e, a) => (o(), x(oe(t.is), {
|
|
248
255
|
class: m([
|
|
249
256
|
"onyx-headline",
|
|
250
257
|
`onyx-headline--${t.is}`,
|
|
251
258
|
t.monospace ? "onyx-headline--monospace" : ""
|
|
252
259
|
])
|
|
253
260
|
}, {
|
|
254
|
-
default:
|
|
261
|
+
default: P(() => [
|
|
255
262
|
$(e.$slots, "default")
|
|
256
263
|
]),
|
|
257
264
|
_: 3
|
|
258
265
|
}, 8, ["class"]));
|
|
259
266
|
}
|
|
260
|
-
}), bt = ["h1", "h2", "h3", "h4", "h5", "h6"], kt = ["12px", "16px", "24px", "32px", "48px", "64px", "96px"],
|
|
267
|
+
}), bt = ["h1", "h2", "h3", "h4", "h5", "h6"], kt = ["12px", "16px", "24px", "32px", "48px", "64px", "96px"], Be = { class: "onyx-input" }, Se = { class: "onyx-input__label onyx-text--small onyx-truncation-ellipsis" }, we = { class: "onyx-input__wrapper" }, Le = ["placeholder", "type"], $t = /* @__PURE__ */ h({
|
|
261
268
|
__name: "OnyxInput",
|
|
262
269
|
props: {
|
|
263
270
|
label: {},
|
|
@@ -267,31 +274,31 @@ const w = /* @__PURE__ */ q(ue, [["render", de]]), pe = ["disabled"], _e = { cla
|
|
|
267
274
|
},
|
|
268
275
|
emits: ["update:modelValue", "change", "focus", "blur"],
|
|
269
276
|
setup(n, { emit: t }) {
|
|
270
|
-
const e = n, a = t,
|
|
277
|
+
const e = n, a = t, l = b({
|
|
271
278
|
get: () => e.modelValue,
|
|
272
|
-
set: (
|
|
273
|
-
}),
|
|
274
|
-
const
|
|
275
|
-
a("change",
|
|
279
|
+
set: (u) => a("update:modelValue", u)
|
|
280
|
+
}), r = (u) => {
|
|
281
|
+
const s = u.target.value;
|
|
282
|
+
a("change", s);
|
|
276
283
|
};
|
|
277
|
-
return (
|
|
278
|
-
p("span",
|
|
284
|
+
return (u, s) => (o(), i("label", Be, [
|
|
285
|
+
p("span", Se, k(e.label), 1),
|
|
279
286
|
p("div", we, [
|
|
280
|
-
|
|
281
|
-
"onUpdate:modelValue":
|
|
287
|
+
I(p("input", {
|
|
288
|
+
"onUpdate:modelValue": s[0] || (s[0] = (d) => l.value = d),
|
|
282
289
|
class: "onyx-input__native",
|
|
283
290
|
placeholder: e.placeholder,
|
|
284
291
|
type: e.type,
|
|
285
|
-
onChange:
|
|
286
|
-
onFocus:
|
|
287
|
-
onBlur:
|
|
288
|
-
}, null, 40,
|
|
289
|
-
[
|
|
292
|
+
onChange: r,
|
|
293
|
+
onFocus: s[1] || (s[1] = (d) => a("focus")),
|
|
294
|
+
onBlur: s[2] || (s[2] = (d) => a("blur"))
|
|
295
|
+
}, null, 40, Le), [
|
|
296
|
+
[K, l.value]
|
|
290
297
|
])
|
|
291
298
|
])
|
|
292
299
|
]));
|
|
293
300
|
}
|
|
294
|
-
}), Vt = ["email", "password", "search", "tel", "text", "url"],
|
|
301
|
+
}), Vt = ["email", "password", "search", "tel", "text", "url"], Ce = '<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>', Te = (n) => /^http(s?):\/\//.test(n), Ee = ["href", "target", "rel"], Ot = /* @__PURE__ */ h({
|
|
295
302
|
__name: "OnyxLink",
|
|
296
303
|
props: {
|
|
297
304
|
href: {},
|
|
@@ -300,96 +307,96 @@ const w = /* @__PURE__ */ q(ue, [["render", de]]), pe = ["disabled"], _e = { cla
|
|
|
300
307
|
},
|
|
301
308
|
emits: ["click"],
|
|
302
309
|
setup(n, { emit: t }) {
|
|
303
|
-
const e = n, a = t,
|
|
304
|
-
return (
|
|
310
|
+
const e = n, a = t, l = b(() => e.withExternalIcon !== "auto" ? e.withExternalIcon : Te(e.href));
|
|
311
|
+
return (r, u) => (o(), i("a", {
|
|
305
312
|
class: "onyx-link",
|
|
306
313
|
href: e.href,
|
|
307
314
|
target: e.target,
|
|
308
315
|
rel: e.target === "_blank" ? "noreferrer" : void 0,
|
|
309
|
-
onClick:
|
|
316
|
+
onClick: u[0] || (u[0] = (s) => a("click"))
|
|
310
317
|
}, [
|
|
311
|
-
$(
|
|
312
|
-
|
|
318
|
+
$(r.$slots, "default"),
|
|
319
|
+
l.value ? (o(), x(U, {
|
|
313
320
|
key: 0,
|
|
314
321
|
class: "onyx-link__icon",
|
|
315
|
-
icon: f(
|
|
322
|
+
icon: f(Ce),
|
|
316
323
|
size: "16px"
|
|
317
|
-
}, null, 8, ["icon"])) :
|
|
318
|
-
], 8,
|
|
324
|
+
}, null, 8, ["icon"])) : y("", !0)
|
|
325
|
+
], 8, Ee));
|
|
319
326
|
}
|
|
320
|
-
}), Bt = ["_self", "_blank", "_parent", "_top"],
|
|
327
|
+
}), Bt = ["_self", "_blank", "_parent", "_top"], Ie = {}, Me = {
|
|
321
328
|
class: "onyx-circle-spinner",
|
|
322
329
|
viewBox: "0 0 50 50"
|
|
323
|
-
},
|
|
330
|
+
}, qe = /* @__PURE__ */ p("circle", {
|
|
324
331
|
class: "onyx-circle-spinner__circle",
|
|
325
332
|
cx: "50%",
|
|
326
333
|
cy: "50%",
|
|
327
334
|
r: "45%"
|
|
328
|
-
}, null, -1),
|
|
329
|
-
|
|
335
|
+
}, null, -1), Pe = [
|
|
336
|
+
qe
|
|
330
337
|
];
|
|
331
|
-
function
|
|
332
|
-
return
|
|
338
|
+
function Ue(n, t) {
|
|
339
|
+
return o(), i("svg", Me, Pe);
|
|
333
340
|
}
|
|
334
|
-
const
|
|
335
|
-
|
|
341
|
+
const Ne = /* @__PURE__ */ N(Ie, [["render", Ue]]), Ae = {}, ze = { class: "onyx-loading-dots" }, Re = /* @__PURE__ */ p("span", { class: "onyx-loading-dots__center" }, null, -1), De = [
|
|
342
|
+
Re
|
|
336
343
|
];
|
|
337
|
-
function
|
|
338
|
-
return
|
|
344
|
+
function Ge(n, t) {
|
|
345
|
+
return o(), i("div", ze, De);
|
|
339
346
|
}
|
|
340
|
-
const
|
|
347
|
+
const Ye = /* @__PURE__ */ N(Ae, [["render", Ge]]), St = /* @__PURE__ */ h({
|
|
341
348
|
__name: "OnyxLoadingIndicator",
|
|
342
349
|
props: {
|
|
343
350
|
type: { default: "dots" }
|
|
344
351
|
},
|
|
345
352
|
setup(n) {
|
|
346
353
|
const t = n;
|
|
347
|
-
return (e, a) => t.type === "circle" ? (
|
|
354
|
+
return (e, a) => t.type === "circle" ? (o(), x(Ne, { key: 0 })) : t.type === "dots" ? (o(), x(Ye, { key: 1 })) : y("", !0);
|
|
348
355
|
}
|
|
349
|
-
}),
|
|
356
|
+
}), je = {
|
|
350
357
|
key: 0,
|
|
351
358
|
class: "onyx-page__sidebar"
|
|
352
|
-
},
|
|
359
|
+
}, He = { class: "onyx-page__main" }, Fe = {
|
|
353
360
|
key: 1,
|
|
354
361
|
class: "onyx-page__footer"
|
|
355
|
-
},
|
|
362
|
+
}, Ke = {
|
|
356
363
|
key: 2,
|
|
357
364
|
class: "onyx-page__toasts"
|
|
358
|
-
},
|
|
365
|
+
}, wt = /* @__PURE__ */ h({
|
|
359
366
|
__name: "OnyxPageLayout",
|
|
360
367
|
props: {
|
|
361
368
|
footerAsideSidebar: { type: Boolean },
|
|
362
369
|
hideSidebar: { type: Boolean }
|
|
363
370
|
},
|
|
364
371
|
setup(n) {
|
|
365
|
-
const t = n, e =
|
|
366
|
-
let
|
|
367
|
-
return !e.footer && e.sidebar && (
|
|
372
|
+
const t = n, e = j(), a = b(() => {
|
|
373
|
+
let l = "";
|
|
374
|
+
return !e.footer && e.sidebar && (l = "onyx-page--side-main"), e.footer && (!e.sidebar || t.hideSidebar) && (l = "onyx-page--main-footer"), e.footer && e.sidebar && (t.footerAsideSidebar ? l = "onyx-page--side-main-footer-partial" : l = "onyx-page--side-main-footer-full"), l;
|
|
368
375
|
});
|
|
369
|
-
return (
|
|
376
|
+
return (l, r) => (o(), i("div", {
|
|
370
377
|
class: m(["onyx-page", a.value])
|
|
371
378
|
}, [
|
|
372
|
-
f(e).sidebar && !t.hideSidebar ? (
|
|
373
|
-
$(
|
|
374
|
-
])) :
|
|
375
|
-
p("main",
|
|
376
|
-
$(
|
|
379
|
+
f(e).sidebar && !t.hideSidebar ? (o(), i("aside", je, [
|
|
380
|
+
$(l.$slots, "sidebar")
|
|
381
|
+
])) : y("", !0),
|
|
382
|
+
p("main", He, [
|
|
383
|
+
$(l.$slots, "default")
|
|
377
384
|
]),
|
|
378
|
-
f(e).footer ? (
|
|
379
|
-
$(
|
|
380
|
-
])) :
|
|
381
|
-
f(e).toasts ? (
|
|
382
|
-
$(
|
|
383
|
-
])) :
|
|
385
|
+
f(e).footer ? (o(), i("footer", Fe, [
|
|
386
|
+
$(l.$slots, "footer")
|
|
387
|
+
])) : y("", !0),
|
|
388
|
+
f(e).toasts ? (o(), i("div", Ke, [
|
|
389
|
+
$(l.$slots, "toasts")
|
|
390
|
+
])) : y("", !0)
|
|
384
391
|
], 2));
|
|
385
392
|
}
|
|
386
|
-
}),
|
|
393
|
+
}), Xe = /* @__PURE__ */ (() => {
|
|
387
394
|
let n = 0;
|
|
388
395
|
return () => n++;
|
|
389
|
-
})(),
|
|
396
|
+
})(), Ze = (n) => `${n}-${Xe()}`, Je = {
|
|
390
397
|
key: 0,
|
|
391
398
|
class: "onyx-radio-button-skeleton"
|
|
392
|
-
},
|
|
399
|
+
}, We = ["title"], Qe = ["required", "name", "value", "checked", "disabled"], Y = /* @__PURE__ */ h({
|
|
393
400
|
__name: "OnyxRadioButton",
|
|
394
401
|
props: {
|
|
395
402
|
id: {},
|
|
@@ -405,13 +412,13 @@ const Ge = /* @__PURE__ */ q(Ne, [["render", De]]), wt = /* @__PURE__ */ h({
|
|
|
405
412
|
},
|
|
406
413
|
setup(n) {
|
|
407
414
|
const t = n, e = O();
|
|
408
|
-
return
|
|
415
|
+
return X(() => {
|
|
409
416
|
var a;
|
|
410
417
|
return (a = e.value) == null ? void 0 : a.setCustomValidity(t.errorMessage ?? "");
|
|
411
|
-
}), (a,
|
|
412
|
-
B(
|
|
413
|
-
B(
|
|
414
|
-
])) : (
|
|
418
|
+
}), (a, l) => t.skeleton ? (o(), i("div", Je, [
|
|
419
|
+
B(S, { class: "onyx-radio-button-skeleton__input" }),
|
|
420
|
+
B(S, { class: "onyx-radio-button-skeleton__label" })
|
|
421
|
+
])) : (o(), i("label", {
|
|
415
422
|
key: 1,
|
|
416
423
|
class: "onyx-radio-button",
|
|
417
424
|
title: t.errorMessage
|
|
@@ -426,11 +433,11 @@ const Ge = /* @__PURE__ */ q(Ne, [["render", De]]), wt = /* @__PURE__ */ h({
|
|
|
426
433
|
value: t.id,
|
|
427
434
|
checked: t.selected,
|
|
428
435
|
disabled: t.disabled
|
|
429
|
-
}, null, 8,
|
|
436
|
+
}, null, 8, Qe),
|
|
430
437
|
p("span", {
|
|
431
438
|
class: m(["onyx-radio-button__label", [`onyx-truncation-${t.truncation}`]])
|
|
432
|
-
},
|
|
433
|
-
], 8,
|
|
439
|
+
}, k(t.label), 3)
|
|
440
|
+
], 8, We));
|
|
434
441
|
}
|
|
435
442
|
}), et = ["disabled"], tt = {
|
|
436
443
|
key: 0,
|
|
@@ -438,64 +445,71 @@ const Ge = /* @__PURE__ */ q(Ne, [["render", De]]), wt = /* @__PURE__ */ h({
|
|
|
438
445
|
}, Lt = /* @__PURE__ */ h({
|
|
439
446
|
__name: "OnyxRadioButtonGroup",
|
|
440
447
|
props: {
|
|
441
|
-
name: { default: () =>
|
|
448
|
+
name: { default: () => Ze("radio-button-group-name") },
|
|
442
449
|
modelValue: {},
|
|
443
450
|
headline: { default: "" },
|
|
444
451
|
required: { type: Boolean, default: !1 },
|
|
445
452
|
disabled: { type: Boolean, default: !1 },
|
|
446
453
|
errorMessage: { default: "" },
|
|
447
454
|
direction: { default: "vertical" },
|
|
448
|
-
options: {}
|
|
455
|
+
options: {},
|
|
456
|
+
skeleton: {}
|
|
449
457
|
},
|
|
450
458
|
emits: ["update:modelValue"],
|
|
451
459
|
setup(n, { emit: t }) {
|
|
452
|
-
const e = n, a = t,
|
|
453
|
-
return (
|
|
460
|
+
const e = n, a = t, l = (r) => a("update:modelValue", e.options.find(({ id: u }) => r.target.value === u));
|
|
461
|
+
return (r, u) => (o(), i("fieldset", {
|
|
454
462
|
class: "onyx-radio-button-group",
|
|
455
463
|
disabled: e.disabled,
|
|
456
|
-
onChange:
|
|
464
|
+
onChange: u[0] || (u[0] = (s) => l(s))
|
|
457
465
|
}, [
|
|
458
|
-
e.headline ? (
|
|
459
|
-
B(
|
|
466
|
+
e.headline ? (o(), i("legend", tt, [
|
|
467
|
+
B(Q, {
|
|
460
468
|
is: "h3",
|
|
461
469
|
class: m({
|
|
462
470
|
"onyx-required-marker": e.required,
|
|
463
471
|
"onyx-optional-marker": !e.required
|
|
464
472
|
})
|
|
465
473
|
}, {
|
|
466
|
-
default:
|
|
467
|
-
|
|
474
|
+
default: P(() => [
|
|
475
|
+
F(k(e.headline), 1)
|
|
468
476
|
]),
|
|
469
477
|
_: 1
|
|
470
478
|
}, 8, ["class"])
|
|
471
|
-
])) :
|
|
479
|
+
])) : y("", !0),
|
|
472
480
|
p("div", {
|
|
473
481
|
class: m(["onyx-radio-button-group__content", { "onyx-radio-button-group__content--horizontal": e.direction === "horizontal" }])
|
|
474
482
|
}, [
|
|
475
|
-
(
|
|
483
|
+
e.skeleton === void 0 ? (o(!0), i(L, { key: 0 }, T(e.options, (s) => {
|
|
476
484
|
var d;
|
|
477
|
-
return
|
|
478
|
-
key:
|
|
479
|
-
},
|
|
485
|
+
return o(), x(Y, C({
|
|
486
|
+
key: s.id
|
|
487
|
+
}, s, {
|
|
480
488
|
name: e.name,
|
|
481
489
|
"error-message": e.errorMessage,
|
|
482
|
-
selected:
|
|
490
|
+
selected: s.id === ((d = e.modelValue) == null ? void 0 : d.id),
|
|
483
491
|
required: e.required
|
|
484
492
|
}), null, 16, ["name", "error-message", "selected", "required"]);
|
|
485
|
-
}), 128))
|
|
493
|
+
}), 128)) : (o(!0), i(L, { key: 1 }, T(e.skeleton, (s) => (o(), x(Y, {
|
|
494
|
+
id: `skeleton-${s}`,
|
|
495
|
+
key: s,
|
|
496
|
+
label: "Skeleton ${i}",
|
|
497
|
+
name: e.name,
|
|
498
|
+
skeleton: ""
|
|
499
|
+
}, null, 8, ["id", "name"]))), 128))
|
|
486
500
|
], 2)
|
|
487
501
|
], 40, et));
|
|
488
502
|
}
|
|
489
|
-
}),
|
|
490
|
-
const e = Object.entries(n).filter(([
|
|
491
|
-
return e.length !== a.length ? !1 : e.every(([
|
|
492
|
-
},
|
|
503
|
+
}), ee = (n, t) => {
|
|
504
|
+
const e = Object.entries(n).filter(([l, r]) => r !== void 0), a = Object.entries(t).filter(([l, r]) => r !== void 0);
|
|
505
|
+
return e.length !== a.length ? !1 : e.every(([l, r]) => r === t[l]);
|
|
506
|
+
}, te = () => Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([n, t]) => t.enumerable).map(([n]) => n), ne = (n) => te().reduce(
|
|
493
507
|
(t, e) => (t[e] = n[e], t),
|
|
494
508
|
{}
|
|
495
509
|
), nt = (n) => {
|
|
496
510
|
if (n.valueMissing)
|
|
497
511
|
return "valueMissing";
|
|
498
|
-
const t =
|
|
512
|
+
const t = te().filter((e) => e !== "valid").sort();
|
|
499
513
|
for (const e of t)
|
|
500
514
|
if (e in n && n[e])
|
|
501
515
|
return e;
|
|
@@ -517,61 +531,61 @@ const Ge = /* @__PURE__ */ q(Ne, [["render", De]]), wt = /* @__PURE__ */ h({
|
|
|
517
531
|
emits: ["update:modelValue", "validityChange"],
|
|
518
532
|
setup(n, { emit: t }) {
|
|
519
533
|
var d;
|
|
520
|
-
const e = n, a = t, { errorMessage:
|
|
534
|
+
const e = n, a = t, { errorMessage: l } = Z(e), r = O(), u = O((d = r.value) == null ? void 0 : d.validity), s = b({
|
|
521
535
|
get: () => e.modelValue,
|
|
522
536
|
set: (c) => {
|
|
523
537
|
a("update:modelValue", c);
|
|
524
538
|
}
|
|
525
539
|
});
|
|
526
|
-
return
|
|
527
|
-
|
|
528
|
-
}),
|
|
529
|
-
[
|
|
540
|
+
return E([r, l], () => {
|
|
541
|
+
r.value && r.value.setCustomValidity(e.errorMessage || "");
|
|
542
|
+
}), E(
|
|
543
|
+
[r, s, l],
|
|
530
544
|
() => {
|
|
531
|
-
if (!
|
|
545
|
+
if (!r.value)
|
|
532
546
|
return;
|
|
533
|
-
const c =
|
|
534
|
-
(!
|
|
547
|
+
const c = ne(r.value.validity);
|
|
548
|
+
(!u.value || !ee(c, u.value)) && (u.value = c, a("validityChange", u.value));
|
|
535
549
|
},
|
|
536
550
|
{ immediate: !0 }
|
|
537
|
-
), (c,
|
|
538
|
-
B(
|
|
539
|
-
e.hideLabel ?
|
|
551
|
+
), (c, v) => e.skeleton ? (o(), i("div", lt, [
|
|
552
|
+
B(S, { class: "onyx-switch-skeleton__input" }),
|
|
553
|
+
e.hideLabel ? y("", !0) : (o(), x(S, {
|
|
540
554
|
key: 0,
|
|
541
555
|
class: "onyx-switch-skeleton__label"
|
|
542
556
|
}))
|
|
543
|
-
])) : (
|
|
557
|
+
])) : (o(), i("label", {
|
|
544
558
|
key: 1,
|
|
545
559
|
class: m(["onyx-switch", { "onyx-required-marker": e.required, "onyx-optional-marker": !e.required }])
|
|
546
560
|
}, [
|
|
547
|
-
|
|
561
|
+
I(p("input", {
|
|
548
562
|
ref_key: "inputElement",
|
|
549
|
-
ref:
|
|
550
|
-
"onUpdate:modelValue":
|
|
563
|
+
ref: r,
|
|
564
|
+
"onUpdate:modelValue": v[0] || (v[0] = (_) => s.value = _),
|
|
551
565
|
class: "onyx-switch__input",
|
|
552
566
|
type: "checkbox",
|
|
553
567
|
"aria-label": e.hideLabel ? e.label : void 0,
|
|
554
568
|
disabled: e.disabled,
|
|
555
569
|
required: e.required
|
|
556
570
|
}, null, 8, st), [
|
|
557
|
-
[
|
|
571
|
+
[H, s.value]
|
|
558
572
|
]),
|
|
559
573
|
p("span", rt, [
|
|
560
574
|
p("span", it, [
|
|
561
|
-
B(f(
|
|
562
|
-
icon:
|
|
575
|
+
B(f(U), {
|
|
576
|
+
icon: s.value ? f(at) : f(ot),
|
|
563
577
|
size: "24px"
|
|
564
578
|
}, null, 8, ["icon"])
|
|
565
579
|
])
|
|
566
580
|
]),
|
|
567
|
-
e.hideLabel ?
|
|
581
|
+
e.hideLabel ? y("", !0) : (o(), i("span", {
|
|
568
582
|
key: 0,
|
|
569
583
|
class: m(["onyx-switch__label", [`onyx-truncation-${e.truncation}`]])
|
|
570
|
-
},
|
|
584
|
+
}, k(e.label), 3))
|
|
571
585
|
], 2));
|
|
572
586
|
}
|
|
573
587
|
}), ut = Object.keys(
|
|
574
|
-
|
|
588
|
+
q.validations.typeMismatch
|
|
575
589
|
), ct = {
|
|
576
590
|
key: 0,
|
|
577
591
|
class: "onyx-test-input__error",
|
|
@@ -593,23 +607,23 @@ const Ge = /* @__PURE__ */ q(Ne, [["render", De]]), wt = /* @__PURE__ */ h({
|
|
|
593
607
|
},
|
|
594
608
|
emits: ["update:modelValue", "change", "validityChange"],
|
|
595
609
|
setup(n, { emit: t }) {
|
|
596
|
-
var
|
|
597
|
-
const e = n, a = t, { t:
|
|
610
|
+
var w;
|
|
611
|
+
const e = n, a = t, { t: l } = A(), { errorMessage: r } = Z(e), u = O(!1), s = O(null), d = O((w = s.value) == null ? void 0 : w.validity), c = b({
|
|
598
612
|
get: () => e.modelValue,
|
|
599
|
-
set: (
|
|
600
|
-
}),
|
|
613
|
+
set: (g) => a("update:modelValue", g)
|
|
614
|
+
}), v = b(() => {
|
|
601
615
|
if (!d.value || d.value.valid)
|
|
602
616
|
return "";
|
|
603
|
-
const
|
|
604
|
-
if (e.errorMessage ||
|
|
617
|
+
const g = nt(d.value);
|
|
618
|
+
if (e.errorMessage || g === "customError")
|
|
605
619
|
return e.errorMessage;
|
|
606
|
-
if (!
|
|
620
|
+
if (!g)
|
|
607
621
|
return "";
|
|
608
|
-
if (
|
|
622
|
+
if (g === "typeMismatch") {
|
|
609
623
|
const V = ut.includes(e.type) ? e.type : "generic";
|
|
610
|
-
return
|
|
624
|
+
return l.value(`validations.typeMismatch.${V}`, { value: c.value });
|
|
611
625
|
}
|
|
612
|
-
return
|
|
626
|
+
return l.value(`validations.${g}`, {
|
|
613
627
|
value: c.value,
|
|
614
628
|
n: c.value.toString().length,
|
|
615
629
|
minLength: e.minLength,
|
|
@@ -618,40 +632,40 @@ const Ge = /* @__PURE__ */ q(Ne, [["render", De]]), wt = /* @__PURE__ */ h({
|
|
|
618
632
|
max: e.max,
|
|
619
633
|
step: e.step
|
|
620
634
|
});
|
|
621
|
-
}),
|
|
622
|
-
const V =
|
|
635
|
+
}), _ = (g) => {
|
|
636
|
+
const V = g.target;
|
|
623
637
|
a("change", V.value);
|
|
624
638
|
};
|
|
625
|
-
return
|
|
626
|
-
|
|
627
|
-
}),
|
|
628
|
-
[
|
|
639
|
+
return E([s, r], () => {
|
|
640
|
+
s.value && s.value.setCustomValidity(e.errorMessage || "");
|
|
641
|
+
}), E(
|
|
642
|
+
[s, c, r],
|
|
629
643
|
() => {
|
|
630
|
-
if (!
|
|
644
|
+
if (!s.value)
|
|
631
645
|
return;
|
|
632
|
-
const
|
|
633
|
-
(!d.value || !
|
|
646
|
+
const g = ne(s.value.validity);
|
|
647
|
+
(!d.value || !ee(g, d.value)) && (d.value = g, a("validityChange", d.value));
|
|
634
648
|
},
|
|
635
649
|
{ immediate: !0 }
|
|
636
|
-
), (
|
|
637
|
-
var
|
|
638
|
-
return
|
|
639
|
-
class: m(["onyx-test-input", { "onyx-test-input--touched":
|
|
650
|
+
), (g, V) => {
|
|
651
|
+
var z, R;
|
|
652
|
+
return o(), i("label", {
|
|
653
|
+
class: m(["onyx-test-input", { "onyx-test-input--touched": u.value }])
|
|
640
654
|
}, [
|
|
641
655
|
p("span", {
|
|
642
656
|
class: m(["onyx-test-input__label", { "onyx-test-input__label--required": e.required }])
|
|
643
|
-
},
|
|
644
|
-
|
|
657
|
+
}, k(e.label), 3),
|
|
658
|
+
I(p("input", C(e, {
|
|
645
659
|
ref_key: "inputElement",
|
|
646
|
-
ref:
|
|
647
|
-
"onUpdate:modelValue": V[0] || (V[0] = (
|
|
648
|
-
onChange:
|
|
649
|
-
onBlur: V[1] || (V[1] = (
|
|
660
|
+
ref: s,
|
|
661
|
+
"onUpdate:modelValue": V[0] || (V[0] = (D) => c.value = D),
|
|
662
|
+
onChange: _,
|
|
663
|
+
onBlur: V[1] || (V[1] = (D) => u.value = !0)
|
|
650
664
|
}), null, 16), [
|
|
651
|
-
[
|
|
665
|
+
[K, c.value]
|
|
652
666
|
]),
|
|
653
|
-
|
|
654
|
-
p("p", dt, ' Model value: "' +
|
|
667
|
+
u.value && !((z = d.value) != null && z.valid) ? (o(), i("p", ct, k(v.value), 1)) : y("", !0),
|
|
668
|
+
p("p", dt, ' Model value: "' + k(c.value) + '", is valid: ' + k((R = d.value) == null ? void 0 : R.valid), 1)
|
|
655
669
|
], 2);
|
|
656
670
|
};
|
|
657
671
|
}
|
|
@@ -665,9 +679,9 @@ const Ge = /* @__PURE__ */ q(Ne, [["render", De]]), wt = /* @__PURE__ */ h({
|
|
|
665
679
|
"info"
|
|
666
680
|
], It = ["small", "default", "large"], Mt = ["ellipsis", "multiline"], qt = (n) => ({
|
|
667
681
|
install: (t) => {
|
|
668
|
-
|
|
669
|
-
const e = t.runWithContext(() =>
|
|
670
|
-
|
|
682
|
+
xe(t, n.i18n);
|
|
683
|
+
const e = t.runWithContext(() => A());
|
|
684
|
+
X(() => pt(e.t.value("optional")));
|
|
671
685
|
}
|
|
672
686
|
}), pt = (n) => globalThis.document.body.style.setProperty("--onyx-global-optional-text", n);
|
|
673
687
|
export {
|
|
@@ -683,14 +697,14 @@ export {
|
|
|
683
697
|
yt as OnyxAppLayout,
|
|
684
698
|
mt as OnyxButton,
|
|
685
699
|
vt as OnyxCheckboxGroup,
|
|
686
|
-
|
|
687
|
-
|
|
700
|
+
Q as OnyxHeadline,
|
|
701
|
+
U as OnyxIcon,
|
|
688
702
|
$t as OnyxInput,
|
|
689
703
|
Ot as OnyxLink,
|
|
690
|
-
|
|
691
|
-
|
|
704
|
+
St as OnyxLoadingIndicator,
|
|
705
|
+
wt as OnyxPageLayout,
|
|
692
706
|
Lt as OnyxRadioButtonGroup,
|
|
693
|
-
|
|
707
|
+
S as OnyxSkeleton,
|
|
694
708
|
Ct as OnyxSwitch,
|
|
695
709
|
It as TEXT_SIZES,
|
|
696
710
|
Mt as TRUNCATION_TYPES,
|
package/package.json
CHANGED