@naptics/vue-collection 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  export declare const nInputPhoneProps: {
2
2
  readonly input: import("vue").PropType<(props: import("./NValInput").InputSlotProps) => JSX.Element>;
3
+ readonly disableValidation: BooleanConstructor;
3
4
  readonly optional: BooleanConstructor;
4
5
  readonly rules: {
5
6
  readonly type: import("vue").PropType<import("../utils/validation").ValidationRule | import("../utils/validation").ValidationRule[]>;
@@ -51,6 +52,7 @@ export declare const nInputPhoneProps: {
51
52
  */
52
53
  declare const Component: import("vue").DefineComponent<{
53
54
  readonly input: import("vue").PropType<(props: import("./NValInput").InputSlotProps) => JSX.Element>;
55
+ readonly disableValidation: BooleanConstructor;
54
56
  readonly optional: BooleanConstructor;
55
57
  readonly rules: {
56
58
  readonly type: import("vue").PropType<import("../utils/validation").ValidationRule | import("../utils/validation").ValidationRule[]>;
@@ -98,6 +100,7 @@ declare const Component: import("vue").DefineComponent<{
98
100
  readonly onUpdateValue: import("vue").PropType<(newValue: string) => void>;
99
101
  }, import("vue").RenderFunction, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
100
102
  readonly input: import("vue").PropType<(props: import("./NValInput").InputSlotProps) => JSX.Element>;
103
+ readonly disableValidation: BooleanConstructor;
101
104
  readonly optional: BooleanConstructor;
102
105
  readonly rules: {
103
106
  readonly type: import("vue").PropType<import("../utils/validation").ValidationRule | import("../utils/validation").ValidationRule[]>;
@@ -154,6 +157,7 @@ declare const Component: import("vue").DefineComponent<{
154
157
  readonly error: boolean;
155
158
  readonly autocomplete: string;
156
159
  readonly hideLabel: boolean;
160
+ readonly disableValidation: boolean;
157
161
  readonly optional: boolean;
158
162
  readonly rules: import("../utils/validation").ValidationRule | import("../utils/validation").ValidationRule[];
159
163
  readonly hideErrorMessage: boolean;
@@ -20,6 +20,7 @@ export declare const nInputSuggestionProps: {
20
20
  readonly default: () => never[];
21
21
  };
22
22
  readonly input: PropType<(props: import("./NValInput").InputSlotProps) => JSX.Element>;
23
+ readonly disableValidation: BooleanConstructor;
23
24
  readonly optional: BooleanConstructor;
24
25
  readonly rules: {
25
26
  readonly type: PropType<import("../utils/validation").ValidationRule | import("../utils/validation").ValidationRule[]>;
@@ -91,6 +92,7 @@ declare const Component: import("vue").DefineComponent<{
91
92
  readonly default: () => never[];
92
93
  };
93
94
  readonly input: PropType<(props: import("./NValInput").InputSlotProps) => JSX.Element>;
95
+ readonly disableValidation: BooleanConstructor;
94
96
  readonly optional: BooleanConstructor;
95
97
  readonly rules: {
96
98
  readonly type: PropType<import("../utils/validation").ValidationRule | import("../utils/validation").ValidationRule[]>;
@@ -157,6 +159,7 @@ declare const Component: import("vue").DefineComponent<{
157
159
  readonly default: () => never[];
158
160
  };
159
161
  readonly input: PropType<(props: import("./NValInput").InputSlotProps) => JSX.Element>;
162
+ readonly disableValidation: BooleanConstructor;
160
163
  readonly optional: BooleanConstructor;
161
164
  readonly rules: {
162
165
  readonly type: PropType<import("../utils/validation").ValidationRule | import("../utils/validation").ValidationRule[]>;
@@ -213,6 +216,7 @@ declare const Component: import("vue").DefineComponent<{
213
216
  readonly error: boolean;
214
217
  readonly autocomplete: string;
215
218
  readonly hideLabel: boolean;
219
+ readonly disableValidation: boolean;
216
220
  readonly optional: boolean;
217
221
  readonly rules: import("../utils/validation").ValidationRule | import("../utils/validation").ValidationRule[];
218
222
  readonly hideErrorMessage: boolean;
@@ -50,6 +50,10 @@ export declare const nSelectProps: {
50
50
  * @see {@link nValInputProps.form}
51
51
  */
52
52
  readonly form: PropType<import("./ValidatedForm").ValidatedForm>;
53
+ /**
54
+ * @see {@link nValInputProps.hideLabel}
55
+ */
56
+ readonly hideLabel: BooleanConstructor;
53
57
  /**
54
58
  * @see {@link nValInputProps.inputClass}
55
59
  */
@@ -111,6 +115,10 @@ declare const Component: import("vue").DefineComponent<{
111
115
  * @see {@link nValInputProps.form}
112
116
  */
113
117
  readonly form: PropType<import("./ValidatedForm").ValidatedForm>;
118
+ /**
119
+ * @see {@link nValInputProps.hideLabel}
120
+ */
121
+ readonly hideLabel: BooleanConstructor;
114
122
  /**
115
123
  * @see {@link nValInputProps.inputClass}
116
124
  */
@@ -164,6 +172,10 @@ declare const Component: import("vue").DefineComponent<{
164
172
  * @see {@link nValInputProps.form}
165
173
  */
166
174
  readonly form: PropType<import("./ValidatedForm").ValidatedForm>;
175
+ /**
176
+ * @see {@link nValInputProps.hideLabel}
177
+ */
178
+ readonly hideLabel: BooleanConstructor;
167
179
  /**
168
180
  * @see {@link nValInputProps.inputClass}
169
181
  */
@@ -175,6 +187,7 @@ declare const Component: import("vue").DefineComponent<{
175
187
  readonly tooltipMaxWidth: import("../utils/tailwind").TWMaxWidth;
176
188
  readonly options: SelectionOption[];
177
189
  readonly disabled: boolean;
190
+ readonly hideLabel: boolean;
178
191
  readonly optional: boolean;
179
192
  }>;
180
193
  export { Component as NSelect, Component as default };
@@ -38,6 +38,10 @@ export const nSelectProps = {
38
38
  * @see {@link nValInputProps.form}
39
39
  */
40
40
  form: nValInputProps.form,
41
+ /**
42
+ * @see {@link nValInputProps.hideLabel}
43
+ */
44
+ hideLabel: nValInputProps.hideLabel,
41
45
  /**
42
46
  * @see {@link nValInputProps.inputClass}
43
47
  */
@@ -61,7 +65,7 @@ const Component = createComponent('NSelect', nSelectProps, (props, context) => {
61
65
  return () => _createVNode(NValInput, _mergeProps({
62
66
  "ref": inputRef
63
67
  }, props, {
64
- "input": slotProps => _createVNode(_Fragment, null, [_createVNode("label", {
68
+ "input": slotProps => _createVNode(_Fragment, null, [props.name && !props.hideLabel && _createVNode("label", {
65
69
  "for": props.name,
66
70
  "class": ['block text-sm font-medium mb-1', props.disabled ? 'text-default-300' : 'text-default-700']
67
71
  }, [props.name]), _createVNode(NTooltip, _mergeProps({
@@ -1,5 +1,6 @@
1
1
  import { type PropType } from 'vue';
2
2
  export declare const nTextAreaProps: {
3
+ readonly disableValidation: BooleanConstructor;
3
4
  readonly optional: BooleanConstructor;
4
5
  readonly rules: {
5
6
  readonly type: PropType<import("../utils/validation").ValidationRule | import("../utils/validation").ValidationRule[]>;
@@ -88,6 +89,7 @@ export type NTextAreaExposed = {
88
89
  focus(): void;
89
90
  };
90
91
  declare const Component: import("vue").DefineComponent<{
92
+ readonly disableValidation: BooleanConstructor;
91
93
  readonly optional: BooleanConstructor;
92
94
  readonly rules: {
93
95
  readonly type: PropType<import("../utils/validation").ValidationRule | import("../utils/validation").ValidationRule[]>;
@@ -169,6 +171,7 @@ declare const Component: import("vue").DefineComponent<{
169
171
  readonly value: PropType<string>;
170
172
  readonly onUpdateValue: PropType<(newValue: string) => void>;
171
173
  }, import("vue").RenderFunction, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
174
+ readonly disableValidation: BooleanConstructor;
172
175
  readonly optional: BooleanConstructor;
173
176
  readonly rules: {
174
177
  readonly type: PropType<import("../utils/validation").ValidationRule | import("../utils/validation").ValidationRule[]>;
@@ -258,6 +261,7 @@ declare const Component: import("vue").DefineComponent<{
258
261
  readonly error: boolean;
259
262
  readonly autocomplete: string;
260
263
  readonly hideLabel: boolean;
264
+ readonly disableValidation: boolean;
261
265
  readonly optional: boolean;
262
266
  readonly rules: import("../utils/validation").ValidationRule | import("../utils/validation").ValidationRule[];
263
267
  readonly hideErrorMessage: boolean;
@@ -3,6 +3,11 @@ import { type NInputExposed } from './NInput';
3
3
  import { type ValidationRule, type ValidationResult } from '../utils/validation';
4
4
  import type { ValidatedForm } from './ValidatedForm';
5
5
  export declare const validationProps: {
6
+ /**
7
+ * If set to `true` this inputs validation will always succeed and all validation
8
+ * rules are ignored. Default is `false`.
9
+ */
10
+ readonly disableValidation: BooleanConstructor;
6
11
  /**
7
12
  * If set to `true` this input is always valid when its value is empty.
8
13
  * If set to `false` the input receives the {@link required} rule. Default is `false`.
@@ -45,6 +50,11 @@ export declare const nValInputProps: {
45
50
  * A slot to replace the input.
46
51
  */
47
52
  readonly input: PropType<(props: InputSlotProps) => JSX.Element>;
53
+ /**
54
+ * If set to `true` this inputs validation will always succeed and all validation
55
+ * rules are ignored. Default is `false`.
56
+ */
57
+ readonly disableValidation: BooleanConstructor;
48
58
  /**
49
59
  * If set to `true` this input is always valid when its value is empty.
50
60
  * If set to `false` the input receives the {@link required} rule. Default is `false`.
@@ -113,7 +123,10 @@ export declare const nValInputProps: {
113
123
  readonly hideLabel: BooleanConstructor;
114
124
  readonly inputClass: StringConstructor;
115
125
  readonly onFocus: PropType<() => void>;
116
- readonly onBlur: PropType<() => void>;
126
+ readonly onBlur: PropType<() => void>; /**
127
+ * If set to `true` the error message is not shown.
128
+ * However, the input is still marked red if it is in an error state.
129
+ */
117
130
  readonly value: PropType<string>;
118
131
  readonly onUpdateValue: PropType<(newValue: string) => void>;
119
132
  };
@@ -143,6 +156,11 @@ declare const Component: import("vue").DefineComponent<{
143
156
  * A slot to replace the input.
144
157
  */
145
158
  readonly input: PropType<(props: InputSlotProps) => JSX.Element>;
159
+ /**
160
+ * If set to `true` this inputs validation will always succeed and all validation
161
+ * rules are ignored. Default is `false`.
162
+ */
163
+ readonly disableValidation: BooleanConstructor;
146
164
  /**
147
165
  * If set to `true` this input is always valid when its value is empty.
148
166
  * If set to `false` the input receives the {@link required} rule. Default is `false`.
@@ -211,7 +229,10 @@ declare const Component: import("vue").DefineComponent<{
211
229
  readonly hideLabel: BooleanConstructor;
212
230
  readonly inputClass: StringConstructor;
213
231
  readonly onFocus: PropType<() => void>;
214
- readonly onBlur: PropType<() => void>;
232
+ readonly onBlur: PropType<() => void>; /**
233
+ * If set to `true` the error message is not shown.
234
+ * However, the input is still marked red if it is in an error state.
235
+ */
215
236
  readonly value: PropType<string>;
216
237
  readonly onUpdateValue: PropType<(newValue: string) => void>;
217
238
  }, import("vue").RenderFunction, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -219,6 +240,11 @@ declare const Component: import("vue").DefineComponent<{
219
240
  * A slot to replace the input.
220
241
  */
221
242
  readonly input: PropType<(props: InputSlotProps) => JSX.Element>;
243
+ /**
244
+ * If set to `true` this inputs validation will always succeed and all validation
245
+ * rules are ignored. Default is `false`.
246
+ */
247
+ readonly disableValidation: BooleanConstructor;
222
248
  /**
223
249
  * If set to `true` this input is always valid when its value is empty.
224
250
  * If set to `false` the input receives the {@link required} rule. Default is `false`.
@@ -287,7 +313,10 @@ declare const Component: import("vue").DefineComponent<{
287
313
  readonly hideLabel: BooleanConstructor;
288
314
  readonly inputClass: StringConstructor;
289
315
  readonly onFocus: PropType<() => void>;
290
- readonly onBlur: PropType<() => void>;
316
+ readonly onBlur: PropType<() => void>; /**
317
+ * If set to `true` the error message is not shown.
318
+ * However, the input is still marked red if it is in an error state.
319
+ */
291
320
  readonly value: PropType<string>;
292
321
  readonly onUpdateValue: PropType<(newValue: string) => void>;
293
322
  }>> & {}, {
@@ -301,6 +330,7 @@ declare const Component: import("vue").DefineComponent<{
301
330
  readonly error: boolean;
302
331
  readonly autocomplete: string;
303
332
  readonly hideLabel: boolean;
333
+ readonly disableValidation: boolean;
304
334
  readonly optional: boolean;
305
335
  readonly rules: ValidationRule | ValidationRule[];
306
336
  readonly hideErrorMessage: boolean;
@@ -3,8 +3,13 @@ import { createComponentWithSlots } from '../utils/component';
3
3
  import { computed } from 'vue';
4
4
  import { ref, reactive, watch } from 'vue';
5
5
  import NInput, { nInputProps } from './NInput';
6
- import { validate, required } from '../utils/validation';
6
+ import { validate, required, validResult } from '../utils/validation';
7
7
  export const validationProps = {
8
+ /**
9
+ * If set to `true` this inputs validation will always succeed and all validation
10
+ * rules are ignored. Default is `false`.
11
+ */
12
+ disableValidation: Boolean,
8
13
  /**
9
14
  * If set to `true` this input is always valid when its value is empty.
10
15
  * If set to `false` the input receives the {@link required} rule. Default is `false`.
@@ -60,7 +65,7 @@ const Component = createComponentWithSlots('NValInput', nValInputProps, ['input'
60
65
  });
61
66
  const validationResult = ref();
62
67
  const validateRules = input => {
63
- const result = validate(input, rules.value);
68
+ const result = props.disableValidation ? validResult() : validate(input, rules.value);
64
69
  validationResult.value = result;
65
70
  return result;
66
71
  };
@@ -72,6 +77,7 @@ const Component = createComponentWithSlots('NValInput', nValInputProps, ['input'
72
77
  };
73
78
  watch(() => props.value, () => validateIfError());
74
79
  watch(() => rules.value, () => validateIfError());
80
+ watch(() => props.disableValidation, () => validateIfError());
75
81
  const onBlur = () => {
76
82
  if (!props.disableBlurValidation) validateRules(props.value);
77
83
  props.onBlur?.();
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@naptics/vue-collection",
3
3
  "author": "Timo Siegenthaler",
4
4
  "description": "Vue Collection is a collection of styled and fully functional Vue components which can easily be integrated into our projects.",
5
- "version": "0.2.4",
5
+ "version": "0.2.6",
6
6
  "main": "./index.js",
7
7
  "repository": {
8
8
  "type": "git",