@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.
- package/.github/workflows/build.yml +26 -0
- package/.github/workflows/deploy-demo.yml +46 -0
- package/.github/workflows/deploy-lib.yml +65 -0
- package/.gitlab-ci.yml +57 -0
- package/.nvmrc +1 -0
- package/.prettierrc +8 -0
- package/.vscode/extensions.json +10 -0
- package/.vscode/launch.json +23 -0
- package/.vscode/settings.json +13 -0
- package/babel.config.json +3 -0
- package/components/NAlert.d.ts +1 -44
- package/components/NBadge.d.ts +1 -133
- package/components/NBreadcrub.d.ts +2 -106
- package/components/NBreadcrub.js +1 -1
- package/components/NButton.d.ts +2 -118
- package/components/NCheckbox.d.ts +1 -32
- package/components/NCheckboxLabel.d.ts +1 -45
- package/components/NCheckboxLabel.js +1 -1
- package/components/NCrudModal.d.ts +7 -251
- package/components/NCrudModal.js +1 -1
- package/components/NDialog.d.ts +1 -110
- package/components/NDialog.js +1 -1
- package/components/NDropdown.d.ts +1 -69
- package/components/NDropdown.js +1 -1
- package/components/NDropzone.d.ts +1 -115
- package/components/NDropzone.js +1 -1
- package/components/NForm.d.ts +1 -23
- package/components/NFormModal.d.ts +7 -151
- package/components/NIconButton.d.ts +3 -159
- package/components/NIconButton.js +1 -1
- package/components/NIconCircle.d.ts +1 -87
- package/components/NInput.d.ts +1 -164
- package/components/NInput.js +1 -1
- package/components/NInputPhone.d.ts +2 -114
- package/components/NInputPhone.js +1 -1
- package/components/NInputSelect.d.ts +2 -187
- package/components/NInputSelect.js +1 -1
- package/components/NInputSuggestion.d.ts +2 -155
- package/components/NInputSuggestion.js +1 -1
- package/components/NLink.d.ts +1 -70
- package/components/NList.d.ts +1 -43
- package/components/NList.js +1 -1
- package/components/NLoadingIndicator.d.ts +1 -49
- package/components/NModal.d.ts +12 -250
- package/components/NModal.js +15 -9
- package/components/NPagination.d.ts +1 -63
- package/components/NSearchbar.d.ts +1 -56
- package/components/NSearchbarList.d.ts +3 -63
- package/components/NSearchbarList.js +1 -1
- package/components/NSelect.d.ts +2 -148
- package/components/NSelect.js +1 -1
- package/components/NSuggestionList.d.ts +3 -126
- package/components/NSuggestionList.js +5 -2
- package/components/NTable.d.ts +1 -85
- package/components/NTable.js +12 -6
- package/components/NTableAction.d.ts +2 -46
- package/components/NTableAction.js +1 -1
- package/components/NTextArea.d.ts +2 -181
- package/components/NTextArea.js +1 -1
- package/components/NTooltip.d.ts +1 -105
- package/components/NTooltip.js +1 -1
- package/components/NValInput.d.ts +7 -182
- package/components/NValInput.js +1 -1
- package/env.d.ts +15 -0
- package/eslint.config.cjs +29 -0
- package/index.html +13 -0
- package/package.json +21 -19
- package/postcss.config.js +6 -0
- package/public/favicon.ico +0 -0
- package/scripts/build-lib.sh +52 -0
- package/scripts/sync-node-types.js +70 -0
- package/src/demo/App.css +9 -0
- package/src/demo/App.tsx +5 -0
- package/src/demo/components/ColorGrid.tsx +26 -0
- package/src/demo/components/ComponentGrid.tsx +26 -0
- package/src/demo/components/ComponentSection.tsx +30 -0
- package/src/demo/components/VariantSection.tsx +18 -0
- package/src/demo/i18n/de.ts +7 -0
- package/src/demo/i18n/en.ts +7 -0
- package/src/demo/i18n/index.ts +24 -0
- package/src/demo/main.ts +13 -0
- package/src/demo/router/index.ts +21 -0
- package/src/demo/views/HomeView.tsx +94 -0
- package/src/demo/views/NavigationView.tsx +43 -0
- package/src/demo/views/presentation/AlertView.tsx +40 -0
- package/src/demo/views/presentation/BadgeView.tsx +61 -0
- package/src/demo/views/presentation/BreadcrumbView.tsx +52 -0
- package/src/demo/views/presentation/ButtonView.tsx +49 -0
- package/src/demo/views/presentation/CheckboxView.tsx +59 -0
- package/src/demo/views/presentation/DropdownView.tsx +59 -0
- package/src/demo/views/presentation/DropzoneView.tsx +39 -0
- package/src/demo/views/presentation/IconButtonView.tsx +47 -0
- package/src/demo/views/presentation/IconCircleView.tsx +38 -0
- package/src/demo/views/presentation/InputView.tsx +179 -0
- package/src/demo/views/presentation/LinkView.tsx +50 -0
- package/src/demo/views/presentation/ListView.tsx +29 -0
- package/src/demo/views/presentation/LoadingIndicatorView.tsx +38 -0
- package/src/demo/views/presentation/ModalView.tsx +210 -0
- package/src/demo/views/presentation/PaginationView.tsx +25 -0
- package/src/demo/views/presentation/SearchbarView.tsx +80 -0
- package/src/demo/views/presentation/TableView.tsx +146 -0
- package/src/demo/views/presentation/TooltipView.tsx +86 -0
- package/src/lib/components/NAlert.tsx +85 -0
- package/src/lib/components/NBadge.tsx +75 -0
- package/src/lib/components/NBreadcrub.tsx +97 -0
- package/src/lib/components/NButton.tsx +80 -0
- package/src/lib/components/NCheckbox.tsx +55 -0
- package/src/lib/components/NCheckboxLabel.tsx +51 -0
- package/src/lib/components/NCrudModal.tsx +133 -0
- package/src/lib/components/NDialog.tsx +182 -0
- package/src/lib/components/NDropdown.tsx +167 -0
- package/src/lib/components/NDropzone.tsx +265 -0
- package/src/lib/components/NForm.tsx +32 -0
- package/src/lib/components/NFormModal.tsx +66 -0
- package/src/lib/components/NIconButton.tsx +92 -0
- package/src/lib/components/NIconCircle.tsx +78 -0
- package/src/lib/components/NInput.css +11 -0
- package/src/lib/components/NInput.tsx +139 -0
- package/src/lib/components/NInputPhone.tsx +53 -0
- package/src/lib/components/NInputSelect.tsx +126 -0
- package/src/lib/components/NInputSuggestion.tsx +80 -0
- package/src/lib/components/NLink.tsx +68 -0
- package/src/lib/components/NList.tsx +67 -0
- package/src/lib/components/NLoadingIndicator.css +46 -0
- package/src/lib/components/NLoadingIndicator.tsx +63 -0
- package/src/lib/components/NModal.tsx +243 -0
- package/src/lib/components/NPagination.css +15 -0
- package/src/lib/components/NPagination.tsx +131 -0
- package/src/lib/components/NSearchbar.tsx +78 -0
- package/src/lib/components/NSearchbarList.tsx +47 -0
- package/src/lib/components/NSelect.tsx +128 -0
- package/src/lib/components/NSuggestionList.tsx +216 -0
- package/src/lib/components/NTable.css +3 -0
- package/src/lib/components/NTable.tsx +247 -0
- package/src/lib/components/NTableAction.tsx +49 -0
- package/src/lib/components/NTextArea.tsx +159 -0
- package/src/lib/components/NTooltip.css +37 -0
- package/src/lib/components/NTooltip.tsx +250 -0
- package/src/lib/components/NValInput.tsx +163 -0
- package/src/lib/components/ValidatedForm.ts +71 -0
- package/src/lib/components/__tests__/NButton.spec.tsx +26 -0
- package/src/lib/components/__tests__/NCheckbox.spec.tsx +39 -0
- package/src/lib/i18n/de/vue-collection.json +58 -0
- package/src/lib/i18n/en/vue-collection.json +58 -0
- package/src/lib/i18n/index.ts +54 -0
- package/src/lib/index.ts +2 -0
- package/src/lib/jsx.d.ts +13 -0
- package/src/lib/utils/__tests__/identifiable.spec.ts +72 -0
- package/src/lib/utils/__tests__/validation.spec.ts +92 -0
- package/src/lib/utils/breakpoints.ts +47 -0
- package/src/lib/utils/component.tsx +131 -0
- package/src/lib/utils/deferred.ts +28 -0
- package/src/lib/utils/identifiable.ts +87 -0
- package/src/lib/utils/stringMaxLength.ts +25 -0
- package/src/lib/utils/tailwind.ts +41 -0
- package/src/lib/utils/utils.ts +90 -0
- package/src/lib/utils/vModel.ts +260 -0
- package/src/lib/utils/validation.ts +189 -0
- package/src/lib/utils/vue.ts +25 -0
- package/tailwind.config.js +38 -0
- package/tsconfig.config.json +9 -0
- package/tsconfig.demo.json +19 -0
- package/tsconfig.json +16 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.vitest.json +8 -0
- package/utils/breakpoints.d.ts +1 -1
- package/utils/component.d.ts +3 -7
- package/utils/component.js +5 -2
- package/utils/identifiable.js +5 -1
- package/vite.config.ts +28 -0
|
@@ -19,7 +19,7 @@ export declare const validationProps: {
|
|
|
19
19
|
* If `optional` is set to false, the rule {@link required} will be checked first.
|
|
20
20
|
*/
|
|
21
21
|
readonly rules: {
|
|
22
|
-
readonly type: PropType<ValidationRule | ValidationRule
|
|
22
|
+
readonly type: PropType<ValidationRule[] | ValidationRule>;
|
|
23
23
|
readonly default: () => never[];
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
@@ -66,7 +66,7 @@ export declare const nValInputProps: {
|
|
|
66
66
|
* If `optional` is set to false, the rule {@link required} will be checked first.
|
|
67
67
|
*/
|
|
68
68
|
readonly rules: {
|
|
69
|
-
readonly type: PropType<ValidationRule | ValidationRule
|
|
69
|
+
readonly type: PropType<ValidationRule[] | ValidationRule>;
|
|
70
70
|
readonly default: () => never[];
|
|
71
71
|
};
|
|
72
72
|
/**
|
|
@@ -92,7 +92,10 @@ export declare const nValInputProps: {
|
|
|
92
92
|
*/
|
|
93
93
|
readonly disableBlurValidation: BooleanConstructor;
|
|
94
94
|
readonly tooltipText: StringConstructor;
|
|
95
|
-
readonly tooltipContent: PropType<() => JSX.Element
|
|
95
|
+
readonly tooltipContent: PropType<() => JSX.Element /**
|
|
96
|
+
* If set to `true` this input is always valid when its value is empty.
|
|
97
|
+
* If set to `false` the input receives the {@link required} rule. Default is `false`.
|
|
98
|
+
*/>;
|
|
96
99
|
readonly tooltipHide: BooleanConstructor;
|
|
97
100
|
readonly tooltipShow: BooleanConstructor;
|
|
98
101
|
readonly tooltipPlacement: {
|
|
@@ -148,183 +151,5 @@ export type NValInputExposed = {
|
|
|
148
151
|
/**
|
|
149
152
|
* The `NValInput` is a `NInput` with custom validation.
|
|
150
153
|
*/
|
|
151
|
-
declare const Component: import("vue").
|
|
152
|
-
/**
|
|
153
|
-
* A slot to replace the input.
|
|
154
|
-
*/
|
|
155
|
-
readonly input: PropType<(props: InputSlotProps) => JSX.Element>;
|
|
156
|
-
/**
|
|
157
|
-
* If set to `true` this inputs validation will always succeed and all validation
|
|
158
|
-
* rules are ignored. Default is `false`.
|
|
159
|
-
*/
|
|
160
|
-
readonly disableValidation: BooleanConstructor;
|
|
161
|
-
/**
|
|
162
|
-
* If set to `true` this input is always valid when its value is empty.
|
|
163
|
-
* If set to `false` the input receives the {@link required} rule. Default is `false`.
|
|
164
|
-
*/
|
|
165
|
-
readonly optional: BooleanConstructor;
|
|
166
|
-
/**
|
|
167
|
-
* The rules which this input is checked with.
|
|
168
|
-
* The rules are checked sequentially and the error of the first failed rule is displayed.
|
|
169
|
-
* If `optional` is set to false, the rule {@link required} will be checked first.
|
|
170
|
-
*/
|
|
171
|
-
readonly rules: {
|
|
172
|
-
readonly type: PropType<ValidationRule | ValidationRule[]>;
|
|
173
|
-
readonly default: () => never[];
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* The form, which this input will be added to.
|
|
177
|
-
* On initialization, this input will call {@link ValidatedForm.addInput} passing itself to the form.
|
|
178
|
-
*/
|
|
179
|
-
readonly form: PropType<ValidatedForm>;
|
|
180
|
-
/**
|
|
181
|
-
* Overrides the internal error state. If set to true, it will always display an error.
|
|
182
|
-
*/
|
|
183
|
-
readonly error: BooleanConstructor;
|
|
184
|
-
/**
|
|
185
|
-
* Overrides the internal error message. If set, this message is always displayed.
|
|
186
|
-
*/
|
|
187
|
-
readonly errorMessage: StringConstructor;
|
|
188
|
-
/**
|
|
189
|
-
* If set to `true` the error message is not shown.
|
|
190
|
-
* However, the input is still marked red if it is in an error state.
|
|
191
|
-
*/
|
|
192
|
-
readonly hideErrorMessage: BooleanConstructor;
|
|
193
|
-
/**
|
|
194
|
-
* Disables the validation on blur. Should only be used in special occasions.
|
|
195
|
-
*/
|
|
196
|
-
readonly disableBlurValidation: BooleanConstructor;
|
|
197
|
-
readonly tooltipText: StringConstructor;
|
|
198
|
-
readonly tooltipContent: PropType<() => JSX.Element>;
|
|
199
|
-
readonly tooltipHide: BooleanConstructor;
|
|
200
|
-
readonly tooltipShow: BooleanConstructor;
|
|
201
|
-
readonly tooltipPlacement: {
|
|
202
|
-
readonly type: PropType<import("./NTooltip").TooltipPlacement>;
|
|
203
|
-
readonly default: "auto";
|
|
204
|
-
};
|
|
205
|
-
readonly tooltipMaxWidth: {
|
|
206
|
-
readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
|
|
207
|
-
readonly default: "max-w-xs";
|
|
208
|
-
};
|
|
209
|
-
readonly tooltipWrapperClass: StringConstructor;
|
|
210
|
-
readonly tooltipContentClass: StringConstructor;
|
|
211
|
-
readonly tooltipArrowClass: StringConstructor;
|
|
212
|
-
readonly name: StringConstructor;
|
|
213
|
-
readonly placeholder: StringConstructor;
|
|
214
|
-
readonly autocomplete: {
|
|
215
|
-
readonly type: StringConstructor;
|
|
216
|
-
readonly default: "off";
|
|
217
|
-
};
|
|
218
|
-
readonly type: {
|
|
219
|
-
readonly type: StringConstructor;
|
|
220
|
-
readonly default: "text";
|
|
221
|
-
};
|
|
222
|
-
readonly max: StringConstructor;
|
|
223
|
-
readonly min: StringConstructor;
|
|
224
|
-
readonly disabled: BooleanConstructor;
|
|
225
|
-
readonly small: BooleanConstructor;
|
|
226
|
-
readonly hideLabel: BooleanConstructor;
|
|
227
|
-
readonly inputClass: StringConstructor;
|
|
228
|
-
readonly onFocus: PropType<() => void>;
|
|
229
|
-
readonly onBlur: PropType<() => void>;
|
|
230
|
-
readonly value: PropType<string>;
|
|
231
|
-
readonly onUpdateValue: PropType<(newValue: string) => void>;
|
|
232
|
-
}, 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<{
|
|
233
|
-
/**
|
|
234
|
-
* A slot to replace the input.
|
|
235
|
-
*/
|
|
236
|
-
readonly input: PropType<(props: InputSlotProps) => JSX.Element>;
|
|
237
|
-
/**
|
|
238
|
-
* If set to `true` this inputs validation will always succeed and all validation
|
|
239
|
-
* rules are ignored. Default is `false`.
|
|
240
|
-
*/
|
|
241
|
-
readonly disableValidation: BooleanConstructor;
|
|
242
|
-
/**
|
|
243
|
-
* If set to `true` this input is always valid when its value is empty.
|
|
244
|
-
* If set to `false` the input receives the {@link required} rule. Default is `false`.
|
|
245
|
-
*/
|
|
246
|
-
readonly optional: BooleanConstructor;
|
|
247
|
-
/**
|
|
248
|
-
* The rules which this input is checked with.
|
|
249
|
-
* The rules are checked sequentially and the error of the first failed rule is displayed.
|
|
250
|
-
* If `optional` is set to false, the rule {@link required} will be checked first.
|
|
251
|
-
*/
|
|
252
|
-
readonly rules: {
|
|
253
|
-
readonly type: PropType<ValidationRule | ValidationRule[]>;
|
|
254
|
-
readonly default: () => never[];
|
|
255
|
-
};
|
|
256
|
-
/**
|
|
257
|
-
* The form, which this input will be added to.
|
|
258
|
-
* On initialization, this input will call {@link ValidatedForm.addInput} passing itself to the form.
|
|
259
|
-
*/
|
|
260
|
-
readonly form: PropType<ValidatedForm>;
|
|
261
|
-
/**
|
|
262
|
-
* Overrides the internal error state. If set to true, it will always display an error.
|
|
263
|
-
*/
|
|
264
|
-
readonly error: BooleanConstructor;
|
|
265
|
-
/**
|
|
266
|
-
* Overrides the internal error message. If set, this message is always displayed.
|
|
267
|
-
*/
|
|
268
|
-
readonly errorMessage: StringConstructor;
|
|
269
|
-
/**
|
|
270
|
-
* If set to `true` the error message is not shown.
|
|
271
|
-
* However, the input is still marked red if it is in an error state.
|
|
272
|
-
*/
|
|
273
|
-
readonly hideErrorMessage: BooleanConstructor;
|
|
274
|
-
/**
|
|
275
|
-
* Disables the validation on blur. Should only be used in special occasions.
|
|
276
|
-
*/
|
|
277
|
-
readonly disableBlurValidation: BooleanConstructor;
|
|
278
|
-
readonly tooltipText: StringConstructor;
|
|
279
|
-
readonly tooltipContent: PropType<() => JSX.Element>;
|
|
280
|
-
readonly tooltipHide: BooleanConstructor;
|
|
281
|
-
readonly tooltipShow: BooleanConstructor;
|
|
282
|
-
readonly tooltipPlacement: {
|
|
283
|
-
readonly type: PropType<import("./NTooltip").TooltipPlacement>;
|
|
284
|
-
readonly default: "auto";
|
|
285
|
-
};
|
|
286
|
-
readonly tooltipMaxWidth: {
|
|
287
|
-
readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
|
|
288
|
-
readonly default: "max-w-xs";
|
|
289
|
-
};
|
|
290
|
-
readonly tooltipWrapperClass: StringConstructor;
|
|
291
|
-
readonly tooltipContentClass: StringConstructor;
|
|
292
|
-
readonly tooltipArrowClass: StringConstructor;
|
|
293
|
-
readonly name: StringConstructor;
|
|
294
|
-
readonly placeholder: StringConstructor;
|
|
295
|
-
readonly autocomplete: {
|
|
296
|
-
readonly type: StringConstructor;
|
|
297
|
-
readonly default: "off";
|
|
298
|
-
};
|
|
299
|
-
readonly type: {
|
|
300
|
-
readonly type: StringConstructor;
|
|
301
|
-
readonly default: "text";
|
|
302
|
-
};
|
|
303
|
-
readonly max: StringConstructor;
|
|
304
|
-
readonly min: StringConstructor;
|
|
305
|
-
readonly disabled: BooleanConstructor;
|
|
306
|
-
readonly small: BooleanConstructor;
|
|
307
|
-
readonly hideLabel: BooleanConstructor;
|
|
308
|
-
readonly inputClass: StringConstructor;
|
|
309
|
-
readonly onFocus: PropType<() => void>;
|
|
310
|
-
readonly onBlur: PropType<() => void>;
|
|
311
|
-
readonly value: PropType<string>;
|
|
312
|
-
readonly onUpdateValue: PropType<(newValue: string) => void>;
|
|
313
|
-
}>> & {}, {
|
|
314
|
-
readonly small: boolean;
|
|
315
|
-
readonly type: string;
|
|
316
|
-
readonly tooltipHide: boolean;
|
|
317
|
-
readonly tooltipShow: boolean;
|
|
318
|
-
readonly tooltipPlacement: import("./NTooltip").TooltipPlacement;
|
|
319
|
-
readonly tooltipMaxWidth: import("../utils/tailwind").TWMaxWidth;
|
|
320
|
-
readonly disabled: boolean;
|
|
321
|
-
readonly error: boolean;
|
|
322
|
-
readonly autocomplete: string;
|
|
323
|
-
readonly hideLabel: boolean;
|
|
324
|
-
readonly disableValidation: boolean;
|
|
325
|
-
readonly optional: boolean;
|
|
326
|
-
readonly rules: ValidationRule | ValidationRule[];
|
|
327
|
-
readonly hideErrorMessage: boolean;
|
|
328
|
-
readonly disableBlurValidation: boolean;
|
|
329
|
-
}>;
|
|
154
|
+
declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
|
|
330
155
|
export { Component as NValInput, Component as default };
|
package/components/NValInput.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
|
2
2
|
import { createComponentWithSlots } from '../utils/component';
|
|
3
3
|
import { computed, onMounted, onUnmounted } from 'vue';
|
|
4
4
|
import { ref, reactive, watch } from 'vue';
|
package/env.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
import type { VNode } from 'vue'
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
namespace JSX {
|
|
7
|
+
interface IntrinsicElements {
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
[elem: string]: any
|
|
10
|
+
}
|
|
11
|
+
type Element = VNode
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const pluginVue = require('eslint-plugin-vue')
|
|
2
|
+
const { defineConfigWithVueTs, vueTsConfigs } = require('@vue/eslint-config-typescript')
|
|
3
|
+
const js = require('@eslint/js')
|
|
4
|
+
const prettierConfig = require('@vue/eslint-config-prettier')
|
|
5
|
+
|
|
6
|
+
require('@rushstack/eslint-patch/modern-module-resolution')
|
|
7
|
+
|
|
8
|
+
module.exports = defineConfigWithVueTs(
|
|
9
|
+
{
|
|
10
|
+
ignores: ['node_modules/**', 'dist/**', 'dist-ssr/**', 'lib/**', 'coverage/**', 'scripts/*.js'],
|
|
11
|
+
},
|
|
12
|
+
js.configs.recommended,
|
|
13
|
+
pluginVue.configs['flat/essential'],
|
|
14
|
+
vueTsConfigs.recommended,
|
|
15
|
+
prettierConfig,
|
|
16
|
+
{
|
|
17
|
+
files: ['**/*.config.js', '**/*.config.cjs'],
|
|
18
|
+
languageOptions: {
|
|
19
|
+
globals: {
|
|
20
|
+
require: 'readonly',
|
|
21
|
+
module: 'readonly',
|
|
22
|
+
__dirname: 'readonly',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
rules: {
|
|
26
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
)
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" href="/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vue Collection</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/demo/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
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.
|
|
5
|
+
"version": "0.3.0",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"dev": "vite",
|
|
13
|
-
"lint": "eslint . --
|
|
13
|
+
"lint": "eslint . --fix --ignore-pattern=.gitignore",
|
|
14
14
|
"type-check": "run-p type-check-lib type-check-demo",
|
|
15
15
|
"type-check-demo": "vue-tsc --noEmit -p tsconfig.demo.json --composite false",
|
|
16
16
|
"type-check-lib": "vue-tsc --noEmit -p tsconfig.lib.json --composite false",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"build-demo": "run-p type-check-demo build-only-demo",
|
|
19
19
|
"build-lib": "run-p type-check-lib build-only-lib",
|
|
20
20
|
"build-only-demo": "vite build",
|
|
21
|
-
"build-only-lib": "bash ./scripts/build-lib.sh"
|
|
21
|
+
"build-only-lib": "bash ./scripts/build-lib.sh",
|
|
22
|
+
"preinstall": "node ./scripts/sync-node-types.js"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@headlessui/vue": "^1.7.10",
|
|
@@ -27,36 +28,37 @@
|
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {
|
|
29
30
|
"@heroicons/vue": "^2.0.16",
|
|
30
|
-
"vue": "^3.
|
|
31
|
+
"vue": "^3.5.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@babel/cli": "^7.21.0",
|
|
34
35
|
"@babel/core": "^7.21.3",
|
|
35
|
-
"@intlify/unplugin-vue-i18n": "^0.
|
|
36
|
-
"@rushstack/eslint-patch": "^1.
|
|
36
|
+
"@intlify/unplugin-vue-i18n": "^11.0.3",
|
|
37
|
+
"@rushstack/eslint-patch": "^1.15.0",
|
|
37
38
|
"@tailwindcss/forms": "^0.5.3",
|
|
38
39
|
"@types/jsdom": "^21.1.0",
|
|
39
|
-
"@types/node": "^
|
|
40
|
-
"@vitejs/plugin-vue": "^
|
|
41
|
-
"@vitejs/plugin-vue-jsx": "^
|
|
40
|
+
"@types/node": "^24",
|
|
41
|
+
"@vitejs/plugin-vue": "^6.0.3",
|
|
42
|
+
"@vitejs/plugin-vue-jsx": "^5.1.2",
|
|
42
43
|
"@vue/babel-plugin-jsx": "^1.1.1",
|
|
43
|
-
"@vue/eslint-config-prettier": "^
|
|
44
|
-
"@vue/eslint-config-typescript": "^
|
|
44
|
+
"@vue/eslint-config-prettier": "^10.2.0",
|
|
45
|
+
"@vue/eslint-config-typescript": "^14.6.0",
|
|
45
46
|
"@vue/test-utils": "^2.3.0",
|
|
46
|
-
"@vue/tsconfig": "^0.1
|
|
47
|
+
"@vue/tsconfig": "^0.5.1",
|
|
47
48
|
"autoprefixer": "^10.4.13",
|
|
48
|
-
"eslint": "^
|
|
49
|
-
"eslint-plugin-vue": "^
|
|
49
|
+
"eslint": "^9.17.0",
|
|
50
|
+
"eslint-plugin-vue": "^10.6.2",
|
|
50
51
|
"jsdom": "^21.1.0",
|
|
51
52
|
"npm-run-all": "^4.1.5",
|
|
52
53
|
"postcss": "^8.4.21",
|
|
53
|
-
"prettier": "^
|
|
54
|
+
"prettier": "^3.0.0",
|
|
54
55
|
"tailwindcss": "^3.2.7",
|
|
55
|
-
"typescript": "
|
|
56
|
-
"vite": "^
|
|
57
|
-
"vitest": "^0.
|
|
56
|
+
"typescript": "~5.5.4",
|
|
57
|
+
"vite": "^7.3.0",
|
|
58
|
+
"vitest": "^4.0.15",
|
|
59
|
+
"vue": "^3.5.25",
|
|
58
60
|
"vue-i18n": "^9.2.2",
|
|
59
61
|
"vue-router": "^4.1.6",
|
|
60
|
-
"vue-tsc": "^
|
|
62
|
+
"vue-tsc": "^3.1.8"
|
|
61
63
|
}
|
|
62
64
|
}
|
|
Binary file
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Exit on error
|
|
3
|
+
set -e
|
|
4
|
+
# Remove lib folder
|
|
5
|
+
echo "Removing ./lib folder."
|
|
6
|
+
rm -rf ./lib
|
|
7
|
+
|
|
8
|
+
# Compile typescript code to javascript code
|
|
9
|
+
echo "Compiling typescript code with tsconfig.lib.json."
|
|
10
|
+
tsc --project tsconfig.lib.json
|
|
11
|
+
|
|
12
|
+
# Move lib two directories up
|
|
13
|
+
echo "Cleaning up ./lib directory."
|
|
14
|
+
if [ ! -d "./lib/src/lib" ]; then
|
|
15
|
+
echo "Error: ./lib/src/lib directory not found after compilation"
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
mv ./lib/src/lib/* ./lib
|
|
19
|
+
|
|
20
|
+
# Remove unused files
|
|
21
|
+
rm -rf ./lib/src
|
|
22
|
+
rm -f ./lib/tsconfig.lib.tsbuildinfo
|
|
23
|
+
|
|
24
|
+
# Move all css files from components to lib
|
|
25
|
+
echo "Copying .css files from the components folder."
|
|
26
|
+
if ls ./src/lib/components/*.css 1> /dev/null 2>&1; then
|
|
27
|
+
cp ./src/lib/components/*.css ./lib/components
|
|
28
|
+
else
|
|
29
|
+
echo "Warning: No CSS files found in ./src/lib/components/"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Transpile jsx files to js with babel
|
|
33
|
+
echo "Using Babel to transpile jsx."
|
|
34
|
+
BABEL_OUTPUT=$(./node_modules/.bin/babel lib --out-dir lib 2>&1)
|
|
35
|
+
BABEL_EXIT_CODE=$?
|
|
36
|
+
echo "$BABEL_OUTPUT"
|
|
37
|
+
|
|
38
|
+
# Check if Babel command succeeded
|
|
39
|
+
if [ $BABEL_EXIT_CODE -ne 0 ]; then
|
|
40
|
+
echo "Error: Babel transpilation failed with exit code $BABEL_EXIT_CODE"
|
|
41
|
+
exit $BABEL_EXIT_CODE
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# Optionally, check if any .js files were produced
|
|
45
|
+
if ! find ./lib -name "*.js" -type f | grep -q .; then
|
|
46
|
+
echo "Error: No .js files produced by Babel transpilation"
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
find ./lib -name "*.jsx" -type f -delete
|
|
51
|
+
|
|
52
|
+
echo "Build completed successfully!"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
|
|
6
|
+
const rootDir = path.join(__dirname, '..')
|
|
7
|
+
const nvmrcPath = path.join(rootDir, '.nvmrc')
|
|
8
|
+
const packageJsonPath = path.join(rootDir, 'package.json')
|
|
9
|
+
|
|
10
|
+
// Read .nvmrc
|
|
11
|
+
if (!fs.existsSync(nvmrcPath)) {
|
|
12
|
+
console.error('Error: .nvmrc file not found')
|
|
13
|
+
process.exit(1)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const nvmrcContent = fs.readFileSync(nvmrcPath, 'utf8').trim()
|
|
17
|
+
|
|
18
|
+
// Extract major version from .nvmrc
|
|
19
|
+
// Supports formats like: "24", "v24", "24.12.0", "lts/iron", etc.
|
|
20
|
+
let nodeMajorVersion
|
|
21
|
+
|
|
22
|
+
if (nvmrcContent.startsWith('lts/')) {
|
|
23
|
+
// Map LTS names to major versions
|
|
24
|
+
const ltsMap = {
|
|
25
|
+
krypton: '24',
|
|
26
|
+
jod: '22',
|
|
27
|
+
iron: '20',
|
|
28
|
+
hydrogen: '18',
|
|
29
|
+
gallium: '16',
|
|
30
|
+
fermium: '14',
|
|
31
|
+
}
|
|
32
|
+
const ltsName = nvmrcContent.replace('lts/', '').toLowerCase()
|
|
33
|
+
nodeMajorVersion = ltsMap[ltsName]
|
|
34
|
+
if (!nodeMajorVersion) {
|
|
35
|
+
console.error(`Error: Unknown LTS name "${ltsName}"`)
|
|
36
|
+
process.exit(1)
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
// Extract numeric version
|
|
40
|
+
const versionMatch = nvmrcContent.match(/^v?(\d+)/)
|
|
41
|
+
if (!versionMatch) {
|
|
42
|
+
console.error(`Error: Could not extract Node version from .nvmrc: "${nvmrcContent}"`)
|
|
43
|
+
process.exit(1)
|
|
44
|
+
}
|
|
45
|
+
nodeMajorVersion = versionMatch[1]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log(`Node version from .nvmrc: ${nodeMajorVersion}`)
|
|
49
|
+
|
|
50
|
+
// Read package.json
|
|
51
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
|
52
|
+
|
|
53
|
+
// Check current @types/node version
|
|
54
|
+
const currentTypesNode = packageJson.devDependencies?.['@types/node']
|
|
55
|
+
const desiredTypesNode = `^${nodeMajorVersion}`
|
|
56
|
+
|
|
57
|
+
if (currentTypesNode === desiredTypesNode) {
|
|
58
|
+
console.log(`✓ @types/node is already set to ${desiredTypesNode}`)
|
|
59
|
+
process.exit(0)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
console.log(`Updating @types/node from ${currentTypesNode} to ${desiredTypesNode}`)
|
|
63
|
+
|
|
64
|
+
// Update package.json
|
|
65
|
+
packageJson.devDependencies['@types/node'] = desiredTypesNode
|
|
66
|
+
|
|
67
|
+
// Write back to package.json
|
|
68
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf8')
|
|
69
|
+
|
|
70
|
+
console.log('✓ package.json updated. Run `npm install` to install the correct @types/node version.')
|
package/src/demo/App.css
ADDED
package/src/demo/App.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createComponent } from '@/lib/utils/component'
|
|
2
|
+
import { computed, type PropType } from 'vue'
|
|
3
|
+
import ComponentGrid, { componentGridProps } from '@/demo/components/ComponentGrid'
|
|
4
|
+
|
|
5
|
+
export const colorGridProps = {
|
|
6
|
+
...componentGridProps,
|
|
7
|
+
colors: {
|
|
8
|
+
type: Number,
|
|
9
|
+
default: 6,
|
|
10
|
+
},
|
|
11
|
+
item: Function as PropType<(color: string, index: number) => JSX.Element>,
|
|
12
|
+
} as const
|
|
13
|
+
|
|
14
|
+
export default createComponent('ColorGrid', colorGridProps, props => {
|
|
15
|
+
const colors = ['primary', 'secondary', 'green', 'red', 'yellow', 'default']
|
|
16
|
+
|
|
17
|
+
const selectedColors = computed(() => colors.slice(0, props.colors))
|
|
18
|
+
|
|
19
|
+
return () => (
|
|
20
|
+
<ComponentGrid cols={props.cols}>
|
|
21
|
+
{selectedColors.value.map((color, index) => (
|
|
22
|
+
<div class="flex">{props.item?.(color, index)}</div>
|
|
23
|
+
))}
|
|
24
|
+
</ComponentGrid>
|
|
25
|
+
)
|
|
26
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createComponent } from '@/lib/utils/component'
|
|
2
|
+
import { computed, type PropType } from 'vue'
|
|
3
|
+
|
|
4
|
+
export const componentGridProps = {
|
|
5
|
+
cols: {
|
|
6
|
+
type: Number as PropType<2 | 4 | 6 | 8>,
|
|
7
|
+
default: 6,
|
|
8
|
+
},
|
|
9
|
+
} as const
|
|
10
|
+
|
|
11
|
+
export default createComponent('ComponentGrid', componentGridProps, (props, { slots }) => {
|
|
12
|
+
const classes = computed(() => {
|
|
13
|
+
switch (props.cols) {
|
|
14
|
+
case 2:
|
|
15
|
+
return 'grid-cols-1 sm:grid-cols-2'
|
|
16
|
+
case 4:
|
|
17
|
+
return 'grid-cols-2 sm:grid-cols-4'
|
|
18
|
+
case 8:
|
|
19
|
+
return 'grid-cols-4 sm:grid-cols-8'
|
|
20
|
+
default:
|
|
21
|
+
return 'grid-cols-3 sm:grid-cols-6'
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
return () => <div class={`grid gap-4 ${classes.value}`}>{slots.default?.()}</div>
|
|
26
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createComponent } from '@/lib/utils/component'
|
|
2
|
+
import { LinkIcon } from '@heroicons/vue/24/solid'
|
|
3
|
+
import { RouterLink } from 'vue-router'
|
|
4
|
+
|
|
5
|
+
export const componentSectionProps = {
|
|
6
|
+
id: String,
|
|
7
|
+
title: String,
|
|
8
|
+
subtitle: String,
|
|
9
|
+
} as const
|
|
10
|
+
|
|
11
|
+
export default createComponent('ComponentSection', componentSectionProps, (props, { slots }) => {
|
|
12
|
+
return () => (
|
|
13
|
+
<div class="border-b-2 border-default-200" id={props.id}>
|
|
14
|
+
<div>
|
|
15
|
+
<div class="px-8 py-10 max-w-4xl mx-auto">
|
|
16
|
+
<RouterLink to={{ hash: props.id ? `#${props.id}` : undefined }} class="group outline-none">
|
|
17
|
+
<h2 class="font-bold text-4xl mb-2 flex items-center space-x-2 ">
|
|
18
|
+
<span>{props.title}</span>
|
|
19
|
+
<LinkIcon class="h-8 w-8 text-default-900 opacity-30 hidden group-hover:block group-focus-visible:block" />
|
|
20
|
+
</h2>
|
|
21
|
+
</RouterLink>
|
|
22
|
+
<p class="text-default-500 text-xl font-light">{props.subtitle}</p>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="bg-default-50">
|
|
26
|
+
<div class="px-8 pt-10 pb-20 space-y-8 max-w-4xl mx-auto">{slots.default?.()}</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
)
|
|
30
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createComponent } from '@/lib/utils/component'
|
|
2
|
+
|
|
3
|
+
export const variantSectionProps = {
|
|
4
|
+
title: String,
|
|
5
|
+
subtitle: String,
|
|
6
|
+
} as const
|
|
7
|
+
|
|
8
|
+
export default createComponent('VariantSection', variantSectionProps, (props, { slots }) => {
|
|
9
|
+
return () => (
|
|
10
|
+
<div>
|
|
11
|
+
<div class="mb-6">
|
|
12
|
+
<h3 class="text-lg font-medium text-default-700"> {props.title} </h3>
|
|
13
|
+
{props.subtitle && <p class="text-default-500 text-sm"> {props.subtitle} </p>}
|
|
14
|
+
</div>
|
|
15
|
+
<div class="border-2 border-dashed rounded-lg p-8 border-default-200 bg-white">{slots.default?.()}</div>
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import en from './en'
|
|
2
|
+
import de from './de'
|
|
3
|
+
import { createI18n } from 'vue-i18n'
|
|
4
|
+
import { registerTranslationProvider } from '@/lib/i18n'
|
|
5
|
+
|
|
6
|
+
export const i18n = createI18n({
|
|
7
|
+
legacy: false,
|
|
8
|
+
locale: 'en',
|
|
9
|
+
messages: {
|
|
10
|
+
en,
|
|
11
|
+
de,
|
|
12
|
+
},
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
registerTranslationProvider({
|
|
16
|
+
trsl(key, params) {
|
|
17
|
+
return i18n.global.t(key, params == null ? {} : params)
|
|
18
|
+
},
|
|
19
|
+
trslc(key, count, params) {
|
|
20
|
+
const newCount = count ?? 0
|
|
21
|
+
const newParams = { n: newCount, ...params }
|
|
22
|
+
return i18n.global.t(key, newParams, { plural: newCount })
|
|
23
|
+
},
|
|
24
|
+
})
|