@antify/template-module 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +163 -0
  2. package/dist/module.d.mts +10 -0
  3. package/dist/module.d.ts +10 -0
  4. package/dist/module.json +9 -0
  5. package/dist/module.mjs +101 -0
  6. package/dist/runtime/assets/antify.css +1 -0
  7. package/dist/runtime/components/Main.mdx +6 -0
  8. package/dist/runtime/components/buttons/ActionButton.d.vue.ts +52 -0
  9. package/dist/runtime/components/buttons/ActionButton.vue +74 -0
  10. package/dist/runtime/components/buttons/ActionButton.vue.d.ts +52 -0
  11. package/dist/runtime/components/buttons/CreateButton.d.vue.ts +25 -0
  12. package/dist/runtime/components/buttons/CreateButton.vue +67 -0
  13. package/dist/runtime/components/buttons/CreateButton.vue.d.ts +25 -0
  14. package/dist/runtime/components/buttons/DeleteButton.d.vue.ts +25 -0
  15. package/dist/runtime/components/buttons/DeleteButton.vue +67 -0
  16. package/dist/runtime/components/buttons/DeleteButton.vue.d.ts +25 -0
  17. package/dist/runtime/components/buttons/DuplicateButton.d.vue.ts +25 -0
  18. package/dist/runtime/components/buttons/DuplicateButton.vue +67 -0
  19. package/dist/runtime/components/buttons/DuplicateButton.vue.d.ts +25 -0
  20. package/dist/runtime/components/buttons/EditButton.d.vue.ts +25 -0
  21. package/dist/runtime/components/buttons/EditButton.vue +67 -0
  22. package/dist/runtime/components/buttons/EditButton.vue.d.ts +25 -0
  23. package/dist/runtime/components/buttons/SaveAndNewButton.d.vue.ts +25 -0
  24. package/dist/runtime/components/buttons/SaveAndNewButton.vue +70 -0
  25. package/dist/runtime/components/buttons/SaveAndNewButton.vue.d.ts +25 -0
  26. package/dist/runtime/components/buttons/SaveButton.d.vue.ts +25 -0
  27. package/dist/runtime/components/buttons/SaveButton.vue +68 -0
  28. package/dist/runtime/components/buttons/SaveButton.vue.d.ts +25 -0
  29. package/dist/runtime/components/crud/Crud.d.vue.ts +24 -0
  30. package/dist/runtime/components/crud/Crud.vue +43 -0
  31. package/dist/runtime/components/crud/Crud.vue.d.ts +24 -0
  32. package/dist/runtime/components/crud/CrudDetail.d.vue.ts +17 -0
  33. package/dist/runtime/components/crud/CrudDetail.vue +14 -0
  34. package/dist/runtime/components/crud/CrudDetail.vue.d.ts +17 -0
  35. package/dist/runtime/components/crud/CrudDetailActions.d.vue.ts +40 -0
  36. package/dist/runtime/components/crud/CrudDetailActions.vue +72 -0
  37. package/dist/runtime/components/crud/CrudDetailActions.vue.d.ts +40 -0
  38. package/dist/runtime/components/crud/CrudDetailNav.d.vue.ts +40 -0
  39. package/dist/runtime/components/crud/CrudDetailNav.vue +65 -0
  40. package/dist/runtime/components/crud/CrudDetailNav.vue.d.ts +40 -0
  41. package/dist/runtime/components/crud/CrudTableFilter.d.vue.ts +48 -0
  42. package/dist/runtime/components/crud/CrudTableFilter.vue +153 -0
  43. package/dist/runtime/components/crud/CrudTableFilter.vue.d.ts +48 -0
  44. package/dist/runtime/components/crud/CrudTableNav.d.vue.ts +23 -0
  45. package/dist/runtime/components/crud/CrudTableNav.vue +121 -0
  46. package/dist/runtime/components/crud/CrudTableNav.vue.d.ts +23 -0
  47. package/dist/runtime/components/dialogs/DeleteDialog.d.vue.ts +15 -0
  48. package/dist/runtime/components/dialogs/DeleteDialog.vue +64 -0
  49. package/dist/runtime/components/dialogs/DeleteDialog.vue.d.ts +15 -0
  50. package/dist/runtime/components/index.d.ts +15 -0
  51. package/dist/runtime/components/index.js +30 -0
  52. package/dist/runtime/composables/useUiClient.d.ts +90 -0
  53. package/dist/runtime/composables/useUiClient.js +151 -0
  54. package/dist/runtime/index.css +1 -0
  55. package/dist/runtime/index.d.ts +2 -0
  56. package/dist/runtime/index.js +2 -0
  57. package/dist/runtime/plugins/template-module.d.ts +48 -0
  58. package/dist/runtime/plugins/template-module.js +14 -0
  59. package/dist/runtime/types.d.ts +1 -0
  60. package/dist/runtime/types.js +0 -0
  61. package/dist/runtime/utils.d.ts +15 -0
  62. package/dist/runtime/utils.js +22 -0
  63. package/dist/types.d.mts +9 -0
  64. package/package.json +60 -0
package/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # @antify/template-module
2
+
3
+ ![Nuxt](https://img.shields.io/badge/Nuxt-3-green)
4
+
5
+ A powerful Nuxt module providing a high-level UI layer for the Antify ecosystem. It seamlessly integrates `@antify/ui` and adds a set of smart, logic-heavy components and client-side utilities to accelerate your development workflow.
6
+
7
+ ## Features
8
+
9
+ - 🚀 **Zero Config Auto-Imports**: Use any component without manual imports.
10
+ - 🎨 **Seamless @antify/ui Integration**: All base components (prefixed with `Ant`) are available out of the box.
11
+ - 🧠 **Smart Logic Components**: Specialized components (prefixed with `AntTemplate`) with built-in logic.
12
+ - 🍞 **Built-in Toaster**: Simple global API to trigger success or error notifications.
13
+ - 🧪 **Advanced Validation**: The `useFormField` utility to bridge Yup validation with UI states.
14
+ - 🛠 **Client-Side Toolbox**: Composables for CRUD routing, error handling, and state detection.
15
+
16
+ ## Installation
17
+
18
+ Add the module to your project:
19
+
20
+ ```bash
21
+ pnpm add @antify/template-module
22
+ ```
23
+
24
+ Then, add it to your `nuxt.config.ts`:
25
+
26
+ ```ts
27
+ export default defineNuxtConfig({
28
+ modules: [
29
+ '@antify/template-module'
30
+ ]
31
+ })
32
+ ```
33
+
34
+ ## Configuration
35
+ You can customize the module behavior via the templateModule key:
36
+
37
+ ```ts
38
+ export default defineNuxtConfig({
39
+ templateModule: {
40
+ /**
41
+ * Absolute or relative path to your custom tailwind.css file.
42
+ * Use this to inject custom @theme blocks or plugins.
43
+ */
44
+ tailwindCSSPath: '@/assets/css/tailwind.css'
45
+ }
46
+ })
47
+ ```
48
+
49
+ ## Usage
50
+ ## Components
51
+ The module automatically exports components from both the UI library and the template layer.
52
+
53
+ - **Base UI components**
54
+ Prefixed with `Ant` (e.g. `<AntButton />`)
55
+
56
+ - **Logic-driven template components**
57
+ Prefixed with `AntTemplate` (e.g. `<AntTemplateSaveButton />`)
58
+
59
+ ```vue
60
+ <template>
61
+ <div>
62
+ <AntButton>Button</AntButton>
63
+
64
+ <AntTemplateSaveButton @click="handleSave" />
65
+ </div>
66
+ </template>
67
+ ```
68
+
69
+ ## Toaster Plugin
70
+ Trigger notifications from anywhere in your app using the $templateModule helper.
71
+ The toaster is intended for global, non-blocking feedback such as:
72
+ - API success or error messages
73
+ - Redirect notifications
74
+ - Form submission feedback
75
+
76
+ ```ts
77
+ const { $templateModule } = useNuxtApp();
78
+
79
+ // Success Notification
80
+ $templateModule.toaster.toastSuccess('Success message');
81
+
82
+ // Error Notification
83
+ $templateModule.toaster.toastError('Error message');
84
+ ```
85
+
86
+ ## Composables (useUiClient)
87
+ > The `useUiClient()` composable is the main entry point for all client-side helpers.
88
+ > It exposes grouped utilities such as `utils` (forms, routing) and `handler` (response handling).
89
+
90
+ Form Validation with useFormField
91
+ Wraps a validation function (e.g., a Yup schema check) and returns reactive properties ready for use with Antify UI components.
92
+
93
+ ```vue
94
+ <script setup lang="ts">
95
+ import {
96
+ useUiClient,
97
+ ref,
98
+ } from '#imports'
99
+ import {
100
+ string
101
+ } from 'yup';
102
+
103
+ const { utils } = useUiClient();
104
+
105
+ const mySchema = string().required('This field is required');
106
+ const val = ref('');
107
+
108
+ const { errors, state, validate } = utils.useFormField(async () => {
109
+ // Your yup validation logic
110
+ await mySchema.validate(val.value);
111
+ });
112
+ </script>
113
+
114
+ <template>
115
+ <AntTextInput
116
+ v-model="val"
117
+ :messages="errors"
118
+ :state="state"
119
+ @validate="validate"
120
+ />
121
+ </template>
122
+ ```
123
+
124
+ CRUD Routing
125
+ Easily manage navigation and state detection (Create vs. Update page) within your application.
126
+
127
+ ```ts
128
+ const { utils } = useUiClient();
129
+ const { isCreatePage, isUpdatePage, getDetailRoute, isListingPage, isDetailPage } = utils.useCrudRouting(
130
+ 'users-id', // Detail route name
131
+ 'users' // Listing route name
132
+ );
133
+ ```
134
+
135
+ Response Handling
136
+ Automate repetitive tasks like handling 404s or fatal errors during data fetching.
137
+
138
+ ```ts
139
+ const { handler } = useUiClient();
140
+
141
+ // Handles "not found" data from API and redirects with a toast message
142
+ await handler.handleNotFoundResponse(response, '/fallback-url');
143
+
144
+ // Throws a fatal Nuxt error if a fetch error occurs
145
+ handler.handleResponseError(error);
146
+ ```
147
+
148
+ ## Development
149
+
150
+ 1. Clone this repository
151
+
152
+ 2. Install dependencies:
153
+ ```bash
154
+ pnpm install
155
+ ```
156
+ 3. Start the playground:
157
+ ```bash
158
+ pnpm dev
159
+ ```
160
+
161
+ ## License
162
+ MIT License
163
+
@@ -0,0 +1,10 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+ export * from '../dist/runtime/types.js';
3
+
4
+ type ModuleOptions = {
5
+ tailwindCSSPath?: string;
6
+ };
7
+
8
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
9
+
10
+ export { _default as default };
@@ -0,0 +1,10 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+ export * from '../dist/runtime/types.js';
3
+
4
+ type ModuleOptions = {
5
+ tailwindCSSPath?: string;
6
+ };
7
+
8
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
9
+
10
+ export { _default as default };
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@antify/template-module",
3
+ "configKey": "templateModule",
4
+ "version": "0.0.2",
5
+ "builder": {
6
+ "@nuxt/module-builder": "1.0.2",
7
+ "unbuild": "2.0.0"
8
+ }
9
+ }
@@ -0,0 +1,101 @@
1
+ import { defineNuxtModule, createResolver, addPlugin, addImportsDir, addComponentsDir, addComponent } from '@nuxt/kit';
2
+ import tailwindcss from '@tailwindcss/vite';
3
+
4
+ const uiComponents = [
5
+ "AntButton",
6
+ "AntColorInput",
7
+ "AntDatePicker",
8
+ "AntDialog",
9
+ "AntField",
10
+ "AntFormGroup",
11
+ "AntFormGroupLabel",
12
+ "AntBaseInput",
13
+ "AntDropDown",
14
+ "AntInputDescription",
15
+ "AntInputLabel",
16
+ "AntInputLimiter",
17
+ "AntCheckbox",
18
+ "AntCheckboxGroup",
19
+ "AntDateInput",
20
+ "AntNumberInput",
21
+ "AntPasswordInput",
22
+ "AntRadio",
23
+ "AntRadioGroup",
24
+ "AntRangeSlider",
25
+ "AntSearch",
26
+ "AntSelect",
27
+ "AntSwitch",
28
+ "AntSwitcher",
29
+ "AntTagInput",
30
+ "AntTextarea",
31
+ "AntTextInput",
32
+ "AntUnitInput",
33
+ "AntImageInput",
34
+ "AntNavLeftLayout",
35
+ "AntNavbar",
36
+ "AntNavbarItem",
37
+ "AntTable",
38
+ "AntTabs",
39
+ "AntTransitionCollapseHeight",
40
+ "AntAccordion",
41
+ "AntAccordionItem",
42
+ "AntAlert",
43
+ "AntCard",
44
+ "AntContent",
45
+ "AntDropdown",
46
+ "AntIcon",
47
+ "AntKeycap",
48
+ "AntListGroup",
49
+ "AntListGroupItem",
50
+ "AntModal",
51
+ "AntPagination",
52
+ "AntPopover",
53
+ "AntSkeleton",
54
+ "AntSpinner",
55
+ "AntTag",
56
+ "AntToast",
57
+ "AntToaster",
58
+ "AntTooltip"
59
+ ];
60
+
61
+ const moduleKey = "templateModule";
62
+ const module$1 = defineNuxtModule({
63
+ meta: {
64
+ name: "@antify/template-module",
65
+ configKey: moduleKey
66
+ },
67
+ defaults: {},
68
+ async setup(options, nuxt) {
69
+ const { resolve } = createResolver(import.meta.url);
70
+ const runtimeDir = resolve("./runtime");
71
+ nuxt.options.build.transpile.push(runtimeDir);
72
+ addPlugin(resolve(runtimeDir, "plugins/template-module"));
73
+ addImportsDir(resolve(runtimeDir, "composables"));
74
+ nuxt.options.alias["#template-module"] = "@antify/ui";
75
+ await addComponentsDir({
76
+ path: resolve(resolve(runtimeDir, "components")),
77
+ prefix: "AntTemplate",
78
+ pathPrefix: false,
79
+ global: true
80
+ });
81
+ uiComponents.forEach((name) => {
82
+ addComponent({
83
+ name,
84
+ export: name,
85
+ global: true,
86
+ filePath: "@antify/ui/components"
87
+ });
88
+ });
89
+ nuxt.hook("vite:extendConfig", (viteInlineConfig) => {
90
+ viteInlineConfig.plugins.push(tailwindcss());
91
+ });
92
+ nuxt.options.css.push(resolve(runtimeDir, "assets/antify.css"));
93
+ if (options.tailwindCSSPath) {
94
+ const tailwindCSSPath = resolve(nuxt.options.rootDir, options.tailwindCSSPath);
95
+ nuxt.options.css.push(tailwindCSSPath);
96
+ }
97
+ nuxt.options.runtimeConfig.public[moduleKey] = options;
98
+ }
99
+ });
100
+
101
+ export { module$1 as default };
@@ -0,0 +1 @@
1
+ @import "@antify/ui";
@@ -0,0 +1,6 @@
1
+ import {Canvas, Meta, Story} from '@storybook/blocks';
2
+ import * as MainStories from './Main.stories';
3
+
4
+ <Meta of={MainStories}/>
5
+
6
+ <h1>This is the storybook for default template.</h1>
@@ -0,0 +1,52 @@
1
+ /**
2
+ * This button is used for everything what is the primary
3
+ * action like save, confirm, create, etc.
4
+ */
5
+ import type { IconDefinition } from '@fortawesome/free-solid-svg-icons';
6
+ import { Position, State, InputState, Size, Grouped } from '@antify/ui';
7
+ type __VLS_Props = {
8
+ iconLeft?: IconDefinition;
9
+ iconRight?: IconDefinition;
10
+ size?: Size;
11
+ disabled?: boolean;
12
+ grouped?: Grouped;
13
+ state?: State;
14
+ skeleton?: boolean;
15
+ expanded?: boolean;
16
+ filled?: boolean;
17
+ hasPermission?: boolean;
18
+ tooltipPosition?: Position;
19
+ tooltipState?: InputState;
20
+ tooltipDelay?: number;
21
+ submit?: boolean;
22
+ dataE2e?: string;
23
+ };
24
+ declare var __VLS_11: {}, __VLS_14: {}, __VLS_16: {};
25
+ type __VLS_Slots = {} & {
26
+ default?: (props: typeof __VLS_11) => any;
27
+ } & {
28
+ tooltipContent?: (props: typeof __VLS_14) => any;
29
+ } & {
30
+ invalidPermissionTooltipContent?: (props: typeof __VLS_16) => any;
31
+ };
32
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
33
+ blur: (...args: any[]) => void;
34
+ click: (...args: any[]) => void;
35
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
36
+ onBlur?: ((...args: any[]) => any) | undefined;
37
+ onClick?: ((...args: any[]) => any) | undefined;
38
+ }>, {
39
+ submit: boolean;
40
+ state: State;
41
+ filled: boolean;
42
+ dataE2e: string;
43
+ hasPermission: boolean;
44
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
45
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
46
+ declare const _default: typeof __VLS_export;
47
+ export default _default;
48
+ type __VLS_WithSlots<T, S> = T & {
49
+ new (): {
50
+ $slots: S;
51
+ };
52
+ };
@@ -0,0 +1,74 @@
1
+ <script setup>
2
+ import {
3
+ computed,
4
+ useSlots
5
+ } from "vue";
6
+ import {
7
+ AntButton,
8
+ Position,
9
+ State,
10
+ InputState,
11
+ Size,
12
+ Grouped,
13
+ hasSlotContent
14
+ } from "@antify/ui";
15
+ defineEmits([
16
+ "click",
17
+ "blur"
18
+ ]);
19
+ const props = defineProps({
20
+ iconLeft: { type: Object, required: false },
21
+ iconRight: { type: Object, required: false },
22
+ size: { type: String, required: false },
23
+ disabled: { type: Boolean, required: false },
24
+ grouped: { type: String, required: false },
25
+ state: { type: String, required: false, default: State.primary },
26
+ skeleton: { type: Boolean, required: false },
27
+ expanded: { type: Boolean, required: false },
28
+ filled: { type: Boolean, required: false, default: true },
29
+ hasPermission: { type: Boolean, required: false, default: true },
30
+ tooltipPosition: { type: String, required: false },
31
+ tooltipState: { type: String, required: false },
32
+ tooltipDelay: { type: Number, required: false },
33
+ submit: { type: Boolean, required: false, default: false },
34
+ dataE2e: { type: String, required: false, default: "action-button" }
35
+ });
36
+ const slots = useSlots();
37
+ const hasTooltip = computed(() => !props.skeleton && !props.disabled && props.hasPermission && hasSlotContent(slots["tooltipContent"]));
38
+ const hasPermissionTooltip = computed(() => !props.skeleton && !(!props.disabled && props.hasPermission) && hasSlotContent(slots["invalidPermissionTooltipContent"]));
39
+ </script>
40
+
41
+ <template>
42
+ <AntButton
43
+ :icon-left="iconLeft"
44
+ :icon-right="iconRight"
45
+ :size="size"
46
+ :disabled="disabled || !hasPermission"
47
+ :grouped="grouped"
48
+ :skeleton="skeleton"
49
+ :expanded="expanded"
50
+ :state="state"
51
+ :filled="filled"
52
+ :tooltip-position="tooltipPosition"
53
+ :tooltip-state="tooltipState"
54
+ :tooltip-delay="hasPermissionTooltip ? 300 : tooltipDelay"
55
+ :submit="submit"
56
+ :data-e2e="dataE2e"
57
+ @click="$emit('click')"
58
+ @blur="$emit('blur')"
59
+ >
60
+ <slot />
61
+
62
+ <template #tooltip-content>
63
+ <slot
64
+ v-if="hasTooltip"
65
+ name="tooltipContent"
66
+ />
67
+
68
+ <slot
69
+ v-if="hasPermissionTooltip"
70
+ name="invalidPermissionTooltipContent"
71
+ />
72
+ </template>
73
+ </AntButton>
74
+ </template>
@@ -0,0 +1,52 @@
1
+ /**
2
+ * This button is used for everything what is the primary
3
+ * action like save, confirm, create, etc.
4
+ */
5
+ import type { IconDefinition } from '@fortawesome/free-solid-svg-icons';
6
+ import { Position, State, InputState, Size, Grouped } from '@antify/ui';
7
+ type __VLS_Props = {
8
+ iconLeft?: IconDefinition;
9
+ iconRight?: IconDefinition;
10
+ size?: Size;
11
+ disabled?: boolean;
12
+ grouped?: Grouped;
13
+ state?: State;
14
+ skeleton?: boolean;
15
+ expanded?: boolean;
16
+ filled?: boolean;
17
+ hasPermission?: boolean;
18
+ tooltipPosition?: Position;
19
+ tooltipState?: InputState;
20
+ tooltipDelay?: number;
21
+ submit?: boolean;
22
+ dataE2e?: string;
23
+ };
24
+ declare var __VLS_11: {}, __VLS_14: {}, __VLS_16: {};
25
+ type __VLS_Slots = {} & {
26
+ default?: (props: typeof __VLS_11) => any;
27
+ } & {
28
+ tooltipContent?: (props: typeof __VLS_14) => any;
29
+ } & {
30
+ invalidPermissionTooltipContent?: (props: typeof __VLS_16) => any;
31
+ };
32
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
33
+ blur: (...args: any[]) => void;
34
+ click: (...args: any[]) => void;
35
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
36
+ onBlur?: ((...args: any[]) => any) | undefined;
37
+ onClick?: ((...args: any[]) => any) | undefined;
38
+ }>, {
39
+ submit: boolean;
40
+ state: State;
41
+ filled: boolean;
42
+ dataE2e: string;
43
+ hasPermission: boolean;
44
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
45
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
46
+ declare const _default: typeof __VLS_export;
47
+ export default _default;
48
+ type __VLS_WithSlots<T, S> = T & {
49
+ new (): {
50
+ $slots: S;
51
+ };
52
+ };
@@ -0,0 +1,25 @@
1
+ import { Position, Size, Grouped, InputState } from '@antify/ui';
2
+ type __VLS_Props = {
3
+ iconVariant?: boolean;
4
+ size?: Size;
5
+ disabled?: boolean;
6
+ grouped?: Grouped;
7
+ skeleton?: boolean;
8
+ expanded?: boolean;
9
+ canCreate?: boolean;
10
+ tooltipPosition?: Position;
11
+ createTooltipMessage?: string;
12
+ tooltipState?: InputState;
13
+ };
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ blur: (...args: any[]) => void;
16
+ click: (...args: any[]) => void;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ onBlur?: ((...args: any[]) => any) | undefined;
19
+ onClick?: ((...args: any[]) => any) | undefined;
20
+ }>, {
21
+ iconVariant: boolean;
22
+ canCreate: boolean;
23
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: typeof __VLS_export;
25
+ export default _default;
@@ -0,0 +1,67 @@
1
+ <script setup>
2
+ import ActionButton from "./ActionButton.vue";
3
+ import {
4
+ Position,
5
+ Size,
6
+ Grouped,
7
+ State,
8
+ InputState
9
+ } from "@antify/ui";
10
+ import {
11
+ faPlus
12
+ } from "@fortawesome/free-solid-svg-icons";
13
+ defineEmits([
14
+ "click",
15
+ "blur"
16
+ ]);
17
+ defineProps({
18
+ iconVariant: { type: Boolean, required: false, default: false },
19
+ size: { type: String, required: false },
20
+ disabled: { type: Boolean, required: false },
21
+ grouped: { type: String, required: false },
22
+ skeleton: { type: Boolean, required: false },
23
+ expanded: { type: Boolean, required: false },
24
+ canCreate: { type: Boolean, required: false, default: true },
25
+ tooltipPosition: { type: String, required: false },
26
+ createTooltipMessage: { type: String, required: false },
27
+ tooltipState: { type: String, required: false }
28
+ });
29
+ </script>
30
+
31
+ <template>
32
+ <ActionButton
33
+ :filled="false"
34
+ :state="State.primary"
35
+ :size="size"
36
+ :disabled="disabled"
37
+ :icon-left="iconVariant ? faPlus : void 0"
38
+ :grouped="grouped"
39
+ :skeleton="skeleton"
40
+ :expanded="expanded"
41
+ :has-permission="canCreate"
42
+ :tooltip-position="tooltipPosition"
43
+ :tooltip-state="tooltipState"
44
+ data-e2e="create-button"
45
+ @click="$emit('click')"
46
+ @blur="$emit('blur')"
47
+ >
48
+ <template
49
+ v-if="!iconVariant"
50
+ #default
51
+ >
52
+ Erstellen
53
+ </template>
54
+
55
+ <template #invalidPermissionTooltipContent>
56
+ <div>
57
+ <template v-if="createTooltipMessage">
58
+ {{ createTooltipMessage }}
59
+ </template>
60
+
61
+ <template v-else>
62
+ Du hast keine Berechtigung um Einträge zu erstellen.<br> Bitte kontaktiere deinen Administrator
63
+ </template>
64
+ </div>
65
+ </template>
66
+ </ActionButton>
67
+ </template>
@@ -0,0 +1,25 @@
1
+ import { Position, Size, Grouped, InputState } from '@antify/ui';
2
+ type __VLS_Props = {
3
+ iconVariant?: boolean;
4
+ size?: Size;
5
+ disabled?: boolean;
6
+ grouped?: Grouped;
7
+ skeleton?: boolean;
8
+ expanded?: boolean;
9
+ canCreate?: boolean;
10
+ tooltipPosition?: Position;
11
+ createTooltipMessage?: string;
12
+ tooltipState?: InputState;
13
+ };
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ blur: (...args: any[]) => void;
16
+ click: (...args: any[]) => void;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ onBlur?: ((...args: any[]) => any) | undefined;
19
+ onClick?: ((...args: any[]) => any) | undefined;
20
+ }>, {
21
+ iconVariant: boolean;
22
+ canCreate: boolean;
23
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: typeof __VLS_export;
25
+ export default _default;
@@ -0,0 +1,25 @@
1
+ import { Position, Size, Grouped, InputState } from '@antify/ui';
2
+ type __VLS_Props = {
3
+ iconVariant?: boolean;
4
+ size?: Size;
5
+ disabled?: boolean;
6
+ grouped?: Grouped;
7
+ skeleton?: boolean;
8
+ expanded?: boolean;
9
+ canDelete?: boolean;
10
+ tooltipPosition?: Position;
11
+ deleteTooltipMessage?: string;
12
+ tooltipState?: InputState;
13
+ };
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ blur: (...args: any[]) => void;
16
+ click: (...args: any[]) => void;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ onBlur?: ((...args: any[]) => any) | undefined;
19
+ onClick?: ((...args: any[]) => any) | undefined;
20
+ }>, {
21
+ iconVariant: boolean;
22
+ canDelete: boolean;
23
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: typeof __VLS_export;
25
+ export default _default;