yuyeon 0.0.23 → 0.0.25
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/style.css +1 -1
- package/dist/yuyeon.js +649 -609
- package/dist/yuyeon.umd.cjs +3 -3
- package/lib/components/alert/YAlert.mjs +32 -0
- package/lib/components/alert/YAlert.mjs.map +1 -0
- package/lib/components/alert/index.mjs +2 -0
- package/lib/components/alert/index.mjs.map +1 -0
- package/lib/components/button/YButton.mjs +2 -2
- package/lib/components/button/YButton.mjs.map +1 -1
- package/lib/components/card/YCard.scss +36 -36
- package/lib/components/checkbox/YInputCheckbox.scss +86 -86
- package/lib/components/dropdown/YDropdown.mjs +1 -1
- package/lib/components/dropdown/YDropdown.mjs.map +1 -1
- package/lib/components/field-input/YFieldInput.mjs +2 -1
- package/lib/components/field-input/YFieldInput.mjs.map +1 -1
- package/lib/components/field-input/YFieldInput.scss +73 -63
- package/lib/components/input/YInput.mjs +15 -7
- package/lib/components/input/YInput.mjs.map +1 -1
- package/lib/components/input/YInput.scss +256 -245
- package/lib/components/layer/YLayer.mjs +1 -1
- package/lib/components/layer/YLayer.mjs.map +1 -1
- package/lib/components/layer/YLayer.scss +33 -33
- package/lib/components/menu/YMenu.scss +22 -22
- package/lib/components/progress-bar/YProgressBar.mjs.map +1 -1
- package/lib/components/select/YSelect.mjs +1 -1
- package/lib/components/select/YSelect.mjs.map +1 -1
- package/lib/components/switch/YSwitch.scss +198 -198
- package/lib/components/table/YTable.scss +114 -114
- package/lib/components/tree-view/YTreeView.mjs.map +1 -1
- package/lib/composables/layer-group.mjs +6 -1
- package/lib/composables/layer-group.mjs.map +1 -1
- package/lib/composables/theme/factory.mjs.map +1 -1
- package/lib/composables/timing.mjs +3 -3
- package/lib/composables/timing.mjs.map +1 -1
- package/lib/styles/base.scss +119 -115
- package/package.json +1 -1
- package/types/components/field-input/YFieldInput.d.ts +27 -0
- package/types/components/input/YInput.d.ts +30 -3
- package/types/components/select/YSelect.d.ts +27 -0
- package/types/composables/timing.d.ts +1 -1
|
@@ -1,245 +1,256 @@
|
|
|
1
|
-
|
|
2
|
-
@use '../../styles/palette';
|
|
3
|
-
@use '../../styles/variables';
|
|
4
|
-
|
|
5
|
-
$input-border-radius: variables.$border-radius-root !default;
|
|
6
|
-
|
|
7
|
-
.y-input {
|
|
8
|
-
font-size: 14px;
|
|
9
|
-
flex: 1 1 auto;
|
|
10
|
-
display: flex;
|
|
11
|
-
align-items: flex-start;
|
|
12
|
-
letter-spacing: normal;
|
|
13
|
-
text-align: left;
|
|
14
|
-
|
|
15
|
-
--y-input-focused-color: var(--y-theme-primary);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
&
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
flex
|
|
28
|
-
|
|
29
|
-
width:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
font-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
color:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
&
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
border-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
border-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
&--
|
|
236
|
-
&.y-input--outlined {
|
|
237
|
-
.y-input__plate {
|
|
238
|
-
border-color: var(--y-palette-
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
.y-input__helper-text {
|
|
242
|
-
color: var(--y-palette-
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
1
|
+
|
|
2
|
+
@use '../../styles/palette';
|
|
3
|
+
@use '../../styles/variables';
|
|
4
|
+
|
|
5
|
+
$input-border-radius: variables.$border-radius-root !default;
|
|
6
|
+
|
|
7
|
+
.y-input {
|
|
8
|
+
font-size: 14px;
|
|
9
|
+
flex: 1 1 auto;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
letter-spacing: normal;
|
|
13
|
+
text-align: left;
|
|
14
|
+
|
|
15
|
+
--y-input-focused-color: var(--y-theme-primary);
|
|
16
|
+
--y-input-label-color: var(--y-theme-on-surface-variant);
|
|
17
|
+
|
|
18
|
+
&__prepend,
|
|
19
|
+
&__append {
|
|
20
|
+
height: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__stack {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
height: 100%; // auto
|
|
27
|
+
flex: 1;
|
|
28
|
+
flex-wrap: wrap;
|
|
29
|
+
min-width: 0;
|
|
30
|
+
width: 100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&__display {
|
|
34
|
+
display: flex;
|
|
35
|
+
position: relative;
|
|
36
|
+
cursor: text;
|
|
37
|
+
flex: 1 1 auto;
|
|
38
|
+
border-radius: $input-border-radius;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&__plate {
|
|
42
|
+
position: absolute;
|
|
43
|
+
inset: 0;
|
|
44
|
+
border-bottom: 1px solid transparent;
|
|
45
|
+
contain: paint;
|
|
46
|
+
border-radius: $input-border-radius;
|
|
47
|
+
outline: 0 solid rgba(0, 0, 0, 0);
|
|
48
|
+
transition: 140ms ease;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&__value {
|
|
52
|
+
position: relative;
|
|
53
|
+
flex: 1 0 auto;
|
|
54
|
+
padding: 0.5rem 0.875rem;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
line-height: 1em;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&__helper-text {
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
font-weight: 320;
|
|
63
|
+
color: #444;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@keyframes label-float {
|
|
67
|
+
0% {
|
|
68
|
+
opacity: 0;
|
|
69
|
+
}
|
|
70
|
+
100% {
|
|
71
|
+
opacity: 1;
|
|
72
|
+
transform: translateY(-26px) scale(0.94);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@keyframes label-sink {
|
|
77
|
+
0% {
|
|
78
|
+
opacity: 1;
|
|
79
|
+
transform: translateY(-26px) scale(0.74);
|
|
80
|
+
}
|
|
81
|
+
30% {
|
|
82
|
+
opacity: 0;
|
|
83
|
+
}
|
|
84
|
+
80% {
|
|
85
|
+
opacity: 0;
|
|
86
|
+
transform: translateY(-8px) scale(1);
|
|
87
|
+
}
|
|
88
|
+
100% {
|
|
89
|
+
opacity: 1;
|
|
90
|
+
transform: translateY(0) scale(1);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&__label {
|
|
95
|
+
color: var(--y-input-label-color);
|
|
96
|
+
padding-bottom: 4px;
|
|
97
|
+
font-weight: 500;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&__floating-label {
|
|
101
|
+
position: absolute;
|
|
102
|
+
max-width: 90%;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
text-overflow: ellipsis;
|
|
105
|
+
white-space: nowrap;
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
padding-bottom: unset;
|
|
108
|
+
left: 0;
|
|
109
|
+
top: 6px;
|
|
110
|
+
transform-origin: left center;
|
|
111
|
+
|
|
112
|
+
&--floated {
|
|
113
|
+
animation: label-float 200ms ease-in-out forwards;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:not(&--floated) {
|
|
117
|
+
animation: label-sink 200ms linear;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&__leading {
|
|
122
|
+
position: relative;
|
|
123
|
+
display: inline-flex;
|
|
124
|
+
margin-top: 10px;
|
|
125
|
+
padding-right: 4px;
|
|
126
|
+
align-self: flex-start;
|
|
127
|
+
|
|
128
|
+
> * {
|
|
129
|
+
width: 24px;
|
|
130
|
+
height: 24px;
|
|
131
|
+
user-select: none;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&__required-mark {
|
|
136
|
+
color: var(--y-theme-error);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&__trailing {
|
|
140
|
+
position: relative;
|
|
141
|
+
display: inline-flex;
|
|
142
|
+
justify-content: center;
|
|
143
|
+
align-items: center;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&--labeled {
|
|
147
|
+
padding-top: 12px;
|
|
148
|
+
margin-top: 4px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&--filled {
|
|
152
|
+
--y-input-default-filled: 242, 242, 242;
|
|
153
|
+
--y-input-filled-opacity: 0.04;
|
|
154
|
+
--y-input-filled-opacity-hover: 0.08;
|
|
155
|
+
|
|
156
|
+
.y-input {
|
|
157
|
+
&__prepend {
|
|
158
|
+
padding-left: 12px;
|
|
159
|
+
}
|
|
160
|
+
//
|
|
161
|
+
&__plate {
|
|
162
|
+
background: rgba(var(--y-theme-on-surface-rgb, var(--y-input-default-filled)), var(--y-input-filled-opacity));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&__display:hover {
|
|
166
|
+
--y-input-filled-opacity: var(--y-input-filled-opacity-hover);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&--outlined {
|
|
172
|
+
--y-input-outlined-opacity: 0.64;
|
|
173
|
+
--y-input-outlined-opacity-hover: 0.87;
|
|
174
|
+
|
|
175
|
+
.y-input {
|
|
176
|
+
&__plate {
|
|
177
|
+
border: 1px solid rgba(var(--y-theme-outline-rgb), var(--y-input-outlined-opacity));
|
|
178
|
+
box-sizing: border-box;
|
|
179
|
+
inset: 0;
|
|
180
|
+
|
|
181
|
+
&:before {
|
|
182
|
+
top: 0;
|
|
183
|
+
height: 100%;
|
|
184
|
+
background: transparent;
|
|
185
|
+
border-radius: inherit;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
&__display:hover {
|
|
190
|
+
--y-input-outlined-opacity: var(--y-input-outlined-opacity-hover);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&--ceramic {
|
|
196
|
+
.y-input__plate {
|
|
197
|
+
border: 1px solid #e4e4e4;
|
|
198
|
+
box-sizing: border-box;
|
|
199
|
+
inset: 0;
|
|
200
|
+
border-top-color: transparent;
|
|
201
|
+
border-left-width: 0;
|
|
202
|
+
border-right-width: 0;
|
|
203
|
+
box-shadow: 1px 2px 8px -1px rgb(0 0 0 / 12%), -1px -1px 2px 1px rgba(0, 0, 0, 0.04),
|
|
204
|
+
inset 1px 1px 8px -4px rgb(0 0 0 / 11%);
|
|
205
|
+
outline: 0 solid rgba(0, 0, 0, 0);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.y-input__plate:before {
|
|
209
|
+
inset: -1px;
|
|
210
|
+
height: 100%;
|
|
211
|
+
background: transparent;
|
|
212
|
+
border-radius: inherit;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
&--focused {
|
|
217
|
+
.y-input__value {
|
|
218
|
+
outline: none;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.y-input__plate {
|
|
222
|
+
outline: 1px solid rgba(var(--y-theme-primary, #4f97dc), 0.1);
|
|
223
|
+
border-color: var(--y-input-focused-color);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.y-input__leading {
|
|
227
|
+
color: currentColor;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&.y-input--outlined {
|
|
231
|
+
//
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
&--error {
|
|
236
|
+
&.y-input--outlined {
|
|
237
|
+
.y-input__plate {
|
|
238
|
+
border-color: var(--y-palette-negative) !important;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
.y-input__helper-text {
|
|
242
|
+
color: var(--y-palette-negative);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
&--success {
|
|
247
|
+
&.y-input--outlined {
|
|
248
|
+
.y-input__plate {
|
|
249
|
+
border-color: var(--y-palette-positive) !important;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
.y-input__helper-text {
|
|
253
|
+
color: var(--y-palette-positive);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
@@ -109,7 +109,7 @@ export const YLayer = defineComponent({
|
|
|
109
109
|
const {
|
|
110
110
|
lazyValue,
|
|
111
111
|
onAfterUpdate
|
|
112
|
-
} = useLazy(
|
|
112
|
+
} = useLazy(toRef(props, 'eager'), active);
|
|
113
113
|
const rendered = computed(() => !disabled.value && (lazyValue.value || active.value));
|
|
114
114
|
const {
|
|
115
115
|
coordinate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YLayer.mjs","names":["Teleport","Transition","computed","defineComponent","mergeProps","reactive","ref","shallowRef","toRef","watchEffect","useRender","pressCoordinateProps","useCoordinate","pressDimensionPropsOptions","useDimension","useLayerGroup","pressThemePropsOptions","useLocalTheme","useLazy","PolyTransition","polyTransitionPropOptions","usePolyTransition","ComplementClick","bindClasses","propsFactory","pressYLayerProps","modelValue","type","Boolean","scrim","eager","classes","Array","String","Object","contentClasses","closeClickScrim","modal","contentStyles","default","disabled","openOnHover","openDelay","Number","closeDelay","YLayer","name","inheritAttrs","components","directives","props","emits","value","mouseEvent","afterLeave","setup","_ref","emit","expose","attrs","slots","base$","scrim$","content$","baseSlot","baseEl","themeClasses","layerGroup","polyTransitionBindProps","dimensionStyles","active","get","set","v","finish","lazyValue","onAfterUpdate","rendered","coordinate","coordinateStyles","updateCoordinate","contentEl","onClickComplementLayer","target","closeConditional","hovered","complementClickOption","handler","determine","include","onAfterEnter","onAfterLeave","onClickScrim","baseFromSlotEl","el","base","$el","computedStyle","zIndex","computedClass","boundClasses","computedContentClasses","onMouseenter","event","onMouseleave","slotBase","class","_createVNode","_Fragment","_mergeProps","_withDirectives","_vShow","_resolveDirective"],"sources":["../../../src/components/layer/YLayer.tsx"],"sourcesContent":["import type { CSSProperties, PropType } from 'vue';\r\nimport {\r\n Teleport,\r\n Transition,\r\n computed,\r\n defineComponent,\r\n mergeProps,\r\n reactive,\r\n ref,\r\n shallowRef,\r\n toRef,\r\n watchEffect,\r\n} from 'vue';\r\n\r\nimport { useRender } from '../../composables/component';\r\nimport {\r\n pressCoordinateProps,\r\n useCoordinate,\r\n} from '../../composables/coordinate';\r\nimport {\r\n pressDimensionPropsOptions,\r\n useDimension,\r\n} from '../../composables/dimension';\r\nimport { useLayerGroup } from '../../composables/layer-group';\r\nimport { pressThemePropsOptions, useLocalTheme } from '../../composables/theme';\r\nimport { useLazy } from '../../composables/timing';\r\nimport {\r\n PolyTransition,\r\n polyTransitionPropOptions,\r\n usePolyTransition,\r\n} from '../../composables/transition';\r\nimport {\r\n ComplementClick,\r\n ComplementClickBindingOptions,\r\n} from '../../directives/complement-click';\r\nimport { bindClasses, propsFactory } from '../../util/vue-component';\r\n\r\nimport './YLayer.scss';\r\n\r\nexport const pressYLayerProps = propsFactory(\r\n {\r\n modelValue: {\r\n type: Boolean as PropType<boolean>,\r\n },\r\n scrim: {\r\n type: Boolean as PropType<boolean>,\r\n },\r\n eager: {\r\n type: Boolean as PropType<boolean>,\r\n },\r\n classes: {\r\n type: [Array, String, Object] as PropType<\r\n string[] | string | Record<string, any>\r\n >,\r\n },\r\n contentClasses: {\r\n type: [Array, String, Object] as PropType<\r\n string[] | string | Record<string, any>\r\n >,\r\n },\r\n closeClickScrim: {\r\n type: Boolean as PropType<boolean>,\r\n },\r\n modal: Boolean as PropType<boolean>,\r\n contentStyles: {\r\n type: Object as PropType<CSSProperties>,\r\n default: () => {},\r\n },\r\n disabled: {\r\n type: Boolean as PropType<boolean>,\r\n default: false,\r\n },\r\n openOnHover: {\r\n type: Boolean as PropType<boolean>,\r\n default: false,\r\n },\r\n openDelay: {\r\n type: Number as PropType<number>,\r\n default: 200,\r\n },\r\n closeDelay: {\r\n type: Number as PropType<number>,\r\n default: 200,\r\n },\r\n ...pressThemePropsOptions(),\r\n ...polyTransitionPropOptions,\r\n ...pressCoordinateProps(),\r\n ...pressDimensionPropsOptions(),\r\n },\r\n 'YLayer',\r\n);\r\n\r\nexport const YLayer = defineComponent({\r\n name: 'YLayer',\r\n inheritAttrs: false,\r\n components: {\r\n PolyTransition,\r\n },\r\n directives: {\r\n ComplementClick,\r\n },\r\n props: {\r\n ...pressYLayerProps(),\r\n },\r\n emits: {\r\n 'update:modelValue': (value: boolean) => true,\r\n 'click:complement': (mouseEvent: MouseEvent) => true,\r\n afterLeave: () => true,\r\n },\r\n setup(props, { emit, expose, attrs, slots }) {\r\n const base$ = ref();\r\n const scrim$ = ref<HTMLElement>();\r\n const content$ = ref<HTMLElement>();\r\n const baseSlot = ref();\r\n const baseEl = ref<HTMLElement>();\r\n\r\n const { themeClasses } = useLocalTheme(props);\r\n const { layerGroup } = useLayerGroup();\r\n const { polyTransitionBindProps } = usePolyTransition(props);\r\n const { dimensionStyles } = useDimension(props);\r\n const active = computed<boolean>({\r\n get: (): boolean => {\r\n return !!props.modelValue;\r\n },\r\n set: (v: boolean) => {\r\n emit('update:modelValue', v);\r\n },\r\n });\r\n const finish = shallowRef(false);\r\n\r\n const disabled = toRef(props, 'disabled');\r\n const { lazyValue, onAfterUpdate } = useLazy(\r\n !!toRef(props, 'eager'),\r\n active,\r\n );\r\n const rendered = computed<boolean>(\r\n () => !disabled.value && (lazyValue.value || active.value),\r\n );\r\n\r\n const { coordinate, coordinateStyles, updateCoordinate } = useCoordinate(\r\n props,\r\n { contentEl: content$, baseEl, active },\r\n );\r\n\r\n function onClickComplementLayer(mouseEvent: MouseEvent) {\r\n emit('click:complement', mouseEvent);\r\n if (!props.modal) {\r\n if (\r\n scrim$.value !== null &&\r\n scrim$.value === mouseEvent.target &&\r\n props.closeClickScrim\r\n ) {\r\n active.value = false;\r\n }\r\n } else {\r\n // TODO: shrug ani\r\n }\r\n }\r\n\r\n function closeConditional(): boolean {\r\n return (\r\n (!props.openOnHover || (props.openOnHover && !hovered.value)) &&\r\n active.value\r\n ); // TODO: && groupTopLevel.value;\r\n }\r\n\r\n const complementClickOption = reactive<ComplementClickBindingOptions>({\r\n handler: onClickComplementLayer,\r\n determine: closeConditional,\r\n include: () => [baseEl.value],\r\n });\r\n\r\n function onAfterEnter() {\r\n finish.value = true;\r\n }\r\n\r\n function onAfterLeave() {\r\n onAfterUpdate();\r\n finish.value = false;\r\n emit('afterLeave');\r\n }\r\n\r\n function onClickScrim() {\r\n if (props.closeClickScrim) {\r\n active.value = false;\r\n }\r\n }\r\n\r\n const baseFromSlotEl = computed(() => {\r\n return baseSlot.value?.[0]?.el;\r\n });\r\n\r\n watchEffect(() => {\r\n if (!base$.value) {\r\n baseEl.value = baseFromSlotEl.value;\r\n return;\r\n }\r\n const base = base$.value;\r\n baseEl.value = base$.value?.$el ? base$.value?.$el : base;\r\n });\r\n\r\n const computedStyle = computed(() => {\r\n return {\r\n zIndex: '2000',\r\n };\r\n });\r\n\r\n const computedClass = computed<Record<string, boolean>>(() => {\r\n const { classes } = props;\r\n const boundClasses = bindClasses(classes);\r\n return {\r\n ...boundClasses,\r\n 'y-layer--active': !!active.value,\r\n };\r\n });\r\n\r\n const computedContentClasses = computed<Record<string, boolean>>(() => {\r\n const boundClasses = bindClasses(props.contentClasses);\r\n return {\r\n ...boundClasses,\r\n };\r\n });\r\n\r\n const hovered = ref(false);\r\n\r\n function onMouseenter(event: Event) {\r\n hovered.value = true;\r\n }\r\n\r\n function onMouseleave(event: Event) {\r\n hovered.value = false;\r\n }\r\n\r\n expose({\r\n scrim$,\r\n base$,\r\n content$,\r\n baseEl,\r\n active,\r\n onAfterUpdate,\r\n updateCoordinate,\r\n hovered,\r\n });\r\n\r\n useRender(() => {\r\n const slotBase = slots.base?.({\r\n active: active.value,\r\n props: mergeProps({\r\n ref: base$,\r\n class: {\r\n 'y-layer-base': true,\r\n 'y-layer-base--active': active.value,\r\n },\r\n }),\r\n });\r\n baseSlot.value = slotBase;\r\n return (\r\n <>\r\n {slotBase}\r\n <Teleport disabled={!layerGroup.value} to={layerGroup.value as any}>\r\n {rendered.value && (\r\n <div\r\n class={{\r\n 'y-layer': true,\r\n 'y-layer--finish': finish.value,\r\n ...computedClass.value,\r\n [themeClasses.value ?? '']: true,\r\n }}\r\n onMouseenter={onMouseenter}\r\n onMouseleave={onMouseleave}\r\n style={computedStyle.value}\r\n {...attrs}\r\n >\r\n <Transition name=\"fade\" appear>\r\n {active.value && props.scrim && (\r\n <div\r\n class=\"y-layer__scrim\"\r\n onClick={onClickScrim}\r\n ref=\"scrim$\"\r\n ></div>\r\n )}\r\n </Transition>\r\n <PolyTransition\r\n onAfterEnter={onAfterEnter}\r\n onAfterLeave={onAfterLeave}\r\n appear\r\n {...polyTransitionBindProps.value}\r\n >\r\n <div\r\n v-show={active.value}\r\n v-complement-click={{ ...complementClickOption }}\r\n class={{\r\n 'y-layer__content': true,\r\n ...computedContentClasses.value,\r\n }}\r\n style={[\r\n {\r\n ...dimensionStyles.value,\r\n ...coordinateStyles.value,\r\n ...props.contentStyles,\r\n },\r\n ]}\r\n ref={content$}\r\n >\r\n {slots.default?.({ active: active.value })}\r\n </div>\r\n </PolyTransition>\r\n </div>\r\n )}\r\n </Teleport>\r\n </>\r\n );\r\n });\r\n\r\n return {\r\n complementClickOption,\r\n layerGroup,\r\n active,\r\n rendered,\r\n lazyValue,\r\n onAfterUpdate: onAfterUpdate as () => void,\r\n scrim$,\r\n content$,\r\n baseEl,\r\n polyTransitionBindProps,\r\n coordinateStyles,\r\n };\r\n },\r\n});\r\n\r\nexport type YLayer = InstanceType<typeof YLayer>;\r\n"],"mappings":";AACA,SACEA,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,eAAe,EACfC,UAAU,EACVC,QAAQ,EACRC,GAAG,EACHC,UAAU,EACVC,KAAK,EACLC,WAAW,QACN,KAAK;AAAC,SAEJC,SAAS;AAAA,SAEhBC,oBAAoB,EACpBC,aAAa;AAAA,SAGbC,0BAA0B,EAC1BC,YAAY;AAAA,SAELC,aAAa;AAAA,SACbC,sBAAsB,EAAEC,aAAa;AAAA,SACr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AEQ,MAAM;UAAA;QAAA;UAAAsC,OAAA,EAAAA,CAAA,MACpB+B,MAAM,CAAClB,KAAK,IAAIF,KAAK,CAACrB,KAAK,IAAA8E,YAAA;YAAA,SAElB,gBAAgB;YAAA,WACbf,YAAY;YAAA,OACjB;UAAQ,QAEf;QAAA,IAAAe,YAAA,CAAAxF,cAAA,EAAA0F,WAAA;UAAA,gBAGanB,YAAY;UAAA,gBACZC,YAAY;UAAA;QAAA,GAEtBvB,uBAAuB,CAAChB,KAAK;UAAAb,OAAA,EAAAA,CAAA,MAAAuE,eAAA,CAAAH,YAAA;YAAA,SAKxB;cACL,kBAAkB,EAAE,IAAI;cACxB,GAAGN,sBAAsB,CAACjD;YAC5B,CAAC;YAAA,SACM,CACL;cACE,GAAGiB,eAAe,CAACjB,KAAK;cACxB,GAAG2B,gBAAgB,CAAC3B,KAAK;cACzB,GAAGF,KAAK,CAACZ;YACX,CAAC,CACF;YAAA,OACIyB;UAAQ,IAEZH,KAAK,CAACrB,OAAO,GAAG;YAAE+B,MAAM,EAAEA,MAAM,CAAClB;UAAM,CAAC,CAAC,MAAA2D,MAAA,EAflCzC,MAAM,CAAClB,KAAK,IAAA4D,iBAAA,sBACA;YAAE,GAAG1B;UAAsB,CAAC;QAAA,IAkBvD;MAAA;IAIT,CAAC,CAAC;IAEF,OAAO;MACLA,qBAAqB;MACrBnB,UAAU;MACVG,MAAM;MACNO,QAAQ;MACRF,SAAS;MACTC,aAAa,EAAEA,aAA2B;MAC1Cd,MAAM;MACNC,QAAQ;MACRE,MAAM;MACNG,uBAAuB;MACvBW;IACF,CAAC;EACH;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"YLayer.mjs","names":["Teleport","Transition","computed","defineComponent","mergeProps","reactive","ref","shallowRef","toRef","watchEffect","useRender","pressCoordinateProps","useCoordinate","pressDimensionPropsOptions","useDimension","useLayerGroup","pressThemePropsOptions","useLocalTheme","useLazy","PolyTransition","polyTransitionPropOptions","usePolyTransition","ComplementClick","bindClasses","propsFactory","pressYLayerProps","modelValue","type","Boolean","scrim","eager","classes","Array","String","Object","contentClasses","closeClickScrim","modal","contentStyles","default","disabled","openOnHover","openDelay","Number","closeDelay","YLayer","name","inheritAttrs","components","directives","props","emits","value","mouseEvent","afterLeave","setup","_ref","emit","expose","attrs","slots","base$","scrim$","content$","baseSlot","baseEl","themeClasses","layerGroup","polyTransitionBindProps","dimensionStyles","active","get","set","v","finish","lazyValue","onAfterUpdate","rendered","coordinate","coordinateStyles","updateCoordinate","contentEl","onClickComplementLayer","target","closeConditional","hovered","complementClickOption","handler","determine","include","onAfterEnter","onAfterLeave","onClickScrim","baseFromSlotEl","el","base","$el","computedStyle","zIndex","computedClass","boundClasses","computedContentClasses","onMouseenter","event","onMouseleave","slotBase","class","_createVNode","_Fragment","_mergeProps","_withDirectives","_vShow","_resolveDirective"],"sources":["../../../src/components/layer/YLayer.tsx"],"sourcesContent":["import type { CSSProperties, PropType } from 'vue';\r\nimport {\r\n Teleport,\r\n Transition,\r\n computed,\r\n defineComponent,\r\n mergeProps,\r\n reactive,\r\n ref,\r\n shallowRef,\r\n toRef,\r\n watchEffect, watch,\r\n} from 'vue';\r\n\r\nimport { useRender } from '../../composables/component';\r\nimport {\r\n pressCoordinateProps,\r\n useCoordinate,\r\n} from '../../composables/coordinate';\r\nimport {\r\n pressDimensionPropsOptions,\r\n useDimension,\r\n} from '../../composables/dimension';\r\nimport { useLayerGroup } from '../../composables/layer-group';\r\nimport { pressThemePropsOptions, useLocalTheme } from '../../composables/theme';\r\nimport { useLazy } from '../../composables/timing';\r\nimport {\r\n PolyTransition,\r\n polyTransitionPropOptions,\r\n usePolyTransition,\r\n} from '../../composables/transition';\r\nimport {\r\n ComplementClick,\r\n ComplementClickBindingOptions,\r\n} from '../../directives/complement-click';\r\nimport { bindClasses, propsFactory } from '../../util/vue-component';\r\n\r\nimport './YLayer.scss';\r\n\r\nexport const pressYLayerProps = propsFactory(\r\n {\r\n modelValue: {\r\n type: Boolean as PropType<boolean>,\r\n },\r\n scrim: {\r\n type: Boolean as PropType<boolean>,\r\n },\r\n eager: {\r\n type: Boolean as PropType<boolean>,\r\n },\r\n classes: {\r\n type: [Array, String, Object] as PropType<\r\n string[] | string | Record<string, any>\r\n >,\r\n },\r\n contentClasses: {\r\n type: [Array, String, Object] as PropType<\r\n string[] | string | Record<string, any>\r\n >,\r\n },\r\n closeClickScrim: {\r\n type: Boolean as PropType<boolean>,\r\n },\r\n modal: Boolean as PropType<boolean>,\r\n contentStyles: {\r\n type: Object as PropType<CSSProperties>,\r\n default: () => {},\r\n },\r\n disabled: {\r\n type: Boolean as PropType<boolean>,\r\n default: false,\r\n },\r\n openOnHover: {\r\n type: Boolean as PropType<boolean>,\r\n default: false,\r\n },\r\n openDelay: {\r\n type: Number as PropType<number>,\r\n default: 200,\r\n },\r\n closeDelay: {\r\n type: Number as PropType<number>,\r\n default: 200,\r\n },\r\n ...pressThemePropsOptions(),\r\n ...polyTransitionPropOptions,\r\n ...pressCoordinateProps(),\r\n ...pressDimensionPropsOptions(),\r\n },\r\n 'YLayer',\r\n);\r\n\r\nexport const YLayer = defineComponent({\r\n name: 'YLayer',\r\n inheritAttrs: false,\r\n components: {\r\n PolyTransition,\r\n },\r\n directives: {\r\n ComplementClick,\r\n },\r\n props: {\r\n ...pressYLayerProps(),\r\n },\r\n emits: {\r\n 'update:modelValue': (value: boolean) => true,\r\n 'click:complement': (mouseEvent: MouseEvent) => true,\r\n afterLeave: () => true,\r\n },\r\n setup(props, { emit, expose, attrs, slots }) {\r\n const base$ = ref();\r\n const scrim$ = ref<HTMLElement>();\r\n const content$ = ref<HTMLElement>();\r\n const baseSlot = ref();\r\n const baseEl = ref<HTMLElement>();\r\n\r\n const { themeClasses } = useLocalTheme(props);\r\n const { layerGroup } = useLayerGroup();\r\n const { polyTransitionBindProps } = usePolyTransition(props);\r\n const { dimensionStyles } = useDimension(props);\r\n const active = computed<boolean>({\r\n get: (): boolean => {\r\n return !!props.modelValue;\r\n },\r\n set: (v: boolean) => {\r\n emit('update:modelValue', v);\r\n },\r\n });\r\n const finish = shallowRef(false);\r\n\r\n const disabled = toRef(props, 'disabled');\r\n const { lazyValue, onAfterUpdate } = useLazy(\r\n toRef(props, 'eager'),\r\n active,\r\n );\r\n const rendered = computed<boolean>(\r\n () => !disabled.value && (lazyValue.value || active.value),\r\n );\r\n\r\n const { coordinate, coordinateStyles, updateCoordinate } = useCoordinate(\r\n props,\r\n { contentEl: content$, baseEl, active },\r\n );\r\n\r\n function onClickComplementLayer(mouseEvent: MouseEvent) {\r\n emit('click:complement', mouseEvent);\r\n if (!props.modal) {\r\n if (\r\n scrim$.value !== null &&\r\n scrim$.value === mouseEvent.target &&\r\n props.closeClickScrim\r\n ) {\r\n active.value = false;\r\n }\r\n } else {\r\n // TODO: shrug ani\r\n }\r\n }\r\n\r\n function closeConditional(): boolean {\r\n return (\r\n (!props.openOnHover || (props.openOnHover && !hovered.value)) &&\r\n active.value\r\n ); // TODO: && groupTopLevel.value;\r\n }\r\n\r\n const complementClickOption = reactive<ComplementClickBindingOptions>({\r\n handler: onClickComplementLayer,\r\n determine: closeConditional,\r\n include: () => [baseEl.value],\r\n });\r\n\r\n function onAfterEnter() {\r\n finish.value = true;\r\n }\r\n\r\n function onAfterLeave() {\r\n onAfterUpdate();\r\n finish.value = false;\r\n emit('afterLeave');\r\n }\r\n\r\n function onClickScrim() {\r\n if (props.closeClickScrim) {\r\n active.value = false;\r\n }\r\n }\r\n\r\n const baseFromSlotEl = computed(() => {\r\n return baseSlot.value?.[0]?.el;\r\n });\r\n\r\n watchEffect(() => {\r\n if (!base$.value) {\r\n baseEl.value = baseFromSlotEl.value;\r\n return;\r\n }\r\n const base = base$.value;\r\n baseEl.value = base$.value?.$el ? base$.value?.$el : base;\r\n });\r\n\r\n const computedStyle = computed(() => {\r\n return {\r\n zIndex: '2000',\r\n };\r\n });\r\n\r\n const computedClass = computed<Record<string, boolean>>(() => {\r\n const { classes } = props;\r\n const boundClasses = bindClasses(classes);\r\n return {\r\n ...boundClasses,\r\n 'y-layer--active': !!active.value,\r\n };\r\n });\r\n\r\n const computedContentClasses = computed<Record<string, boolean>>(() => {\r\n const boundClasses = bindClasses(props.contentClasses);\r\n return {\r\n ...boundClasses,\r\n };\r\n });\r\n\r\n const hovered = ref(false);\r\n\r\n function onMouseenter(event: Event) {\r\n hovered.value = true;\r\n }\r\n\r\n function onMouseleave(event: Event) {\r\n hovered.value = false;\r\n }\r\n\r\n expose({\r\n scrim$,\r\n base$,\r\n content$,\r\n baseEl,\r\n active,\r\n onAfterUpdate,\r\n updateCoordinate,\r\n hovered,\r\n });\r\n\r\n useRender(() => {\r\n const slotBase = slots.base?.({\r\n active: active.value,\r\n props: mergeProps({\r\n ref: base$,\r\n class: {\r\n 'y-layer-base': true,\r\n 'y-layer-base--active': active.value,\r\n },\r\n }),\r\n });\r\n baseSlot.value = slotBase;\r\n return (\r\n <>\r\n {slotBase}\r\n <Teleport disabled={!layerGroup.value} to={layerGroup.value as any}>\r\n {rendered.value && (\r\n <div\r\n class={{\r\n 'y-layer': true,\r\n 'y-layer--finish': finish.value,\r\n ...computedClass.value,\r\n [themeClasses.value ?? '']: true,\r\n }}\r\n onMouseenter={onMouseenter}\r\n onMouseleave={onMouseleave}\r\n style={computedStyle.value}\r\n {...attrs}\r\n >\r\n <Transition name=\"fade\" appear>\r\n {active.value && props.scrim && (\r\n <div\r\n class=\"y-layer__scrim\"\r\n onClick={onClickScrim}\r\n ref=\"scrim$\"\r\n ></div>\r\n )}\r\n </Transition>\r\n <PolyTransition\r\n onAfterEnter={onAfterEnter}\r\n onAfterLeave={onAfterLeave}\r\n appear\r\n {...polyTransitionBindProps.value}\r\n >\r\n <div\r\n v-show={active.value}\r\n v-complement-click={{ ...complementClickOption }}\r\n class={{\r\n 'y-layer__content': true,\r\n ...computedContentClasses.value,\r\n }}\r\n style={[\r\n {\r\n ...dimensionStyles.value,\r\n ...coordinateStyles.value,\r\n ...props.contentStyles,\r\n },\r\n ]}\r\n ref={content$}\r\n >\r\n {slots.default?.({ active: active.value })}\r\n </div>\r\n </PolyTransition>\r\n </div>\r\n )}\r\n </Teleport>\r\n </>\r\n );\r\n });\r\n\r\n return {\r\n complementClickOption,\r\n layerGroup,\r\n active,\r\n rendered,\r\n lazyValue,\r\n onAfterUpdate: onAfterUpdate as () => void,\r\n scrim$,\r\n content$,\r\n baseEl,\r\n polyTransitionBindProps,\r\n coordinateStyles,\r\n };\r\n },\r\n});\r\n\r\nexport type YLayer = InstanceType<typeof YLayer>;\r\n"],"mappings":";AACA,SACEA,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,eAAe,EACfC,UAAU,EACVC,QAAQ,EACRC,GAAG,EACHC,UAAU,EACVC,KAAK,EACLC,WAAW,QACN,KAAK;AAAC,SAEJC,SAAS;AAAA,SAEhBC,oBAAoB,EACpBC,aAAa;AAAA,SAGbC,0BAA0B,EAC1BC,YAAY;AAAA,SAELC,aAAa;AAAA,SACbC,sBAAsB,EAAEC,aAAa;AAAA,SACrCC,OAAO;AAAA,SAEdC,cAAc,EACdC,yBAAyB,EACzBC,iBAAiB;AAAA,SAGjBC,eAAe;AAAA,SAGRC,WAAW,EAAEC,YAAY;AAElC;AAEA,OAAO,MAAMC,gBAAgB,GAAGD,YAAY,CAC1C;EACEE,UAAU,EAAE;IACVC,IAAI,EAAEC;EACR,CAAC;EACDC,KAAK,EAAE;IACLF,IAAI,EAAEC;EACR,CAAC;EACDE,KAAK,EAAE;IACLH,IAAI,EAAEC;EACR,CAAC;EACDG,OAAO,EAAE;IACPJ,IAAI,EAAE,CAACK,KAAK,EAAEC,MAAM,EAAEC,MAAM;EAG9B,CAAC;EACDC,cAAc,EAAE;IACdR,IAAI,EAAE,CAACK,KAAK,EAAEC,MAAM,EAAEC,MAAM;EAG9B,CAAC;EACDE,eAAe,EAAE;IACfT,IAAI,EAAEC;EACR,CAAC;EACDS,KAAK,EAAET,OAA4B;EACnCU,aAAa,EAAE;IACbX,IAA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