@naptics/vue-collection 0.3.1 → 1.0.0-beta.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.
- package/eslint.config.cjs +0 -2
- package/package.json +32 -31
- package/postcss.config.js +1 -4
- package/src/demo/App.css +47 -3
- package/src/demo/components/ComponentSection.tsx +1 -1
- package/src/demo/views/NavigationView.tsx +1 -1
- package/src/demo/views/presentation/TooltipView.tsx +8 -2
- package/src/lib/components/NAlert.tsx +3 -3
- package/src/lib/components/NBadge.tsx +1 -1
- package/src/lib/components/NButton.tsx +6 -4
- package/src/lib/components/NCheckbox.tsx +2 -2
- package/src/lib/components/NDialog.tsx +2 -2
- package/src/lib/components/NDropdown.tsx +11 -9
- package/src/lib/components/NDropzone.tsx +4 -4
- package/src/lib/components/NIconButton.tsx +2 -2
- package/src/lib/components/NInput.tsx +1 -1
- package/src/lib/components/NLink.tsx +1 -1
- package/src/lib/components/NModal.tsx +4 -4
- package/src/lib/components/NPagination.css +4 -2
- package/src/lib/components/NPagination.tsx +1 -1
- package/src/lib/components/NSearchbar.tsx +1 -1
- package/src/lib/components/NSelect.tsx +1 -1
- package/src/lib/components/NSuggestionList.tsx +1 -1
- package/src/lib/components/NTable.css +2 -0
- package/src/lib/components/NTableAction.tsx +1 -1
- package/src/lib/components/NTextArea.tsx +1 -1
- package/src/lib/components/NTooltip.css +2 -0
- package/src/lib/components/NTooltip.tsx +42 -3
- package/src/lib/utils/component.tsx +1 -1
- package/tsconfig.lib.json +1 -0
- package/vite.config.ts +2 -0
- package/components/NAlert.d.ts +0 -29
- package/components/NAlert.js +0 -84
- package/components/NBadge.d.ts +0 -69
- package/components/NBadge.js +0 -64
- package/components/NBreadcrub.d.ts +0 -69
- package/components/NBreadcrub.js +0 -71
- package/components/NButton.d.ts +0 -60
- package/components/NButton.js +0 -72
- package/components/NCheckbox.d.ts +0 -20
- package/components/NCheckbox.js +0 -43
- package/components/NCheckboxLabel.d.ts +0 -26
- package/components/NCheckboxLabel.js +0 -42
- package/components/NCrudModal.d.ts +0 -118
- package/components/NCrudModal.js +0 -120
- package/components/NDialog.d.ts +0 -81
- package/components/NDialog.js +0 -161
- package/components/NDropdown.d.ts +0 -67
- package/components/NDropdown.js +0 -115
- package/components/NDropzone.d.ts +0 -61
- package/components/NDropzone.js +0 -218
- package/components/NForm.d.ts +0 -21
- package/components/NForm.js +0 -29
- package/components/NFormModal.d.ts +0 -75
- package/components/NFormModal.js +0 -59
- package/components/NIconButton.d.ts +0 -79
- package/components/NIconButton.js +0 -88
- package/components/NIconCircle.d.ts +0 -49
- package/components/NIconCircle.js +0 -67
- package/components/NInput.css +0 -11
- package/components/NInput.d.ts +0 -90
- package/components/NInput.js +0 -110
- package/components/NInputPhone.d.ts +0 -54
- package/components/NInputPhone.js +0 -47
- package/components/NInputSelect.d.ts +0 -99
- package/components/NInputSelect.js +0 -115
- package/components/NInputSuggestion.d.ts +0 -75
- package/components/NInputSuggestion.js +0 -64
- package/components/NLink.d.ts +0 -47
- package/components/NLink.js +0 -67
- package/components/NList.d.ts +0 -37
- package/components/NList.js +0 -40
- package/components/NLoadingIndicator.css +0 -46
- package/components/NLoadingIndicator.d.ts +0 -29
- package/components/NLoadingIndicator.js +0 -54
- package/components/NModal.d.ts +0 -133
- package/components/NModal.js +0 -232
- package/components/NPagination.css +0 -15
- package/components/NPagination.d.ts +0 -37
- package/components/NPagination.js +0 -105
- package/components/NSearchbar.d.ts +0 -39
- package/components/NSearchbar.js +0 -64
- package/components/NSearchbarList.d.ts +0 -33
- package/components/NSearchbarList.js +0 -41
- package/components/NSelect.d.ts +0 -78
- package/components/NSelect.js +0 -101
- package/components/NSuggestionList.d.ts +0 -153
- package/components/NSuggestionList.js +0 -160
- package/components/NTable.css +0 -3
- package/components/NTable.d.ts +0 -97
- package/components/NTable.js +0 -128
- package/components/NTableAction.d.ts +0 -30
- package/components/NTableAction.js +0 -50
- package/components/NTextArea.d.ts +0 -92
- package/components/NTextArea.js +0 -133
- package/components/NTooltip.css +0 -37
- package/components/NTooltip.d.ts +0 -136
- package/components/NTooltip.js +0 -207
- package/components/NValInput.d.ts +0 -155
- package/components/NValInput.js +0 -113
- package/components/ValidatedForm.d.ts +0 -39
- package/components/ValidatedForm.js +0 -35
- package/i18n/de/vue-collection.json +0 -58
- package/i18n/en/vue-collection.json +0 -58
- package/i18n/index.d.ts +0 -40
- package/i18n/index.js +0 -31
- package/index.d.ts +0 -2
- package/index.js +0 -2
- package/tailwind.config.js +0 -38
- package/utils/breakpoints.d.ts +0 -18
- package/utils/breakpoints.js +0 -40
- package/utils/component.d.ts +0 -57
- package/utils/component.js +0 -79
- package/utils/deferred.d.ts +0 -13
- package/utils/deferred.js +0 -17
- package/utils/identifiable.d.ts +0 -56
- package/utils/identifiable.js +0 -81
- package/utils/stringMaxLength.d.ts +0 -14
- package/utils/stringMaxLength.js +0 -23
- package/utils/tailwind.d.ts +0 -4
- package/utils/tailwind.js +0 -1
- package/utils/utils.d.ts +0 -47
- package/utils/utils.js +0 -56
- package/utils/vModel.d.ts +0 -182
- package/utils/vModel.js +0 -224
- package/utils/validation.d.ts +0 -90
- package/utils/validation.js +0 -147
- package/utils/vue.d.ts +0 -13
- package/utils/vue.js +0 -21
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
|
2
|
-
import { createComponentWithSlots } from '../utils/component';
|
|
3
|
-
import { Id } from '../utils/identifiable';
|
|
4
|
-
import { option } from '../utils/validation';
|
|
5
|
-
import { vModelForRef } from '../utils/vModel';
|
|
6
|
-
import { watchRef } from '../utils/vue';
|
|
7
|
-
import { computed, ref, watch } from 'vue';
|
|
8
|
-
import { nInputProps } from './NInput';
|
|
9
|
-
import NSuggestionList, { nSuggestionListProps } from './NSuggestionList';
|
|
10
|
-
import NValInput, { nValInputProps } from './NValInput';
|
|
11
|
-
export const nInputSelectProps = {
|
|
12
|
-
...nInputProps,
|
|
13
|
-
/**
|
|
14
|
-
* The id of the currently selected option of this input.
|
|
15
|
-
*/
|
|
16
|
-
value: String,
|
|
17
|
-
/**
|
|
18
|
-
* This is called with the newly selected id when the selection has changed.
|
|
19
|
-
* This happens, when an item from the suggestion list is selected or the
|
|
20
|
-
* input matches a selection option exactly.
|
|
21
|
-
* If no id is selected, the empty string is passed, in order to
|
|
22
|
-
* match the API of all other inputs who never pass `undefined`.
|
|
23
|
-
*/
|
|
24
|
-
onUpdateValue: Function,
|
|
25
|
-
/**
|
|
26
|
-
* The options which are allowed and suggested for this input.
|
|
27
|
-
* The options are filtered based on the user input.
|
|
28
|
-
*/
|
|
29
|
-
options: {
|
|
30
|
-
type: Array,
|
|
31
|
-
default: () => []
|
|
32
|
-
},
|
|
33
|
-
/**
|
|
34
|
-
* @see {@link nValInputProps.optional}
|
|
35
|
-
*/
|
|
36
|
-
optional: nValInputProps.optional,
|
|
37
|
-
/**
|
|
38
|
-
* @see {@link nValInputProps.form}
|
|
39
|
-
*/
|
|
40
|
-
form: nValInputProps.form,
|
|
41
|
-
/**
|
|
42
|
-
* @see {@link nValInputProps.error}
|
|
43
|
-
*/
|
|
44
|
-
error: nValInputProps.error,
|
|
45
|
-
/**
|
|
46
|
-
* @see {@link nValInputProps.errorMessage}
|
|
47
|
-
*/
|
|
48
|
-
errorMessage: nValInputProps.errorMessage,
|
|
49
|
-
/**
|
|
50
|
-
* If set to `true` the list is hidden even if there are still matching items in the list.
|
|
51
|
-
*/
|
|
52
|
-
hideList: nSuggestionListProps.hideList,
|
|
53
|
-
/**
|
|
54
|
-
* @see {@link nSuggestionListProps.maxItems}
|
|
55
|
-
*/
|
|
56
|
-
maxItems: nSuggestionListProps.maxItems,
|
|
57
|
-
/**
|
|
58
|
-
* @see {@link nSuggestionListProps.listItem}
|
|
59
|
-
*/
|
|
60
|
-
listItem: nSuggestionListProps.listItem
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* The `NInputSelect` is very similar to the {@link NSelect}, but instead of a select input it is a regular input.
|
|
64
|
-
* The user is forced to use a value from the specified options of the input.
|
|
65
|
-
* While they type, the list of options is shown to them and filtered based on their input.
|
|
66
|
-
*/
|
|
67
|
-
const Component = createComponentWithSlots('NInputSelect', nInputSelectProps, ['listItem'], props => {
|
|
68
|
-
const inputRef = ref();
|
|
69
|
-
const inputValue = ref('');
|
|
70
|
-
watch(() => props.value, newValue => {
|
|
71
|
-
if (newValue) {
|
|
72
|
-
const chosenOption = Id.find(props.options, newValue);
|
|
73
|
-
if (chosenOption) inputValue.value = chosenOption.label;
|
|
74
|
-
}
|
|
75
|
-
}, {
|
|
76
|
-
immediate: true
|
|
77
|
-
});
|
|
78
|
-
const filteredOptions = computed(() => props.options.filter(option => option.label.includes(inputValue.value || '')));
|
|
79
|
-
const matchedOption = computed(() => {
|
|
80
|
-
const matches = props.options.filter(option => option.label === inputValue.value);
|
|
81
|
-
return matches.length > 0 ? matches[0] : null;
|
|
82
|
-
});
|
|
83
|
-
watchRef(matchedOption, newOption => props.onUpdateValue?.(newOption?.id || ''));
|
|
84
|
-
return () => _createVNode(NSuggestionList, {
|
|
85
|
-
"items": filteredOptions.value,
|
|
86
|
-
"onSelect": props.onUpdateValue,
|
|
87
|
-
"inputValue": inputValue.value,
|
|
88
|
-
"hideList": props.hideList || matchedOption.value != null || filteredOptions.value.length == 0,
|
|
89
|
-
"maxItems": props.maxItems,
|
|
90
|
-
"listItem": props.listItem,
|
|
91
|
-
"input": ({
|
|
92
|
-
onFocus,
|
|
93
|
-
onBlur
|
|
94
|
-
}) => _createVNode(NValInput, _mergeProps({
|
|
95
|
-
"ref": inputRef
|
|
96
|
-
}, {
|
|
97
|
-
...props,
|
|
98
|
-
...vModelForRef(inputValue)
|
|
99
|
-
}, {
|
|
100
|
-
"rules": option(props.options.map(opt => opt.label)),
|
|
101
|
-
"onFocus": () => {
|
|
102
|
-
onFocus();
|
|
103
|
-
props.onFocus?.();
|
|
104
|
-
},
|
|
105
|
-
"onBlur": onBlur,
|
|
106
|
-
"disableBlurValidation": true
|
|
107
|
-
}), null),
|
|
108
|
-
"onRequestInputFocus": () => inputRef.value?.focus(),
|
|
109
|
-
"onRealBlur": () => {
|
|
110
|
-
props.onBlur?.();
|
|
111
|
-
inputRef?.value?.validate();
|
|
112
|
-
}
|
|
113
|
-
}, null);
|
|
114
|
-
});
|
|
115
|
-
export { Component as NInputSelect, Component as default };
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { type PropType } from 'vue';
|
|
2
|
-
export declare const nInputSuggestionProps: {
|
|
3
|
-
/**
|
|
4
|
-
* If set to `true` the list is hidden even if there are still matching items in the list.
|
|
5
|
-
*/
|
|
6
|
-
readonly hideList: BooleanConstructor;
|
|
7
|
-
/**
|
|
8
|
-
* @see {@link nSuggestionListProps.maxItems}
|
|
9
|
-
*/
|
|
10
|
-
readonly maxItems: {
|
|
11
|
-
readonly type: NumberConstructor;
|
|
12
|
-
readonly default: () => number;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* The suggestions which are shown to the user for this input.
|
|
16
|
-
* The suggestions are filtered based on the user input.
|
|
17
|
-
*/
|
|
18
|
-
readonly suggestions: {
|
|
19
|
-
readonly type: PropType<string[]>;
|
|
20
|
-
readonly default: () => never[];
|
|
21
|
-
};
|
|
22
|
-
readonly input: PropType<(props: import("./NValInput").InputSlotProps) => JSX.Element>;
|
|
23
|
-
readonly disableValidation: BooleanConstructor;
|
|
24
|
-
readonly optional: BooleanConstructor;
|
|
25
|
-
readonly rules: {
|
|
26
|
-
readonly type: PropType<import("../utils/validation").ValidationRule[] | import("../utils/validation").ValidationRule>;
|
|
27
|
-
readonly default: () => never[];
|
|
28
|
-
};
|
|
29
|
-
readonly form: PropType<import("./ValidatedForm").ValidatedForm>;
|
|
30
|
-
readonly error: BooleanConstructor;
|
|
31
|
-
readonly errorMessage: StringConstructor;
|
|
32
|
-
readonly hideErrorMessage: BooleanConstructor;
|
|
33
|
-
readonly disableBlurValidation: BooleanConstructor;
|
|
34
|
-
readonly tooltipText: StringConstructor;
|
|
35
|
-
readonly tooltipContent: PropType<() => JSX.Element>;
|
|
36
|
-
readonly tooltipHide: BooleanConstructor;
|
|
37
|
-
readonly tooltipShow: BooleanConstructor;
|
|
38
|
-
readonly tooltipPlacement: {
|
|
39
|
-
readonly type: PropType<import("./NTooltip").TooltipPlacement>;
|
|
40
|
-
readonly default: "auto";
|
|
41
|
-
};
|
|
42
|
-
readonly tooltipMaxWidth: {
|
|
43
|
-
readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
|
|
44
|
-
readonly default: "max-w-xs";
|
|
45
|
-
};
|
|
46
|
-
readonly tooltipWrapperClass: StringConstructor;
|
|
47
|
-
readonly tooltipContentClass: StringConstructor;
|
|
48
|
-
readonly tooltipArrowClass: StringConstructor;
|
|
49
|
-
readonly name: StringConstructor;
|
|
50
|
-
readonly placeholder: StringConstructor;
|
|
51
|
-
readonly autocomplete: {
|
|
52
|
-
readonly type: StringConstructor;
|
|
53
|
-
readonly default: "off";
|
|
54
|
-
};
|
|
55
|
-
readonly type: {
|
|
56
|
-
readonly type: StringConstructor;
|
|
57
|
-
readonly default: "text";
|
|
58
|
-
};
|
|
59
|
-
readonly max: StringConstructor;
|
|
60
|
-
readonly min: StringConstructor;
|
|
61
|
-
readonly disabled: BooleanConstructor;
|
|
62
|
-
readonly small: BooleanConstructor;
|
|
63
|
-
readonly hideLabel: BooleanConstructor;
|
|
64
|
-
readonly inputClass: StringConstructor;
|
|
65
|
-
readonly onFocus: PropType<() => void>;
|
|
66
|
-
readonly onBlur: PropType<() => void>;
|
|
67
|
-
readonly value: PropType<string>;
|
|
68
|
-
readonly onUpdateValue: PropType<(newValue: string) => void>;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* `NInputSuggestion` is an input, which shows a list of possible suggestions to the user
|
|
72
|
-
* which is filtered while typing. Contrary to {@link NInputSelect} the user is not required to choose any of the suggestions.
|
|
73
|
-
*/
|
|
74
|
-
declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
|
|
75
|
-
export { Component as NInputSuggestion, Component as default };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
|
2
|
-
import { createComponent } from '../utils/component';
|
|
3
|
-
import { Id } from '../utils/identifiable';
|
|
4
|
-
import { computed, ref } from 'vue';
|
|
5
|
-
import NSuggestionList, { nSuggestionListProps } from './NSuggestionList';
|
|
6
|
-
import NValInput, { nValInputProps } from './NValInput';
|
|
7
|
-
export const nInputSuggestionProps = {
|
|
8
|
-
...nValInputProps,
|
|
9
|
-
/**
|
|
10
|
-
* If set to `true` the list is hidden even if there are still matching items in the list.
|
|
11
|
-
*/
|
|
12
|
-
hideList: nSuggestionListProps.hideList,
|
|
13
|
-
/**
|
|
14
|
-
* @see {@link nSuggestionListProps.maxItems}
|
|
15
|
-
*/
|
|
16
|
-
maxItems: nSuggestionListProps.maxItems,
|
|
17
|
-
/**
|
|
18
|
-
* The suggestions which are shown to the user for this input.
|
|
19
|
-
* The suggestions are filtered based on the user input.
|
|
20
|
-
*/
|
|
21
|
-
suggestions: {
|
|
22
|
-
type: Array,
|
|
23
|
-
default: () => []
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* `NInputSuggestion` is an input, which shows a list of possible suggestions to the user
|
|
28
|
-
* which is filtered while typing. Contrary to {@link NInputSelect} the user is not required to choose any of the suggestions.
|
|
29
|
-
*/
|
|
30
|
-
const Component = createComponent('NInputSuggestion', nInputSuggestionProps, props => {
|
|
31
|
-
const suggestionItems = computed(() => props.suggestions.filter(suggestion => suggestion.includes(props.value || '')).map((value, index) => ({
|
|
32
|
-
id: index.toString(),
|
|
33
|
-
label: value
|
|
34
|
-
})));
|
|
35
|
-
const select = id => props.onUpdateValue?.(Id.find(suggestionItems.value, id)?.label || '');
|
|
36
|
-
const hideList = computed(() => props.hideList || suggestionItems.value.length == 0 || suggestionItems.value.filter(suggestion => suggestion.label !== props.value).length == 0);
|
|
37
|
-
const inputRef = ref();
|
|
38
|
-
return () => _createVNode(NSuggestionList, {
|
|
39
|
-
"items": suggestionItems.value,
|
|
40
|
-
"onSelect": id => select(id),
|
|
41
|
-
"inputValue": props.value || '',
|
|
42
|
-
"hideList": hideList.value,
|
|
43
|
-
"maxItems": props.maxItems,
|
|
44
|
-
"input": ({
|
|
45
|
-
onFocus,
|
|
46
|
-
onBlur
|
|
47
|
-
}) => _createVNode(NValInput, _mergeProps({
|
|
48
|
-
"ref": inputRef
|
|
49
|
-
}, props, {
|
|
50
|
-
"onFocus": () => {
|
|
51
|
-
onFocus();
|
|
52
|
-
props.onFocus?.();
|
|
53
|
-
},
|
|
54
|
-
"onBlur": onBlur,
|
|
55
|
-
"disableBlurValidation": true
|
|
56
|
-
}), null),
|
|
57
|
-
"onRequestInputFocus": () => inputRef.value?.focus(),
|
|
58
|
-
"onRealBlur": () => {
|
|
59
|
-
props.onBlur?.();
|
|
60
|
-
inputRef?.value?.validate();
|
|
61
|
-
}
|
|
62
|
-
}, null);
|
|
63
|
-
});
|
|
64
|
-
export { Component as NInputSuggestion, Component as default };
|
package/components/NLink.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { TWTextSize } from '../utils/tailwind';
|
|
2
|
-
import { type PropType } from 'vue';
|
|
3
|
-
import { type RouteLocationRaw } from 'vue-router';
|
|
4
|
-
export declare const nLinkProps: {
|
|
5
|
-
/**
|
|
6
|
-
* The text of the link. Can also be set in the default slot.
|
|
7
|
-
*/
|
|
8
|
-
readonly text: StringConstructor;
|
|
9
|
-
/**
|
|
10
|
-
* The route of the link. If this is set,
|
|
11
|
-
* the link becomes a {@link RouterLink} and does not emit the `onClick` event.
|
|
12
|
-
*/
|
|
13
|
-
readonly route: PropType<RouteLocationRaw>;
|
|
14
|
-
/**
|
|
15
|
-
* The color of the link.
|
|
16
|
-
*/
|
|
17
|
-
readonly color: {
|
|
18
|
-
readonly type: StringConstructor;
|
|
19
|
-
readonly default: "primary";
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* The text size, a standard tailwind text-size class.
|
|
23
|
-
*/
|
|
24
|
-
readonly textSize: PropType<TWTextSize>;
|
|
25
|
-
/**
|
|
26
|
-
* The shade of the link.
|
|
27
|
-
*/
|
|
28
|
-
readonly shade: {
|
|
29
|
-
readonly type: NumberConstructor;
|
|
30
|
-
readonly default: 500;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* If set to `true` the link is disabled and no interaction is possible.
|
|
34
|
-
* Note: If the `route` prop is set, the link will still be clickable, because it becomes a {@link RouterLink}.
|
|
35
|
-
*/
|
|
36
|
-
readonly disabled: BooleanConstructor;
|
|
37
|
-
/**
|
|
38
|
-
* This is called when the link is clicked but only, if the `route` prop is not set.
|
|
39
|
-
* If the `route` prop is not set, the link will act as a regular button.
|
|
40
|
-
*/
|
|
41
|
-
readonly onClick: PropType<() => void>;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* The `NLink` is a styled text which can be used as a {@link RouterLink} or a regular button.
|
|
45
|
-
*/
|
|
46
|
-
declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
|
|
47
|
-
export { Component as NLink, Component as default };
|
package/components/NLink.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { createVNode as _createVNode } from "vue";
|
|
2
|
-
import { createComponent } from '../utils/component';
|
|
3
|
-
import { computed } from 'vue';
|
|
4
|
-
import { RouterLink } from 'vue-router';
|
|
5
|
-
export const nLinkProps = {
|
|
6
|
-
/**
|
|
7
|
-
* The text of the link. Can also be set in the default slot.
|
|
8
|
-
*/
|
|
9
|
-
text: String,
|
|
10
|
-
/**
|
|
11
|
-
* The route of the link. If this is set,
|
|
12
|
-
* the link becomes a {@link RouterLink} and does not emit the `onClick` event.
|
|
13
|
-
*/
|
|
14
|
-
route: [Object, String],
|
|
15
|
-
/**
|
|
16
|
-
* The color of the link.
|
|
17
|
-
*/
|
|
18
|
-
color: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: 'primary'
|
|
21
|
-
},
|
|
22
|
-
/**
|
|
23
|
-
* The text size, a standard tailwind text-size class.
|
|
24
|
-
*/
|
|
25
|
-
textSize: String,
|
|
26
|
-
/**
|
|
27
|
-
* The shade of the link.
|
|
28
|
-
*/
|
|
29
|
-
shade: {
|
|
30
|
-
type: Number,
|
|
31
|
-
default: 500
|
|
32
|
-
},
|
|
33
|
-
/**
|
|
34
|
-
* If set to `true` the link is disabled and no interaction is possible.
|
|
35
|
-
* Note: If the `route` prop is set, the link will still be clickable, because it becomes a {@link RouterLink}.
|
|
36
|
-
*/
|
|
37
|
-
disabled: Boolean,
|
|
38
|
-
/**
|
|
39
|
-
* This is called when the link is clicked but only, if the `route` prop is not set.
|
|
40
|
-
* If the `route` prop is not set, the link will act as a regular button.
|
|
41
|
-
*/
|
|
42
|
-
onClick: Function
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* The `NLink` is a styled text which can be used as a {@link RouterLink} or a regular button.
|
|
46
|
-
*/
|
|
47
|
-
const Component = createComponent('NLink', nLinkProps, (props, {
|
|
48
|
-
slots
|
|
49
|
-
}) => {
|
|
50
|
-
const hoverShade = computed(() => {
|
|
51
|
-
const shade = props.shade;
|
|
52
|
-
if (shade <= 500) return shade + 100;else return shade - 200;
|
|
53
|
-
});
|
|
54
|
-
const classes = computed(() => ['font-medium focus:outline-none focus-visible:ring-2 rounded-sm ring-offset-2 hover:underline text-left', `${props.textSize} text-${props.color}-${props.shade} hover:text-${props.color}-${hoverShade.value} focus-visible:ring-${props.color}-${props.shade}`]);
|
|
55
|
-
const disabledClasses = computed(() => ['font-medium text-left cursor-not-allowed', `${props.textSize} text-${props.color}-200`]);
|
|
56
|
-
return () => props.route ? _createVNode(RouterLink, {
|
|
57
|
-
"to": props.route,
|
|
58
|
-
"class": classes.value
|
|
59
|
-
}, {
|
|
60
|
-
default: () => [slots.default?.() || props.text]
|
|
61
|
-
}) : _createVNode("button", {
|
|
62
|
-
"onClick": props.onClick,
|
|
63
|
-
"class": props.disabled ? disabledClasses.value : classes.value,
|
|
64
|
-
"disabled": props.disabled
|
|
65
|
-
}, [slots.default?.() || props.text]);
|
|
66
|
-
});
|
|
67
|
-
export { Component as NLink, Component as default };
|
package/components/NList.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { PropType } from 'vue';
|
|
2
|
-
export type ListItem = {
|
|
3
|
-
/**
|
|
4
|
-
* The title of the item. Accepts either string or a function returning a JSX element.
|
|
5
|
-
*/
|
|
6
|
-
title: string | (() => JSX.Element);
|
|
7
|
-
/**
|
|
8
|
-
* The text of the item. Accepts either string or a function returning a JSX element.
|
|
9
|
-
*/
|
|
10
|
-
text?: string | (() => JSX.Element);
|
|
11
|
-
};
|
|
12
|
-
export declare const nListProps: {
|
|
13
|
-
/**
|
|
14
|
-
* The items which are displayed in the list.
|
|
15
|
-
*/
|
|
16
|
-
readonly items: {
|
|
17
|
-
readonly type: PropType<ListItem[]>;
|
|
18
|
-
readonly default: () => never[];
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Adds the classes to all title elements (on the left side).
|
|
22
|
-
*/
|
|
23
|
-
readonly titleClass: StringConstructor;
|
|
24
|
-
/**
|
|
25
|
-
* Adds the classes to all text elements (on the right side).
|
|
26
|
-
*/
|
|
27
|
-
readonly textClass: StringConstructor;
|
|
28
|
-
/**
|
|
29
|
-
* Adds the classes to each row.
|
|
30
|
-
*/
|
|
31
|
-
readonly rowClass: StringConstructor;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* The `NList` displays key-value data in an appealing way.
|
|
35
|
-
*/
|
|
36
|
-
declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
|
|
37
|
-
export { Component as NList, Component as default };
|
package/components/NList.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { createVNode as _createVNode, Fragment as _Fragment } from "vue";
|
|
2
|
-
import { createComponent } from '../utils/component';
|
|
3
|
-
export const nListProps = {
|
|
4
|
-
/**
|
|
5
|
-
* The items which are displayed in the list.
|
|
6
|
-
*/
|
|
7
|
-
items: {
|
|
8
|
-
type: Array,
|
|
9
|
-
default: () => []
|
|
10
|
-
},
|
|
11
|
-
/**
|
|
12
|
-
* Adds the classes to all title elements (on the left side).
|
|
13
|
-
*/
|
|
14
|
-
titleClass: String,
|
|
15
|
-
/**
|
|
16
|
-
* Adds the classes to all text elements (on the right side).
|
|
17
|
-
*/
|
|
18
|
-
textClass: String,
|
|
19
|
-
/**
|
|
20
|
-
* Adds the classes to each row.
|
|
21
|
-
*/
|
|
22
|
-
rowClass: String
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* The `NList` displays key-value data in an appealing way.
|
|
26
|
-
*/
|
|
27
|
-
const Component = createComponent('NList', nListProps, props => {
|
|
28
|
-
return () => _createVNode("dl", null, [props.items.map((item, index) => _createVNode("div", {
|
|
29
|
-
"key": index,
|
|
30
|
-
"class": ['py-5 px-4 sm:grid sm:grid-cols-3 sm:gap-4', index % 2 === 1 ? 'bg-white' : 'bg-default-50', props.rowClass]
|
|
31
|
-
}, [_createVNode("dt", {
|
|
32
|
-
"class": `text-sm font-medium text-default-500 ${props.titleClass}`
|
|
33
|
-
}, [buildElement(item.title)]), _createVNode("dd", {
|
|
34
|
-
"class": `mt-1 text-sm sm:mt-0 sm:col-span-2 ${props.textClass}`
|
|
35
|
-
}, [buildElement(item.text)])]))]);
|
|
36
|
-
});
|
|
37
|
-
export { Component as NList, Component as default };
|
|
38
|
-
function buildElement(element) {
|
|
39
|
-
if (typeof element === 'function') return element();else return _createVNode(_Fragment, null, [element]);
|
|
40
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
.lds-ellipsis {
|
|
2
|
-
position: relative;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.lds-ellipsis div {
|
|
6
|
-
position: absolute;
|
|
7
|
-
border-radius: 50%;
|
|
8
|
-
animation-timing-function: cubic-bezier(0, 1, 1, 0);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.lds-ellipsis div:nth-child(1) {
|
|
12
|
-
animation: lds-ellipsis1 0.6s infinite;
|
|
13
|
-
}
|
|
14
|
-
.lds-ellipsis div:nth-child(2) {
|
|
15
|
-
animation: lds-ellipsis2 0.6s infinite;
|
|
16
|
-
}
|
|
17
|
-
.lds-ellipsis div:nth-child(3) {
|
|
18
|
-
animation: lds-ellipsis2 0.6s infinite;
|
|
19
|
-
}
|
|
20
|
-
.lds-ellipsis div:nth-child(4) {
|
|
21
|
-
animation: lds-ellipsis3 0.6s infinite;
|
|
22
|
-
}
|
|
23
|
-
@keyframes lds-ellipsis1 {
|
|
24
|
-
0% {
|
|
25
|
-
transform: scale(0);
|
|
26
|
-
}
|
|
27
|
-
100% {
|
|
28
|
-
transform: scale(1);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
@keyframes lds-ellipsis3 {
|
|
32
|
-
0% {
|
|
33
|
-
transform: scale(1);
|
|
34
|
-
}
|
|
35
|
-
100% {
|
|
36
|
-
transform: scale(0);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
@keyframes lds-ellipsis2 {
|
|
40
|
-
0% {
|
|
41
|
-
transform: translate(0, 0);
|
|
42
|
-
}
|
|
43
|
-
100% {
|
|
44
|
-
transform: translate(var(--n-loading-indicator-gap), 0);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import './NLoadingIndicator.css';
|
|
2
|
-
export declare const nLoadingIndicator: {
|
|
3
|
-
/**
|
|
4
|
-
* The color of the loading-indicator.
|
|
5
|
-
*/
|
|
6
|
-
readonly color: {
|
|
7
|
-
readonly type: StringConstructor;
|
|
8
|
-
readonly default: "primary";
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* The shade of the loading-indicator.
|
|
12
|
-
*/
|
|
13
|
-
readonly shade: {
|
|
14
|
-
readonly type: NumberConstructor;
|
|
15
|
-
readonly default: 400;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* The height of the loading-indicator in px.
|
|
19
|
-
*/
|
|
20
|
-
readonly size: {
|
|
21
|
-
readonly type: NumberConstructor;
|
|
22
|
-
readonly default: 10;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* The `NLoadingIndicator` is a styled loading indicator.
|
|
27
|
-
*/
|
|
28
|
-
declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
|
|
29
|
-
export { Component as NLoadingIndicator, Component as default };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { createVNode as _createVNode } from "vue";
|
|
2
|
-
import { createComponent } from '../utils/component';
|
|
3
|
-
import { computed, useCssVars } from 'vue';
|
|
4
|
-
import './NLoadingIndicator.css';
|
|
5
|
-
export const nLoadingIndicator = {
|
|
6
|
-
/**
|
|
7
|
-
* The color of the loading-indicator.
|
|
8
|
-
*/
|
|
9
|
-
color: {
|
|
10
|
-
type: String,
|
|
11
|
-
default: 'primary'
|
|
12
|
-
},
|
|
13
|
-
/**
|
|
14
|
-
* The shade of the loading-indicator.
|
|
15
|
-
*/
|
|
16
|
-
shade: {
|
|
17
|
-
type: Number,
|
|
18
|
-
default: 400
|
|
19
|
-
},
|
|
20
|
-
/**
|
|
21
|
-
* The height of the loading-indicator in px.
|
|
22
|
-
*/
|
|
23
|
-
size: {
|
|
24
|
-
type: Number,
|
|
25
|
-
default: 10
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* The `NLoadingIndicator` is a styled loading indicator.
|
|
30
|
-
*/
|
|
31
|
-
const Component = createComponent('NLoadingIndicator', nLoadingIndicator, props => {
|
|
32
|
-
const gap = computed(() => props.size / 13 * 24);
|
|
33
|
-
const totalWidth = computed(() => gap.value * 2 + props.size);
|
|
34
|
-
useCssVars(() => ({
|
|
35
|
-
'n-loading-indicator-gap': `${gap.value}px`
|
|
36
|
-
}));
|
|
37
|
-
return () => _createVNode("div", {
|
|
38
|
-
"class": "lds-ellipsis",
|
|
39
|
-
"style": `height:${props.size}px;width:${totalWidth.value}px`
|
|
40
|
-
}, [_createVNode("div", {
|
|
41
|
-
"class": `bg-${props.color}-${props.shade}`,
|
|
42
|
-
"style": `height:${props.size}px;width:${props.size}px;left:0px`
|
|
43
|
-
}, null), _createVNode("div", {
|
|
44
|
-
"class": `bg-${props.color}-${props.shade}`,
|
|
45
|
-
"style": `height:${props.size}px;width:${props.size}px;left:0px`
|
|
46
|
-
}, null), _createVNode("div", {
|
|
47
|
-
"class": `bg-${props.color}-${props.shade}`,
|
|
48
|
-
"style": `height:${props.size}px;width:${props.size}px;left:${gap.value}px`
|
|
49
|
-
}, null), _createVNode("div", {
|
|
50
|
-
"class": `bg-${props.color}-${props.shade}`,
|
|
51
|
-
"style": `height:${props.size}px;width:${props.size}px;left:${2 * gap.value}px`
|
|
52
|
-
}, null)]);
|
|
53
|
-
});
|
|
54
|
-
export { Component as NLoadingIndicator, Component as default };
|