forstok-ui-lib 8.9.4 → 8.9.6
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/index.d.ts +1 -1
- package/dist/index.js +19 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/images/icons/export-download.svg +11 -6
- package/src/components/dropdown/index.tsx +374 -185
- package/src/components/dropdown/styles.ts +101 -60
|
@@ -1,19 +1,44 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import {
|
|
3
|
+
buttonActiveShadowStyle,
|
|
4
|
+
buttonActiveStyle,
|
|
5
|
+
} from "../../assets/stylesheets/bases.styles";
|
|
6
|
+
import type { TDropdown } from "./typed";
|
|
4
7
|
|
|
5
|
-
type TDropdownChild = Pick<
|
|
6
|
-
|
|
8
|
+
type TDropdownChild = Pick<
|
|
9
|
+
TDropdown,
|
|
10
|
+
"$internalWidth" | "$openPosition" | "$placement" | "$bottom" | "$top"
|
|
11
|
+
>;
|
|
12
|
+
type TDropdownParent = Pick<
|
|
13
|
+
TDropdown,
|
|
14
|
+
| "$openPosition"
|
|
15
|
+
| "$placement"
|
|
16
|
+
| "$bottom"
|
|
17
|
+
| "$top"
|
|
18
|
+
| "$alias"
|
|
19
|
+
| "$externalWidth"
|
|
20
|
+
| "$externalMinWidth"
|
|
21
|
+
| "$area"
|
|
22
|
+
>;
|
|
7
23
|
|
|
8
|
-
const getDropDownContainerModifiedStyled = ({
|
|
9
|
-
|
|
24
|
+
const getDropDownContainerModifiedStyled = ({
|
|
25
|
+
$top,
|
|
26
|
+
$bottom,
|
|
27
|
+
$placement,
|
|
28
|
+
$alias,
|
|
29
|
+
$openPosition,
|
|
30
|
+
$externalWidth,
|
|
31
|
+
$externalMinWidth,
|
|
32
|
+
$area,
|
|
33
|
+
}: TDropdownParent) => {
|
|
34
|
+
const axTop = $top ? parseInt($top) + 5 + "px" : "40px";
|
|
10
35
|
let style = `
|
|
11
36
|
@keyframes droptodown {
|
|
12
37
|
90% {
|
|
13
38
|
top: ${axTop};
|
|
14
39
|
}
|
|
15
40
|
100% {
|
|
16
|
-
top: ${$top ||
|
|
41
|
+
top: ${$top || "35px"};
|
|
17
42
|
}
|
|
18
43
|
}
|
|
19
44
|
@keyframes droptoup {
|
|
@@ -32,7 +57,7 @@ const getDropDownContainerModifiedStyled = ({ $top, $bottom, $placement, $alias,
|
|
|
32
57
|
bottom: ${axTop};
|
|
33
58
|
}
|
|
34
59
|
100% {
|
|
35
|
-
bottom: ${$bottom ||
|
|
60
|
+
bottom: ${$bottom || "35px"};
|
|
36
61
|
}
|
|
37
62
|
}
|
|
38
63
|
@keyframse dropgoup {
|
|
@@ -64,7 +89,7 @@ const getDropDownContainerModifiedStyled = ({ $top, $bottom, $placement, $alias,
|
|
|
64
89
|
left: 0 !important;
|
|
65
90
|
top: auto !important;
|
|
66
91
|
bottom: 0 !important;
|
|
67
|
-
${$placement ===
|
|
92
|
+
${$placement === "top" ? "animation: dropgoup .075s;" : "animation: droptoup .075s;"}
|
|
68
93
|
overflow-x: hidden;
|
|
69
94
|
}
|
|
70
95
|
& ${DropDownBody} {
|
|
@@ -76,41 +101,41 @@ const getDropDownContainerModifiedStyled = ({ $top, $bottom, $placement, $alias,
|
|
|
76
101
|
@media only screen and (min-width: 768px) {
|
|
77
102
|
& ${DropDownWrapper} {
|
|
78
103
|
display: grid;
|
|
79
|
-
${$placement ===
|
|
80
|
-
left: ${
|
|
104
|
+
${$placement === "top" ? `animation: dropgodown .075s linear; bottom: ${$bottom || "35px"}; top: auto;` : `animation: droptodown .075s linear; top: ${$top || "35px"};`}
|
|
105
|
+
left: ${$alias === "_dropdownFilterContainer" && $openPosition !== "left" ? "100%" : $openPosition === "left" ? "0" : "auto"};
|
|
81
106
|
}
|
|
82
107
|
}
|
|
83
108
|
@media only screen and (min-width: 1024px) {
|
|
84
109
|
& ${DropDownWrapper} {
|
|
85
|
-
left: ${
|
|
110
|
+
left: ${$alias === "_dropdownFilterContainer" && $openPosition !== "left" ? "30%" : $openPosition === "left" ? "0" : "auto"};
|
|
86
111
|
}
|
|
87
112
|
}
|
|
88
113
|
@media only screen and (min-width: 1280px) {
|
|
89
114
|
& ${DropDownWrapper} {
|
|
90
|
-
left: ${
|
|
115
|
+
left: ${$alias === "_dropdownFilterContainer" && $openPosition !== "left" ? "0" : $openPosition === "left" ? "0" : "auto"};
|
|
91
116
|
}
|
|
92
117
|
}
|
|
93
118
|
}
|
|
94
|
-
|
|
95
|
-
if ($alias ===
|
|
119
|
+
`;
|
|
120
|
+
if ($alias === "_dropdownFilterContainer") {
|
|
96
121
|
style += `
|
|
97
122
|
margin-top: 4px;
|
|
98
123
|
${DropDownControl} {
|
|
99
124
|
margin-top: -4px;
|
|
100
125
|
}
|
|
101
|
-
|
|
126
|
+
`;
|
|
102
127
|
}
|
|
103
128
|
if ($externalWidth) {
|
|
104
129
|
style += `
|
|
105
130
|
width: ${$externalWidth}
|
|
106
|
-
|
|
131
|
+
`;
|
|
107
132
|
}
|
|
108
133
|
if ($externalMinWidth) {
|
|
109
134
|
style += `
|
|
110
135
|
min-width: ${$externalMinWidth}
|
|
111
|
-
|
|
136
|
+
`;
|
|
112
137
|
}
|
|
113
|
-
if ($area ===
|
|
138
|
+
if ($area === "mobile") {
|
|
114
139
|
style += `
|
|
115
140
|
@media (min-width: 320px) and (max-width: 480px) {
|
|
116
141
|
${DropDownWrapper} {
|
|
@@ -119,106 +144,122 @@ const getDropDownContainerModifiedStyled = ({ $top, $bottom, $placement, $alias,
|
|
|
119
144
|
z-index: 88;
|
|
120
145
|
}
|
|
121
146
|
}
|
|
122
|
-
|
|
147
|
+
`;
|
|
123
148
|
}
|
|
124
|
-
return style
|
|
149
|
+
return style;
|
|
125
150
|
};
|
|
126
151
|
|
|
127
|
-
const getDropDownWrapperModifiedStyled = ({
|
|
128
|
-
|
|
152
|
+
const getDropDownWrapperModifiedStyled = ({
|
|
153
|
+
$internalWidth,
|
|
154
|
+
$openPosition,
|
|
155
|
+
$placement,
|
|
156
|
+
$bottom,
|
|
157
|
+
$top,
|
|
158
|
+
}: TDropdownChild) => {
|
|
159
|
+
let style = "";
|
|
129
160
|
if ($internalWidth) {
|
|
130
161
|
style += `
|
|
131
162
|
width: ${$internalWidth};
|
|
132
|
-
|
|
163
|
+
`;
|
|
133
164
|
} else {
|
|
134
|
-
style
|
|
165
|
+
style += `
|
|
135
166
|
width: auto;
|
|
136
167
|
white-space: nowrap;
|
|
137
168
|
${DropDownBody} {
|
|
138
169
|
overflow: unset;
|
|
139
170
|
}
|
|
140
|
-
|
|
171
|
+
`;
|
|
141
172
|
}
|
|
142
|
-
if ($openPosition ===
|
|
173
|
+
if ($openPosition === "left") {
|
|
143
174
|
style += `
|
|
144
175
|
left: 0;
|
|
145
176
|
right: auto;
|
|
146
|
-
|
|
147
|
-
} else if ($openPosition ===
|
|
177
|
+
`;
|
|
178
|
+
} else if ($openPosition === "center") {
|
|
148
179
|
style += `
|
|
149
180
|
left: 50%;
|
|
150
181
|
right: auto;
|
|
151
182
|
transform: translateX(-50%);
|
|
152
|
-
|
|
183
|
+
`;
|
|
153
184
|
}
|
|
154
|
-
if ($placement ===
|
|
185
|
+
if ($placement === "top" && $bottom) {
|
|
155
186
|
style += `
|
|
156
187
|
top: unset; bottom: ${$bottom}
|
|
157
|
-
|
|
188
|
+
`;
|
|
158
189
|
} else if ($top) {
|
|
159
190
|
style += `
|
|
160
191
|
top: ${$top};
|
|
161
|
-
|
|
192
|
+
`;
|
|
162
193
|
}
|
|
163
|
-
return style
|
|
194
|
+
return style;
|
|
164
195
|
};
|
|
165
196
|
|
|
166
|
-
const getDropDownBodyModifiedStyled = ({ $area }:{ $area?: string }) => {
|
|
167
|
-
let style =
|
|
168
|
-
if ($area ===
|
|
197
|
+
const getDropDownBodyModifiedStyled = ({ $area }: { $area?: string }) => {
|
|
198
|
+
let style = "";
|
|
199
|
+
if ($area === "promotion") {
|
|
169
200
|
style += `
|
|
170
201
|
max-height: 347px;
|
|
171
202
|
overflow-y: auto;
|
|
172
|
-
|
|
203
|
+
`;
|
|
173
204
|
}
|
|
174
|
-
return style
|
|
205
|
+
return style;
|
|
175
206
|
};
|
|
176
207
|
|
|
177
|
-
const getDropDownActionModifiedStyled = ({
|
|
208
|
+
const getDropDownActionModifiedStyled = ({
|
|
209
|
+
$position,
|
|
210
|
+
}: {
|
|
211
|
+
$position?: string;
|
|
212
|
+
}) => {
|
|
178
213
|
let style = `
|
|
179
214
|
justify-self: end;
|
|
180
|
-
|
|
181
|
-
if ($position ===
|
|
215
|
+
`;
|
|
216
|
+
if ($position === "middle") {
|
|
182
217
|
style += `
|
|
183
218
|
width: 100%;
|
|
184
219
|
text-align: center;
|
|
185
|
-
|
|
186
|
-
} else if ($position ===
|
|
220
|
+
`;
|
|
221
|
+
} else if ($position === "left") {
|
|
187
222
|
style += `
|
|
188
223
|
width: 100%;
|
|
189
|
-
|
|
190
|
-
} else if ($position ===
|
|
224
|
+
`;
|
|
225
|
+
} else if ($position === "end") {
|
|
191
226
|
style += `
|
|
192
227
|
width: 100%;
|
|
193
228
|
text-align: end
|
|
194
|
-
|
|
229
|
+
`;
|
|
195
230
|
}
|
|
196
|
-
return style
|
|
231
|
+
return style;
|
|
197
232
|
};
|
|
198
233
|
|
|
199
234
|
export const DropDownWrapper = styled.section<TDropdownChild>`
|
|
200
235
|
background-color: var(--pri-clr-bg);
|
|
201
236
|
border: 1px solid var(--sec-clr-ln);
|
|
202
237
|
position: fixed;
|
|
203
|
-
width: 100vw;
|
|
238
|
+
width: 100vw;
|
|
204
239
|
z-index: 102;
|
|
205
240
|
display: none;
|
|
206
241
|
border-radius: 10px 10px 0px 0px;
|
|
207
|
-
> div,
|
|
242
|
+
> div,
|
|
208
243
|
> section {
|
|
209
244
|
padding: 1em;
|
|
210
245
|
}
|
|
211
246
|
@media only screen and (min-width: 768px) {
|
|
212
|
-
position: absolute;
|
|
247
|
+
position: absolute;
|
|
213
248
|
min-width: 110px;
|
|
214
249
|
width: 100vw;
|
|
215
250
|
top: 40px;
|
|
216
251
|
right: 0;
|
|
217
252
|
z-index: 10;
|
|
218
253
|
border: none;
|
|
219
|
-
border-radius: .75rem;
|
|
220
|
-
box-shadow:
|
|
221
|
-
|
|
254
|
+
border-radius: 0.75rem;
|
|
255
|
+
box-shadow:
|
|
256
|
+
0rem 0.5rem 1.5rem -0.5rem rgba(0, 0, 0, 0.05),
|
|
257
|
+
0rem 0.5rem 1rem -0.25rem rgba(0, 0, 0, 0.05),
|
|
258
|
+
0rem 0.1875rem 0.375rem 0rem rgba(0, 0, 0, 0.05),
|
|
259
|
+
0rem 0.125rem 0.25rem 0rem rgba(0, 0, 0, 0.05),
|
|
260
|
+
0rem 0.0625rem 0.125rem 0rem rgba(0, 0, 0, 0.05),
|
|
261
|
+
0rem 0rem 0rem 0.0625rem rgba(0, 0, 0, 0.06);
|
|
262
|
+
> div,
|
|
222
263
|
> section {
|
|
223
264
|
padding: 1em;
|
|
224
265
|
._refFilterDropdown {
|
|
@@ -249,7 +290,7 @@ export const DropDownOverlayWrapper = styled.div`
|
|
|
249
290
|
top: 0;
|
|
250
291
|
left: 0;
|
|
251
292
|
z-index: 100;
|
|
252
|
-
background-color: rgba(0, 0, 0, .1);
|
|
293
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
253
294
|
display: none;
|
|
254
295
|
@media only screen and (min-width: 768px) {
|
|
255
296
|
display: none !important;
|
|
@@ -284,8 +325,8 @@ export const DropDownContainer = styled.section<{ $area?: string }>`
|
|
|
284
325
|
&._refContainerhover:hover {
|
|
285
326
|
${DropDownWrapper} {
|
|
286
327
|
display: grid;
|
|
287
|
-
animation: droptodown .075s linear;
|
|
288
|
-
top:
|
|
328
|
+
animation: droptodown 0.075s linear;
|
|
329
|
+
top: "35px";
|
|
289
330
|
}
|
|
290
331
|
}
|
|
291
332
|
}
|
|
@@ -323,8 +364,8 @@ export const DropDownAction = styled.section<{ $position?: string }>`
|
|
|
323
364
|
export const DropdownPortalContainer = styled.div`
|
|
324
365
|
display: inline-block;
|
|
325
366
|
position: fixed;
|
|
326
|
-
top:
|
|
327
|
-
left:
|
|
367
|
+
top: -100%;
|
|
368
|
+
left: -100%;
|
|
328
369
|
z-index: 999;
|
|
329
370
|
&.is-shown {
|
|
330
371
|
& ${DropDownWrapper} {
|