| 1 |
/* -------------------------------------------------------------------------- |
| 2 |
Buttons |
| 3 |
-------------------------------------------------------------------------- */ |
| 4 |
.wpsubs-btn { |
| 5 |
display: inline-flex; |
| 6 |
align-items: center; |
| 7 |
justify-content: center; |
| 8 |
gap: 5px; |
| 9 |
height: 36px; |
| 10 |
padding: 0 14px; |
| 11 |
border-radius: var(--wpsubs-radius-sm); |
| 12 |
font-size: 13px; |
| 13 |
font-weight: 500; |
| 14 |
font-family: inherit; |
| 15 |
cursor: pointer; |
| 16 |
white-space: nowrap; |
| 17 |
text-decoration: none; |
| 18 |
transition: |
| 19 |
background 0.12s, |
| 20 |
border-color 0.12s, |
| 21 |
color 0.12s; |
| 22 |
border: 1px solid transparent; |
| 23 |
line-height: 1; |
| 24 |
vertical-align: middle; |
| 25 |
box-shadow: none; |
| 26 |
} |
| 27 |
|
| 28 |
.wpsubs-btn:focus, |
| 29 |
.wpsubs-btn:focus-visible, |
| 30 |
.wpsubs-btn:active { |
| 31 |
outline: none !important; |
| 32 |
box-shadow: none !important; |
| 33 |
border-radius: var(--wpsubs-radius-sm) !important; |
| 34 |
} |
| 35 |
|
| 36 |
.wpsubs-btn--outline { |
| 37 |
background: var(--wpsubs-surface); |
| 38 |
border-color: var(--wpsubs-border); |
| 39 |
color: var(--wpsubs-text); |
| 40 |
} |
| 41 |
|
| 42 |
.wpsubs-btn--outline:hover { |
| 43 |
border-color: var(--wpsubs-border-strong); |
| 44 |
background: var(--wpsubs-surface-muted); |
| 45 |
color: var(--wpsubs-text); |
| 46 |
text-decoration: none; |
| 47 |
} |
| 48 |
|
| 49 |
.wpsubs-btn--primary { |
| 50 |
background: var(--wpsubs-brand); |
| 51 |
border-color: var(--wpsubs-brand); |
| 52 |
color: #fff; |
| 53 |
} |
| 54 |
|
| 55 |
.wpsubs-btn--primary:hover { |
| 56 |
background: var(--wpsubs-brand-dark); |
| 57 |
border-color: var(--wpsubs-brand-dark); |
| 58 |
color: #fff; |
| 59 |
text-decoration: none; |
| 60 |
} |
| 61 |
|
| 62 |
/* Icon-only square button */ |
| 63 |
.wpsubs-btn--icon { |
| 64 |
width: 36px; |
| 65 |
height: 36px; |
| 66 |
padding: 0; |
| 67 |
flex-shrink: 0; |
| 68 |
} |
| 69 |
|
| 70 |
/* Subtle, borderless icon action (row/card controls). */ |
| 71 |
.wpsubs-icon-action { |
| 72 |
display: inline-flex; |
| 73 |
align-items: center; |
| 74 |
justify-content: center; |
| 75 |
width: 30px; |
| 76 |
height: 30px; |
| 77 |
padding: 0; |
| 78 |
border: none; |
| 79 |
border-radius: var(--wpsubs-radius-sm); |
| 80 |
background: transparent; |
| 81 |
color: var(--wpsubs-text-subtle); |
| 82 |
cursor: pointer; |
| 83 |
transition: |
| 84 |
background 0.12s, |
| 85 |
color 0.12s; |
| 86 |
} |
| 87 |
|
| 88 |
.wpsubs-icon-action:hover { |
| 89 |
background: var(--wpsubs-surface-muted); |
| 90 |
color: var(--wpsubs-text); |
| 91 |
} |
| 92 |
|
| 93 |
.wpsubs-icon-action--danger:hover { |
| 94 |
background: #fef2f2; |
| 95 |
color: #dc2626; |
| 96 |
} |
| 97 |
|
| 98 |
.wpsubs-icon-action .dashicons { |
| 99 |
font-size: 17px; |
| 100 |
width: 17px; |
| 101 |
height: 17px; |
| 102 |
line-height: 1; |
| 103 |
} |
| 104 |
|
| 105 |
.wpsubs-btn--sm { |
| 106 |
height: 30px; |
| 107 |
padding: 0 10px; |
| 108 |
font-size: 12px; |
| 109 |
} |
| 110 |
|
| 111 |
/* Muted: a secondary action that should not compete with the row's content. |
| 112 |
Outline's shape, with the label dropped back to the muted text tone. */ |
| 113 |
.wpsubs-btn--muted { |
| 114 |
background: var(--wpsubs-surface); |
| 115 |
border-color: var(--wpsubs-border); |
| 116 |
color: var(--wpsubs-text-muted); |
| 117 |
} |
| 118 |
|
| 119 |
.wpsubs-btn--muted:hover { |
| 120 |
border-color: var(--wpsubs-border-strong); |
| 121 |
background: var(--wpsubs-surface-muted); |
| 122 |
color: var(--wpsubs-text); |
| 123 |
text-decoration: none; |
| 124 |
} |
| 125 |
|
| 126 |
.wpsubs-btn--muted .dashicons { |
| 127 |
font-size: 15px; |
| 128 |
width: 15px; |
| 129 |
height: 15px; |
| 130 |
line-height: 1; |
| 131 |
} |
| 132 |
|
| 133 |
.wpsubs-btn--danger { |
| 134 |
background: var(--wpsubs-surface); |
| 135 |
border-color: #fca5a5; |
| 136 |
color: #dc2626; |
| 137 |
} |
| 138 |
|
| 139 |
.wpsubs-btn--danger:hover { |
| 140 |
background: #fef2f2; |
| 141 |
border-color: #f87171; |
| 142 |
color: #b91c1c; |
| 143 |
text-decoration: none; |
| 144 |
} |
| 145 |
|
| 146 |
/* -------------------------------------------------------------------------- |
| 147 |
Disabled + in-flight states |
| 148 |
|
| 149 |
setLoading() (plans.js / plan-forms.js) sets `disabled` and toggles |
| 150 |
`is-loading` on the submit button — and on the controls beside it — for as |
| 151 |
long as a REST write is in flight. Without these rules the class is inert, |
| 152 |
so a slow save is indistinguishable from a dead button. |
| 153 |
-------------------------------------------------------------------------- */ |
| 154 |
.wpsubs-btn:disabled, |
| 155 |
.wpsubs-icon-action:disabled { |
| 156 |
opacity: 0.6; |
| 157 |
cursor: not-allowed; |
| 158 |
pointer-events: none; |
| 159 |
} |
| 160 |
|
| 161 |
/* The label is hidden rather than removed so the button keeps its width. */ |
| 162 |
.wpsubs-btn.is-loading { |
| 163 |
position: relative; |
| 164 |
color: transparent !important; |
| 165 |
} |
| 166 |
|
| 167 |
/* The spinner replaces the label, so the button still reads as itself. */ |
| 168 |
.wpsubs-btn.is-loading::after { |
| 169 |
content: ""; |
| 170 |
position: absolute; |
| 171 |
top: 50%; |
| 172 |
left: 50%; |
| 173 |
width: 14px; |
| 174 |
height: 14px; |
| 175 |
margin: -7px 0 0 -7px; |
| 176 |
border: 2px solid var(--wpsubs-border-strong); |
| 177 |
border-top-color: var(--wpsubs-text); |
| 178 |
border-radius: 50%; |
| 179 |
animation: wpsubs-btn-spin 0.6s linear infinite; |
| 180 |
} |
| 181 |
|
| 182 |
/* `color` is transparent while loading, so the ring needs its own colours. */ |
| 183 |
.wpsubs-btn--primary.is-loading::after { |
| 184 |
border-color: rgba(255, 255, 255, 0.45); |
| 185 |
border-top-color: #ffffff; |
| 186 |
} |
| 187 |
|
| 188 |
.wpsubs-btn--danger.is-loading::after { |
| 189 |
border-color: #fca5a5; |
| 190 |
border-top-color: #dc2626; |
| 191 |
} |
| 192 |
|
| 193 |
/* A spinning button is already unmistakably busy — dimming it hides the ring. */ |
| 194 |
.wpsubs-btn.is-loading:disabled { |
| 195 |
opacity: 1; |
| 196 |
} |
| 197 |
|
| 198 |
@keyframes wpsubs-btn-spin { |
| 199 |
to { |
| 200 |
transform: rotate(360deg); |
| 201 |
} |
| 202 |
} |
| 203 |
|
| 204 |
@media (prefers-reduced-motion: reduce) { |
| 205 |
.wpsubs-btn.is-loading::after { |
| 206 |
animation-duration: 2s; |
| 207 |
} |
| 208 |
} |
| 209 |
|