@cloud-ru/uikit-product-button-predefined 0.7.4 → 0.7.5
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/CHANGELOG.md +11 -0
- package/dist/cjs/components/ButtonDropdown/ButtonDropdown.d.ts +6 -0
- package/dist/cjs/components/ButtonDropdown/ButtonDropdown.js +32 -0
- package/dist/cjs/components/ButtonDropdown/index.d.ts +1 -0
- package/dist/cjs/components/ButtonDropdown/index.js +17 -0
- package/dist/cjs/components/ButtonPromo/ButtonPromo.d.ts +6 -0
- package/dist/cjs/components/ButtonPromo/ButtonPromo.js +29 -0
- package/dist/cjs/components/ButtonPromo/index.d.ts +1 -0
- package/dist/cjs/components/ButtonPromo/index.js +17 -0
- package/dist/cjs/components/ButtonPromo/styles.module.css +293 -0
- package/dist/cjs/components/ButtonPromoOutline/ButtonPromoOutline.d.ts +6 -0
- package/dist/cjs/components/ButtonPromoOutline/ButtonPromoOutline.js +29 -0
- package/dist/cjs/components/ButtonPromoOutline/index.d.ts +1 -0
- package/dist/cjs/components/ButtonPromoOutline/index.js +17 -0
- package/dist/cjs/components/ButtonPromoOutline/styles.module.css +305 -0
- package/dist/cjs/components/index.d.ts +3 -0
- package/dist/cjs/components/index.js +19 -0
- package/dist/cjs/constants.d.ts +25 -0
- package/dist/cjs/constants.js +28 -0
- package/dist/cjs/helperComponents/ButtonPrivate/ButtonPrivate.d.ts +14 -0
- package/dist/cjs/helperComponents/ButtonPrivate/ButtonPrivate.js +55 -0
- package/dist/cjs/helperComponents/ButtonPrivate/constants.d.ts +10 -0
- package/dist/cjs/helperComponents/ButtonPrivate/constants.js +15 -0
- package/dist/cjs/helperComponents/ButtonPrivate/index.d.ts +1 -0
- package/dist/cjs/helperComponents/ButtonPrivate/index.js +17 -0
- package/dist/cjs/helperComponents/ButtonPrivate/styles.module.css +36 -0
- package/dist/cjs/helperComponents/ButtonPrivate/utils.d.ts +11 -0
- package/dist/cjs/helperComponents/ButtonPrivate/utils.js +54 -0
- package/dist/cjs/helperComponents/index.d.ts +1 -0
- package/dist/cjs/helperComponents/index.js +17 -0
- package/dist/cjs/hooks.d.ts +7 -0
- package/dist/cjs/hooks.js +10 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +17 -0
- package/dist/cjs/styles.module.css +0 -0
- package/dist/cjs/types.d.ts +48 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils.d.ts +12 -0
- package/dist/cjs/utils.js +6 -0
- package/dist/esm/components/ButtonDropdown/ButtonDropdown.d.ts +6 -0
- package/dist/esm/components/ButtonDropdown/ButtonDropdown.js +29 -0
- package/dist/esm/components/ButtonDropdown/index.d.ts +1 -0
- package/dist/esm/components/ButtonDropdown/index.js +1 -0
- package/dist/esm/components/ButtonPromo/ButtonPromo.d.ts +6 -0
- package/dist/esm/components/ButtonPromo/ButtonPromo.js +23 -0
- package/dist/esm/components/ButtonPromo/index.d.ts +1 -0
- package/dist/esm/components/ButtonPromo/index.js +1 -0
- package/dist/esm/components/ButtonPromo/styles.module.css +293 -0
- package/dist/esm/components/ButtonPromoOutline/ButtonPromoOutline.d.ts +6 -0
- package/dist/esm/components/ButtonPromoOutline/ButtonPromoOutline.js +23 -0
- package/dist/esm/components/ButtonPromoOutline/index.d.ts +1 -0
- package/dist/esm/components/ButtonPromoOutline/index.js +1 -0
- package/dist/esm/components/ButtonPromoOutline/styles.module.css +305 -0
- package/dist/esm/components/index.d.ts +3 -0
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/constants.d.ts +25 -0
- package/dist/esm/constants.js +25 -0
- package/dist/esm/helperComponents/ButtonPrivate/ButtonPrivate.d.ts +14 -0
- package/dist/esm/helperComponents/ButtonPrivate/ButtonPrivate.js +49 -0
- package/dist/esm/helperComponents/ButtonPrivate/constants.d.ts +10 -0
- package/dist/esm/helperComponents/ButtonPrivate/constants.js +12 -0
- package/dist/esm/helperComponents/ButtonPrivate/index.d.ts +1 -0
- package/dist/esm/helperComponents/ButtonPrivate/index.js +1 -0
- package/dist/esm/helperComponents/ButtonPrivate/styles.module.css +36 -0
- package/dist/esm/helperComponents/ButtonPrivate/utils.d.ts +11 -0
- package/dist/esm/helperComponents/ButtonPrivate/utils.js +48 -0
- package/dist/esm/helperComponents/index.d.ts +1 -0
- package/dist/esm/helperComponents/index.js +1 -0
- package/dist/esm/hooks.d.ts +7 -0
- package/dist/esm/hooks.js +7 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/styles.module.css +0 -0
- package/dist/esm/types.d.ts +48 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils.d.ts +12 -0
- package/dist/esm/utils.js +3 -0
- package/package.json +6 -5
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
.button[data-size=xs] .label{
|
|
2
|
+
font-family:var(--sans-label-s-font-family, SB Sans Text);
|
|
3
|
+
font-weight:var(--sans-label-s-font-weight, Semibold);
|
|
4
|
+
line-height:var(--sans-label-s-line-height, 14px);
|
|
5
|
+
font-size:var(--sans-label-s-font-size, 11px);
|
|
6
|
+
letter-spacing:var(--sans-label-s-letter-spacing, 0px);
|
|
7
|
+
paragraph-spacing:var(--sans-label-s-paragraph-spacing, 6.05px);
|
|
8
|
+
}
|
|
9
|
+
.button[data-size=xs] .icon{
|
|
10
|
+
display:inline-flex;
|
|
11
|
+
align-items:center;
|
|
12
|
+
justify-content:center;
|
|
13
|
+
width:var(--size-icon-container-s, 24px);
|
|
14
|
+
height:var(--size-icon-container-s, 24px);
|
|
15
|
+
}
|
|
16
|
+
.button[data-size=xs] .icon svg{
|
|
17
|
+
max-width:var(--size-icon-container-s, 24px);
|
|
18
|
+
max-height:var(--size-icon-container-s, 24px);
|
|
19
|
+
}
|
|
20
|
+
.button[data-size=xs][data-variant=label-only]{
|
|
21
|
+
border-radius:var(--radius-button-xs, 0px);
|
|
22
|
+
height:var(--size-button-xs, 24px);
|
|
23
|
+
padding-right:var(--space-button-xs-from-label, 8px);
|
|
24
|
+
padding-left:var(--space-button-xs-from-label, 8px);
|
|
25
|
+
border-width:var(--border-width-button-outline-single, 2px);
|
|
26
|
+
min-width:var(--size-button-mininal-width-xs, 0px);
|
|
27
|
+
}
|
|
28
|
+
.button[data-size=xs][data-variant=icon-only]{
|
|
29
|
+
border-radius:var(--radius-button-xs, 0px);
|
|
30
|
+
height:var(--size-button-xs, 24px);
|
|
31
|
+
width:var(--size-button-xs, 24px);
|
|
32
|
+
border-width:var(--border-width-button-outline-single, 2px);
|
|
33
|
+
}
|
|
34
|
+
.button[data-size=xs][data-variant=icon-after]{
|
|
35
|
+
border-radius:var(--radius-button-xs, 0px);
|
|
36
|
+
height:var(--size-button-xs, 24px);
|
|
37
|
+
gap:var(--space-button-xs-gap, 2px);
|
|
38
|
+
padding-right:var(--space-button-xs-from-icon, 4px);
|
|
39
|
+
padding-left:var(--space-button-xs-from-label, 8px);
|
|
40
|
+
border-width:var(--border-width-button-outline-single, 2px);
|
|
41
|
+
min-width:var(--size-button-mininal-width-xs, 0px);
|
|
42
|
+
}
|
|
43
|
+
.button[data-size=s] .label{
|
|
44
|
+
font-family:var(--sans-label-m-font-family, SB Sans Text);
|
|
45
|
+
font-weight:var(--sans-label-m-font-weight, Semibold);
|
|
46
|
+
line-height:var(--sans-label-m-line-height, 16px);
|
|
47
|
+
font-size:var(--sans-label-m-font-size, 12px);
|
|
48
|
+
letter-spacing:var(--sans-label-m-letter-spacing, 0px);
|
|
49
|
+
paragraph-spacing:var(--sans-label-m-paragraph-spacing, 6.6px);
|
|
50
|
+
}
|
|
51
|
+
.button[data-size=s] .icon{
|
|
52
|
+
display:inline-flex;
|
|
53
|
+
align-items:center;
|
|
54
|
+
justify-content:center;
|
|
55
|
+
width:var(--size-icon-container-s, 24px);
|
|
56
|
+
height:var(--size-icon-container-s, 24px);
|
|
57
|
+
}
|
|
58
|
+
.button[data-size=s] .icon svg{
|
|
59
|
+
max-width:var(--size-icon-container-s, 24px);
|
|
60
|
+
max-height:var(--size-icon-container-s, 24px);
|
|
61
|
+
}
|
|
62
|
+
.button[data-size=s][data-variant=label-only]{
|
|
63
|
+
border-radius:var(--radius-button-s, 0px);
|
|
64
|
+
height:var(--size-button-s, 32px);
|
|
65
|
+
padding-right:var(--space-button-s-from-label, 16px);
|
|
66
|
+
padding-left:var(--space-button-s-from-label, 16px);
|
|
67
|
+
border-width:var(--border-width-button-outline-single, 2px);
|
|
68
|
+
min-width:var(--size-button-mininal-width-s, 0px);
|
|
69
|
+
}
|
|
70
|
+
.button[data-size=s][data-variant=icon-only]{
|
|
71
|
+
border-radius:var(--radius-button-s, 0px);
|
|
72
|
+
height:var(--size-button-s, 32px);
|
|
73
|
+
width:var(--size-button-s, 32px);
|
|
74
|
+
border-width:var(--border-width-button-outline-single, 2px);
|
|
75
|
+
}
|
|
76
|
+
.button[data-size=s][data-variant=icon-after]{
|
|
77
|
+
border-radius:var(--radius-button-s, 0px);
|
|
78
|
+
height:var(--size-button-s, 32px);
|
|
79
|
+
gap:var(--space-button-s-gap, 4px);
|
|
80
|
+
padding-right:var(--space-button-s-from-icon, 8px);
|
|
81
|
+
padding-left:var(--space-button-s-from-label, 16px);
|
|
82
|
+
border-width:var(--border-width-button-outline-single, 2px);
|
|
83
|
+
min-width:var(--size-button-mininal-width-s, 0px);
|
|
84
|
+
}
|
|
85
|
+
.button[data-size=m] .label{
|
|
86
|
+
font-family:var(--sans-label-l-font-family, SB Sans Text);
|
|
87
|
+
font-weight:var(--sans-label-l-font-weight, Semibold);
|
|
88
|
+
line-height:var(--sans-label-l-line-height, 20px);
|
|
89
|
+
font-size:var(--sans-label-l-font-size, 14px);
|
|
90
|
+
letter-spacing:var(--sans-label-l-letter-spacing, 0px);
|
|
91
|
+
paragraph-spacing:var(--sans-label-l-paragraph-spacing, 7.7px);
|
|
92
|
+
}
|
|
93
|
+
.button[data-size=m] .icon{
|
|
94
|
+
display:inline-flex;
|
|
95
|
+
align-items:center;
|
|
96
|
+
justify-content:center;
|
|
97
|
+
width:var(--size-icon-container-s, 24px);
|
|
98
|
+
height:var(--size-icon-container-s, 24px);
|
|
99
|
+
}
|
|
100
|
+
.button[data-size=m] .icon svg{
|
|
101
|
+
max-width:var(--size-icon-container-s, 24px);
|
|
102
|
+
max-height:var(--size-icon-container-s, 24px);
|
|
103
|
+
}
|
|
104
|
+
.button[data-size=m][data-variant=label-only]{
|
|
105
|
+
border-radius:var(--radius-button-m, 0px);
|
|
106
|
+
height:var(--size-button-m, 40px);
|
|
107
|
+
padding-right:var(--space-button-m-from-label, 24px);
|
|
108
|
+
padding-left:var(--space-button-m-from-label, 24px);
|
|
109
|
+
border-width:var(--border-width-button-outline-single, 2px);
|
|
110
|
+
min-width:var(--size-button-mininal-width-m, 0px);
|
|
111
|
+
}
|
|
112
|
+
.button[data-size=m][data-variant=icon-only]{
|
|
113
|
+
border-radius:var(--radius-button-m, 0px);
|
|
114
|
+
height:var(--size-button-m, 40px);
|
|
115
|
+
width:var(--size-button-m, 40px);
|
|
116
|
+
border-width:var(--border-width-button-outline-single, 2px);
|
|
117
|
+
}
|
|
118
|
+
.button[data-size=m][data-variant=icon-after]{
|
|
119
|
+
border-radius:var(--radius-button-m, 0px);
|
|
120
|
+
height:var(--size-button-m, 40px);
|
|
121
|
+
gap:var(--space-button-m-gap, 4px);
|
|
122
|
+
padding-right:var(--space-button-m-from-icon, 16px);
|
|
123
|
+
padding-left:var(--space-button-m-from-label, 24px);
|
|
124
|
+
border-width:var(--border-width-button-outline-single, 2px);
|
|
125
|
+
min-width:var(--size-button-mininal-width-m, 0px);
|
|
126
|
+
}
|
|
127
|
+
.button[data-size=l] .label{
|
|
128
|
+
font-family:var(--sans-label-l-font-family, SB Sans Text);
|
|
129
|
+
font-weight:var(--sans-label-l-font-weight, Semibold);
|
|
130
|
+
line-height:var(--sans-label-l-line-height, 20px);
|
|
131
|
+
font-size:var(--sans-label-l-font-size, 14px);
|
|
132
|
+
letter-spacing:var(--sans-label-l-letter-spacing, 0px);
|
|
133
|
+
paragraph-spacing:var(--sans-label-l-paragraph-spacing, 7.7px);
|
|
134
|
+
}
|
|
135
|
+
.button[data-size=l] .icon{
|
|
136
|
+
display:inline-flex;
|
|
137
|
+
align-items:center;
|
|
138
|
+
justify-content:center;
|
|
139
|
+
width:var(--size-icon-container-s, 24px);
|
|
140
|
+
height:var(--size-icon-container-s, 24px);
|
|
141
|
+
}
|
|
142
|
+
.button[data-size=l] .icon svg{
|
|
143
|
+
max-width:var(--size-icon-container-s, 24px);
|
|
144
|
+
max-height:var(--size-icon-container-s, 24px);
|
|
145
|
+
}
|
|
146
|
+
.button[data-size=l][data-variant=label-only]{
|
|
147
|
+
border-radius:var(--radius-button-l, 0px);
|
|
148
|
+
height:var(--size-button-l, 48px);
|
|
149
|
+
padding-right:var(--space-button-l-from-label, 32px);
|
|
150
|
+
padding-left:var(--space-button-l-from-label, 32px);
|
|
151
|
+
border-width:var(--border-width-button-outline-single, 2px);
|
|
152
|
+
min-width:var(--size-button-mininal-width-l, 0px);
|
|
153
|
+
}
|
|
154
|
+
.button[data-size=l][data-variant=icon-only]{
|
|
155
|
+
border-radius:var(--radius-button-l, 0px);
|
|
156
|
+
height:var(--size-button-l, 48px);
|
|
157
|
+
width:var(--size-button-l, 48px);
|
|
158
|
+
border-width:var(--border-width-button-outline-single, 2px);
|
|
159
|
+
}
|
|
160
|
+
.button[data-size=l][data-variant=icon-after]{
|
|
161
|
+
border-radius:var(--radius-button-l, 0px);
|
|
162
|
+
height:var(--size-button-l, 48px);
|
|
163
|
+
gap:var(--space-button-l-gap, 4px);
|
|
164
|
+
padding-right:var(--space-button-l-from-icon, 24px);
|
|
165
|
+
padding-left:var(--space-button-l-from-label, 32px);
|
|
166
|
+
border-width:var(--border-width-button-outline-single, 2px);
|
|
167
|
+
min-width:var(--size-button-mininal-width-l, 0px);
|
|
168
|
+
}
|
|
169
|
+
.button[data-loading][data-variant=label-only] .icon{
|
|
170
|
+
position:absolute;
|
|
171
|
+
top:50%;
|
|
172
|
+
left:50%;
|
|
173
|
+
transform:translate(-50%, -50%);
|
|
174
|
+
}
|
|
175
|
+
.button[data-loading][data-variant=label-only] .label{
|
|
176
|
+
opacity:var(--opacity-a0, 0);
|
|
177
|
+
}
|
|
178
|
+
.button[data-appearance=fluorescent-yellow]{
|
|
179
|
+
border-color:var(--sys-fluorescent-yellow-accent-default, #cff500);
|
|
180
|
+
}
|
|
181
|
+
.button[data-appearance=fluorescent-yellow] .label{
|
|
182
|
+
color:var(--sys-fluorescent-yellow-accent-default, #cff500);
|
|
183
|
+
}
|
|
184
|
+
.button[data-appearance=fluorescent-yellow] .icon{
|
|
185
|
+
color:var(--sys-fluorescent-yellow-accent-default, #cff500);
|
|
186
|
+
}
|
|
187
|
+
@media (hover: hover){
|
|
188
|
+
.button[data-appearance=fluorescent-yellow]:hover{
|
|
189
|
+
border-color:var(--sys-fluorescent-yellow-accent-hovered, #abcb0f);
|
|
190
|
+
}
|
|
191
|
+
.button[data-appearance=fluorescent-yellow]:hover .label{
|
|
192
|
+
color:var(--sys-fluorescent-yellow-accent-hovered, #abcb0f);
|
|
193
|
+
}
|
|
194
|
+
.button[data-appearance=fluorescent-yellow]:hover .icon{
|
|
195
|
+
color:var(--sys-fluorescent-yellow-accent-hovered, #abcb0f);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
@media (hover: none) or (hover: hover){
|
|
199
|
+
.button[data-appearance=fluorescent-yellow]:focus-visible{
|
|
200
|
+
border-color:var(--sys-fluorescent-yellow-accent-hovered, #abcb0f);
|
|
201
|
+
}
|
|
202
|
+
.button[data-appearance=fluorescent-yellow]:focus-visible .label{
|
|
203
|
+
color:var(--sys-fluorescent-yellow-accent-hovered, #abcb0f);
|
|
204
|
+
}
|
|
205
|
+
.button[data-appearance=fluorescent-yellow]:focus-visible .icon{
|
|
206
|
+
color:var(--sys-fluorescent-yellow-accent-hovered, #abcb0f);
|
|
207
|
+
}
|
|
208
|
+
.button[data-appearance=fluorescent-yellow]:active{
|
|
209
|
+
border-color:var(--sys-fluorescent-yellow-accent-pressed, #859c2d);
|
|
210
|
+
}
|
|
211
|
+
.button[data-appearance=fluorescent-yellow]:active .label{
|
|
212
|
+
color:var(--sys-fluorescent-yellow-accent-pressed, #859c2d);
|
|
213
|
+
}
|
|
214
|
+
.button[data-appearance=fluorescent-yellow]:active .icon{
|
|
215
|
+
color:var(--sys-fluorescent-yellow-accent-pressed, #859c2d);
|
|
216
|
+
}
|
|
217
|
+
.button[data-appearance=fluorescent-yellow][data-loading]{
|
|
218
|
+
border-color:var(--sys-fluorescent-yellow-accent-pressed, #859c2d);
|
|
219
|
+
}
|
|
220
|
+
.button[data-appearance=fluorescent-yellow][data-loading] .label{
|
|
221
|
+
color:var(--sys-fluorescent-yellow-accent-pressed, #859c2d);
|
|
222
|
+
}
|
|
223
|
+
.button[data-appearance=fluorescent-yellow][data-loading] .icon{
|
|
224
|
+
color:var(--sys-fluorescent-yellow-accent-pressed, #859c2d);
|
|
225
|
+
}
|
|
226
|
+
.button[data-appearance=fluorescent-yellow]:disabled, .button[data-appearance=fluorescent-yellow][data-disabled]{
|
|
227
|
+
border-color:var(--sys-neutral-decor-disabled, #e6e8ef);
|
|
228
|
+
}
|
|
229
|
+
.button[data-appearance=fluorescent-yellow]:disabled .label, .button[data-appearance=fluorescent-yellow][data-disabled] .label{
|
|
230
|
+
color:var(--sys-neutral-text-disabled, #aaaebd);
|
|
231
|
+
}
|
|
232
|
+
.button[data-appearance=fluorescent-yellow]:disabled .icon, .button[data-appearance=fluorescent-yellow][data-disabled] .icon{
|
|
233
|
+
color:var(--sys-neutral-text-disabled, #aaaebd);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
.button[data-appearance=graphite]{
|
|
237
|
+
border-color:var(--sys-graphite-accent-default, #222222);
|
|
238
|
+
}
|
|
239
|
+
.button[data-appearance=graphite] .label{
|
|
240
|
+
color:var(--sys-graphite-accent-default, #222222);
|
|
241
|
+
}
|
|
242
|
+
.button[data-appearance=graphite] .icon{
|
|
243
|
+
color:var(--sys-graphite-accent-default, #222222);
|
|
244
|
+
}
|
|
245
|
+
@media (hover: hover){
|
|
246
|
+
.button[data-appearance=graphite]:hover{
|
|
247
|
+
border-color:var(--sys-graphite-accent-hovered, #383838);
|
|
248
|
+
}
|
|
249
|
+
.button[data-appearance=graphite]:hover .label{
|
|
250
|
+
color:var(--sys-graphite-accent-hovered, #383838);
|
|
251
|
+
}
|
|
252
|
+
.button[data-appearance=graphite]:hover .icon{
|
|
253
|
+
color:var(--sys-graphite-accent-hovered, #383838);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
@media (hover: none) or (hover: hover){
|
|
257
|
+
.button[data-appearance=graphite]:focus-visible{
|
|
258
|
+
border-color:var(--sys-graphite-accent-hovered, #383838);
|
|
259
|
+
}
|
|
260
|
+
.button[data-appearance=graphite]:focus-visible .label{
|
|
261
|
+
color:var(--sys-graphite-accent-hovered, #383838);
|
|
262
|
+
}
|
|
263
|
+
.button[data-appearance=graphite]:focus-visible .icon{
|
|
264
|
+
color:var(--sys-graphite-accent-hovered, #383838);
|
|
265
|
+
}
|
|
266
|
+
.button[data-appearance=graphite]:active{
|
|
267
|
+
border-color:var(--sys-graphite-accent-pressed, #4e4e4e);
|
|
268
|
+
}
|
|
269
|
+
.button[data-appearance=graphite]:active .label{
|
|
270
|
+
color:var(--sys-graphite-accent-pressed, #4e4e4e);
|
|
271
|
+
}
|
|
272
|
+
.button[data-appearance=graphite]:active .icon{
|
|
273
|
+
color:var(--sys-graphite-accent-pressed, #4e4e4e);
|
|
274
|
+
}
|
|
275
|
+
.button[data-appearance=graphite][data-loading]{
|
|
276
|
+
border-color:var(--sys-graphite-accent-pressed, #4e4e4e);
|
|
277
|
+
}
|
|
278
|
+
.button[data-appearance=graphite][data-loading] .label{
|
|
279
|
+
color:var(--sys-graphite-accent-pressed, #4e4e4e);
|
|
280
|
+
}
|
|
281
|
+
.button[data-appearance=graphite][data-loading] .icon{
|
|
282
|
+
color:var(--sys-graphite-accent-pressed, #4e4e4e);
|
|
283
|
+
}
|
|
284
|
+
.button[data-appearance=graphite]:disabled, .button[data-appearance=graphite][data-disabled]{
|
|
285
|
+
border-color:var(--sys-neutral-decor-disabled, #e6e8ef);
|
|
286
|
+
}
|
|
287
|
+
.button[data-appearance=graphite]:disabled .label, .button[data-appearance=graphite][data-disabled] .label{
|
|
288
|
+
color:var(--sys-neutral-text-disabled, #aaaebd);
|
|
289
|
+
}
|
|
290
|
+
.button[data-appearance=graphite]:disabled .icon, .button[data-appearance=graphite][data-disabled] .icon{
|
|
291
|
+
color:var(--sys-neutral-text-disabled, #aaaebd);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
.button[data-appearance=fluorescent-yellow]:focus-visible{
|
|
295
|
+
outline-color:var(--sys-available-complementary, #15151b);
|
|
296
|
+
}
|
|
297
|
+
.button[data-appearance=graphite]:focus-visible{
|
|
298
|
+
outline-color:var(--sys-available-complementary, #15151b);
|
|
299
|
+
}
|
|
300
|
+
.button:focus-visible{
|
|
301
|
+
outline-width:var(--border-state-focus-s-border-width, 2px);
|
|
302
|
+
outline-style:var(--border-state-focus-s-border-style, solid);
|
|
303
|
+
outline-color:var(--border-state-focus-s-border-color, );
|
|
304
|
+
outline-offset:var(--spacing-state-focus-offset, 2px);
|
|
305
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const APPEARANCE: {
|
|
2
|
+
readonly Tertiary: "tertiary";
|
|
3
|
+
readonly Secondary: "secondary";
|
|
4
|
+
};
|
|
5
|
+
export declare const HTML_TYPE: {
|
|
6
|
+
readonly Button: "button";
|
|
7
|
+
readonly Submit: "submit";
|
|
8
|
+
readonly Reset: "reset";
|
|
9
|
+
};
|
|
10
|
+
export declare const TARGET: {
|
|
11
|
+
readonly Blank: "_blank";
|
|
12
|
+
readonly Self: "_self";
|
|
13
|
+
readonly Parent: "_parent";
|
|
14
|
+
readonly Top: "_top";
|
|
15
|
+
};
|
|
16
|
+
export declare const SIZE: {
|
|
17
|
+
readonly Xs: "xs";
|
|
18
|
+
readonly S: "s";
|
|
19
|
+
readonly M: "m";
|
|
20
|
+
readonly L: "l";
|
|
21
|
+
};
|
|
22
|
+
export declare const ICON_POSITION: {
|
|
23
|
+
readonly Before: "before";
|
|
24
|
+
readonly After: "after";
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const APPEARANCE = {
|
|
2
|
+
Tertiary: 'tertiary',
|
|
3
|
+
Secondary: 'secondary',
|
|
4
|
+
};
|
|
5
|
+
export const HTML_TYPE = {
|
|
6
|
+
Button: 'button',
|
|
7
|
+
Submit: 'submit',
|
|
8
|
+
Reset: 'reset',
|
|
9
|
+
};
|
|
10
|
+
export const TARGET = {
|
|
11
|
+
Blank: '_blank',
|
|
12
|
+
Self: '_self',
|
|
13
|
+
Parent: '_parent',
|
|
14
|
+
Top: '_top',
|
|
15
|
+
};
|
|
16
|
+
export const SIZE = {
|
|
17
|
+
Xs: 'xs',
|
|
18
|
+
S: 's',
|
|
19
|
+
M: 'm',
|
|
20
|
+
L: 'l',
|
|
21
|
+
};
|
|
22
|
+
export const ICON_POSITION = {
|
|
23
|
+
Before: 'before',
|
|
24
|
+
After: 'after',
|
|
25
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WithSupportProps } from '@snack-uikit/utils';
|
|
2
|
+
import { CommonButtonProps } from '../../types';
|
|
3
|
+
export type ButtonPrivateProps = WithSupportProps<CommonButtonProps & {
|
|
4
|
+
iconClassName: string;
|
|
5
|
+
labelClassName: string;
|
|
6
|
+
fullWidth?: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const ButtonPrivate: import("react").ForwardRefExoticComponent<{
|
|
9
|
+
'data-test-id'?: string;
|
|
10
|
+
} & import("react").AriaAttributes & import("../../types").AnchorButtonProps & import("../../types").BaseButtonProps & {
|
|
11
|
+
iconClassName: string;
|
|
12
|
+
labelClassName: string;
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
} & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import cn from 'classnames';
|
|
14
|
+
import { forwardRef } from 'react';
|
|
15
|
+
import { extractSupportProps } from '@snack-uikit/utils';
|
|
16
|
+
import { APPEARANCE, HTML_TYPE, ICON_POSITION, TARGET } from '../../constants';
|
|
17
|
+
import { APPEARANCE_TO_COLOR_MAP } from './constants';
|
|
18
|
+
import styles from './styles.module.css';
|
|
19
|
+
import { getChildren, getVariant } from './utils';
|
|
20
|
+
export const ButtonPrivate = forwardRef((_a, ref) => {
|
|
21
|
+
var { className, disabled, href, icon, iconClassName, iconPosition = ICON_POSITION.After, label, labelClassName, loading, onClick, onKeyDown, onFocus, onBlur, size, target = TARGET.Blank, type = HTML_TYPE.Button, appearance = APPEARANCE.Tertiary, tabIndex: tabIndexProp = 0, fullWidth } = _a, rest = __rest(_a, ["className", "disabled", "href", "icon", "iconClassName", "iconPosition", "label", "labelClassName", "loading", "onClick", "onKeyDown", "onFocus", "onBlur", "size", "target", "type", "appearance", "tabIndex", "fullWidth"]);
|
|
22
|
+
const variant = getVariant({ label, iconPosition, icon });
|
|
23
|
+
const children = getChildren({
|
|
24
|
+
icon,
|
|
25
|
+
iconClassName,
|
|
26
|
+
iconPosition,
|
|
27
|
+
label,
|
|
28
|
+
labelClassName,
|
|
29
|
+
loading,
|
|
30
|
+
});
|
|
31
|
+
const tabIndex = loading || disabled ? -1 : tabIndexProp;
|
|
32
|
+
const handleClick = (event) => {
|
|
33
|
+
if (disabled || loading) {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (onClick) {
|
|
38
|
+
onClick(event);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const buttonProps = Object.assign(Object.assign({}, extractSupportProps(rest)), { className: cn(styles.button, className), 'data-disabled': disabled || undefined, 'aria-disabled': disabled || undefined, 'data-loading': loading || undefined, 'data-size': size, 'data-full-width': fullWidth || undefined, 'data-appearance': APPEARANCE_TO_COLOR_MAP[appearance], 'data-variant': variant, onClick: handleClick, onKeyDown,
|
|
42
|
+
onFocus,
|
|
43
|
+
onBlur,
|
|
44
|
+
tabIndex });
|
|
45
|
+
if (href) {
|
|
46
|
+
return (_jsx("a", Object.assign({ role: 'button', href: href, target: target }, buttonProps, { ref: ref, children: children })));
|
|
47
|
+
}
|
|
48
|
+
return (_jsx("button", Object.assign({}, buttonProps, { type: type, ref: ref, children: children })));
|
|
49
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { APPEARANCE } from '../../constants';
|
|
2
|
+
export var Variant;
|
|
3
|
+
(function (Variant) {
|
|
4
|
+
Variant["LabelOnly"] = "label-only";
|
|
5
|
+
Variant["IconOnly"] = "icon-only";
|
|
6
|
+
Variant["IconBefore"] = "icon-before";
|
|
7
|
+
Variant["IconAfter"] = "icon-after";
|
|
8
|
+
})(Variant || (Variant = {}));
|
|
9
|
+
export const APPEARANCE_TO_COLOR_MAP = {
|
|
10
|
+
[APPEARANCE.Tertiary]: 'fluorescent-yellow',
|
|
11
|
+
[APPEARANCE.Secondary]: 'graphite',
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ButtonPrivate';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ButtonPrivate';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.button{
|
|
2
|
+
cursor:pointer;
|
|
3
|
+
position:relative;
|
|
4
|
+
display:inline-flex;
|
|
5
|
+
flex-shrink:0;
|
|
6
|
+
align-items:center;
|
|
7
|
+
justify-content:center;
|
|
8
|
+
box-sizing:border-box;
|
|
9
|
+
width:-moz-max-content;
|
|
10
|
+
width:max-content;
|
|
11
|
+
min-width:-moz-max-content;
|
|
12
|
+
min-width:max-content;
|
|
13
|
+
margin:0;
|
|
14
|
+
padding:0;
|
|
15
|
+
color:transparent;
|
|
16
|
+
text-decoration:none;
|
|
17
|
+
text-transform:none;
|
|
18
|
+
background-color:transparent;
|
|
19
|
+
border:0 solid transparent;
|
|
20
|
+
outline:0;
|
|
21
|
+
outline-offset:0;
|
|
22
|
+
}
|
|
23
|
+
.button[data-full-width]{
|
|
24
|
+
flex-grow:1;
|
|
25
|
+
flex-shrink:1;
|
|
26
|
+
width:100%;
|
|
27
|
+
}
|
|
28
|
+
.button > *{
|
|
29
|
+
cursor:pointer;
|
|
30
|
+
}
|
|
31
|
+
.button:disabled, .button[data-disabled], .button[data-loading]{
|
|
32
|
+
cursor:not-allowed;
|
|
33
|
+
}
|
|
34
|
+
.button:disabled > *, .button[data-disabled] > *, .button[data-loading] > *{
|
|
35
|
+
cursor:not-allowed;
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ButtonPrivateProps } from './ButtonPrivate';
|
|
2
|
+
import { Variant } from './constants';
|
|
3
|
+
type GetVariantProps = Pick<ButtonPrivateProps, 'label' | 'icon' | 'iconPosition'>;
|
|
4
|
+
export declare function getVariant({ label, icon, iconPosition }: GetVariantProps): Variant;
|
|
5
|
+
type GetWrappedIconProps = Pick<ButtonPrivateProps, 'icon' | 'iconClassName' | 'loading'>;
|
|
6
|
+
export declare function getWrappedIcon({ icon, iconClassName, loading }: GetWrappedIconProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
7
|
+
type GetWrappedLabelProps = Pick<ButtonPrivateProps, 'label' | 'labelClassName'>;
|
|
8
|
+
export declare function getWrappedLabel({ label, labelClassName }: GetWrappedLabelProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
9
|
+
type GetChildrenProps = Pick<ButtonPrivateProps, 'icon' | 'label' | 'iconPosition' | 'iconClassName' | 'labelClassName' | 'loading'>;
|
|
10
|
+
export declare function getChildren({ icon, label, iconPosition, iconClassName, labelClassName, loading }: GetChildrenProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Sun } from '@snack-uikit/loaders';
|
|
3
|
+
import { ICON_POSITION } from '../../constants';
|
|
4
|
+
import { Variant } from './constants';
|
|
5
|
+
export function getVariant({ label, icon, iconPosition }) {
|
|
6
|
+
if (label && icon && iconPosition === ICON_POSITION.After) {
|
|
7
|
+
return Variant.IconAfter;
|
|
8
|
+
}
|
|
9
|
+
if (label && icon && iconPosition === ICON_POSITION.Before) {
|
|
10
|
+
return Variant.IconBefore;
|
|
11
|
+
}
|
|
12
|
+
if (label) {
|
|
13
|
+
return Variant.LabelOnly;
|
|
14
|
+
}
|
|
15
|
+
return Variant.IconOnly;
|
|
16
|
+
}
|
|
17
|
+
export function getWrappedIcon({ icon, iconClassName, loading }) {
|
|
18
|
+
if (loading) {
|
|
19
|
+
return (_jsx("span", { "data-test-id": 'loading-icon', className: iconClassName, children: _jsx(Sun, { size: 's' }) }));
|
|
20
|
+
}
|
|
21
|
+
if (icon) {
|
|
22
|
+
return (_jsx("span", { "data-test-id": 'icon', className: iconClassName, children: icon }));
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
export function getWrappedLabel({ label, labelClassName }) {
|
|
27
|
+
return label ? (_jsx("span", { "data-test-id": 'label', className: labelClassName, children: label })) : undefined;
|
|
28
|
+
}
|
|
29
|
+
export function getChildren({ icon, label, iconPosition, iconClassName, labelClassName, loading }) {
|
|
30
|
+
const wrappedIcon = getWrappedIcon({
|
|
31
|
+
icon,
|
|
32
|
+
iconClassName,
|
|
33
|
+
loading,
|
|
34
|
+
});
|
|
35
|
+
const wrappedLabel = getWrappedLabel({
|
|
36
|
+
label,
|
|
37
|
+
labelClassName,
|
|
38
|
+
});
|
|
39
|
+
switch (iconPosition) {
|
|
40
|
+
case ICON_POSITION.Before: {
|
|
41
|
+
return (_jsxs(_Fragment, { children: [wrappedIcon, wrappedLabel] }));
|
|
42
|
+
}
|
|
43
|
+
case ICON_POSITION.After:
|
|
44
|
+
default: {
|
|
45
|
+
return (_jsxs(_Fragment, { children: [wrappedLabel, wrappedIcon] }));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ButtonPrivate';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ButtonPrivate';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type UseValueControl<TValue> = {
|
|
2
|
+
value?: TValue;
|
|
3
|
+
onChange?(value: TValue): void;
|
|
4
|
+
defaultValue?: TValue;
|
|
5
|
+
};
|
|
6
|
+
export declare function useValueControl<TValue>({ value, onChange, defaultValue }: UseValueControl<TValue>): readonly [TValue | undefined, (value: any, ...args: any[]) => any];
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useUncontrolledProp } from 'uncontrollable';
|
|
2
|
+
export function useValueControl({ value, onChange, defaultValue }) {
|
|
3
|
+
return useUncontrolledProp(value, defaultValue, (newValue) => {
|
|
4
|
+
const newState = typeof newValue === 'function' ? newValue(value) : newValue;
|
|
5
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newState);
|
|
6
|
+
});
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
File without changes
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AnchorHTMLAttributes, ButtonHTMLAttributes, FocusEventHandler, KeyboardEventHandler, MouseEventHandler, ReactElement } from 'react';
|
|
2
|
+
import { ValueOf } from '@snack-uikit/utils';
|
|
3
|
+
import { APPEARANCE, ICON_POSITION, SIZE } from './constants';
|
|
4
|
+
export type Appearance = ValueOf<typeof APPEARANCE>;
|
|
5
|
+
export type IconPosition = ValueOf<typeof ICON_POSITION>;
|
|
6
|
+
export type Size = ValueOf<typeof SIZE>;
|
|
7
|
+
export type BaseButtonProps = {
|
|
8
|
+
/** CSS-класс */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Флаг неактивности компонента */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Иконка
|
|
14
|
+
* @type ReactElement
|
|
15
|
+
*/
|
|
16
|
+
icon?: ReactElement;
|
|
17
|
+
/** Позиция иконки */
|
|
18
|
+
iconPosition?: IconPosition;
|
|
19
|
+
/** Текст кнопки */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** Флаг состояния загрузки */
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
/** Колбек обработки клика */
|
|
24
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
25
|
+
/** Колбек обработки нажатия клавиши */
|
|
26
|
+
onKeyDown?: KeyboardEventHandler<HTMLElement>;
|
|
27
|
+
/** Колбек обработки фокуса */
|
|
28
|
+
onFocus?: FocusEventHandler<HTMLAnchorElement | HTMLButtonElement>;
|
|
29
|
+
/** Колбек обработки блюра */
|
|
30
|
+
onBlur?: FocusEventHandler<HTMLAnchorElement | HTMLButtonElement>;
|
|
31
|
+
/** Размер */
|
|
32
|
+
size?: Size;
|
|
33
|
+
/** Внешний вид кнопки */
|
|
34
|
+
appearance?: Appearance;
|
|
35
|
+
/** HTML-аттрибут type */
|
|
36
|
+
type?: ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
37
|
+
/** HTML-аттрибут tab-index */
|
|
38
|
+
tabIndex?: number;
|
|
39
|
+
/** Сделать кнопку во всю ширину */
|
|
40
|
+
fullWidth?: boolean;
|
|
41
|
+
};
|
|
42
|
+
export type AnchorButtonProps = {
|
|
43
|
+
/** Ссылка */
|
|
44
|
+
href?: string;
|
|
45
|
+
/** HTML-аттрибут target */
|
|
46
|
+
target?: AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
47
|
+
};
|
|
48
|
+
export type CommonButtonProps = AnchorButtonProps & BaseButtonProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CommonButtonProps } from './types';
|
|
2
|
+
export declare function extractCommonButtonProps({ disabled, href, icon, label, loading, onClick, onFocus, onBlur, onKeyDown, }: CommonButtonProps): {
|
|
3
|
+
disabled: boolean | undefined;
|
|
4
|
+
href: string | undefined;
|
|
5
|
+
icon: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
6
|
+
label: string | undefined;
|
|
7
|
+
loading: boolean | undefined;
|
|
8
|
+
onClick: import("react").MouseEventHandler<HTMLElement> | undefined;
|
|
9
|
+
onKeyDown: import("react").KeyboardEventHandler<HTMLElement> | undefined;
|
|
10
|
+
onFocus: import("react").FocusEventHandler<HTMLAnchorElement | HTMLButtonElement> | undefined;
|
|
11
|
+
onBlur: import("react").FocusEventHandler<HTMLAnchorElement | HTMLButtonElement> | undefined;
|
|
12
|
+
};
|