@schwarzdavid/ui-kit 0.0.1-alpha.16 → 0.0.1-alpha.19
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 +162 -2
- package/dist/main.d.ts +235 -65
- package/dist/main.js +1376 -851
- package/dist/ui-kit.css +2 -1
- package/dist/validators.d.ts +21 -17
- package/dist/validators.js +52 -80
- package/dist/vuetify/settings.scss +32 -0
- package/dist/vuetify.d.ts +31 -0
- package/dist/vuetify.js +288 -0
- package/package.json +84 -61
- package/dist/favicon.ico +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,165 @@
|
|
|
1
1
|
# @schwarzdavid/ui-kit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Vue 3 + Vuetify composables and components for promise-based dialogs, toasts, loading states and translated Vuelidate validators. Dialogs and toasts are created from code with `useDialog()` and `useToast()`, rendered by a single `<UiKitOutlet />`, and settle a Promise when the user closes them.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @schwarzdavid/ui-kit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The following peer dependencies must be installed in your application:
|
|
12
|
+
|
|
13
|
+
| Package | Version |
|
|
14
|
+
|-------------------|---------------------------------|
|
|
15
|
+
| `vue` | `^3.5.0` |
|
|
16
|
+
| `vuetify` | `^3.0.0 \|\| ^4.0.0` |
|
|
17
|
+
| `vue-i18n` | `^9.0.0 \|\| ^10.0.0 \|\| ^11.0.0` |
|
|
18
|
+
| `@vuelidate/core` | `^2.0.0` |
|
|
19
|
+
|
|
20
|
+
The package is published as ESM only and has three entry points:
|
|
21
|
+
|
|
22
|
+
- `@schwarzdavid/ui-kit` for the plugin, the outlet component and the composables
|
|
23
|
+
- `@schwarzdavid/ui-kit/validators` for the translated Vuelidate validators
|
|
24
|
+
- `@schwarzdavid/ui-kit/styles` for the stylesheet
|
|
25
|
+
|
|
26
|
+
## Setup
|
|
27
|
+
|
|
28
|
+
1. Register Vuetify, vue-i18n and the ui-kit plugin with `app.use(createUIKit(options))`. All options are optional; see the Configuration page in the docs for the full list and defaults.
|
|
29
|
+
2. Import `@schwarzdavid/ui-kit/styles` once.
|
|
30
|
+
3. Mount `<UiKitOutlet />` once inside `<VApp>`, usually in `App.vue`. It renders every dialog, toast and the loading overlay.
|
|
31
|
+
4. Provide translations for the button labels. By default the dialogs look up `common.yes`, `common.no`, `action.cancel`, `action.close` and `action.save` in the global vue-i18n instance. A key that does not exist is rendered verbatim, so the dialogs still work without translations.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { createApp } from 'vue'
|
|
35
|
+
import { createVuetify } from 'vuetify'
|
|
36
|
+
import { createI18n } from 'vue-i18n'
|
|
37
|
+
import { createUIKit } from '@schwarzdavid/ui-kit'
|
|
38
|
+
import { setGlobalValidationSettings } from '@schwarzdavid/ui-kit/validators'
|
|
39
|
+
import 'vuetify/styles'
|
|
40
|
+
import '@schwarzdavid/ui-kit/styles'
|
|
41
|
+
import App from './App.vue'
|
|
42
|
+
|
|
43
|
+
const i18n = createI18n({
|
|
44
|
+
legacy: false,
|
|
45
|
+
locale: 'en',
|
|
46
|
+
messages: {
|
|
47
|
+
en: {
|
|
48
|
+
common: { yes: 'Yes', no: 'No' },
|
|
49
|
+
action: { cancel: 'Cancel', close: 'Close', save: 'Save' },
|
|
50
|
+
validation: { required: 'This field is required' },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
setGlobalValidationSettings({
|
|
56
|
+
t: (path, params) => i18n.global.t(path, params),
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
createApp(App)
|
|
60
|
+
.use(createVuetify())
|
|
61
|
+
.use(i18n)
|
|
62
|
+
.use(createUIKit({
|
|
63
|
+
toast: { timeout: 6000 },
|
|
64
|
+
}))
|
|
65
|
+
.mount('#app')
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```vue
|
|
69
|
+
<template>
|
|
70
|
+
<VApp>
|
|
71
|
+
<VMain>
|
|
72
|
+
<RouterView />
|
|
73
|
+
</VMain>
|
|
74
|
+
<UiKitOutlet />
|
|
75
|
+
</VApp>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<script lang="ts" setup>
|
|
79
|
+
import { UiKitOutlet } from '@schwarzdavid/ui-kit'
|
|
80
|
+
</script>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The composables must be called inside `setup()` or inside `app.runWithContext()`. Anywhere else they throw `@schwarzdavid/ui-kit is not available in this context. Install it with app.use(createUIKit()) and call its composables inside setup() or app.runWithContext().`
|
|
84
|
+
|
|
85
|
+
## Usage
|
|
86
|
+
|
|
87
|
+
### useDialog
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { useDialog } from '@schwarzdavid/ui-kit'
|
|
91
|
+
|
|
92
|
+
const dialog = useDialog()
|
|
93
|
+
|
|
94
|
+
const confirmed = await dialog.confirm('items.delete.title', 'items.delete.content')
|
|
95
|
+
await dialog.info('about.title', 'about.content')
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
`useDialog()` also provides `confirm()` and `form()`, which renders your own input or form component and resolves with its value.
|
|
99
|
+
|
|
100
|
+
### useToast
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { useToast } from '@schwarzdavid/ui-kit'
|
|
104
|
+
|
|
105
|
+
const toast = useToast()
|
|
106
|
+
|
|
107
|
+
await toast.success('items.saved')
|
|
108
|
+
toast.error('Upload failed', { translateMessage: false, timeout: 8000 })
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Each toast function returns a Promise that resolves when the toast disappears.
|
|
112
|
+
|
|
113
|
+
### useLoading
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import { useLoading } from '@schwarzdavid/ui-kit'
|
|
117
|
+
|
|
118
|
+
const { loading, action: save } = useLoading(async (id: number) => api.save(id), { overlay: true })
|
|
119
|
+
|
|
120
|
+
const result = await save(42)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Validators
|
|
124
|
+
|
|
125
|
+
The validators entry wraps the `@vuelidate/validators` rules so that their messages are translated. Call `setGlobalValidationSettings` once with your translation function (see Setup), then use the rules with `useVuelidate`. `useVuelidateErrors` turns a validation object into a nested object of translated error messages.
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
import useVuelidate from '@vuelidate/core'
|
|
129
|
+
import { email, minLength, required, useVuelidateErrors } from '@schwarzdavid/ui-kit/validators'
|
|
130
|
+
|
|
131
|
+
const v = useVuelidate({
|
|
132
|
+
name: { required, minLength: minLength(3) },
|
|
133
|
+
email: { required, email },
|
|
134
|
+
}, state)
|
|
135
|
+
|
|
136
|
+
const errors = useVuelidateErrors(v)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Documentation
|
|
140
|
+
|
|
141
|
+
The full documentation, including live demos of every composable, is a Storybook. Run it locally with:
|
|
142
|
+
|
|
143
|
+
```sh
|
|
144
|
+
npm run docs
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
and open http://localhost:6006.
|
|
148
|
+
|
|
149
|
+
## Development
|
|
150
|
+
|
|
151
|
+
| Script | Description |
|
|
152
|
+
|----------------------|----------------------------------------------------------------|
|
|
153
|
+
| `npm run lint` | Run ESLint |
|
|
154
|
+
| `npm run check` | Type-check the project with `vue-tsc` |
|
|
155
|
+
| `npm test` | Run the Vitest test suite |
|
|
156
|
+
| `npm run build:lib` | Type-check and build the library into `dist/` |
|
|
157
|
+
| `npm run build:docs` | Build the static Storybook into `storybook-static/` |
|
|
158
|
+
|
|
159
|
+
## Known limitations
|
|
160
|
+
|
|
161
|
+
- `useVuelidateErrors` has not been made to work with `$each` collection validators (rules built with Vuelidate's `helpers.forEach`). Errors of the individual collection items are not mapped into the result; read them from the validation object directly.
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
Apache-2.0
|
package/dist/main.d.ts
CHANGED
|
@@ -1,19 +1,121 @@
|
|
|
1
|
+
import { AllowedComponentProps } from 'vue';
|
|
1
2
|
import { Component } from 'vue';
|
|
3
|
+
import { ComponentCustomProps } from 'vue';
|
|
2
4
|
import { ComponentOptionsMixin } from 'vue';
|
|
3
5
|
import { ComponentProps } from 'vue-component-type-helpers';
|
|
4
6
|
import { ComponentProvideOptions } from 'vue';
|
|
5
|
-
import { ComponentPublicInstance } from 'vue';
|
|
6
|
-
import { ComputedOptions } from 'vue';
|
|
7
7
|
import { DefineComponent } from 'vue';
|
|
8
|
-
import { EmitFn } from 'vue';
|
|
9
8
|
import { FunctionPlugin } from 'vue';
|
|
10
|
-
import {
|
|
9
|
+
import { HasRequiredKeys } from 'type-fest';
|
|
11
10
|
import { MaybeRefOrGetter } from 'vue';
|
|
12
|
-
import { MethodOptions } from 'vue';
|
|
13
11
|
import { PartialDeep } from 'type-fest';
|
|
14
12
|
import { Promisable } from 'type-fest';
|
|
15
13
|
import { PublicProps } from 'vue';
|
|
16
14
|
import { Ref } from 'vue';
|
|
15
|
+
import { VNodeProps } from 'vue';
|
|
16
|
+
|
|
17
|
+
declare const __VLS_base: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
18
|
+
close: () => any;
|
|
19
|
+
submit: () => any;
|
|
20
|
+
"update:modelValue": (value: boolean) => any;
|
|
21
|
+
"update:stage": (stage: SheetStage) => any;
|
|
22
|
+
opened: () => any;
|
|
23
|
+
closed: () => any;
|
|
24
|
+
}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
25
|
+
onClose?: (() => any) | undefined;
|
|
26
|
+
onSubmit?: (() => any) | undefined;
|
|
27
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
28
|
+
"onUpdate:stage"?: ((stage: SheetStage) => any) | undefined;
|
|
29
|
+
onOpened?: (() => any) | undefined;
|
|
30
|
+
onClosed?: (() => any) | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
form: boolean;
|
|
33
|
+
title: string;
|
|
34
|
+
persistent: boolean;
|
|
35
|
+
stage: SheetStage;
|
|
36
|
+
translateTitle: boolean;
|
|
37
|
+
expandable: boolean;
|
|
38
|
+
closable: boolean;
|
|
39
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
40
|
+
|
|
41
|
+
declare const __VLS_base_2: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
42
|
+
close: () => any;
|
|
43
|
+
submit: () => any;
|
|
44
|
+
"update:modelValue": (value: boolean) => any;
|
|
45
|
+
"update:stage": (stage: SheetStage) => any;
|
|
46
|
+
opened: () => any;
|
|
47
|
+
closed: () => any;
|
|
48
|
+
}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
|
|
49
|
+
onClose?: (() => any) | undefined;
|
|
50
|
+
onSubmit?: (() => any) | undefined;
|
|
51
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
52
|
+
"onUpdate:stage"?: ((stage: SheetStage) => any) | undefined;
|
|
53
|
+
onOpened?: (() => any) | undefined;
|
|
54
|
+
onClosed?: (() => any) | undefined;
|
|
55
|
+
}>, {
|
|
56
|
+
width: DialogWidth;
|
|
57
|
+
form: boolean;
|
|
58
|
+
persistent: boolean;
|
|
59
|
+
stage: SheetStage;
|
|
60
|
+
translateTitle: boolean;
|
|
61
|
+
expandable: boolean;
|
|
62
|
+
closable: boolean;
|
|
63
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
64
|
+
|
|
65
|
+
declare const __VLS_export: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
66
|
+
|
|
67
|
+
declare const __VLS_export_2: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
68
|
+
|
|
69
|
+
declare const __VLS_export_3: __VLS_WithSlots_2<typeof __VLS_base_2, __VLS_Slots_2>;
|
|
70
|
+
|
|
71
|
+
declare type __VLS_Props = {
|
|
72
|
+
modelValue: boolean;
|
|
73
|
+
stage?: SheetStage;
|
|
74
|
+
title?: string;
|
|
75
|
+
translateTitle?: boolean;
|
|
76
|
+
expandable?: boolean;
|
|
77
|
+
closable?: boolean;
|
|
78
|
+
persistent?: boolean;
|
|
79
|
+
form?: boolean;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
declare type __VLS_Props_2 = {
|
|
83
|
+
modelValue: boolean;
|
|
84
|
+
title: string;
|
|
85
|
+
translateTitle?: boolean;
|
|
86
|
+
width?: DialogWidth;
|
|
87
|
+
closable?: boolean;
|
|
88
|
+
persistent?: boolean;
|
|
89
|
+
form?: boolean;
|
|
90
|
+
expandable?: boolean;
|
|
91
|
+
stage?: SheetStage;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
declare type __VLS_Slots = {
|
|
95
|
+
default?: () => unknown;
|
|
96
|
+
preview?: () => unknown;
|
|
97
|
+
header?: () => unknown;
|
|
98
|
+
actions?: () => unknown;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
declare type __VLS_Slots_2 = {
|
|
102
|
+
default?: () => unknown;
|
|
103
|
+
preview?: () => unknown;
|
|
104
|
+
header?: () => unknown;
|
|
105
|
+
actions?: () => unknown;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
declare type __VLS_WithSlots<T, S> = T & {
|
|
109
|
+
new (): {
|
|
110
|
+
$slots: S;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
declare type __VLS_WithSlots_2<T, S> = T & {
|
|
115
|
+
new (): {
|
|
116
|
+
$slots: S;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
17
119
|
|
|
18
120
|
declare interface ConfirmDialogBaseProps {
|
|
19
121
|
title: string;
|
|
@@ -22,7 +124,7 @@ declare interface ConfirmDialogBaseProps {
|
|
|
22
124
|
rejectCta?: Partial<DialogCta>;
|
|
23
125
|
throwOnReject?: boolean;
|
|
24
126
|
permanent?: boolean;
|
|
25
|
-
|
|
127
|
+
width?: DialogWidth;
|
|
26
128
|
highlightCta?: 'confirm' | 'reject' | false;
|
|
27
129
|
level?: ConfirmDialogLevel;
|
|
28
130
|
}
|
|
@@ -44,64 +146,95 @@ export declare interface ConfirmDialogTextContent extends ConfirmDialogBaseProps
|
|
|
44
146
|
translateContent?: boolean;
|
|
45
147
|
}
|
|
46
148
|
|
|
47
|
-
|
|
149
|
+
declare interface CreateToastQueueEntry {
|
|
150
|
+
type: ToastType;
|
|
151
|
+
message: string;
|
|
152
|
+
translateMessage: boolean;
|
|
153
|
+
timeout: number | false;
|
|
154
|
+
action?: ToastAction;
|
|
155
|
+
resolve(triggered: boolean): void;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export declare function createUIKit(options?: CreateUIKitOptions): FunctionPlugin<unknown[]>;
|
|
159
|
+
|
|
160
|
+
export declare type CreateUIKitOptions = PartialDeep<Omit<PluginOptions, 'components'>> & {
|
|
161
|
+
components?: {
|
|
162
|
+
dialog?: Partial<PluginDialogComponentOptions>;
|
|
163
|
+
toast?: Component;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
48
166
|
|
|
49
|
-
declare interface DialogActionCta extends DialogCta {
|
|
167
|
+
export declare interface DialogActionCta extends DialogCta {
|
|
50
168
|
action(): unknown;
|
|
51
169
|
}
|
|
52
170
|
|
|
53
171
|
export declare interface DialogComposable {
|
|
54
172
|
info(title: string, content: string): Promise<null>;
|
|
55
173
|
info<T = void, C extends Component = Component>(options: InfoDialogProps<T, C>): Promise<T extends void ? null : (T | null)>;
|
|
56
|
-
prompt<T, R extends boolean = false, C extends PromptDialogComponent<T> = PromptDialogComponent<T>>(options: PromptDialogProps<T, R, C>): Promise<R extends true ? T : T | null>;
|
|
57
174
|
confirm(title: string, content: string, level?: ConfirmDialogLevel): Promise<boolean>;
|
|
58
175
|
confirm<C extends Component = Component>(options: ConfirmDialogProps<C>): Promise<boolean>;
|
|
59
|
-
form<
|
|
176
|
+
form<T, R = T, Required extends boolean = false, C extends Component = Component>(options: FormDialogProps<T, R, Required, C>): Promise<Required extends true ? R : R | null>;
|
|
60
177
|
}
|
|
61
178
|
|
|
62
|
-
declare interface DialogCta {
|
|
179
|
+
export declare interface DialogCta {
|
|
63
180
|
text: string;
|
|
64
181
|
translateText: boolean;
|
|
65
182
|
}
|
|
66
183
|
|
|
67
|
-
declare
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
value: T;
|
|
184
|
+
export declare interface DialogEntryContext<Data = unknown, Value = unknown> {
|
|
185
|
+
readonly id: string;
|
|
186
|
+
readonly data: Data;
|
|
187
|
+
resolve(value: Value): void;
|
|
188
|
+
reject(reason?: unknown): void;
|
|
73
189
|
}
|
|
74
190
|
|
|
75
|
-
export declare
|
|
191
|
+
export declare interface DialogFormContext {
|
|
192
|
+
submit(): Promise<void>;
|
|
193
|
+
loading: Readonly<Ref<boolean>>;
|
|
194
|
+
}
|
|
76
195
|
|
|
77
|
-
export declare type
|
|
78
|
-
$emit: EmitFn<FormDialogComponentEmits>;
|
|
79
|
-
};
|
|
196
|
+
export declare type DialogFormFinish<T> = () => Promisable<T>;
|
|
80
197
|
|
|
81
|
-
|
|
82
|
-
|
|
198
|
+
declare type DialogProps<T extends object> = PropsRequired<OwnProps<T>> extends true ? {
|
|
199
|
+
props: OwnProps<T>;
|
|
200
|
+
} : {
|
|
201
|
+
props?: OwnProps<T>;
|
|
83
202
|
};
|
|
84
203
|
|
|
85
|
-
export declare interface
|
|
86
|
-
|
|
204
|
+
export declare interface DialogValueCta<T> extends DialogCta {
|
|
205
|
+
value: T;
|
|
87
206
|
}
|
|
88
207
|
|
|
89
|
-
export declare type
|
|
208
|
+
export declare type DialogWidth = 'sm' | 'md' | 'lg' | number;
|
|
209
|
+
|
|
210
|
+
export declare type FormDialogAction<T, R> = (value: T) => Promise<R>;
|
|
211
|
+
|
|
212
|
+
export declare interface FormDialogBaseProps<T, R = T, Required extends boolean = false, C extends Component = Component> {
|
|
90
213
|
title: string;
|
|
91
|
-
translateTitle?:
|
|
214
|
+
translateTitle?: boolean;
|
|
215
|
+
width?: DialogWidth;
|
|
92
216
|
saveCta?: Partial<DialogCta>;
|
|
93
217
|
abortCta?: Partial<DialogCta>;
|
|
94
218
|
component: C;
|
|
219
|
+
initialValue?: MaybeRefOrGetter<T>;
|
|
95
220
|
action?: FormDialogAction<T, R>;
|
|
96
|
-
|
|
97
|
-
}
|
|
221
|
+
required?: Required;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export declare type FormDialogInjectedProp = 'modelValue' | 'onUpdate:modelValue' | 'toolbar';
|
|
225
|
+
|
|
226
|
+
declare type FormDialogModelCheck<T, C extends Component> = unknown extends T ? unknown : 'modelValue' extends keyof ComponentProps<C> ? [T] extends [NonNullable<ComponentProps<C>['modelValue']>] ? unknown : {
|
|
227
|
+
component: never;
|
|
228
|
+
} : unknown;
|
|
229
|
+
|
|
230
|
+
export declare type FormDialogProps<T, R = T, Required extends boolean = false, C extends Component = Component> = DialogProps<Omit<ComponentProps<C>, FormDialogInjectedProp>> & FormDialogModelCheck<T, C> & FormDialogBaseProps<T, R, Required, C>;
|
|
98
231
|
|
|
99
232
|
declare interface InfoDialogBaseProps<T> {
|
|
100
233
|
title: string;
|
|
101
234
|
translateTitle?: boolean;
|
|
102
235
|
additionalCta?: InteractiveDialogCta<T>[];
|
|
103
|
-
defaultCta?: Partial<
|
|
104
|
-
width?:
|
|
236
|
+
defaultCta?: Partial<DialogCta> | false;
|
|
237
|
+
width?: DialogWidth;
|
|
105
238
|
}
|
|
106
239
|
|
|
107
240
|
export declare type InfoDialogComponentContent<T = void, C extends Component = Component> = DialogProps<ComponentProps<C>> & InfoDialogBaseProps<T> & {
|
|
@@ -115,81 +248,118 @@ export declare interface InfoDialogTextContent<T> extends InfoDialogBaseProps<T>
|
|
|
115
248
|
translateContent?: boolean;
|
|
116
249
|
}
|
|
117
250
|
|
|
118
|
-
declare type InteractiveDialogCta<T> = DialogActionCta | DialogValueCta<T>;
|
|
251
|
+
export declare type InteractiveDialogCta<T> = DialogActionCta | DialogValueCta<T>;
|
|
119
252
|
|
|
120
|
-
export declare type LoadingAction = (...args:
|
|
253
|
+
export declare type LoadingAction = (...args: never[]) => unknown;
|
|
121
254
|
|
|
122
255
|
export declare interface LoadingComposable<A extends LoadingAction> {
|
|
123
256
|
loading: Readonly<Ref<boolean>>;
|
|
124
257
|
action(...args: Parameters<A>): Promise<Awaited<ReturnType<A>>>;
|
|
125
258
|
}
|
|
126
259
|
|
|
127
|
-
declare type
|
|
260
|
+
declare type OwnProps<T extends object> = Omit<T, keyof VNodeProps | keyof AllowedComponentProps | keyof ComponentCustomProps>;
|
|
261
|
+
|
|
262
|
+
export declare interface PluginComponentOptions {
|
|
263
|
+
dialog: PluginDialogComponentOptions;
|
|
264
|
+
toast: Component;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export declare interface PluginDialogComponentOptions {
|
|
268
|
+
info: Component;
|
|
269
|
+
confirm: Component;
|
|
270
|
+
form: Component;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export declare interface PluginDialogOptions {
|
|
274
|
+
closeOnOverlayClick: boolean;
|
|
275
|
+
}
|
|
128
276
|
|
|
129
|
-
declare
|
|
277
|
+
export declare type PluginI18nMessageKey = 'save' | 'cancel' | 'close' | 'yes' | 'no' | 'saveFailed' | 'unknownError' | 'expand' | 'collapse';
|
|
278
|
+
|
|
279
|
+
export declare interface PluginI18nOptions {
|
|
130
280
|
messages: Record<PluginI18nMessageKey, string>;
|
|
131
281
|
}
|
|
132
282
|
|
|
133
|
-
declare interface PluginLoadingOptions {
|
|
283
|
+
export declare interface PluginLoadingOptions {
|
|
134
284
|
delay: number | false;
|
|
135
285
|
overlay: boolean;
|
|
136
286
|
}
|
|
137
287
|
|
|
138
|
-
declare interface PluginOptions {
|
|
288
|
+
export declare interface PluginOptions {
|
|
139
289
|
loading: PluginLoadingOptions;
|
|
140
290
|
toast: PluginToastOptions;
|
|
291
|
+
dialog: PluginDialogOptions;
|
|
141
292
|
i18n: PluginI18nOptions;
|
|
293
|
+
components: PluginComponentOptions;
|
|
142
294
|
}
|
|
143
295
|
|
|
144
|
-
declare interface PluginToastOptions {
|
|
296
|
+
export declare interface PluginToastOptions {
|
|
145
297
|
timeout: number;
|
|
298
|
+
errorTimeout: number | false;
|
|
146
299
|
}
|
|
147
300
|
|
|
148
|
-
|
|
301
|
+
declare type PropsRequired<P extends object> = string extends keyof P ? false : HasRequiredKeys<P>;
|
|
149
302
|
|
|
150
|
-
export declare type
|
|
303
|
+
export declare type SheetStage = 'preview' | 'content' | 'fullscreen';
|
|
151
304
|
|
|
152
|
-
export declare interface
|
|
153
|
-
|
|
154
|
-
|
|
305
|
+
export declare interface ToastAction {
|
|
306
|
+
text: string;
|
|
307
|
+
translateText?: boolean;
|
|
308
|
+
handler?: () => unknown;
|
|
155
309
|
}
|
|
156
310
|
|
|
157
|
-
export declare
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
initialValue?: MaybeRefOrGetter<T>;
|
|
163
|
-
size?: PromptDialogSize;
|
|
164
|
-
required?: R;
|
|
165
|
-
component: C;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
export declare enum PromptDialogSize {
|
|
169
|
-
SMALL = "sm",
|
|
170
|
-
LARGE = "lg"
|
|
311
|
+
export declare interface ToastComposable {
|
|
312
|
+
info: ToastFunction;
|
|
313
|
+
warn: ToastFunction;
|
|
314
|
+
error: ToastFunction;
|
|
315
|
+
success: ToastFunction;
|
|
171
316
|
}
|
|
172
317
|
|
|
173
|
-
export declare interface
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
success(message: string, options?: Partial<ToastOptions>): Promise<void>;
|
|
318
|
+
export declare interface ToastEntryContext {
|
|
319
|
+
readonly entry: ToastEntryData;
|
|
320
|
+
close(): void;
|
|
321
|
+
trigger(): void;
|
|
178
322
|
}
|
|
179
323
|
|
|
180
|
-
declare
|
|
181
|
-
|
|
324
|
+
export declare type ToastEntryData = Omit<ToastQueueEntry, 'resolve'>;
|
|
325
|
+
|
|
326
|
+
export declare type ToastFunction = (message: string, options?: Partial<ToastOptions>) => Promise<boolean>;
|
|
327
|
+
|
|
328
|
+
export declare interface ToastOptions {
|
|
329
|
+
timeout: number | false;
|
|
182
330
|
translateMessage: boolean;
|
|
331
|
+
action?: ToastAction;
|
|
183
332
|
}
|
|
184
333
|
|
|
185
|
-
export declare
|
|
334
|
+
export declare interface ToastQueueEntry extends CreateToastQueueEntry {
|
|
335
|
+
id: string;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export declare enum ToastType {
|
|
339
|
+
SUCCESS = "success",
|
|
340
|
+
INFO = "info",
|
|
341
|
+
WARNING = "warning",
|
|
342
|
+
ERROR = "error"
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export declare const UiBottomSheet: typeof __VLS_export_2;
|
|
346
|
+
|
|
347
|
+
export declare const UiKitOutlet: typeof __VLS_export;
|
|
348
|
+
|
|
349
|
+
export declare const UiResponsiveDialog: typeof __VLS_export_3;
|
|
186
350
|
|
|
187
351
|
export declare function useDialog(): DialogComposable;
|
|
188
352
|
|
|
353
|
+
export declare function useDialogEntry<Data, Value = unknown>(): DialogEntryContext<Data, Value>;
|
|
354
|
+
|
|
355
|
+
export declare function useDialogForm<T>(finish: DialogFormFinish<T>): DialogFormContext;
|
|
356
|
+
|
|
189
357
|
export declare function useLoading<A extends LoadingAction>(actionCallback: A, options?: Partial<PluginLoadingOptions>): LoadingComposable<A>;
|
|
190
358
|
|
|
191
359
|
export declare function useLoadingOverlay(): Ref<boolean>;
|
|
192
360
|
|
|
193
361
|
export declare function useToast(): ToastComposable;
|
|
194
362
|
|
|
363
|
+
export declare function useToastEntry(): ToastEntryContext;
|
|
364
|
+
|
|
195
365
|
export { }
|