@weni/unnnic-system 3.7.1 → 3.8.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/CHANGELOG.md +9 -0
- package/dist/components/index.d.ts +174 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/ui/popover/Popover.vue.d.ts +23 -0
- package/dist/components/ui/popover/Popover.vue.d.ts.map +1 -0
- package/dist/components/ui/popover/PopoverContent.vue.d.ts +28 -0
- package/dist/components/ui/popover/PopoverContent.vue.d.ts.map +1 -0
- package/dist/components/ui/popover/PopoverFooter.vue.d.ts +18 -0
- package/dist/components/ui/popover/PopoverFooter.vue.d.ts.map +1 -0
- package/dist/components/ui/popover/PopoverTrigger.vue.d.ts +19 -0
- package/dist/components/ui/popover/PopoverTrigger.vue.d.ts.map +1 -0
- package/dist/components/ui/popover/index.d.ts +6 -0
- package/dist/components/ui/popover/index.d.ts.map +1 -0
- package/dist/{es-484b4c46.mjs → es-85030529.mjs} +1 -1
- package/dist/{index-dc007393.mjs → index-43dacc8a.mjs} +17235 -11225
- package/dist/{pt-br-f73c4b3a.mjs → pt-br-191d9782.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +137 -129
- package/dist/unnnic.umd.js +53 -51
- package/package.json +2 -1
- package/src/components/index.ts +15 -0
- package/src/components/ui/popover/Popover.vue +19 -0
- package/src/components/ui/popover/PopoverContent.vue +109 -0
- package/src/components/ui/popover/PopoverFooter.vue +32 -0
- package/src/components/ui/popover/PopoverTrigger.vue +23 -0
- package/src/components/ui/popover/index.ts +5 -0
- package/src/stories/Popover.stories.js +396 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weni/unnnic-system",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@iconify/vue": "^5.0.0",
|
|
55
55
|
"@vueuse/components": "^10.4.1",
|
|
56
|
+
"@vueuse/core": "^14.0.0",
|
|
56
57
|
"emoji-mart-vue-fast": "^15.0.5",
|
|
57
58
|
"lodash": "^4.17.21",
|
|
58
59
|
"lucide-vue-next": "^0.546.0",
|
package/src/components/index.ts
CHANGED
|
@@ -90,6 +90,10 @@ import Navigator from './Navigator/index.vue';
|
|
|
90
90
|
import SelectTime from './SelectTime/index.vue';
|
|
91
91
|
import DataTable from './DataTable/index.vue';
|
|
92
92
|
import Chip from './Chip/Chip.vue';
|
|
93
|
+
import Popover from './ui/popover/Popover.vue';
|
|
94
|
+
import PopoverContent from './ui/popover/PopoverContent.vue';
|
|
95
|
+
import PopoverTrigger from './ui/popover/PopoverTrigger.vue';
|
|
96
|
+
import PopoverFooter from './ui/popover/PopoverFooter.vue';
|
|
93
97
|
import TemplatePreview from './TemplatePreview/TemplatePreview.vue';
|
|
94
98
|
import TemplatePreviewModal from './TemplatePreview/TemplatePreviewModal.vue';
|
|
95
99
|
|
|
@@ -194,6 +198,9 @@ export const components: ComponentsMap = {
|
|
|
194
198
|
unnnicTemplatePreviewModal: TemplatePreviewModal,
|
|
195
199
|
unnnicDataTable: DataTable,
|
|
196
200
|
unnnicChip: Chip,
|
|
201
|
+
unnnicPopover: Popover,
|
|
202
|
+
unnnicPopoverContent: PopoverContent,
|
|
203
|
+
unnnicPopoverTrigger: PopoverTrigger,
|
|
197
204
|
};
|
|
198
205
|
|
|
199
206
|
export const unnnicFontSize = fontSize;
|
|
@@ -289,6 +296,10 @@ export const unnnicNavigator = Navigator;
|
|
|
289
296
|
export const unnnicDataTable = DataTable as VueComponent;
|
|
290
297
|
export const unnnicSelectTime = SelectTime as VueComponent;
|
|
291
298
|
export const unnnicChip = Chip;
|
|
299
|
+
export const unnnicPopover = Popover;
|
|
300
|
+
export const unnnicPopoverContent = PopoverContent;
|
|
301
|
+
export const unnnicPopoverTrigger = PopoverTrigger;
|
|
302
|
+
export const unnnicPopoverFooter = PopoverFooter;
|
|
292
303
|
export const unnnicTemplatePreview = TemplatePreview as VueComponent;
|
|
293
304
|
export const unnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
|
|
294
305
|
|
|
@@ -385,5 +396,9 @@ export const UnnnicNavigator = Navigator;
|
|
|
385
396
|
export const UnnnicDataTable = DataTable as VueComponent;
|
|
386
397
|
export const UnnnicSelectTime = SelectTime as VueComponent;
|
|
387
398
|
export const UnnnicChip = Chip;
|
|
399
|
+
export const UnnnicPopover = Popover;
|
|
400
|
+
export const UnnnicPopoverContent = PopoverContent;
|
|
401
|
+
export const UnnnicPopoverTrigger = PopoverTrigger;
|
|
402
|
+
export const UnnnicPopoverFooter = PopoverFooter;
|
|
388
403
|
export const UnnnicTemplatePreview = TemplatePreview as VueComponent;
|
|
389
404
|
export const UnnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PopoverRootEmits, PopoverRootProps } from 'reka-ui';
|
|
3
|
+
import { PopoverRoot, useForwardPropsEmits } from 'reka-ui';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UnnnicPopover',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = defineProps<PopoverRootProps>();
|
|
10
|
+
const emits = defineEmits<PopoverRootEmits>();
|
|
11
|
+
|
|
12
|
+
const forwarded = useForwardPropsEmits(props, emits);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<PopoverRoot v-bind="forwarded">
|
|
17
|
+
<slot />
|
|
18
|
+
</PopoverRoot>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PopoverPortal>
|
|
3
|
+
<PopoverContent
|
|
4
|
+
v-bind="{ ...forwarded, ...$attrs }"
|
|
5
|
+
:class="
|
|
6
|
+
cn(
|
|
7
|
+
'unnnic-popover',
|
|
8
|
+
`unnnic-popover--size-${props.size}`,
|
|
9
|
+
'bg-popover text-popover-foreground outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
10
|
+
)
|
|
11
|
+
"
|
|
12
|
+
>
|
|
13
|
+
<section :class="`unnnic-popover__content ${props.class || ''}`">
|
|
14
|
+
<component
|
|
15
|
+
:is="child"
|
|
16
|
+
v-for="(child, index) in contentChildren"
|
|
17
|
+
:key="index"
|
|
18
|
+
/>
|
|
19
|
+
</section>
|
|
20
|
+
|
|
21
|
+
<component
|
|
22
|
+
:is="child"
|
|
23
|
+
v-for="(child, index) in footerChildren"
|
|
24
|
+
:key="index"
|
|
25
|
+
/>
|
|
26
|
+
</PopoverContent>
|
|
27
|
+
</PopoverPortal>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import type { PopoverContentEmits, PopoverContentProps } from 'reka-ui';
|
|
32
|
+
import type { HTMLAttributes, VNode } from 'vue';
|
|
33
|
+
import { computed, useSlots } from 'vue';
|
|
34
|
+
import { reactiveOmit } from '@vueuse/core';
|
|
35
|
+
import { PopoverContent, PopoverPortal, useForwardPropsEmits } from 'reka-ui';
|
|
36
|
+
import { cn } from '@/lib/utils';
|
|
37
|
+
|
|
38
|
+
defineOptions({
|
|
39
|
+
inheritAttrs: false,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const props = withDefaults(
|
|
43
|
+
defineProps<
|
|
44
|
+
PopoverContentProps & {
|
|
45
|
+
class?: HTMLAttributes['class'];
|
|
46
|
+
size?: 'small' | 'medium' | 'large';
|
|
47
|
+
}
|
|
48
|
+
>(),
|
|
49
|
+
{
|
|
50
|
+
align: 'center',
|
|
51
|
+
sideOffset: 4,
|
|
52
|
+
size: 'medium',
|
|
53
|
+
class: '',
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
const emits = defineEmits<PopoverContentEmits>();
|
|
57
|
+
|
|
58
|
+
const delegatedProps = reactiveOmit(props, 'class', 'size');
|
|
59
|
+
|
|
60
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
61
|
+
|
|
62
|
+
const slots = useSlots();
|
|
63
|
+
|
|
64
|
+
const getComponentName = (vnode: VNode): string | undefined => {
|
|
65
|
+
const componentType = vnode.type as { name?: string; __name?: string };
|
|
66
|
+
return componentType?.name || componentType?.__name;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const contentChildren = computed(() => {
|
|
70
|
+
const defaultSlot = slots.default?.() || [];
|
|
71
|
+
return defaultSlot.filter(
|
|
72
|
+
(vnode: VNode) => getComponentName(vnode) !== 'UnnnicPopoverFooter',
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const footerChildren = computed(() => {
|
|
77
|
+
const defaultSlot = slots.default?.() || [];
|
|
78
|
+
return defaultSlot.filter(
|
|
79
|
+
(vnode: VNode) => getComponentName(vnode) === 'UnnnicPopoverFooter',
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<style lang="scss">
|
|
85
|
+
@use '@/assets/scss/unnnic' as *;
|
|
86
|
+
|
|
87
|
+
$popover-space: $unnnic-space-4;
|
|
88
|
+
|
|
89
|
+
.unnnic-popover {
|
|
90
|
+
z-index: 10000;
|
|
91
|
+
|
|
92
|
+
border-radius: $unnnic-radius-2;
|
|
93
|
+
box-shadow: $unnnic-shadow-1;
|
|
94
|
+
|
|
95
|
+
&--size-small {
|
|
96
|
+
width: 240px;
|
|
97
|
+
}
|
|
98
|
+
&--size-medium {
|
|
99
|
+
width: 320px;
|
|
100
|
+
}
|
|
101
|
+
&--size-large {
|
|
102
|
+
width: 400px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&__content {
|
|
106
|
+
padding: $popover-space;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<footer class="unnnic-popover__footer">
|
|
3
|
+
<slot />
|
|
4
|
+
</footer>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
defineOptions({
|
|
9
|
+
name: 'UnnnicPopoverFooter',
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<style lang="scss">
|
|
14
|
+
@use '@/assets/scss/unnnic' as *;
|
|
15
|
+
|
|
16
|
+
$popover-space: $unnnic-space-4;
|
|
17
|
+
|
|
18
|
+
.unnnic-popover__footer {
|
|
19
|
+
border-top: 1px solid $unnnic-color-border-soft;
|
|
20
|
+
|
|
21
|
+
padding: $popover-space;
|
|
22
|
+
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: $unnnic-space-2;
|
|
27
|
+
|
|
28
|
+
> * {
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PopoverTriggerProps } from 'reka-ui';
|
|
3
|
+
import { PopoverTrigger } from 'reka-ui';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<PopoverTriggerProps>();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<PopoverTrigger
|
|
10
|
+
v-bind="props"
|
|
11
|
+
class="unnnic-popover-trigger"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</PopoverTrigger>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<style scoped>
|
|
18
|
+
.unnnic-popover-trigger {
|
|
19
|
+
border: none;
|
|
20
|
+
background: transparent;
|
|
21
|
+
padding: 0;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Popover } from './Popover.vue';
|
|
2
|
+
export { default as PopoverContent } from './PopoverContent.vue';
|
|
3
|
+
export { default as PopoverFooter } from './PopoverFooter.vue';
|
|
4
|
+
export { default as PopoverTrigger } from './PopoverTrigger.vue';
|
|
5
|
+
export { PopoverAnchor } from 'reka-ui';
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Popover,
|
|
3
|
+
PopoverContent,
|
|
4
|
+
PopoverFooter,
|
|
5
|
+
PopoverTrigger,
|
|
6
|
+
} from '../components/ui/popover';
|
|
7
|
+
import UnnnicButton from '../components/Button/Button.vue';
|
|
8
|
+
import UnnnicInput from '../components/Input/Input.vue';
|
|
9
|
+
import UnnnicLabel from '../components/Label/Label.vue';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: 'Misc/Popover',
|
|
13
|
+
component: Popover,
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
parameters: {
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: `A popover component that displays rich content in a portal, floating on top of other content.
|
|
19
|
+
<br/>
|
|
20
|
+
It supports three sizes (small, medium, large).
|
|
21
|
+
<br/>
|
|
22
|
+
API reference: https://www.reka-ui.com/docs/components/popover
|
|
23
|
+
`,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
argTypes: {
|
|
28
|
+
size: {
|
|
29
|
+
control: { type: 'select' },
|
|
30
|
+
options: ['small', 'medium', 'large'],
|
|
31
|
+
description: 'The size of the popover',
|
|
32
|
+
},
|
|
33
|
+
side: {
|
|
34
|
+
control: { type: 'select' },
|
|
35
|
+
options: ['top', 'right', 'bottom', 'left'],
|
|
36
|
+
description: 'The preferred side of the trigger to render against',
|
|
37
|
+
},
|
|
38
|
+
align: {
|
|
39
|
+
control: { type: 'select' },
|
|
40
|
+
options: ['start', 'center', 'end'],
|
|
41
|
+
description: 'The preferred alignment against the trigger',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
args: {
|
|
45
|
+
size: 'medium',
|
|
46
|
+
side: 'bottom',
|
|
47
|
+
align: 'center',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const Default = {
|
|
52
|
+
parameters: {
|
|
53
|
+
docs: {
|
|
54
|
+
description: {
|
|
55
|
+
story: 'A simple popover with some content inside.',
|
|
56
|
+
},
|
|
57
|
+
source: {
|
|
58
|
+
code: `
|
|
59
|
+
<UnnnicPopover>
|
|
60
|
+
<UnnnicPopoverTrigger>
|
|
61
|
+
<UnnnicButton text="Open Popover" />
|
|
62
|
+
</UnnnicPopoverTrigger>
|
|
63
|
+
<UnnnicPopoverContent v-bind="args">
|
|
64
|
+
<p style="margin: 0;">This is a simple popover with some content inside.</p>
|
|
65
|
+
</UnnnicPopoverContent>
|
|
66
|
+
</UnnnicPopover>
|
|
67
|
+
`,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
render: (args) => ({
|
|
72
|
+
components: { Popover, PopoverContent, PopoverTrigger, UnnnicButton },
|
|
73
|
+
setup() {
|
|
74
|
+
return { args };
|
|
75
|
+
},
|
|
76
|
+
template: `
|
|
77
|
+
<div style="display: flex; justify-content: center; align-items: center; min-height: 300px;">
|
|
78
|
+
<Popover>
|
|
79
|
+
<PopoverTrigger>
|
|
80
|
+
<UnnnicButton text="Open Popover" />
|
|
81
|
+
</PopoverTrigger>
|
|
82
|
+
<PopoverContent v-bind="args">
|
|
83
|
+
<p style="margin: 0;">This is a simple popover with some content inside.</p>
|
|
84
|
+
</PopoverContent>
|
|
85
|
+
</Popover>
|
|
86
|
+
</div>
|
|
87
|
+
`,
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const WithFooter = {
|
|
92
|
+
parameters: {
|
|
93
|
+
docs: {
|
|
94
|
+
description: {
|
|
95
|
+
story:
|
|
96
|
+
'Popover with action buttons in the footer using the `PopoverFooter` component.',
|
|
97
|
+
},
|
|
98
|
+
source: {
|
|
99
|
+
code: `
|
|
100
|
+
<UnnnicPopover>
|
|
101
|
+
<UnnnicPopoverTrigger>
|
|
102
|
+
<UnnnicButton text="Open Popover" />
|
|
103
|
+
</UnnnicPopoverTrigger>
|
|
104
|
+
<UnnnicPopoverContent v-bind="args">
|
|
105
|
+
<p style="margin: 0;">This popover has a footer with action buttons.</p>
|
|
106
|
+
<UnnnicPopoverFooter>
|
|
107
|
+
<UnnnicButton text="Cancel" type="tertiary" />
|
|
108
|
+
<UnnnicButton text="Save" type="primary" />
|
|
109
|
+
</UnnnicPopoverFooter>
|
|
110
|
+
</UnnnicPopoverContent>
|
|
111
|
+
</UnnnicPopover>
|
|
112
|
+
`,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
render: (args) => ({
|
|
117
|
+
components: {
|
|
118
|
+
Popover,
|
|
119
|
+
PopoverContent,
|
|
120
|
+
PopoverFooter,
|
|
121
|
+
PopoverTrigger,
|
|
122
|
+
UnnnicButton,
|
|
123
|
+
},
|
|
124
|
+
setup() {
|
|
125
|
+
return { args };
|
|
126
|
+
},
|
|
127
|
+
template: `
|
|
128
|
+
<div style="display: flex; justify-content: center; align-items: center; min-height: 300px;">
|
|
129
|
+
<Popover>
|
|
130
|
+
<PopoverTrigger>
|
|
131
|
+
<UnnnicButton text="Open Popover" />
|
|
132
|
+
</PopoverTrigger>
|
|
133
|
+
<PopoverContent v-bind="args">
|
|
134
|
+
<p style="margin: 0;">This popover has a footer with action buttons.</p>
|
|
135
|
+
<PopoverFooter>
|
|
136
|
+
<UnnnicButton text="Cancel" type="tertiary" />
|
|
137
|
+
<UnnnicButton text="Save" type="primary" />
|
|
138
|
+
</PopoverFooter>
|
|
139
|
+
</PopoverContent>
|
|
140
|
+
</Popover>
|
|
141
|
+
</div>
|
|
142
|
+
`,
|
|
143
|
+
}),
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const WithForm = {
|
|
147
|
+
parameters: {
|
|
148
|
+
docs: {
|
|
149
|
+
description: {
|
|
150
|
+
story: 'Popover containing a form with inputs and footer actions.',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
render: (args) => ({
|
|
155
|
+
components: {
|
|
156
|
+
Popover,
|
|
157
|
+
PopoverContent,
|
|
158
|
+
PopoverFooter,
|
|
159
|
+
PopoverTrigger,
|
|
160
|
+
UnnnicButton,
|
|
161
|
+
UnnnicInput,
|
|
162
|
+
UnnnicLabel,
|
|
163
|
+
},
|
|
164
|
+
setup() {
|
|
165
|
+
return { args };
|
|
166
|
+
},
|
|
167
|
+
template: `
|
|
168
|
+
<div style="display: flex; justify-content: center; align-items: center; min-height: 400px;">
|
|
169
|
+
<Popover>
|
|
170
|
+
<PopoverTrigger>
|
|
171
|
+
<UnnnicButton text="Edit Profile" iconLeft="edit" />
|
|
172
|
+
</PopoverTrigger>
|
|
173
|
+
<PopoverContent v-bind="args">
|
|
174
|
+
<h3 style="margin: 0 0 16px 0; font-size: 16px; font-weight: 700;">Edit Profile</h3>
|
|
175
|
+
<form>
|
|
176
|
+
<UnnnicLabel label="Name" />
|
|
177
|
+
<UnnnicInput placeholder="Enter your name" />
|
|
178
|
+
<br />
|
|
179
|
+
<UnnnicLabel label="Email" />
|
|
180
|
+
<UnnnicInput placeholder="Enter your email" type="email" />
|
|
181
|
+
</form>
|
|
182
|
+
<PopoverFooter>
|
|
183
|
+
<UnnnicButton text="Cancel" type="tertiary" />
|
|
184
|
+
<UnnnicButton text="Save" type="primary" />
|
|
185
|
+
</PopoverFooter>
|
|
186
|
+
</PopoverContent>
|
|
187
|
+
</Popover>
|
|
188
|
+
</div>
|
|
189
|
+
`,
|
|
190
|
+
}),
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export const Sizes = {
|
|
194
|
+
parameters: {
|
|
195
|
+
docs: {
|
|
196
|
+
description: {
|
|
197
|
+
story:
|
|
198
|
+
'The popover comes in three sizes: small (240px), medium (320px), and large (400px).',
|
|
199
|
+
},
|
|
200
|
+
source: {
|
|
201
|
+
code: `
|
|
202
|
+
<UnnnicPopover>
|
|
203
|
+
<!-- Small popover (240px) -->
|
|
204
|
+
<UnnnicPopoverContent size="small">
|
|
205
|
+
...
|
|
206
|
+
</UnnnicPopoverContent>
|
|
207
|
+
|
|
208
|
+
<!-- Medium popover (320px) -->
|
|
209
|
+
<UnnnicPopoverContent size="medium">
|
|
210
|
+
...
|
|
211
|
+
</UnnnicPopoverContent>
|
|
212
|
+
<!-- Large popover (400px) -->
|
|
213
|
+
<UnnnicPopoverContent size="large">
|
|
214
|
+
...
|
|
215
|
+
</UnnnicPopoverContent>
|
|
216
|
+
</UnnnicPopover>
|
|
217
|
+
`,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
render: (args) => ({
|
|
222
|
+
components: { Popover, PopoverContent, PopoverTrigger, UnnnicButton },
|
|
223
|
+
setup() {
|
|
224
|
+
return { args };
|
|
225
|
+
},
|
|
226
|
+
template: `
|
|
227
|
+
<div style="display: flex; justify-content: space-around; align-items: center; min-height: 400px; gap: 32px;">
|
|
228
|
+
<Popover>
|
|
229
|
+
<PopoverTrigger>
|
|
230
|
+
<UnnnicButton text="Small" />
|
|
231
|
+
</PopoverTrigger>
|
|
232
|
+
<PopoverContent size="small">
|
|
233
|
+
<p style="margin: 0;">Small popover (240px)</p>
|
|
234
|
+
</PopoverContent>
|
|
235
|
+
</Popover>
|
|
236
|
+
|
|
237
|
+
<Popover>
|
|
238
|
+
<PopoverTrigger>
|
|
239
|
+
<UnnnicButton text="Medium" />
|
|
240
|
+
</PopoverTrigger>
|
|
241
|
+
<PopoverContent size="medium">
|
|
242
|
+
<p style="margin: 0;">Medium popover (320px)</p>
|
|
243
|
+
</PopoverContent>
|
|
244
|
+
</Popover>
|
|
245
|
+
|
|
246
|
+
<Popover>
|
|
247
|
+
<PopoverTrigger>
|
|
248
|
+
<UnnnicButton text="Large" />
|
|
249
|
+
</PopoverTrigger>
|
|
250
|
+
<PopoverContent size="large">
|
|
251
|
+
<p style="margin: 0;">Large popover (400px)</p>
|
|
252
|
+
</PopoverContent>
|
|
253
|
+
</Popover>
|
|
254
|
+
</div>
|
|
255
|
+
`,
|
|
256
|
+
}),
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export const Placements = {
|
|
260
|
+
parameters: {
|
|
261
|
+
docs: {
|
|
262
|
+
description: {
|
|
263
|
+
story:
|
|
264
|
+
'The popover can be positioned on any side of the trigger: top, bottom, left, or right.',
|
|
265
|
+
},
|
|
266
|
+
source: {
|
|
267
|
+
code: `
|
|
268
|
+
<UnnnicPopover>
|
|
269
|
+
<!-- Top -->
|
|
270
|
+
<UnnnicPopoverContent side="top">
|
|
271
|
+
...
|
|
272
|
+
</UnnnicPopoverContent>
|
|
273
|
+
<!-- Bottom -->
|
|
274
|
+
<UnnnicPopoverContent side="bottom">
|
|
275
|
+
...
|
|
276
|
+
</UnnnicPopoverContent>
|
|
277
|
+
<!-- Right -->
|
|
278
|
+
<UnnnicPopoverContent side="right">
|
|
279
|
+
...
|
|
280
|
+
</UnnnicPopoverContent>
|
|
281
|
+
<!-- Left -->
|
|
282
|
+
<UnnnicPopoverContent side="left">
|
|
283
|
+
...
|
|
284
|
+
</UnnnicPopoverContent>
|
|
285
|
+
</UnnnicPopover>
|
|
286
|
+
`,
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
render: (args) => ({
|
|
291
|
+
components: { Popover, PopoverContent, PopoverTrigger, UnnnicButton },
|
|
292
|
+
setup() {
|
|
293
|
+
return { args };
|
|
294
|
+
},
|
|
295
|
+
template: `
|
|
296
|
+
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; padding: 100px;">
|
|
297
|
+
<Popover>
|
|
298
|
+
<PopoverTrigger>
|
|
299
|
+
<UnnnicButton text="Top" style="width: 100%;" />
|
|
300
|
+
</PopoverTrigger>
|
|
301
|
+
<PopoverContent side="top" align="center">
|
|
302
|
+
<p style="margin: 0;">Popover on top</p>
|
|
303
|
+
</PopoverContent>
|
|
304
|
+
</Popover>
|
|
305
|
+
|
|
306
|
+
<Popover>
|
|
307
|
+
<PopoverTrigger>
|
|
308
|
+
<UnnnicButton text="Bottom" style="width: 100%;" />
|
|
309
|
+
</PopoverTrigger>
|
|
310
|
+
<PopoverContent side="bottom" align="center">
|
|
311
|
+
<p style="margin: 0;">Popover on bottom</p>
|
|
312
|
+
</PopoverContent>
|
|
313
|
+
</Popover>
|
|
314
|
+
|
|
315
|
+
<Popover>
|
|
316
|
+
<PopoverTrigger>
|
|
317
|
+
<UnnnicButton text="Right" style="width: 100%;" />
|
|
318
|
+
</PopoverTrigger>
|
|
319
|
+
<PopoverContent side="right" align="center">
|
|
320
|
+
<p style="margin: 0;">Popover on right</p>
|
|
321
|
+
</PopoverContent>
|
|
322
|
+
</Popover>
|
|
323
|
+
|
|
324
|
+
<Popover>
|
|
325
|
+
<PopoverTrigger>
|
|
326
|
+
<UnnnicButton text="Left" style="width: 100%;" />
|
|
327
|
+
</PopoverTrigger>
|
|
328
|
+
<PopoverContent side="left" align="center">
|
|
329
|
+
<p style="margin: 0;">Popover on left</p>
|
|
330
|
+
</PopoverContent>
|
|
331
|
+
</Popover>
|
|
332
|
+
</div>
|
|
333
|
+
`,
|
|
334
|
+
}),
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
export const RichContent = {
|
|
338
|
+
args: {
|
|
339
|
+
size: 'large',
|
|
340
|
+
},
|
|
341
|
+
parameters: {
|
|
342
|
+
docs: {
|
|
343
|
+
description: {
|
|
344
|
+
story:
|
|
345
|
+
'Example of a popover with rich, structured content and footer actions.',
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
render: (args) => ({
|
|
350
|
+
components: {
|
|
351
|
+
Popover,
|
|
352
|
+
PopoverContent,
|
|
353
|
+
PopoverFooter,
|
|
354
|
+
PopoverTrigger,
|
|
355
|
+
UnnnicButton,
|
|
356
|
+
},
|
|
357
|
+
setup() {
|
|
358
|
+
return { args };
|
|
359
|
+
},
|
|
360
|
+
template: `
|
|
361
|
+
<div style="display: flex; justify-content: center; align-items: center; min-height: 400px;">
|
|
362
|
+
<Popover>
|
|
363
|
+
<PopoverTrigger>
|
|
364
|
+
<UnnnicButton text="Show Details" iconLeft="info" />
|
|
365
|
+
</PopoverTrigger>
|
|
366
|
+
<PopoverContent v-bind="args">
|
|
367
|
+
<div>
|
|
368
|
+
<h3 style="margin: 0 0 8px 0; font-size: 16px; font-weight: 700;">User Information</h3>
|
|
369
|
+
<div style="display: flex; flex-direction: column; gap: 12px;">
|
|
370
|
+
<div style="display: flex; gap: 8px;">
|
|
371
|
+
<span style="font-weight: 600;">Name:</span>
|
|
372
|
+
<span>John Doe</span>
|
|
373
|
+
</div>
|
|
374
|
+
<div style="display: flex; gap: 8px;">
|
|
375
|
+
<span style="font-weight: 600;">Email:</span>
|
|
376
|
+
<span>john.doe@example.com</span>
|
|
377
|
+
</div>
|
|
378
|
+
<div style="display: flex; gap: 8px;">
|
|
379
|
+
<span style="font-weight: 600;">Role:</span>
|
|
380
|
+
<span>Administrator</span>
|
|
381
|
+
</div>
|
|
382
|
+
<div style="display: flex; gap: 8px;">
|
|
383
|
+
<span style="font-weight: 600;">Status:</span>
|
|
384
|
+
<span style="color: #4CAF50;">Active</span>
|
|
385
|
+
</div>
|
|
386
|
+
</div>
|
|
387
|
+
</div>
|
|
388
|
+
<PopoverFooter>
|
|
389
|
+
<UnnnicButton text="View Profile" type="primary" />
|
|
390
|
+
</PopoverFooter>
|
|
391
|
+
</PopoverContent>
|
|
392
|
+
</Popover>
|
|
393
|
+
</div>
|
|
394
|
+
`,
|
|
395
|
+
}),
|
|
396
|
+
};
|