@witchcraft/ui 0.4.0-beta.9 → 0.4.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/dist/module.json +1 -1
- package/dist/runtime/build/WitchcraftUiResolver.js +1 -2
- package/dist/runtime/components/WPopup/WPopup.d.vue.ts +11 -1
- package/dist/runtime/components/WPopup/WPopup.vue +43 -2
- package/dist/runtime/components/WPopup/WPopup.vue.d.ts +11 -1
- package/dist/runtime/components/WRoot/WRoot.d.vue.ts +1 -1
- package/dist/runtime/components/WRoot/WRoot.vue.d.ts +1 -1
- package/package.json +1 -1
- package/src/runtime/build/WitchcraftUiResolver.ts +1 -2
- package/src/runtime/components/WPopup/WPopup.stories.ts +59 -15
- package/src/runtime/components/WPopup/WPopup.vue +44 -3
package/dist/module.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
const prefixless = ["Icon"];
|
|
2
1
|
export const WitchcraftUiResolver = ({
|
|
3
2
|
prefix = "W",
|
|
4
3
|
filter = () => true
|
|
5
4
|
} = {}) => (componentName) => {
|
|
6
5
|
if (componentName.startsWith(prefix)) {
|
|
7
6
|
const n = componentName.slice(1);
|
|
8
|
-
const filename =
|
|
7
|
+
const filename = `W${n}`;
|
|
9
8
|
if (!filter(n)) {
|
|
10
9
|
return void 0;
|
|
11
10
|
}
|
|
@@ -2,6 +2,8 @@ import type { DialogContentEmits, DialogContentProps, DialogRootEmits, DialogRoo
|
|
|
2
2
|
import type { EmitsToProps, HTMLAttributes } from "vue";
|
|
3
3
|
import type { TailwindClassProp } from "../../types/index.js";
|
|
4
4
|
type __VLS_Props = {
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
5
7
|
backdropClass?: string;
|
|
6
8
|
/** Overrides reka-ui's DialogContentProps */
|
|
7
9
|
contentProps?: DialogContentProps & EmitsToProps<DialogContentEmits> & Omit<HTMLAttributes, "class"> & TailwindClassProp;
|
|
@@ -16,13 +18,21 @@ type __VLS_ModelProps = {
|
|
|
16
18
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
17
19
|
declare var __VLS_14: {}, __VLS_28: {
|
|
18
20
|
class: string;
|
|
19
|
-
}, __VLS_36: {};
|
|
21
|
+
}, __VLS_36: {}, __VLS_38: {}, __VLS_46: {}, __VLS_54: {}, __VLS_62: {};
|
|
20
22
|
type __VLS_Slots = {} & {
|
|
21
23
|
button?: (props: typeof __VLS_14) => any;
|
|
22
24
|
} & {
|
|
23
25
|
backdrop?: (props: typeof __VLS_28) => any;
|
|
24
26
|
} & {
|
|
25
27
|
popup?: (props: typeof __VLS_36) => any;
|
|
28
|
+
} & {
|
|
29
|
+
title?: (props: typeof __VLS_38) => any;
|
|
30
|
+
} & {
|
|
31
|
+
description?: (props: typeof __VLS_46) => any;
|
|
32
|
+
} & {
|
|
33
|
+
extra?: (props: typeof __VLS_54) => any;
|
|
34
|
+
} & {
|
|
35
|
+
close?: (props: typeof __VLS_62) => any;
|
|
26
36
|
};
|
|
27
37
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
38
|
"update:modelValue": (value: boolean) => any;
|
|
@@ -51,9 +51,38 @@
|
|
|
51
51
|
bg-neutral-100
|
|
52
52
|
dark:bg-neutral-800
|
|
53
53
|
rounded-md
|
|
54
|
+
flex
|
|
55
|
+
flex-col
|
|
56
|
+
gap-3
|
|
57
|
+
p-2
|
|
54
58
|
`)"
|
|
55
59
|
>
|
|
56
|
-
<slot name="popup"
|
|
60
|
+
<slot name="popup">
|
|
61
|
+
<slot name="title">
|
|
62
|
+
<DialogTitle
|
|
63
|
+
v-if="title"
|
|
64
|
+
class="text-lg font-bold"
|
|
65
|
+
>
|
|
66
|
+
{{ title }}
|
|
67
|
+
</DialogTitle>
|
|
68
|
+
</slot>
|
|
69
|
+
<slot name="description">
|
|
70
|
+
<DialogDescription v-if="description">
|
|
71
|
+
{{ description }}
|
|
72
|
+
</DialogDescription>
|
|
73
|
+
</slot>
|
|
74
|
+
<slot name="extra"/>
|
|
75
|
+
</slot>
|
|
76
|
+
<DialogClose as-child>
|
|
77
|
+
<slot name="close">
|
|
78
|
+
<WButton
|
|
79
|
+
class="justify-self-end"
|
|
80
|
+
@click="modelValue = false"
|
|
81
|
+
>
|
|
82
|
+
Close
|
|
83
|
+
</WButton>
|
|
84
|
+
</slot>
|
|
85
|
+
</DialogClose>
|
|
57
86
|
</div>
|
|
58
87
|
</DialogContent>
|
|
59
88
|
</DialogPortal>
|
|
@@ -61,10 +90,22 @@
|
|
|
61
90
|
</template>
|
|
62
91
|
|
|
63
92
|
<script setup>
|
|
64
|
-
import {
|
|
93
|
+
import {
|
|
94
|
+
DialogClose,
|
|
95
|
+
DialogContent,
|
|
96
|
+
DialogDescription,
|
|
97
|
+
DialogOverlay,
|
|
98
|
+
DialogPortal,
|
|
99
|
+
DialogRoot,
|
|
100
|
+
DialogTitle,
|
|
101
|
+
DialogTrigger
|
|
102
|
+
} from "reka-ui";
|
|
65
103
|
import { twMerge } from "../../utils/twMerge.js";
|
|
104
|
+
import WButton from "../WButton/WButton.vue";
|
|
66
105
|
defineOptions({ name: "WPopup", inheritAttrs: false });
|
|
67
106
|
defineProps({
|
|
107
|
+
title: { type: String, required: false },
|
|
108
|
+
description: { type: String, required: false },
|
|
68
109
|
backdropClass: { type: String, required: false },
|
|
69
110
|
contentProps: { type: Object, required: false },
|
|
70
111
|
rootProps: { type: Object, required: false },
|
|
@@ -2,6 +2,8 @@ import type { DialogContentEmits, DialogContentProps, DialogRootEmits, DialogRoo
|
|
|
2
2
|
import type { EmitsToProps, HTMLAttributes } from "vue";
|
|
3
3
|
import type { TailwindClassProp } from "../../types/index.js";
|
|
4
4
|
type __VLS_Props = {
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
5
7
|
backdropClass?: string;
|
|
6
8
|
/** Overrides reka-ui's DialogContentProps */
|
|
7
9
|
contentProps?: DialogContentProps & EmitsToProps<DialogContentEmits> & Omit<HTMLAttributes, "class"> & TailwindClassProp;
|
|
@@ -16,13 +18,21 @@ type __VLS_ModelProps = {
|
|
|
16
18
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
17
19
|
declare var __VLS_14: {}, __VLS_28: {
|
|
18
20
|
class: string;
|
|
19
|
-
}, __VLS_36: {};
|
|
21
|
+
}, __VLS_36: {}, __VLS_38: {}, __VLS_46: {}, __VLS_54: {}, __VLS_62: {};
|
|
20
22
|
type __VLS_Slots = {} & {
|
|
21
23
|
button?: (props: typeof __VLS_14) => any;
|
|
22
24
|
} & {
|
|
23
25
|
backdrop?: (props: typeof __VLS_28) => any;
|
|
24
26
|
} & {
|
|
25
27
|
popup?: (props: typeof __VLS_36) => any;
|
|
28
|
+
} & {
|
|
29
|
+
title?: (props: typeof __VLS_38) => any;
|
|
30
|
+
} & {
|
|
31
|
+
description?: (props: typeof __VLS_46) => any;
|
|
32
|
+
} & {
|
|
33
|
+
extra?: (props: typeof __VLS_54) => any;
|
|
34
|
+
} & {
|
|
35
|
+
close?: (props: typeof __VLS_62) => any;
|
|
26
36
|
};
|
|
27
37
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
38
|
"update:modelValue": (value: boolean) => any;
|
|
@@ -23,8 +23,8 @@ type __VLS_Slots = {} & {
|
|
|
23
23
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
24
24
|
darkMode: import("../../main.lib.js").DarkModeState & import("../../main.lib.js").DarkModeCommands;
|
|
25
25
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
26
|
-
theme: Theme;
|
|
27
26
|
useBuiltinTranslations: boolean;
|
|
27
|
+
theme: Theme;
|
|
28
28
|
outline: boolean;
|
|
29
29
|
isClientSide: boolean;
|
|
30
30
|
forceOutline: boolean;
|
|
@@ -23,8 +23,8 @@ type __VLS_Slots = {} & {
|
|
|
23
23
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
24
24
|
darkMode: import("../../main.lib.js").DarkModeState & import("../../main.lib.js").DarkModeCommands;
|
|
25
25
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
26
|
-
theme: Theme;
|
|
27
26
|
useBuiltinTranslations: boolean;
|
|
27
|
+
theme: Theme;
|
|
28
28
|
outline: boolean;
|
|
29
29
|
isClientSide: boolean;
|
|
30
30
|
forceOutline: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ComponentResolver } from "unplugin-vue-components"
|
|
2
2
|
|
|
3
|
-
const prefixless = ["Icon"]
|
|
4
3
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5
4
|
export const WitchcraftUiResolver = (
|
|
6
5
|
{
|
|
@@ -15,7 +14,7 @@ export const WitchcraftUiResolver = (
|
|
|
15
14
|
): { from: string } | undefined => {
|
|
16
15
|
if (componentName.startsWith(prefix)) {
|
|
17
16
|
const n = componentName.slice(1)
|
|
18
|
-
const filename =
|
|
17
|
+
const filename = `W${n}`
|
|
19
18
|
if (!filter(n)) {
|
|
20
19
|
return undefined
|
|
21
20
|
}
|
|
@@ -6,42 +6,86 @@ import WPopup from "./WPopup.vue"
|
|
|
6
6
|
|
|
7
7
|
import * as components from "../index.js"
|
|
8
8
|
|
|
9
|
+
type ExtraTestArgs = {
|
|
10
|
+
_slots: string
|
|
11
|
+
}
|
|
9
12
|
const meta: Meta<typeof WPopup> = {
|
|
10
13
|
component: WPopup,
|
|
11
|
-
title: "Components/Popup"
|
|
14
|
+
title: "Components/Popup",
|
|
15
|
+
args: {
|
|
16
|
+
title: "Popup Title",
|
|
17
|
+
description: "Popup Description"
|
|
18
|
+
}
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
export default meta
|
|
15
|
-
type Story = StoryObj<typeof WPopup>
|
|
22
|
+
type Story = StoryObj<typeof WPopup> & { args?: ExtraTestArgs }
|
|
16
23
|
|
|
17
24
|
export const Primary: Story = {
|
|
18
|
-
render: args =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
render: args => {
|
|
26
|
+
const extraArgs = args as ExtraTestArgs
|
|
27
|
+
return {
|
|
28
|
+
components,
|
|
29
|
+
setup: () => {
|
|
30
|
+
const value = ref(false)
|
|
31
|
+
return { args, value }
|
|
32
|
+
},
|
|
33
|
+
template: `
|
|
25
34
|
<div class="test bg-transparency-squares flex items-center justify-center" style="height:80vh;border:1px solid black;">
|
|
26
|
-
<WPopup
|
|
35
|
+
<WPopup
|
|
36
|
+
:title="args.title"
|
|
37
|
+
:description="args.description"
|
|
38
|
+
v-model="value"
|
|
39
|
+
v-bind="args"
|
|
40
|
+
>
|
|
41
|
+
${extraArgs._slots}
|
|
27
42
|
<template #button>
|
|
28
43
|
<WButton>Open Modal Popup</WButton>
|
|
29
44
|
</template>
|
|
30
|
-
<template #
|
|
45
|
+
<template #extra>
|
|
31
46
|
<div
|
|
32
47
|
:style="{width: args.width, height: args.height}"
|
|
33
|
-
class="p-3"
|
|
34
48
|
>
|
|
35
|
-
<div>
|
|
36
|
-
<WButton class="mt-4" @click="value = false">Close</WButton>
|
|
49
|
+
<div>Extra Slot</div>
|
|
37
50
|
</div>
|
|
38
51
|
</template>
|
|
39
52
|
</WPopup>
|
|
40
53
|
</div>
|
|
41
54
|
`
|
|
42
|
-
|
|
55
|
+
}
|
|
56
|
+
}
|
|
43
57
|
}
|
|
44
58
|
|
|
59
|
+
export const OtherSlots = {
|
|
60
|
+
...Primary,
|
|
61
|
+
args: {
|
|
62
|
+
_slots: `
|
|
63
|
+
<template #title>
|
|
64
|
+
<div>Title Slot</div>
|
|
65
|
+
</template>
|
|
66
|
+
<template #description>
|
|
67
|
+
<div>Description Slot</div>
|
|
68
|
+
</template>
|
|
69
|
+
<template #close>
|
|
70
|
+
<div>Close Slot</div>
|
|
71
|
+
</template>
|
|
72
|
+
<template #backdrop>
|
|
73
|
+
<div>Backdrop Slot</div>
|
|
74
|
+
</template>
|
|
75
|
+
`
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const PopupSlots = {
|
|
80
|
+
...Primary,
|
|
81
|
+
args: {
|
|
82
|
+
_slots: `
|
|
83
|
+
<template #popup>
|
|
84
|
+
<div>Popup Slot - Replaces Other Slots except Close (note, you must provide reka's DialogTitle and DialogDescription to avoid it's warnings</div>
|
|
85
|
+
</template>
|
|
86
|
+
`
|
|
87
|
+
}
|
|
88
|
+
}
|
|
45
89
|
export const PopupLarge = {
|
|
46
90
|
...Primary,
|
|
47
91
|
args: {
|
|
@@ -52,9 +52,38 @@
|
|
|
52
52
|
bg-neutral-100
|
|
53
53
|
dark:bg-neutral-800
|
|
54
54
|
rounded-md
|
|
55
|
+
flex
|
|
56
|
+
flex-col
|
|
57
|
+
gap-3
|
|
58
|
+
p-2
|
|
55
59
|
`)"
|
|
56
60
|
>
|
|
57
|
-
<slot name="popup"
|
|
61
|
+
<slot name="popup">
|
|
62
|
+
<slot name="title">
|
|
63
|
+
<DialogTitle
|
|
64
|
+
v-if="title"
|
|
65
|
+
class="text-lg font-bold"
|
|
66
|
+
>
|
|
67
|
+
{{ title }}
|
|
68
|
+
</DialogTitle>
|
|
69
|
+
</slot>
|
|
70
|
+
<slot name="description">
|
|
71
|
+
<DialogDescription v-if="description">
|
|
72
|
+
{{ description }}
|
|
73
|
+
</DialogDescription>
|
|
74
|
+
</slot>
|
|
75
|
+
<slot name="extra"/>
|
|
76
|
+
</slot>
|
|
77
|
+
<DialogClose as-child>
|
|
78
|
+
<slot name="close">
|
|
79
|
+
<WButton
|
|
80
|
+
class="justify-self-end"
|
|
81
|
+
@click="modelValue = false"
|
|
82
|
+
>
|
|
83
|
+
Close
|
|
84
|
+
</WButton>
|
|
85
|
+
</slot>
|
|
86
|
+
</DialogClose>
|
|
58
87
|
</div>
|
|
59
88
|
</DialogContent>
|
|
60
89
|
</DialogPortal>
|
|
@@ -66,17 +95,29 @@ import type {
|
|
|
66
95
|
DialogContentEmits,
|
|
67
96
|
DialogContentProps,
|
|
68
97
|
DialogRootEmits,
|
|
69
|
-
DialogRootProps
|
|
70
|
-
|
|
98
|
+
DialogRootProps
|
|
99
|
+
} from "reka-ui"
|
|
100
|
+
import {
|
|
101
|
+
DialogClose,
|
|
102
|
+
DialogContent,
|
|
103
|
+
DialogDescription,
|
|
104
|
+
DialogOverlay,
|
|
105
|
+
DialogPortal,
|
|
106
|
+
DialogRoot,
|
|
107
|
+
DialogTitle,
|
|
108
|
+
DialogTrigger } from "reka-ui"
|
|
71
109
|
import type { EmitsToProps, HTMLAttributes } from "vue"
|
|
72
110
|
|
|
73
111
|
import type { TailwindClassProp } from "../../types/index.js"
|
|
74
112
|
import { twMerge } from "../../utils/twMerge.js"
|
|
113
|
+
import WButton from "../WButton/WButton.vue"
|
|
75
114
|
|
|
76
115
|
defineOptions({ name: "WPopup", inheritAttrs: false })
|
|
77
116
|
|
|
78
117
|
withDefaults(defineProps<
|
|
79
118
|
& {
|
|
119
|
+
title?: string
|
|
120
|
+
description?: string
|
|
80
121
|
backdropClass?: string
|
|
81
122
|
/** Overrides reka-ui's DialogContentProps */
|
|
82
123
|
contentProps?: DialogContentProps & EmitsToProps<DialogContentEmits> & Omit<HTMLAttributes, "class"> & TailwindClassProp
|