@naptics/vue-collection 0.0.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/README.md +27 -0
- package/lib/components/NAlert.d.ts +72 -0
- package/lib/components/NAlert.jsx +69 -0
- package/lib/components/NBadge.d.ts +174 -0
- package/lib/components/NBadge.jsx +58 -0
- package/lib/components/NBreadcrub.d.ts +161 -0
- package/lib/components/NBreadcrub.jsx +64 -0
- package/lib/components/NButton.d.ts +149 -0
- package/lib/components/NButton.jsx +58 -0
- package/lib/components/NCheckbox.d.ts +51 -0
- package/lib/components/NCheckbox.jsx +38 -0
- package/lib/components/NCheckboxLabel.d.ts +70 -0
- package/lib/components/NCheckboxLabel.jsx +42 -0
- package/lib/components/NCrudModal.d.ts +301 -0
- package/lib/components/NCrudModal.jsx +89 -0
- package/lib/components/NDialog.d.ts +190 -0
- package/lib/components/NDialog.jsx +144 -0
- package/lib/components/NDropdown.d.ts +116 -0
- package/lib/components/NDropdown.jsx +92 -0
- package/lib/components/NDropzone.d.ts +162 -0
- package/lib/components/NDropzone.jsx +211 -0
- package/lib/components/NForm.d.ts +43 -0
- package/lib/components/NForm.jsx +26 -0
- package/lib/components/NFormModal.d.ts +190 -0
- package/lib/components/NFormModal.jsx +48 -0
- package/lib/components/NIconButton.d.ts +202 -0
- package/lib/components/NIconButton.jsx +71 -0
- package/lib/components/NIconCircle.d.ts +135 -0
- package/lib/components/NIconCircle.jsx +67 -0
- package/lib/components/NInput.css +11 -0
- package/lib/components/NInput.d.ts +232 -0
- package/lib/components/NInput.jsx +97 -0
- package/lib/components/NInputPhone.d.ts +150 -0
- package/lib/components/NInputPhone.jsx +31 -0
- package/lib/components/NInputSelect.d.ts +271 -0
- package/lib/components/NInputSelect.jsx +89 -0
- package/lib/components/NInputSuggestion.d.ts +212 -0
- package/lib/components/NInputSuggestion.jsx +48 -0
- package/lib/components/NLink.d.ts +111 -0
- package/lib/components/NLink.jsx +58 -0
- package/lib/components/NList.d.ts +43 -0
- package/lib/components/NList.jsx +24 -0
- package/lib/components/NLoadingIndicator.css +46 -0
- package/lib/components/NLoadingIndicator.d.ts +77 -0
- package/lib/components/NLoadingIndicator.jsx +42 -0
- package/lib/components/NModal.d.ts +333 -0
- package/lib/components/NModal.jsx +170 -0
- package/lib/components/NPagination.css +15 -0
- package/lib/components/NPagination.d.ts +99 -0
- package/lib/components/NPagination.jsx +104 -0
- package/lib/components/NSearchbar.d.ts +94 -0
- package/lib/components/NSearchbar.jsx +58 -0
- package/lib/components/NSearchbarList.d.ts +90 -0
- package/lib/components/NSearchbarList.jsx +20 -0
- package/lib/components/NSelect.d.ts +159 -0
- package/lib/components/NSelect.jsx +81 -0
- package/lib/components/NSuggestionList.d.ts +275 -0
- package/lib/components/NSuggestionList.jsx +157 -0
- package/lib/components/NTable.css +3 -0
- package/lib/components/NTable.d.ts +187 -0
- package/lib/components/NTable.jsx +146 -0
- package/lib/components/NTableAction.d.ts +74 -0
- package/lib/components/NTableAction.jsx +35 -0
- package/lib/components/NTextArea.d.ts +252 -0
- package/lib/components/NTextArea.jsx +108 -0
- package/lib/components/NTooltip.css +37 -0
- package/lib/components/NTooltip.d.ts +186 -0
- package/lib/components/NTooltip.jsx +161 -0
- package/lib/components/NValInput.d.ts +297 -0
- package/lib/components/NValInput.jsx +101 -0
- package/lib/components/ValidatedForm.d.ts +34 -0
- package/lib/components/ValidatedForm.js +25 -0
- package/lib/i18n/de/template.json +10 -0
- package/lib/i18n/de/vue-collection.json +58 -0
- package/lib/i18n/de.d.ts +61 -0
- package/lib/i18n/de.js +5 -0
- package/lib/i18n/en/template.json +10 -0
- package/lib/i18n/en/vue-collection.json +58 -0
- package/lib/i18n/en.d.ts +61 -0
- package/lib/i18n/en.js +5 -0
- package/lib/i18n/index.d.ts +17 -0
- package/lib/i18n/index.js +34 -0
- package/lib/index.d.ts +64 -0
- package/lib/index.js +65 -0
- package/lib/utils/breakpoints.d.ts +15 -0
- package/lib/utils/breakpoints.js +37 -0
- package/lib/utils/component.d.ts +50 -0
- package/lib/utils/component.js +51 -0
- package/lib/utils/deferred.d.ts +13 -0
- package/lib/utils/deferred.js +17 -0
- package/lib/utils/identifiable.d.ts +57 -0
- package/lib/utils/identifiable.js +78 -0
- package/lib/utils/stringMaxLength.d.ts +14 -0
- package/lib/utils/stringMaxLength.js +28 -0
- package/lib/utils/tailwind.d.ts +2 -0
- package/lib/utils/tailwind.js +1 -0
- package/lib/utils/utils.d.ts +27 -0
- package/lib/utils/utils.js +26 -0
- package/lib/utils/vModel.d.ts +182 -0
- package/lib/utils/vModel.js +215 -0
- package/lib/utils/validation.d.ts +84 -0
- package/lib/utils/validation.js +163 -0
- package/lib/utils/vue.d.ts +13 -0
- package/lib/utils/vue.js +19 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Vue Collection
|
|
2
|
+
|
|
3
|
+
Vue Collection is a collection of styled and fully functional Vue components which can easily be integrated into our projects.
|
|
4
|
+
|
|
5
|
+
## Showroom 🎆
|
|
6
|
+
|
|
7
|
+
You can take a look at all components on [Gitlab Pages](https://naptx.gitlab.io/libraries/vue-collection/).
|
|
8
|
+
|
|
9
|
+
## Integrate Vue Collection into a new project 🔨
|
|
10
|
+
|
|
11
|
+
1. Create a new vue-project with `npm init vue@latest`. Add at least typescript, jsx, vue-router, eslint and prettier.
|
|
12
|
+
2. Remove boilerplate code.
|
|
13
|
+
3. Follow the instructions to [install tailwind](https://tailwindcss.com/docs/installation/using-postcss).
|
|
14
|
+
- `npm install -D tailwindcss postcss autoprefixer`
|
|
15
|
+
- `npx tailwindcss init`
|
|
16
|
+
- ... follow the further instructions
|
|
17
|
+
- When creating the App.css add contents of this repo's `App.css`
|
|
18
|
+
4. Add tailwind forms with `npm install -D @tailwindcss/forms`
|
|
19
|
+
5. Copy the tailwind configuration `tailwind.config.js` to your project.
|
|
20
|
+
6. Add other dependencies with `npm install @headlessui/vue @heroicons/vue vue-i18n awesome-phonenumber @popperjs/core`
|
|
21
|
+
7. Copy files from `.vscode` to your project. Remove `.vscode/settings.json` file from `.gitignore`. Copy `.prettierrc` to your project.
|
|
22
|
+
8. Make sure typescript config is correct. Double check with this repo.
|
|
23
|
+
9. Copy the contents of `src/components/base` (without the tests), `src/i18n` and `src/utils/vue-collection` to your project.
|
|
24
|
+
10. Create your `App.tsx` file (you probably deleted earlier) and add a router view to the app. Link the `App.css` to it. Then you're ready to add a `HomeView` and link it to the router. Make sure to always use the `createView` and `createComponent` functions defined in the `src/utils/vue` file.
|
|
25
|
+
11. Close your project and reopen it again. Now all weird warnings should go away.
|
|
26
|
+
12. You're ready to go: Run your app with `npm run dev`.
|
|
27
|
+
13. Don't forget to configure primary, secondary and default color in `tailwind.config.js`. Also choose which classes are white-listed.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
export type AlertVariant = 'success' | 'info' | 'warning' | 'error' | 'loading';
|
|
3
|
+
export declare const nAlertProps: {
|
|
4
|
+
/**
|
|
5
|
+
* The variant of the alert. This defines its color and icon.
|
|
6
|
+
*/
|
|
7
|
+
variant: {
|
|
8
|
+
type: PropType<AlertVariant>;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The text of the alert.
|
|
13
|
+
*/
|
|
14
|
+
text: StringConstructor;
|
|
15
|
+
/**
|
|
16
|
+
* If set to `true` the X-button of the alert is hidden.
|
|
17
|
+
*/
|
|
18
|
+
hideX: BooleanConstructor;
|
|
19
|
+
/**
|
|
20
|
+
* This is called, when the X-button is clicked.
|
|
21
|
+
*/
|
|
22
|
+
onDismiss: PropType<() => void>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The `NAlert` is a fully styled alert with multiple variants.
|
|
26
|
+
* It can be used as a normal blocking element or as part of an alert queue.
|
|
27
|
+
*/
|
|
28
|
+
declare const _default: import("vue").DefineComponent<{
|
|
29
|
+
/**
|
|
30
|
+
* The variant of the alert. This defines its color and icon.
|
|
31
|
+
*/
|
|
32
|
+
variant: {
|
|
33
|
+
type: PropType<AlertVariant>;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The text of the alert.
|
|
38
|
+
*/
|
|
39
|
+
text: StringConstructor;
|
|
40
|
+
/**
|
|
41
|
+
* If set to `true` the X-button of the alert is hidden.
|
|
42
|
+
*/
|
|
43
|
+
hideX: BooleanConstructor;
|
|
44
|
+
/**
|
|
45
|
+
* This is called, when the X-button is clicked.
|
|
46
|
+
*/
|
|
47
|
+
onDismiss: PropType<() => void>;
|
|
48
|
+
}, 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<{
|
|
49
|
+
/**
|
|
50
|
+
* The variant of the alert. This defines its color and icon.
|
|
51
|
+
*/
|
|
52
|
+
variant: {
|
|
53
|
+
type: PropType<AlertVariant>;
|
|
54
|
+
default: string;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* The text of the alert.
|
|
58
|
+
*/
|
|
59
|
+
text: StringConstructor;
|
|
60
|
+
/**
|
|
61
|
+
* If set to `true` the X-button of the alert is hidden.
|
|
62
|
+
*/
|
|
63
|
+
hideX: BooleanConstructor;
|
|
64
|
+
/**
|
|
65
|
+
* This is called, when the X-button is clicked.
|
|
66
|
+
*/
|
|
67
|
+
onDismiss: PropType<() => void>;
|
|
68
|
+
}>> & {}, {
|
|
69
|
+
variant: AlertVariant;
|
|
70
|
+
hideX: boolean;
|
|
71
|
+
}>;
|
|
72
|
+
export default _default;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createComponent, createProps } from '../utils/component';
|
|
2
|
+
import { CheckCircleIcon, ExclamationCircleIcon, InformationCircleIcon, XMarkIcon } from '@heroicons/vue/24/solid';
|
|
3
|
+
import { computed } from 'vue';
|
|
4
|
+
import NIconButton from './NIconButton';
|
|
5
|
+
import NLoadingIndicator from './NLoadingIndicator';
|
|
6
|
+
export const nAlertProps = createProps({
|
|
7
|
+
/**
|
|
8
|
+
* The variant of the alert. This defines its color and icon.
|
|
9
|
+
*/
|
|
10
|
+
variant: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: 'success',
|
|
13
|
+
},
|
|
14
|
+
/**
|
|
15
|
+
* The text of the alert.
|
|
16
|
+
*/
|
|
17
|
+
text: String,
|
|
18
|
+
/**
|
|
19
|
+
* If set to `true` the X-button of the alert is hidden.
|
|
20
|
+
*/
|
|
21
|
+
hideX: Boolean,
|
|
22
|
+
/**
|
|
23
|
+
* This is called, when the X-button is clicked.
|
|
24
|
+
*/
|
|
25
|
+
onDismiss: Function,
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* The `NAlert` is a fully styled alert with multiple variants.
|
|
29
|
+
* It can be used as a normal blocking element or as part of an alert queue.
|
|
30
|
+
*/
|
|
31
|
+
export default createComponent('NAlert', nAlertProps, props => {
|
|
32
|
+
const variant = computed(() => VARIANTS[props.variant]);
|
|
33
|
+
return () => (<div class={`rounded-md p-3 shadow-lg bg-${variant.value.color}-50`}>
|
|
34
|
+
<div class="flex items-center">
|
|
35
|
+
<div class="flex flex-shrink-0 items-center">{variant.value.icon()}</div>
|
|
36
|
+
|
|
37
|
+
<div class="ml-3 flex-grow">
|
|
38
|
+
<p class={`text-sm font-medium text-${variant.value.color}-900`}>{props.text}</p>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
{!props.hideX && (<div class="flex items-center flex-shrink-0 ml-3">
|
|
42
|
+
<NIconButton color={variant.value.color} size={5} icon={XMarkIcon} onClick={props.onDismiss}/>
|
|
43
|
+
</div>)}
|
|
44
|
+
</div>
|
|
45
|
+
</div>);
|
|
46
|
+
});
|
|
47
|
+
const icon = (icon, color) => () => <icon class={`h-5 w-5 text-${color}-500`}/>;
|
|
48
|
+
const VARIANTS = {
|
|
49
|
+
success: {
|
|
50
|
+
icon: icon(CheckCircleIcon, 'green'),
|
|
51
|
+
color: 'green',
|
|
52
|
+
},
|
|
53
|
+
info: {
|
|
54
|
+
icon: icon(InformationCircleIcon, 'blue'),
|
|
55
|
+
color: 'blue',
|
|
56
|
+
},
|
|
57
|
+
warning: {
|
|
58
|
+
icon: icon(ExclamationCircleIcon, 'yellow'),
|
|
59
|
+
color: 'yellow',
|
|
60
|
+
},
|
|
61
|
+
error: {
|
|
62
|
+
icon: icon(ExclamationCircleIcon, 'red'),
|
|
63
|
+
color: 'red',
|
|
64
|
+
},
|
|
65
|
+
loading: {
|
|
66
|
+
icon: () => <NLoadingIndicator color="blue" size={7} shade={500}/>,
|
|
67
|
+
color: 'blue',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { TWTextSize } from '../utils/tailwind';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
export declare const nBadgeProps: {
|
|
4
|
+
tooltipText: StringConstructor;
|
|
5
|
+
tooltipContent: PropType<() => void>;
|
|
6
|
+
tooltipHide: BooleanConstructor;
|
|
7
|
+
tooltipShow: BooleanConstructor;
|
|
8
|
+
tooltipPlacement: {
|
|
9
|
+
type: PropType<import("./NTooltip").TooltipPlacement>;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
tooltipMaxWidth: {
|
|
13
|
+
type: PropType<import("../utils/tailwind").TWMaxWidth>;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The text of the badge. Can alternatively be passed in the default slot.
|
|
18
|
+
*/
|
|
19
|
+
text: StringConstructor;
|
|
20
|
+
/**
|
|
21
|
+
* The text size, a standard tailwind text-size class.
|
|
22
|
+
*/
|
|
23
|
+
textSize: {
|
|
24
|
+
type: PropType<TWTextSize>;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The color of the badge.
|
|
29
|
+
*/
|
|
30
|
+
color: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The background shade of the badge.
|
|
36
|
+
*/
|
|
37
|
+
shade: {
|
|
38
|
+
type: NumberConstructor;
|
|
39
|
+
default: number;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The text shade of the badge.
|
|
43
|
+
*/
|
|
44
|
+
textShade: {
|
|
45
|
+
type: NumberConstructor;
|
|
46
|
+
default: number;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* If set to `true` the badges text is all-caps. Default is `true`.
|
|
50
|
+
*/
|
|
51
|
+
allCaps: {
|
|
52
|
+
type: BooleanConstructor;
|
|
53
|
+
default: boolean;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* The `NBadge` is a styled element to wrap a text.
|
|
58
|
+
*/
|
|
59
|
+
declare const _default: import("vue").DefineComponent<{
|
|
60
|
+
tooltipText: StringConstructor;
|
|
61
|
+
tooltipContent: PropType<() => void>;
|
|
62
|
+
tooltipHide: BooleanConstructor;
|
|
63
|
+
tooltipShow: BooleanConstructor;
|
|
64
|
+
tooltipPlacement: {
|
|
65
|
+
type: PropType<import("./NTooltip").TooltipPlacement>;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
68
|
+
tooltipMaxWidth: {
|
|
69
|
+
type: PropType<import("../utils/tailwind").TWMaxWidth>;
|
|
70
|
+
default: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The text of the badge. Can alternatively be passed in the default slot.
|
|
74
|
+
*/
|
|
75
|
+
text: StringConstructor;
|
|
76
|
+
/**
|
|
77
|
+
* The text size, a standard tailwind text-size class.
|
|
78
|
+
*/
|
|
79
|
+
textSize: {
|
|
80
|
+
type: PropType<TWTextSize>;
|
|
81
|
+
default: string;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* The color of the badge.
|
|
85
|
+
*/
|
|
86
|
+
color: {
|
|
87
|
+
type: StringConstructor;
|
|
88
|
+
default: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The background shade of the badge.
|
|
92
|
+
*/
|
|
93
|
+
shade: {
|
|
94
|
+
type: NumberConstructor;
|
|
95
|
+
default: number;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The text shade of the badge.
|
|
99
|
+
*/
|
|
100
|
+
textShade: {
|
|
101
|
+
type: NumberConstructor;
|
|
102
|
+
default: number;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* If set to `true` the badges text is all-caps. Default is `true`.
|
|
106
|
+
*/
|
|
107
|
+
allCaps: {
|
|
108
|
+
type: BooleanConstructor;
|
|
109
|
+
default: boolean;
|
|
110
|
+
};
|
|
111
|
+
}, 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<{
|
|
112
|
+
tooltipText: StringConstructor;
|
|
113
|
+
tooltipContent: PropType<() => void>;
|
|
114
|
+
tooltipHide: BooleanConstructor;
|
|
115
|
+
tooltipShow: BooleanConstructor;
|
|
116
|
+
tooltipPlacement: {
|
|
117
|
+
type: PropType<import("./NTooltip").TooltipPlacement>;
|
|
118
|
+
default: string;
|
|
119
|
+
};
|
|
120
|
+
tooltipMaxWidth: {
|
|
121
|
+
type: PropType<import("../utils/tailwind").TWMaxWidth>;
|
|
122
|
+
default: string;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* The text of the badge. Can alternatively be passed in the default slot.
|
|
126
|
+
*/
|
|
127
|
+
text: StringConstructor;
|
|
128
|
+
/**
|
|
129
|
+
* The text size, a standard tailwind text-size class.
|
|
130
|
+
*/
|
|
131
|
+
textSize: {
|
|
132
|
+
type: PropType<TWTextSize>;
|
|
133
|
+
default: string;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* The color of the badge.
|
|
137
|
+
*/
|
|
138
|
+
color: {
|
|
139
|
+
type: StringConstructor;
|
|
140
|
+
default: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* The background shade of the badge.
|
|
144
|
+
*/
|
|
145
|
+
shade: {
|
|
146
|
+
type: NumberConstructor;
|
|
147
|
+
default: number;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* The text shade of the badge.
|
|
151
|
+
*/
|
|
152
|
+
textShade: {
|
|
153
|
+
type: NumberConstructor;
|
|
154
|
+
default: number;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* If set to `true` the badges text is all-caps. Default is `true`.
|
|
158
|
+
*/
|
|
159
|
+
allCaps: {
|
|
160
|
+
type: BooleanConstructor;
|
|
161
|
+
default: boolean;
|
|
162
|
+
};
|
|
163
|
+
}>> & {}, {
|
|
164
|
+
color: string;
|
|
165
|
+
shade: number;
|
|
166
|
+
tooltipHide: boolean;
|
|
167
|
+
tooltipShow: boolean;
|
|
168
|
+
tooltipPlacement: import("./NTooltip").TooltipPlacement;
|
|
169
|
+
tooltipMaxWidth: import("../utils/tailwind").TWMaxWidth;
|
|
170
|
+
textSize: TWTextSize;
|
|
171
|
+
textShade: number;
|
|
172
|
+
allCaps: boolean;
|
|
173
|
+
}>;
|
|
174
|
+
export default _default;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createComponent, createProps } from '../utils/component';
|
|
2
|
+
import NTooltip, { mapTooltipProps, nToolTipPropsForImplementor } from './NTooltip';
|
|
3
|
+
export const nBadgeProps = createProps({
|
|
4
|
+
/**
|
|
5
|
+
* The text of the badge. Can alternatively be passed in the default slot.
|
|
6
|
+
*/
|
|
7
|
+
text: String,
|
|
8
|
+
/**
|
|
9
|
+
* The text size, a standard tailwind text-size class.
|
|
10
|
+
*/
|
|
11
|
+
textSize: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: 'text-sm',
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* The color of the badge.
|
|
17
|
+
*/
|
|
18
|
+
color: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: 'primary',
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* The background shade of the badge.
|
|
24
|
+
*/
|
|
25
|
+
shade: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 200,
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* The text shade of the badge.
|
|
31
|
+
*/
|
|
32
|
+
textShade: {
|
|
33
|
+
type: Number,
|
|
34
|
+
default: 900,
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* If set to `true` the badges text is all-caps. Default is `true`.
|
|
38
|
+
*/
|
|
39
|
+
allCaps: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: true,
|
|
42
|
+
},
|
|
43
|
+
...nToolTipPropsForImplementor,
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* The `NBadge` is a styled element to wrap a text.
|
|
47
|
+
*/
|
|
48
|
+
export default createComponent('NBadge', nBadgeProps, (props, { slots }) => {
|
|
49
|
+
return () => (<NTooltip {...mapTooltipProps(props)}>
|
|
50
|
+
<div class={[
|
|
51
|
+
'px-2 py-1 rounded-md font-semibold shadow',
|
|
52
|
+
`${props.textSize} bg-${props.color}-${props.shade} text-${props.color}-${props.textShade}`,
|
|
53
|
+
props.allCaps ? 'uppercase' : '',
|
|
54
|
+
]}>
|
|
55
|
+
{slots.default?.() || props.text}
|
|
56
|
+
</div>
|
|
57
|
+
</NTooltip>);
|
|
58
|
+
});
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { HeroIcon } from '../utils/utils';
|
|
2
|
+
import type { TWTextSize } from '../utils/tailwind';
|
|
3
|
+
import type { PropType } from 'vue';
|
|
4
|
+
import type { RouteLocationRaw } from 'vue-router';
|
|
5
|
+
export declare const nBreadcrumbProps: {
|
|
6
|
+
/**
|
|
7
|
+
* The items of the breadcrumb.
|
|
8
|
+
*/
|
|
9
|
+
items: {
|
|
10
|
+
type: PropType<BreadcrumbItem[]>;
|
|
11
|
+
default: () => never[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The color of the breadcrumbs text and icons.
|
|
15
|
+
*/
|
|
16
|
+
color: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The text-size of the breadcrumb labels.
|
|
22
|
+
*/
|
|
23
|
+
textSize: {
|
|
24
|
+
type: PropType<TWTextSize>;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The icon which is used as a seperator between two breadcrumb items.
|
|
29
|
+
*/
|
|
30
|
+
icon: {
|
|
31
|
+
type: PropType<HeroIcon>;
|
|
32
|
+
default: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}>;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The size of the icon in tailwind units.
|
|
36
|
+
*/
|
|
37
|
+
iconSize: {
|
|
38
|
+
type: NumberConstructor;
|
|
39
|
+
default: number;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* A slot the replace the breadcrumb labels.
|
|
43
|
+
*/
|
|
44
|
+
item: PropType<(item: BreadcrumbItem, index: number) => JSX.Element>;
|
|
45
|
+
/**
|
|
46
|
+
* A slot to replace the separators between the breadcrumb labels.
|
|
47
|
+
* The passsed item is the item before the seperator.
|
|
48
|
+
*/
|
|
49
|
+
seperator: PropType<(item: BreadcrumbItem, index: number) => JSX.Element>;
|
|
50
|
+
};
|
|
51
|
+
export type BreadcrumbItem = {
|
|
52
|
+
/**
|
|
53
|
+
* The visible label of the breadcrumb item.
|
|
54
|
+
*/
|
|
55
|
+
label: string;
|
|
56
|
+
/**
|
|
57
|
+
* The route the breadcrumb item points to.
|
|
58
|
+
*/
|
|
59
|
+
route: RouteLocationRaw;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* The `NBreadcrumb` is a styled breadcrumb which can be used as a navigation in hierarchical views.
|
|
63
|
+
*/
|
|
64
|
+
declare const _default: import("vue").DefineComponent<{
|
|
65
|
+
/**
|
|
66
|
+
* The items of the breadcrumb.
|
|
67
|
+
*/
|
|
68
|
+
items: {
|
|
69
|
+
type: PropType<BreadcrumbItem[]>;
|
|
70
|
+
default: () => never[];
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The color of the breadcrumbs text and icons.
|
|
74
|
+
*/
|
|
75
|
+
color: {
|
|
76
|
+
type: StringConstructor;
|
|
77
|
+
default: string;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* The text-size of the breadcrumb labels.
|
|
81
|
+
*/
|
|
82
|
+
textSize: {
|
|
83
|
+
type: PropType<TWTextSize>;
|
|
84
|
+
default: string;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* The icon which is used as a seperator between two breadcrumb items.
|
|
88
|
+
*/
|
|
89
|
+
icon: {
|
|
90
|
+
type: PropType<HeroIcon>;
|
|
91
|
+
default: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}>;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* The size of the icon in tailwind units.
|
|
95
|
+
*/
|
|
96
|
+
iconSize: {
|
|
97
|
+
type: NumberConstructor;
|
|
98
|
+
default: number;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* A slot the replace the breadcrumb labels.
|
|
102
|
+
*/
|
|
103
|
+
item: PropType<(item: BreadcrumbItem, index: number) => JSX.Element>;
|
|
104
|
+
/**
|
|
105
|
+
* A slot to replace the separators between the breadcrumb labels.
|
|
106
|
+
* The passsed item is the item before the seperator.
|
|
107
|
+
*/
|
|
108
|
+
seperator: PropType<(item: BreadcrumbItem, index: number) => JSX.Element>;
|
|
109
|
+
}, 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<{
|
|
110
|
+
/**
|
|
111
|
+
* The items of the breadcrumb.
|
|
112
|
+
*/
|
|
113
|
+
items: {
|
|
114
|
+
type: PropType<BreadcrumbItem[]>;
|
|
115
|
+
default: () => never[];
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* The color of the breadcrumbs text and icons.
|
|
119
|
+
*/
|
|
120
|
+
color: {
|
|
121
|
+
type: StringConstructor;
|
|
122
|
+
default: string;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* The text-size of the breadcrumb labels.
|
|
126
|
+
*/
|
|
127
|
+
textSize: {
|
|
128
|
+
type: PropType<TWTextSize>;
|
|
129
|
+
default: string;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* The icon which is used as a seperator between two breadcrumb items.
|
|
133
|
+
*/
|
|
134
|
+
icon: {
|
|
135
|
+
type: PropType<HeroIcon>;
|
|
136
|
+
default: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}>;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* The size of the icon in tailwind units.
|
|
140
|
+
*/
|
|
141
|
+
iconSize: {
|
|
142
|
+
type: NumberConstructor;
|
|
143
|
+
default: number;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* A slot the replace the breadcrumb labels.
|
|
147
|
+
*/
|
|
148
|
+
item: PropType<(item: BreadcrumbItem, index: number) => JSX.Element>;
|
|
149
|
+
/**
|
|
150
|
+
* A slot to replace the separators between the breadcrumb labels.
|
|
151
|
+
* The passsed item is the item before the seperator.
|
|
152
|
+
*/
|
|
153
|
+
seperator: PropType<(item: BreadcrumbItem, index: number) => JSX.Element>;
|
|
154
|
+
}>> & {}, {
|
|
155
|
+
color: string;
|
|
156
|
+
icon: HeroIcon;
|
|
157
|
+
textSize: TWTextSize;
|
|
158
|
+
items: BreadcrumbItem[];
|
|
159
|
+
iconSize: number;
|
|
160
|
+
}>;
|
|
161
|
+
export default _default;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createComponent, createProps } from '../utils/component';
|
|
2
|
+
import { ChevronRightIcon } from '@heroicons/vue/24/solid';
|
|
3
|
+
import NLink from './NLink';
|
|
4
|
+
export const nBreadcrumbProps = createProps({
|
|
5
|
+
/**
|
|
6
|
+
* The items of the breadcrumb.
|
|
7
|
+
*/
|
|
8
|
+
items: {
|
|
9
|
+
type: Array,
|
|
10
|
+
default: () => [],
|
|
11
|
+
},
|
|
12
|
+
/**
|
|
13
|
+
* The color of the breadcrumbs text and icons.
|
|
14
|
+
*/
|
|
15
|
+
color: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: 'primary',
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* The text-size of the breadcrumb labels.
|
|
21
|
+
*/
|
|
22
|
+
textSize: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: 'text-base',
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* The icon which is used as a seperator between two breadcrumb items.
|
|
28
|
+
*/
|
|
29
|
+
icon: {
|
|
30
|
+
type: Function,
|
|
31
|
+
default: ChevronRightIcon,
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* The size of the icon in tailwind units.
|
|
35
|
+
*/
|
|
36
|
+
iconSize: {
|
|
37
|
+
type: Number,
|
|
38
|
+
default: 5,
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* A slot the replace the breadcrumb labels.
|
|
42
|
+
*/
|
|
43
|
+
item: Function,
|
|
44
|
+
/**
|
|
45
|
+
* A slot to replace the separators between the breadcrumb labels.
|
|
46
|
+
* The passsed item is the item before the seperator.
|
|
47
|
+
*/
|
|
48
|
+
seperator: Function,
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* The `NBreadcrumb` is a styled breadcrumb which can be used as a navigation in hierarchical views.
|
|
52
|
+
*/
|
|
53
|
+
export default createComponent('NBreadcrumb', nBreadcrumbProps, props => {
|
|
54
|
+
return () => (<div class="flex flex-wrap items-center">
|
|
55
|
+
{props.items.map((item, index) => (<>
|
|
56
|
+
{props.item?.(item, index) || (<NLink textSize={props.textSize} route={item.route} color={props.color}>
|
|
57
|
+
{item.label}
|
|
58
|
+
</NLink>)}
|
|
59
|
+
|
|
60
|
+
{index < props.items.length - 1 &&
|
|
61
|
+
(props.seperator?.(item, index) || (<props.icon class={`mx-2 w-${props.iconSize} h-${props.iconSize} text-${props.color}-500`}/>))}
|
|
62
|
+
</>))}
|
|
63
|
+
</div>);
|
|
64
|
+
});
|