@teammodlr/ui-kit 3.0.0-beta.7 → 3.0.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/lib/components/checkbox/Checkbox.vue.d.ts +4 -4
- package/lib/components/clearbutton/ClearButton.vue.d.ts +7 -0
- package/lib/components/clearbutton/style/ClearButton.css.d.ts +2 -0
- package/lib/components/clearbutton/style/index.d.ts +1 -0
- package/lib/components/colorpicker/ColorPicker.vue.d.ts +0 -1
- package/lib/components/colorpicker/style/ColorPicker.css.d.ts +1 -0
- package/lib/components/dialog/style/Dialog.css.d.ts +2 -0
- package/lib/components/drawer/Drawer.vue.d.ts +142 -0
- package/lib/components/drawer/style/Drawer.css.d.ts +33 -0
- package/lib/components/drawer/style/index.d.ts +1 -0
- package/lib/components/hovercard/HoverCard.vue.d.ts +122 -0
- package/lib/components/hovercard/style/HoverCard.css.d.ts +3 -0
- package/lib/components/hovercard/style/index.d.ts +1 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/input/Input.vue.d.ts +20 -5
- package/lib/components/input/style/Input.css.d.ts +4 -0
- package/lib/components/paneldialog/PanelDialog.vue.d.ts +167 -0
- package/lib/components/paneldialog/style/PanelDialog.css.d.ts +8 -0
- package/lib/components/paneldialog/style/index.d.ts +1 -0
- package/lib/components/popover/Popover.vue.d.ts +113 -0
- package/lib/components/popover/style/Popover.css.d.ts +4 -0
- package/lib/components/popover/style/index.d.ts +1 -0
- package/lib/components/radio/Radio.vue.d.ts +5 -5
- package/lib/components/radiobutton/RadioButton.vue.d.ts +4 -4
- package/lib/components/select/Select.vue.d.ts +72 -91
- package/lib/components/select/style/Select.css.d.ts +9 -1
- package/lib/components/switch/Switch.vue.d.ts +4 -4
- package/lib/components/textarea/Textarea.vue.d.ts +16 -5
- package/lib/components/textarea/style/Textarea.css.d.ts +2 -0
- package/lib/composables/useInput.d.ts +9 -2
- package/lib/index.cjs.js +3 -3
- package/lib/index.es.js +11870 -9642
- package/lib/style.css +1 -1
- package/lib/tsconfig.app.tsbuildinfo +1 -0
- package/package.json +7 -4
- package/src/components/cardcontextmenu/style/Dropdown.css.ts +7 -0
- package/src/components/clearbutton/ClearButton.vue +39 -0
- package/src/components/clearbutton/style/ClearButton.css.ts +37 -0
- package/src/components/clearbutton/style/index.ts +1 -0
- package/src/components/colorpicker/ColorPicker.vue +8 -11
- package/src/components/colorpicker/examples/basic.vue +8 -17
- package/src/components/colorpicker/style/ColorPicker.css.ts +6 -1
- package/src/components/dialog/Dialog.vue +2 -5
- package/src/components/dialog/style/Dialog.css.ts +30 -0
- package/src/components/drawer/Drawer.vue +276 -0
- package/src/components/drawer/examples/basic.vue +15 -0
- package/src/components/drawer/examples/custom-title.vue +21 -0
- package/src/components/drawer/examples/index.stories.ts +24 -0
- package/src/components/drawer/examples/index.ts +7 -0
- package/src/components/drawer/examples/no-mask.vue +15 -0
- package/src/components/drawer/examples/no-outside-close.vue +15 -0
- package/src/components/drawer/examples/placements.vue +28 -0
- package/src/components/drawer/examples/with-footer.vue +21 -0
- package/src/components/drawer/examples/with-trigger.vue +13 -0
- package/src/components/drawer/style/Drawer.css.ts +208 -0
- package/src/components/drawer/style/index.ts +1 -0
- package/src/components/dropdown/Dropdown.vue +1 -1
- package/src/components/hovercard/HoverCard.vue +163 -0
- package/src/components/hovercard/style/HoverCard.css.ts +175 -0
- package/src/components/hovercard/style/index.ts +1 -0
- package/src/components/index.ts +4 -0
- package/src/components/input/Input.vue +52 -4
- package/src/components/input/examples/clearable.vue +18 -0
- package/src/components/input/examples/index.stories.ts +3 -1
- package/src/components/input/examples/index.ts +1 -0
- package/src/components/input/style/Input.css.ts +19 -0
- package/src/components/messageprovider/MessageProvider.vue +33 -7
- package/src/components/paneldialog/PanelDialog.vue +500 -0
- package/src/components/paneldialog/examples/basic.vue +36 -0
- package/src/components/paneldialog/examples/index.stories.ts +22 -0
- package/src/components/paneldialog/examples/index.ts +2 -0
- package/src/components/paneldialog/examples/modal.vue +31 -0
- package/src/components/paneldialog/style/PanelDialog.css.ts +90 -0
- package/src/components/paneldialog/style/index.ts +1 -0
- package/src/components/popover/Popover.vue +155 -0
- package/src/components/popover/examples/arrow.vue +47 -0
- package/src/components/popover/examples/basic.vue +15 -0
- package/src/components/popover/examples/index.stories.ts +19 -0
- package/src/components/popover/examples/index.ts +4 -0
- package/src/components/popover/examples/placement.vue +59 -0
- package/src/components/popover/examples/variant.vue +30 -0
- package/src/components/popover/style/Popover.css.ts +203 -0
- package/src/components/popover/style/index.ts +1 -0
- package/src/components/select/Select.vue +122 -42
- package/src/components/select/examples/clearable.vue +18 -0
- package/src/components/select/examples/fill.vue +52 -0
- package/src/components/select/examples/index.stories.ts +3 -1
- package/src/components/select/examples/index.ts +2 -0
- package/src/components/select/style/Select.css.ts +140 -24
- package/src/components/tab/Tab.vue +1 -1
- package/src/components/tab/style/Tab.css.ts +6 -0
- package/src/components/textarea/Textarea.vue +40 -4
- package/src/components/textarea/examples/clearable.vue +16 -0
- package/src/components/textarea/examples/index.stories.ts +2 -1
- package/src/components/textarea/examples/index.ts +1 -0
- package/src/components/textarea/style/Textarea.css.ts +10 -0
- package/src/composables/useInput.ts +10 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import MPanelDialog from '../PanelDialog.vue';
|
|
2
|
+
import { MPanelDialogBasic, MPanelDialogModal } from './index';
|
|
3
|
+
import { createStory } from '../../../__storybook__';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
component: MPanelDialog,
|
|
7
|
+
title: 'Components/PanelDialog',
|
|
8
|
+
argTypes: {
|
|
9
|
+
open: { control: 'boolean' },
|
|
10
|
+
modal: { control: 'boolean' },
|
|
11
|
+
draggable: { control: 'boolean' },
|
|
12
|
+
width: { control: 'text' },
|
|
13
|
+
height: { control: 'text' },
|
|
14
|
+
maxHeight: { control: 'text' },
|
|
15
|
+
handleSelector: { control: 'text' },
|
|
16
|
+
backdrop: { control: 'boolean' },
|
|
17
|
+
focusTrap: { control: 'boolean' }
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const Basic = createStory(MPanelDialogBasic);
|
|
22
|
+
export const Modal = createStory(MPanelDialogModal);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<button @click="open = true">Open modal panel</button>
|
|
4
|
+
<MPanelDialog
|
|
5
|
+
v-model:open="open"
|
|
6
|
+
:modal="true"
|
|
7
|
+
width="520px"
|
|
8
|
+
:draggable="false"
|
|
9
|
+
:backdrop="true"
|
|
10
|
+
>
|
|
11
|
+
<div data-panel-handle style="padding: 12px 16px; border-bottom: 1px solid #e4e2ea; font-weight: 600;">
|
|
12
|
+
Modal panel (drag disabled)
|
|
13
|
+
</div>
|
|
14
|
+
<div style="padding: 16px; display: flex; flex-direction: column; gap: 12px;">
|
|
15
|
+
<p style="margin: 0;">Modal variant blocks background interaction and shows an overlay.</p>
|
|
16
|
+
<MInput placeholder="Focus trap stays inside" />
|
|
17
|
+
<div style="display: flex; gap: 8px; justify-content: flex-end;">
|
|
18
|
+
<button @click="open = false">Close</button>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</MPanelDialog>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script lang="ts" setup>
|
|
26
|
+
import { ref } from 'vue';
|
|
27
|
+
import MPanelDialog from '../PanelDialog.vue';
|
|
28
|
+
import MInput from '../../input/Input.vue';
|
|
29
|
+
|
|
30
|
+
const open = ref(false);
|
|
31
|
+
</script>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { globalStyle, style } from '@vanilla-extract/css';
|
|
2
|
+
import { themeVars } from '../../../styles/theme.css';
|
|
3
|
+
|
|
4
|
+
export const backdrop = style({
|
|
5
|
+
position: 'fixed',
|
|
6
|
+
inset: 0,
|
|
7
|
+
backgroundColor: 'rgba(0,0,0,.45)',
|
|
8
|
+
pointerEvents: 'none'
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const dialogContent = style({
|
|
12
|
+
position: 'fixed',
|
|
13
|
+
inset: 0,
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
outline: 'none',
|
|
18
|
+
selectors: {
|
|
19
|
+
'&:focus': {
|
|
20
|
+
outline: 'none'
|
|
21
|
+
},
|
|
22
|
+
'&:focus-visible': {
|
|
23
|
+
outline: 'none'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const dialogContentModal = style({
|
|
29
|
+
pointerEvents: 'auto'
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const dialogContentNonModal = style({
|
|
33
|
+
pointerEvents: 'none'
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const focusScope = style({
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
width: '100%',
|
|
41
|
+
height: '100%',
|
|
42
|
+
outline: 'none',
|
|
43
|
+
selectors: {
|
|
44
|
+
'&:focus': {
|
|
45
|
+
outline: 'none'
|
|
46
|
+
},
|
|
47
|
+
'&:focus-visible': {
|
|
48
|
+
outline: 'none'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const focusScopeNonModal = style({
|
|
54
|
+
pointerEvents: 'none'
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export const focusScopeModal = style({
|
|
58
|
+
pointerEvents: 'auto'
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const panel = style({
|
|
62
|
+
position: 'relative',
|
|
63
|
+
display: 'flex',
|
|
64
|
+
flexDirection: 'column',
|
|
65
|
+
backgroundColor: '#FFF',
|
|
66
|
+
backgroundClip: 'padding-box',
|
|
67
|
+
border: `1px solid ${themeVars.color.gray[300]}`,
|
|
68
|
+
borderRadius: themeVars.rounded.medium,
|
|
69
|
+
boxShadow: `2px 2px 8px rgba(128, 128, 128, 0.1), 0 9px 28px 8px rgba(0,0,0,.05)`,
|
|
70
|
+
overflow: 'hidden',
|
|
71
|
+
outline: 'none',
|
|
72
|
+
pointerEvents: 'auto',
|
|
73
|
+
maxWidth: 'calc(100vw - 32px)',
|
|
74
|
+
selectors: {
|
|
75
|
+
'&:focus': {
|
|
76
|
+
outline: 'none'
|
|
77
|
+
},
|
|
78
|
+
'&:focus-visible': {
|
|
79
|
+
outline: 'none'
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
globalStyle(`${panel} [data-panel-handle]`, {
|
|
85
|
+
cursor: 'grab'
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
globalStyle(`${panel} [data-panel-handle]:active`, {
|
|
89
|
+
cursor: 'grabbing'
|
|
90
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PanelDialog.css';
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PopoverRoot v-model:open="isOpen" :modal="modal">
|
|
3
|
+
<PopoverTrigger as-child>
|
|
4
|
+
<slot />
|
|
5
|
+
</PopoverTrigger>
|
|
6
|
+
<PopoverPortal :disabled="!transfer">
|
|
7
|
+
<PopoverContent
|
|
8
|
+
:class="contentClasses"
|
|
9
|
+
:side="resolvedSide"
|
|
10
|
+
:align="resolvedAlign"
|
|
11
|
+
:side-offset="sideOffset"
|
|
12
|
+
:collision-padding="collisionPadding"
|
|
13
|
+
:style="{ zIndex: zIndex }"
|
|
14
|
+
>
|
|
15
|
+
<slot name="content" />
|
|
16
|
+
<PopoverArrow v-if="showArrow" :class="style.arrow" :width="12" :height="6" />
|
|
17
|
+
</PopoverContent>
|
|
18
|
+
</PopoverPortal>
|
|
19
|
+
</PopoverRoot>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import {
|
|
24
|
+
PopoverArrow,
|
|
25
|
+
PopoverContent,
|
|
26
|
+
PopoverPortal,
|
|
27
|
+
PopoverRoot,
|
|
28
|
+
PopoverTrigger,
|
|
29
|
+
type PopoverContentProps
|
|
30
|
+
} from 'reka-ui';
|
|
31
|
+
import {
|
|
32
|
+
computed,
|
|
33
|
+
defineComponent,
|
|
34
|
+
ref,
|
|
35
|
+
useAttrs,
|
|
36
|
+
watch,
|
|
37
|
+
type PropType
|
|
38
|
+
} from 'vue';
|
|
39
|
+
import {
|
|
40
|
+
type Placement,
|
|
41
|
+
placementWhileList
|
|
42
|
+
} from '../../composables/usePopper';
|
|
43
|
+
import { useZIndex } from '../../composables/useZIndex';
|
|
44
|
+
import * as style from './style';
|
|
45
|
+
|
|
46
|
+
export default defineComponent({
|
|
47
|
+
name: 'MPopover',
|
|
48
|
+
inheritAttrs: false,
|
|
49
|
+
components: {
|
|
50
|
+
PopoverArrow,
|
|
51
|
+
PopoverContent,
|
|
52
|
+
PopoverPortal,
|
|
53
|
+
PopoverRoot,
|
|
54
|
+
PopoverTrigger
|
|
55
|
+
},
|
|
56
|
+
props: {
|
|
57
|
+
open: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
60
|
+
},
|
|
61
|
+
modal: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
placement: {
|
|
66
|
+
type: String as PropType<Placement>,
|
|
67
|
+
default: 'bottom',
|
|
68
|
+
validator: (value: Placement) => placementWhileList.includes(value)
|
|
69
|
+
},
|
|
70
|
+
transfer: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: true
|
|
73
|
+
},
|
|
74
|
+
sideOffset: {
|
|
75
|
+
type: Number,
|
|
76
|
+
default: 5
|
|
77
|
+
},
|
|
78
|
+
collisionPadding: {
|
|
79
|
+
type: [Number, Object] as PropType<number | { top?: number; right?: number; bottom?: number; left?: number }>,
|
|
80
|
+
default: 10
|
|
81
|
+
},
|
|
82
|
+
arrow: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false
|
|
85
|
+
},
|
|
86
|
+
variant: {
|
|
87
|
+
type: String as PropType<'light' | 'dark'>,
|
|
88
|
+
default: 'light'
|
|
89
|
+
},
|
|
90
|
+
zIndex: {
|
|
91
|
+
type: Number
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
emits: ['update:open'],
|
|
95
|
+
setup(props, { emit }) {
|
|
96
|
+
const attrs = useAttrs();
|
|
97
|
+
const { nextZIndex } = useZIndex();
|
|
98
|
+
const isOpen = ref(props.open);
|
|
99
|
+
const zIndex = ref(props.zIndex ?? nextZIndex());
|
|
100
|
+
|
|
101
|
+
const resolvedPlacement = computed(() => {
|
|
102
|
+
const [side, align] = props.placement.split('-');
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
side: side === 'top' || side === 'right' || side === 'bottom' || side === 'left'
|
|
106
|
+
? side
|
|
107
|
+
: undefined,
|
|
108
|
+
align: align === 'start' || align === 'center' || align === 'end'
|
|
109
|
+
? align
|
|
110
|
+
: undefined
|
|
111
|
+
} as {
|
|
112
|
+
side?: PopoverContentProps['side'];
|
|
113
|
+
align?: PopoverContentProps['align'];
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const showArrow = computed(() => {
|
|
118
|
+
const { align } = resolvedPlacement.value;
|
|
119
|
+
return props.arrow && (!align || align === 'center');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const contentClasses = computed(() => {
|
|
123
|
+
return [
|
|
124
|
+
'm-popover-content',
|
|
125
|
+
style.content,
|
|
126
|
+
{
|
|
127
|
+
[style.dark]: props.variant === 'dark'
|
|
128
|
+
},
|
|
129
|
+
attrs.class
|
|
130
|
+
];
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
watch(
|
|
134
|
+
() => props.open,
|
|
135
|
+
value => {
|
|
136
|
+
isOpen.value = value;
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
watch(isOpen, value => {
|
|
141
|
+
emit('update:open', value);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
isOpen,
|
|
146
|
+
zIndex,
|
|
147
|
+
showArrow,
|
|
148
|
+
contentClasses,
|
|
149
|
+
resolvedSide: computed(() => resolvedPlacement.value.side),
|
|
150
|
+
resolvedAlign: computed(() => resolvedPlacement.value.align),
|
|
151
|
+
style
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
</script>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="padding: 100px; display: flex; gap: 16px; flex-wrap: wrap;">
|
|
3
|
+
<MPopover arrow placement="bottom">
|
|
4
|
+
<MButton>Bottom (Arrow)</MButton>
|
|
5
|
+
<template #content>
|
|
6
|
+
<div style="padding: 8px; min-width: 180px;">
|
|
7
|
+
<p style="margin: 0; font-size: 14px;">
|
|
8
|
+
Arrow points to the trigger.
|
|
9
|
+
</p>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
</MPopover>
|
|
13
|
+
|
|
14
|
+
<MPopover arrow placement="top">
|
|
15
|
+
<MButton>Top (Arrow)</MButton>
|
|
16
|
+
<template #content>
|
|
17
|
+
<div style="padding: 8px; min-width: 180px;">
|
|
18
|
+
<p style="margin: 0; font-size: 14px;">
|
|
19
|
+
Arrow points to the trigger.
|
|
20
|
+
</p>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
</MPopover>
|
|
24
|
+
|
|
25
|
+
<MPopover arrow placement="left">
|
|
26
|
+
<MButton>Left (Arrow)</MButton>
|
|
27
|
+
<template #content>
|
|
28
|
+
<div style="padding: 8px; min-width: 180px;">
|
|
29
|
+
<p style="margin: 0; font-size: 14px;">
|
|
30
|
+
Arrow points to the trigger.
|
|
31
|
+
</p>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
</MPopover>
|
|
35
|
+
|
|
36
|
+
<MPopover arrow placement="right">
|
|
37
|
+
<MButton>Right (Arrow)</MButton>
|
|
38
|
+
<template #content>
|
|
39
|
+
<div style="padding: 8px; min-width: 180px;">
|
|
40
|
+
<p style="margin: 0; font-size: 14px;">
|
|
41
|
+
Arrow points to the trigger.
|
|
42
|
+
</p>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
</MPopover>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="padding: 100px;">
|
|
3
|
+
<MPopover>
|
|
4
|
+
<MButton>Open Popover</MButton>
|
|
5
|
+
<template #content>
|
|
6
|
+
<div style="padding: 8px; min-width: 200px;">
|
|
7
|
+
<h4 style="margin: 0 0 8px; font-weight: 600;">Popover Title</h4>
|
|
8
|
+
<p style="margin: 0; color: #666; font-size: 14px;">
|
|
9
|
+
This is the popover content. You can put anything here.
|
|
10
|
+
</p>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
</MPopover>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import MPopover from '../Popover.vue';
|
|
2
|
+
import MButton from '../../button/Button.vue';
|
|
3
|
+
|
|
4
|
+
import { MPopoverBasic, MPopoverPlacement, MPopoverArrow, MPopoverVariant } from './index';
|
|
5
|
+
import { createStory, popperPositionArgType } from '../../../__storybook__';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
component: MPopover,
|
|
9
|
+
subcomponents: { MButton },
|
|
10
|
+
title: 'Components/Popover',
|
|
11
|
+
argTypes: {
|
|
12
|
+
...popperPositionArgType()
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Basic = createStory(MPopoverBasic);
|
|
17
|
+
export const Placement = createStory(MPopoverPlacement);
|
|
18
|
+
export const Arrow = createStory(MPopoverArrow);
|
|
19
|
+
export const Variant = createStory(MPopoverVariant);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="padding: 150px; display: flex; gap: 16px; flex-wrap: wrap;">
|
|
3
|
+
<MPopover placement="top">
|
|
4
|
+
<MButton>Top</MButton>
|
|
5
|
+
<template #content>
|
|
6
|
+
<div style="padding: 8px;">Top</div>
|
|
7
|
+
</template>
|
|
8
|
+
</MPopover>
|
|
9
|
+
|
|
10
|
+
<MPopover placement="top-start">
|
|
11
|
+
<MButton>Top Start</MButton>
|
|
12
|
+
<template #content>
|
|
13
|
+
<div style="padding: 8px;">Top Start</div>
|
|
14
|
+
</template>
|
|
15
|
+
</MPopover>
|
|
16
|
+
|
|
17
|
+
<MPopover placement="top-end">
|
|
18
|
+
<MButton>Top End</MButton>
|
|
19
|
+
<template #content>
|
|
20
|
+
<div style="padding: 8px;">Top End</div>
|
|
21
|
+
</template>
|
|
22
|
+
</MPopover>
|
|
23
|
+
|
|
24
|
+
<MPopover placement="bottom">
|
|
25
|
+
<MButton>Bottom</MButton>
|
|
26
|
+
<template #content>
|
|
27
|
+
<div style="padding: 8px;">Bottom</div>
|
|
28
|
+
</template>
|
|
29
|
+
</MPopover>
|
|
30
|
+
|
|
31
|
+
<MPopover placement="bottom-start">
|
|
32
|
+
<MButton>Bottom Start</MButton>
|
|
33
|
+
<template #content>
|
|
34
|
+
<div style="padding: 8px;">Bottom Start</div>
|
|
35
|
+
</template>
|
|
36
|
+
</MPopover>
|
|
37
|
+
|
|
38
|
+
<MPopover placement="bottom-end">
|
|
39
|
+
<MButton>Bottom End</MButton>
|
|
40
|
+
<template #content>
|
|
41
|
+
<div style="padding: 8px;">Bottom End</div>
|
|
42
|
+
</template>
|
|
43
|
+
</MPopover>
|
|
44
|
+
|
|
45
|
+
<MPopover placement="left">
|
|
46
|
+
<MButton>Left</MButton>
|
|
47
|
+
<template #content>
|
|
48
|
+
<div style="padding: 8px;">Left</div>
|
|
49
|
+
</template>
|
|
50
|
+
</MPopover>
|
|
51
|
+
|
|
52
|
+
<MPopover placement="right">
|
|
53
|
+
<MButton>Right</MButton>
|
|
54
|
+
<template #content>
|
|
55
|
+
<div style="padding: 8px;">Right</div>
|
|
56
|
+
</template>
|
|
57
|
+
</MPopover>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="padding: 100px; display: flex; gap: 16px;">
|
|
3
|
+
<MPopover>
|
|
4
|
+
<MButton>Light (Default)</MButton>
|
|
5
|
+
<template #content>
|
|
6
|
+
<div style="padding: 8px; min-width: 150px;">
|
|
7
|
+
<p style="margin: 0; font-size: 14px;">Light popover content</p>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
</MPopover>
|
|
11
|
+
|
|
12
|
+
<MPopover variant="dark">
|
|
13
|
+
<MButton variant="dark">Dark</MButton>
|
|
14
|
+
<template #content>
|
|
15
|
+
<div style="padding: 8px; min-width: 150px;">
|
|
16
|
+
<p style="margin: 0; font-size: 14px;">Dark popover content</p>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
</MPopover>
|
|
20
|
+
|
|
21
|
+
<MPopover variant="dark" arrow placement="bottom">
|
|
22
|
+
<MButton variant="dark">Dark with Arrow</MButton>
|
|
23
|
+
<template #content>
|
|
24
|
+
<div style="padding: 8px; min-width: 150px;">
|
|
25
|
+
<p style="margin: 0; font-size: 14px;">Dark popover with arrow</p>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
</MPopover>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { globalKeyframes, globalStyle, style } from '@vanilla-extract/css';
|
|
2
|
+
import { themeVars } from '../../../styles/theme.css';
|
|
3
|
+
|
|
4
|
+
const menuFadeOutAnimation = 'popover-fade-out';
|
|
5
|
+
globalKeyframes(menuFadeOutAnimation, {
|
|
6
|
+
from: {
|
|
7
|
+
opacity: 1
|
|
8
|
+
},
|
|
9
|
+
to: {
|
|
10
|
+
opacity: 0
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const menuSlideFadeOutTopAnimation = 'popover-slide-fade-out-top';
|
|
15
|
+
globalKeyframes(menuSlideFadeOutTopAnimation, {
|
|
16
|
+
from: {
|
|
17
|
+
opacity: 1,
|
|
18
|
+
transform: 'translateY(0) scale(1)'
|
|
19
|
+
},
|
|
20
|
+
to: {
|
|
21
|
+
opacity: 0,
|
|
22
|
+
transform: 'translateY(6px) scale(0.98)'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const menuSlideFadeOutBottomAnimation = 'popover-slide-fade-out-bottom';
|
|
27
|
+
globalKeyframes(menuSlideFadeOutBottomAnimation, {
|
|
28
|
+
from: {
|
|
29
|
+
opacity: 1,
|
|
30
|
+
transform: 'translateY(0) scale(1)'
|
|
31
|
+
},
|
|
32
|
+
to: {
|
|
33
|
+
opacity: 0,
|
|
34
|
+
transform: 'translateY(-6px) scale(0.98)'
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const menuSlideFadeOutLeftAnimation = 'popover-slide-fade-out-left';
|
|
39
|
+
globalKeyframes(menuSlideFadeOutLeftAnimation, {
|
|
40
|
+
from: {
|
|
41
|
+
opacity: 1,
|
|
42
|
+
transform: 'translateX(0) scale(1)'
|
|
43
|
+
},
|
|
44
|
+
to: {
|
|
45
|
+
opacity: 0,
|
|
46
|
+
transform: 'translateX(6px) scale(0.98)'
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const menuSlideFadeOutRightAnimation = 'popover-slide-fade-out-right';
|
|
51
|
+
globalKeyframes(menuSlideFadeOutRightAnimation, {
|
|
52
|
+
from: {
|
|
53
|
+
opacity: 1,
|
|
54
|
+
transform: 'translateX(0) scale(1)'
|
|
55
|
+
},
|
|
56
|
+
to: {
|
|
57
|
+
opacity: 0,
|
|
58
|
+
transform: 'translateX(-6px) scale(0.98)'
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const menuSlideFadeTopAnimation = 'popover-slide-fade-top';
|
|
63
|
+
globalKeyframes(menuSlideFadeTopAnimation, {
|
|
64
|
+
from: {
|
|
65
|
+
opacity: 0,
|
|
66
|
+
transform: 'translateY(6px) scale(0.98)'
|
|
67
|
+
},
|
|
68
|
+
to: {
|
|
69
|
+
opacity: 1,
|
|
70
|
+
transform: 'translateY(0) scale(1)'
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const menuSlideFadeBottomAnimation = 'popover-slide-fade-bottom';
|
|
75
|
+
globalKeyframes(menuSlideFadeBottomAnimation, {
|
|
76
|
+
from: {
|
|
77
|
+
opacity: 0,
|
|
78
|
+
transform: 'translateY(-6px) scale(0.98)'
|
|
79
|
+
},
|
|
80
|
+
to: {
|
|
81
|
+
opacity: 1,
|
|
82
|
+
transform: 'translateY(0) scale(1)'
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const menuSlideFadeLeftAnimation = 'popover-slide-fade-left';
|
|
87
|
+
globalKeyframes(menuSlideFadeLeftAnimation, {
|
|
88
|
+
from: {
|
|
89
|
+
opacity: 0,
|
|
90
|
+
transform: 'translateX(6px) scale(0.98)'
|
|
91
|
+
},
|
|
92
|
+
to: {
|
|
93
|
+
opacity: 1,
|
|
94
|
+
transform: 'translateX(0) scale(1)'
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const menuSlideFadeRightAnimation = 'popover-slide-fade-right';
|
|
99
|
+
globalKeyframes(menuSlideFadeRightAnimation, {
|
|
100
|
+
from: {
|
|
101
|
+
opacity: 0,
|
|
102
|
+
transform: 'translateX(-6px) scale(0.98)'
|
|
103
|
+
},
|
|
104
|
+
to: {
|
|
105
|
+
opacity: 1,
|
|
106
|
+
transform: 'translateX(0) scale(1)'
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export const content = style({
|
|
111
|
+
backgroundColor: '#ffffff',
|
|
112
|
+
borderRadius: '5px',
|
|
113
|
+
padding: '5px',
|
|
114
|
+
zIndex: 4000,
|
|
115
|
+
boxSizing: 'border-box',
|
|
116
|
+
position: 'relative',
|
|
117
|
+
minWidth: '130px',
|
|
118
|
+
maxWidth: '350px',
|
|
119
|
+
border: `1px solid ${themeVars.color.gray[300]}`,
|
|
120
|
+
boxShadow: themeVars.shadow.md,
|
|
121
|
+
transformOrigin: 'var(--reka-popover-content-transform-origin)',
|
|
122
|
+
willChange: 'transform, opacity',
|
|
123
|
+
outline: 'none',
|
|
124
|
+
selectors: {
|
|
125
|
+
'&[data-state="open"]': {
|
|
126
|
+
animationDuration: '0.16s',
|
|
127
|
+
animationTimingFunction: 'cubic-bezier(0.16, 1, 0.3, 1)',
|
|
128
|
+
animationFillMode: 'both'
|
|
129
|
+
},
|
|
130
|
+
'&[data-state="closed"]': {
|
|
131
|
+
animationDuration: '0.12s',
|
|
132
|
+
animationTimingFunction: 'ease-out',
|
|
133
|
+
animationFillMode: 'both'
|
|
134
|
+
},
|
|
135
|
+
'&[data-state="closed"][data-side="top"]': {
|
|
136
|
+
animationName: menuSlideFadeOutTopAnimation
|
|
137
|
+
},
|
|
138
|
+
'&[data-state="closed"][data-side="bottom"]': {
|
|
139
|
+
animationName: menuSlideFadeOutBottomAnimation
|
|
140
|
+
},
|
|
141
|
+
'&[data-state="closed"][data-side="left"]': {
|
|
142
|
+
animationName: menuSlideFadeOutLeftAnimation
|
|
143
|
+
},
|
|
144
|
+
'&[data-state="closed"][data-side="right"]': {
|
|
145
|
+
animationName: menuSlideFadeOutRightAnimation
|
|
146
|
+
},
|
|
147
|
+
'&[data-state="open"][data-side="top"]': {
|
|
148
|
+
animationName: menuSlideFadeTopAnimation
|
|
149
|
+
},
|
|
150
|
+
'&[data-state="open"][data-side="bottom"]': {
|
|
151
|
+
animationName: menuSlideFadeBottomAnimation
|
|
152
|
+
},
|
|
153
|
+
'&[data-state="open"][data-side="left"]': {
|
|
154
|
+
animationName: menuSlideFadeLeftAnimation
|
|
155
|
+
},
|
|
156
|
+
'&[data-state="open"][data-side="right"]': {
|
|
157
|
+
animationName: menuSlideFadeRightAnimation
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
export const arrow = style({
|
|
163
|
+
fill: '#ffffff'
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
globalStyle(`${arrow} path`, {
|
|
167
|
+
fill: '#ffffff',
|
|
168
|
+
stroke: themeVars.color.gray[300],
|
|
169
|
+
strokeWidth: '1px'
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
export const dark = style({
|
|
173
|
+
backgroundColor: themeVars.color.gray[900],
|
|
174
|
+
border: `1px solid ${themeVars.color.gray[800]}`,
|
|
175
|
+
color: themeVars.color.gray[100]
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
globalStyle(`${dark} ${arrow}`, {
|
|
179
|
+
fill: themeVars.color.gray[900]
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
globalStyle(`${dark} ${arrow} path`, {
|
|
183
|
+
fill: themeVars.color.gray[900],
|
|
184
|
+
stroke: themeVars.color.gray[800]
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
export const close = style({
|
|
188
|
+
position: 'absolute',
|
|
189
|
+
top: themeVars.space[2],
|
|
190
|
+
right: themeVars.space[2],
|
|
191
|
+
display: 'flex',
|
|
192
|
+
alignItems: 'center',
|
|
193
|
+
justifyContent: 'center',
|
|
194
|
+
width: '20px',
|
|
195
|
+
height: '20px',
|
|
196
|
+
borderRadius: themeVars.rounded.default,
|
|
197
|
+
cursor: 'pointer',
|
|
198
|
+
color: themeVars.color.font.muted,
|
|
199
|
+
':hover': {
|
|
200
|
+
backgroundColor: themeVars.color.gray[100],
|
|
201
|
+
color: themeVars.color.font.text
|
|
202
|
+
}
|
|
203
|
+
});
|