@teammodlr/ui-kit 3.0.0-beta.26 → 3.0.0-beta.30

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.
@@ -0,0 +1,175 @@
1
+ import { globalKeyframes, globalStyle, style } from '@vanilla-extract/css';
2
+ import { themeVars } from '../../../styles/theme.css';
3
+
4
+ const slideFadeOutTopAnimation = 'hover-card-slide-fade-out-top';
5
+ globalKeyframes(slideFadeOutTopAnimation, {
6
+ from: {
7
+ opacity: 1,
8
+ transform: 'translateY(0) scale(1)'
9
+ },
10
+ to: {
11
+ opacity: 0,
12
+ transform: 'translateY(6px) scale(0.98)'
13
+ }
14
+ });
15
+
16
+ const slideFadeOutBottomAnimation = 'hover-card-slide-fade-out-bottom';
17
+ globalKeyframes(slideFadeOutBottomAnimation, {
18
+ from: {
19
+ opacity: 1,
20
+ transform: 'translateY(0) scale(1)'
21
+ },
22
+ to: {
23
+ opacity: 0,
24
+ transform: 'translateY(-6px) scale(0.98)'
25
+ }
26
+ });
27
+
28
+ const slideFadeOutLeftAnimation = 'hover-card-slide-fade-out-left';
29
+ globalKeyframes(slideFadeOutLeftAnimation, {
30
+ from: {
31
+ opacity: 1,
32
+ transform: 'translateX(0) scale(1)'
33
+ },
34
+ to: {
35
+ opacity: 0,
36
+ transform: 'translateX(6px) scale(0.98)'
37
+ }
38
+ });
39
+
40
+ const slideFadeOutRightAnimation = 'hover-card-slide-fade-out-right';
41
+ globalKeyframes(slideFadeOutRightAnimation, {
42
+ from: {
43
+ opacity: 1,
44
+ transform: 'translateX(0) scale(1)'
45
+ },
46
+ to: {
47
+ opacity: 0,
48
+ transform: 'translateX(-6px) scale(0.98)'
49
+ }
50
+ });
51
+
52
+ const slideFadeTopAnimation = 'hover-card-slide-fade-top';
53
+ globalKeyframes(slideFadeTopAnimation, {
54
+ from: {
55
+ opacity: 0,
56
+ transform: 'translateY(6px) scale(0.98)'
57
+ },
58
+ to: {
59
+ opacity: 1,
60
+ transform: 'translateY(0) scale(1)'
61
+ }
62
+ });
63
+
64
+ const slideFadeBottomAnimation = 'hover-card-slide-fade-bottom';
65
+ globalKeyframes(slideFadeBottomAnimation, {
66
+ from: {
67
+ opacity: 0,
68
+ transform: 'translateY(-6px) scale(0.98)'
69
+ },
70
+ to: {
71
+ opacity: 1,
72
+ transform: 'translateY(0) scale(1)'
73
+ }
74
+ });
75
+
76
+ const slideFadeLeftAnimation = 'hover-card-slide-fade-left';
77
+ globalKeyframes(slideFadeLeftAnimation, {
78
+ from: {
79
+ opacity: 0,
80
+ transform: 'translateX(6px) scale(0.98)'
81
+ },
82
+ to: {
83
+ opacity: 1,
84
+ transform: 'translateX(0) scale(1)'
85
+ }
86
+ });
87
+
88
+ const slideFadeRightAnimation = 'hover-card-slide-fade-right';
89
+ globalKeyframes(slideFadeRightAnimation, {
90
+ from: {
91
+ opacity: 0,
92
+ transform: 'translateX(-6px) scale(0.98)'
93
+ },
94
+ to: {
95
+ opacity: 1,
96
+ transform: 'translateX(0) scale(1)'
97
+ }
98
+ });
99
+
100
+ export const content = style({
101
+ backgroundColor: '#ffffff',
102
+ borderRadius: '5px',
103
+ padding: '5px',
104
+ zIndex: 4000,
105
+ boxSizing: 'border-box',
106
+ position: 'relative',
107
+ minWidth: '130px',
108
+ maxWidth: '350px',
109
+ border: `1px solid ${themeVars.color.gray[300]}`,
110
+ boxShadow: themeVars.shadow.md,
111
+ transformOrigin: 'var(--reka-hover-card-content-transform-origin)',
112
+ willChange: 'transform, opacity',
113
+ outline: 'none',
114
+ selectors: {
115
+ '&[data-state="open"]': {
116
+ animationDuration: '0.16s',
117
+ animationTimingFunction: 'cubic-bezier(0.16, 1, 0.3, 1)',
118
+ animationFillMode: 'both'
119
+ },
120
+ '&[data-state="closed"]': {
121
+ animationDuration: '0.12s',
122
+ animationTimingFunction: 'ease-out',
123
+ animationFillMode: 'both'
124
+ },
125
+ '&[data-state="closed"][data-side="top"]': {
126
+ animationName: slideFadeOutTopAnimation
127
+ },
128
+ '&[data-state="closed"][data-side="bottom"]': {
129
+ animationName: slideFadeOutBottomAnimation
130
+ },
131
+ '&[data-state="closed"][data-side="left"]': {
132
+ animationName: slideFadeOutLeftAnimation
133
+ },
134
+ '&[data-state="closed"][data-side="right"]': {
135
+ animationName: slideFadeOutRightAnimation
136
+ },
137
+ '&[data-state="open"][data-side="top"]': {
138
+ animationName: slideFadeTopAnimation
139
+ },
140
+ '&[data-state="open"][data-side="bottom"]': {
141
+ animationName: slideFadeBottomAnimation
142
+ },
143
+ '&[data-state="open"][data-side="left"]': {
144
+ animationName: slideFadeLeftAnimation
145
+ },
146
+ '&[data-state="open"][data-side="right"]': {
147
+ animationName: slideFadeRightAnimation
148
+ }
149
+ }
150
+ });
151
+
152
+ export const arrow = style({
153
+ fill: '#ffffff'
154
+ });
155
+
156
+ globalStyle(`${arrow} path`, {
157
+ fill: '#ffffff',
158
+ stroke: themeVars.color.gray[300],
159
+ strokeWidth: '1px'
160
+ });
161
+
162
+ export const dark = style({
163
+ backgroundColor: themeVars.color.gray[900],
164
+ border: `1px solid ${themeVars.color.gray[800]}`,
165
+ color: themeVars.color.gray[100]
166
+ });
167
+
168
+ globalStyle(`${dark} ${arrow}`, {
169
+ fill: themeVars.color.gray[900]
170
+ });
171
+
172
+ globalStyle(`${dark} ${arrow} path`, {
173
+ fill: themeVars.color.gray[900],
174
+ stroke: themeVars.color.gray[800]
175
+ });
@@ -0,0 +1 @@
1
+ export * from './HoverCard.css';
@@ -58,3 +58,4 @@ export { default as MDialogProvider } from './dialogprovider/DialogProvider.vue'
58
58
  export { default as MDrawer } from './drawer/Drawer.vue';
59
59
  export { default as MTree } from './tree/Tree.vue';
60
60
  export { default as MPopover } from './popover/Popover.vue';
61
+ export { default as MHoverCard } from './hovercard/HoverCard.vue';
@@ -16,7 +16,7 @@
16
16
  <div :class="selectComputedClasses">
17
17
  <template v-if="multiple && Array.isArray(selected) && selected.length > 0">
18
18
  <MTag v-for="value in selectedMax" :key="value" :closeable="true"
19
- @close="event => removeSelected(event, value)" :size="size">
19
+ @close="() => removeSelected(value)" :size="size">
20
20
  {{ getSelectedLabel(value) }}
21
21
  </MTag>
22
22
  <template v-if="selectedCountNotShown > 0">
@@ -138,7 +138,9 @@ let shouldOpenNextFocusedSelect = false;
138
138
  export default defineComponent({
139
139
  name: 'MSelect',
140
140
  emits: {
141
- ...useInput.emits()
141
+ ...useInput.emits(),
142
+ 'on-open': () => true,
143
+ 'on-close': () => true
142
144
  },
143
145
  props: {
144
146
  ...useInput.props(),
@@ -613,9 +615,7 @@ export default defineComponent({
613
615
  }
614
616
  }
615
617
 
616
- function removeSelected(event: MouseEvent, value: string | number) {
617
- event.preventDefault();
618
- event.stopPropagation();
618
+ function removeSelected(value: string | number) {
619
619
  if (!props.multiple) {
620
620
  return;
621
621
  }
@@ -827,10 +827,12 @@ export default defineComponent({
827
827
  watch(open, (value: boolean) => {
828
828
  nextTick(() => {
829
829
  if (!value) {
830
+ emit('on-close');
830
831
  search.value = '';
831
832
  }
832
833
 
833
834
  if (value) {
835
+ emit('on-open');
834
836
  zIndex.value = nextZIndex();
835
837
  }
836
838