@fiscozen/input 3.2.0 → 3.3.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.
@@ -55,6 +55,8 @@ declare function __VLS_template(): {
55
55
  readonly disableEmphasisReset?: boolean | undefined;
56
56
  readonly maxlength?: number | undefined;
57
57
  readonly autocomplete?: boolean | undefined;
58
+ readonly clearable?: boolean | undefined;
59
+ readonly clearAriaLabel?: string | undefined;
58
60
  readonly leftIconClass?: string | undefined;
59
61
  readonly onFocus?: ((event: FocusEvent) => any) | undefined;
60
62
  readonly onBlur?: ((event: FocusEvent) => any) | undefined;
@@ -63,6 +65,7 @@ declare function __VLS_template(): {
63
65
  readonly "onFzinput:second-right-icon-click"?: (() => any) | undefined;
64
66
  readonly "onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
65
67
  readonly "onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
68
+ readonly "onFzinput:clear"?: (() => any) | undefined;
66
69
  readonly "onUpdate:modelValue"?: ((value: string) => any) | undefined;
67
70
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
68
71
  $attrs: {
@@ -80,7 +83,7 @@ declare function __VLS_template(): {
80
83
  $root: import('vue').ComponentPublicInstance | null;
81
84
  $parent: import('vue').ComponentPublicInstance | null;
82
85
  $host: Element | null;
83
- $emit: ((event: "focus", event: FocusEvent) => void) & ((event: "blur", event: FocusEvent) => void) & ((event: "fzinput:left-icon-click") => void) & ((event: "fzinput:right-icon-click") => void) & ((event: "fzinput:second-right-icon-click") => void) & ((event: "update:highlighted", value: boolean) => void) & ((event: "update:aiReasoning", value: boolean) => void) & ((event: "update:modelValue", value: string) => void);
86
+ $emit: ((event: "focus", event: FocusEvent) => void) & ((event: "blur", event: FocusEvent) => void) & ((event: "fzinput:left-icon-click") => void) & ((event: "fzinput:right-icon-click") => void) & ((event: "fzinput:second-right-icon-click") => void) & ((event: "update:highlighted", value: boolean) => void) & ((event: "update:aiReasoning", value: boolean) => void) & ((event: "fzinput:clear") => void) & ((event: "update:modelValue", value: string) => void);
84
87
  $el: any;
85
88
  $options: import('vue').ComponentOptionsBase<Readonly<{
86
89
  modelValue?: string;
@@ -92,6 +95,7 @@ declare function __VLS_template(): {
92
95
  "onFzinput:second-right-icon-click"?: (() => any) | undefined;
93
96
  "onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
94
97
  "onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
98
+ "onFzinput:clear"?: (() => any) | undefined;
95
99
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
96
100
  }>, {
97
101
  inputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
@@ -104,6 +108,7 @@ declare function __VLS_template(): {
104
108
  "fzinput:second-right-icon-click": () => any;
105
109
  "update:highlighted": (value: boolean) => any;
106
110
  "update:aiReasoning": (value: boolean) => any;
111
+ "fzinput:clear": () => any;
107
112
  "update:modelValue": (value: string) => any;
108
113
  }, string, {
109
114
  variant: "normal" | "floating-label";
@@ -118,6 +123,8 @@ declare function __VLS_template(): {
118
123
  aiReasoningDescription: string;
119
124
  disableEmphasisReset: boolean;
120
125
  autocomplete: boolean;
126
+ clearable: boolean;
127
+ clearAriaLabel: string;
121
128
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
122
129
  beforeCreate?: (() => void) | (() => void)[];
123
130
  created?: (() => void) | (() => void)[];
@@ -151,6 +158,8 @@ declare function __VLS_template(): {
151
158
  aiReasoningDescription: string;
152
159
  disableEmphasisReset: boolean;
153
160
  autocomplete: boolean;
161
+ clearable: boolean;
162
+ clearAriaLabel: string;
154
163
  }> & Omit<Readonly<{
155
164
  modelValue?: string;
156
165
  } & import('./types').FzInputProps> & Readonly<{
@@ -161,8 +170,9 @@ declare function __VLS_template(): {
161
170
  "onFzinput:second-right-icon-click"?: (() => any) | undefined;
162
171
  "onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
163
172
  "onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
173
+ "onFzinput:clear"?: (() => any) | undefined;
164
174
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
165
- }>, "inputRef" | "containerRef" | ("variant" | "type" | "environment" | "rightIconButtonVariant" | "secondRightIconButtonVariant" | "error" | "highlighted" | "highlightedDescription" | "aiReasoning" | "aiReasoningDescription" | "disableEmphasisReset" | "autocomplete")> & import('vue').ShallowUnwrapRef<{
175
+ }>, "inputRef" | "containerRef" | ("variant" | "type" | "environment" | "rightIconButtonVariant" | "secondRightIconButtonVariant" | "error" | "highlighted" | "highlightedDescription" | "aiReasoning" | "aiReasoningDescription" | "disableEmphasisReset" | "autocomplete" | "clearable" | "clearAriaLabel")> & import('vue').ShallowUnwrapRef<{
166
176
  inputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
167
177
  containerRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
168
178
  }> & {} & import('vue').ComponentCustomProperties & {} & {
@@ -189,8 +199,10 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
189
199
  containerRef: import('vue').ComputedRef<HTMLElement | null | undefined>;
190
200
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
191
201
  "update:modelValue": (value: string | number | null | undefined) => any;
202
+ "fzcurrencyinput:clear": () => any;
192
203
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
193
204
  "onUpdate:modelValue"?: ((value: string | number | null | undefined) => any) | undefined;
205
+ "onFzcurrencyinput:clear"?: (() => any) | undefined;
194
206
  }>, {
195
207
  minimumFractionDigits: number;
196
208
  maximumFractionDigits: number;
@@ -240,6 +252,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
240
252
  readonly disableEmphasisReset?: boolean | undefined;
241
253
  readonly maxlength?: number | undefined;
242
254
  readonly autocomplete?: boolean | undefined;
255
+ readonly clearable?: boolean | undefined;
256
+ readonly clearAriaLabel?: string | undefined;
243
257
  readonly leftIconClass?: string | undefined;
244
258
  readonly onFocus?: ((event: FocusEvent) => any) | undefined;
245
259
  readonly onBlur?: ((event: FocusEvent) => any) | undefined;
@@ -248,6 +262,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
248
262
  readonly "onFzinput:second-right-icon-click"?: (() => any) | undefined;
249
263
  readonly "onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
250
264
  readonly "onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
265
+ readonly "onFzinput:clear"?: (() => any) | undefined;
251
266
  readonly "onUpdate:modelValue"?: ((value: string) => any) | undefined;
252
267
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
253
268
  $attrs: {
@@ -265,7 +280,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
265
280
  $root: import('vue').ComponentPublicInstance | null;
266
281
  $parent: import('vue').ComponentPublicInstance | null;
267
282
  $host: Element | null;
268
- $emit: ((event: "focus", event: FocusEvent) => void) & ((event: "blur", event: FocusEvent) => void) & ((event: "fzinput:left-icon-click") => void) & ((event: "fzinput:right-icon-click") => void) & ((event: "fzinput:second-right-icon-click") => void) & ((event: "update:highlighted", value: boolean) => void) & ((event: "update:aiReasoning", value: boolean) => void) & ((event: "update:modelValue", value: string) => void);
283
+ $emit: ((event: "focus", event: FocusEvent) => void) & ((event: "blur", event: FocusEvent) => void) & ((event: "fzinput:left-icon-click") => void) & ((event: "fzinput:right-icon-click") => void) & ((event: "fzinput:second-right-icon-click") => void) & ((event: "update:highlighted", value: boolean) => void) & ((event: "update:aiReasoning", value: boolean) => void) & ((event: "fzinput:clear") => void) & ((event: "update:modelValue", value: string) => void);
269
284
  $el: any;
270
285
  $options: import('vue').ComponentOptionsBase<Readonly<{
271
286
  modelValue?: string;
@@ -277,6 +292,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
277
292
  "onFzinput:second-right-icon-click"?: (() => any) | undefined;
278
293
  "onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
279
294
  "onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
295
+ "onFzinput:clear"?: (() => any) | undefined;
280
296
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
281
297
  }>, {
282
298
  inputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
@@ -289,6 +305,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
289
305
  "fzinput:second-right-icon-click": () => any;
290
306
  "update:highlighted": (value: boolean) => any;
291
307
  "update:aiReasoning": (value: boolean) => any;
308
+ "fzinput:clear": () => any;
292
309
  "update:modelValue": (value: string) => any;
293
310
  }, string, {
294
311
  variant: "normal" | "floating-label";
@@ -303,6 +320,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
303
320
  aiReasoningDescription: string;
304
321
  disableEmphasisReset: boolean;
305
322
  autocomplete: boolean;
323
+ clearable: boolean;
324
+ clearAriaLabel: string;
306
325
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
307
326
  beforeCreate?: (() => void) | (() => void)[];
308
327
  created?: (() => void) | (() => void)[];
@@ -336,6 +355,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
336
355
  aiReasoningDescription: string;
337
356
  disableEmphasisReset: boolean;
338
357
  autocomplete: boolean;
358
+ clearable: boolean;
359
+ clearAriaLabel: string;
339
360
  }> & Omit<Readonly<{
340
361
  modelValue?: string;
341
362
  } & import('./types').FzInputProps> & Readonly<{
@@ -346,8 +367,9 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
346
367
  "onFzinput:second-right-icon-click"?: (() => any) | undefined;
347
368
  "onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
348
369
  "onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
370
+ "onFzinput:clear"?: (() => any) | undefined;
349
371
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
350
- }>, "inputRef" | "containerRef" | ("variant" | "type" | "environment" | "rightIconButtonVariant" | "secondRightIconButtonVariant" | "error" | "highlighted" | "highlightedDescription" | "aiReasoning" | "aiReasoningDescription" | "disableEmphasisReset" | "autocomplete")> & import('vue').ShallowUnwrapRef<{
372
+ }>, "inputRef" | "containerRef" | ("variant" | "type" | "environment" | "rightIconButtonVariant" | "secondRightIconButtonVariant" | "error" | "highlighted" | "highlightedDescription" | "aiReasoning" | "aiReasoningDescription" | "disableEmphasisReset" | "autocomplete" | "clearable" | "clearAriaLabel")> & import('vue').ShallowUnwrapRef<{
351
373
  inputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
352
374
  containerRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
353
375
  }> & {} & import('vue').ComponentCustomProperties & {} & {
@@ -37,6 +37,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
37
37
  "fzinput:second-right-icon-click": () => any;
38
38
  "update:highlighted": (value: boolean) => any;
39
39
  "update:aiReasoning": (value: boolean) => any;
40
+ "fzinput:clear": () => any;
40
41
  "update:modelValue": (value: string) => any;
41
42
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
42
43
  onFocus?: ((event: FocusEvent) => any) | undefined;
@@ -46,6 +47,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
46
47
  "onFzinput:second-right-icon-click"?: (() => any) | undefined;
47
48
  "onUpdate:highlighted"?: ((value: boolean) => any) | undefined;
48
49
  "onUpdate:aiReasoning"?: ((value: boolean) => any) | undefined;
50
+ "onFzinput:clear"?: (() => any) | undefined;
49
51
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
50
52
  }>, {
51
53
  variant: "normal" | "floating-label";
@@ -60,6 +62,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
60
62
  aiReasoningDescription: string;
61
63
  disableEmphasisReset: boolean;
62
64
  autocomplete: boolean;
65
+ clearable: boolean;
66
+ clearAriaLabel: string;
63
67
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
64
68
  containerRef: HTMLDivElement;
65
69
  inputRef: HTMLInputElement;
@@ -183,6 +183,17 @@ type FzInputProps = {
183
183
  * @default false
184
184
  */
185
185
  autocomplete?: boolean;
186
+ /**
187
+ * Shows a clear (×) button when the input has a value.
188
+ * Clicking it clears the model and emits `fzinput:clear`.
189
+ * @default false
190
+ */
191
+ clearable?: boolean;
192
+ /**
193
+ * Accessible label for the clear button.
194
+ * @default 'Cancella'
195
+ */
196
+ clearAriaLabel?: string;
186
197
  /**
187
198
  * Additional CSS classes applied to left icon container
188
199
  */
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@fiscozen/input",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "Design System Input component",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
7
7
  "keywords": [],
8
8
  "author": "Cristian Barraco",
9
9
  "dependencies": {
10
+ "@fiscozen/button": "3.0.0",
10
11
  "@fiscozen/alert": "3.0.0",
11
- "@fiscozen/composables": "1.0.3",
12
- "@fiscozen/button": "3.0.0"
12
+ "@fiscozen/composables": "1.0.3"
13
13
  },
14
14
  "peerDependencies": {
15
15
  "tailwindcss": "^3.4.1",
16
16
  "vue": "^3.4.13",
17
- "@fiscozen/icons": "^1.0.3"
17
+ "@fiscozen/icons": "^1.0.4"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@rushstack/eslint-patch": "^1.3.3",
@@ -32,9 +32,9 @@
32
32
  "vite-plugin-dts": "^4.5.0",
33
33
  "vitest": "^4.1.1",
34
34
  "vue-tsc": "^2.2.12",
35
- "@fiscozen/prettier-config": "^0.1.0",
36
35
  "@fiscozen/eslint-config": "^0.1.0",
37
- "@fiscozen/tsconfig": "^0.1.0"
36
+ "@fiscozen/tsconfig": "^0.1.0",
37
+ "@fiscozen/prettier-config": "^0.1.0"
38
38
  },
39
39
  "license": "MIT",
40
40
  "scripts": {
@@ -41,6 +41,12 @@ const props = withDefaults(defineProps<FzCurrencyInputProps>(), {
41
41
  step: 1,
42
42
  });
43
43
 
44
+ // DOM events (@focus, @blur, @keydown, …) propagate via v-bind fallthrough on the
45
+ // inner FzInput. @update:modelValue is handled by defineModel. Only custom events
46
+ // emitted explicitly by this component need to be declared here.
47
+ const emit = defineEmits<{
48
+ "fzcurrencyinput:clear": [];
49
+ }>();
44
50
  const model = defineModel<FzCurrencyInputProps["modelValue"]>();
45
51
 
46
52
  let isInternalUpdate = false;
@@ -730,6 +736,7 @@ defineExpose({
730
736
  @focus="handleFocus"
731
737
  @blur="handleBlur"
732
738
  @paste="handlePaste"
739
+ @fzinput:clear="emit('fzcurrencyinput:clear')"
733
740
  >
734
741
  <template v-if="$slots.label" #label>
735
742
  <slot name="label"></slot>