|
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright (c) 2016 - 2025 Vaadin Ltd. |
| 4 | + * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ |
| 5 | + */ |
| 6 | +import '@vaadin/component-base/src/style-props.js'; |
| 7 | +import { css } from 'lit'; |
| 8 | + |
| 9 | +export const uploadFileStyles = css` |
| 10 | + :host { |
| 11 | + align-items: center; |
| 12 | + display: grid; |
| 13 | + gap: var(--vaadin-upload-file-gap, var(--vaadin-gap-container-block)); |
| 14 | + grid-template-columns: var(--vaadin-icon-size, 1lh) minmax(0, 1fr) auto; |
| 15 | + padding: var(--vaadin-upload-file-padding, var(--vaadin-padding)); |
| 16 | + } |
| 17 | +
|
| 18 | + [hidden] { |
| 19 | + display: none; |
| 20 | + } |
| 21 | +
|
| 22 | + [part='row'] { |
| 23 | + display: contents; |
| 24 | + } |
| 25 | +
|
| 26 | + [part='info'] { |
| 27 | + display: contents; |
| 28 | + } |
| 29 | +
|
| 30 | + [part='done-icon']:not([hidden]), |
| 31 | + [part='warning-icon']:not([hidden]) { |
| 32 | + display: flex; |
| 33 | + } |
| 34 | +
|
| 35 | + [part='done-icon']::before, |
| 36 | + [part='warning-icon']::before { |
| 37 | + content: ''; |
| 38 | + display: inline-block; |
| 39 | + flex: none; |
| 40 | + height: var(--vaadin-icon-size, 1lh); |
| 41 | + width: var(--vaadin-icon-size, 1lh); |
| 42 | + } |
| 43 | +
|
| 44 | + [part='done-icon']::before { |
| 45 | + background: var(--vaadin-upload-file-done-color, currentColor); |
| 46 | + mask-image: var(--_vaadin-icon-checkmark); |
| 47 | + } |
| 48 | +
|
| 49 | + [part='warning-icon']::before { |
| 50 | + background: var(--vaadin-upload-file-warning-color, currentColor); |
| 51 | + mask-image: var(--_vaadin-icon-warn); |
| 52 | + } |
| 53 | +
|
| 54 | + [part='meta'] { |
| 55 | + grid-column: 2; |
| 56 | + } |
| 57 | +
|
| 58 | + [part='name'] { |
| 59 | + color: var(--vaadin-upload-file-name-color, var(--vaadin-color)); |
| 60 | + font-size: var(--vaadin-upload-file-name-font-size, inherit); |
| 61 | + font-weight: var(--vaadin-upload-file-name-font-weight, inherit); |
| 62 | + line-height: var(--vaadin-upload-file-name-line-height, inherit); |
| 63 | + overflow: hidden; |
| 64 | + text-overflow: ellipsis; |
| 65 | + } |
| 66 | +
|
| 67 | + [part='status'] { |
| 68 | + color: var(--vaadin-upload-file-status-color, var(--vaadin-color-subtle)); |
| 69 | + font-size: var(--vaadin-upload-file-status-font-size, inherit); |
| 70 | + font-weight: var(--vaadin-upload-file-status-font-weight, inherit); |
| 71 | + line-height: var(--vaadin-upload-file-status-line-height, inherit); |
| 72 | + } |
| 73 | +
|
| 74 | + [part='error'] { |
| 75 | + color: var(--vaadin-upload-file-error-color, var(--vaadin-color)); |
| 76 | + font-size: var(--vaadin-upload-file-error-font-size, inherit); |
| 77 | + font-weight: var(--vaadin-upload-file-error-font-weight, inherit); |
| 78 | + line-height: var(--vaadin-upload-file-error-line-height, inherit); |
| 79 | + } |
| 80 | +
|
| 81 | + button { |
| 82 | + background: var(--vaadin-upload-file-button-background, transparent); |
| 83 | + border: var( |
| 84 | + --vaadin-upload-file-button-border, |
| 85 | + var(--vaadin-upload-file-button-border-width, 1px) solid |
| 86 | + var(--vaadin-upload-file-button-border-color, transparent) |
| 87 | + ); |
| 88 | + border-radius: var(--vaadin-upload-file-button-border-radius, var(--vaadin-radius-m)); |
| 89 | + color: var(--vaadin-upload-file-button-text-color, var(--vaadin-color)); |
| 90 | + cursor: var(--vaadin-clickable-cursor); |
| 91 | + flex-shrink: 0; |
| 92 | + font-family: var(--vaadin-upload-file-button-font-family, inherit); |
| 93 | + font-size: var(--vaadin-upload-file-button-font-size, inherit); |
| 94 | + font-weight: var(--vaadin-upload-file-button-font-weight, 500); |
| 95 | + height: var(--vaadin-upload-file-button-height, auto); |
| 96 | + line-height: var(--vaadin-upload-file-button-line-height, inherit); |
| 97 | + padding: var(--vaadin-upload-file-button-padding, var(--vaadin-padding-container)); |
| 98 | + } |
| 99 | +
|
| 100 | + [part='start-button']::before, |
| 101 | + [part='retry-button']::before, |
| 102 | + [part='remove-button']::before { |
| 103 | + background: currentColor; |
| 104 | + content: ''; |
| 105 | + display: block; |
| 106 | + height: var(--vaadin-icon-size, 1lh); |
| 107 | + width: var(--vaadin-icon-size, 1lh); |
| 108 | + } |
| 109 | +
|
| 110 | + [part='start-button']::before { |
| 111 | + mask-image: var(--_vaadin-icon-play); |
| 112 | + } |
| 113 | +
|
| 114 | + [part='retry-button']::before { |
| 115 | + mask-image: var(--_vaadin-icon-refresh); |
| 116 | + } |
| 117 | +
|
| 118 | + [part='remove-button']::before { |
| 119 | + mask-image: var(--_vaadin-icon-cross); |
| 120 | + } |
| 121 | +
|
| 122 | + ::slotted([slot='progress']) { |
| 123 | + grid-column: 2 / -1; |
| 124 | + width: auto; |
| 125 | + } |
| 126 | +
|
| 127 | + :host([complete]) ::slotted([slot='progress']), |
| 128 | + :host([error]) ::slotted([slot='progress']) { |
| 129 | + display: none; |
| 130 | + } |
| 131 | +
|
| 132 | + @media (forced-colors: active) { |
| 133 | + :is([part$='icon'], [part$='button'])::before { |
| 134 | + background: CanvasText; |
| 135 | + } |
| 136 | + } |
| 137 | +`; |
0 commit comments