@moises.ai/design-system 4.21.14 → 4.21.16
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 +1394 -1386
- package/package.json +1 -1
- package/src/components/Button/Button.module.css +135 -134
- package/src/components/InstrumentSelect/InstrumentSelect.jsx +29 -12
- package/src/components/InstrumentSelect/InstrumentSelect.module.css +26 -5
- package/src/components/InstrumentSelect/InstrumentSelect.stories.jsx +33 -0
- package/src/components/InstrumentSelect/InstrumentSelectCard.jsx +1 -1
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
|
-
|
|
@@ -36,7 +36,8 @@ import styles from './InstrumentSelect.module.css'
|
|
|
36
36
|
* @property {number | { initial?: string | number, sm?: string | number, md?: string | number, lg?: string | number }} [columns=2] - Horizontal only. Maximum items per row. If the container cannot fit that many at the card's minimum width, the extras wrap onto the next row.
|
|
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
|
-
* @property {'small' | 'medium' | 'large'} [size='small'] - Card size. `small` is the compact horizontal card. `medium` is the 64px vertical card. `large` is the
|
|
39
|
+
* @property {'small' | 'medium' | 'large'} [size='small'] - Card size. `small` is the compact horizontal card. `medium` is the 64px vertical card (min 150px). `large` is the 160×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
|
|
|
@@ -60,13 +61,13 @@ function gridGap(size) {
|
|
|
60
61
|
|
|
61
62
|
const TRACK_MIN = {
|
|
62
63
|
small: 140,
|
|
63
|
-
medium:
|
|
64
|
-
large:
|
|
64
|
+
medium: 150,
|
|
65
|
+
large: 160,
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
const TRACK_MAX = {
|
|
68
69
|
medium: 160,
|
|
69
|
-
large:
|
|
70
|
+
large: 160,
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
function resolveColumns(columns) {
|
|
@@ -86,9 +87,10 @@ function resolveColumns(columns) {
|
|
|
86
87
|
*
|
|
87
88
|
* Vertical fills `rows` rows top to bottom, then starts the next column.
|
|
88
89
|
*/
|
|
89
|
-
function getGridStyle(orientation, size, columns, rows, itemCount) {
|
|
90
|
+
function getGridStyle(orientation, size, columns, rows, itemCount, fit) {
|
|
90
91
|
const min = TRACK_MIN[size] ?? TRACK_MIN.small
|
|
91
|
-
const
|
|
92
|
+
const fill = fit === 'fill' || size === 'small'
|
|
93
|
+
const max = fill ? undefined : TRACK_MAX[size]
|
|
92
94
|
const gap = gridGap(size)
|
|
93
95
|
const gaps = Math.max(columns - 1, 0)
|
|
94
96
|
const share = `calc((100% - ${gap}px * ${gaps}) / ${columns})`
|
|
@@ -103,21 +105,31 @@ function getGridStyle(orientation, size, columns, rows, itemCount) {
|
|
|
103
105
|
gridTemplateColumns: 'unset',
|
|
104
106
|
gridAutoColumns: max ? `minmax(${min}px, ${max}px)` : `minmax(${min}px, 1fr)`,
|
|
105
107
|
justifyContent: 'start',
|
|
106
|
-
width: 'max-content',
|
|
108
|
+
width: fill ? '100%' : 'max-content',
|
|
107
109
|
maxWidth: '100%',
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
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
|
+
|
|
111
123
|
return {
|
|
112
124
|
'--track-min': `${min}px`,
|
|
113
|
-
'--track-max':
|
|
125
|
+
'--track-max': `${max}px`,
|
|
114
126
|
display: 'flex',
|
|
115
127
|
flexWrap: 'wrap',
|
|
116
128
|
alignItems: 'stretch',
|
|
117
129
|
justifyContent: 'flex-start',
|
|
118
130
|
gap,
|
|
119
131
|
width: '100%',
|
|
120
|
-
maxWidth:
|
|
132
|
+
maxWidth: `calc(${max}px * ${columns} + ${gap}px * ${gaps})`,
|
|
121
133
|
}
|
|
122
134
|
}
|
|
123
135
|
|
|
@@ -132,7 +144,8 @@ function getGridStyle(orientation, size, columns, rows, itemCount) {
|
|
|
132
144
|
*
|
|
133
145
|
* Layout: horizontal by default, at most `columns` items per row (2). When the row cannot
|
|
134
146
|
* fit that many cards, the rest wrap onto the next line. Vertical fills `rows` rows down
|
|
135
|
-
* 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.
|
|
136
149
|
*
|
|
137
150
|
* @example
|
|
138
151
|
* // Single select
|
|
@@ -174,6 +187,7 @@ export const InstrumentSelect = forwardRef(function InstrumentSelect(
|
|
|
174
187
|
orientation = 'horizontal',
|
|
175
188
|
variant = 'neutral',
|
|
176
189
|
size = 'small',
|
|
190
|
+
fit = 'fixed',
|
|
177
191
|
className,
|
|
178
192
|
...props
|
|
179
193
|
},
|
|
@@ -183,9 +197,11 @@ export const InstrumentSelect = forwardRef(function InstrumentSelect(
|
|
|
183
197
|
|
|
184
198
|
const cols = useMemo(() => resolveColumns(columns), [columns])
|
|
185
199
|
|
|
200
|
+
const fill = fit === 'fill' || size === 'small'
|
|
201
|
+
|
|
186
202
|
const gridStyle = useMemo(
|
|
187
|
-
() => getGridStyle(orientation, size, cols, rows, items.length),
|
|
188
|
-
[orientation, size, cols, rows, items.length],
|
|
203
|
+
() => getGridStyle(orientation, size, cols, rows, items.length, fit),
|
|
204
|
+
[orientation, size, cols, rows, items.length, fit],
|
|
189
205
|
)
|
|
190
206
|
|
|
191
207
|
return (
|
|
@@ -206,6 +222,7 @@ export const InstrumentSelect = forwardRef(function InstrumentSelect(
|
|
|
206
222
|
<div
|
|
207
223
|
className={styles.grid}
|
|
208
224
|
data-orientation={orientation}
|
|
225
|
+
data-fit={fill ? 'fill' : 'fixed'}
|
|
209
226
|
style={gridStyle}
|
|
210
227
|
role="group"
|
|
211
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 {
|
|
@@ -191,9 +197,6 @@
|
|
|
191
197
|
.card[data-size="medium"],
|
|
192
198
|
.card[data-size="large"] {
|
|
193
199
|
display: flex;
|
|
194
|
-
min-width: 148px;
|
|
195
|
-
max-width: 160px;
|
|
196
|
-
|
|
197
200
|
flex-direction: column;
|
|
198
201
|
justify-content: space-between;
|
|
199
202
|
align-items: flex-start;
|
|
@@ -213,11 +216,15 @@
|
|
|
213
216
|
.card[data-size="medium"] {
|
|
214
217
|
height: 64px;
|
|
215
218
|
flex: 1 0 0;
|
|
219
|
+
min-width: 150px;
|
|
220
|
+
max-width: 160px;
|
|
216
221
|
}
|
|
217
222
|
|
|
218
223
|
.card[data-size="large"] {
|
|
219
|
-
width:
|
|
224
|
+
width: 160px;
|
|
220
225
|
height: 80px;
|
|
226
|
+
min-width: 160px;
|
|
227
|
+
max-width: 160px;
|
|
221
228
|
}
|
|
222
229
|
|
|
223
230
|
.cardTop,
|
|
@@ -235,6 +242,7 @@
|
|
|
235
242
|
.cardBottom {
|
|
236
243
|
justify-content: space-between;
|
|
237
244
|
gap: 4px;
|
|
245
|
+
align-items: flex-end;
|
|
238
246
|
}
|
|
239
247
|
|
|
240
248
|
.card[data-size="medium"] .cardText,
|
|
@@ -246,6 +254,18 @@
|
|
|
246
254
|
font-weight: 500;
|
|
247
255
|
}
|
|
248
256
|
|
|
257
|
+
.card[data-size="large"] .cardText {
|
|
258
|
+
display: -webkit-box;
|
|
259
|
+
flex: 1 1 auto;
|
|
260
|
+
min-width: 0;
|
|
261
|
+
width: auto;
|
|
262
|
+
white-space: normal;
|
|
263
|
+
overflow-wrap: anywhere;
|
|
264
|
+
-webkit-box-orient: vertical;
|
|
265
|
+
-webkit-line-clamp: 2;
|
|
266
|
+
line-clamp: 2;
|
|
267
|
+
}
|
|
268
|
+
|
|
249
269
|
.cardBadge {
|
|
250
270
|
display: flex;
|
|
251
271
|
flex-shrink: 0;
|
|
@@ -285,6 +305,7 @@
|
|
|
285
305
|
right: auto;
|
|
286
306
|
transform: none;
|
|
287
307
|
flex-shrink: 0;
|
|
308
|
+
margin-bottom: 4px;
|
|
288
309
|
}
|
|
289
310
|
|
|
290
311
|
/* ----- Variant: cyan ----- */
|
|
@@ -364,7 +385,7 @@
|
|
|
364
385
|
.card[data-variant="cyan"][data-state="disabled-checked"] .cardIcon,
|
|
365
386
|
.card[data-variant="cyan"][data-state="disabled"]:hover .cardIcon,
|
|
366
387
|
.card[data-variant="cyan"][data-state="disabled-checked"]:hover .cardIcon {
|
|
367
|
-
color: var(--
|
|
388
|
+
color: var(--neutral-alpha-10);
|
|
368
389
|
}
|
|
369
390
|
|
|
370
391
|
.card[data-variant="cyan"][data-state="disabled"] .cardText,
|