| 1 |
/* -------------------------------------------------------------------------- |
| 2 |
Advanced Select (wpsubs-adv-select) |
| 3 |
Drop-in replacement for native <select>. Renders a trigger button that |
| 4 |
opens a styled dropdown menu. Use wpsubs_render_adv_select() PHP helper. |
| 5 |
-------------------------------------------------------------------------- */ |
| 6 |
.wpsubs-adv-select { |
| 7 |
position: relative; |
| 8 |
display: inline-block; |
| 9 |
} |
| 10 |
|
| 11 |
.wpsubs-adv-select__trigger { |
| 12 |
display: inline-flex; |
| 13 |
align-items: center; |
| 14 |
gap: 5px; |
| 15 |
height: 36px; |
| 16 |
width: 100%; |
| 17 |
min-width: max-content; |
| 18 |
padding: 0 14px; |
| 19 |
border-radius: var(--wpsubs-radius-sm); |
| 20 |
font-size: 13px; |
| 21 |
font-weight: 500; |
| 22 |
font-family: inherit; |
| 23 |
cursor: pointer; |
| 24 |
white-space: nowrap; |
| 25 |
text-align: left; |
| 26 |
background: var(--wpsubs-surface); |
| 27 |
border: 1px solid var(--wpsubs-border); |
| 28 |
color: var(--wpsubs-text); |
| 29 |
transition: |
| 30 |
background 0.12s, |
| 31 |
border-color 0.12s; |
| 32 |
line-height: 1; |
| 33 |
box-shadow: none; |
| 34 |
} |
| 35 |
|
| 36 |
.wpsubs-adv-select__trigger:hover { |
| 37 |
border-color: var(--wpsubs-border-strong); |
| 38 |
background: var(--wpsubs-surface-muted); |
| 39 |
} |
| 40 |
|
| 41 |
.wpsubs-adv-select__trigger:focus { |
| 42 |
outline: none; |
| 43 |
border-color: var(--wpsubs-brand); |
| 44 |
box-shadow: 0 0 0 3px var(--wpsubs-brand-ring); |
| 45 |
} |
| 46 |
|
| 47 |
.wpsubs-adv-select--open .wpsubs-adv-select__trigger { |
| 48 |
border-color: var(--wpsubs-brand); |
| 49 |
} |
| 50 |
|
| 51 |
.wpsubs-adv-select__label { |
| 52 |
flex: 1; |
| 53 |
overflow: hidden; |
| 54 |
text-overflow: ellipsis; |
| 55 |
white-space: nowrap; |
| 56 |
} |
| 57 |
|
| 58 |
.wpsubs-adv-select__chevron { |
| 59 |
flex-shrink: 0; |
| 60 |
opacity: 0.55; |
| 61 |
transition: transform 0.15s; |
| 62 |
} |
| 63 |
|
| 64 |
.wpsubs-adv-select--open .wpsubs-adv-select__chevron { |
| 65 |
transform: rotate(180deg); |
| 66 |
} |
| 67 |
|
| 68 |
.wpsubs-adv-select__menu { |
| 69 |
display: none; |
| 70 |
position: absolute; |
| 71 |
top: calc(100% + 4px); |
| 72 |
min-width: 100%; |
| 73 |
width: max-content; |
| 74 |
box-sizing: border-box; |
| 75 |
background: var(--wpsubs-surface); |
| 76 |
border: 1px solid var(--wpsubs-border); |
| 77 |
border-radius: var(--wpsubs-radius); |
| 78 |
box-shadow: var(--wpsubs-shadow-md); |
| 79 |
z-index: 9999; |
| 80 |
padding: 4px; |
| 81 |
animation: wpsubs-dropdown-in 0.1s ease; |
| 82 |
} |
| 83 |
|
| 84 |
/* Align variants */ |
| 85 |
.wpsubs-adv-select--left .wpsubs-adv-select__menu { |
| 86 |
left: 0; |
| 87 |
right: auto; |
| 88 |
} |
| 89 |
.wpsubs-adv-select--right .wpsubs-adv-select__menu { |
| 90 |
right: 0; |
| 91 |
left: auto; |
| 92 |
} |
| 93 |
|
| 94 |
/* Default: left-aligned */ |
| 95 |
.wpsubs-adv-select__menu { |
| 96 |
left: 0; |
| 97 |
right: auto; |
| 98 |
} |
| 99 |
|
| 100 |
.wpsubs-adv-select--open .wpsubs-adv-select__menu { |
| 101 |
display: block; |
| 102 |
} |
| 103 |
|
| 104 |
.wpsubs-adv-select__item { |
| 105 |
display: flex; |
| 106 |
align-items: center; |
| 107 |
gap: 8px; |
| 108 |
width: 100%; |
| 109 |
padding: 7px 10px; |
| 110 |
border-radius: var(--wpsubs-radius-sm); |
| 111 |
border: none; |
| 112 |
background: transparent; |
| 113 |
font-size: 13px; |
| 114 |
font-family: inherit; |
| 115 |
color: var(--wpsubs-text); |
| 116 |
cursor: pointer; |
| 117 |
text-align: left; |
| 118 |
text-decoration: none; |
| 119 |
white-space: nowrap; |
| 120 |
transition: background 0.1s; |
| 121 |
box-sizing: border-box; |
| 122 |
line-height: 1.4; |
| 123 |
} |
| 124 |
|
| 125 |
.wpsubs-adv-select__item:hover { |
| 126 |
background: var(--wpsubs-surface-muted); |
| 127 |
color: var(--wpsubs-text); |
| 128 |
text-decoration: none; |
| 129 |
} |
| 130 |
|
| 131 |
.wpsubs-adv-select__item[data-disabled] { |
| 132 |
opacity: 0.45; |
| 133 |
cursor: not-allowed; |
| 134 |
} |
| 135 |
|
| 136 |
.wpsubs-adv-select__item--danger { |
| 137 |
color: #dc2626; |
| 138 |
} |
| 139 |
.wpsubs-adv-select__item--danger:hover { |
| 140 |
background: #fee2e2; |
| 141 |
color: #b91c1c; |
| 142 |
} |
| 143 |
|
| 144 |
.wpsubs-adv-select__divider { |
| 145 |
height: 1px; |
| 146 |
background: var(--wpsubs-border); |
| 147 |
margin: 4px 0; |
| 148 |
} |
| 149 |
|
| 150 |
/* -------------------------------------------------------------------------- |
| 151 |
Select control |
| 152 |
-------------------------------------------------------------------------- */ |
| 153 |
.wpsubs-select { |
| 154 |
height: 36px; |
| 155 |
padding: 0 28px 0 10px; |
| 156 |
border: 1px solid var(--wpsubs-border) !important; |
| 157 |
border-radius: var(--wpsubs-radius-sm) !important; |
| 158 |
background: var(--wpsubs-surface) !important; |
| 159 |
font-size: 13px !important; |
| 160 |
font-family: inherit !important; |
| 161 |
color: var(--wpsubs-text) !important; |
| 162 |
outline: none !important; |
| 163 |
box-shadow: none !important; |
| 164 |
cursor: pointer; |
| 165 |
appearance: none; |
| 166 |
-webkit-appearance: none; |
| 167 |
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important; |
| 168 |
background-repeat: no-repeat !important; |
| 169 |
background-position: right 9px center !important; |
| 170 |
transition: border-color 0.15s; |
| 171 |
vertical-align: middle; |
| 172 |
line-height: 1; |
| 173 |
} |
| 174 |
|
| 175 |
.wpsubs-select:focus { |
| 176 |
border-color: var(--wpsubs-brand) !important; |
| 177 |
box-shadow: 0 0 0 3px var(--wpsubs-brand-ring) !important; |
| 178 |
} |
| 179 |
|
| 180 |
/* -------------------------------------------------------------------------- |
| 181 |
Custom checkbox |
| 182 |
-------------------------------------------------------------------------- */ |
| 183 |
input[type="checkbox"].wpsubs-checkbox { |
| 184 |
-webkit-appearance: none !important; |
| 185 |
appearance: none !important; |
| 186 |
display: inline-block !important; |
| 187 |
box-sizing: border-box !important; |
| 188 |
width: 16px !important; |
| 189 |
height: 16px !important; |
| 190 |
min-width: 16px !important; |
| 191 |
padding: 0 !important; |
| 192 |
margin: 0 !important; |
| 193 |
border: 1.5px solid var(--wpsubs-border-strong) !important; |
| 194 |
border-radius: 4px !important; |
| 195 |
background: var(--wpsubs-surface) !important; |
| 196 |
box-shadow: none !important; |
| 197 |
outline: none !important; |
| 198 |
cursor: pointer; |
| 199 |
flex-shrink: 0; |
| 200 |
vertical-align: middle; |
| 201 |
transition: |
| 202 |
background 0.12s, |
| 203 |
border-color 0.12s; |
| 204 |
} |
| 205 |
|
| 206 |
input[type="checkbox"].wpsubs-checkbox:hover { |
| 207 |
border-color: var(--wpsubs-brand) !important; |
| 208 |
} |
| 209 |
|
| 210 |
input[type="checkbox"].wpsubs-checkbox:checked { |
| 211 |
background-color: var(--wpsubs-brand) !important; |
| 212 |
border-color: var(--wpsubs-brand) !important; |
| 213 |
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5L6.5 12L13 5' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E") !important; |
| 214 |
background-repeat: no-repeat !important; |
| 215 |
background-position: center !important; |
| 216 |
} |
| 217 |
|
| 218 |
/* Suppress WP admin's ::before blue checkmark overlay */ |
| 219 |
input[type="checkbox"].wpsubs-checkbox:checked::before, |
| 220 |
input[type="checkbox"].wpsubs-checkbox:checked::after { |
| 221 |
display: none !important; |
| 222 |
} |
| 223 |
|
| 224 |
input[type="checkbox"].wpsubs-checkbox:indeterminate { |
| 225 |
background-color: var(--wpsubs-brand) !important; |
| 226 |
border-color: var(--wpsubs-brand) !important; |
| 227 |
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8H12' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") !important; |
| 228 |
background-repeat: no-repeat !important; |
| 229 |
background-position: center !important; |
| 230 |
background-size: 11px 11px !important; |
| 231 |
} |
| 232 |
|
| 233 |
input[type="checkbox"].wpsubs-checkbox:indeterminate::before, |
| 234 |
input[type="checkbox"].wpsubs-checkbox:indeterminate::after { |
| 235 |
display: none !important; |
| 236 |
} |
| 237 |
|
| 238 |
input[type="checkbox"].wpsubs-checkbox:focus { |
| 239 |
outline: none !important; |
| 240 |
box-shadow: |
| 241 |
0 0 0 2px #fff, |
| 242 |
0 0 0 4px var(--wpsubs-brand) !important; |
| 243 |
} |
| 244 |
|