sit-onyx 0.1.0-alpha.4 → 0.1.0-alpha.6

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/README.md CHANGED
@@ -1,10 +1,12 @@
1
- <p>
2
- <a href="https://gruppe.schwarz">
3
- <div align="center">
4
- <img src="../../.github/schwarz-group.svg" width="400px" />
5
- </div>
6
- </a>
7
- </p>
1
+ <div align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/SchwarzIT/onyx/main/.github/onyx-logo-light.svg">
4
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/SchwarzIT/onyx/main/.github/onyx-logo-dark.svg">
5
+ <img alt="onyx logo" src="https://raw.githubusercontent.com/SchwarzIT/onyx/main/.github/onyx-logo-dark.svg" width="160px">
6
+ </picture>
7
+ </div>
8
+
9
+ <br>
8
10
 
9
11
  # onyx
10
12
 
@@ -0,0 +1,24 @@
1
+ import type { Meta } from "@storybook/vue3";
2
+ import OnyxHeadline from "./OnyxHeadline.vue";
3
+ /**
4
+ * Headline that can e.g. be used to structure the page content.
5
+ */
6
+ declare const meta: Meta<typeof OnyxHeadline>;
7
+ export default meta;
8
+ /**
9
+ * This example shows a default h1 headline.
10
+ */
11
+ export declare const Default: {
12
+ args: {
13
+ is: "h1";
14
+ };
15
+ };
16
+ /**
17
+ * This example shows a h1 headline with the monospace font family.
18
+ */
19
+ export declare const Monospace: {
20
+ args: {
21
+ monospace: true;
22
+ is: "h1";
23
+ };
24
+ };
@@ -0,0 +1,41 @@
1
+ import type { OnyxHeadlineProps } from "./types";
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxHeadlineProps>, {
3
+ monospace: boolean;
4
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxHeadlineProps>, {
5
+ monospace: boolean;
6
+ }>>>, {
7
+ monospace: boolean;
8
+ }, {}>, Readonly<{
9
+ /**
10
+ * Headline content.
11
+ */
12
+ default(): unknown;
13
+ }> & {
14
+ /**
15
+ * Headline content.
16
+ */
17
+ default(): unknown;
18
+ }>;
19
+ export default _default;
20
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
+ type __VLS_TypePropsToRuntimeProps<T> = {
22
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
23
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
24
+ } : {
25
+ type: import('vue').PropType<T[K]>;
26
+ required: true;
27
+ };
28
+ };
29
+ type __VLS_WithDefaults<P, D> = {
30
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
31
+ default: D[K];
32
+ }> : P[K];
33
+ };
34
+ type __VLS_Prettify<T> = {
35
+ [K in keyof T]: T[K];
36
+ } & {};
37
+ type __VLS_WithTemplateSlots<T, S> = T & {
38
+ new (): {
39
+ $slots: S;
40
+ };
41
+ };
@@ -0,0 +1,11 @@
1
+ export type OnyxHeadlineProps = {
2
+ /**
3
+ * Headline type. Please note that only h1-h4 are intended to be used from UX perspective.
4
+ * h5 and h6 will have the same styles as h4 and should only be used for semantic reasons.
5
+ */
6
+ is: HeadlineType;
7
+ /** If `true`, the monospace font family will be used instead of the default one. */
8
+ monospace?: boolean;
9
+ };
10
+ export declare const HEADLINE_TYPES: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
11
+ export type HeadlineType = (typeof HEADLINE_TYPES)[number];
@@ -0,0 +1,37 @@
1
+ import type { Meta } from "@storybook/vue3";
2
+ import OnyxIcon from "./OnyxIcon.vue";
3
+ /**
4
+ * Component to display icons. Supports all inline SVG icon libraries.
5
+ * We recommend using the official icons from `@sit-onyx/icons`.
6
+ *
7
+ * When importing SVG icon files, make sure to add `?raw` after the file name as shown in the examples to import the SVG content
8
+ * instead of the file system path to the file.
9
+ */
10
+ declare const meta: Meta<typeof OnyxIcon>;
11
+ export default meta;
12
+ /**
13
+ * This example shows a default icon.
14
+ */
15
+ export declare const Default: {
16
+ args: {
17
+ icon: string;
18
+ };
19
+ };
20
+ /**
21
+ * This example shows an icon with a different size.
22
+ */
23
+ export declare const WithSize: {
24
+ args: {
25
+ size: "2xl";
26
+ icon: string;
27
+ };
28
+ };
29
+ /**
30
+ * This example shows an icon with a different color.
31
+ */
32
+ export declare const WithColor: {
33
+ args: {
34
+ color: "success";
35
+ icon: string;
36
+ };
37
+ };
@@ -0,0 +1,29 @@
1
+ import type { OnyxIconProps } from "./types";
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxIconProps>, {
3
+ size: string;
4
+ color: string;
5
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxIconProps>, {
6
+ size: string;
7
+ color: string;
8
+ }>>>, {
9
+ color: "primary" | "secondary" | "neutral" | "danger" | "warning" | "success" | "info" | "currentColor";
10
+ size: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
11
+ }, {}>;
12
+ export default _default;
13
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
14
+ type __VLS_TypePropsToRuntimeProps<T> = {
15
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
16
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
17
+ } : {
18
+ type: import('vue').PropType<T[K]>;
19
+ required: true;
20
+ };
21
+ };
22
+ type __VLS_WithDefaults<P, D> = {
23
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
24
+ default: D[K];
25
+ }> : P[K];
26
+ };
27
+ type __VLS_Prettify<T> = {
28
+ [K in keyof T]: T[K];
29
+ } & {};
@@ -0,0 +1,14 @@
1
+ import type { OnyxColor } from '../../index';
2
+ export type OnyxIconProps = {
3
+ /**
4
+ * SVG source of the icon. **Important**: Only provide trustworthy content, the SVG content will
5
+ * not be sanitized.
6
+ */
7
+ icon: string;
8
+ /** Icon size. */
9
+ size?: IconSize;
10
+ /** Icon color. */
11
+ color?: OnyxColor | "currentColor";
12
+ };
13
+ export declare const ICON_SIZES: readonly ["2xs", "xs", "sm", "md", "lg", "xl", "2xl"];
14
+ export type IconSize = (typeof ICON_SIZES)[number];
@@ -56,9 +56,9 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
56
56
  onChange?: ((value: string) => any) | undefined;
57
57
  onValidityChange?: ((state: ValidityState) => any) | undefined;
58
58
  }, {
59
+ type: "number" | "search" | "email" | "tel" | "url" | "password" | "text";
59
60
  modelValue: string | number;
60
61
  label: string;
61
- type: "number" | "search" | "email" | "tel" | "url" | "password" | "text";
62
62
  }, {}>;
63
63
  export default _default;
64
64
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),V={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.'}},v={validations:V},_=Symbol(),b=t=>{const n=r.computed(()=>r.unref(t==null?void 0:t.locale)??"en-US"),e=r.computed(()=>t!=null&&t.messages&&n.value in t.messages?t.messages[n.value]:v),a=r.computed(()=>(s,l={})=>{let m=y(s,e.value)??y(s,v)??"";const o=typeof l.n=="number"?l.n:void 0;return m=I(m,o),T(m,l)});return{locale:n,t:a}},E=t=>{r.provide(_,b(t))},P=()=>r.inject(_,()=>b(),!0),y=(t,n)=>{const e=t.split(".").reduce((a,s)=>!a||typeof a=="string"?a:a[s],n);return e&&typeof e=="string"?e:void 0},I=(t,n)=>{const e=t.split(" | ").map(s=>s.trim());if(e.length<=1)return t;let a=1;return n===0&&(a=0),n&&(n<=0||n>1)&&(a=2),e.length===2?a===1?e[0]:e[1]:e[a]},T=(t,n)=>n?Object.entries(n).reduce((a,[s,l])=>l===void 0?a:a.replace(new RegExp(`{${s}}`,"gi"),l.toString()),t).replace(/\s?{.*}\s?/gi,""):t,x=()=>Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([t,n])=>n.enumerable).map(([t])=>t),L=t=>x().reduce((n,e)=>(n[e]=t[e],n),{}),O=t=>{if(t.valueMissing)return"valueMissing";const n=x().filter(e=>e!=="valid").sort();for(const e of n)if(e in t&&t[e])return e},C=(t,n)=>{const e=Object.entries(t).filter(([s,l])=>l!==void 0),a=Object.entries(n).filter(([s,l])=>l!==void 0);return e.length!==a.length?!1:e.every(([s,l])=>l===n[s])},N={key:0,class:"onyx-input__error","aria-live":"polite"},q={class:"onyx-input__info"},w=Object.keys(v.validations.typeMismatch),D=r.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(t,{emit:n}){var p;const e=t,a=n,{t:s}=P(),{errorMessage:l}=r.toRefs(e),m=r.ref(!1),o=r.ref(null),u=r.ref((p=o.value)==null?void 0:p.validity),d=r.computed({get:()=>e.modelValue,set:i=>a("update:modelValue",i)}),M=r.computed(()=>{if(!u.value||u.value.valid)return"";const i=O(u.value);if(e.errorMessage||i==="customError")return e.errorMessage;if(!i)return"";if(i==="typeMismatch"){const c=w.includes(e.type)?e.type:"generic";return s.value(`validations.typeMismatch.${c}`,{value:d.value})}return s.value(`validations.${i}`,{value:d.value,n:d.value.toString().length,minLength:e.minLength,maxLength:e.maxLength,min:e.min,max:e.max,step:e.step})}),S=i=>{const c=i.target;a("change",c.value)};return r.watch([o,l],()=>{o.value&&o.value.setCustomValidity(e.errorMessage||"")}),r.watch([o,d,l],()=>{if(!o.value)return;const i=L(o.value.validity);(!u.value||!C(i,u.value))&&(u.value=i,a("validityChange",u.value))},{immediate:!0}),(i,c)=>{var g,h;return r.openBlock(),r.createElementBlock("label",{class:r.normalizeClass(["onyx-input",{"onyx-input--touched":m.value}])},[r.createElementVNode("span",{class:r.normalizeClass(["onyx-input__label",{"onyx-input__label--required":e.required}])},r.toDisplayString(e.label),3),r.withDirectives(r.createElementVNode("input",r.mergeProps(e,{ref_key:"inputElement",ref:o,"onUpdate:modelValue":c[0]||(c[0]=f=>d.value=f),onChange:S,onBlur:c[1]||(c[1]=f=>m.value=!0)}),null,16),[[r.vModelDynamic,d.value]]),m.value&&!((g=u.value)!=null&&g.valid)?(r.openBlock(),r.createElementBlock("p",N,r.toDisplayString(M.value),1)):r.createCommentVNode("",!0),r.createElementVNode("p",q,'Model value: "'+r.toDisplayString(d.value)+'", is valid: '+r.toDisplayString((h=u.value)==null?void 0:h.valid),1)],2)}}}),U=(t,n)=>{const e=t.__vccOpts||t;for(const[a,s]of n)e[a]=s;return e},j=U(D,[["__scopeId","data-v-6632dbdc"]]);exports.TestInput=j;exports.provideI18n=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),O=t.defineComponent({__name:"OnyxHeadline",props:{is:{},monospace:{type:Boolean,default:!1}},setup(n){const r=n;return(e,a)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.is),{class:t.normalizeClass(["onyx-headline",`onyx-headline--${r.is}`,r.monospace?"onyx-headline--monospace":""])},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:3},8,["class"]))}}),M=["h1","h2","h3","h4","h5","h6"],C=["innerHTML"],I=t.defineComponent({__name:"OnyxIcon",props:{icon:{},size:{default:"sm"},color:{default:"currentColor"}},setup(n){const r=n;return(e,a)=>(t.openBlock(),t.createElementBlock("figure",{class:t.normalizeClass(["onyx-icon",[r.size!=="sm"?`onyx-icon--${r.size}`:"",r.color!=="currentColor"?`onyx-icon--${r.color}`:""]]),"aria-hidden":"true",innerHTML:r.icon},null,10,C))}}),L=["2xs","xs","sm","md","lg","xl","2xl"],V={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.'}},p={validations:V},_=Symbol(),x=n=>{const r=t.computed(()=>t.unref(n==null?void 0:n.locale)??"en-US"),e=t.computed(()=>n!=null&&n.messages&&r.value in n.messages?n.messages[r.value]:p),a=t.computed(()=>(s,l={})=>{let m=f(s,e.value)??f(s,p)??"";const i=typeof l.n=="number"?l.n:void 0;return m=N(m,i),B(m,l)});return{locale:r,t:a}},P=n=>{t.provide(_,x(n))},T=()=>t.inject(_,()=>x(),!0),f=(n,r)=>{const e=n.split(".").reduce((a,s)=>!a||typeof a=="string"?a:a[s],r);return e&&typeof e=="string"?e:void 0},N=(n,r)=>{const e=n.split(" | ").map(s=>s.trim());if(e.length<=1)return n;let a=1;return r===0&&(a=0),r&&(r<=0||r>1)&&(a=2),e.length===2?a===1?e[0]:e[1]:e[a]},B=(n,r)=>r?Object.entries(r).reduce((a,[s,l])=>l===void 0?a:a.replace(new RegExp(`{${s}}`,"gi"),l.toString()),n).replace(/\s?{.*}\s?/gi,""):n,S=()=>Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([n,r])=>r.enumerable).map(([n])=>n),D=n=>S().reduce((r,e)=>(r[e]=n[e],r),{}),$=n=>{if(n.valueMissing)return"valueMissing";const r=S().filter(e=>e!=="valid").sort();for(const e of r)if(e in n&&n[e])return e},w=(n,r)=>{const e=Object.entries(n).filter(([s,l])=>l!==void 0),a=Object.entries(r).filter(([s,l])=>l!==void 0);return e.length!==a.length?!1:e.every(([s,l])=>l===r[s])},z={key:0,class:"onyx-input__error","aria-live":"polite"},k={class:"onyx-input__info"},q=Object.keys(p.validations.typeMismatch),U=t.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:r}){var v;const e=n,a=r,{t:s}=T(),{errorMessage:l}=t.toRefs(e),m=t.ref(!1),i=t.ref(null),u=t.ref((v=i.value)==null?void 0:v.validity),d=t.computed({get:()=>e.modelValue,set:o=>a("update:modelValue",o)}),E=t.computed(()=>{if(!u.value||u.value.valid)return"";const o=$(u.value);if(e.errorMessage||o==="customError")return e.errorMessage;if(!o)return"";if(o==="typeMismatch"){const c=q.includes(e.type)?e.type:"generic";return s.value(`validations.typeMismatch.${c}`,{value:d.value})}return s.value(`validations.${o}`,{value:d.value,n:d.value.toString().length,minLength:e.minLength,maxLength:e.maxLength,min:e.min,max:e.max,step:e.step})}),b=o=>{const c=o.target;a("change",c.value)};return t.watch([i,l],()=>{i.value&&i.value.setCustomValidity(e.errorMessage||"")}),t.watch([i,d,l],()=>{if(!i.value)return;const o=D(i.value.validity);(!u.value||!w(o,u.value))&&(u.value=o,a("validityChange",u.value))},{immediate:!0}),(o,c)=>{var g,h;return t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["onyx-input",{"onyx-input--touched":m.value}])},[t.createElementVNode("span",{class:t.normalizeClass(["onyx-input__label",{"onyx-input__label--required":e.required}])},t.toDisplayString(e.label),3),t.withDirectives(t.createElementVNode("input",t.mergeProps(e,{ref_key:"inputElement",ref:i,"onUpdate:modelValue":c[0]||(c[0]=y=>d.value=y),onChange:b,onBlur:c[1]||(c[1]=y=>m.value=!0)}),null,16),[[t.vModelDynamic,d.value]]),m.value&&!((g=u.value)!=null&&g.valid)?(t.openBlock(),t.createElementBlock("p",z,t.toDisplayString(E.value),1)):t.createCommentVNode("",!0),t.createElementVNode("p",k,'Model value: "'+t.toDisplayString(d.value)+'", is valid: '+t.toDisplayString((h=u.value)==null?void 0:h.valid),1)],2)}}}),j=["primary","secondary","neutral","danger","warning","success","info"];exports.HEADLINE_TYPES=M;exports.ICON_SIZES=L;exports.ONYX_COLORS=j;exports.OnyxHeadline=O;exports.OnyxIcon=I;exports.TestInput=U;exports.provideI18n=P;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,9 @@
1
+ export { default as OnyxHeadline } from './components/OnyxHeadline/OnyxHeadline.vue';
2
+ export * from './components/OnyxHeadline/types';
3
+ export { default as OnyxIcon } from './components/OnyxIcon/OnyxIcon.vue';
4
+ export * from './components/OnyxIcon/types';
1
5
  export { default as TestInput } from './components/TestInput/TestInput.vue';
6
+ export * from './types/colors';
2
7
  export * from './types/i18n';
3
8
  export * from './types/utils';
4
9
  export { provideI18n, type OnyxTranslations, type ProvideI18nOptions } from './i18n';
package/dist/index.js CHANGED
@@ -1,5 +1,44 @@
1
- import { provide as C, inject as U, computed as d, unref as q, defineComponent as w, toRefs as N, ref as p, watch as b, openBlock as M, createElementBlock as V, normalizeClass as E, createElementVNode as g, toDisplayString as v, withDirectives as j, mergeProps as D, vModelDynamic as k, createCommentVNode as z } from "vue";
2
- const B = {
1
+ import { defineComponent as _, openBlock as v, createBlock as $, resolveDynamicComponent as N, normalizeClass as h, withCtx as w, renderSlot as U, createElementBlock as y, provide as q, inject as z, computed as d, unref as D, toRefs as j, ref as g, watch as S, createElementVNode as f, toDisplayString as p, withDirectives as B, mergeProps as H, vModelDynamic as R, createCommentVNode as k } from "vue";
2
+ const ne = /* @__PURE__ */ _({
3
+ __name: "OnyxHeadline",
4
+ props: {
5
+ is: {},
6
+ monospace: { type: Boolean, default: !1 }
7
+ },
8
+ setup(t) {
9
+ const n = t;
10
+ return (e, r) => (v(), $(N(n.is), {
11
+ class: h([
12
+ "onyx-headline",
13
+ `onyx-headline--${n.is}`,
14
+ n.monospace ? "onyx-headline--monospace" : ""
15
+ ])
16
+ }, {
17
+ default: w(() => [
18
+ U(e.$slots, "default")
19
+ ]),
20
+ _: 3
21
+ }, 8, ["class"]));
22
+ }
23
+ }), re = ["h1", "h2", "h3", "h4", "h5", "h6"], Y = ["innerHTML"], ae = /* @__PURE__ */ _({
24
+ __name: "OnyxIcon",
25
+ props: {
26
+ icon: {},
27
+ size: { default: "sm" },
28
+ color: { default: "currentColor" }
29
+ },
30
+ setup(t) {
31
+ const n = t;
32
+ return (e, r) => (v(), y("figure", {
33
+ class: h(["onyx-icon", [
34
+ n.size !== "sm" ? `onyx-icon--${n.size}` : "",
35
+ n.color !== "currentColor" ? `onyx-icon--${n.color}` : ""
36
+ ]]),
37
+ "aria-hidden": "true",
38
+ innerHTML: n.icon
39
+ }, null, 10, Y));
40
+ }
41
+ }), se = ["2xs", "xs", "sm", "md", "lg", "xl", "2xl"], A = {
3
42
  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)",
4
43
  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)",
5
44
  rangeUnderflow: "Value must be greater than or equal to {min}",
@@ -15,46 +54,46 @@ const B = {
15
54
  tel: '"{value}" must be a valid phone number.',
16
55
  url: '"{value}" must a valid URL.'
17
56
  }
18
- }, h = {
19
- validations: B
20
- }, L = Symbol(), S = (t) => {
21
- const r = d(() => q(t == null ? void 0 : t.locale) ?? "en-US"), e = d(() => t != null && t.messages && r.value in t.messages ? t.messages[r.value] : h), a = d(() => (n, s = {}) => {
22
- let c = P(n, e.value) ?? P(n, h) ?? "";
23
- const i = typeof s.n == "number" ? s.n : void 0;
24
- return c = $(c, i), A(c, s);
57
+ }, x = {
58
+ validations: A
59
+ }, I = Symbol(), V = (t) => {
60
+ const n = d(() => D(t == null ? void 0 : t.locale) ?? "en-US"), e = d(() => t != null && t.messages && n.value in t.messages ? t.messages[n.value] : x), r = d(() => (a, s = {}) => {
61
+ let c = L(a, e.value) ?? L(a, x) ?? "";
62
+ const o = typeof s.n == "number" ? s.n : void 0;
63
+ return c = J(c, o), K(c, s);
25
64
  });
26
- return { locale: r, t: a };
27
- }, Z = (t) => {
28
- C(L, S(t));
29
- }, R = () => U(L, () => S(), !0), P = (t, r) => {
30
- const e = t.split(".").reduce((a, n) => !a || typeof a == "string" ? a : a[n], r);
65
+ return { locale: n, t: r };
66
+ }, le = (t) => {
67
+ q(I, V(t));
68
+ }, F = () => z(I, () => V(), !0), L = (t, n) => {
69
+ const e = t.split(".").reduce((r, a) => !r || typeof r == "string" ? r : r[a], n);
31
70
  return e && typeof e == "string" ? e : void 0;
32
- }, $ = (t, r) => {
33
- const e = t.split(" | ").map((n) => n.trim());
71
+ }, J = (t, n) => {
72
+ const e = t.split(" | ").map((a) => a.trim());
34
73
  if (e.length <= 1)
35
74
  return t;
36
- let a = 1;
37
- return r === 0 && (a = 0), r && (r <= 0 || r > 1) && (a = 2), e.length === 2 ? a === 1 ? e[0] : e[1] : e[a];
38
- }, A = (t, r) => r ? Object.entries(r).reduce((a, [n, s]) => s === void 0 ? a : a.replace(new RegExp(`{${n}}`, "gi"), s.toString()), t).replace(/\s?{.*}\s?/gi, "") : t, I = () => Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([t, r]) => r.enumerable).map(([t]) => t), F = (t) => I().reduce(
39
- (r, e) => (r[e] = t[e], r),
75
+ let r = 1;
76
+ return n === 0 && (r = 0), n && (n <= 0 || n > 1) && (r = 2), e.length === 2 ? r === 1 ? e[0] : e[1] : e[r];
77
+ }, K = (t, n) => n ? Object.entries(n).reduce((r, [a, s]) => s === void 0 ? r : r.replace(new RegExp(`{${a}}`, "gi"), s.toString()), t).replace(/\s?{.*}\s?/gi, "") : t, P = () => Object.entries(Object.getOwnPropertyDescriptors(ValidityState.prototype)).filter(([t, n]) => n.enumerable).map(([t]) => t), X = (t) => P().reduce(
78
+ (n, e) => (n[e] = t[e], n),
40
79
  {}
41
- ), Y = (t) => {
80
+ ), Z = (t) => {
42
81
  if (t.valueMissing)
43
82
  return "valueMissing";
44
- const r = I().filter((e) => e !== "valid").sort();
45
- for (const e of r)
83
+ const n = P().filter((e) => e !== "valid").sort();
84
+ for (const e of n)
46
85
  if (e in t && t[e])
47
86
  return e;
48
- }, J = (t, r) => {
49
- const e = Object.entries(t).filter(([n, s]) => s !== void 0), a = Object.entries(r).filter(([n, s]) => s !== void 0);
50
- return e.length !== a.length ? !1 : e.every(([n, s]) => s === r[n]);
51
- }, K = {
87
+ }, G = (t, n) => {
88
+ const e = Object.entries(t).filter(([a, s]) => s !== void 0), r = Object.entries(n).filter(([a, s]) => s !== void 0);
89
+ return e.length !== r.length ? !1 : e.every(([a, s]) => s === n[a]);
90
+ }, Q = {
52
91
  key: 0,
53
92
  class: "onyx-input__error",
54
93
  "aria-live": "polite"
55
- }, G = { class: "onyx-input__info" }, H = Object.keys(
56
- h.validations.typeMismatch
57
- ), Q = /* @__PURE__ */ w({
94
+ }, W = { class: "onyx-input__info" }, ee = Object.keys(
95
+ x.validations.typeMismatch
96
+ ), oe = /* @__PURE__ */ _({
58
97
  __name: "TestInput",
59
98
  props: {
60
99
  modelValue: { default: "" },
@@ -70,24 +109,24 @@ const B = {
70
109
  minLength: {}
71
110
  },
72
111
  emits: ["update:modelValue", "change", "validityChange"],
73
- setup(t, { emit: r }) {
74
- var f;
75
- const e = t, a = r, { t: n } = R(), { errorMessage: s } = N(e), c = p(!1), i = p(null), u = p((f = i.value) == null ? void 0 : f.validity), m = d({
112
+ setup(t, { emit: n }) {
113
+ var b;
114
+ const e = t, r = n, { t: a } = F(), { errorMessage: s } = j(e), c = g(!1), o = g(null), i = g((b = o.value) == null ? void 0 : b.validity), m = d({
76
115
  get: () => e.modelValue,
77
- set: (l) => a("update:modelValue", l)
78
- }), O = d(() => {
79
- if (!u.value || u.value.valid)
116
+ set: (l) => r("update:modelValue", l)
117
+ }), T = d(() => {
118
+ if (!i.value || i.value.valid)
80
119
  return "";
81
- const l = Y(u.value);
120
+ const l = Z(i.value);
82
121
  if (e.errorMessage || l === "customError")
83
122
  return e.errorMessage;
84
123
  if (!l)
85
124
  return "";
86
125
  if (l === "typeMismatch") {
87
- const o = H.includes(e.type) ? e.type : "generic";
88
- return n.value(`validations.typeMismatch.${o}`, { value: m.value });
126
+ const u = ee.includes(e.type) ? e.type : "generic";
127
+ return a.value(`validations.typeMismatch.${u}`, { value: m.value });
89
128
  }
90
- return n.value(`validations.${l}`, {
129
+ return a.value(`validations.${l}`, {
91
130
  value: m.value,
92
131
  n: m.value.toString().length,
93
132
  minLength: e.minLength,
@@ -96,50 +135,58 @@ const B = {
96
135
  max: e.max,
97
136
  step: e.step
98
137
  });
99
- }), T = (l) => {
100
- const o = l.target;
101
- a("change", o.value);
138
+ }), C = (l) => {
139
+ const u = l.target;
140
+ r("change", u.value);
102
141
  };
103
- return b([i, s], () => {
104
- i.value && i.value.setCustomValidity(e.errorMessage || "");
105
- }), b(
106
- [i, m, s],
142
+ return S([o, s], () => {
143
+ o.value && o.value.setCustomValidity(e.errorMessage || "");
144
+ }), S(
145
+ [o, m, s],
107
146
  () => {
108
- if (!i.value)
147
+ if (!o.value)
109
148
  return;
110
- const l = F(i.value.validity);
111
- (!u.value || !J(l, u.value)) && (u.value = l, a("validityChange", u.value));
149
+ const l = X(o.value.validity);
150
+ (!i.value || !G(l, i.value)) && (i.value = l, r("validityChange", i.value));
112
151
  },
113
152
  { immediate: !0 }
114
- ), (l, o) => {
115
- var y, _;
116
- return M(), V("label", {
117
- class: E(["onyx-input", { "onyx-input--touched": c.value }])
153
+ ), (l, u) => {
154
+ var M, O;
155
+ return v(), y("label", {
156
+ class: h(["onyx-input", { "onyx-input--touched": c.value }])
118
157
  }, [
119
- g("span", {
120
- class: E(["onyx-input__label", { "onyx-input__label--required": e.required }])
121
- }, v(e.label), 3),
122
- j(g("input", D(e, {
158
+ f("span", {
159
+ class: h(["onyx-input__label", { "onyx-input__label--required": e.required }])
160
+ }, p(e.label), 3),
161
+ B(f("input", H(e, {
123
162
  ref_key: "inputElement",
124
- ref: i,
125
- "onUpdate:modelValue": o[0] || (o[0] = (x) => m.value = x),
126
- onChange: T,
127
- onBlur: o[1] || (o[1] = (x) => c.value = !0)
163
+ ref: o,
164
+ "onUpdate:modelValue": u[0] || (u[0] = (E) => m.value = E),
165
+ onChange: C,
166
+ onBlur: u[1] || (u[1] = (E) => c.value = !0)
128
167
  }), null, 16), [
129
- [k, m.value]
168
+ [R, m.value]
130
169
  ]),
131
- c.value && !((y = u.value) != null && y.valid) ? (M(), V("p", K, v(O.value), 1)) : z("", !0),
132
- g("p", G, 'Model value: "' + v(m.value) + '", is valid: ' + v((_ = u.value) == null ? void 0 : _.valid), 1)
170
+ c.value && !((M = i.value) != null && M.valid) ? (v(), y("p", Q, p(T.value), 1)) : k("", !0),
171
+ f("p", W, 'Model value: "' + p(m.value) + '", is valid: ' + p((O = i.value) == null ? void 0 : O.valid), 1)
133
172
  ], 2);
134
173
  };
135
174
  }
136
- }), W = (t, r) => {
137
- const e = t.__vccOpts || t;
138
- for (const [a, n] of r)
139
- e[a] = n;
140
- return e;
141
- }, ee = /* @__PURE__ */ W(Q, [["__scopeId", "data-v-6632dbdc"]]);
175
+ }), ie = [
176
+ "primary",
177
+ "secondary",
178
+ "neutral",
179
+ "danger",
180
+ "warning",
181
+ "success",
182
+ "info"
183
+ ];
142
184
  export {
143
- ee as TestInput,
144
- Z as provideI18n
185
+ re as HEADLINE_TYPES,
186
+ se as ICON_SIZES,
187
+ ie as ONYX_COLORS,
188
+ ne as OnyxHeadline,
189
+ ae as OnyxIcon,
190
+ oe as TestInput,
191
+ le as provideI18n
145
192
  };