@webx-ui/core 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Affix/Affix.d.ts +37 -0
- package/dist/components/Affix/index.d.ts +2 -0
- package/dist/components/Affix/types.d.ts +14 -0
- package/dist/components/Avatar/Avatar.d.ts +31 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/types.d.ts +30 -0
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +8 -0
- package/dist/components/AvatarGroup/index.d.ts +2 -0
- package/dist/components/AvatarGroup/types.d.ts +12 -0
- package/dist/components/Backtop/Backtop.d.ts +31 -0
- package/dist/components/Backtop/index.d.ts +2 -0
- package/dist/components/Backtop/types.d.ts +19 -0
- package/dist/components/Cascader/Cascader.d.ts +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/Descriptions/Descriptions.d.ts +33 -0
- package/dist/components/Descriptions/context.d.ts +5 -0
- package/dist/components/Descriptions/index.d.ts +2 -0
- package/dist/components/Descriptions/types.d.ts +30 -0
- package/dist/components/DescriptionsItem/DescriptionsItem.d.ts +25 -0
- package/dist/components/DescriptionsItem/index.d.ts +1 -0
- package/dist/components/Empty/Empty.d.ts +38 -0
- package/dist/components/Empty/index.d.ts +2 -0
- package/dist/components/Empty/types.d.ts +20 -0
- package/dist/components/EntityCard/EntityCard.d.ts +1 -1
- package/dist/components/Form/Form.d.ts +1 -1
- package/dist/components/Image/Image.d.ts +43 -0
- package/dist/components/Image/index.d.ts +2 -0
- package/dist/components/Image/types.d.ts +26 -0
- package/dist/components/Indicator/Indicator.d.ts +1 -1
- package/dist/components/InputNumber/InputNumber.d.ts +2 -2
- package/dist/components/Loading/Loading.d.ts +34 -0
- package/dist/components/Loading/index.d.ts +2 -0
- package/dist/components/Loading/types.d.ts +25 -0
- package/dist/components/Popconfirm/Popconfirm.d.ts +69 -0
- package/dist/components/Popconfirm/index.d.ts +2 -0
- package/dist/components/Popconfirm/types.d.ts +33 -0
- package/dist/components/Progress/Progress.d.ts +41 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/types.d.ts +26 -0
- package/dist/components/Rate/Rate.d.ts +1 -1
- package/dist/components/Result/Result.d.ts +38 -0
- package/dist/components/Result/index.d.ts +2 -0
- package/dist/components/Result/types.d.ts +15 -0
- package/dist/components/Segmented/Segmented.d.ts +44 -0
- package/dist/components/Segmented/index.d.ts +2 -0
- package/dist/components/Segmented/types.d.ts +23 -0
- package/dist/components/SelectionArea/SelectionArea.d.ts +48 -0
- package/dist/components/SelectionArea/directive.d.ts +19 -0
- package/dist/components/SelectionArea/index.d.ts +3 -0
- package/dist/components/SelectionArea/types.d.ts +26 -0
- package/dist/components/Skeleton/Skeleton.d.ts +33 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Skeleton/types.d.ts +31 -0
- package/dist/components/SkeletonItem/SkeletonItem.d.ts +8 -0
- package/dist/components/SkeletonItem/index.d.ts +1 -0
- package/dist/components/Slider/Slider.d.ts +1 -1
- package/dist/components/SortableList/SortableList.d.ts +53 -0
- package/dist/components/SortableList/index.d.ts +2 -0
- package/dist/components/SortableList/types.d.ts +38 -0
- package/dist/components/Step/Step.d.ts +38 -0
- package/dist/components/Step/index.d.ts +1 -0
- package/dist/components/Steps/Steps.d.ts +31 -0
- package/dist/components/Steps/context.d.ts +5 -0
- package/dist/components/Steps/index.d.ts +2 -0
- package/dist/components/Steps/types.d.ts +44 -0
- package/dist/components/Table/types.d.ts +4 -3
- package/dist/components/Textarea/Textarea.d.ts +1 -1
- package/dist/components/Toaster/Toaster.d.ts +9 -0
- package/dist/components/Toaster/index.d.ts +2 -0
- package/dist/components/Toaster/types.d.ts +16 -0
- package/dist/components/Tooltip/Tooltip.d.ts +44 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/types.d.ts +25 -0
- package/dist/components/Upload/Upload.d.ts +74 -0
- package/dist/components/Upload/index.d.ts +2 -0
- package/dist/components/Upload/types.d.ts +54 -0
- package/dist/components/index.d.ts +22 -0
- package/dist/composables/confirm.d.ts +23 -0
- package/dist/composables/useModal.d.ts +68 -0
- package/dist/composables/useToast.d.ts +66 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5976 -3835
- package/dist/index.js.map +1 -1
- package/dist/internal/ConfirmDialog.d.ts +18 -0
- package/dist/{components/Menu → internal}/nodes.d.ts +6 -6
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as WxStep } from './Step';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { StepsProps } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: Readonly<{
|
|
5
|
+
default?: () => unknown;
|
|
6
|
+
}> & {
|
|
7
|
+
default?: () => unknown;
|
|
8
|
+
};
|
|
9
|
+
refs: {};
|
|
10
|
+
rootEl: HTMLOListElement;
|
|
11
|
+
};
|
|
12
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
13
|
+
declare const __VLS_component: import('vue').DefineComponent<StepsProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
|
+
change: (index: number) => any;
|
|
15
|
+
}, string, import('vue').PublicProps, Readonly<StepsProps> & Readonly<{
|
|
16
|
+
onChange?: ((index: number) => any) | undefined;
|
|
17
|
+
}>, {
|
|
18
|
+
size: import('./types').StepsSize;
|
|
19
|
+
ariaLabel: string;
|
|
20
|
+
error: boolean;
|
|
21
|
+
current: number;
|
|
22
|
+
direction: import('./types').StepsDirection;
|
|
23
|
+
clickable: boolean;
|
|
24
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLOListElement>;
|
|
25
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IconName } from '../Icon/types';
|
|
2
|
+
export type StepsDirection = 'horizontal' | 'vertical';
|
|
3
|
+
export type StepsSize = 'sm' | 'md';
|
|
4
|
+
/** Where a step stands relative to the one the reader is on. */
|
|
5
|
+
export type StepState = 'done' | 'current' | 'todo' | 'error';
|
|
6
|
+
export interface StepsProps {
|
|
7
|
+
/** Which step the reader is on, counting from zero. */
|
|
8
|
+
current?: number;
|
|
9
|
+
direction?: StepsDirection;
|
|
10
|
+
size?: StepsSize;
|
|
11
|
+
/** Marks the current step as gone wrong, without moving off it. */
|
|
12
|
+
error?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Lets a finished step be clicked to go back to it. Going forward is never
|
|
15
|
+
* offered: the steps ahead are the ones that have not been filled in.
|
|
16
|
+
*/
|
|
17
|
+
clickable?: boolean;
|
|
18
|
+
/** Accessible name of the sequence. */
|
|
19
|
+
ariaLabel?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface StepsEmits {
|
|
22
|
+
/** A step was chosen. Only fires for steps that are behind the current one. */
|
|
23
|
+
change: [index: number];
|
|
24
|
+
}
|
|
25
|
+
export interface StepProps {
|
|
26
|
+
/** What this step is. */
|
|
27
|
+
title?: string;
|
|
28
|
+
/** What it involves, in a few words. */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Icon instead of the number. */
|
|
31
|
+
icon?: IconName;
|
|
32
|
+
}
|
|
33
|
+
/** What `WxSteps` hands down to each step. */
|
|
34
|
+
export interface StepsContext {
|
|
35
|
+
register: (id: symbol) => void;
|
|
36
|
+
unregister: (id: symbol) => void;
|
|
37
|
+
indexOf: (id: symbol) => number;
|
|
38
|
+
stateOf: (index: number) => StepState;
|
|
39
|
+
choose: (index: number) => void;
|
|
40
|
+
direction: StepsDirection;
|
|
41
|
+
size: StepsSize;
|
|
42
|
+
clickable: boolean;
|
|
43
|
+
total: number;
|
|
44
|
+
}
|
|
@@ -36,9 +36,10 @@ export interface TableColumn<T = TableRow> {
|
|
|
36
36
|
/** Adds a sort control to the heading. The table reports, it does not reorder. */
|
|
37
37
|
sortable?: boolean;
|
|
38
38
|
/**
|
|
39
|
-
* Pins the column to an edge while the rest scrolls sideways.
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* Pins the column to an edge while the rest scrolls sideways. Give it a `width` as
|
|
40
|
+
* well: the table measures where each pinned column comes to rest, but the declared
|
|
41
|
+
* width is what the offsets fall back on before the first measurement — and what
|
|
42
|
+
* decides how wide the column is in the first place.
|
|
42
43
|
*/
|
|
43
44
|
fixed?: 'left' | 'right';
|
|
44
45
|
/** Turns the raw value into the text of the cell. */
|
|
@@ -27,8 +27,8 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
|
27
27
|
ariaLabel: string;
|
|
28
28
|
status: import('../..').ControlStatus;
|
|
29
29
|
id: string;
|
|
30
|
-
readonly: boolean;
|
|
31
30
|
resize: "none" | "vertical" | "both";
|
|
31
|
+
readonly: boolean;
|
|
32
32
|
maxlength: number;
|
|
33
33
|
showCount: boolean;
|
|
34
34
|
rows: number;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ToasterProps } from './types';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<ToasterProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ToasterProps> & Readonly<{}>, {
|
|
3
|
+
label: string;
|
|
4
|
+
width: number | string;
|
|
5
|
+
max: number;
|
|
6
|
+
placement: import('./types').ToasterPlacement;
|
|
7
|
+
hotkey: string[];
|
|
8
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Which corner — or edge — the toasts stack in. */
|
|
2
|
+
export type ToasterPlacement = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
3
|
+
export interface ToasterProps {
|
|
4
|
+
placement?: ToasterPlacement;
|
|
5
|
+
/** Width of a toast: a number in pixels, or any CSS length. */
|
|
6
|
+
width?: number | string;
|
|
7
|
+
/** Accessible name of the region the toasts land in. */
|
|
8
|
+
label?: string;
|
|
9
|
+
/**
|
|
10
|
+
* How many are shown at once. The rest wait their turn rather than covering the
|
|
11
|
+
* screen — a hundred failed requests is one problem, not a hundred notifications.
|
|
12
|
+
*/
|
|
13
|
+
max?: number;
|
|
14
|
+
/** Key that dismisses everything on screen, e.g. `F8`. */
|
|
15
|
+
hotkey?: string[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { TooltipProps } from './types';
|
|
2
|
+
type __VLS_Props = TooltipProps;
|
|
3
|
+
type __VLS_PublicProps = {
|
|
4
|
+
'open'?: boolean | undefined;
|
|
5
|
+
} & __VLS_Props;
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
|
+
attrs: Partial<{}>;
|
|
8
|
+
slots: Readonly<{
|
|
9
|
+
/** The control the tip belongs to. Exactly one element. */
|
|
10
|
+
default?: () => unknown;
|
|
11
|
+
/** The tip itself, when the text is not enough. */
|
|
12
|
+
content?: () => unknown;
|
|
13
|
+
}> & {
|
|
14
|
+
/** The control the tip belongs to. Exactly one element. */
|
|
15
|
+
default?: () => unknown;
|
|
16
|
+
/** The tip itself, when the text is not enough. */
|
|
17
|
+
content?: () => unknown;
|
|
18
|
+
};
|
|
19
|
+
refs: {};
|
|
20
|
+
rootEl: any;
|
|
21
|
+
};
|
|
22
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
23
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
24
|
+
"update:open": (value: boolean | undefined) => any;
|
|
25
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
26
|
+
"onUpdate:open"?: ((value: boolean | undefined) => any) | undefined;
|
|
27
|
+
}>, {
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
content: string;
|
|
30
|
+
side: import('./types').TooltipSide;
|
|
31
|
+
align: import('./types').TooltipAlign;
|
|
32
|
+
offset: number;
|
|
33
|
+
teleport: boolean;
|
|
34
|
+
delay: number;
|
|
35
|
+
maxWidth: number | string;
|
|
36
|
+
arrow: boolean;
|
|
37
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
38
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
39
|
+
export default _default;
|
|
40
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
41
|
+
new (): {
|
|
42
|
+
$slots: S;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type TooltipSide = 'top' | 'right' | 'bottom' | 'left';
|
|
2
|
+
export type TooltipAlign = 'start' | 'center' | 'end';
|
|
3
|
+
export interface TooltipProps {
|
|
4
|
+
/** The text. Use the `content` slot for anything richer. */
|
|
5
|
+
content?: string;
|
|
6
|
+
/** Which side of the trigger it prefers; it flips when there is no room. */
|
|
7
|
+
side?: TooltipSide;
|
|
8
|
+
align?: TooltipAlign;
|
|
9
|
+
/** Distance from the trigger, in pixels. */
|
|
10
|
+
offset?: number;
|
|
11
|
+
/**
|
|
12
|
+
* How long the pointer has to rest before the tip appears, in milliseconds. The
|
|
13
|
+
* first tip in a group waits; the ones after it come at once, because by then the
|
|
14
|
+
* reader has said what they are doing.
|
|
15
|
+
*/
|
|
16
|
+
delay?: number;
|
|
17
|
+
/** Draws the little pointer at the trigger. */
|
|
18
|
+
arrow?: boolean;
|
|
19
|
+
/** Largest width the tip takes before it wraps. */
|
|
20
|
+
maxWidth?: number | string;
|
|
21
|
+
/** Nothing opens. For a tip whose trigger is temporarily meaningless. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Render the tip in a portal so it escapes `overflow: hidden`. */
|
|
24
|
+
teleport?: boolean;
|
|
25
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { UploadFile, UploadProps } from './types';
|
|
2
|
+
type __VLS_Props = UploadProps;
|
|
3
|
+
type __VLS_PublicProps = {
|
|
4
|
+
modelValue?: UploadFile[];
|
|
5
|
+
} & __VLS_Props;
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
|
+
attrs: Partial<{}>;
|
|
8
|
+
slots: Readonly<{
|
|
9
|
+
/** Replaces the inside of the drop zone. */
|
|
10
|
+
default?: (props: {
|
|
11
|
+
open: () => void;
|
|
12
|
+
dragging: boolean;
|
|
13
|
+
}) => unknown;
|
|
14
|
+
/** Replaces the row a file is shown as. */
|
|
15
|
+
file?: (props: {
|
|
16
|
+
file: UploadFile;
|
|
17
|
+
remove: () => void;
|
|
18
|
+
}) => unknown;
|
|
19
|
+
/** Under the zone: a note about formats or sizes. */
|
|
20
|
+
footer?: () => unknown;
|
|
21
|
+
}> & {
|
|
22
|
+
/** Replaces the inside of the drop zone. */
|
|
23
|
+
default?: (props: {
|
|
24
|
+
open: () => void;
|
|
25
|
+
dragging: boolean;
|
|
26
|
+
}) => unknown;
|
|
27
|
+
/** Replaces the row a file is shown as. */
|
|
28
|
+
file?: (props: {
|
|
29
|
+
file: UploadFile;
|
|
30
|
+
remove: () => void;
|
|
31
|
+
}) => unknown;
|
|
32
|
+
/** Under the zone: a note about formats or sizes. */
|
|
33
|
+
footer?: () => unknown;
|
|
34
|
+
};
|
|
35
|
+
refs: {
|
|
36
|
+
input: HTMLInputElement;
|
|
37
|
+
};
|
|
38
|
+
rootEl: HTMLDivElement;
|
|
39
|
+
};
|
|
40
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
41
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
42
|
+
"update:modelValue": (value: UploadFile[]) => any;
|
|
43
|
+
select: (file: UploadFile) => any;
|
|
44
|
+
add: (files: UploadFile[]) => any;
|
|
45
|
+
remove: (file: UploadFile) => any;
|
|
46
|
+
reject: (file: File, reason: "size" | "type" | "count" | "rejected") => any;
|
|
47
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
48
|
+
"onUpdate:modelValue"?: ((value: UploadFile[]) => any) | undefined;
|
|
49
|
+
onSelect?: ((file: UploadFile) => any) | undefined;
|
|
50
|
+
onAdd?: ((files: UploadFile[]) => any) | undefined;
|
|
51
|
+
onRemove?: ((file: UploadFile) => any) | undefined;
|
|
52
|
+
onReject?: ((file: File, reason: "size" | "type" | "count" | "rejected") => any) | undefined;
|
|
53
|
+
}>, {
|
|
54
|
+
multiple: boolean;
|
|
55
|
+
disabled: boolean;
|
|
56
|
+
max: number;
|
|
57
|
+
accept: string;
|
|
58
|
+
maxSize: number;
|
|
59
|
+
buttonOnly: boolean;
|
|
60
|
+
buttonText: string;
|
|
61
|
+
hint: string;
|
|
62
|
+
gallery: boolean;
|
|
63
|
+
removable: boolean;
|
|
64
|
+
beforeAdd: (file: File) => boolean | Promise<boolean>;
|
|
65
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
66
|
+
input: HTMLInputElement;
|
|
67
|
+
}, HTMLDivElement>;
|
|
68
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
69
|
+
export default _default;
|
|
70
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
71
|
+
new (): {
|
|
72
|
+
$slots: S;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** Where a file has got to. */
|
|
2
|
+
export type UploadStatus = 'ready' | 'uploading' | 'done' | 'error';
|
|
3
|
+
export interface UploadFile {
|
|
4
|
+
/** Stable across the file's whole life, including a retry. */
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
/** In bytes. `0` for a file that arrived as a URL rather than from disk. */
|
|
8
|
+
size: number;
|
|
9
|
+
type: string;
|
|
10
|
+
status: UploadStatus;
|
|
11
|
+
/** How far along, 0–100. Meaningful while `uploading`. */
|
|
12
|
+
progress: number;
|
|
13
|
+
/** What went wrong, for a file that failed. */
|
|
14
|
+
error?: string;
|
|
15
|
+
/** Where it ended up, once the caller knows. */
|
|
16
|
+
url?: string;
|
|
17
|
+
/** The file itself, for anything picked from disk. */
|
|
18
|
+
raw?: File;
|
|
19
|
+
}
|
|
20
|
+
export interface UploadProps {
|
|
21
|
+
/** What the file input accepts, e.g. `image/*,.pdf`. */
|
|
22
|
+
accept?: string;
|
|
23
|
+
multiple?: boolean;
|
|
24
|
+
/** Largest file, in bytes. Anything over it is refused before it is added. */
|
|
25
|
+
maxSize?: number;
|
|
26
|
+
/** Largest number of files. */
|
|
27
|
+
max?: number;
|
|
28
|
+
/** Drops the drop zone and leaves a button. */
|
|
29
|
+
buttonOnly?: boolean;
|
|
30
|
+
/** Label of the button. */
|
|
31
|
+
buttonText?: string;
|
|
32
|
+
/** The line inside the drop zone. */
|
|
33
|
+
hint?: string;
|
|
34
|
+
/** Shows each file as a thumbnail rather than a row. For pictures. */
|
|
35
|
+
gallery?: boolean;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/** Whether a file can be taken off the list once it is there. */
|
|
38
|
+
removable?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Asked about every file before it joins the list. Return `false` — or a rejected
|
|
41
|
+
* promise — to refuse it. This is where a caller checks dimensions, or renames.
|
|
42
|
+
*/
|
|
43
|
+
beforeAdd?: (file: File) => boolean | Promise<boolean>;
|
|
44
|
+
}
|
|
45
|
+
export interface UploadEmits {
|
|
46
|
+
/** Files that passed the checks and joined the list. */
|
|
47
|
+
add: [files: UploadFile[]];
|
|
48
|
+
/** A file was taken off the list. */
|
|
49
|
+
remove: [file: UploadFile];
|
|
50
|
+
/** A file was refused, and why. */
|
|
51
|
+
reject: [file: File, reason: 'size' | 'count' | 'type' | 'rejected'];
|
|
52
|
+
/** A file in the list was chosen — to preview it, usually. */
|
|
53
|
+
select: [file: UploadFile];
|
|
54
|
+
}
|
|
@@ -2,9 +2,13 @@ export * from './Accordion';
|
|
|
2
2
|
export * from './AccordionItem';
|
|
3
3
|
export * from './Action';
|
|
4
4
|
export * from './Actions';
|
|
5
|
+
export * from './Affix';
|
|
5
6
|
export * from './Alert';
|
|
6
7
|
export * from './Aside';
|
|
7
8
|
export * from './Autocomplete';
|
|
9
|
+
export * from './Avatar';
|
|
10
|
+
export * from './AvatarGroup';
|
|
11
|
+
export * from './Backtop';
|
|
8
12
|
export * from './Badge';
|
|
9
13
|
export * from './Breadcrumb';
|
|
10
14
|
export * from './BreadcrumbItem';
|
|
@@ -21,11 +25,14 @@ export * from './Countdown';
|
|
|
21
25
|
export * from './DatePicker';
|
|
22
26
|
export * from './DateRangePicker';
|
|
23
27
|
export * from './DateTimePicker';
|
|
28
|
+
export * from './Descriptions';
|
|
29
|
+
export * from './DescriptionsItem';
|
|
24
30
|
export * from './Dialog';
|
|
25
31
|
export * from './Divider';
|
|
26
32
|
export * from './Drawer';
|
|
27
33
|
export * from './Dropdown';
|
|
28
34
|
export * from './DropdownItem';
|
|
35
|
+
export * from './Empty';
|
|
29
36
|
export * from './EntityCard';
|
|
30
37
|
export * from './Footer';
|
|
31
38
|
export * from './Form';
|
|
@@ -33,29 +40,41 @@ export * from './FormItem';
|
|
|
33
40
|
export * from './Header';
|
|
34
41
|
export * from './Heading';
|
|
35
42
|
export * from './Icon';
|
|
43
|
+
export * from './Image';
|
|
36
44
|
export * from './Indicator';
|
|
37
45
|
export * from './Input';
|
|
38
46
|
export * from './InputNumber';
|
|
39
47
|
export * from './Kanban';
|
|
40
48
|
export * from './Link';
|
|
41
49
|
export * from './ListDetail';
|
|
50
|
+
export * from './Loading';
|
|
42
51
|
export * from './Main';
|
|
43
52
|
export * from './Menu';
|
|
44
53
|
export * from './MenuGroup';
|
|
45
54
|
export * from './MenuItem';
|
|
46
55
|
export * from './Pagination';
|
|
56
|
+
export * from './Popconfirm';
|
|
47
57
|
export * from './Popover';
|
|
58
|
+
export * from './Progress';
|
|
48
59
|
export * from './Prose';
|
|
49
60
|
export * from './Radio';
|
|
50
61
|
export * from './RadioGroup';
|
|
51
62
|
export * from './Rate';
|
|
63
|
+
export * from './Result';
|
|
52
64
|
export * from './RichText';
|
|
53
65
|
export * from './Row';
|
|
54
66
|
export * from './Scrollbar';
|
|
67
|
+
export * from './Segmented';
|
|
55
68
|
export * from './Select';
|
|
69
|
+
export * from './SelectionArea';
|
|
70
|
+
export * from './Skeleton';
|
|
71
|
+
export * from './SkeletonItem';
|
|
56
72
|
export * from './Slider';
|
|
73
|
+
export * from './SortableList';
|
|
57
74
|
export * from './Space';
|
|
58
75
|
export * from './Statistic';
|
|
76
|
+
export * from './Step';
|
|
77
|
+
export * from './Steps';
|
|
59
78
|
export * from './Submenu';
|
|
60
79
|
export * from './Switch';
|
|
61
80
|
export * from './Tab';
|
|
@@ -67,3 +86,6 @@ export * from './Textarea';
|
|
|
67
86
|
export * from './Timeline';
|
|
68
87
|
export * from './TimelineItem';
|
|
69
88
|
export * from './TimePicker';
|
|
89
|
+
export * from './Toaster';
|
|
90
|
+
export * from './Tooltip';
|
|
91
|
+
export * from './Upload';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ButtonType } from '../components/Button/types';
|
|
2
|
+
export interface ConfirmOptions {
|
|
3
|
+
/** The question, as the heading. Defaults to "Are you sure?" */
|
|
4
|
+
title?: string;
|
|
5
|
+
/** What is at stake, under the question. */
|
|
6
|
+
message?: string;
|
|
7
|
+
confirmText?: string;
|
|
8
|
+
cancelText?: string;
|
|
9
|
+
/** Colour of the confirming button. `danger` for anything that destroys something. */
|
|
10
|
+
tone?: ButtonType;
|
|
11
|
+
width?: number | string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Asks, and answers `true` or `false`.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* if (await confirm('Delete this product?')) remove(product)
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* It never rejects. A question that throws when the answer is no turns every call site
|
|
21
|
+
* into a `try` block, and a forgotten `catch` into an unhandled rejection.
|
|
22
|
+
*/
|
|
23
|
+
export declare function confirm(message?: string | ConfirmOptions, options?: ConfirmOptions): Promise<boolean>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { App, AppContext, Component, InjectionKey, Ref } from 'vue';
|
|
2
|
+
/** What a component opened from code can do about itself. */
|
|
3
|
+
export interface ModalHandle<T = unknown> {
|
|
4
|
+
/** `false` in a component that is being used declaratively. */
|
|
5
|
+
isModal: boolean;
|
|
6
|
+
/** Bind it to the panel: `<wx-dialog v-model:open="open">`. */
|
|
7
|
+
open: Ref<boolean>;
|
|
8
|
+
/** Settles the promise with a value, and closes. */
|
|
9
|
+
resolve: (value: T) => void;
|
|
10
|
+
/** Settles it with nothing, and closes. */
|
|
11
|
+
dismiss: () => void;
|
|
12
|
+
}
|
|
13
|
+
export interface ModalOptions {
|
|
14
|
+
/** Props for the component. */
|
|
15
|
+
props?: Record<string, unknown>;
|
|
16
|
+
/** Slots for it, as render functions. */
|
|
17
|
+
slots?: Record<string, (...args: unknown[]) => unknown>;
|
|
18
|
+
/** Events that settle the promise with their payload. Default: `resolve`. */
|
|
19
|
+
resolveOn?: string | string[];
|
|
20
|
+
/** Events that settle it with nothing. Default: `cancel` and `close`. */
|
|
21
|
+
dismissOn?: string | string[];
|
|
22
|
+
/** Where to mount. Default: a div at the end of `<body>`. */
|
|
23
|
+
container?: HTMLElement;
|
|
24
|
+
/** The app whose plugins and provides the component should see. */
|
|
25
|
+
appContext?: AppContext;
|
|
26
|
+
/** How long the closing animation is given before the node is taken away, in ms. */
|
|
27
|
+
duration?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface ModalPromise<T> extends Promise<T | undefined> {
|
|
30
|
+
/** Closes it from outside — a route change, a timeout, a second thought. */
|
|
31
|
+
close: (value?: T) => void;
|
|
32
|
+
}
|
|
33
|
+
export declare const modalKey: InjectionKey<ModalHandle>;
|
|
34
|
+
export declare function connectModals(app: App): void;
|
|
35
|
+
/**
|
|
36
|
+
* Mounts a component outside the app and hands back a promise for its answer.
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* const product = await openModal<Product>(ProductBrowser, {
|
|
40
|
+
* props: { multiple: false },
|
|
41
|
+
* resolveOn: 'select',
|
|
42
|
+
* })
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* The promise settles the moment the answer is known and the node is taken away once the
|
|
46
|
+
* closing animation has had its time — so the caller is never waiting on an animation, and
|
|
47
|
+
* the panel is never cut off mid-fade.
|
|
48
|
+
*/
|
|
49
|
+
export declare function openModal<T = unknown>(component: Component, options?: ModalOptions): ModalPromise<T>;
|
|
50
|
+
/**
|
|
51
|
+
* Wraps a component in a function that opens it — the shape a browser or a picker is
|
|
52
|
+
* reached by everywhere else in an app.
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* export const productBrowser = createModal<Product, ProductBrowserProps>(ProductBrowser, {
|
|
56
|
+
* resolveOn: 'select',
|
|
57
|
+
* })
|
|
58
|
+
*
|
|
59
|
+
* const product = await productBrowser({ multiple: false })
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function createModal<T = unknown, P extends Record<string, unknown> = Record<string, never>>(component: Component, defaults?: ModalOptions): (props?: P, options?: ModalOptions) => ModalPromise<T>;
|
|
63
|
+
/**
|
|
64
|
+
* The handle of the modal a component is being shown in. Outside one it answers all the
|
|
65
|
+
* same, with `isModal: false` and calls that do nothing — so a component can be written
|
|
66
|
+
* once and used both ways.
|
|
67
|
+
*/
|
|
68
|
+
export declare function useModal<T = unknown>(): ModalHandle<T>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DeepReadonly } from 'vue';
|
|
2
|
+
import { IconName } from '../components/Icon/types';
|
|
3
|
+
export type ToastType = 'default' | 'success' | 'warning' | 'danger' | 'info';
|
|
4
|
+
export interface ToastAction {
|
|
5
|
+
label: string;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface ToastOptions {
|
|
9
|
+
/** A headline. Without one the toast is a single line — a message rather than a card. */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** The message. This is what a one-line toast says. */
|
|
12
|
+
description?: string;
|
|
13
|
+
type?: ToastType;
|
|
14
|
+
/**
|
|
15
|
+
* How long it stays, in milliseconds. `0` keeps it until it is dismissed, which is
|
|
16
|
+
* what an error the reader has to act on wants.
|
|
17
|
+
*/
|
|
18
|
+
duration?: number;
|
|
19
|
+
/** Adds a ×. On by default for anything that does not leave on its own. */
|
|
20
|
+
closable?: boolean;
|
|
21
|
+
/** Glyph to draw instead of the one the type picks; `false` drops it. */
|
|
22
|
+
icon?: IconName | false;
|
|
23
|
+
/** One thing to do about it: Undo, Retry, View. */
|
|
24
|
+
action?: ToastAction;
|
|
25
|
+
}
|
|
26
|
+
export interface ToastRecord extends ToastOptions {
|
|
27
|
+
id: number;
|
|
28
|
+
/** Bound to the panel; set to false to start it leaving. */
|
|
29
|
+
open: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ToastHandle {
|
|
32
|
+
id: number;
|
|
33
|
+
dismiss: () => void;
|
|
34
|
+
}
|
|
35
|
+
/** What the `WxToaster` renders. Nothing else should be writing to it. */
|
|
36
|
+
export declare function toastQueue(): DeepReadonly<ToastRecord[]>;
|
|
37
|
+
/** Starts a toast leaving. It is taken off the queue once it has gone. */
|
|
38
|
+
export declare function dismissToast(id: number): void;
|
|
39
|
+
/** Takes a toast off the queue for good — called when its animation has finished. */
|
|
40
|
+
export declare function removeToast(id: number): void;
|
|
41
|
+
/** Clears everything on screen at once. */
|
|
42
|
+
export declare function clearToasts(): void;
|
|
43
|
+
export interface ToastApi {
|
|
44
|
+
(message: string | ToastOptions, options?: ToastOptions): ToastHandle;
|
|
45
|
+
success: (message: string | ToastOptions, options?: ToastOptions) => ToastHandle;
|
|
46
|
+
warning: (message: string | ToastOptions, options?: ToastOptions) => ToastHandle;
|
|
47
|
+
danger: (message: string | ToastOptions, options?: ToastOptions) => ToastHandle;
|
|
48
|
+
info: (message: string | ToastOptions, options?: ToastOptions) => ToastHandle;
|
|
49
|
+
dismiss: (id: number) => void;
|
|
50
|
+
clear: () => void;
|
|
51
|
+
}
|
|
52
|
+
declare const api: ToastApi;
|
|
53
|
+
/**
|
|
54
|
+
* Raises a toast from anywhere.
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* const toast = useToast()
|
|
58
|
+
* toast.success('Saved')
|
|
59
|
+
* toast.danger({ title: 'Could not save', description: response.message })
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* The same object is importable as `toast` for code that is not in a component at
|
|
63
|
+
* all — an interceptor, say. Put one `<wx-toaster />` on the page to show them.
|
|
64
|
+
*/
|
|
65
|
+
export declare function useToast(): ToastApi;
|
|
66
|
+
export { api as toast };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,7 @@ export { WebxUI, type WebxUiOptions } from './plugin';
|
|
|
3
3
|
export type { ControlSize, ControlStatus, ValidationErrors } from './composables/useFormField';
|
|
4
4
|
export { useControlAttrs, type ControlAttrs } from './composables/useControlAttrs';
|
|
5
5
|
export { useElementWidth } from './composables/useElementWidth';
|
|
6
|
+
export { useToast, toast, toastQueue, dismissToast, removeToast, clearToasts, type ToastApi, type ToastHandle, type ToastOptions, type ToastRecord, type ToastType, type ToastAction, } from './composables/useToast';
|
|
7
|
+
export { openModal, createModal, useModal, connectModals, modalKey, type ModalHandle, type ModalOptions, type ModalPromise, } from './composables/useModal';
|
|
8
|
+
export { confirm, type ConfirmOptions } from './composables/confirm';
|
|
6
9
|
export { useResponsiveShell, shellLayoutFor, type ResponsiveShell, type ResponsiveShellOptions, type ShellLayout, } from './composables/useResponsiveShell';
|