@react-spectrum/list 3.0.0-alpha.10 → 3.0.0-alpha.11

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.
@@ -1,3 +1,14 @@
1
+ /*
2
+ * Copyright 2022 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
 
2
13
  :root {
3
14
  --spectrum-listview-item-compact-padding-y: var(--spectrum-global-dimension-size-50);
@@ -7,6 +18,11 @@
7
18
  --spectrum-listview-border-radius: var(--spectrum-table-border-radius, var(--spectrum-alias-border-radius-regular));
8
19
  --spectrum-listview-item-border-radius: calc(var(--spectrum-listview-border-radius) - var(--spectrum-listview-border-width));
9
20
  --spectrum-listview-row-sticky-focus-indicator-width: 3px;
21
+ --spectrum-listview-item-line-height: calc(var(--spectrum-table-cell-text-size, var(--spectrum-alias-font-size-default)) * var(--spectrum-table-cell-text-line-height, var(--spectrum-alias-body-text-line-height)) - 1px);
22
+ --spectrum-listview-item-title-text-color: var(--spectrum-global-color-gray-800);
23
+ --spectrum-listview-item-title-text-size: var(--spectrum-global-dimension-font-size-100);
24
+ --spectrum-listview-item-description-text-color: var(--spectrum-global-color-gray-700);
25
+ --spectrum-listview-item-description-text-size: var(--spectrum-global-dimension-font-size-75);
10
26
  }
11
27
 
12
28
  .react-spectrum-ListView {
@@ -45,13 +61,6 @@
45
61
  pointer-events: none;
46
62
  }
47
63
 
48
- /* Box shadow for bottom border for non-selected rows that is immmediately above a selected row. */
49
- &.is-next-selected {
50
- &:after {
51
- box-shadow: inset 0 -1px 0 0 var(--spectrum-global-color-blue-500);
52
- }
53
- }
54
-
55
64
  &.is-selected {
56
65
  background-color: var(--spectrum-table-row-background-color-selected);
57
66
  &.is-hovered,
@@ -63,22 +72,18 @@
63
72
  background-color: var(--spectrum-table-row-background-color-selected-key-focus);
64
73
  }
65
74
 
66
- /* Box shadow for left, right, and bottom border for selected rows. */
75
+ /* Negative block start causes borders to actually be shared between items. Only works if we allow item overflow to be visible, like card focus rings. */
67
76
  &:after {
68
- box-shadow: inset 1px 0 0 0 var(--spectrum-global-color-blue-500), inset -1px 0 0 0 var(--spectrum-global-color-blue-500), inset 0 -1px 0 0 var(--spectrum-global-color-blue-500);
69
- }
70
-
71
- /* Box shadow for left, right, bottom, and top border for first row when selected (needs 1px top blue border). */
72
- &.react-spectrum-ListViewItem--firstRow {
73
- &:after {
74
- box-shadow: inset 1px 0 0 0 var(--spectrum-global-color-blue-500), inset -1px 0 0 0 var(--spectrum-global-color-blue-500), inset 0 -1px 0 0 var(--spectrum-global-color-blue-500), inset 0 1px 0 0 var(--spectrum-global-color-blue-500);
75
- }
77
+ inset-block-start: -1px;
78
+ box-shadow: inset 1px 0 0 0 var(--spectrum-global-color-blue-500), inset -1px 0 0 0 var(--spectrum-global-color-blue-500), inset 0 -1px 0 0 var(--spectrum-global-color-blue-500), inset 0 1px 0 0 var(--spectrum-global-color-blue-500);
76
79
  }
80
+ }
77
81
 
78
- /* Box shadow for left, right, and bottom border for last row when selected (needs 1px bottom blue border). */
79
- &.react-spectrum-ListViewItem--lastRow {
82
+ /* First item in the ListView should not have a border that extends outside of itself to the top, it doesn't need to share a border space. */
83
+ &.react-spectrum-ListViewItem--firstRow {
84
+ &.is-selected {
80
85
  &:after {
81
- box-shadow: inset 1px 0 0 0 var(--spectrum-global-color-blue-500), inset -1px 0 0 0 var(--spectrum-global-color-blue-500), inset 0 -1px 0 0 var(--spectrum-global-color-blue-500);
86
+ inset-block-start: 0px;
82
87
  }
83
88
  }
84
89
  }
@@ -86,7 +91,7 @@
86
91
 
87
92
  &:not(.react-spectrum-ListView--quiet) {
88
93
  .react-spectrum-ListViewItem {
89
- /* Box shadow for bottom border for non-selected rows that aren't immediatly above a selected row (grey border bottom). */
94
+ /* Box shadow for bottom border for non-selected rows that aren't immediately above a selected row (grey border bottom). */
90
95
  /* Also omit bottom border for last row if the total content height of the ListView is equal or greater than the height of the container. This avoids overlapping bottom borders. */
91
96
  &:not(.is-selected):not(.is-next-selected):not(.react-spectrum-ListViewItem--isFlushBottom) {
92
97
  &:after {
@@ -110,6 +115,42 @@
110
115
  }
111
116
  }
112
117
  }
118
+
119
+ &.react-spectrum-ListView--isVerticalScrollbarVisible {
120
+ .react-spectrum-ListViewItem {
121
+ &.react-spectrum-ListViewItem--firstRow.is-selected {
122
+ &:after {
123
+ border-start-end-radius: 0;
124
+ }
125
+ }
126
+ }
127
+
128
+ &:not(.react-spectrum-ListView--loadingMore) {
129
+ .react-spectrum-ListViewItem--lastRow.react-spectrum-ListViewItem--isFlushBottom.is-selected {
130
+ &:after {
131
+ border-end-end-radius: 0;
132
+ }
133
+ }
134
+ }
135
+ }
136
+
137
+ &.react-spectrum-ListView--isHorizontalScrollbarVisible {
138
+ &:not(.react-spectrum-ListView--loadingMore) {
139
+ .react-spectrum-ListViewItem--lastRow.react-spectrum-ListViewItem--isFlushBottom.is-selected {
140
+ &:after {
141
+ border-end-start-radius: 0;
142
+ border-end-end-radius: 0;
143
+ }
144
+ }
145
+ }
146
+ }
147
+ }
148
+ }
149
+ &.react-spectrum-ListView--wrap .react-spectrum-ListViewItem {
150
+ & .react-spectrum-ListViewItem-content,
151
+ & .react-spectrum-ListViewItem-description {
152
+ white-space: normal;
153
+ height: auto;
113
154
  }
114
155
  }
115
156
  }
@@ -131,10 +172,46 @@
131
172
  }
132
173
  }
133
174
 
134
- .react-spectrum-ListView--quiet {
175
+ .react-spectrum-ListView.react-spectrum-ListView--quiet {
135
176
  background-color: var(--spectrum-alias-background-color-transparent);
136
177
  border-width: 0;
137
178
  border-radius: 0;
179
+
180
+ .react-spectrum-ListView-row {
181
+ &.round-tops {
182
+ &:focus-ring {
183
+ &:before {
184
+ border-start-start-radius: var(--spectrum-listview-item-border-radius);
185
+ }
186
+ }
187
+ & > .react-spectrum-ListViewItem {
188
+ border-start-start-radius: var(--spectrum-listview-item-border-radius);
189
+ border-start-end-radius: var(--spectrum-listview-item-border-radius);
190
+
191
+ &:after {
192
+ border-start-start-radius: var(--spectrum-listview-item-border-radius);
193
+ border-start-end-radius: var(--spectrum-listview-item-border-radius);
194
+ }
195
+ }
196
+ }
197
+
198
+ &.round-bottoms {
199
+ &:focus-ring {
200
+ &:before {
201
+ border-end-start-radius: var(--spectrum-listview-item-border-radius);
202
+ }
203
+ }
204
+ & > .react-spectrum-ListViewItem {
205
+ border-end-start-radius: var(--spectrum-listview-item-border-radius);
206
+ border-end-end-radius: var(--spectrum-listview-item-border-radius);
207
+
208
+ &:after {
209
+ border-end-start-radius: var(--spectrum-listview-item-border-radius);
210
+ border-end-end-radius: var(--spectrum-listview-item-border-radius);
211
+ }
212
+ }
213
+ }
214
+ }
138
215
  }
139
216
 
140
217
  .react-spectrum-ListViewItem {
@@ -142,7 +219,7 @@
142
219
  box-sizing: border-box;
143
220
  font-size: var(--spectrum-table-cell-text-size, var(--spectrum-alias-font-size-default));
144
221
  font-weight: var(--spectrum-table-cell-text-font-weight, var(--spectrum-global-font-weight-regular));
145
- line-height: calc(var(--spectrum-table-cell-text-size, var(--spectrum-alias-font-size-default)) * var(--spectrum-table-cell-text-line-height, var(--spectrum-alias-body-text-line-height)) - 1px);
222
+ line-height: var(--spectrum-listview-item-line-height);
146
223
  padding: var(--spectrum-listview-item-regular-padding-y) var(--spectrum-global-dimension-size-160);
147
224
  position: relative;
148
225
  /*background-color: var(--spectrum-table-background-color, var(--spectrum-global-color-gray-50));*/
@@ -176,6 +253,12 @@
176
253
  }
177
254
  }
178
255
 
256
+ &.is-disabled {
257
+ &, .react-spectrum-ListViewItem-content, .react-spectrum-ListViewItem-description {
258
+ color: var(--spectrum-alias-text-color-disabled);
259
+ }
260
+ }
261
+
179
262
  &.has-checkbox {
180
263
  /* have to eliminate vertical padding to allow proper vertical alignment */
181
264
  padding-top: 0px;
@@ -188,8 +271,7 @@
188
271
  grid-template-rows: 1fr auto;
189
272
  grid-template-areas:
190
273
  "draghandle checkbox icon image content actions actionmenu chevron"
191
- "draghandle checkbox icon image description actions actionmenu chevron"
192
- ;
274
+ "draghandle checkbox icon image description actions actionmenu chevron";
193
275
  align-items: center;
194
276
  }
195
277
 
@@ -218,12 +300,18 @@
218
300
  }
219
301
  }
220
302
 
221
- .react-spectrum-ListViewItem-checkbox {
303
+ .react-spectrum-ListViewItem-checkboxWrapper {
222
304
  grid-area: checkbox;
223
305
  align-items: center;
224
306
  justify-items: center;
307
+ transition-duration: 160ms;
308
+ display: flex;
309
+ }
310
+
311
+ .react-spectrum-ListViewItem-checkbox {
225
312
  min-height: 0;
226
313
  height: 100%;
314
+
227
315
  > span {
228
316
  margin: 0;
229
317
  }
@@ -238,22 +326,46 @@
238
326
  }
239
327
 
240
328
  .react-spectrum-ListViewItem-image {
329
+ display: flex;
241
330
  border-radius: var(--spectrum-global-dimension-size-25);
242
331
  width: var(--spectrum-global-dimension-size-400);
243
332
  height: var(--spectrum-global-dimension-size-400);
333
+ align-items: center;
334
+ justify-content: center;
335
+ > img {
336
+ width: unset;
337
+ height: unset;
338
+ max-height: 100%;
339
+ }
244
340
  }
245
341
 
246
342
  .react-spectrum-ListViewItem-content,
247
343
  .react-spectrum-ListViewItem-description {
248
344
  flex-grow: 1;
345
+
346
+ /* truncate text with ellipsis */
347
+ overflow: hidden;
348
+ white-space: nowrap;
349
+ text-overflow: ellipsis;
350
+ height: var(--spectrum-listview-item-line-height);
249
351
  }
250
352
 
251
353
  .react-spectrum-ListViewItem-content {
252
354
  grid-area: content;
355
+ color: var(--spectrum-listview-item-title-text-color);
356
+ font-size: var(--spectrum-listview-item-title-text-size);
357
+ }
358
+
359
+ &:not(.react-spectrum-ListView--hasDescription) {
360
+ .react-spectrum-ListViewItem-content {
361
+ grid-area: content / description;
362
+ }
253
363
  }
254
364
 
255
365
  .react-spectrum-ListViewItem-description {
256
366
  grid-area: description;
367
+ color: var(--spectrum-listview-item-description-text-color);
368
+ font-size: var(--spectrum-listview-item-description-text-size);
257
369
  }
258
370
 
259
371
  .react-spectrum-ListViewItem-actions {
@@ -269,6 +381,12 @@
269
381
  .react-spectrum-ListViewItem-parentIndicator {
270
382
  grid-area: chevron;
271
383
  padding-inline-start: var(--spectrum-global-dimension-size-75);
384
+ display: none;
385
+ transition: color var(--spectrum-global-animation-duration-100);
386
+
387
+ &.is-disabled {
388
+ color: var(--spectrum-alias-icon-color-disabled);
389
+ }
272
390
  }
273
391
 
274
392
  &.react-spectrum-ListViewItem-dragPreview {
@@ -280,8 +398,7 @@
280
398
  .react-spectrum-ListViewItem-grid {
281
399
  grid-template-areas:
282
400
  "icon image content . badge"
283
- "icon image description . badge"
284
- ;
401
+ "icon image description . badge";
285
402
  grid-template-columns: auto auto auto 1fr;
286
403
  }
287
404
 
@@ -293,8 +410,9 @@
293
410
  border-radius: var(--spectrum-alias-border-radius-regular);
294
411
  }
295
412
 
296
- &.react-spectrum-ListViewItem-dragPreview--multiple {
413
+ &.react-spectrum-ListViewItem-dragPreview--multiple {
297
414
  position: relative;
415
+
298
416
  &:after {
299
417
  content: '';
300
418
  display: block;
@@ -315,16 +433,49 @@
315
433
  display: none;
316
434
  }
317
435
  }
318
-
436
+ }
437
+ .react-spectrum-ListView:not(.react-spectrum-ListView--quiet) {
319
438
  /* give first and last items border-radius to match listview container */
320
- div:first-child > div[role="row"] > & {
439
+
440
+ .react-spectrum-ListViewItem--firstRow.react-spectrum-ListViewItem {
321
441
  border-start-start-radius: var(--spectrum-listview-item-start-end-border-radius);
322
442
  border-start-end-radius: var(--spectrum-listview-item-start-end-border-radius);
323
443
  }
324
- div:last-child > div[role="row"] > & {
444
+
445
+ .react-spectrum-ListViewItem--lastRow.react-spectrum-ListViewItem {
325
446
  border-end-start-radius: var(--spectrum-listview-item-start-end-border-radius);
326
447
  border-end-end-radius: var(--spectrum-listview-item-start-end-border-radius);
327
448
  }
449
+
450
+ &.react-spectrum-ListView--isVerticalScrollbarVisible {
451
+ .react-spectrum-ListViewItem--firstRow.react-spectrum-ListViewItem {
452
+ border-start-end-radius: 0;
453
+ }
454
+
455
+ .react-spectrum-ListViewItem--lastRow.react-spectrum-ListViewItem {
456
+ border-end-end-radius: 0;
457
+ }
458
+ }
459
+
460
+ &.react-spectrum-ListView--isHorizontalScrollbarVisible {
461
+ .react-spectrum-ListViewItem--lastRow.react-spectrum-ListViewItem {
462
+ border-end-start-radius: 0;
463
+ border-end-end-radius: 0;
464
+ }
465
+ }
466
+ }
467
+
468
+ .react-spectrum-ListView {
469
+ /* When we can use subgrid, get rid of this. */
470
+ &.react-spectrum-ListView--hasAnyChildren {
471
+ .react-spectrum-ListViewItem-parentIndicator {
472
+ display: inline-block;
473
+ visibility: hidden;
474
+ }
475
+ .react-spectrum-ListViewItem-parentIndicator--hasChildItems {
476
+ visibility: visible;
477
+ }
478
+ }
328
479
  }
329
480
 
330
481
  .react-spectrum-ListView--compact .react-spectrum-ListViewItem {
@@ -341,11 +492,39 @@
341
492
 
342
493
  .react-spectrum-ListView--draggable .react-spectrum-ListViewItem {
343
494
  padding-inline-start: 0;
495
+
496
+ .react-spectrum-ListViewItem-checkbox {
497
+ input {
498
+ inset-inline-start: 0;
499
+ }
500
+ }
501
+ }
502
+
503
+ .react-spectrum-ListViewItem--dropTarget {
504
+ background-color: var(--spectrum-alias-highlight-selected);
505
+ box-shadow:
506
+ inset 2px 0 0 0 var(--spectrum-table-cell-border-color-key-focus),
507
+ inset -2px 0 0 0 var(--spectrum-table-cell-border-color-key-focus),
508
+ inset 0 -3px 0 0 var(--spectrum-table-cell-border-color-key-focus),
509
+ inset 0 2px 0 0 var(--spectrum-table-cell-border-color-key-focus);
344
510
  }
345
511
 
346
- .react-spectrum-ListViewItem--draggable {
347
- .react-spectrum-ListViewItem-checkbox input {
512
+ .react-spectrum-ListView--dropTarget {
513
+ border-color: var(--spectrum-global-color-blue-500);
514
+ background-color: var(--spectrum-alias-highlight-selected);
515
+ box-shadow: inset 0 0 0 1px var(--spectrum-table-cell-border-color-key-focus);
516
+ &::after {
517
+ border-radius: inherit;
518
+ border-color: var(--spectrum-global-color-blue-500);
519
+ background-color: var(--spectrum-alias-highlight-selected);
520
+ box-shadow: inset 0 0 0 1px var(--spectrum-table-cell-border-color-key-focus);
521
+ content: '';
522
+ display: block;
523
+ position: absolute;
524
+ top: 0;
348
525
  inset-inline-start: 0;
526
+ width: 100%;
527
+ height: 100%;
349
528
  }
350
529
  }
351
530
 
@@ -359,3 +538,55 @@
359
538
  padding-top: var(--spectrum-global-dimension-size-50);
360
539
  }
361
540
  }
541
+
542
+ .react-spectrum-ListViewInsertionIndicator {
543
+ width: calc(100% - (2 * var(--spectrum-dropindicator-circle-size)));
544
+ inset-inline-start: var(--spectrum-dropindicator-circle-size);
545
+ position: absolute;
546
+ outline: none;
547
+
548
+ &.react-spectrum-ListViewInsertionIndicator--dropTarget {
549
+ background: var(--spectrum-dropindicator-border-color);
550
+ border-bottom: 2px solid var(--spectrum-dropindicator-border-color);
551
+
552
+ &:before {
553
+ left: calc(var(--spectrum-dropindicator-circle-size) * -1);
554
+ }
555
+
556
+ &:after {
557
+ right: calc(var(--spectrum-dropindicator-circle-size) * -1);
558
+ }
559
+
560
+ &:before,
561
+ &:after {
562
+ content: '';
563
+ position: absolute;
564
+ top: calc(var(--spectrum-dropindicator-circle-size) * -1 / 2 + var(--spectrum-dropindicator-border-size) / 2);
565
+ width: var(--spectrum-dropindicator-circle-size);
566
+ height: var(--spectrum-dropindicator-circle-size);
567
+ border-radius: 50%;
568
+ border: var(--spectrum-dropindicator-border-size) solid;
569
+ box-sizing: border-box;
570
+ border-color: var(--spectrum-dropindicator-circle-border-color);
571
+ background-color: var(--spectrum-table-background-color, var(--spectrum-global-color-gray-50));
572
+ z-index: 3;
573
+ }
574
+ }
575
+ }
576
+
577
+ .react-spectrum-ListViewItem-checkbox--enter {
578
+ opacity: 0.01;
579
+ max-width: 0px;
580
+ }
581
+ .react-spectrum-ListViewItem-checkbox--enterActive {
582
+ opacity: 1;
583
+ max-width: 80px;
584
+ }
585
+ .react-spectrum-ListViewItem-checkbox--exit {
586
+ opacity: 1;
587
+ max-width: 80px;
588
+ }
589
+ .react-spectrum-ListViewItem-checkbox--exitActive {
590
+ opacity: 0.01;
591
+ max-width: 0px;
592
+ }