@oneb/ui-vue 0.2.9 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,17 @@
1
1
  import type { ExtractPropTypes, ComputedRef } from 'vue';
2
2
  export type ValidationType = Record<string, string[] | undefined>;
3
+ export type FormInputEmits = {
4
+ 'update:modelValue': [value: any];
5
+ 'focus': [event: FocusEvent];
6
+ 'blur': [event: FocusEvent];
7
+ 'change': [event: Event];
8
+ 'input': [event: Event];
9
+ 'keydown': [event: KeyboardEvent];
10
+ 'keyup': [event: KeyboardEvent];
11
+ 'keypress': [event: KeyboardEvent];
12
+ 'clear': [];
13
+ 'toggle-password': [visible: boolean];
14
+ };
3
15
  export declare const formProps: {
4
16
  id: {
5
17
  type: StringConstructor;
@@ -68,66 +80,82 @@ export declare const formLabelProps: {
68
80
  };
69
81
  export type FormLabelProps = ExtractPropTypes<typeof formLabelProps>;
70
82
  export declare const formInputProps: {
83
+ /** Unique identifier for the input element */
71
84
  id: {
72
85
  type: StringConstructor;
73
86
  required: boolean;
74
87
  };
88
+ /** Name attribute for form submission */
75
89
  name: {
76
90
  type: StringConstructor;
77
91
  required: boolean;
78
92
  };
93
+ /** Placeholder text displayed when input is empty */
79
94
  placeholder: {
80
95
  type: StringConstructor;
81
96
  default: string;
82
97
  };
98
+ /** Icon component to display at the start of the input */
83
99
  icon: {
84
100
  type: PropType<any>;
85
101
  };
102
+ /** Type of input field */
86
103
  type: {
87
- type: PropType<"number" | "checkbox" | "text" | "select" | "password" | "radio" | "range" | "textarea">;
104
+ type: PropType<"number" | "checkbox" | "text" | "search" | "select" | "password" | "email" | "tel" | "url" | "radio" | "range" | "textarea" | "date" | "time" | "datetime-local" | "month" | "week" | "color">;
88
105
  default: string;
89
106
  };
107
+ /** Additional CSS classes to apply to the input element */
90
108
  inputClass: {
91
109
  required: boolean;
92
110
  type: PropType<string | string[]>;
93
111
  };
112
+ /** Current value of the input (v-model) */
94
113
  modelValue: {
95
114
  required: boolean;
96
115
  type: PropType<any>;
97
116
  };
117
+ /** Auto-focus the input when component mounts */
98
118
  autofocus: {
99
119
  type: BooleanConstructor;
100
120
  default: boolean;
101
121
  };
122
+ /** Mark input as required (adds asterisk to label) */
102
123
  required: {
103
124
  type: BooleanConstructor;
104
125
  default: boolean;
105
126
  };
127
+ /** Disable the input field */
106
128
  disabled: {
107
129
  type: BooleanConstructor;
108
130
  default: boolean;
109
131
  };
132
+ /** Make the input read-only */
110
133
  readonly: {
111
134
  type: BooleanConstructor;
112
135
  default: boolean;
113
136
  };
137
+ /** Show clear button when input has value */
114
138
  clearable: {
115
139
  type: BooleanConstructor;
116
140
  default: boolean;
117
141
  };
142
+ /** Use rounded styling (full rounded borders) */
118
143
  rounded: {
119
144
  type: BooleanConstructor;
120
145
  default: boolean;
121
146
  };
147
+ /** Use large size styling */
122
148
  large: {
123
149
  type: BooleanConstructor;
124
150
  default: boolean;
125
151
  };
152
+ /** Mark input as invalid (shows error styling) */
126
153
  invalid: {
127
154
  type: BooleanConstructor;
128
155
  required: boolean;
129
156
  default: boolean;
130
157
  };
158
+ /** Options array for select and radio inputs */
131
159
  options: {
132
160
  type: PropType<{
133
161
  key: string;
@@ -136,11 +164,82 @@ export declare const formInputProps: {
136
164
  required: boolean;
137
165
  default: any[];
138
166
  };
167
+ /** HTML autocomplete attribute value */
139
168
  autocomplete: {
140
169
  type: StringConstructor;
141
170
  required: boolean;
142
171
  default: string;
143
172
  };
173
+ /** Maximum length of text input */
174
+ maxlength: {
175
+ type: NumberConstructor;
176
+ required: boolean;
177
+ };
178
+ /** Minimum length of text input */
179
+ minlength: {
180
+ type: NumberConstructor;
181
+ required: boolean;
182
+ };
183
+ /** Minimum value for number/date inputs */
184
+ min: {
185
+ type: PropType<string | number>;
186
+ required: boolean;
187
+ };
188
+ /** Maximum value for number/date inputs */
189
+ max: {
190
+ type: PropType<string | number>;
191
+ required: boolean;
192
+ };
193
+ /** Step increment for number/range inputs */
194
+ step: {
195
+ type: PropType<string | number>;
196
+ required: boolean;
197
+ };
198
+ /** Validation pattern (regex) for text inputs */
199
+ pattern: {
200
+ type: StringConstructor;
201
+ required: boolean;
202
+ };
203
+ /** Number of rows for textarea */
204
+ rows: {
205
+ type: NumberConstructor;
206
+ default: number;
207
+ };
208
+ /** Number of columns for textarea */
209
+ cols: {
210
+ type: NumberConstructor;
211
+ required: boolean;
212
+ };
213
+ /** Allow textarea to be resized */
214
+ resize: {
215
+ type: PropType<"none" | "vertical" | "both" | "horizontal">;
216
+ default: string;
217
+ };
218
+ /** Spellcheck attribute for text inputs */
219
+ spellcheck: {
220
+ type: BooleanConstructor;
221
+ required: boolean;
222
+ };
223
+ /** Input mode for mobile keyboards */
224
+ inputmode: {
225
+ type: PropType<"none" | "text" | "search" | "email" | "tel" | "url" | "numeric" | "decimal">;
226
+ required: boolean;
227
+ };
228
+ /** Tab index for keyboard navigation */
229
+ tabindex: {
230
+ type: NumberConstructor;
231
+ required: boolean;
232
+ };
233
+ /** Aria label for accessibility */
234
+ ariaLabel: {
235
+ type: StringConstructor;
236
+ required: boolean;
237
+ };
238
+ /** Aria described by for accessibility */
239
+ ariaDescribedby: {
240
+ type: StringConstructor;
241
+ required: boolean;
242
+ };
144
243
  };
145
244
  export type FormInputProps = ExtractPropTypes<typeof formInputProps>;
146
245
  export declare const injectForm: () => any;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),S=require("../XMarkIcon-f94baa4c.cjs"),F={id:{type:String,required:!1},validation:{type:Object,required:!1}},$={id:{type:String,required:!1},label:{type:String,required:!1},name:{type:String,required:!1},required:{required:!1,type:Boolean,default:!1},hint:{type:String,required:!1,default:""},errors:{type:Array,required:!1}},N={name:{type:String,required:!1},errors:{type:Array,required:!1}},q={label:{type:String,required:!1}},O={id:{type:String,required:!1},name:{type:String,required:!1},placeholder:{type:String,default:""},icon:{type:[Function,Object]},type:{type:String,default:"text"},inputClass:{required:!1,type:[Array,String]},modelValue:{required:!1,type:[String,Number,Array,Boolean,Object,null]},autofocus:{type:Boolean,default:!1},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},rounded:{type:Boolean,default:!1},large:{type:Boolean,default:!1},invalid:{type:Boolean,required:!1,default:!1},options:{type:Array,required:!1,default:[]},autocomplete:{type:String,required:!1,default:""}},h=()=>e.inject("BaseForm",()=>({formId:e.computed(()=>{}),validation:e.computed(()=>{})}),!0),k=()=>e.inject("BaseFormField",()=>({inputId:e.computed(()=>{}),inputName:e.computed(()=>{}),hasError:e.computed(()=>!1)}),!0),j=["id"],I=e.defineComponent({__name:"OneForm",props:F,emits:["submit"],setup(d,{emit:l}){const n=d,o=l;e.provide("BaseForm",{formId:e.computed(()=>n.id),validation:e.computed(()=>n.validation)});const a=()=>{o("submit")};return(t,c)=>(e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(a,["prevent"]),id:t.id,class:"space-y-3"},[e.renderSlot(t.$slots,"default")],40,j))}}),_=["for"],b=e.defineComponent({__name:"OneFormLabel",props:q,setup(d){const{inputId:l}=k();return(n,o)=>(e.openBlock(),e.createElementBlock("label",{for:e.unref(l),class:"text-sm font-medium text-primary-content select-none flex justify-between"},[e.createElementVNode("span",null,[e.renderSlot(n.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(n.label),1)])]),e.renderSlot(n.$slots,"right")],8,_))}}),L={key:0,class:"text-danger-content text-xs space-y-1"},B=e.defineComponent({__name:"OneFormFeedback",props:N,setup(d){const l=d,{validation:n}=h(),{inputName:o}=k(),a=e.computed(()=>o.value==null&&l.name==null?l.errors??[]:n.value==null?l.errors??[]:(n.value??{})[l.name||o.value]??l.errors??[]);return(t,c)=>a.value.length>0?(e.openBlock(),e.createElementBlock("div",L,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u},e.toDisplayString(u),1))),128))])):e.createCommentVNode("",!0)}});function M(d,l){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})])}function A(d,l){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})])}const D=["id","disabled"],z=["selected"],P=["selected","value"],T=["name","id","value","placeholder","disabled","readonly"],X={key:2,class:"flex w-full space-x-3 items-center"},G=["type","name","id","disabled","readonly","checked"],H=["for"],J={key:3,class:"w-full space-y-1"},K=["name","id","value","disabled","readonly","checked"],Q=["for"],R={key:4,class:"relative"},U={class:"absolute p-2 px-3 rounded-md h-full flex items-center select-none pointer-events-none"},W=["type","name","id","value","placeholder","disabled","readonly","autocomplete"],g=e.defineComponent({__name:"OneFormInput",props:O,emits:["update:modelValue"],setup(d,{expose:l,emit:n}){const o=d,a=n,{inputId:t,inputName:c,hasError:u}=k(),i=e.ref(null),m=e.ref(!1);e.onMounted(()=>{o.autofocus&&i.value&&i.value.focus()});const E=e.computed(()=>o.modelValue!=null&&o.modelValue!==""),p=e.computed(()=>{if(o.id)return o.id;const r=(t==null?void 0:t.value)||"";return o.name?`${r}-${o.name}`:r||""}),V=()=>{a("update:modelValue","")},w=()=>{i.value&&i.value.focus()},C=e.computed(()=>{const r={"shadow-sm":o.type!=="range","border-danger-base":u.value||o.invalid,"pl-10":o.icon!=null,"pr-10":o.type==="password","rounded-full":o.rounded,"rounded-md":!o.rounded,"text-lg":o.large,"py-2.5":o.large,"py-2":!o.large};return o.inputClass!=null&&(typeof o.inputClass=="string"?r[o.inputClass]=!0:o.inputClass instanceof Array&&o.inputClass.forEach(y=>{r[y]=!0})),r}),f=r=>{o.type==="checkbox"?a("update:modelValue",r.target.checked):a("update:modelValue",r.target.value)};return l({focus:w}),(r,y)=>r.type==="select"?(e.openBlock(),e.createElementBlock("select",{key:0,id:p.value,ref_key:"inputElement",ref:i,class:e.normalizeClass(["border border-primary-stroke px-3 w-full",{"border-danger-base":e.unref(u)||r.invalid,"text-secondary-content":r.modelValue===""||r.modelValue==null,"rounded-full":r.rounded,"rounded-md":!r.rounded,"text-lg":r.large,"py-2.5":r.large,"py-2":!r.large}]),disabled:r.disabled},[r.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,selected:r.modelValue===""||r.modelValue==null,disabled:"",hidden:""},e.toDisplayString(r.placeholder),9,z)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,s=>(e.openBlock(),e.createElementBlock("option",{selected:s.key===r.modelValue,key:s.key,value:s.key},e.toDisplayString(s.value),9,P))),128))],10,D)):r.type==="textarea"?(e.openBlock(),e.createElementBlock("textarea",{key:1,name:r.name||e.unref(c),id:p.value,value:r.modelValue,onInput:f,rows:"3",class:e.normalizeClass(["border border-primary-stroke px-3 w-full placeholder-gray-400",{"border-danger-base":e.unref(u),"rounded-3xl":r.rounded,"rounded-md":!r.rounded,"text-lg":r.large,"py-2.5":r.large,"py-2":!r.large}]),placeholder:r.placeholder,disabled:r.disabled,readonly:r.readonly,ref_key:"inputElement",ref:i},null,42,T)):r.type==="checkbox"?(e.openBlock(),e.createElementBlock("div",X,[e.createElementVNode("input",{type:r.type,name:r.name||e.unref(c),id:p.value,value:!0,onInput:f,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["rounded-md border border-primary-stroke px-2 py-2 shadow-sm",{"border-danger-base":e.unref(u)||r.invalid}]),checked:r.modelValue===!0,ref_key:"inputElement",ref:i},null,42,G),e.createElementVNode("label",{for:p.value,class:"text-primary-content select-none"},e.toDisplayString(r.placeholder),9,H)])):r.type==="radio"?(e.openBlock(),e.createElementBlock("div",J,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,(s,v)=>(e.openBlock(),e.createElementBlock("div",{key:s.key,class:"flex w-full space-x-3 items-center"},[e.createElementVNode("input",{type:"radio",name:r.name||e.unref(c),id:`${p.value}-${v}`,value:s.key,onInput:f,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm",{"border-danger-base":e.unref(u)||r.invalid}]),checked:s.key===r.modelValue,ref_for:!0,ref_key:"inputElement",ref:i},null,42,K),e.createElementVNode("label",{for:`${p.value}-${v}`,class:"text-primary-content select-none"},e.toDisplayString(s.value),9,Q)]))),128))])):(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("div",U,[r.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.icon),{key:0,class:"w-5 h-5 text-primary-content"})):e.createCommentVNode("",!0)]),e.createElementVNode("input",{type:m.value?"text":r.type,name:r.name||e.unref(c),id:p.value,value:r.modelValue,onInput:f,placeholder:r.placeholder,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["border border-primary-stroke w-full px-3 placeholder-gray-400 disabled:bg-gray-50",C.value]),ref_key:"inputElement",ref:i,autocomplete:r.autocomplete},null,42,W),r.clearable&&E.value?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:V,class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[e.createVNode(e.unref(S.render),{class:"w-5 h-5 text-secondary-content hover:text-primary-base"})])):r.type==="password"?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:y[0]||(y[0]=s=>m.value=!m.value),class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[m.value?(e.openBlock(),e.createBlock(e.unref(A),{key:0,class:"w-5 h-5 text-primary-content hover:text-primary-base"})):(e.openBlock(),e.createBlock(e.unref(M),{key:1,class:"w-5 h-5 text-secondary-content hover:text-primary-base"}))])):e.createCommentVNode("",!0)]))}}),Y={class:"space-y-1"},Z={key:2,class:"text-xs text-secondary-content select-none"},x=e.defineComponent({__name:"OneFormField",props:$,setup(d){const l=d,{formId:n,validation:o}=h(),a=e.computed(()=>l.errors!=null&&l.errors.length>0?!0:l.name==null?!1:(o.value??{})[l.name]!=null);return e.provide("BaseFormField",{inputId:e.computed(()=>{const t=n.value||"form";if(l.id!=null)return`${t}-${l.id}`;if(l.name!=null)return`${t}-field-${l.name}`}),inputName:e.computed(()=>l.name),hasError:a}),(t,c)=>(e.openBlock(),e.createElementBlock("div",Y,[t.label?(e.openBlock(),e.createBlock(b,{key:0,label:t.label},{right:e.withCtx(()=>[e.renderSlot(t.$slots,"right")]),_:3},8,["label"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},()=>[e.createVNode(g)]),a.value?(e.openBlock(),e.createBlock(B,{key:1,errors:t.errors},null,8,["errors"])):t.hint.length>0?(e.openBlock(),e.createElementBlock("p",Z,e.toDisplayString(t.hint),1)):e.createCommentVNode("",!0)]))}});exports.OneForm=I;exports.OneFormFeedback=B;exports.OneFormField=x;exports.OneFormInput=g;exports.OneFormLabel=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),j=require("../XMarkIcon-f94baa4c.cjs"),I={id:{type:String,required:!1},validation:{type:Object,required:!1}},L={id:{type:String,required:!1},label:{type:String,required:!1},name:{type:String,required:!1},required:{required:!1,type:Boolean,default:!1},hint:{type:String,required:!1,default:""},errors:{type:Array,required:!1}},D={name:{type:String,required:!1},errors:{type:Array,required:!1}},A={label:{type:String,required:!1}},M={id:{type:String,required:!1},name:{type:String,required:!1},placeholder:{type:String,default:""},icon:{type:[Function,Object]},type:{type:String,default:"text"},inputClass:{required:!1,type:[Array,String]},modelValue:{required:!1,type:[String,Number,Array,Boolean,Object,null]},autofocus:{type:Boolean,default:!1},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},rounded:{type:Boolean,default:!1},large:{type:Boolean,default:!1},invalid:{type:Boolean,required:!1,default:!1},options:{type:Array,required:!1,default:[]},autocomplete:{type:String,required:!1,default:""},maxlength:{type:Number,required:!1},minlength:{type:Number,required:!1},min:{type:[Number,String],required:!1},max:{type:[Number,String],required:!1},step:{type:[Number,String],required:!1},pattern:{type:String,required:!1},rows:{type:Number,default:3},cols:{type:Number,required:!1},resize:{type:String,default:"vertical"},spellcheck:{type:Boolean,required:!1},inputmode:{type:String,required:!1},tabindex:{type:Number,required:!1},ariaLabel:{type:String,required:!1},ariaDescribedby:{type:String,required:!1}},V=()=>e.inject("BaseForm",()=>({formId:e.computed(()=>{}),validation:e.computed(()=>{})}),!0),w=()=>e.inject("BaseFormField",()=>({inputId:e.computed(()=>{}),inputName:e.computed(()=>{}),hasError:e.computed(()=>!1)}),!0),P=["id"],K=e.defineComponent({__name:"OneForm",props:I,emits:["submit"],setup(i,{emit:n}){const a=i,l=n;e.provide("BaseForm",{formId:e.computed(()=>a.id),validation:e.computed(()=>a.validation)});const t=()=>{l("submit")};return(o,c)=>(e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(t,["prevent"]),id:o.id,class:"space-y-3"},[e.renderSlot(o.$slots,"default")],40,P))}}),T=["for"],q=e.defineComponent({__name:"OneFormLabel",props:A,setup(i){const{inputId:n}=w();return(a,l)=>(e.openBlock(),e.createElementBlock("label",{for:e.unref(n),class:"text-sm font-medium text-primary-content select-none flex justify-between"},[e.createElementVNode("span",null,[e.renderSlot(a.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(a.label),1)])]),e.renderSlot(a.$slots,"right")],8,T))}}),X={key:0,class:"text-danger-content text-xs space-y-1"},C=e.defineComponent({__name:"OneFormFeedback",props:D,setup(i){const n=i,{validation:a}=V(),{inputName:l}=w(),t=e.computed(()=>l.value==null&&n.name==null?n.errors??[]:a.value==null?n.errors??[]:(a.value??{})[n.name||l.value]??n.errors??[]);return(o,c)=>t.value.length>0?(e.openBlock(),e.createElementBlock("div",X,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u},e.toDisplayString(u),1))),128))])):e.createCommentVNode("",!0)}});function G(i,n){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})])}function H(i,n){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})])}const J=["id","disabled","tabindex"],Q=["selected"],R=["selected","value"],U=["name","id","value","rows","cols","maxlength","minlength","spellcheck","placeholder","disabled","readonly","tabindex","aria-label","aria-describedby"],W={key:2,class:"flex w-full space-x-3 items-center"},Y=["type","name","id","disabled","readonly","tabindex","aria-label","aria-describedby","checked"],Z=["for"],x={key:3,class:"w-full space-y-1"},_=["name","id","value","disabled","readonly","tabindex","checked"],ee=["for"],re={key:4,class:"relative"},le={class:"absolute p-2 px-3 rounded-md h-full flex items-center select-none pointer-events-none"},ne=["type","name","id","value","placeholder","disabled","readonly","maxlength","minlength","min","max","step","pattern","spellcheck","inputmode","tabindex","autocomplete","aria-label","aria-describedby"],N=e.defineComponent({__name:"OneFormInput",props:M,emits:["update:modelValue","focus","blur","change","input","keydown","keyup","keypress","clear","toggle-password"],setup(i,{expose:n,emit:a}){const l=i,t=a,{inputId:o,inputName:c,hasError:u}=w(),s=e.ref(null),m=e.ref(!1);e.onMounted(()=>{l.autofocus&&s.value&&s.value.focus()});const F=e.computed(()=>l.modelValue!=null&&l.modelValue!==""),p=e.computed(()=>{if(l.id)return l.id;const r=(o==null?void 0:o.value)||"";return l.name?`${r}-${l.name}`:r||""}),$=()=>{t("update:modelValue",""),t("clear"),E()},z=()=>{m.value=!m.value,t("toggle-password",m.value)},E=()=>{if(s.value){const r=Array.isArray(s.value)?s.value[0]:s.value;r==null||r.focus()}},O=e.computed(()=>{const r={"shadow-sm":l.type!=="range","border-danger-base":u.value||l.invalid,"pl-10":l.icon!=null,"pr-10":l.type==="password","rounded-full":l.rounded,"rounded-md":!l.rounded,"text-lg":l.large,"py-2.5":l.large,"py-2":!l.large};return l.inputClass!=null&&(typeof l.inputClass=="string"?r[l.inputClass]=!0:l.inputClass instanceof Array&&l.inputClass.forEach(h=>{r[h]=!0})),r}),y=r=>{const h=r.target;if(l.type==="checkbox"){const d=h.checked;t("update:modelValue",d),t("input",r)}else t("update:modelValue",h.value),t("input",r)},f=r=>t("focus",r),b=r=>t("blur",r),k=r=>t("change",r),g=r=>t("keydown",r),v=r=>t("keyup",r),B=r=>t("keypress",r);return n({focus:E}),(r,h)=>r.type==="select"?(e.openBlock(),e.createElementBlock("select",{key:0,id:p.value,ref_key:"inputElement",ref:s,class:e.normalizeClass(["border border-primary-stroke px-3 w-full",{"border-danger-base":e.unref(u)||r.invalid,"text-secondary-content":r.modelValue===""||r.modelValue==null,"rounded-full":r.rounded,"rounded-md":!r.rounded,"text-lg":r.large,"py-2.5":r.large,"py-2":!r.large}]),disabled:r.disabled,tabindex:r.tabindex,onInput:y,onFocus:f,onBlur:b,onChange:k,onKeydown:g,onKeyup:v,onKeypress:B},[r.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,selected:r.modelValue===""||r.modelValue==null,disabled:"",hidden:""},e.toDisplayString(r.placeholder),9,Q)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,d=>(e.openBlock(),e.createElementBlock("option",{selected:d.key===r.modelValue,key:d.key,value:d.key},e.toDisplayString(d.value),9,R))),128))],42,J)):r.type==="textarea"?(e.openBlock(),e.createElementBlock("textarea",{key:1,name:r.name||e.unref(c),id:p.value,value:r.modelValue,rows:r.rows,cols:r.cols,maxlength:r.maxlength,minlength:r.minlength,spellcheck:r.spellcheck,placeholder:r.placeholder,disabled:r.disabled,readonly:r.readonly,tabindex:r.tabindex,"aria-label":r.ariaLabel,"aria-describedby":r.ariaDescribedby,onInput:y,onFocus:f,onBlur:b,onChange:k,onKeydown:g,onKeyup:v,onKeypress:B,class:e.normalizeClass(["border border-primary-stroke px-3 w-full placeholder-gray-400",{"border-danger-base":e.unref(u),"rounded-3xl":r.rounded,"rounded-md":!r.rounded,"text-lg":r.large,"py-2.5":r.large,"py-2":!r.large,"resize-none":r.resize==="none","resize-both":r.resize==="both","resize-x":r.resize==="horizontal","resize-y":r.resize==="vertical"}]),ref_key:"inputElement",ref:s},null,42,U)):r.type==="checkbox"?(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("input",{type:r.type,name:r.name||e.unref(c),id:p.value,value:!0,disabled:r.disabled,readonly:r.readonly,tabindex:r.tabindex,"aria-label":r.ariaLabel,"aria-describedby":r.ariaDescribedby,checked:r.modelValue===!0,onInput:y,onFocus:f,onBlur:b,onChange:k,class:e.normalizeClass(["rounded-md border border-primary-stroke px-2 py-2 shadow-sm",{"border-danger-base":e.unref(u)||r.invalid}]),ref_key:"inputElement",ref:s},null,42,Y),e.createElementVNode("label",{for:p.value,class:"text-primary-content select-none"},e.toDisplayString(r.placeholder),9,Z)])):r.type==="radio"?(e.openBlock(),e.createElementBlock("div",x,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,(d,S)=>(e.openBlock(),e.createElementBlock("div",{key:d.key,class:"flex w-full space-x-3 items-center"},[e.createElementVNode("input",{type:"radio",name:r.name||e.unref(c),id:`${p.value}-${S}`,value:d.key,disabled:r.disabled,readonly:r.readonly,tabindex:r.tabindex,checked:d.key===r.modelValue,onInput:y,onFocus:f,onBlur:b,onChange:k,class:e.normalizeClass(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm",{"border-danger-base":e.unref(u)||r.invalid}]),ref_for:!0,ref_key:"inputElement",ref:s},null,42,_),e.createElementVNode("label",{for:`${p.value}-${S}`,class:"text-primary-content select-none"},e.toDisplayString(d.value),9,ee)]))),128))])):(e.openBlock(),e.createElementBlock("div",re,[e.createElementVNode("div",le,[r.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.icon),{key:0,class:"w-5 h-5 text-primary-content"})):e.createCommentVNode("",!0)]),e.createElementVNode("input",{type:m.value?"text":r.type,name:r.name||e.unref(c),id:p.value,value:r.modelValue,placeholder:r.placeholder,disabled:r.disabled,readonly:r.readonly,maxlength:r.maxlength,minlength:r.minlength,min:r.min,max:r.max,step:r.step,pattern:r.pattern,spellcheck:r.spellcheck,inputmode:r.inputmode,tabindex:r.tabindex,autocomplete:r.autocomplete,"aria-label":r.ariaLabel,"aria-describedby":r.ariaDescribedby,onInput:y,onFocus:f,onBlur:b,onChange:k,onKeydown:g,onKeyup:v,onKeypress:B,class:e.normalizeClass(["border border-primary-stroke w-full px-3 placeholder-gray-400 disabled:bg-gray-50",O.value]),ref_key:"inputElement",ref:s},null,42,ne),r.clearable&&F.value?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:$,class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[e.createVNode(e.unref(j.render),{class:"w-5 h-5 text-secondary-content hover:text-primary-base"})])):r.type==="password"?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:z,class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[m.value?(e.openBlock(),e.createBlock(e.unref(H),{key:0,class:"w-5 h-5 text-primary-content hover:text-primary-base"})):(e.openBlock(),e.createBlock(e.unref(G),{key:1,class:"w-5 h-5 text-secondary-content hover:text-primary-base"}))])):e.createCommentVNode("",!0)]))}}),te={class:"space-y-1"},oe={key:2,class:"text-xs text-secondary-content select-none"},ae=e.defineComponent({__name:"OneFormField",props:L,setup(i){const n=i,{formId:a,validation:l}=V(),t=e.computed(()=>n.errors!=null&&n.errors.length>0?!0:n.name==null?!1:(l.value??{})[n.name]!=null);return e.provide("BaseFormField",{inputId:e.computed(()=>{const o=a.value||"form";if(n.id!=null)return`${o}-${n.id}`;if(n.name!=null)return`${o}-field-${n.name}`}),inputName:e.computed(()=>n.name),hasError:t}),(o,c)=>(e.openBlock(),e.createElementBlock("div",te,[o.label?(e.openBlock(),e.createBlock(q,{key:0,label:o.label},{right:e.withCtx(()=>[e.renderSlot(o.$slots,"right")]),_:3},8,["label"])):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"default",{},()=>[e.createVNode(N)]),t.value?(e.openBlock(),e.createBlock(C,{key:1,errors:o.errors},null,8,["errors"])):o.hint.length>0?(e.openBlock(),e.createElementBlock("p",oe,e.toDisplayString(o.hint),1)):e.createCommentVNode("",!0)]))}});exports.OneForm=K;exports.OneFormFeedback=C;exports.OneFormField=ae;exports.OneFormInput=N;exports.OneFormLabel=q;
@@ -3,4 +3,4 @@ export { default as OneFormField } from './OneFormField.vue';
3
3
  export { default as OneFormFeedback } from './OneFormFeedback.vue';
4
4
  export { default as OneFormLabel } from './OneFormLabel.vue';
5
5
  export { default as OneFormInput } from './OneFormInput.vue';
6
- export type { FormProps, FormProvide, FormFieldProps, FormFieldProvide, FormFeedbackProps, FormLabelProps, FormInputProps } from './form';
6
+ export type { FormProps, FormProvide, FormFieldProps, FormFieldProvide, FormFeedbackProps, FormLabelProps, FormInputProps, FormInputEmits } from './form';
@@ -1,6 +1,6 @@
1
- import { inject as I, computed as n, defineComponent as F, provide as _, openBlock as l, createElementBlock as t, withModifiers as z, renderSlot as w, unref as d, createElementVNode as m, createTextVNode as D, toDisplayString as v, Fragment as C, renderList as B, createCommentVNode as b, ref as O, onMounted as T, normalizeClass as k, createBlock as g, resolveDynamicComponent as G, createVNode as j, withCtx as H } from "vue";
2
- import { r as J } from "../XMarkIcon-51ef0691.js";
3
- const K = {
1
+ import { inject as P, computed as s, defineComponent as V, provide as D, openBlock as a, createElementBlock as t, withModifiers as R, renderSlot as C, unref as i, createElementVNode as c, createTextVNode as U, toDisplayString as h, Fragment as O, renderList as I, createCommentVNode as v, ref as M, onMounted as W, normalizeClass as $, createBlock as B, resolveDynamicComponent as X, createVNode as K, withCtx as Y } from "vue";
2
+ import { r as Z } from "../XMarkIcon-51ef0691.js";
3
+ const x = {
4
4
  id: {
5
5
  type: String,
6
6
  required: !1
@@ -9,7 +9,7 @@ const K = {
9
9
  type: Object,
10
10
  required: !1
11
11
  }
12
- }, Q = {
12
+ }, _ = {
13
13
  id: {
14
14
  type: String,
15
15
  required: !1
@@ -36,7 +36,7 @@ const K = {
36
36
  type: Array,
37
37
  required: !1
38
38
  }
39
- }, R = {
39
+ }, ee = {
40
40
  name: {
41
41
  type: String,
42
42
  required: !1
@@ -45,154 +45,241 @@ const K = {
45
45
  type: Array,
46
46
  required: !1
47
47
  }
48
- }, U = {
48
+ }, re = {
49
49
  label: {
50
50
  type: String,
51
51
  required: !1
52
52
  }
53
- }, W = {
53
+ }, ae = {
54
+ /** Unique identifier for the input element */
54
55
  id: {
55
56
  type: String,
56
57
  required: !1
57
58
  },
59
+ /** Name attribute for form submission */
58
60
  name: {
59
61
  type: String,
60
62
  required: !1
61
63
  },
64
+ /** Placeholder text displayed when input is empty */
62
65
  placeholder: {
63
66
  type: String,
64
67
  default: ""
65
68
  },
69
+ /** Icon component to display at the start of the input */
66
70
  icon: {
67
71
  type: [Function, Object]
68
72
  },
73
+ /** Type of input field */
69
74
  type: {
70
75
  type: String,
71
76
  default: "text"
72
77
  },
78
+ /** Additional CSS classes to apply to the input element */
73
79
  inputClass: {
74
80
  required: !1,
75
81
  type: [Array, String]
76
82
  },
83
+ /** Current value of the input (v-model) */
77
84
  modelValue: {
78
85
  required: !1,
79
86
  type: [String, Number, Array, Boolean, Object, null]
80
87
  },
88
+ /** Auto-focus the input when component mounts */
81
89
  autofocus: {
82
90
  type: Boolean,
83
91
  default: !1
84
92
  },
93
+ /** Mark input as required (adds asterisk to label) */
85
94
  required: {
86
95
  type: Boolean,
87
96
  default: !1
88
97
  },
98
+ /** Disable the input field */
89
99
  disabled: {
90
100
  type: Boolean,
91
101
  default: !1
92
102
  },
103
+ /** Make the input read-only */
93
104
  readonly: {
94
105
  type: Boolean,
95
106
  default: !1
96
107
  },
108
+ /** Show clear button when input has value */
97
109
  clearable: {
98
110
  type: Boolean,
99
111
  default: !1
100
112
  },
113
+ /** Use rounded styling (full rounded borders) */
101
114
  rounded: {
102
115
  type: Boolean,
103
116
  default: !1
104
117
  },
118
+ /** Use large size styling */
105
119
  large: {
106
120
  type: Boolean,
107
121
  default: !1
108
122
  },
123
+ /** Mark input as invalid (shows error styling) */
109
124
  invalid: {
110
125
  type: Boolean,
111
126
  required: !1,
112
127
  default: !1
113
128
  },
129
+ /** Options array for select and radio inputs */
114
130
  options: {
115
131
  type: Array,
116
132
  required: !1,
117
133
  default: []
118
134
  },
135
+ /** HTML autocomplete attribute value */
119
136
  autocomplete: {
120
137
  type: String,
121
138
  required: !1,
122
139
  default: ""
140
+ },
141
+ /** Maximum length of text input */
142
+ maxlength: {
143
+ type: Number,
144
+ required: !1
145
+ },
146
+ /** Minimum length of text input */
147
+ minlength: {
148
+ type: Number,
149
+ required: !1
150
+ },
151
+ /** Minimum value for number/date inputs */
152
+ min: {
153
+ type: [Number, String],
154
+ required: !1
155
+ },
156
+ /** Maximum value for number/date inputs */
157
+ max: {
158
+ type: [Number, String],
159
+ required: !1
160
+ },
161
+ /** Step increment for number/range inputs */
162
+ step: {
163
+ type: [Number, String],
164
+ required: !1
165
+ },
166
+ /** Validation pattern (regex) for text inputs */
167
+ pattern: {
168
+ type: String,
169
+ required: !1
170
+ },
171
+ /** Number of rows for textarea */
172
+ rows: {
173
+ type: Number,
174
+ default: 3
175
+ },
176
+ /** Number of columns for textarea */
177
+ cols: {
178
+ type: Number,
179
+ required: !1
180
+ },
181
+ /** Allow textarea to be resized */
182
+ resize: {
183
+ type: String,
184
+ default: "vertical"
185
+ },
186
+ /** Spellcheck attribute for text inputs */
187
+ spellcheck: {
188
+ type: Boolean,
189
+ required: !1
190
+ },
191
+ /** Input mode for mobile keyboards */
192
+ inputmode: {
193
+ type: String,
194
+ required: !1
195
+ },
196
+ /** Tab index for keyboard navigation */
197
+ tabindex: {
198
+ type: Number,
199
+ required: !1
200
+ },
201
+ /** Aria label for accessibility */
202
+ ariaLabel: {
203
+ type: String,
204
+ required: !1
205
+ },
206
+ /** Aria described by for accessibility */
207
+ ariaDescribedby: {
208
+ type: String,
209
+ required: !1
123
210
  }
124
- }, N = () => I(
211
+ }, T = () => P(
125
212
  "BaseForm",
126
213
  () => ({
127
- formId: n(() => {
214
+ formId: s(() => {
128
215
  }),
129
- validation: n(() => {
216
+ validation: s(() => {
130
217
  })
131
218
  }),
132
219
  !0
133
- ), S = () => I(
220
+ ), j = () => P(
134
221
  "BaseFormField",
135
222
  () => ({
136
- inputId: n(() => {
223
+ inputId: s(() => {
137
224
  }),
138
- inputName: n(() => {
225
+ inputName: s(() => {
139
226
  }),
140
- hasError: n(() => !1)
227
+ hasError: s(() => !1)
141
228
  }),
142
229
  !0
143
- ), X = ["id"], we = /* @__PURE__ */ F({
230
+ ), le = ["id"], Ve = /* @__PURE__ */ V({
144
231
  __name: "OneForm",
145
- props: K,
232
+ props: x,
146
233
  emits: ["submit"],
147
- setup(u, { emit: a }) {
148
- const s = u, r = a;
149
- _("BaseForm", {
150
- formId: n(() => s.id),
151
- validation: n(() => s.validation)
234
+ setup(m, { emit: l }) {
235
+ const d = m, r = l;
236
+ D("BaseForm", {
237
+ formId: s(() => d.id),
238
+ validation: s(() => d.validation)
152
239
  });
153
- const i = () => {
240
+ const n = () => {
154
241
  r("submit");
155
242
  };
156
- return (o, y) => (l(), t("form", {
157
- onSubmit: z(i, ["prevent"]),
243
+ return (o, f) => (a(), t("form", {
244
+ onSubmit: R(n, ["prevent"]),
158
245
  id: o.id,
159
246
  class: "space-y-3"
160
247
  }, [
161
- w(o.$slots, "default")
162
- ], 40, X));
248
+ C(o.$slots, "default")
249
+ ], 40, le));
163
250
  }
164
- }), Y = ["for"], Z = /* @__PURE__ */ F({
251
+ }), ne = ["for"], te = /* @__PURE__ */ V({
165
252
  __name: "OneFormLabel",
166
- props: U,
167
- setup(u) {
168
- const { inputId: a } = S();
169
- return (s, r) => (l(), t("label", {
170
- for: d(a),
253
+ props: re,
254
+ setup(m) {
255
+ const { inputId: l } = j();
256
+ return (d, r) => (a(), t("label", {
257
+ for: i(l),
171
258
  class: "text-sm font-medium text-primary-content select-none flex justify-between"
172
259
  }, [
173
- m("span", null, [
174
- w(s.$slots, "default", {}, () => [
175
- D(v(s.label), 1)
260
+ c("span", null, [
261
+ C(d.$slots, "default", {}, () => [
262
+ U(h(d.label), 1)
176
263
  ])
177
264
  ]),
178
- w(s.$slots, "right")
179
- ], 8, Y));
265
+ C(d.$slots, "right")
266
+ ], 8, ne));
180
267
  }
181
- }), x = {
268
+ }), oe = {
182
269
  key: 0,
183
270
  class: "text-danger-content text-xs space-y-1"
184
- }, ee = /* @__PURE__ */ F({
271
+ }, se = /* @__PURE__ */ V({
185
272
  __name: "OneFormFeedback",
186
- props: R,
187
- setup(u) {
188
- const a = u, { validation: s } = N(), { inputName: r } = S(), i = n(() => r.value == null && a.name == null ? a.errors ?? [] : s.value == null ? a.errors ?? [] : (s.value ?? {})[a.name || r.value] ?? a.errors ?? []);
189
- return (o, y) => i.value.length > 0 ? (l(), t("div", x, [
190
- (l(!0), t(C, null, B(i.value, (f) => (l(), t("div", { key: f }, v(f), 1))), 128))
191
- ])) : b("", !0);
273
+ props: ee,
274
+ setup(m) {
275
+ const l = m, { validation: d } = T(), { inputName: r } = j(), n = s(() => r.value == null && l.name == null ? l.errors ?? [] : d.value == null ? l.errors ?? [] : (d.value ?? {})[l.name || r.value] ?? l.errors ?? []);
276
+ return (o, f) => n.value.length > 0 ? (a(), t("div", oe, [
277
+ (a(!0), t(O, null, I(n.value, (y) => (a(), t("div", { key: y }, h(y), 1))), 128))
278
+ ])) : v("", !0);
192
279
  }
193
280
  });
194
- function re(u, a) {
195
- return l(), t("svg", {
281
+ function de(m, l) {
282
+ return a(), t("svg", {
196
283
  xmlns: "http://www.w3.org/2000/svg",
197
284
  fill: "none",
198
285
  viewBox: "0 0 24 24",
@@ -200,20 +287,20 @@ function re(u, a) {
200
287
  stroke: "currentColor",
201
288
  "aria-hidden": "true"
202
289
  }, [
203
- m("path", {
290
+ c("path", {
204
291
  "stroke-linecap": "round",
205
292
  "stroke-linejoin": "round",
206
293
  d: "M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"
207
294
  }),
208
- m("path", {
295
+ c("path", {
209
296
  "stroke-linecap": "round",
210
297
  "stroke-linejoin": "round",
211
298
  d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
212
299
  })
213
300
  ]);
214
301
  }
215
- function le(u, a) {
216
- return l(), t("svg", {
302
+ function ie(m, l) {
303
+ return a(), t("svg", {
217
304
  xmlns: "http://www.w3.org/2000/svg",
218
305
  fill: "none",
219
306
  viewBox: "0 0 24 24",
@@ -221,44 +308,49 @@ function le(u, a) {
221
308
  stroke: "currentColor",
222
309
  "aria-hidden": "true"
223
310
  }, [
224
- m("path", {
311
+ c("path", {
225
312
  "stroke-linecap": "round",
226
313
  "stroke-linejoin": "round",
227
314
  d: "M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"
228
315
  })
229
316
  ]);
230
317
  }
231
- const ae = ["id", "disabled"], te = ["selected"], oe = ["selected", "value"], ne = ["name", "id", "value", "placeholder", "disabled", "readonly"], se = {
318
+ const ue = ["id", "disabled", "tabindex"], pe = ["selected"], me = ["selected", "value"], ce = ["name", "id", "value", "rows", "cols", "maxlength", "minlength", "spellcheck", "placeholder", "disabled", "readonly", "tabindex", "aria-label", "aria-describedby"], ye = {
232
319
  key: 2,
233
320
  class: "flex w-full space-x-3 items-center"
234
- }, de = ["type", "name", "id", "disabled", "readonly", "checked"], ie = ["for"], ue = {
321
+ }, fe = ["type", "name", "id", "disabled", "readonly", "tabindex", "aria-label", "aria-describedby", "checked"], be = ["for"], he = {
235
322
  key: 3,
236
323
  class: "w-full space-y-1"
237
- }, pe = ["name", "id", "value", "disabled", "readonly", "checked"], me = ["for"], ce = {
324
+ }, ve = ["name", "id", "value", "disabled", "readonly", "tabindex", "checked"], ge = ["for"], ke = {
238
325
  key: 4,
239
326
  class: "relative"
240
- }, fe = { class: "absolute p-2 px-3 rounded-md h-full flex items-center select-none pointer-events-none" }, ye = ["type", "name", "id", "value", "placeholder", "disabled", "readonly", "autocomplete"], he = /* @__PURE__ */ F({
327
+ }, we = { class: "absolute p-2 px-3 rounded-md h-full flex items-center select-none pointer-events-none" }, qe = ["type", "name", "id", "value", "placeholder", "disabled", "readonly", "maxlength", "minlength", "min", "max", "step", "pattern", "spellcheck", "inputmode", "tabindex", "autocomplete", "aria-label", "aria-describedby"], Fe = /* @__PURE__ */ V({
241
328
  __name: "OneFormInput",
242
- props: W,
243
- emits: ["update:modelValue"],
244
- setup(u, { expose: a, emit: s }) {
245
- const r = u, i = s, { inputId: o, inputName: y, hasError: f } = S(), c = O(null), $ = O(!1);
246
- T(() => {
247
- r.autofocus && c.value && c.value.focus();
329
+ props: ae,
330
+ emits: ["update:modelValue", "focus", "blur", "change", "input", "keydown", "keyup", "keypress", "clear", "toggle-password"],
331
+ setup(m, { expose: l, emit: d }) {
332
+ const r = m, n = d, { inputId: o, inputName: f, hasError: y } = j(), u = M(null), g = M(!1);
333
+ W(() => {
334
+ r.autofocus && u.value && u.value.focus();
248
335
  });
249
- const A = n(() => r.modelValue != null && r.modelValue !== ""), h = n(() => {
336
+ const G = s(() => r.modelValue != null && r.modelValue !== ""), b = s(() => {
250
337
  if (r.id)
251
338
  return r.id;
252
339
  const e = (o == null ? void 0 : o.value) || "";
253
340
  return r.name ? `${e}-${r.name}` : e || "";
254
- }), L = () => {
255
- i("update:modelValue", "");
256
- }, M = () => {
257
- c.value && c.value.focus();
258
- }, P = n(() => {
341
+ }), H = () => {
342
+ n("update:modelValue", ""), n("clear"), L();
343
+ }, J = () => {
344
+ g.value = !g.value, n("toggle-password", g.value);
345
+ }, L = () => {
346
+ if (u.value) {
347
+ const e = Array.isArray(u.value) ? u.value[0] : u.value;
348
+ e == null || e.focus();
349
+ }
350
+ }, Q = s(() => {
259
351
  const e = {
260
352
  "shadow-sm": r.type !== "range",
261
- "border-danger-base": f.value || r.invalid,
353
+ "border-danger-base": y.value || r.invalid,
262
354
  "pl-10": r.icon != null,
263
355
  "pr-10": r.type === "password",
264
356
  "rounded-full": r.rounded,
@@ -267,21 +359,26 @@ const ae = ["id", "disabled"], te = ["selected"], oe = ["selected", "value"], ne
267
359
  "py-2.5": r.large,
268
360
  "py-2": !r.large
269
361
  };
270
- return r.inputClass != null && (typeof r.inputClass == "string" ? e[r.inputClass] = !0 : r.inputClass instanceof Array && r.inputClass.forEach((q) => {
271
- e[q] = !0;
362
+ return r.inputClass != null && (typeof r.inputClass == "string" ? e[r.inputClass] = !0 : r.inputClass instanceof Array && r.inputClass.forEach((S) => {
363
+ e[S] = !0;
272
364
  })), e;
273
- }), V = (e) => {
274
- r.type === "checkbox" ? i("update:modelValue", e.target.checked) : i("update:modelValue", e.target.value);
275
- };
276
- return a({
277
- focus: M
278
- }), (e, q) => e.type === "select" ? (l(), t("select", {
365
+ }), k = (e) => {
366
+ const S = e.target;
367
+ if (r.type === "checkbox") {
368
+ const p = S.checked;
369
+ n("update:modelValue", p), n("input", e);
370
+ } else
371
+ n("update:modelValue", S.value), n("input", e);
372
+ }, w = (e) => n("focus", e), q = (e) => n("blur", e), F = (e) => n("change", e), N = (e) => n("keydown", e), z = (e) => n("keyup", e), E = (e) => n("keypress", e);
373
+ return l({
374
+ focus: L
375
+ }), (e, S) => e.type === "select" ? (a(), t("select", {
279
376
  key: 0,
280
- id: h.value,
377
+ id: b.value,
281
378
  ref_key: "inputElement",
282
- ref: c,
283
- class: k(["border border-primary-stroke px-3 w-full", {
284
- "border-danger-base": d(f) || e.invalid,
379
+ ref: u,
380
+ class: $(["border border-primary-stroke px-3 w-full", {
381
+ "border-danger-base": i(y) || e.invalid,
285
382
  "text-secondary-content": e.modelValue === "" || e.modelValue == null,
286
383
  "rounded-full": e.rounded,
287
384
  "rounded-md": !e.rounded,
@@ -289,169 +386,221 @@ const ae = ["id", "disabled"], te = ["selected"], oe = ["selected", "value"], ne
289
386
  "py-2.5": e.large,
290
387
  "py-2": !e.large
291
388
  }]),
292
- disabled: e.disabled
389
+ disabled: e.disabled,
390
+ tabindex: e.tabindex,
391
+ onInput: k,
392
+ onFocus: w,
393
+ onBlur: q,
394
+ onChange: F,
395
+ onKeydown: N,
396
+ onKeyup: z,
397
+ onKeypress: E
293
398
  }, [
294
- e.placeholder ? (l(), t("option", {
399
+ e.placeholder ? (a(), t("option", {
295
400
  key: 0,
296
401
  selected: e.modelValue === "" || e.modelValue == null,
297
402
  disabled: "",
298
403
  hidden: ""
299
- }, v(e.placeholder), 9, te)) : b("", !0),
300
- (l(!0), t(C, null, B(e.options, (p) => (l(), t("option", {
404
+ }, h(e.placeholder), 9, pe)) : v("", !0),
405
+ (a(!0), t(O, null, I(e.options, (p) => (a(), t("option", {
301
406
  selected: p.key === e.modelValue,
302
407
  key: p.key,
303
408
  value: p.key
304
- }, v(p.value), 9, oe))), 128))
305
- ], 10, ae)) : e.type === "textarea" ? (l(), t("textarea", {
409
+ }, h(p.value), 9, me))), 128))
410
+ ], 42, ue)) : e.type === "textarea" ? (a(), t("textarea", {
306
411
  key: 1,
307
- name: e.name || d(y),
308
- id: h.value,
412
+ name: e.name || i(f),
413
+ id: b.value,
309
414
  value: e.modelValue,
310
- onInput: V,
311
- rows: "3",
312
- class: k(["border border-primary-stroke px-3 w-full placeholder-gray-400", {
313
- "border-danger-base": d(f),
415
+ rows: e.rows,
416
+ cols: e.cols,
417
+ maxlength: e.maxlength,
418
+ minlength: e.minlength,
419
+ spellcheck: e.spellcheck,
420
+ placeholder: e.placeholder,
421
+ disabled: e.disabled,
422
+ readonly: e.readonly,
423
+ tabindex: e.tabindex,
424
+ "aria-label": e.ariaLabel,
425
+ "aria-describedby": e.ariaDescribedby,
426
+ onInput: k,
427
+ onFocus: w,
428
+ onBlur: q,
429
+ onChange: F,
430
+ onKeydown: N,
431
+ onKeyup: z,
432
+ onKeypress: E,
433
+ class: $(["border border-primary-stroke px-3 w-full placeholder-gray-400", {
434
+ "border-danger-base": i(y),
314
435
  "rounded-3xl": e.rounded,
315
436
  "rounded-md": !e.rounded,
316
437
  "text-lg": e.large,
317
438
  "py-2.5": e.large,
318
- "py-2": !e.large
439
+ "py-2": !e.large,
440
+ "resize-none": e.resize === "none",
441
+ "resize-both": e.resize === "both",
442
+ "resize-x": e.resize === "horizontal",
443
+ "resize-y": e.resize === "vertical"
319
444
  }]),
320
- placeholder: e.placeholder,
321
- disabled: e.disabled,
322
- readonly: e.readonly,
323
445
  ref_key: "inputElement",
324
- ref: c
325
- }, null, 42, ne)) : e.type === "checkbox" ? (l(), t("div", se, [
326
- m("input", {
446
+ ref: u
447
+ }, null, 42, ce)) : e.type === "checkbox" ? (a(), t("div", ye, [
448
+ c("input", {
327
449
  type: e.type,
328
- name: e.name || d(y),
329
- id: h.value,
450
+ name: e.name || i(f),
451
+ id: b.value,
330
452
  value: !0,
331
- onInput: V,
332
453
  disabled: e.disabled,
333
454
  readonly: e.readonly,
334
- class: k(["rounded-md border border-primary-stroke px-2 py-2 shadow-sm", {
335
- "border-danger-base": d(f) || e.invalid
336
- }]),
455
+ tabindex: e.tabindex,
456
+ "aria-label": e.ariaLabel,
457
+ "aria-describedby": e.ariaDescribedby,
337
458
  checked: e.modelValue === !0,
459
+ onInput: k,
460
+ onFocus: w,
461
+ onBlur: q,
462
+ onChange: F,
463
+ class: $(["rounded-md border border-primary-stroke px-2 py-2 shadow-sm", {
464
+ "border-danger-base": i(y) || e.invalid
465
+ }]),
338
466
  ref_key: "inputElement",
339
- ref: c
340
- }, null, 42, de),
341
- m("label", {
342
- for: h.value,
467
+ ref: u
468
+ }, null, 42, fe),
469
+ c("label", {
470
+ for: b.value,
343
471
  class: "text-primary-content select-none"
344
- }, v(e.placeholder), 9, ie)
345
- ])) : e.type === "radio" ? (l(), t("div", ue, [
346
- (l(!0), t(C, null, B(e.options, (p, E) => (l(), t("div", {
472
+ }, h(e.placeholder), 9, be)
473
+ ])) : e.type === "radio" ? (a(), t("div", he, [
474
+ (a(!0), t(O, null, I(e.options, (p, A) => (a(), t("div", {
347
475
  key: p.key,
348
476
  class: "flex w-full space-x-3 items-center"
349
477
  }, [
350
- m("input", {
478
+ c("input", {
351
479
  type: "radio",
352
- name: e.name || d(y),
353
- id: `${h.value}-${E}`,
480
+ name: e.name || i(f),
481
+ id: `${b.value}-${A}`,
354
482
  value: p.key,
355
- onInput: V,
356
483
  disabled: e.disabled,
357
484
  readonly: e.readonly,
358
- class: k(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm", {
359
- "border-danger-base": d(f) || e.invalid
360
- }]),
485
+ tabindex: e.tabindex,
361
486
  checked: p.key === e.modelValue,
487
+ onInput: k,
488
+ onFocus: w,
489
+ onBlur: q,
490
+ onChange: F,
491
+ class: $(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm", {
492
+ "border-danger-base": i(y) || e.invalid
493
+ }]),
362
494
  ref_for: !0,
363
495
  ref_key: "inputElement",
364
- ref: c
365
- }, null, 42, pe),
366
- m("label", {
367
- for: `${h.value}-${E}`,
496
+ ref: u
497
+ }, null, 42, ve),
498
+ c("label", {
499
+ for: `${b.value}-${A}`,
368
500
  class: "text-primary-content select-none"
369
- }, v(p.value), 9, me)
501
+ }, h(p.value), 9, ge)
370
502
  ]))), 128))
371
- ])) : (l(), t("div", ce, [
372
- m("div", fe, [
373
- e.icon ? (l(), g(G(e.icon), {
503
+ ])) : (a(), t("div", ke, [
504
+ c("div", we, [
505
+ e.icon ? (a(), B(X(e.icon), {
374
506
  key: 0,
375
507
  class: "w-5 h-5 text-primary-content"
376
- })) : b("", !0)
508
+ })) : v("", !0)
377
509
  ]),
378
- m("input", {
379
- type: $.value ? "text" : e.type,
380
- name: e.name || d(y),
381
- id: h.value,
510
+ c("input", {
511
+ type: g.value ? "text" : e.type,
512
+ name: e.name || i(f),
513
+ id: b.value,
382
514
  value: e.modelValue,
383
- onInput: V,
384
515
  placeholder: e.placeholder,
385
516
  disabled: e.disabled,
386
517
  readonly: e.readonly,
387
- class: k(["border border-primary-stroke w-full px-3 placeholder-gray-400 disabled:bg-gray-50", P.value]),
518
+ maxlength: e.maxlength,
519
+ minlength: e.minlength,
520
+ min: e.min,
521
+ max: e.max,
522
+ step: e.step,
523
+ pattern: e.pattern,
524
+ spellcheck: e.spellcheck,
525
+ inputmode: e.inputmode,
526
+ tabindex: e.tabindex,
527
+ autocomplete: e.autocomplete,
528
+ "aria-label": e.ariaLabel,
529
+ "aria-describedby": e.ariaDescribedby,
530
+ onInput: k,
531
+ onFocus: w,
532
+ onBlur: q,
533
+ onChange: F,
534
+ onKeydown: N,
535
+ onKeyup: z,
536
+ onKeypress: E,
537
+ class: $(["border border-primary-stroke w-full px-3 placeholder-gray-400 disabled:bg-gray-50", Q.value]),
388
538
  ref_key: "inputElement",
389
- ref: c,
390
- autocomplete: e.autocomplete
391
- }, null, 42, ye),
392
- e.clearable && A.value ? (l(), t("div", {
539
+ ref: u
540
+ }, null, 42, qe),
541
+ e.clearable && G.value ? (a(), t("div", {
393
542
  key: 0,
394
- onClick: L,
543
+ onClick: H,
395
544
  class: "absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"
396
545
  }, [
397
- j(d(J), { class: "w-5 h-5 text-secondary-content hover:text-primary-base" })
398
- ])) : e.type === "password" ? (l(), t("div", {
546
+ K(i(Z), { class: "w-5 h-5 text-secondary-content hover:text-primary-base" })
547
+ ])) : e.type === "password" ? (a(), t("div", {
399
548
  key: 1,
400
- onClick: q[0] || (q[0] = (p) => $.value = !$.value),
549
+ onClick: J,
401
550
  class: "absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"
402
551
  }, [
403
- $.value ? (l(), g(d(le), {
552
+ g.value ? (a(), B(i(ie), {
404
553
  key: 0,
405
554
  class: "w-5 h-5 text-primary-content hover:text-primary-base"
406
- })) : (l(), g(d(re), {
555
+ })) : (a(), B(i(de), {
407
556
  key: 1,
408
557
  class: "w-5 h-5 text-secondary-content hover:text-primary-base"
409
558
  }))
410
- ])) : b("", !0)
559
+ ])) : v("", !0)
411
560
  ]));
412
561
  }
413
- }), ve = { class: "space-y-1" }, be = {
562
+ }), Se = { class: "space-y-1" }, $e = {
414
563
  key: 2,
415
564
  class: "text-xs text-secondary-content select-none"
416
- }, Fe = /* @__PURE__ */ F({
565
+ }, Ne = /* @__PURE__ */ V({
417
566
  __name: "OneFormField",
418
- props: Q,
419
- setup(u) {
420
- const a = u, { formId: s, validation: r } = N(), i = n(() => a.errors != null && a.errors.length > 0 ? !0 : a.name == null ? !1 : (r.value ?? {})[a.name] != null);
421
- return _("BaseFormField", {
422
- inputId: n(() => {
423
- const o = s.value || "form";
424
- if (a.id != null)
425
- return `${o}-${a.id}`;
426
- if (a.name != null)
427
- return `${o}-field-${a.name}`;
567
+ props: _,
568
+ setup(m) {
569
+ const l = m, { formId: d, validation: r } = T(), n = s(() => l.errors != null && l.errors.length > 0 ? !0 : l.name == null ? !1 : (r.value ?? {})[l.name] != null);
570
+ return D("BaseFormField", {
571
+ inputId: s(() => {
572
+ const o = d.value || "form";
573
+ if (l.id != null)
574
+ return `${o}-${l.id}`;
575
+ if (l.name != null)
576
+ return `${o}-field-${l.name}`;
428
577
  }),
429
- inputName: n(() => a.name),
430
- hasError: i
431
- }), (o, y) => (l(), t("div", ve, [
432
- o.label ? (l(), g(Z, {
578
+ inputName: s(() => l.name),
579
+ hasError: n
580
+ }), (o, f) => (a(), t("div", Se, [
581
+ o.label ? (a(), B(te, {
433
582
  key: 0,
434
583
  label: o.label
435
584
  }, {
436
- right: H(() => [
437
- w(o.$slots, "right")
585
+ right: Y(() => [
586
+ C(o.$slots, "right")
438
587
  ]),
439
588
  _: 3
440
- }, 8, ["label"])) : b("", !0),
441
- w(o.$slots, "default", {}, () => [
442
- j(he)
589
+ }, 8, ["label"])) : v("", !0),
590
+ C(o.$slots, "default", {}, () => [
591
+ K(Fe)
443
592
  ]),
444
- i.value ? (l(), g(ee, {
593
+ n.value ? (a(), B(se, {
445
594
  key: 1,
446
595
  errors: o.errors
447
- }, null, 8, ["errors"])) : o.hint.length > 0 ? (l(), t("p", be, v(o.hint), 1)) : b("", !0)
596
+ }, null, 8, ["errors"])) : o.hint.length > 0 ? (a(), t("p", $e, h(o.hint), 1)) : v("", !0)
448
597
  ]));
449
598
  }
450
599
  });
451
600
  export {
452
- we as OneForm,
453
- ee as OneFormFeedback,
454
- Fe as OneFormField,
455
- he as OneFormInput,
456
- Z as OneFormLabel
601
+ Ve as OneForm,
602
+ se as OneFormFeedback,
603
+ Ne as OneFormField,
604
+ Fe as OneFormInput,
605
+ te as OneFormLabel
457
606
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneb/ui-vue",
3
- "version": "0.2.9",
3
+ "version": "0.2.13",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -8,6 +8,79 @@
8
8
  ],
9
9
  "module": "./dist/index.js",
10
10
  "types": "./dist/index.d.ts",
11
+ "typesVersions": {
12
+ "*": {
13
+ "icons/outline": [
14
+ "./dist/icons/outline/esm/index.d.ts"
15
+ ],
16
+ "icons/*": [
17
+ "./dist/icons/outline/esm/*.d.ts"
18
+ ],
19
+ "card": [
20
+ "./dist/card/index.d.ts"
21
+ ],
22
+ "button": [
23
+ "./dist/button/index.d.ts"
24
+ ],
25
+ "buttonGroup": [
26
+ "./dist/buttonGroup/index.d.ts"
27
+ ],
28
+ "form": [
29
+ "./dist/form/index.d.ts"
30
+ ],
31
+ "dropdown": [
32
+ "./dist/dropdown/index.d.ts"
33
+ ],
34
+ "common": [
35
+ "./dist/common/index.d.ts"
36
+ ],
37
+ "layout": [
38
+ "./dist/layout/index.d.ts"
39
+ ],
40
+ "checkbox": [
41
+ "./dist/checkbox/index.d.ts"
42
+ ],
43
+ "collapse": [
44
+ "./dist/collapse/index.d.ts"
45
+ ],
46
+ "errorsPage": [
47
+ "./dist/errorsPage/index.d.ts"
48
+ ],
49
+ "indicators": [
50
+ "./dist/indicators/index.d.ts"
51
+ ],
52
+ "infobox": [
53
+ "./dist/infobox/index.d.ts"
54
+ ],
55
+ "label": [
56
+ "./dist/label/index.d.ts"
57
+ ],
58
+ "modal": [
59
+ "./dist/modal/index.d.ts"
60
+ ],
61
+ "radio": [
62
+ "./dist/radio/index.d.ts"
63
+ ],
64
+ "skeleton": [
65
+ "./dist/skeleton/index.d.ts"
66
+ ],
67
+ "switch": [
68
+ "./dist/switch/index.d.ts"
69
+ ],
70
+ "toast": [
71
+ "./dist/toast/index.d.ts"
72
+ ],
73
+ "tooltip": [
74
+ "./dist/tooltip/index.d.ts"
75
+ ],
76
+ "periodPicker": [
77
+ "./dist/periodPicker/index.d.ts"
78
+ ],
79
+ "tailwind.config": [
80
+ "./dist/tailwind.config.d.ts"
81
+ ]
82
+ }
83
+ },
11
84
  "exports": {
12
85
  ".": {
13
86
  "import": "./dist/index.js",