@naptics/vue-collection 0.2.15 → 0.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.
Files changed (170) hide show
  1. package/.github/workflows/build.yml +26 -0
  2. package/.github/workflows/deploy-demo.yml +46 -0
  3. package/.github/workflows/deploy-lib.yml +65 -0
  4. package/.gitlab-ci.yml +57 -0
  5. package/.nvmrc +1 -0
  6. package/.prettierrc +8 -0
  7. package/.vscode/extensions.json +10 -0
  8. package/.vscode/launch.json +23 -0
  9. package/.vscode/settings.json +13 -0
  10. package/babel.config.json +3 -0
  11. package/components/NAlert.d.ts +1 -44
  12. package/components/NBadge.d.ts +1 -133
  13. package/components/NBreadcrub.d.ts +2 -106
  14. package/components/NBreadcrub.js +1 -1
  15. package/components/NButton.d.ts +2 -118
  16. package/components/NCheckbox.d.ts +1 -32
  17. package/components/NCheckboxLabel.d.ts +1 -45
  18. package/components/NCheckboxLabel.js +1 -1
  19. package/components/NCrudModal.d.ts +7 -251
  20. package/components/NCrudModal.js +1 -1
  21. package/components/NDialog.d.ts +1 -110
  22. package/components/NDialog.js +1 -1
  23. package/components/NDropdown.d.ts +1 -69
  24. package/components/NDropdown.js +1 -1
  25. package/components/NDropzone.d.ts +1 -115
  26. package/components/NDropzone.js +1 -1
  27. package/components/NForm.d.ts +1 -23
  28. package/components/NFormModal.d.ts +7 -151
  29. package/components/NIconButton.d.ts +3 -159
  30. package/components/NIconButton.js +1 -1
  31. package/components/NIconCircle.d.ts +1 -87
  32. package/components/NInput.d.ts +1 -164
  33. package/components/NInput.js +1 -1
  34. package/components/NInputPhone.d.ts +2 -114
  35. package/components/NInputPhone.js +1 -1
  36. package/components/NInputSelect.d.ts +2 -187
  37. package/components/NInputSelect.js +1 -1
  38. package/components/NInputSuggestion.d.ts +2 -155
  39. package/components/NInputSuggestion.js +1 -1
  40. package/components/NLink.d.ts +1 -70
  41. package/components/NList.d.ts +1 -43
  42. package/components/NList.js +1 -1
  43. package/components/NLoadingIndicator.d.ts +1 -49
  44. package/components/NModal.d.ts +12 -250
  45. package/components/NModal.js +15 -9
  46. package/components/NPagination.d.ts +1 -63
  47. package/components/NSearchbar.d.ts +1 -56
  48. package/components/NSearchbarList.d.ts +3 -63
  49. package/components/NSearchbarList.js +1 -1
  50. package/components/NSelect.d.ts +2 -148
  51. package/components/NSelect.js +1 -1
  52. package/components/NSuggestionList.d.ts +3 -126
  53. package/components/NSuggestionList.js +5 -2
  54. package/components/NTable.d.ts +1 -85
  55. package/components/NTable.js +12 -6
  56. package/components/NTableAction.d.ts +2 -46
  57. package/components/NTableAction.js +1 -1
  58. package/components/NTextArea.d.ts +2 -181
  59. package/components/NTextArea.js +1 -1
  60. package/components/NTooltip.d.ts +1 -105
  61. package/components/NTooltip.js +1 -1
  62. package/components/NValInput.d.ts +7 -182
  63. package/components/NValInput.js +1 -1
  64. package/env.d.ts +15 -0
  65. package/eslint.config.cjs +29 -0
  66. package/index.html +13 -0
  67. package/package.json +21 -19
  68. package/postcss.config.js +6 -0
  69. package/public/favicon.ico +0 -0
  70. package/scripts/build-lib.sh +52 -0
  71. package/scripts/sync-node-types.js +70 -0
  72. package/src/demo/App.css +9 -0
  73. package/src/demo/App.tsx +5 -0
  74. package/src/demo/components/ColorGrid.tsx +26 -0
  75. package/src/demo/components/ComponentGrid.tsx +26 -0
  76. package/src/demo/components/ComponentSection.tsx +30 -0
  77. package/src/demo/components/VariantSection.tsx +18 -0
  78. package/src/demo/i18n/de.ts +7 -0
  79. package/src/demo/i18n/en.ts +7 -0
  80. package/src/demo/i18n/index.ts +24 -0
  81. package/src/demo/main.ts +13 -0
  82. package/src/demo/router/index.ts +21 -0
  83. package/src/demo/views/HomeView.tsx +94 -0
  84. package/src/demo/views/NavigationView.tsx +43 -0
  85. package/src/demo/views/presentation/AlertView.tsx +40 -0
  86. package/src/demo/views/presentation/BadgeView.tsx +61 -0
  87. package/src/demo/views/presentation/BreadcrumbView.tsx +52 -0
  88. package/src/demo/views/presentation/ButtonView.tsx +49 -0
  89. package/src/demo/views/presentation/CheckboxView.tsx +59 -0
  90. package/src/demo/views/presentation/DropdownView.tsx +59 -0
  91. package/src/demo/views/presentation/DropzoneView.tsx +39 -0
  92. package/src/demo/views/presentation/IconButtonView.tsx +47 -0
  93. package/src/demo/views/presentation/IconCircleView.tsx +38 -0
  94. package/src/demo/views/presentation/InputView.tsx +179 -0
  95. package/src/demo/views/presentation/LinkView.tsx +50 -0
  96. package/src/demo/views/presentation/ListView.tsx +29 -0
  97. package/src/demo/views/presentation/LoadingIndicatorView.tsx +38 -0
  98. package/src/demo/views/presentation/ModalView.tsx +210 -0
  99. package/src/demo/views/presentation/PaginationView.tsx +25 -0
  100. package/src/demo/views/presentation/SearchbarView.tsx +80 -0
  101. package/src/demo/views/presentation/TableView.tsx +146 -0
  102. package/src/demo/views/presentation/TooltipView.tsx +86 -0
  103. package/src/lib/components/NAlert.tsx +85 -0
  104. package/src/lib/components/NBadge.tsx +75 -0
  105. package/src/lib/components/NBreadcrub.tsx +97 -0
  106. package/src/lib/components/NButton.tsx +80 -0
  107. package/src/lib/components/NCheckbox.tsx +55 -0
  108. package/src/lib/components/NCheckboxLabel.tsx +51 -0
  109. package/src/lib/components/NCrudModal.tsx +133 -0
  110. package/src/lib/components/NDialog.tsx +182 -0
  111. package/src/lib/components/NDropdown.tsx +167 -0
  112. package/src/lib/components/NDropzone.tsx +265 -0
  113. package/src/lib/components/NForm.tsx +32 -0
  114. package/src/lib/components/NFormModal.tsx +66 -0
  115. package/src/lib/components/NIconButton.tsx +92 -0
  116. package/src/lib/components/NIconCircle.tsx +78 -0
  117. package/src/lib/components/NInput.css +11 -0
  118. package/src/lib/components/NInput.tsx +139 -0
  119. package/src/lib/components/NInputPhone.tsx +53 -0
  120. package/src/lib/components/NInputSelect.tsx +126 -0
  121. package/src/lib/components/NInputSuggestion.tsx +80 -0
  122. package/src/lib/components/NLink.tsx +68 -0
  123. package/src/lib/components/NList.tsx +67 -0
  124. package/src/lib/components/NLoadingIndicator.css +46 -0
  125. package/src/lib/components/NLoadingIndicator.tsx +63 -0
  126. package/src/lib/components/NModal.tsx +243 -0
  127. package/src/lib/components/NPagination.css +15 -0
  128. package/src/lib/components/NPagination.tsx +131 -0
  129. package/src/lib/components/NSearchbar.tsx +78 -0
  130. package/src/lib/components/NSearchbarList.tsx +47 -0
  131. package/src/lib/components/NSelect.tsx +128 -0
  132. package/src/lib/components/NSuggestionList.tsx +216 -0
  133. package/src/lib/components/NTable.css +3 -0
  134. package/src/lib/components/NTable.tsx +247 -0
  135. package/src/lib/components/NTableAction.tsx +49 -0
  136. package/src/lib/components/NTextArea.tsx +159 -0
  137. package/src/lib/components/NTooltip.css +37 -0
  138. package/src/lib/components/NTooltip.tsx +250 -0
  139. package/src/lib/components/NValInput.tsx +163 -0
  140. package/src/lib/components/ValidatedForm.ts +71 -0
  141. package/src/lib/components/__tests__/NButton.spec.tsx +26 -0
  142. package/src/lib/components/__tests__/NCheckbox.spec.tsx +39 -0
  143. package/src/lib/i18n/de/vue-collection.json +58 -0
  144. package/src/lib/i18n/en/vue-collection.json +58 -0
  145. package/src/lib/i18n/index.ts +54 -0
  146. package/src/lib/index.ts +2 -0
  147. package/src/lib/jsx.d.ts +13 -0
  148. package/src/lib/utils/__tests__/identifiable.spec.ts +72 -0
  149. package/src/lib/utils/__tests__/validation.spec.ts +92 -0
  150. package/src/lib/utils/breakpoints.ts +47 -0
  151. package/src/lib/utils/component.tsx +131 -0
  152. package/src/lib/utils/deferred.ts +28 -0
  153. package/src/lib/utils/identifiable.ts +87 -0
  154. package/src/lib/utils/stringMaxLength.ts +25 -0
  155. package/src/lib/utils/tailwind.ts +41 -0
  156. package/src/lib/utils/utils.ts +90 -0
  157. package/src/lib/utils/vModel.ts +260 -0
  158. package/src/lib/utils/validation.ts +189 -0
  159. package/src/lib/utils/vue.ts +25 -0
  160. package/tailwind.config.js +38 -0
  161. package/tsconfig.config.json +9 -0
  162. package/tsconfig.demo.json +19 -0
  163. package/tsconfig.json +16 -0
  164. package/tsconfig.lib.json +18 -0
  165. package/tsconfig.vitest.json +8 -0
  166. package/utils/breakpoints.d.ts +1 -1
  167. package/utils/component.d.ts +3 -7
  168. package/utils/component.js +5 -2
  169. package/utils/identifiable.js +5 -1
  170. package/vite.config.ts +28 -0
@@ -1,4 +1,4 @@
1
- import { createTextVNode as _createTextVNode, createVNode as _createVNode } from "vue";
1
+ import { createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
2
2
  import { createComponentWithSlots } from '../utils/component';
3
3
  import { Dialog, DialogOverlay, DialogTitle, TransitionRoot, TransitionChild } from '@headlessui/vue';
4
4
  import NButton from './NButton';
@@ -27,6 +27,20 @@ export const nModalProps = {
27
27
  type: String,
28
28
  default: 'max-w-md'
29
29
  },
30
+ /**
31
+ * The vertical position of the modal. Default is `center`.
32
+ */
33
+ verticalPosition: {
34
+ type: String,
35
+ default: 'center'
36
+ },
37
+ /**
38
+ * The horizontal position of the modal. Default is `center`.
39
+ */
40
+ horizontalPosition: {
41
+ type: String,
42
+ default: 'center'
43
+ },
30
44
  /**
31
45
  * The title of the modal which is displayed in the header.
32
46
  */
@@ -52,14 +66,6 @@ export const nModalProps = {
52
66
  type: Boolean,
53
67
  default: true
54
68
  },
55
- verticalPosition: {
56
- type: String,
57
- default: 'center'
58
- },
59
- horizontalPosition: {
60
- type: String,
61
- default: 'center'
62
- },
63
69
  /**
64
70
  * If set to `true` the ok-button is hidden.
65
71
  */
@@ -33,67 +33,5 @@ export declare const nPaginationProps: {
33
33
  /**
34
34
  * The `NPagination` is a styled pagination component.
35
35
  */
36
- declare const Component: import("vue").DefineComponent<{
37
- /**
38
- * The page number which is currently selected.
39
- */
40
- readonly value: {
41
- readonly type: NumberConstructor;
42
- readonly default: () => number;
43
- };
44
- /**
45
- * This is called, when a new page number has been selected.
46
- */
47
- readonly onUpdateValue: PropType<(newValue: number) => void>;
48
- /**
49
- * The total pages which exists. This is needed to correctly display the selectable pages.
50
- */
51
- readonly total: {
52
- readonly type: NumberConstructor;
53
- readonly default: () => number;
54
- };
55
- /**
56
- * If set to `true`, the pagination is displayed smaller.
57
- */
58
- readonly small: BooleanConstructor;
59
- /**
60
- * This is called, when the visible pages, which are selectable in the pagination, have changed.
61
- * This is useful as only these pages can be navigated to on the next click.
62
- * This information can be useful for prefetching.
63
- */
64
- readonly onVisiblePagesChanged: PropType<(visiblePages: number[]) => void>;
65
- }, 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<{
66
- /**
67
- * The page number which is currently selected.
68
- */
69
- readonly value: {
70
- readonly type: NumberConstructor;
71
- readonly default: () => number;
72
- };
73
- /**
74
- * This is called, when a new page number has been selected.
75
- */
76
- readonly onUpdateValue: PropType<(newValue: number) => void>;
77
- /**
78
- * The total pages which exists. This is needed to correctly display the selectable pages.
79
- */
80
- readonly total: {
81
- readonly type: NumberConstructor;
82
- readonly default: () => number;
83
- };
84
- /**
85
- * If set to `true`, the pagination is displayed smaller.
86
- */
87
- readonly small: BooleanConstructor;
88
- /**
89
- * This is called, when the visible pages, which are selectable in the pagination, have changed.
90
- * This is useful as only these pages can be navigated to on the next click.
91
- * This information can be useful for prefetching.
92
- */
93
- readonly onVisiblePagesChanged: PropType<(visiblePages: number[]) => void>;
94
- }>> & {}, {
95
- readonly small: boolean;
96
- readonly value: number;
97
- readonly total: number;
98
- }>;
36
+ declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
99
37
  export { Component as NPagination, Component as default };
@@ -35,60 +35,5 @@ export type NSearchbarExposed = {
35
35
  /**
36
36
  * The `NSearchbar` is a styled input with a search icon.
37
37
  */
38
- declare const Component: import("vue").DefineComponent<{
39
- /**
40
- * The placeholder of the search-bar.
41
- */
42
- readonly placeholder: {
43
- readonly type: StringConstructor;
44
- readonly default: string;
45
- };
46
- /**
47
- * If set to `true` the search-bar is displayed smaller.
48
- */
49
- readonly small: BooleanConstructor;
50
- /**
51
- * Adds the classes directly to the input (e.g. for shadow).
52
- */
53
- readonly inputClass: StringConstructor;
54
- /**
55
- * This is called when the search-bar receives focus.
56
- */
57
- readonly onFocus: PropType<() => void>;
58
- /**
59
- * This is called when the search-bar looses focus.
60
- */
61
- readonly onBlur: PropType<() => void>;
62
- readonly value: PropType<string>;
63
- readonly onUpdateValue: PropType<(newValue: string) => void>;
64
- }, 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<{
65
- /**
66
- * The placeholder of the search-bar.
67
- */
68
- readonly placeholder: {
69
- readonly type: StringConstructor;
70
- readonly default: string;
71
- };
72
- /**
73
- * If set to `true` the search-bar is displayed smaller.
74
- */
75
- readonly small: BooleanConstructor;
76
- /**
77
- * Adds the classes directly to the input (e.g. for shadow).
78
- */
79
- readonly inputClass: StringConstructor;
80
- /**
81
- * This is called when the search-bar receives focus.
82
- */
83
- readonly onFocus: PropType<() => void>;
84
- /**
85
- * This is called when the search-bar looses focus.
86
- */
87
- readonly onBlur: PropType<() => void>;
88
- readonly value: PropType<string>;
89
- readonly onUpdateValue: PropType<(newValue: string) => void>;
90
- }>> & {}, {
91
- readonly small: boolean;
92
- readonly placeholder: string;
93
- }>;
38
+ declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
94
39
  export { Component as NSearchbar, Component as default };
@@ -13,7 +13,7 @@ export declare const nSearchbarListProps: {
13
13
  readonly value: import("vue").PropType<string>;
14
14
  readonly onUpdateValue: import("vue").PropType<(newValue: string) => void>;
15
15
  readonly items: {
16
- readonly type: import("vue").PropType<import("./NSuggestionList").SuggestionItem[]>;
16
+ readonly type: import("vue").PropType<Array<import("./NSuggestionList").SuggestionItem>>;
17
17
  readonly default: () => never[];
18
18
  };
19
19
  readonly maxItems: {
@@ -23,71 +23,11 @@ export declare const nSearchbarListProps: {
23
23
  readonly hideList: BooleanConstructor;
24
24
  readonly loading: BooleanConstructor;
25
25
  readonly onSelect: import("vue").PropType<(id: string) => void>;
26
- readonly listItem: import("vue").PropType<(props: import("./NSuggestionList").ItemSlotProps<import("./NSuggestionList").SuggestionItem>) => JSX.Element>;
26
+ readonly listItem: import("vue").PropType<(props: import("./NSuggestionList").ItemSlotProps) => JSX.Element>;
27
27
  readonly onRealBlur: import("vue").PropType<() => void>;
28
28
  };
29
29
  /**
30
30
  * The `NSearchbarList` is a {@link NSearchbar} with a {@link NSuggestionList}.
31
31
  */
32
- declare const Component: import("vue").DefineComponent<{
33
- /**
34
- * @see {@link nSearchbarProps.placeholder}
35
- */
36
- readonly placeholder: {
37
- readonly type: StringConstructor;
38
- readonly default: string;
39
- };
40
- /**
41
- * Adds the classes directly to the input (e.g. for shadow).
42
- */
43
- readonly inputClass: StringConstructor;
44
- readonly value: import("vue").PropType<string>;
45
- readonly onUpdateValue: import("vue").PropType<(newValue: string) => void>;
46
- readonly items: {
47
- readonly type: import("vue").PropType<import("./NSuggestionList").SuggestionItem[]>;
48
- readonly default: () => never[];
49
- };
50
- readonly maxItems: {
51
- readonly type: NumberConstructor;
52
- readonly default: () => number;
53
- };
54
- readonly hideList: BooleanConstructor;
55
- readonly loading: BooleanConstructor;
56
- readonly onSelect: import("vue").PropType<(id: string) => void>;
57
- readonly listItem: import("vue").PropType<(props: import("./NSuggestionList").ItemSlotProps<import("./NSuggestionList").SuggestionItem>) => JSX.Element>;
58
- readonly onRealBlur: import("vue").PropType<() => void>;
59
- }, 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<{
60
- /**
61
- * @see {@link nSearchbarProps.placeholder}
62
- */
63
- readonly placeholder: {
64
- readonly type: StringConstructor;
65
- readonly default: string;
66
- };
67
- /**
68
- * Adds the classes directly to the input (e.g. for shadow).
69
- */
70
- readonly inputClass: StringConstructor;
71
- readonly value: import("vue").PropType<string>;
72
- readonly onUpdateValue: import("vue").PropType<(newValue: string) => void>;
73
- readonly items: {
74
- readonly type: import("vue").PropType<import("./NSuggestionList").SuggestionItem[]>;
75
- readonly default: () => never[];
76
- };
77
- readonly maxItems: {
78
- readonly type: NumberConstructor;
79
- readonly default: () => number;
80
- };
81
- readonly hideList: BooleanConstructor;
82
- readonly loading: BooleanConstructor;
83
- readonly onSelect: import("vue").PropType<(id: string) => void>;
84
- readonly listItem: import("vue").PropType<(props: import("./NSuggestionList").ItemSlotProps<import("./NSuggestionList").SuggestionItem>) => JSX.Element>;
85
- readonly onRealBlur: import("vue").PropType<() => void>;
86
- }>> & {}, {
87
- readonly loading: boolean;
88
- readonly items: import("./NSuggestionList").SuggestionItem[];
89
- readonly placeholder: string;
90
- readonly maxItems: number;
91
- readonly hideList: boolean;
92
- }>;
32
+ declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
93
33
  export { Component as NSearchbarList, Component as default };
@@ -1,4 +1,4 @@
1
- import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
1
+ import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
2
  import { createComponentWithSlots } from '../utils/component';
3
3
  import { ref } from 'vue';
4
4
  import { vModelProps } from '../utils/vModel';
@@ -8,9 +8,7 @@ export declare const nSelectProps: {
8
8
  readonly tooltipShow: BooleanConstructor;
9
9
  readonly tooltipPlacement: {
10
10
  readonly type: PropType<import("./NTooltip").TooltipPlacement>;
11
- readonly default: "auto"; /**
12
- * @see {@link nValInputProps.name}
13
- */
11
+ readonly default: "auto";
14
12
  };
15
13
  readonly tooltipMaxWidth: {
16
14
  readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
@@ -76,149 +74,5 @@ export type NSelectExposed = NValInputExposed;
76
74
  /**
77
75
  * The `NSelect` is a styled html select-input.
78
76
  */
79
- declare const Component: import("vue").DefineComponent<{
80
- readonly tooltipText: StringConstructor;
81
- readonly tooltipContent: PropType<() => JSX.Element>;
82
- readonly tooltipHide: BooleanConstructor;
83
- readonly tooltipShow: BooleanConstructor;
84
- readonly tooltipPlacement: {
85
- readonly type: PropType<import("./NTooltip").TooltipPlacement>;
86
- readonly default: "auto"; /**
87
- * @see {@link nValInputProps.name}
88
- */
89
- };
90
- readonly tooltipMaxWidth: {
91
- readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
92
- readonly default: "max-w-xs";
93
- };
94
- readonly tooltipWrapperClass: StringConstructor;
95
- readonly tooltipContentClass: StringConstructor;
96
- readonly tooltipArrowClass: StringConstructor;
97
- /**
98
- * The id of the currently selected option of this input.
99
- */
100
- readonly value: StringConstructor;
101
- /**
102
- * This is called with the newly selected id when the selection has changed.
103
- * If no id is selected, the empty string is passed, in order to
104
- * match the API of all other inputs who never pass `undefined`.
105
- */
106
- readonly onUpdateValue: PropType<(newValue: string) => void>;
107
- /**
108
- * The different options which can be selected.
109
- */
110
- readonly options: {
111
- readonly type: PropType<SelectionOption[]>;
112
- readonly default: () => never[];
113
- };
114
- /**
115
- * The value which is shown in the empty state.
116
- * The "nothing-option" will be called like this.
117
- */
118
- readonly placeholder: {
119
- readonly type: StringConstructor;
120
- readonly default: () => string;
121
- };
122
- /**
123
- * @see {@link nValInputProps.name}
124
- */
125
- readonly name: StringConstructor;
126
- /**
127
- * @see {@link nValInputProps.optional}
128
- */
129
- readonly optional: BooleanConstructor;
130
- /**
131
- * @see {@link nValInputProps.disabled}
132
- */
133
- readonly disabled: BooleanConstructor;
134
- /**
135
- * @see {@link nValInputProps.form}
136
- */
137
- readonly form: PropType<import("./ValidatedForm").ValidatedForm>;
138
- /**
139
- * @see {@link nValInputProps.hideLabel}
140
- */
141
- readonly hideLabel: BooleanConstructor;
142
- /**
143
- * @see {@link nValInputProps.inputClass}
144
- */
145
- readonly inputClass: StringConstructor;
146
- }, 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<{
147
- readonly tooltipText: StringConstructor;
148
- readonly tooltipContent: PropType<() => JSX.Element>;
149
- readonly tooltipHide: BooleanConstructor;
150
- readonly tooltipShow: BooleanConstructor;
151
- readonly tooltipPlacement: {
152
- readonly type: PropType<import("./NTooltip").TooltipPlacement>;
153
- readonly default: "auto"; /**
154
- * @see {@link nValInputProps.name}
155
- */
156
- };
157
- readonly tooltipMaxWidth: {
158
- readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
159
- readonly default: "max-w-xs";
160
- };
161
- readonly tooltipWrapperClass: StringConstructor;
162
- readonly tooltipContentClass: StringConstructor;
163
- readonly tooltipArrowClass: StringConstructor;
164
- /**
165
- * The id of the currently selected option of this input.
166
- */
167
- readonly value: StringConstructor;
168
- /**
169
- * This is called with the newly selected id when the selection has changed.
170
- * If no id is selected, the empty string is passed, in order to
171
- * match the API of all other inputs who never pass `undefined`.
172
- */
173
- readonly onUpdateValue: PropType<(newValue: string) => void>;
174
- /**
175
- * The different options which can be selected.
176
- */
177
- readonly options: {
178
- readonly type: PropType<SelectionOption[]>;
179
- readonly default: () => never[];
180
- };
181
- /**
182
- * The value which is shown in the empty state.
183
- * The "nothing-option" will be called like this.
184
- */
185
- readonly placeholder: {
186
- readonly type: StringConstructor;
187
- readonly default: () => string;
188
- };
189
- /**
190
- * @see {@link nValInputProps.name}
191
- */
192
- readonly name: StringConstructor;
193
- /**
194
- * @see {@link nValInputProps.optional}
195
- */
196
- readonly optional: BooleanConstructor;
197
- /**
198
- * @see {@link nValInputProps.disabled}
199
- */
200
- readonly disabled: BooleanConstructor;
201
- /**
202
- * @see {@link nValInputProps.form}
203
- */
204
- readonly form: PropType<import("./ValidatedForm").ValidatedForm>;
205
- /**
206
- * @see {@link nValInputProps.hideLabel}
207
- */
208
- readonly hideLabel: BooleanConstructor;
209
- /**
210
- * @see {@link nValInputProps.inputClass}
211
- */
212
- readonly inputClass: StringConstructor;
213
- }>> & {}, {
214
- readonly tooltipHide: boolean;
215
- readonly tooltipShow: boolean;
216
- readonly tooltipPlacement: import("./NTooltip").TooltipPlacement;
217
- readonly tooltipMaxWidth: import("../utils/tailwind").TWMaxWidth;
218
- readonly options: SelectionOption[];
219
- readonly disabled: boolean;
220
- readonly placeholder: string;
221
- readonly hideLabel: boolean;
222
- readonly optional: boolean;
223
- }>;
77
+ declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
224
78
  export { Component as NSelect, Component as default };
@@ -1,4 +1,4 @@
1
- import { mergeProps as _mergeProps, createVNode as _createVNode, Fragment as _Fragment } from "vue";
1
+ import { Fragment as _Fragment, createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
2
  import { trsl } from '../i18n';
3
3
  import { createComponent } from '../utils/component';
4
4
  import { ref } from 'vue';
@@ -6,7 +6,7 @@ export declare const nSuggestionListPropsForConfig: {
6
6
  * The items which are available to show in the list. The first `maxItems` will be displayed.
7
7
  */
8
8
  readonly items: {
9
- readonly type: PropType<SuggestionItem[]>;
9
+ readonly type: PropType<Array<SuggestionItem>>;
10
10
  readonly default: () => never[];
11
11
  };
12
12
  /**
@@ -90,7 +90,7 @@ export declare const nSuggestionListProps: {
90
90
  * The items which are available to show in the list. The first `maxItems` will be displayed.
91
91
  */
92
92
  readonly items: {
93
- readonly type: PropType<SuggestionItem[]>;
93
+ readonly type: PropType<Array<SuggestionItem>>;
94
94
  readonly default: () => never[];
95
95
  };
96
96
  /**
@@ -149,128 +149,5 @@ export type SuggestionItem = Identifiable & {
149
149
  /**
150
150
  * The `NSuggestionList` can be added to an input and adds a list below it which is shown when the input is focused.
151
151
  */
152
- declare const Component: import("vue").DefineComponent<{
153
- /**
154
- * The slot for the input, which will be enhanced with the suggestion list.
155
- */
156
- readonly input: {
157
- readonly type: PropType<(props: InputSlotProps) => JSX.Element>;
158
- readonly required: true;
159
- };
160
- /**
161
- * When this function is called, the parent is required to call focus() on the input element.
162
- * It won't work properly if the parent does not request focus on the input.
163
- */
164
- readonly onRequestInputFocus: {
165
- readonly type: PropType<() => void>;
166
- readonly required: true;
167
- };
168
- /**
169
- * The current value of the input. This is just needed to display the «No results found for {value}» message.
170
- */
171
- readonly inputValue: {
172
- readonly type: StringConstructor;
173
- readonly required: true;
174
- };
175
- /**
176
- * The items which are available to show in the list. The first `maxItems` will be displayed.
177
- */
178
- readonly items: {
179
- readonly type: PropType<SuggestionItem[]>;
180
- readonly default: () => never[];
181
- };
182
- /**
183
- * The maximum items which are displayed in the list.
184
- */
185
- readonly maxItems: {
186
- readonly type: NumberConstructor;
187
- readonly default: () => number;
188
- };
189
- /**
190
- * If set to `true` the list is hidden.
191
- */
192
- readonly hideList: BooleanConstructor;
193
- /**
194
- * If set to `true` the list shows a loading indicator when the `items` array is empty.
195
- */
196
- readonly loading: BooleanConstructor;
197
- /**
198
- * This is called with the id of the selected item.
199
- */
200
- readonly onSelect: PropType<(id: string) => void>;
201
- /**
202
- * The slot for every item of the list.
203
- */
204
- readonly listItem: PropType<(props: ItemSlotProps) => JSX.Element>;
205
- /**
206
- * This function is called, when the input and the suggestion list are really blurred.
207
- * This means, it's not just the input temporarly beeing blurred because the user clicks on the item list,
208
- * but the focus has completely disappeared from the input and the list.
209
- */
210
- readonly onRealBlur: PropType<() => void>;
211
- }, 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<{
212
- /**
213
- * The slot for the input, which will be enhanced with the suggestion list.
214
- */
215
- readonly input: {
216
- readonly type: PropType<(props: InputSlotProps) => JSX.Element>;
217
- readonly required: true;
218
- };
219
- /**
220
- * When this function is called, the parent is required to call focus() on the input element.
221
- * It won't work properly if the parent does not request focus on the input.
222
- */
223
- readonly onRequestInputFocus: {
224
- readonly type: PropType<() => void>;
225
- readonly required: true;
226
- };
227
- /**
228
- * The current value of the input. This is just needed to display the «No results found for {value}» message.
229
- */
230
- readonly inputValue: {
231
- readonly type: StringConstructor;
232
- readonly required: true;
233
- };
234
- /**
235
- * The items which are available to show in the list. The first `maxItems` will be displayed.
236
- */
237
- readonly items: {
238
- readonly type: PropType<SuggestionItem[]>;
239
- readonly default: () => never[];
240
- };
241
- /**
242
- * The maximum items which are displayed in the list.
243
- */
244
- readonly maxItems: {
245
- readonly type: NumberConstructor;
246
- readonly default: () => number;
247
- };
248
- /**
249
- * If set to `true` the list is hidden.
250
- */
251
- readonly hideList: BooleanConstructor;
252
- /**
253
- * If set to `true` the list shows a loading indicator when the `items` array is empty.
254
- */
255
- readonly loading: BooleanConstructor;
256
- /**
257
- * This is called with the id of the selected item.
258
- */
259
- readonly onSelect: PropType<(id: string) => void>;
260
- /**
261
- * The slot for every item of the list.
262
- */
263
- readonly listItem: PropType<(props: ItemSlotProps) => JSX.Element>;
264
- /**
265
- * This function is called, when the input and the suggestion list are really blurred.
266
- * This means, it's not just the input temporarly beeing blurred because the user clicks on the item list,
267
- * but the focus has completely disappeared from the input and the list.
268
- */
269
- readonly onRealBlur: PropType<() => void>;
270
- }>> & {}, {
271
- readonly loading: boolean;
272
- readonly items: SuggestionItem[];
273
- readonly maxItems: number;
274
- readonly hideList: boolean;
275
- }>;
152
+ declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
276
153
  export { Component as NSuggestionList, Component as default };
@@ -1,4 +1,4 @@
1
- import { createTextVNode as _createTextVNode, createVNode as _createVNode } from "vue";
1
+ import { createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
2
2
  import { trsl } from '../i18n';
3
3
  import { createComponentWithSlots } from '../utils/component';
4
4
  import { computed, ref } from 'vue';
@@ -103,7 +103,10 @@ const Component = createComponentWithSlots('NSuggestionList', nSuggestionListPro
103
103
  event.preventDefault();
104
104
  const index = selectedIndex.value;
105
105
  if (index != null && index < displayItems.value.length) {
106
- onSelect(displayItems.value[index].id);
106
+ const item = displayItems.value[index];
107
+ if (item) {
108
+ onSelect(item.id);
109
+ }
107
110
  }
108
111
  }
109
112
  };