numori-ui 0.1.0

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.
Files changed (130) hide show
  1. package/LICENSE +651 -0
  2. package/README.md +466 -0
  3. package/dist/components/Alert.js +137 -0
  4. package/dist/components/Alert.js.map +1 -0
  5. package/dist/components/Avatar.js +133 -0
  6. package/dist/components/Avatar.js.map +1 -0
  7. package/dist/components/Badge.js +93 -0
  8. package/dist/components/Badge.js.map +1 -0
  9. package/dist/components/Button.js +428 -0
  10. package/dist/components/Button.js.map +1 -0
  11. package/dist/components/ButtonsGroup.js +153 -0
  12. package/dist/components/ButtonsGroup.js.map +1 -0
  13. package/dist/components/Checkbox.js +93 -0
  14. package/dist/components/Checkbox.js.map +1 -0
  15. package/dist/components/Divider.js +79 -0
  16. package/dist/components/Divider.js.map +1 -0
  17. package/dist/components/Dropdown.js +166 -0
  18. package/dist/components/Dropdown.js.map +1 -0
  19. package/dist/components/DropdownItem.js +106 -0
  20. package/dist/components/DropdownItem.js.map +1 -0
  21. package/dist/components/DropdownRow.js +41 -0
  22. package/dist/components/DropdownRow.js.map +1 -0
  23. package/dist/components/DropdownSubmenu.js +142 -0
  24. package/dist/components/DropdownSubmenu.js.map +1 -0
  25. package/dist/components/FileInput.js +122 -0
  26. package/dist/components/FileInput.js.map +1 -0
  27. package/dist/components/FormField.js +112 -0
  28. package/dist/components/FormField.js.map +1 -0
  29. package/dist/components/Input.js +603 -0
  30. package/dist/components/Input.js.map +1 -0
  31. package/dist/components/Kbd.js +35 -0
  32. package/dist/components/Kbd.js.map +1 -0
  33. package/dist/components/ListMenu.js +143 -0
  34. package/dist/components/ListMenu.js.map +1 -0
  35. package/dist/components/ListMenuItem.js +189 -0
  36. package/dist/components/ListMenuItem.js.map +1 -0
  37. package/dist/components/Modal.js +206 -0
  38. package/dist/components/Modal.js.map +1 -0
  39. package/dist/components/Numpad.js +123 -0
  40. package/dist/components/Numpad.js.map +1 -0
  41. package/dist/components/Popup.js +170 -0
  42. package/dist/components/Popup.js.map +1 -0
  43. package/dist/components/ProgressBar.js +118 -0
  44. package/dist/components/ProgressBar.js.map +1 -0
  45. package/dist/components/Prompt.js +201 -0
  46. package/dist/components/Prompt.js.map +1 -0
  47. package/dist/components/Radio.js +81 -0
  48. package/dist/components/Radio.js.map +1 -0
  49. package/dist/components/Select.js +441 -0
  50. package/dist/components/Select.js.map +1 -0
  51. package/dist/components/Slider.js +116 -0
  52. package/dist/components/Slider.js.map +1 -0
  53. package/dist/components/Stepper.js +65 -0
  54. package/dist/components/Stepper.js.map +1 -0
  55. package/dist/components/Toggle.js +133 -0
  56. package/dist/components/Toggle.js.map +1 -0
  57. package/dist/components/Tooltip.js +120 -0
  58. package/dist/components/Tooltip.js.map +1 -0
  59. package/dist/components/index.js +81 -0
  60. package/dist/components/index.js.map +1 -0
  61. package/dist/composables/onClickOutside.js +51 -0
  62. package/dist/composables/onClickOutside.js.map +1 -0
  63. package/dist/composables/useBackButton.js +98 -0
  64. package/dist/composables/useBackButton.js.map +1 -0
  65. package/dist/composables/useEventListener.js +63 -0
  66. package/dist/composables/useEventListener.js.map +1 -0
  67. package/dist/icons/Icon.js +120 -0
  68. package/dist/icons/Icon.js.map +1 -0
  69. package/dist/icons/mdi.js +69 -0
  70. package/dist/icons/mdi.js.map +1 -0
  71. package/dist/icons/registry.js +63 -0
  72. package/dist/icons/registry.js.map +1 -0
  73. package/dist/icons/resolver.js +49 -0
  74. package/dist/icons/resolver.js.map +1 -0
  75. package/dist/index.d.ts +108 -0
  76. package/dist/index.js +157 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/manifest.js +89 -0
  79. package/dist/manifest.js.map +1 -0
  80. package/dist/numori-ui.css +184 -0
  81. package/dist/nuxt.d.ts +35 -0
  82. package/dist/nuxt.mjs +243 -0
  83. package/dist/nuxt.mjs.map +1 -0
  84. package/dist/vite.d.ts +29 -0
  85. package/dist/vite.mjs +187 -0
  86. package/dist/vite.mjs.map +1 -0
  87. package/package.json +138 -0
  88. package/src/components/Alert.vue +127 -0
  89. package/src/components/Avatar.vue +100 -0
  90. package/src/components/Badge.vue +77 -0
  91. package/src/components/Button.vue +419 -0
  92. package/src/components/ButtonsGroup.vue +140 -0
  93. package/src/components/Checkbox.vue +81 -0
  94. package/src/components/Divider.vue +64 -0
  95. package/src/components/Dropdown.vue +150 -0
  96. package/src/components/DropdownItem.vue +78 -0
  97. package/src/components/DropdownRow.vue +37 -0
  98. package/src/components/DropdownSubmenu.vue +127 -0
  99. package/src/components/FileInput.vue +107 -0
  100. package/src/components/FormField.vue +86 -0
  101. package/src/components/Input.vue +619 -0
  102. package/src/components/Kbd.vue +30 -0
  103. package/src/components/ListMenu.vue +127 -0
  104. package/src/components/ListMenuItem.vue +171 -0
  105. package/src/components/Modal.vue +209 -0
  106. package/src/components/Numpad.vue +118 -0
  107. package/src/components/Popup.vue +156 -0
  108. package/src/components/ProgressBar.vue +107 -0
  109. package/src/components/Prompt.vue +161 -0
  110. package/src/components/Radio.vue +50 -0
  111. package/src/components/Select.vue +470 -0
  112. package/src/components/Slider.vue +93 -0
  113. package/src/components/Stepper.vue +53 -0
  114. package/src/components/Toggle.vue +125 -0
  115. package/src/components/Tooltip.vue +113 -0
  116. package/src/components/index.js +109 -0
  117. package/src/composables/onClickOutside.js +61 -0
  118. package/src/composables/useBackButton.js +98 -0
  119. package/src/composables/useEventListener.js +65 -0
  120. package/src/icons/Icon.vue +139 -0
  121. package/src/icons/mdi.js +67 -0
  122. package/src/icons/registry.js +64 -0
  123. package/src/icons/resolver.js +48 -0
  124. package/src/index.js +167 -0
  125. package/src/manifest.js +86 -0
  126. package/src/nuxt.js +315 -0
  127. package/src/style.css +20 -0
  128. package/src/tailwind.css +18 -0
  129. package/src/theme.css +172 -0
  130. package/src/vite.js +235 -0
@@ -0,0 +1,603 @@
1
+ import _sfc_main$1 from "../icons/Icon.js";
2
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, normalizeClass, normalizeStyle, openBlock, ref, renderSlot, toDisplayString, useSlots, watch, withModifiers } from "vue";
3
+ //#region src/components/Input.vue
4
+ var _hoisted_1 = { class: "w-full" };
5
+ var _hoisted_2 = { class: "relative flex" };
6
+ var _hoisted_3 = [
7
+ "value",
8
+ "placeholder",
9
+ "required",
10
+ "disabled",
11
+ "readonly",
12
+ "rows",
13
+ "maxlength"
14
+ ];
15
+ var _hoisted_4 = {
16
+ key: 3,
17
+ class: "absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-gray-400 dark:text-gray-500"
18
+ };
19
+ var _hoisted_5 = [
20
+ "type",
21
+ "value",
22
+ "placeholder",
23
+ "required",
24
+ "disabled",
25
+ "readonly",
26
+ "autocomplete",
27
+ "minlength",
28
+ "maxlength",
29
+ "inputmode",
30
+ "min",
31
+ "max",
32
+ "step",
33
+ "pattern"
34
+ ];
35
+ var _hoisted_6 = {
36
+ key: 5,
37
+ class: "absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-500"
38
+ };
39
+ var _hoisted_7 = ["aria-label"];
40
+ var _hoisted_8 = {
41
+ key: 0,
42
+ class: "text-xs text-red-600 dark:text-red-400 mt-1"
43
+ };
44
+ var _sfc_main = {
45
+ __name: "Input",
46
+ props: {
47
+ /**
48
+ * Bound value (v-model).
49
+ * @type {string | number}
50
+ * @default ''
51
+ */
52
+ modelValue: {
53
+ type: [String, Number],
54
+ default: ""
55
+ },
56
+ /**
57
+ * Input type determining the mode and behavior.
58
+ * @type {string}
59
+ * @default 'text'
60
+ * @values 'text' | 'number' | 'password' | 'email' | 'phone' | 'textarea'
61
+ */
62
+ type: {
63
+ type: String,
64
+ default: "text"
65
+ },
66
+ /**
67
+ * Placeholder text shown when the input is empty.
68
+ * @type {string}
69
+ * @default ''
70
+ */
71
+ placeholder: {
72
+ type: String,
73
+ default: ""
74
+ },
75
+ /**
76
+ * Whether the field is required for form validation.
77
+ * @type {boolean}
78
+ * @default false
79
+ */
80
+ required: {
81
+ type: Boolean,
82
+ default: false
83
+ },
84
+ /**
85
+ * Disabled state — dims the input and prevents interaction.
86
+ * @type {boolean}
87
+ * @default false
88
+ */
89
+ disabled: {
90
+ type: Boolean,
91
+ default: false
92
+ },
93
+ /**
94
+ * Read-only state — allows focus/selection but prevents editing.
95
+ * @type {boolean}
96
+ * @default false
97
+ */
98
+ readonly: {
99
+ type: Boolean,
100
+ default: false
101
+ },
102
+ /**
103
+ * HTML autocomplete attribute hint for the browser.
104
+ * @type {string}
105
+ * @default undefined
106
+ */
107
+ autocomplete: {
108
+ type: String,
109
+ default: void 0
110
+ },
111
+ /**
112
+ * Minimum character length for text validation.
113
+ * @type {number}
114
+ * @default undefined
115
+ */
116
+ minlength: {
117
+ type: Number,
118
+ default: void 0
119
+ },
120
+ /**
121
+ * Maximum character length for text validation.
122
+ * @type {number}
123
+ * @default undefined
124
+ */
125
+ maxlength: {
126
+ type: Number,
127
+ default: void 0
128
+ },
129
+ /**
130
+ * Number of visible text rows (textarea mode only).
131
+ * @type {number}
132
+ * @default 3
133
+ */
134
+ rows: {
135
+ type: Number,
136
+ default: 3
137
+ },
138
+ /**
139
+ * Resize behavior for textarea mode.
140
+ * @type {string}
141
+ * @default 'none'
142
+ * @values 'none' | 'vertical' | 'horizontal' | 'both'
143
+ */
144
+ resize: {
145
+ type: String,
146
+ default: "none"
147
+ },
148
+ /**
149
+ * Minimum height CSS value for textarea (e.g. '80px', '5rem').
150
+ * @type {string}
151
+ * @default undefined
152
+ */
153
+ minHeight: {
154
+ type: String,
155
+ default: void 0
156
+ },
157
+ /**
158
+ * Maximum height CSS value for textarea (e.g. '300px', '20rem').
159
+ * @type {string}
160
+ * @default undefined
161
+ */
162
+ maxHeight: {
163
+ type: String,
164
+ default: void 0
165
+ },
166
+ /**
167
+ * Minimum width CSS value for textarea (e.g. '200px').
168
+ * @type {string}
169
+ * @default undefined
170
+ */
171
+ minWidth: {
172
+ type: String,
173
+ default: void 0
174
+ },
175
+ /**
176
+ * Maximum width CSS value for textarea (e.g. '600px').
177
+ * @type {string}
178
+ * @default undefined
179
+ */
180
+ maxWidth: {
181
+ type: String,
182
+ default: void 0
183
+ },
184
+ /**
185
+ * HTML pattern attribute for native form validation.
186
+ * @type {string}
187
+ * @default undefined
188
+ */
189
+ pattern: {
190
+ type: String,
191
+ default: void 0
192
+ },
193
+ /**
194
+ * Show the password visibility toggle button (password mode only).
195
+ * @type {boolean}
196
+ * @default true
197
+ */
198
+ showToggle: {
199
+ type: Boolean,
200
+ default: true
201
+ },
202
+ /**
203
+ * Minimum allowed numeric value.
204
+ * @type {number}
205
+ * @default undefined
206
+ */
207
+ min: {
208
+ type: Number,
209
+ default: void 0
210
+ },
211
+ /**
212
+ * Maximum allowed numeric value.
213
+ * @type {number}
214
+ * @default undefined
215
+ */
216
+ max: {
217
+ type: Number,
218
+ default: void 0
219
+ },
220
+ /**
221
+ * Step increment for number stepper buttons.
222
+ * @type {number}
223
+ * @default 1
224
+ */
225
+ step: {
226
+ type: Number,
227
+ default: 1
228
+ },
229
+ /**
230
+ * Layout of the +/- stepper buttons for number inputs.
231
+ * @type {string}
232
+ * @default 'both-sides'
233
+ * @values 'stacked-left' | 'stacked-right' | 'both-sides' | 'none'
234
+ */
235
+ stepperLayout: {
236
+ type: String,
237
+ default: "both-sides"
238
+ },
239
+ /**
240
+ * Show a clear button when the input has a value.
241
+ * @type {boolean}
242
+ * @default false
243
+ */
244
+ clearable: {
245
+ type: Boolean,
246
+ default: false
247
+ },
248
+ /**
249
+ * Icon name to display on the left side of the input.
250
+ * @type {string}
251
+ * @default undefined
252
+ */
253
+ iconLeft: {
254
+ type: String,
255
+ default: void 0
256
+ },
257
+ /**
258
+ * Icon name to display on the right side of the input.
259
+ * @type {string}
260
+ * @default undefined
261
+ */
262
+ iconRight: {
263
+ type: String,
264
+ default: void 0
265
+ },
266
+ /**
267
+ * Enable built-in validation feedback shown below the input on blur.
268
+ * @type {boolean}
269
+ * @default true
270
+ */
271
+ validate: {
272
+ type: Boolean,
273
+ default: true
274
+ },
275
+ /**
276
+ * Custom regex pattern string — overrides built-in type-based patterns.
277
+ * @type {string}
278
+ * @default undefined
279
+ */
280
+ validationPattern: {
281
+ type: String,
282
+ default: void 0
283
+ },
284
+ /**
285
+ * Custom error message shown when validation fails.
286
+ * @type {string}
287
+ * @default undefined
288
+ */
289
+ validationMessage: {
290
+ type: String,
291
+ default: void 0
292
+ }
293
+ },
294
+ emits: ["update:modelValue", "validation"],
295
+ setup(__props, { expose: __expose, emit: __emit }) {
296
+ /**
297
+ * UiInput — Multi-purpose input component supporting text, number, password, email,
298
+ * phone, and textarea modes in a single unified interface.
299
+ *
300
+ * Features:
301
+ * - Number mode with configurable stepper layouts (both-sides, stacked-left, stacked-right, none)
302
+ * - Password mode with show/hide toggle
303
+ * - Textarea mode with configurable resize, min/max dimensions
304
+ * - Built-in validation for email, phone, and number patterns
305
+ * - Custom regex validation with configurable error messages
306
+ * - Exposes `focus()` method and `el` ref for parent control
307
+ *
308
+ * @example Basic text input
309
+ * <UiInput v-model="name" placeholder="Enter your name" />
310
+ *
311
+ * @example Number input with min/max
312
+ * <UiInput v-model="quantity" type="number" :min="0" :max="100" :step="1" />
313
+ *
314
+ * @example Password with toggle
315
+ * <UiInput v-model="password" type="password" />
316
+ *
317
+ * @example Textarea
318
+ * <UiInput v-model="bio" type="textarea" :rows="5" resize="vertical" />
319
+ *
320
+ * @example Email with validation
321
+ * <UiInput v-model="email" type="email" :validate="true" />
322
+ *
323
+ * @emits {string | number} update:modelValue — Emitted when the input value changes (v-model)
324
+ * @emits {{ valid: boolean, error: string | null }} validation — Emitted when the validation state changes
325
+ */
326
+ const props = __props;
327
+ const emit = __emit;
328
+ const inputRef = ref(null);
329
+ const passwordVisible = ref(false);
330
+ const touched = ref(false);
331
+ const isPassword = computed(() => props.type === "password");
332
+ const isNumber = computed(() => props.type === "number");
333
+ const isTextarea = computed(() => props.type === "textarea");
334
+ const resizeClass = computed(() => {
335
+ return {
336
+ none: "resize-none",
337
+ vertical: "resize-y",
338
+ horizontal: "resize-x",
339
+ both: "resize"
340
+ }[props.resize] || "resize-none";
341
+ });
342
+ const textareaStyle = computed(() => {
343
+ const s = {};
344
+ if (props.minHeight) s.minHeight = props.minHeight;
345
+ if (props.maxHeight) s.maxHeight = props.maxHeight;
346
+ if (props.minWidth) s.minWidth = props.minWidth;
347
+ if (props.maxWidth) s.maxWidth = props.maxWidth;
348
+ return s;
349
+ });
350
+ const computedType = computed(() => {
351
+ if (isPassword.value) return passwordVisible.value ? "text" : "password";
352
+ if (isNumber.value) return "text";
353
+ if (props.type === "phone") return "tel";
354
+ return props.type;
355
+ });
356
+ const computedInputMode = computed(() => {
357
+ if (isNumber.value) return "decimal";
358
+ if (props.type === "phone") return "tel";
359
+ if (props.type === "email") return "email";
360
+ });
361
+ const hasStepper = computed(() => isNumber.value && props.stepperLayout !== "none");
362
+ const slots = useSlots();
363
+ const hasLeftIcon = computed(() => !!props.iconLeft || !!slots.left);
364
+ const hasRightIcon = computed(() => !!props.iconRight || !!slots.right);
365
+ const inputClasses = computed(() => {
366
+ const classes = [];
367
+ if (hasStepper.value) classes.push("px-1.5");
368
+ else {
369
+ classes.push(hasLeftIcon.value ? "pl-9" : "pl-3");
370
+ classes.push(hasRightIcon.value ? "pr-9" : "pr-3");
371
+ }
372
+ if (hasStepper.value) {
373
+ if (props.stepperLayout === "both-sides") classes.push("rounded-none");
374
+ else if (props.stepperLayout === "stacked-left") classes.push("rounded-l-none", "rounded-r-lg");
375
+ else if (props.stepperLayout === "stacked-right") classes.push("rounded-r-none", "rounded-l-lg");
376
+ } else classes.push("rounded-lg");
377
+ if (isPassword.value && props.showToggle) classes.push("pr-10");
378
+ if (props.clearable) classes.push("pr-8");
379
+ if (isNumber.value && hasStepper.value) classes.push("text-center");
380
+ return classes;
381
+ });
382
+ const PATTERNS = {
383
+ email: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
384
+ phone: /^\+?[\d\s\-().]{7,}$/,
385
+ number: /^-?\d*\.?\d+$/
386
+ };
387
+ const MESSAGES = {
388
+ email: "Please enter a valid email address",
389
+ phone: "Please enter a valid phone number",
390
+ number: "Please enter a valid number"
391
+ };
392
+ const validationError = computed(() => {
393
+ const val = String(props.modelValue ?? "");
394
+ if (!val) return null;
395
+ if (props.validationPattern) {
396
+ if (!new RegExp(props.validationPattern).test(val)) return props.validationMessage || "Invalid format";
397
+ }
398
+ const builtIn = PATTERNS[props.type];
399
+ if (builtIn && !builtIn.test(val)) return props.validationMessage || MESSAGES[props.type] || "Invalid input";
400
+ return null;
401
+ });
402
+ const showError = computed(() => props.validate && touched.value);
403
+ watch(validationError, (err) => {
404
+ emit("validation", {
405
+ valid: !err,
406
+ error: err
407
+ });
408
+ });
409
+ const NUMBER_ALLOWED = /^-?\d*\.?\d*$/;
410
+ function onInput(e) {
411
+ const val = e.target.value;
412
+ if (isNumber.value) {
413
+ if (!NUMBER_ALLOWED.test(val)) {
414
+ e.target.value = String(props.modelValue ?? "");
415
+ return;
416
+ }
417
+ }
418
+ emit("update:modelValue", isNumber.value && val !== "" && val !== "-" && val !== "." && val !== "-." ? Number(val) : val);
419
+ }
420
+ function onBlur() {
421
+ touched.value = true;
422
+ }
423
+ function onKeydown(e) {
424
+ if (!isNumber.value) return;
425
+ if ([
426
+ "Backspace",
427
+ "Delete",
428
+ "Tab",
429
+ "Escape",
430
+ "Enter",
431
+ "ArrowLeft",
432
+ "ArrowRight",
433
+ "Home",
434
+ "End"
435
+ ].includes(e.key)) return;
436
+ if (e.key === "." && !String(props.modelValue).includes(".")) return;
437
+ if (e.key === "-" && e.target.selectionStart === 0 && !String(props.modelValue).includes("-")) return;
438
+ if (e.ctrlKey || e.metaKey) return;
439
+ if (!/^\d$/.test(e.key)) e.preventDefault();
440
+ }
441
+ function stepUp() {
442
+ let next = (Number(props.modelValue) || 0) + (props.step ?? 1);
443
+ if (props.max !== void 0) next = Math.min(next, props.max);
444
+ emit("update:modelValue", next);
445
+ }
446
+ function stepDown() {
447
+ let next = (Number(props.modelValue) || 0) - (props.step ?? 1);
448
+ if (props.min !== void 0) next = Math.max(next, props.min);
449
+ emit("update:modelValue", next);
450
+ }
451
+ __expose({
452
+ focus: () => inputRef.value?.focus(),
453
+ el: inputRef
454
+ });
455
+ return (_ctx, _cache) => {
456
+ return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [
457
+ isNumber.value && __props.stepperLayout === "both-sides" ? (openBlock(), createElementBlock("button", {
458
+ key: 0,
459
+ type: "button",
460
+ tabindex: "-1",
461
+ class: normalizeClass(["flex items-center justify-center w-9 rounded-l-lg border border-r-0 border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none", { "opacity-50 pointer-events-none": __props.disabled }]),
462
+ "aria-label": "Decrease value",
463
+ onClick: stepDown
464
+ }, [createVNode(_sfc_main$1, {
465
+ name: "mdi:minus",
466
+ class: "w-4 h-4"
467
+ })], 2)) : createCommentVNode("", true),
468
+ isNumber.value && __props.stepperLayout === "stacked-left" ? (openBlock(), createElementBlock("div", {
469
+ key: 1,
470
+ class: normalizeClass(["flex flex-col w-6 border border-r-0 border-gray-300 dark:border-gray-600 rounded-l-lg overflow-hidden", { "opacity-50 pointer-events-none": __props.disabled }])
471
+ }, [createElementVNode("button", {
472
+ type: "button",
473
+ tabindex: "-1",
474
+ class: "grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600",
475
+ "aria-label": "Increase value",
476
+ onClick: stepUp
477
+ }, [createVNode(_sfc_main$1, {
478
+ name: "mdi:chevron-up",
479
+ class: "block w-3 h-3"
480
+ })]), createElementVNode("button", {
481
+ type: "button",
482
+ tabindex: "-1",
483
+ class: "grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none",
484
+ "aria-label": "Decrease value",
485
+ onClick: stepDown
486
+ }, [createVNode(_sfc_main$1, {
487
+ name: "mdi:chevron-down",
488
+ class: "block w-3 h-3"
489
+ })])], 2)) : createCommentVNode("", true),
490
+ isTextarea.value ? (openBlock(), createElementBlock("textarea", {
491
+ key: 2,
492
+ ref_key: "inputRef",
493
+ ref: inputRef,
494
+ value: __props.modelValue,
495
+ placeholder: __props.placeholder,
496
+ required: __props.required,
497
+ disabled: __props.disabled,
498
+ readonly: __props.readonly,
499
+ rows: __props.rows,
500
+ maxlength: __props.maxlength,
501
+ class: normalizeClass(["w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-400 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none text-sm transition-colors [scrollbar-width:thin] [scrollbar-color:var(--color-gray-300)_transparent] dark:[scrollbar-color:var(--color-gray-600)_transparent] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-thumb]:bg-gray-600 hover:[&::-webkit-scrollbar-thumb]:bg-gray-400 dark:hover:[&::-webkit-scrollbar-thumb]:bg-gray-500", resizeClass.value]),
502
+ style: normalizeStyle(textareaStyle.value),
503
+ onInput,
504
+ onBlur
505
+ }, null, 46, _hoisted_3)) : createCommentVNode("", true),
506
+ !isTextarea.value && (_ctx.$slots.left || __props.iconLeft) ? (openBlock(), createElementBlock("span", _hoisted_4, [renderSlot(_ctx.$slots, "left", {}, () => [__props.iconLeft ? (openBlock(), createBlock(_sfc_main$1, {
507
+ key: 0,
508
+ name: __props.iconLeft,
509
+ class: "w-4 h-4"
510
+ }, null, 8, ["name"])) : createCommentVNode("", true)])])) : createCommentVNode("", true),
511
+ !isTextarea.value ? (openBlock(), createElementBlock("input", {
512
+ key: 4,
513
+ ref_key: "inputRef",
514
+ ref: inputRef,
515
+ type: computedType.value,
516
+ value: __props.modelValue,
517
+ placeholder: __props.placeholder,
518
+ required: __props.required,
519
+ disabled: __props.disabled,
520
+ readonly: __props.readonly,
521
+ autocomplete: __props.autocomplete,
522
+ minlength: __props.minlength,
523
+ maxlength: __props.maxlength,
524
+ inputmode: computedInputMode.value,
525
+ min: __props.min,
526
+ max: __props.max,
527
+ step: __props.step,
528
+ pattern: __props.pattern,
529
+ class: normalizeClass(["w-full py-2 border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-400 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none text-sm transition-colors", inputClasses.value]),
530
+ onInput,
531
+ onBlur,
532
+ onKeydown
533
+ }, null, 42, _hoisted_5)) : createCommentVNode("", true),
534
+ !isTextarea.value && (_ctx.$slots.right || __props.iconRight) && !(__props.clearable && __props.modelValue) && !(isPassword.value && __props.showToggle) ? (openBlock(), createElementBlock("span", _hoisted_6, [renderSlot(_ctx.$slots, "right", {}, () => [__props.iconRight ? (openBlock(), createBlock(_sfc_main$1, {
535
+ key: 0,
536
+ name: __props.iconRight,
537
+ class: "w-4 h-4"
538
+ }, null, 8, ["name"])) : createCommentVNode("", true)])])) : createCommentVNode("", true),
539
+ __props.clearable && __props.modelValue ? (openBlock(), createElementBlock("button", {
540
+ key: 6,
541
+ type: "button",
542
+ tabindex: "-1",
543
+ class: "absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",
544
+ "aria-label": "Clear",
545
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"])),
546
+ onClick: _cache[1] || (_cache[1] = ($event) => emit("update:modelValue", ""))
547
+ }, [createVNode(_sfc_main$1, {
548
+ name: "mdi:close-circle",
549
+ class: "w-4 h-4"
550
+ })], 32)) : createCommentVNode("", true),
551
+ isPassword.value && __props.showToggle ? (openBlock(), createElementBlock("button", {
552
+ key: 7,
553
+ type: "button",
554
+ tabindex: "-1",
555
+ class: "absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",
556
+ "aria-label": passwordVisible.value ? "Hide password" : "Show password",
557
+ onMousedown: _cache[2] || (_cache[2] = withModifiers(() => {}, ["prevent"])),
558
+ onClick: _cache[3] || (_cache[3] = ($event) => passwordVisible.value = !passwordVisible.value)
559
+ }, [createVNode(_sfc_main$1, {
560
+ name: passwordVisible.value ? "mdi:eye-off-outline" : "mdi:eye-outline",
561
+ class: "w-4 h-4"
562
+ }, null, 8, ["name"])], 40, _hoisted_7)) : createCommentVNode("", true),
563
+ isNumber.value && __props.stepperLayout === "stacked-right" ? (openBlock(), createElementBlock("div", {
564
+ key: 8,
565
+ class: normalizeClass(["flex flex-col w-6 border border-l-0 border-gray-300 dark:border-gray-600 rounded-r-lg overflow-hidden", { "opacity-50 pointer-events-none": __props.disabled }])
566
+ }, [createElementVNode("button", {
567
+ type: "button",
568
+ tabindex: "-1",
569
+ class: "grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600",
570
+ "aria-label": "Increase value",
571
+ onClick: stepUp
572
+ }, [createVNode(_sfc_main$1, {
573
+ name: "mdi:chevron-up",
574
+ class: "block w-3 h-3"
575
+ })]), createElementVNode("button", {
576
+ type: "button",
577
+ tabindex: "-1",
578
+ class: "grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none",
579
+ "aria-label": "Decrease value",
580
+ onClick: stepDown
581
+ }, [createVNode(_sfc_main$1, {
582
+ name: "mdi:chevron-down",
583
+ class: "block w-3 h-3"
584
+ })])], 2)) : createCommentVNode("", true),
585
+ isNumber.value && __props.stepperLayout === "both-sides" ? (openBlock(), createElementBlock("button", {
586
+ key: 9,
587
+ type: "button",
588
+ tabindex: "-1",
589
+ class: normalizeClass(["flex items-center justify-center w-9 rounded-r-lg border border-l-0 border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none", { "opacity-50 pointer-events-none": __props.disabled }]),
590
+ "aria-label": "Increase value",
591
+ onClick: stepUp
592
+ }, [createVNode(_sfc_main$1, {
593
+ name: "mdi:plus",
594
+ class: "w-4 h-4"
595
+ })], 2)) : createCommentVNode("", true)
596
+ ]), showError.value && validationError.value ? (openBlock(), createElementBlock("p", _hoisted_8, toDisplayString(validationError.value), 1)) : createCommentVNode("", true)]);
597
+ };
598
+ }
599
+ };
600
+ //#endregion
601
+ export { _sfc_main as default };
602
+
603
+ //# sourceMappingURL=Input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.js","names":["$slots"],"sources":["../../src/components/Input.vue"],"sourcesContent":["<template>\n <div class=\"w-full\">\n <div class=\"relative flex\">\n <!-- Number stepper: minus button on left (both-sides layout) -->\n <button\n v-if=\"isNumber && stepperLayout === 'both-sides'\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"flex items-center justify-center w-9 rounded-l-lg border border-r-0 border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none\"\n :class=\"{ 'opacity-50 pointer-events-none': disabled }\"\n aria-label=\"Decrease value\"\n @click=\"stepDown\"\n >\n <UiIcon name=\"mdi:minus\" class=\"w-4 h-4\" />\n </button>\n\n <!-- Number stepper: stacked up/down buttons on left -->\n <div\n v-if=\"isNumber && stepperLayout === 'stacked-left'\"\n class=\"flex flex-col w-6 border border-r-0 border-gray-300 dark:border-gray-600 rounded-l-lg overflow-hidden\"\n :class=\"{ 'opacity-50 pointer-events-none': disabled }\"\n >\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600\"\n aria-label=\"Increase value\"\n @click=\"stepUp\"\n >\n <UiIcon name=\"mdi:chevron-up\" class=\"block w-3 h-3\" />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none\"\n aria-label=\"Decrease value\"\n @click=\"stepDown\"\n >\n <UiIcon name=\"mdi:chevron-down\" class=\"block w-3 h-3\" />\n </button>\n </div>\n\n <!-- Textarea mode: multi-line text input with custom scrollbar styling -->\n <textarea\n v-if=\"isTextarea\"\n ref=\"inputRef\"\n :value=\"modelValue\"\n :placeholder=\"placeholder\"\n :required=\"required\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :rows=\"rows\"\n :maxlength=\"maxlength\"\n class=\"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-400 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none text-sm transition-colors [scrollbar-width:thin] [scrollbar-color:var(--color-gray-300)_transparent] dark:[scrollbar-color:var(--color-gray-600)_transparent] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-thumb]:bg-gray-600 hover:[&::-webkit-scrollbar-thumb]:bg-gray-400 dark:hover:[&::-webkit-scrollbar-thumb]:bg-gray-500\"\n :class=\"resizeClass\"\n :style=\"textareaStyle\"\n @input=\"onInput\"\n @blur=\"onBlur\"\n />\n\n <!-- The actual input element (text, number, password, email, phone) -->\n <!-- Left icon/image slot -->\n <span\n v-if=\"!isTextarea && ($slots.left || iconLeft)\"\n class=\"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-gray-400 dark:text-gray-500\"\n >\n <slot name=\"left\">\n <UiIcon v-if=\"iconLeft\" :name=\"iconLeft\" class=\"w-4 h-4\" />\n </slot>\n </span>\n\n <input\n v-if=\"!isTextarea\"\n ref=\"inputRef\"\n :type=\"computedType\"\n :value=\"modelValue\"\n :placeholder=\"placeholder\"\n :required=\"required\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :minlength=\"minlength\"\n :maxlength=\"maxlength\"\n :inputmode=\"computedInputMode\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :pattern=\"pattern\"\n class=\"w-full py-2 border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-400 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none text-sm transition-colors\"\n :class=\"inputClasses\"\n @input=\"onInput\"\n @blur=\"onBlur\"\n @keydown=\"onKeydown\"\n />\n\n <!-- Right icon/image slot (hidden when clear button or password toggle is shown) -->\n <span\n v-if=\"\n !isTextarea &&\n ($slots.right || iconRight) &&\n !(clearable && modelValue) &&\n !(isPassword && showToggle)\n \"\n class=\"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-500\"\n >\n <slot name=\"right\">\n <UiIcon v-if=\"iconRight\" :name=\"iconRight\" class=\"w-4 h-4\" />\n </slot>\n </span>\n\n <!-- Clear button -->\n <button\n v-if=\"clearable && modelValue\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors\"\n aria-label=\"Clear\"\n @mousedown.prevent\n @click=\"emit('update:modelValue', '')\"\n >\n <UiIcon name=\"mdi:close-circle\" class=\"w-4 h-4\" />\n </button>\n\n <!-- Password visibility toggle button -->\n <button\n v-if=\"isPassword && showToggle\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors\"\n :aria-label=\"passwordVisible ? 'Hide password' : 'Show password'\"\n @mousedown.prevent\n @click=\"passwordVisible = !passwordVisible\"\n >\n <UiIcon\n :name=\"passwordVisible ? 'mdi:eye-off-outline' : 'mdi:eye-outline'\"\n class=\"w-4 h-4\"\n />\n </button>\n\n <!-- Number stepper: stacked up/down buttons on right -->\n <div\n v-if=\"isNumber && stepperLayout === 'stacked-right'\"\n class=\"flex flex-col w-6 border border-l-0 border-gray-300 dark:border-gray-600 rounded-r-lg overflow-hidden\"\n :class=\"{ 'opacity-50 pointer-events-none': disabled }\"\n >\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600\"\n aria-label=\"Increase value\"\n @click=\"stepUp\"\n >\n <UiIcon name=\"mdi:chevron-up\" class=\"block w-3 h-3\" />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none\"\n aria-label=\"Decrease value\"\n @click=\"stepDown\"\n >\n <UiIcon name=\"mdi:chevron-down\" class=\"block w-3 h-3\" />\n </button>\n </div>\n\n <!-- Number stepper: plus button on right (both-sides layout) -->\n <button\n v-if=\"isNumber && stepperLayout === 'both-sides'\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"flex items-center justify-center w-9 rounded-r-lg border border-l-0 border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none\"\n :class=\"{ 'opacity-50 pointer-events-none': disabled }\"\n aria-label=\"Increase value\"\n @click=\"stepUp\"\n >\n <UiIcon name=\"mdi:plus\" class=\"w-4 h-4\" />\n </button>\n </div>\n\n <!-- Validation error message (shown after first blur) -->\n <p v-if=\"showError && validationError\" class=\"text-xs text-red-600 dark:text-red-400 mt-1\">\n {{ validationError }}\n </p>\n </div>\n</template>\n\n<script setup>\n/**\n * UiInput — Multi-purpose input component supporting text, number, password, email,\n * phone, and textarea modes in a single unified interface.\n *\n * Features:\n * - Number mode with configurable stepper layouts (both-sides, stacked-left, stacked-right, none)\n * - Password mode with show/hide toggle\n * - Textarea mode with configurable resize, min/max dimensions\n * - Built-in validation for email, phone, and number patterns\n * - Custom regex validation with configurable error messages\n * - Exposes `focus()` method and `el` ref for parent control\n *\n * @example Basic text input\n * <UiInput v-model=\"name\" placeholder=\"Enter your name\" />\n *\n * @example Number input with min/max\n * <UiInput v-model=\"quantity\" type=\"number\" :min=\"0\" :max=\"100\" :step=\"1\" />\n *\n * @example Password with toggle\n * <UiInput v-model=\"password\" type=\"password\" />\n *\n * @example Textarea\n * <UiInput v-model=\"bio\" type=\"textarea\" :rows=\"5\" resize=\"vertical\" />\n *\n * @example Email with validation\n * <UiInput v-model=\"email\" type=\"email\" :validate=\"true\" />\n *\n * @emits {string | number} update:modelValue — Emitted when the input value changes (v-model)\n * @emits {{ valid: boolean, error: string | null }} validation — Emitted when the validation state changes\n */\nimport { ref, computed, watch, useSlots } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nconst props = defineProps({\n /**\n * Bound value (v-model).\n * @type {string | number}\n * @default ''\n */\n modelValue: { type: [String, Number], default: '' },\n\n /**\n * Input type determining the mode and behavior.\n * @type {string}\n * @default 'text'\n * @values 'text' | 'number' | 'password' | 'email' | 'phone' | 'textarea'\n */\n type: { type: String, default: 'text' },\n\n /**\n * Placeholder text shown when the input is empty.\n * @type {string}\n * @default ''\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Whether the field is required for form validation.\n * @type {boolean}\n * @default false\n */\n required: { type: Boolean, default: false },\n\n /**\n * Disabled state — dims the input and prevents interaction.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Read-only state — allows focus/selection but prevents editing.\n * @type {boolean}\n * @default false\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * HTML autocomplete attribute hint for the browser.\n * @type {string}\n * @default undefined\n */\n autocomplete: { type: String, default: undefined },\n\n /**\n * Minimum character length for text validation.\n * @type {number}\n * @default undefined\n */\n minlength: { type: Number, default: undefined },\n\n /**\n * Maximum character length for text validation.\n * @type {number}\n * @default undefined\n */\n maxlength: { type: Number, default: undefined },\n\n // ── Textarea-specific props ──\n\n /**\n * Number of visible text rows (textarea mode only).\n * @type {number}\n * @default 3\n */\n rows: { type: Number, default: 3 },\n\n /**\n * Resize behavior for textarea mode.\n * @type {string}\n * @default 'none'\n * @values 'none' | 'vertical' | 'horizontal' | 'both'\n */\n resize: { type: String, default: 'none' },\n\n /**\n * Minimum height CSS value for textarea (e.g. '80px', '5rem').\n * @type {string}\n * @default undefined\n */\n minHeight: { type: String, default: undefined },\n\n /**\n * Maximum height CSS value for textarea (e.g. '300px', '20rem').\n * @type {string}\n * @default undefined\n */\n maxHeight: { type: String, default: undefined },\n\n /**\n * Minimum width CSS value for textarea (e.g. '200px').\n * @type {string}\n * @default undefined\n */\n minWidth: { type: String, default: undefined },\n\n /**\n * Maximum width CSS value for textarea (e.g. '600px').\n * @type {string}\n * @default undefined\n */\n maxWidth: { type: String, default: undefined },\n\n /**\n * HTML pattern attribute for native form validation.\n * @type {string}\n * @default undefined\n */\n pattern: { type: String, default: undefined },\n\n // ── Password-specific props ──\n\n /**\n * Show the password visibility toggle button (password mode only).\n * @type {boolean}\n * @default true\n */\n showToggle: { type: Boolean, default: true },\n\n // ── Number-specific props ──\n\n /**\n * Minimum allowed numeric value.\n * @type {number}\n * @default undefined\n */\n min: { type: Number, default: undefined },\n\n /**\n * Maximum allowed numeric value.\n * @type {number}\n * @default undefined\n */\n max: { type: Number, default: undefined },\n\n /**\n * Step increment for number stepper buttons.\n * @type {number}\n * @default 1\n */\n step: { type: Number, default: 1 },\n\n /**\n * Layout of the +/- stepper buttons for number inputs.\n * @type {string}\n * @default 'both-sides'\n * @values 'stacked-left' | 'stacked-right' | 'both-sides' | 'none'\n */\n stepperLayout: { type: String, default: 'both-sides' },\n\n // ── Validation props ──\n\n /**\n * Show a clear button when the input has a value.\n * @type {boolean}\n * @default false\n */\n clearable: { type: Boolean, default: false },\n\n /**\n * Icon name to display on the left side of the input.\n * @type {string}\n * @default undefined\n */\n iconLeft: { type: String, default: undefined },\n\n /**\n * Icon name to display on the right side of the input.\n * @type {string}\n * @default undefined\n */\n iconRight: { type: String, default: undefined },\n\n /**\n * Enable built-in validation feedback shown below the input on blur.\n * @type {boolean}\n * @default true\n */\n validate: { type: Boolean, default: true },\n\n /**\n * Custom regex pattern string — overrides built-in type-based patterns.\n * @type {string}\n * @default undefined\n */\n validationPattern: { type: String, default: undefined },\n\n /**\n * Custom error message shown when validation fails.\n * @type {string}\n * @default undefined\n */\n validationMessage: { type: String, default: undefined },\n})\n\nconst emit = defineEmits(['update:modelValue', 'validation'])\n\nconst inputRef = ref(null)\nconst passwordVisible = ref(false)\nconst touched = ref(false)\n\n// --- Computed helpers ---\n\n// Detect input mode from the type prop\nconst isPassword = computed(() => props.type === 'password')\nconst isNumber = computed(() => props.type === 'number')\nconst isTextarea = computed(() => props.type === 'textarea')\n\n// Map resize prop to Tailwind resize utility class\nconst resizeClass = computed(() => {\n const map = { none: 'resize-none', vertical: 'resize-y', horizontal: 'resize-x', both: 'resize' }\n return map[props.resize] || 'resize-none'\n})\n\nconst textareaStyle = computed(() => {\n const s = {}\n if (props.minHeight) s.minHeight = props.minHeight\n if (props.maxHeight) s.maxHeight = props.maxHeight\n if (props.minWidth) s.minWidth = props.minWidth\n if (props.maxWidth) s.maxWidth = props.maxWidth\n return s\n})\n\n// For number type, render as text input so we can filter keystrokes ourselves\nconst computedType = computed(() => {\n if (isPassword.value) return passwordVisible.value ? 'text' : 'password'\n if (isNumber.value) return 'text' // we handle number filtering ourselves\n if (props.type === 'phone') return 'tel'\n return props.type\n})\n\n// Set appropriate mobile keyboard via inputmode attribute\nconst computedInputMode = computed(() => {\n if (isNumber.value) return 'decimal'\n if (props.type === 'phone') return 'tel'\n if (props.type === 'email') return 'email'\n return undefined\n})\n\nconst hasStepper = computed(() => isNumber.value && props.stepperLayout !== 'none')\n\nconst slots = useSlots()\n\nconst hasLeftIcon = computed(() => !!props.iconLeft || !!slots.left)\nconst hasRightIcon = computed(() => !!props.iconRight || !!slots.right)\n\nconst inputClasses = computed(() => {\n const classes = []\n\n // Horizontal padding — tighter when steppers are present\n if (hasStepper.value) {\n classes.push('px-1.5')\n } else {\n // Adjust padding for icons/slots\n classes.push(hasLeftIcon.value ? 'pl-9' : 'pl-3')\n classes.push(hasRightIcon.value ? 'pr-9' : 'pr-3')\n }\n\n // Rounding based on stepper layout\n if (hasStepper.value) {\n if (props.stepperLayout === 'both-sides') classes.push('rounded-none')\n else if (props.stepperLayout === 'stacked-left') classes.push('rounded-l-none', 'rounded-r-lg')\n else if (props.stepperLayout === 'stacked-right') classes.push('rounded-r-none', 'rounded-l-lg')\n } else {\n classes.push('rounded-lg')\n }\n\n // Extra right padding for password toggle\n if (isPassword.value && props.showToggle) classes.push('pr-10')\n\n // Extra right padding for clear button\n if (props.clearable) classes.push('pr-8')\n\n // Number text alignment\n if (isNumber.value && hasStepper.value) classes.push('text-center')\n\n return classes\n})\n\n// --- Validation ---\n\n// Built-in regex patterns for common input types\nconst PATTERNS = {\n email: /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/,\n phone: /^\\+?[\\d\\s\\-().]{7,}$/,\n number: /^-?\\d*\\.?\\d+$/,\n}\n\nconst MESSAGES = {\n email: 'Please enter a valid email address',\n phone: 'Please enter a valid phone number',\n number: 'Please enter a valid number',\n}\n\nconst validationError = computed(() => {\n const val = String(props.modelValue ?? '')\n if (!val) return null\n\n // Custom pattern takes priority\n if (props.validationPattern) {\n const re = new RegExp(props.validationPattern)\n if (!re.test(val)) return props.validationMessage || 'Invalid format'\n }\n\n // Built-in patterns\n const builtIn = PATTERNS[props.type]\n if (builtIn && !builtIn.test(val)) {\n return props.validationMessage || MESSAGES[props.type] || 'Invalid input'\n }\n\n return null\n})\n\nconst showError = computed(() => props.validate && touched.value)\n\nwatch(validationError, (err) => {\n emit('validation', { valid: !err, error: err })\n})\n\n// --- Event handlers ---\n\n// Regex for validating partial number input (allows intermediate states like \"-\" or \".\")\nconst NUMBER_ALLOWED = /^-?\\d*\\.?\\d*$/\n\nfunction onInput(e) {\n const val = e.target.value\n\n // For number type, reject non-numeric characters\n if (isNumber.value) {\n if (!NUMBER_ALLOWED.test(val)) {\n // Revert to previous valid value\n e.target.value = String(props.modelValue ?? '')\n return\n }\n }\n\n emit(\n 'update:modelValue',\n isNumber.value && val !== '' && val !== '-' && val !== '.' && val !== '-.' ? Number(val) : val,\n )\n}\n\nfunction onBlur() {\n touched.value = true\n}\n\nfunction onKeydown(e) {\n if (!isNumber.value) return\n\n // Allow: backspace, delete, tab, escape, enter, arrows, home, end, decimal point, minus\n const allowed = [\n 'Backspace',\n 'Delete',\n 'Tab',\n 'Escape',\n 'Enter',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n ]\n if (allowed.includes(e.key)) return\n if (e.key === '.' && !String(props.modelValue).includes('.')) return\n if (e.key === '-' && e.target.selectionStart === 0 && !String(props.modelValue).includes('-'))\n return\n if (e.ctrlKey || e.metaKey) return // allow copy/paste/select-all\n\n // Block non-digit keys\n if (!/^\\d$/.test(e.key)) {\n e.preventDefault()\n }\n}\n\nfunction stepUp() {\n const current = Number(props.modelValue) || 0\n let next = current + (props.step ?? 1)\n if (props.max !== undefined) next = Math.min(next, props.max)\n emit('update:modelValue', next)\n}\n\nfunction stepDown() {\n const current = Number(props.modelValue) || 0\n let next = current - (props.step ?? 1)\n if (props.min !== undefined) next = Math.max(next, props.min)\n emit('update:modelValue', next)\n}\n\n// Expose focus method\ndefineExpose({\n focus: () => inputRef.value?.focus(),\n el: inputRef,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2NA,MAAM,QAAQ;EA0Md,MAAM,OAAO;EAEb,MAAM,WAAW,IAAI,IAAI;EACzB,MAAM,kBAAkB,IAAI,KAAK;EACjC,MAAM,UAAU,IAAI,KAAK;EAKzB,MAAM,aAAa,eAAe,MAAM,SAAS,UAAU;EAC3D,MAAM,WAAW,eAAe,MAAM,SAAS,QAAQ;EACvD,MAAM,aAAa,eAAe,MAAM,SAAS,UAAU;EAG3D,MAAM,cAAc,eAAe;GAEjC,OAAO;IADO,MAAM;IAAe,UAAU;IAAY,YAAY;IAAY,MAAM;GAC9E,EAAE,MAAM,WAAW;EAC9B,CAAC;EAED,MAAM,gBAAgB,eAAe;GACnC,MAAM,IAAI,CAAC;GACX,IAAI,MAAM,WAAW,EAAE,YAAY,MAAM;GACzC,IAAI,MAAM,WAAW,EAAE,YAAY,MAAM;GACzC,IAAI,MAAM,UAAU,EAAE,WAAW,MAAM;GACvC,IAAI,MAAM,UAAU,EAAE,WAAW,MAAM;GACvC,OAAO;EACT,CAAC;EAGD,MAAM,eAAe,eAAe;GAClC,IA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