forstok-ui-lib 8.5.12 → 8.5.13
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.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/button/styles.ts +115 -83
package/package.json
CHANGED
|
@@ -1,46 +1,64 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
import { buttonActiveStyle, buttonHoverStyle, buttonStyle } from
|
|
3
|
-
import IconAgent from
|
|
4
|
-
import IconReport from
|
|
5
|
-
import IconDotted from
|
|
6
|
-
import IconClose from
|
|
7
|
-
import IconCloseWhite from
|
|
8
|
-
import IconArrowDownload from
|
|
9
|
-
import IconArrowWhiteUpload from
|
|
10
|
-
import IconFilter from
|
|
11
|
-
import IconCalendar from
|
|
12
|
-
import IconTag from
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { buttonActiveStyle, buttonHoverStyle, buttonStyle } from "../../assets";
|
|
3
|
+
import IconAgent from "../../assets/images/icons/agent.svg";
|
|
4
|
+
import IconReport from "../../assets/images/icons/report.svg";
|
|
5
|
+
import IconDotted from "../../assets/images/icons/dotted.svg";
|
|
6
|
+
import IconClose from "../../assets/images/icons/close.svg";
|
|
7
|
+
import IconCloseWhite from "../../assets/images/icons/close-white.svg";
|
|
8
|
+
import IconArrowDownload from "../../assets/images/icons/arrow-download.svg";
|
|
9
|
+
import IconArrowWhiteUpload from "../../assets/images/icons/arrow-white-upload.svg";
|
|
10
|
+
import IconFilter from "../../assets/images/icons/filter.svg";
|
|
11
|
+
import IconCalendar from "../../assets/images/icons/calendar.svg";
|
|
12
|
+
import IconTag from "../../assets/images/icons/tag.svg";
|
|
13
13
|
|
|
14
14
|
const IconStyles = css`
|
|
15
15
|
display: inline-block;
|
|
16
16
|
pointer-events: none;
|
|
17
|
-
|
|
17
|
+
`;
|
|
18
18
|
|
|
19
|
-
const getButtonModifiedStyled = ({
|
|
19
|
+
const getButtonModifiedStyled = ({
|
|
20
|
+
$mode,
|
|
21
|
+
$isIndicatorArrow,
|
|
22
|
+
$isShown,
|
|
23
|
+
$isLoading,
|
|
24
|
+
$activated,
|
|
25
|
+
$size,
|
|
26
|
+
disabled,
|
|
27
|
+
$iconLeft,
|
|
28
|
+
}: {
|
|
29
|
+
$mode?: string;
|
|
30
|
+
$isIndicatorArrow: boolean;
|
|
31
|
+
$isShown: boolean;
|
|
32
|
+
$isLoading: boolean;
|
|
33
|
+
$activated: boolean;
|
|
34
|
+
$size?: string;
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
$iconLeft?: string;
|
|
37
|
+
}) => {
|
|
20
38
|
let style = ``;
|
|
21
39
|
if (!$isShown) {
|
|
22
|
-
return `display:none
|
|
40
|
+
return `display:none;`;
|
|
23
41
|
}
|
|
24
42
|
if ($size) {
|
|
25
|
-
if ($size ===
|
|
43
|
+
if ($size === "xsmall") {
|
|
26
44
|
style += `
|
|
27
45
|
font-size: 12px;
|
|
28
46
|
height: 20px;
|
|
29
47
|
padding: 0 8px;
|
|
30
|
-
|
|
31
|
-
} else if ($size ===
|
|
48
|
+
`;
|
|
49
|
+
} else if ($size === "small") {
|
|
32
50
|
style += `
|
|
33
51
|
font-size: 13px;
|
|
34
52
|
height: 28px;
|
|
35
53
|
min-width: 75px;
|
|
36
|
-
|
|
37
|
-
} else if ($size ===
|
|
54
|
+
`;
|
|
55
|
+
} else if ($size === "medium") {
|
|
38
56
|
style += `
|
|
39
57
|
height: 32px;
|
|
40
|
-
|
|
58
|
+
`;
|
|
41
59
|
}
|
|
42
60
|
}
|
|
43
|
-
if ($mode ===
|
|
61
|
+
if ($mode === "red") {
|
|
44
62
|
style += `
|
|
45
63
|
color: var(--act-clr);
|
|
46
64
|
background-color: var(--act-clr-bg);
|
|
@@ -52,8 +70,8 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
52
70
|
fill: #ffffff;
|
|
53
71
|
stroke: #ffffff;
|
|
54
72
|
}
|
|
55
|
-
|
|
56
|
-
} else if ($mode ===
|
|
73
|
+
`;
|
|
74
|
+
} else if ($mode === "green") {
|
|
57
75
|
style += `
|
|
58
76
|
color: var(--act-clr);
|
|
59
77
|
background-color: rgb(33, 186, 69);
|
|
@@ -65,37 +83,40 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
65
83
|
fill: #ffffff;
|
|
66
84
|
stroke: #ffffff;
|
|
67
85
|
}
|
|
68
|
-
|
|
69
|
-
} else if ($mode ===
|
|
86
|
+
`;
|
|
87
|
+
} else if ($mode === "white") {
|
|
70
88
|
style += `
|
|
71
89
|
color: var(--mt-clr);
|
|
72
90
|
background-color: var(--cl-clr-bg);
|
|
73
91
|
&:hover {
|
|
74
92
|
background-color: var(--cl-clr-bg__hvr);
|
|
75
93
|
}
|
|
76
|
-
|
|
77
|
-
} else if ($mode ===
|
|
94
|
+
`;
|
|
95
|
+
} else if ($mode === "blue") {
|
|
78
96
|
style += `
|
|
79
97
|
&,
|
|
80
98
|
&:hover {
|
|
81
99
|
background-color: var(--ck-clr-bg__act);
|
|
82
100
|
color: var(--act-clr);
|
|
83
101
|
}
|
|
102
|
+
&:hover {
|
|
103
|
+
text-decoration: underline;
|
|
104
|
+
}
|
|
84
105
|
& ${IndicatorsArrowIconSvg} {
|
|
85
106
|
fill: #ffffff;
|
|
86
107
|
stroke: #ffffff;
|
|
87
108
|
}
|
|
88
|
-
|
|
89
|
-
}
|
|
109
|
+
`;
|
|
110
|
+
}
|
|
90
111
|
// else if ($mode === 'nude') {
|
|
91
112
|
// style += `
|
|
92
|
-
// &, &:hover {
|
|
93
|
-
// background-color: var(--ter-clr-bg);
|
|
94
|
-
// }
|
|
113
|
+
// &, &:hover {
|
|
114
|
+
// background-color: var(--ter-clr-bg);
|
|
115
|
+
// }
|
|
95
116
|
// `
|
|
96
|
-
// }
|
|
97
|
-
else if ($mode ===
|
|
98
|
-
style
|
|
117
|
+
// }
|
|
118
|
+
else if ($mode === "clearL") {
|
|
119
|
+
style += `
|
|
99
120
|
width: auto;
|
|
100
121
|
height: auto;
|
|
101
122
|
text-decoration: none;
|
|
@@ -115,8 +136,8 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
115
136
|
background-color: transparent !important;
|
|
116
137
|
color: var(--mt-clr);
|
|
117
138
|
}
|
|
118
|
-
|
|
119
|
-
} else if ($mode ===
|
|
139
|
+
`;
|
|
140
|
+
} else if ($mode === "clearB") {
|
|
120
141
|
style += `
|
|
121
142
|
background-color: var(--cl-clr-bg);
|
|
122
143
|
color: var(--pri-clr-lnk__hvr);
|
|
@@ -134,22 +155,22 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
134
155
|
fill: var(--pri-clr-lnk__hvr);
|
|
135
156
|
stroke: var(--pri-clr-lnk__hvr);
|
|
136
157
|
}
|
|
137
|
-
|
|
138
|
-
} else if ($mode ===
|
|
139
|
-
style
|
|
158
|
+
`;
|
|
159
|
+
} else if ($mode === "clear") {
|
|
160
|
+
style += `
|
|
140
161
|
box-shadow: none !important;
|
|
141
162
|
&,
|
|
142
163
|
&:hover {
|
|
143
164
|
background-color: transparent;
|
|
144
165
|
}
|
|
145
|
-
|
|
166
|
+
`;
|
|
146
167
|
if ($activated) {
|
|
147
168
|
style += `
|
|
148
169
|
color: var(--pri-clr) !important;
|
|
149
170
|
font-weight: 600;
|
|
150
|
-
|
|
171
|
+
`;
|
|
151
172
|
}
|
|
152
|
-
} else if ($mode ===
|
|
173
|
+
} else if ($mode === "more") {
|
|
153
174
|
style += `
|
|
154
175
|
padding: 8px;
|
|
155
176
|
background-color: var(--mt-clr-bg__fc);
|
|
@@ -159,8 +180,8 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
159
180
|
width: 14px;
|
|
160
181
|
${IconStyles}
|
|
161
182
|
}
|
|
162
|
-
|
|
163
|
-
} else if ($mode ===
|
|
183
|
+
`;
|
|
184
|
+
} else if ($mode === "round-close") {
|
|
164
185
|
style += `
|
|
165
186
|
background-color: transparent;
|
|
166
187
|
box-shadow: none;
|
|
@@ -169,8 +190,8 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
169
190
|
width: 12px;
|
|
170
191
|
${IconStyles}
|
|
171
192
|
}
|
|
172
|
-
|
|
173
|
-
} else if ($mode ===
|
|
193
|
+
`;
|
|
194
|
+
} else if ($mode === "small-white-round-close") {
|
|
174
195
|
style += `
|
|
175
196
|
&,
|
|
176
197
|
&:hover,
|
|
@@ -183,8 +204,8 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
183
204
|
width: 8px;
|
|
184
205
|
${IconStyles}
|
|
185
206
|
}
|
|
186
|
-
|
|
187
|
-
} else if ($mode ===
|
|
207
|
+
`;
|
|
208
|
+
} else if ($mode === "page-option") {
|
|
188
209
|
style += `
|
|
189
210
|
font-weight: 600;
|
|
190
211
|
cursor: pointer;
|
|
@@ -195,13 +216,13 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
195
216
|
height: 14px;
|
|
196
217
|
margin-top: -7px;
|
|
197
218
|
}
|
|
198
|
-
|
|
199
|
-
} else if ($mode ===
|
|
219
|
+
`;
|
|
220
|
+
} else if ($mode === "sortBy") {
|
|
200
221
|
style += `
|
|
201
222
|
> span {
|
|
202
223
|
display: none;
|
|
203
224
|
}
|
|
204
|
-
|
|
225
|
+
`;
|
|
205
226
|
}
|
|
206
227
|
if (disabled) {
|
|
207
228
|
style += `
|
|
@@ -212,11 +233,11 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
212
233
|
cursor: default;
|
|
213
234
|
color: var(--sec-clr);
|
|
214
235
|
}
|
|
215
|
-
|
|
236
|
+
`;
|
|
216
237
|
}
|
|
217
238
|
if ($iconLeft) {
|
|
218
|
-
style += ` padding-left: 35px;
|
|
219
|
-
if ($iconLeft ===
|
|
239
|
+
style += ` padding-left: 35px; `;
|
|
240
|
+
if ($iconLeft === "export") {
|
|
220
241
|
style += `
|
|
221
242
|
&:before {
|
|
222
243
|
content: url(${IconArrowDownload});
|
|
@@ -226,8 +247,8 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
226
247
|
width: 14px;
|
|
227
248
|
${IconStyles}
|
|
228
249
|
}
|
|
229
|
-
|
|
230
|
-
} else if ($iconLeft ===
|
|
250
|
+
`;
|
|
251
|
+
} else if ($iconLeft === "import") {
|
|
231
252
|
style += `
|
|
232
253
|
&:before {
|
|
233
254
|
content: url(${IconArrowWhiteUpload});
|
|
@@ -238,8 +259,8 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
238
259
|
margin-left: -8px;
|
|
239
260
|
${IconStyles}
|
|
240
261
|
}
|
|
241
|
-
|
|
242
|
-
} else if ($iconLeft ===
|
|
262
|
+
`;
|
|
263
|
+
} else if ($iconLeft === "filter") {
|
|
243
264
|
style += `
|
|
244
265
|
&:before {
|
|
245
266
|
content: url(${IconFilter});
|
|
@@ -250,8 +271,8 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
250
271
|
width: 14px;
|
|
251
272
|
height: 16px;
|
|
252
273
|
}
|
|
253
|
-
|
|
254
|
-
} else if ($iconLeft ===
|
|
274
|
+
`;
|
|
275
|
+
} else if ($iconLeft === "calendar") {
|
|
255
276
|
style += `
|
|
256
277
|
&:before {
|
|
257
278
|
content: url(${IconCalendar});
|
|
@@ -262,8 +283,8 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
262
283
|
width: 14px;
|
|
263
284
|
height: 16px;
|
|
264
285
|
}
|
|
265
|
-
|
|
266
|
-
} else if ($iconLeft ===
|
|
286
|
+
`;
|
|
287
|
+
} else if ($iconLeft === "add") {
|
|
267
288
|
style += `
|
|
268
289
|
&:before {
|
|
269
290
|
content: '+';
|
|
@@ -275,8 +296,8 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
275
296
|
height: 16px;
|
|
276
297
|
font-size: 16px;
|
|
277
298
|
}
|
|
278
|
-
|
|
279
|
-
} else if ($iconLeft ===
|
|
299
|
+
`;
|
|
300
|
+
} else if ($iconLeft === "agent") {
|
|
280
301
|
style += `
|
|
281
302
|
&:before {
|
|
282
303
|
content: url(${IconAgent});
|
|
@@ -287,8 +308,8 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
287
308
|
width: 14px;
|
|
288
309
|
height: 16px;
|
|
289
310
|
}
|
|
290
|
-
|
|
291
|
-
} else if ($iconLeft ===
|
|
311
|
+
`;
|
|
312
|
+
} else if ($iconLeft === "report") {
|
|
292
313
|
style += `
|
|
293
314
|
&:before {
|
|
294
315
|
content: url(${IconReport});
|
|
@@ -299,8 +320,8 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
299
320
|
width: 14px;
|
|
300
321
|
height: 16px;
|
|
301
322
|
}
|
|
302
|
-
|
|
303
|
-
} else if ($iconLeft ===
|
|
323
|
+
`;
|
|
324
|
+
} else if ($iconLeft === "tag") {
|
|
304
325
|
style += `
|
|
305
326
|
&:before {
|
|
306
327
|
content: url(${IconTag});
|
|
@@ -311,33 +332,46 @@ const getButtonModifiedStyled = ({ $mode, $isIndicatorArrow, $isShown, $isLoadin
|
|
|
311
332
|
width: 15px;
|
|
312
333
|
height: 16px;
|
|
313
334
|
}
|
|
314
|
-
|
|
335
|
+
`;
|
|
315
336
|
}
|
|
316
337
|
}
|
|
317
338
|
if ($isIndicatorArrow) {
|
|
318
339
|
style += `
|
|
319
340
|
padding-right: 25px;
|
|
320
|
-
|
|
341
|
+
`;
|
|
321
342
|
}
|
|
322
343
|
if ($isLoading) {
|
|
323
344
|
style += `
|
|
324
345
|
padding-right: 30px !important;
|
|
325
|
-
|
|
346
|
+
`;
|
|
326
347
|
}
|
|
327
348
|
return style;
|
|
328
|
-
}
|
|
329
|
-
const getIndicatorsArrowIconSvgModifiedStyled = ({
|
|
349
|
+
};
|
|
350
|
+
const getIndicatorsArrowIconSvgModifiedStyled = ({
|
|
351
|
+
color,
|
|
352
|
+
}: {
|
|
353
|
+
color?: string;
|
|
354
|
+
}) => {
|
|
330
355
|
let style = ``;
|
|
331
|
-
if (color && color !==
|
|
356
|
+
if (color && color !== "initial") {
|
|
332
357
|
style += `
|
|
333
358
|
fill: ${color};
|
|
334
359
|
stroke: ${color};
|
|
335
|
-
|
|
360
|
+
`;
|
|
336
361
|
}
|
|
337
362
|
return style;
|
|
338
|
-
}
|
|
363
|
+
};
|
|
339
364
|
|
|
340
|
-
export const ButtonContainer = styled.button<{
|
|
365
|
+
export const ButtonContainer = styled.button<{
|
|
366
|
+
$mode?: string;
|
|
367
|
+
$isIndicatorArrow: boolean;
|
|
368
|
+
$isShown: boolean;
|
|
369
|
+
$isLoading: boolean;
|
|
370
|
+
$activated: boolean;
|
|
371
|
+
$size?: string;
|
|
372
|
+
disabled: boolean;
|
|
373
|
+
$iconLeft?: string;
|
|
374
|
+
}>`
|
|
341
375
|
${buttonStyle}
|
|
342
376
|
&:hover {
|
|
343
377
|
${buttonHoverStyle}
|
|
@@ -350,7 +384,6 @@ export const ButtonContainer = styled.button<{ $mode?: string, $isIndicatorArrow
|
|
|
350
384
|
}
|
|
351
385
|
&._refButtonLoading {
|
|
352
386
|
padding-right: 30px !important;
|
|
353
|
-
|
|
354
387
|
}
|
|
355
388
|
> span {
|
|
356
389
|
white-space: nowrap;
|
|
@@ -364,8 +397,7 @@ export const ButtonContainer = styled.button<{ $mode?: string, $isIndicatorArrow
|
|
|
364
397
|
margin-top: -8px;
|
|
365
398
|
}
|
|
366
399
|
${getButtonModifiedStyled}
|
|
367
|
-
|
|
368
|
-
`
|
|
400
|
+
`;
|
|
369
401
|
export const IndicatorsArrowIconSvg = styled.svg<{ color?: string }>`
|
|
370
402
|
display: inline-block;
|
|
371
403
|
fill: currentColor;
|
|
@@ -379,4 +411,4 @@ export const IndicatorsArrowIconSvg = styled.svg<{ color?: string }>`
|
|
|
379
411
|
height: 14px;
|
|
380
412
|
margin-top: -7px;
|
|
381
413
|
${getIndicatorsArrowIconSvgModifiedStyled}
|
|
382
|
-
|
|
414
|
+
`;
|