@naptics/vue-collection 0.1.10 → 0.2.1

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 (53) hide show
  1. package/components/NAlert.d.ts +0 -12
  2. package/components/NAlert.js +1 -5
  3. package/components/NBadge.d.ts +21 -12
  4. package/components/NBadge.js +5 -3
  5. package/components/NBreadcrub.d.ts +3 -15
  6. package/components/NBreadcrub.js +3 -7
  7. package/components/NButton.d.ts +21 -12
  8. package/components/NButton.js +5 -3
  9. package/components/NCheckbox.d.ts +0 -12
  10. package/components/NCheckbox.js +2 -6
  11. package/components/NCheckboxLabel.d.ts +0 -3
  12. package/components/NCheckboxLabel.js +2 -8
  13. package/components/NDropdown.d.ts +89 -14
  14. package/components/NDropdown.js +9 -7
  15. package/components/NDropzone.d.ts +0 -12
  16. package/components/NDropzone.js +2 -6
  17. package/components/NFormModal.js +11 -7
  18. package/components/NIconButton.d.ts +21 -12
  19. package/components/NIconButton.js +5 -3
  20. package/components/NIconCircle.d.ts +0 -12
  21. package/components/NIconCircle.js +2 -6
  22. package/components/NInput.d.ts +9 -18
  23. package/components/NInput.js +1 -7
  24. package/components/NInputPhone.d.ts +9 -9
  25. package/components/NInputSelect.d.ts +9 -9
  26. package/components/NInputSuggestion.d.ts +9 -9
  27. package/components/NLink.d.ts +0 -12
  28. package/components/NLink.js +1 -5
  29. package/components/NList.d.ts +0 -12
  30. package/components/NList.js +2 -8
  31. package/components/NLoadingIndicator.d.ts +0 -12
  32. package/components/NLoadingIndicator.js +2 -6
  33. package/components/NPagination.d.ts +0 -12
  34. package/components/NPagination.js +1 -5
  35. package/components/NSearchbar.d.ts +0 -12
  36. package/components/NSearchbar.js +1 -7
  37. package/components/NSearchbarList.d.ts +0 -12
  38. package/components/NSearchbarList.js +1 -6
  39. package/components/NSelect.d.ts +9 -18
  40. package/components/NSelect.js +0 -4
  41. package/components/NTable.d.ts +27 -53
  42. package/components/NTable.js +21 -30
  43. package/components/NTableAction.d.ts +0 -12
  44. package/components/NTableAction.js +1 -5
  45. package/components/NTextArea.d.ts +9 -18
  46. package/components/NTextArea.js +0 -4
  47. package/components/NTooltip.d.ts +32 -12
  48. package/components/NTooltip.js +21 -11
  49. package/components/NValInput.d.ts +9 -9
  50. package/components/NValInput.js +4 -9
  51. package/package.json +1 -1
  52. package/utils/utils.d.ts +7 -0
  53. package/utils/utils.js +9 -0
@@ -41,11 +41,16 @@ export declare const nTooltipProps: {
41
41
  /**
42
42
  * Adds the classes to the (invisible) wrapper element.
43
43
  */
44
- readonly wrapperAddClass: StringConstructor;
44
+ readonly wrapperClass: StringConstructor;
45
45
  /**
46
46
  * Adds the classes to the container of the tooltips content.
47
47
  */
48
- readonly contentAddClass: StringConstructor;
48
+ readonly contentClass: StringConstructor;
49
+ /**
50
+ * Adds the classes to the tooltip arrow. Make sure to use `before:` classes
51
+ * to target the arrow (which is the before element).
52
+ */
53
+ readonly arrowClass: StringConstructor;
49
54
  };
50
55
  /**
51
56
  * These props are made to use on a component which implements the tooltip
@@ -88,13 +93,17 @@ export declare const nToolTipPropsForImplementor: {
88
93
  readonly default: "max-w-xs";
89
94
  };
90
95
  /**
91
- * @see {@link nTooltipProps.wrapperAddClass}
96
+ * @see {@link nTooltipProps.wrapperClass}
97
+ */
98
+ tooltipWrapperClass: StringConstructor;
99
+ /**
100
+ * @see {@link nTooltipProps.contentClass}
92
101
  */
93
- tooltipWrapperAddClass: StringConstructor;
102
+ tooltipContentClass: StringConstructor;
94
103
  /**
95
- * @see {@link nTooltipProps.contentAddClass}
104
+ * @see {@link nTooltipProps.arrowClass}
96
105
  */
97
- tooltipContentAddClass: StringConstructor;
106
+ tooltipArrowClass: StringConstructor;
98
107
  };
99
108
  /**
100
109
  * Maps the {@link nToolTipPropsForImplementor} props to normal tooltip props
@@ -107,8 +116,9 @@ export declare function mapTooltipProps(props: ExtractedProps<typeof nToolTipPro
107
116
  show: boolean;
108
117
  placement: TooltipPlacement;
109
118
  maxWidth: TWMaxWidth;
110
- wrapperAddClass: string | undefined;
111
- contentAddClass: string | undefined;
119
+ wrapperClass: string | undefined;
120
+ contentClass: string | undefined;
121
+ arrowClass: string | undefined;
112
122
  };
113
123
  /**
114
124
  * The `NTooltip` is a wrapper for any component which adds a tooltip to it.
@@ -160,11 +170,16 @@ declare const _default: import("vue").DefineComponent<{
160
170
  /**
161
171
  * Adds the classes to the (invisible) wrapper element.
162
172
  */
163
- readonly wrapperAddClass: StringConstructor;
173
+ readonly wrapperClass: StringConstructor;
164
174
  /**
165
175
  * Adds the classes to the container of the tooltips content.
166
176
  */
167
- readonly contentAddClass: StringConstructor;
177
+ readonly contentClass: StringConstructor;
178
+ /**
179
+ * Adds the classes to the tooltip arrow. Make sure to use `before:` classes
180
+ * to target the arrow (which is the before element).
181
+ */
182
+ readonly arrowClass: StringConstructor;
168
183
  }, 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<{
169
184
  /**
170
185
  * The text content of the tooltip.
@@ -204,11 +219,16 @@ declare const _default: import("vue").DefineComponent<{
204
219
  /**
205
220
  * Adds the classes to the (invisible) wrapper element.
206
221
  */
207
- readonly wrapperAddClass: StringConstructor;
222
+ readonly wrapperClass: StringConstructor;
208
223
  /**
209
224
  * Adds the classes to the container of the tooltips content.
210
225
  */
211
- readonly contentAddClass: StringConstructor;
226
+ readonly contentClass: StringConstructor;
227
+ /**
228
+ * Adds the classes to the tooltip arrow. Make sure to use `before:` classes
229
+ * to target the arrow (which is the before element).
230
+ */
231
+ readonly arrowClass: StringConstructor;
212
232
  }>> & {}, {
213
233
  readonly show: boolean;
214
234
  readonly hide: boolean;
@@ -44,11 +44,16 @@ export const nTooltipProps = {
44
44
  /**
45
45
  * Adds the classes to the (invisible) wrapper element.
46
46
  */
47
- wrapperAddClass: String,
47
+ wrapperClass: String,
48
48
  /**
49
49
  * Adds the classes to the container of the tooltips content.
50
50
  */
51
- contentAddClass: String
51
+ contentClass: String,
52
+ /**
53
+ * Adds the classes to the tooltip arrow. Make sure to use `before:` classes
54
+ * to target the arrow (which is the before element).
55
+ */
56
+ arrowClass: String
52
57
  };
53
58
  /**
54
59
  * These props are made to use on a component which implements the tooltip
@@ -85,13 +90,17 @@ export const nToolTipPropsForImplementor = {
85
90
  */
86
91
  tooltipMaxWidth: nTooltipProps.maxWidth,
87
92
  /**
88
- * @see {@link nTooltipProps.wrapperAddClass}
93
+ * @see {@link nTooltipProps.wrapperClass}
94
+ */
95
+ tooltipWrapperClass: nTooltipProps.wrapperClass,
96
+ /**
97
+ * @see {@link nTooltipProps.contentClass}
89
98
  */
90
- tooltipWrapperAddClass: nTooltipProps.wrapperAddClass,
99
+ tooltipContentClass: nTooltipProps.contentClass,
91
100
  /**
92
- * @see {@link nTooltipProps.contentAddClass}
101
+ * @see {@link nTooltipProps.arrowClass}
93
102
  */
94
- tooltipContentAddClass: nTooltipProps.contentAddClass
103
+ tooltipArrowClass: nTooltipProps.arrowClass
95
104
  };
96
105
  /**
97
106
  * Maps the {@link nToolTipPropsForImplementor} props to normal tooltip props
@@ -105,8 +114,9 @@ export function mapTooltipProps(props) {
105
114
  show: props.tooltipShow,
106
115
  placement: props.tooltipPlacement,
107
116
  maxWidth: props.tooltipMaxWidth,
108
- wrapperAddClass: props.tooltipWrapperAddClass,
109
- contentAddClass: props.tooltipContentAddClass
117
+ wrapperClass: props.tooltipWrapperClass,
118
+ contentClass: props.tooltipContentClass,
119
+ arrowClass: props.tooltipArrowClass
110
120
  };
111
121
  }
112
122
  /**
@@ -124,7 +134,7 @@ export default createComponent('NTooltip', nTooltipProps, (props, {
124
134
  slots
125
135
  }) => {
126
136
  return () => _createVNode("div", {
127
- "class": [props.block ? 'block' : 'inline-block', props.wrapperAddClass]
137
+ "class": [props.block ? 'block' : 'inline-block', props.wrapperClass]
128
138
  }, [props.content || props.text ? _createVNode(NTooltipBase, props, {
129
139
  default: () => [slots.default?.()]
130
140
  }) : slots.default?.()]);
@@ -187,10 +197,10 @@ const NTooltipBase = createComponent('NTooltipBase', nTooltipProps, (props, {
187
197
  "onMouseleave": () => isHoveringTooltip.value = false,
188
198
  "class": [isHovering.value ? 'z-20' : 'z-10', props.maxWidth, 'tooltip']
189
199
  }, [_createVNode("div", {
190
- "class": `bg-white rounded-md py-2 px-4 shadow-lg border-default-200 border text-sm whitespace-normal font-normal text-default-700 ${props.contentAddClass}`
200
+ "class": `bg-white rounded-md py-2 px-4 shadow-lg border-default-200 border text-sm whitespace-normal font-normal text-default-700 ${props.contentClass}`
191
201
  }, [props.content?.() || props.text]), _createVNode("div", {
192
202
  "data-popper-arrow": true,
193
- "class": "arrow"
203
+ "class": `arrow ${props.arrowClass}`
194
204
  }, null)]), [[_vShow, showTooltip.value]])]
195
205
  })]);
196
206
  });
@@ -93,8 +93,9 @@ export declare const nValInputProps: {
93
93
  readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
94
94
  readonly default: "max-w-xs";
95
95
  };
96
- readonly tooltipWrapperAddClass: StringConstructor;
97
- readonly tooltipContentAddClass: StringConstructor;
96
+ readonly tooltipWrapperClass: StringConstructor;
97
+ readonly tooltipContentClass: StringConstructor;
98
+ readonly tooltipArrowClass: StringConstructor;
98
99
  readonly name: StringConstructor;
99
100
  readonly placeholder: StringConstructor;
100
101
  readonly autocomplete: {
@@ -111,7 +112,6 @@ export declare const nValInputProps: {
111
112
  readonly small: BooleanConstructor;
112
113
  readonly hideLabel: BooleanConstructor;
113
114
  readonly inputClass: StringConstructor;
114
- readonly addClass: StringConstructor;
115
115
  readonly onFocus: PropType<() => void>;
116
116
  readonly onBlur: PropType<() => void>;
117
117
  readonly value: PropType<string>;
@@ -191,8 +191,9 @@ declare const _default: import("vue").DefineComponent<{
191
191
  readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
192
192
  readonly default: "max-w-xs";
193
193
  };
194
- readonly tooltipWrapperAddClass: StringConstructor;
195
- readonly tooltipContentAddClass: StringConstructor;
194
+ readonly tooltipWrapperClass: StringConstructor;
195
+ readonly tooltipContentClass: StringConstructor;
196
+ readonly tooltipArrowClass: StringConstructor;
196
197
  readonly name: StringConstructor;
197
198
  readonly placeholder: StringConstructor;
198
199
  readonly autocomplete: {
@@ -209,7 +210,6 @@ declare const _default: import("vue").DefineComponent<{
209
210
  readonly small: BooleanConstructor;
210
211
  readonly hideLabel: BooleanConstructor;
211
212
  readonly inputClass: StringConstructor;
212
- readonly addClass: StringConstructor;
213
213
  readonly onFocus: PropType<() => void>;
214
214
  readonly onBlur: PropType<() => void>;
215
215
  readonly value: PropType<string>;
@@ -267,8 +267,9 @@ declare const _default: import("vue").DefineComponent<{
267
267
  readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
268
268
  readonly default: "max-w-xs";
269
269
  };
270
- readonly tooltipWrapperAddClass: StringConstructor;
271
- readonly tooltipContentAddClass: StringConstructor;
270
+ readonly tooltipWrapperClass: StringConstructor;
271
+ readonly tooltipContentClass: StringConstructor;
272
+ readonly tooltipArrowClass: StringConstructor;
272
273
  readonly name: StringConstructor;
273
274
  readonly placeholder: StringConstructor;
274
275
  readonly autocomplete: {
@@ -285,7 +286,6 @@ declare const _default: import("vue").DefineComponent<{
285
286
  readonly small: BooleanConstructor;
286
287
  readonly hideLabel: BooleanConstructor;
287
288
  readonly inputClass: StringConstructor;
288
- readonly addClass: StringConstructor;
289
289
  readonly onFocus: PropType<() => void>;
290
290
  readonly onBlur: PropType<() => void>;
291
291
  readonly value: PropType<string>;
@@ -93,17 +93,12 @@ export default createComponentWithSlots('NValInput', nValInputProps, ['input'],
93
93
  };
94
94
  context.expose(expose);
95
95
  props.form?.addInput(expose);
96
- const childProps = computed(() => ({
96
+ return () => _createVNode("div", null, [props.input?.(inputSlotProps) || _createVNode(NInput, _mergeProps({
97
+ "ref": inputRef
98
+ }, {
97
99
  ...props,
98
- // We should not pass this property to the child, as the class is applied on this element.
99
- addClass: undefined,
100
100
  ...inputSlotProps
101
- }));
102
- return () => _createVNode("div", {
103
- "class": props.addClass
104
- }, [props.input?.(inputSlotProps) || _createVNode(NInput, _mergeProps({
105
- "ref": inputRef
106
- }, childProps.value), null), showErrorMessage.value && _createVNode("p", {
101
+ }), null), showErrorMessage.value && _createVNode("p", {
107
102
  "class": "text-red-500 text-xs mt-1"
108
103
  }, [errorMessage.value])]);
109
104
  });
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.1.10",
5
+ "version": "0.2.1",
6
6
  "main": "./index.js",
7
7
  "repository": {
8
8
  "type": "git",
package/utils/utils.d.ts CHANGED
@@ -21,6 +21,13 @@ export declare function isNullish(value: Nullish<unknown>): value is null | unde
21
21
  * @see notNullish
22
22
  */
23
23
  export declare function notNullishRef<T>(ref: Ref<T>): ref is Ref<NonNullable<T>>;
24
+ /**
25
+ * Determines if the value of a ref is null or undefined.
26
+ * @param ref the ref to check
27
+ * @returns `true` if the value of the ref is `null` or `undefined`.
28
+ * @see isNullish
29
+ */
30
+ export declare function isNullishRef(ref: Ref<Nullish<unknown>>): ref is Ref<null | undefined>;
24
31
  export type AnyObject = Record<string | number | symbol, unknown>;
25
32
  export type EmptyObject = Record<string | number | symbol, never>;
26
33
  export declare function isAnyObject(object: unknown): object is AnyObject;
package/utils/utils.js CHANGED
@@ -26,6 +26,15 @@ export function isNullish(value) {
26
26
  export function notNullishRef(ref) {
27
27
  return notNullish(ref.value);
28
28
  }
29
+ /**
30
+ * Determines if the value of a ref is null or undefined.
31
+ * @param ref the ref to check
32
+ * @returns `true` if the value of the ref is `null` or `undefined`.
33
+ * @see isNullish
34
+ */
35
+ export function isNullishRef(ref) {
36
+ return isNullish(ref.value);
37
+ }
29
38
  export function isAnyObject(object) {
30
39
  return typeof object === 'object' && !Array.isArray(object);
31
40
  }