@moises.ai/design-system 4.21.13 → 4.21.15
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 +2125 -2108
- package/package.json +1 -1
- package/src/components/Button/Button.module.css +135 -134
- package/src/components/InstrumentSelect/InstrumentSelect.jsx +32 -10
- package/src/components/InstrumentSelect/InstrumentSelect.module.css +20 -1
- package/src/components/InstrumentSelect/InstrumentSelect.stories.jsx +33 -0
package/package.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
.button {
|
|
2
|
-
|
|
2
|
+
box-shadow: none;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
.button:focus-visible:not(.disabled):not(.loading) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
outline: 2px solid var(--neutral-alpha-8);
|
|
7
|
+
outline-offset: 2px;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.size1 {
|
|
11
|
-
|
|
11
|
+
border-radius: 4px;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.size2 {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
border-radius: 6px;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.size3 {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
font-size: 16px;
|
|
21
|
+
border-radius: 8px;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.size4 {
|
|
25
|
-
|
|
25
|
+
border-radius: 12px;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.solid.disabled,
|
|
28
|
+
.solid.disabled,
|
|
29
29
|
.solid.loading,
|
|
30
30
|
.soft.disabled,
|
|
31
31
|
.soft.loading {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
background-color: var(--neutral-alpha-3) !important;
|
|
33
|
+
color: var(--neutral-alpha-8) !important;
|
|
34
|
+
cursor: default;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.surface.disabled,
|
|
38
38
|
.surface.loading {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
background-color: var(--neutral-alpha-2) !important;
|
|
40
|
+
border: 1px solid var(--neutral-alpha-6) !important;
|
|
41
|
+
cursor: default;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.ghost.disabled,
|
|
45
45
|
.ghost.loading {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
background-color: transparent !important;
|
|
47
|
+
color: var(--neutral-alpha-8) !important;
|
|
48
|
+
cursor: default;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
.solid.disabled:hover,
|
|
51
|
+
.solid.disabled:hover,
|
|
52
52
|
.solid.disabled:active,
|
|
53
53
|
.solid.loading:hover,
|
|
54
54
|
.solid.loading:active,
|
|
@@ -56,284 +56,285 @@
|
|
|
56
56
|
.soft.disabled:active,
|
|
57
57
|
.soft.loading:hover,
|
|
58
58
|
.soft.loading:active {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
background-color: var(--neutral-alpha-3) !important;
|
|
60
|
+
color: var(--neutral-alpha-8) !important;
|
|
61
|
+
cursor: default;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
.surface.disabled:hover,
|
|
65
65
|
.surface.disabled:active,
|
|
66
66
|
.surface.loading:hover,
|
|
67
67
|
.surface.loading:active {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
background-color: var(--neutral-alpha-2) !important;
|
|
69
|
+
border: 1px solid var(--neutral-alpha-6) !important;
|
|
70
|
+
cursor: default;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
.ghost.disabled:hover,
|
|
74
74
|
.ghost.disabled:active,
|
|
75
75
|
.ghost.loading:hover,
|
|
76
76
|
.ghost.loading:active {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
background-color: transparent !important;
|
|
78
|
+
color: var(--neutral-alpha-8) !important;
|
|
79
|
+
cursor: default;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
.solid.cyan {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
background-color: var(--aqua-9);
|
|
84
|
+
color: var(--aqua-1);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
.solid.cyan:hover:not(.disabled):not(.loading) {
|
|
88
|
-
|
|
88
|
+
background-color: var(--aqua-10);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
.solid.cyan.highContrast {
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
background-color: var(--aqua-12);
|
|
93
|
+
color: var(--neutral-1);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
.solid.cyan.highContrast:hover:not(.disabled):not(.loading) {
|
|
97
|
-
|
|
97
|
+
opacity: 0.88;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
.solid.cyan.highContrast:active:not(.disabled):not(.loading) {
|
|
101
|
-
|
|
101
|
+
opacity: 0.82;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
.solid.gray,
|
|
105
|
-
.solid.gray.highContrast
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
.solid.gray.highContrast {
|
|
106
|
+
background-color: var(--neutral-12);
|
|
107
|
+
color: var(--neutral-1);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
.solid.gray:hover:not(.disabled):not(.loading),
|
|
111
111
|
.solid.gray.highContrast:hover:not(.disabled):not(.loading) {
|
|
112
|
-
|
|
112
|
+
opacity: 0.88;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
.solid.red {
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
background-color: var(--red-9);
|
|
117
|
+
color: var(--neutral-12);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
.solid.red:hover:not(.disabled):not(.loading) {
|
|
121
|
-
|
|
121
|
+
background-color: var(--red-10);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
.solid.red.highContrast {
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
background-color: var(--red-12);
|
|
126
|
+
color: var(--red-1);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
.solid.red.highContrast:hover:not(.disabled):not(.loading) {
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
.solid.red.highContrast:hover:not(.disabled):not(.loading) {
|
|
130
|
+
background-color: var(--red-12);
|
|
131
|
+
opacity: 0.88;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
.solid.red.highContrast:active:not(.disabled):not(.loading) {
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
background-color: var(--red-12);
|
|
136
|
+
opacity: 0.82;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
.soft.gray {
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
.soft.gray {
|
|
140
|
+
background-color: var(--neutral-alpha-3);
|
|
141
|
+
color: var(--neutral-11);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
.soft.gray:hover:not(.disabled):not(.loading) {
|
|
145
|
-
|
|
145
|
+
background-color: var(--neutral-alpha-4);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
.soft.gray:active:not(.disabled):not(.loading) {
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
background-color: var(--neutral-alpha-5);
|
|
150
|
+
opacity: 0.92;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
.soft.gray.highContrast {
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
background-color: var(--neutral-alpha-3);
|
|
155
|
+
color: var(--neutral-12);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
.soft.gray.highContrast:hover:not(.disabled):not(.loading) {
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
background-color: var(--neutral-alpha-4);
|
|
160
|
+
opacity: 0.88;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
.soft.gray.highContrast:active:not(.disabled):not(.loading) {
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
background-color: var(--neutral-alpha-5);
|
|
165
|
+
opacity: 0.82;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
.surface.gray {
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
color: var(--neutral-11);
|
|
170
|
+
border: 1px solid var(--neutral-alpha-7);
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
.surface.gray:hover:not(.disabled):not(.loading) {
|
|
174
|
-
|
|
174
|
+
border: 1px solid var(--neutral-alpha-8);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
.surface.gray:active:not(.disabled):not(.loading) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
background-color: var(--neutral-alpha-3);
|
|
179
|
+
border: 1px solid var(--neutral-alpha-8);
|
|
180
|
+
opacity: 0.92;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
.surface.gray.highContrast {
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
color: var(--neutral-12);
|
|
185
|
+
border: 1px solid var(--neutral-alpha-7);
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
.surface.gray.highContrast:hover:not(.disabled):not(.loading) {
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
border: 1px solid var(--neutral-alpha-8);
|
|
190
|
+
opacity: 0.88;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
.surface.gray.highContrast:active:not(.disabled):not(.loading) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
background-color: var(--neutral-alpha-3);
|
|
195
|
+
border: 1px solid var(--neutral-alpha-8);
|
|
196
|
+
opacity: 0.82;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
.ghost {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
200
|
+
background-color: transparent;
|
|
201
|
+
margin: 0;
|
|
202
|
+
padding: 0;
|
|
203
|
+
border-radius: 0;
|
|
204
|
+
box-sizing: revert !important;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
.ghost.cyan {
|
|
208
|
-
|
|
208
|
+
color: var(--aqua-alpha-11);
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
.ghost.cyan:hover:not(.disabled):not(.loading) {
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
/* background-color: var(--aqua-alpha-2) !important; */
|
|
213
|
+
/* border-radius: max(var(--radius-2), var(--radius-full)); */
|
|
214
|
+
color: var(--aqua-alpha-12);
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
.ghost.cyan:active:not(.disabled):not(.loading) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
/* background-color: var(--aqua-alpha-3) !important; */
|
|
219
|
+
color: var(--aqua-alpha-8);
|
|
220
|
+
/* border-radius: max(var(--radius-2), var(--radius-full)); */
|
|
221
|
+
/* opacity: 0.92; */
|
|
220
222
|
}
|
|
221
223
|
|
|
222
224
|
.ghost.cyan.highContrast {
|
|
223
|
-
|
|
225
|
+
color: var(--aqua-12);
|
|
224
226
|
}
|
|
225
227
|
|
|
226
228
|
.ghost.cyan.highContrast:hover:not(.disabled):not(.loading) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
229
|
+
background-color: var(--aqua-alpha-2) !important;
|
|
230
|
+
border-radius: max(var(--radius-2), var(--radius-full));
|
|
231
|
+
opacity: 0.88;
|
|
230
232
|
}
|
|
231
233
|
|
|
232
234
|
.ghost.cyan.highContrast:active:not(.disabled):not(.loading) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
235
|
+
background-color: var(--aqua-alpha-3) !important;
|
|
236
|
+
border-radius: max(var(--radius-2), var(--radius-full));
|
|
237
|
+
opacity: 0.82;
|
|
236
238
|
}
|
|
237
239
|
|
|
238
240
|
.ghost.gray {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
+
color: var(--neutral-11);
|
|
242
|
+
background-color: transparent;
|
|
241
243
|
}
|
|
242
244
|
|
|
243
245
|
.ghost.gray:hover:not(.disabled):not(.loading) {
|
|
244
|
-
|
|
246
|
+
color: var(--neutral-12);
|
|
245
247
|
}
|
|
246
248
|
|
|
247
249
|
.ghost.gray:active:not(.disabled):not(.loading) {
|
|
248
|
-
|
|
250
|
+
color: var(--neutral-11);
|
|
249
251
|
}
|
|
250
252
|
|
|
251
253
|
.ghost.gray.highContrast,
|
|
252
254
|
.ghost.gray.highContrast:hover:not(.disabled):not(.loading) {
|
|
253
|
-
|
|
255
|
+
color: var(--neutral-12);
|
|
254
256
|
}
|
|
255
257
|
|
|
256
258
|
.ghost.gray.highContrast:active:not(.disabled):not(.loading) {
|
|
257
|
-
|
|
259
|
+
color: var(--neutral-11);
|
|
258
260
|
}
|
|
259
261
|
|
|
260
262
|
.ghost.red {
|
|
261
|
-
|
|
263
|
+
color: var(--red-11);
|
|
262
264
|
}
|
|
263
265
|
|
|
264
266
|
.ghost.red:hover:not(.disabled):not(.loading) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
+
background-color: var(--red-alpha-2) !important;
|
|
268
|
+
border-radius: max(var(--radius-2), var(--radius-full));
|
|
267
269
|
}
|
|
268
270
|
|
|
269
271
|
.ghost.red:active:not(.disabled):not(.loading) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
background-color: var(--red-alpha-3) !important;
|
|
273
|
+
border-radius: max(var(--radius-2), var(--radius-full));
|
|
274
|
+
opacity: 0.92;
|
|
273
275
|
}
|
|
274
276
|
|
|
275
277
|
.ghost.red.highContrast {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
+
background-color: transparent;
|
|
279
|
+
color: var(--red-12);
|
|
278
280
|
}
|
|
279
281
|
|
|
280
282
|
.ghost.red.highContrast:hover:not(.disabled):not(.loading) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
283
|
+
background-color: var(--red-alpha-2) !important;
|
|
284
|
+
border-radius: max(var(--radius-2), var(--radius-full));
|
|
285
|
+
opacity: 0.88;
|
|
284
286
|
}
|
|
285
287
|
|
|
286
288
|
.ghost.red.highContrast:active:not(.disabled):not(.loading) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
289
|
+
background-color: var(--red-alpha-3) !important;
|
|
290
|
+
border-radius: max(var(--radius-2), var(--radius-full));
|
|
291
|
+
opacity: 0.82;
|
|
290
292
|
}
|
|
291
293
|
|
|
292
294
|
.ghost.size1 {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
+
padding: 4px 8px;
|
|
296
|
+
border-radius: 4px;
|
|
295
297
|
}
|
|
296
298
|
|
|
297
299
|
.ghost.size2 {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
+
padding: 6px 12px;
|
|
301
|
+
border-radius: 6px;
|
|
300
302
|
}
|
|
301
303
|
|
|
302
304
|
.ghost.size3 {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
+
padding: 10px 16px;
|
|
306
|
+
border-radius: 8px;
|
|
305
307
|
}
|
|
306
308
|
|
|
307
309
|
.ghost.size4 {
|
|
308
|
-
|
|
310
|
+
border-radius: 12px;
|
|
309
311
|
}
|
|
310
312
|
|
|
311
313
|
.hasRightSlot {
|
|
312
|
-
|
|
314
|
+
position: relative;
|
|
313
315
|
}
|
|
314
316
|
|
|
315
317
|
.label {
|
|
316
|
-
|
|
318
|
+
min-width: 0;
|
|
317
319
|
}
|
|
318
320
|
|
|
319
321
|
.rightSlot {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
322
|
+
position: absolute;
|
|
323
|
+
top: 50%;
|
|
324
|
+
right: 12px;
|
|
325
|
+
transform: translateY(-50%);
|
|
326
|
+
display: flex;
|
|
327
|
+
align-items: center;
|
|
328
|
+
gap: 8px;
|
|
329
|
+
flex-shrink: 0;
|
|
330
|
+
line-height: 1;
|
|
329
331
|
}
|
|
330
332
|
|
|
331
333
|
.hasRightSlot.size1 .rightSlot {
|
|
332
|
-
|
|
334
|
+
right: 8px;
|
|
333
335
|
}
|
|
334
336
|
|
|
335
337
|
.hasRightSlot.size3 .rightSlot,
|
|
336
338
|
.hasRightSlot.size4 .rightSlot {
|
|
337
|
-
|
|
339
|
+
right: 16px;
|
|
338
340
|
}
|
|
339
|
-
|
|
@@ -37,6 +37,7 @@ import styles from './InstrumentSelect.module.css'
|
|
|
37
37
|
* @property {number} [rows] - Vertical only. How many rows to fill before starting another column. Defaults to one column (every item on its own row).
|
|
38
38
|
* @property {'neutral' | 'cyan'} [variant='neutral'] - Visual variant. `neutral` is the default bordered card. `cyan` uses the accent-tinted background and selection border.
|
|
39
39
|
* @property {'small' | 'medium' | 'large'} [size='small'] - Card size. `small` is the compact horizontal card. `medium` is the 64px vertical card. `large` is the 148×80 vertical card.
|
|
40
|
+
* @property {'fixed' | 'fill'} [fit='fixed'] - `fixed` keeps medium and large at their designed width. `fill` stretches each card so a row of `columns` occupies the full container, the same way `small` does.
|
|
40
41
|
* @property {string} [className]
|
|
41
42
|
*/
|
|
42
43
|
|
|
@@ -54,7 +55,9 @@ function isItemSelected(value, itemValue) {
|
|
|
54
55
|
return value === itemValue
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
function gridGap(size) {
|
|
59
|
+
return size === 'medium' || size === 'large' ? 6 : 4
|
|
60
|
+
}
|
|
58
61
|
|
|
59
62
|
const TRACK_MIN = {
|
|
60
63
|
small: 140,
|
|
@@ -84,35 +87,49 @@ function resolveColumns(columns) {
|
|
|
84
87
|
*
|
|
85
88
|
* Vertical fills `rows` rows top to bottom, then starts the next column.
|
|
86
89
|
*/
|
|
87
|
-
function getGridStyle(orientation, size, columns, rows, itemCount) {
|
|
90
|
+
function getGridStyle(orientation, size, columns, rows, itemCount, fit) {
|
|
88
91
|
const min = TRACK_MIN[size] ?? TRACK_MIN.small
|
|
89
|
-
const
|
|
92
|
+
const fill = fit === 'fill' || size === 'small'
|
|
93
|
+
const max = fill ? undefined : TRACK_MAX[size]
|
|
94
|
+
const gap = gridGap(size)
|
|
90
95
|
const gaps = Math.max(columns - 1, 0)
|
|
91
|
-
const share = `calc((100% - ${
|
|
96
|
+
const share = `calc((100% - ${gap}px * ${gaps}) / ${columns})`
|
|
92
97
|
|
|
93
98
|
if (orientation === 'vertical') {
|
|
94
99
|
const rowCount = Math.max(rows ?? itemCount, 1)
|
|
95
100
|
return {
|
|
96
101
|
display: 'grid',
|
|
102
|
+
gap,
|
|
97
103
|
gridAutoFlow: 'column',
|
|
98
104
|
gridTemplateRows: `repeat(${rowCount}, auto)`,
|
|
99
105
|
gridTemplateColumns: 'unset',
|
|
100
106
|
gridAutoColumns: max ? `minmax(${min}px, ${max}px)` : `minmax(${min}px, 1fr)`,
|
|
101
107
|
justifyContent: 'start',
|
|
102
|
-
width: 'max-content',
|
|
108
|
+
width: fill ? '100%' : 'max-content',
|
|
103
109
|
maxWidth: '100%',
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
112
|
|
|
113
|
+
if (fill) {
|
|
114
|
+
return {
|
|
115
|
+
display: 'grid',
|
|
116
|
+
gap,
|
|
117
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(max(${min}px, ${share}), 1fr))`,
|
|
118
|
+
justifyContent: 'stretch',
|
|
119
|
+
width: '100%',
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
107
123
|
return {
|
|
108
124
|
'--track-min': `${min}px`,
|
|
109
|
-
'--track-max':
|
|
125
|
+
'--track-max': `${max}px`,
|
|
110
126
|
display: 'flex',
|
|
111
127
|
flexWrap: 'wrap',
|
|
112
128
|
alignItems: 'stretch',
|
|
113
129
|
justifyContent: 'flex-start',
|
|
130
|
+
gap,
|
|
114
131
|
width: '100%',
|
|
115
|
-
maxWidth:
|
|
132
|
+
maxWidth: `calc(${max}px * ${columns} + ${gap}px * ${gaps})`,
|
|
116
133
|
}
|
|
117
134
|
}
|
|
118
135
|
|
|
@@ -127,7 +144,8 @@ function getGridStyle(orientation, size, columns, rows, itemCount) {
|
|
|
127
144
|
*
|
|
128
145
|
* Layout: horizontal by default, at most `columns` items per row (2). When the row cannot
|
|
129
146
|
* fit that many cards, the rest wrap onto the next line. Vertical fills `rows` rows down
|
|
130
|
-
* each column before starting the next one. Gap is 4px
|
|
147
|
+
* each column before starting the next one. Gap is 4px for `small` and 6px for `medium`
|
|
148
|
+
* and `large`. `fit="fill"` stretches medium and large cards across the row.
|
|
131
149
|
*
|
|
132
150
|
* @example
|
|
133
151
|
* // Single select
|
|
@@ -169,6 +187,7 @@ export const InstrumentSelect = forwardRef(function InstrumentSelect(
|
|
|
169
187
|
orientation = 'horizontal',
|
|
170
188
|
variant = 'neutral',
|
|
171
189
|
size = 'small',
|
|
190
|
+
fit = 'fixed',
|
|
172
191
|
className,
|
|
173
192
|
...props
|
|
174
193
|
},
|
|
@@ -178,9 +197,11 @@ export const InstrumentSelect = forwardRef(function InstrumentSelect(
|
|
|
178
197
|
|
|
179
198
|
const cols = useMemo(() => resolveColumns(columns), [columns])
|
|
180
199
|
|
|
200
|
+
const fill = fit === 'fill' || size === 'small'
|
|
201
|
+
|
|
181
202
|
const gridStyle = useMemo(
|
|
182
|
-
() => getGridStyle(orientation, size, cols, rows, items.length),
|
|
183
|
-
[orientation, size, cols, rows, items.length],
|
|
203
|
+
() => getGridStyle(orientation, size, cols, rows, items.length, fit),
|
|
204
|
+
[orientation, size, cols, rows, items.length, fit],
|
|
184
205
|
)
|
|
185
206
|
|
|
186
207
|
return (
|
|
@@ -201,6 +222,7 @@ export const InstrumentSelect = forwardRef(function InstrumentSelect(
|
|
|
201
222
|
<div
|
|
202
223
|
className={styles.grid}
|
|
203
224
|
data-orientation={orientation}
|
|
225
|
+
data-fit={fill ? 'fill' : 'fixed'}
|
|
204
226
|
style={gridStyle}
|
|
205
227
|
role="group"
|
|
206
228
|
aria-label={title}
|
|
@@ -52,6 +52,12 @@
|
|
|
52
52
|
max-width: var(--track-max, 100%);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
.grid[data-fit="fill"] > .card {
|
|
56
|
+
width: 100%;
|
|
57
|
+
min-width: 0;
|
|
58
|
+
max-width: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
55
61
|
/* ----- Card ----- */
|
|
56
62
|
|
|
57
63
|
.card {
|
|
@@ -243,6 +249,19 @@
|
|
|
243
249
|
width: auto;
|
|
244
250
|
max-width: 100%;
|
|
245
251
|
margin-right: 0;
|
|
252
|
+
font-weight: 500;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.card[data-size="large"] .cardText {
|
|
256
|
+
display: -webkit-box;
|
|
257
|
+
flex: 1 1 auto;
|
|
258
|
+
min-width: 0;
|
|
259
|
+
width: auto;
|
|
260
|
+
white-space: normal;
|
|
261
|
+
overflow-wrap: anywhere;
|
|
262
|
+
-webkit-box-orient: vertical;
|
|
263
|
+
-webkit-line-clamp: 2;
|
|
264
|
+
line-clamp: 2;
|
|
246
265
|
}
|
|
247
266
|
|
|
248
267
|
.cardBadge {
|
|
@@ -363,7 +382,7 @@
|
|
|
363
382
|
.card[data-variant="cyan"][data-state="disabled-checked"] .cardIcon,
|
|
364
383
|
.card[data-variant="cyan"][data-state="disabled"]:hover .cardIcon,
|
|
365
384
|
.card[data-variant="cyan"][data-state="disabled-checked"]:hover .cardIcon {
|
|
366
|
-
color: var(--
|
|
385
|
+
color: var(--neutral-alpha-10);
|
|
367
386
|
}
|
|
368
387
|
|
|
369
388
|
.card[data-variant="cyan"][data-state="disabled"] .cardText,
|
|
@@ -55,12 +55,14 @@ export default {
|
|
|
55
55
|
tooltip: { control: 'text' },
|
|
56
56
|
variant: { control: 'select', options: ['neutral', 'cyan'] },
|
|
57
57
|
size: { control: 'select', options: ['small', 'medium', 'large'] },
|
|
58
|
+
fit: { control: 'select', options: ['fixed', 'fill'] },
|
|
58
59
|
},
|
|
59
60
|
args: {
|
|
60
61
|
variant: 'neutral',
|
|
61
62
|
size: 'small',
|
|
62
63
|
orientation: 'horizontal',
|
|
63
64
|
columns: 2,
|
|
65
|
+
fit: 'fixed',
|
|
64
66
|
},
|
|
65
67
|
decorators: [
|
|
66
68
|
(Story, context) => (
|
|
@@ -305,6 +307,37 @@ export const Large = {
|
|
|
305
307
|
},
|
|
306
308
|
}
|
|
307
309
|
|
|
310
|
+
export const MediumFill = {
|
|
311
|
+
render: verticalStory(['vocals']),
|
|
312
|
+
args: {
|
|
313
|
+
variant: 'cyan',
|
|
314
|
+
size: 'medium',
|
|
315
|
+
fit: 'fill',
|
|
316
|
+
columns: 2,
|
|
317
|
+
items: INSTRUMENTS.slice(0, 4),
|
|
318
|
+
},
|
|
319
|
+
parameters: {
|
|
320
|
+
containerWidth: 500,
|
|
321
|
+
},
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export const LargeTextWrap = {
|
|
325
|
+
render: verticalStory(['long']),
|
|
326
|
+
args: {
|
|
327
|
+
variant: 'cyan',
|
|
328
|
+
size: 'large',
|
|
329
|
+
columns: 2,
|
|
330
|
+
items: [
|
|
331
|
+
{
|
|
332
|
+
value: 'long',
|
|
333
|
+
text: 'Dialogue, Soundtrack & Effects Extra',
|
|
334
|
+
Icon: VocalIcon,
|
|
335
|
+
},
|
|
336
|
+
{ value: 'bass', text: 'Bass', Icon: BassIcon, disabled: true },
|
|
337
|
+
],
|
|
338
|
+
},
|
|
339
|
+
}
|
|
340
|
+
|
|
308
341
|
/* ---------- Columns ---------- */
|
|
309
342
|
|
|
310
343
|
export const OneColumn = {
|