| 1 |
// WooCommerce Billing / Shipping composite address fields. |
| 2 |
// |
| 3 |
// Two surfaces: |
| 4 |
// 1. `.wppb-fb-woo-fields` — the sub-field picker in the Field Settings |
| 5 |
// sidebar. Mirrors the classic Manage Fields "woocheckbox" control: a |
| 6 |
// compact two-column table ("Field Name" | "Required"), one draggable row |
| 7 |
// per sub-field (drag handle + include checkbox + inline-editable label + |
| 8 |
// required checkbox), rather than the old checkbox-then-expand layout. |
| 9 |
// 2. `.wppb-fb-woo-address` — the canvas preview: each included sub-field as a |
| 10 |
// real title + a disabled placeholder input, so the block reads like the |
| 11 |
// rendered address form. |
| 12 |
// |
| 13 |
// Rendered by components/WooAddressFieldEdit.js. Column widths are shared between |
| 14 |
// the header and every row so they line up. |
| 15 |
$wppb-woo-handle: 18px; |
| 16 |
$wppb-woo-check: 18px; |
| 17 |
$wppb-woo-req-col: 60px; |
| 18 |
|
| 19 |
.wppb-fb-woo-fields { |
| 20 |
&__head, |
| 21 |
&__row { |
| 22 |
display: flex; |
| 23 |
align-items: center; |
| 24 |
gap: var(--wppb-fb-space-sm); |
| 25 |
} |
| 26 |
|
| 27 |
&__head { |
| 28 |
padding-bottom: var(--wppb-fb-space-2xs); |
| 29 |
margin-bottom: var(--wppb-fb-space-2xs); |
| 30 |
border-bottom: 1px solid var(--wppb-fb-border-default); |
| 31 |
} |
| 32 |
|
| 33 |
&__head-name, |
| 34 |
&__head-req { |
| 35 |
color: var(--wppb-fb-text-muted); |
| 36 |
font-size: var(--wppb-fb-font-xs); |
| 37 |
font-weight: 600; |
| 38 |
text-transform: uppercase; |
| 39 |
letter-spacing: 0.02em; |
| 40 |
} |
| 41 |
|
| 42 |
// Align the header labels over their columns: "Field Name" starts past the |
| 43 |
// handle + include-checkbox columns; "Required" sits over the req column. |
| 44 |
&__head-name { |
| 45 |
flex: 1 1 auto; |
| 46 |
padding-left: calc(#{$wppb-woo-handle} + #{$wppb-woo-check} + 2 * var(--wppb-fb-space-sm)); |
| 47 |
} |
| 48 |
|
| 49 |
&__head-req { |
| 50 |
flex: 0 0 #{$wppb-woo-req-col}; |
| 51 |
text-align: center; |
| 52 |
white-space: nowrap; |
| 53 |
} |
| 54 |
|
| 55 |
&__row { |
| 56 |
padding: var(--wppb-fb-space-2xs) 0; |
| 57 |
border-radius: var(--wppb-fb-radius-sm); |
| 58 |
|
| 59 |
// Insertion indicator while a dragged row hovers this one. |
| 60 |
&.is-drag-over { |
| 61 |
box-shadow: inset 0 2px 0 0 var(--wppb-fb-accent); |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
// Drag handle — the only drag initiator (keeps the label input selectable). |
| 66 |
&__handle { |
| 67 |
flex: 0 0 #{$wppb-woo-handle}; |
| 68 |
display: flex; |
| 69 |
align-items: center; |
| 70 |
justify-content: center; |
| 71 |
cursor: grab; |
| 72 |
color: var(--wppb-fb-text-faint); |
| 73 |
|
| 74 |
&:active { cursor: grabbing; } |
| 75 |
|
| 76 |
.dashicons { |
| 77 |
font-size: 16px; |
| 78 |
width: 16px; |
| 79 |
height: 16px; |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
&__include { |
| 84 |
flex: 0 0 #{$wppb-woo-check}; |
| 85 |
margin: 0; |
| 86 |
} |
| 87 |
|
| 88 |
&__req-cell { |
| 89 |
flex: 0 0 #{$wppb-woo-req-col}; |
| 90 |
display: flex; |
| 91 |
align-items: center; |
| 92 |
justify-content: center; |
| 93 |
} |
| 94 |
|
| 95 |
&__req { |
| 96 |
margin: 0; |
| 97 |
} |
| 98 |
|
| 99 |
// Editable label — a text input styled to sit flush like the classic control, |
| 100 |
// with a subtle pencil affordance that surfaces on hover / focus. |
| 101 |
&__name { |
| 102 |
flex: 1 1 auto; |
| 103 |
min-width: 0; |
| 104 |
position: relative; |
| 105 |
display: flex; |
| 106 |
align-items: center; |
| 107 |
|
| 108 |
input[type="text"]="text""] { |
| 109 |
width: 100%; |
| 110 |
min-height: 30px; |
| 111 |
padding: 2px var(--wppb-fb-space-lg) 2px var(--wppb-fb-space-sm); |
| 112 |
font-size: var(--wppb-fb-font-sm); |
| 113 |
line-height: 1.4; |
| 114 |
color: var(--wppb-fb-text-primary); |
| 115 |
background: var(--wppb-fb-surface-default); |
| 116 |
border: 1px solid var(--wppb-fb-border-strong); |
| 117 |
border-radius: var(--wppb-fb-radius-sm); |
| 118 |
box-shadow: none; |
| 119 |
transition: border-color 0.15s ease-in-out; |
| 120 |
|
| 121 |
&::placeholder { |
| 122 |
color: var(--wppb-fb-text-faint); |
| 123 |
} |
| 124 |
|
| 125 |
&:focus { |
| 126 |
border-color: var(--wppb-fb-accent); |
| 127 |
box-shadow: 0 0 0 1px var(--wppb-fb-accent); |
| 128 |
outline: none; |
| 129 |
} |
| 130 |
|
| 131 |
&:disabled { |
| 132 |
background: var(--wppb-fb-surface-subtle); |
| 133 |
border-color: var(--wppb-fb-border-default); |
| 134 |
color: var(--wppb-fb-text-faint); |
| 135 |
} |
| 136 |
} |
| 137 |
|
| 138 |
.dashicons-edit { |
| 139 |
position: absolute; |
| 140 |
right: var(--wppb-fb-space-2xs); |
| 141 |
font-size: 14px; |
| 142 |
width: 14px; |
| 143 |
height: 14px; |
| 144 |
color: var(--wppb-fb-text-faint); |
| 145 |
opacity: 0; |
| 146 |
pointer-events: none; |
| 147 |
transition: opacity 0.15s ease-in-out; |
| 148 |
} |
| 149 |
} |
| 150 |
|
| 151 |
// Hide the pencil while the row is disabled; reveal on hover / focus otherwise. |
| 152 |
&__row:not(.is-included) &__name .dashicons-edit { |
| 153 |
display: none; |
| 154 |
} |
| 155 |
|
| 156 |
&__name:hover .dashicons-edit, |
| 157 |
&__name input[type="text"]="text""]:focus + .dashicons-edit { |
| 158 |
opacity: 0.6; |
| 159 |
} |
| 160 |
} |
| 161 |
|
| 162 |
// Canvas preview — one real title + disabled placeholder input per included |
| 163 |
// sub-field. The input picks up the shared `.wppb-fb-field-preview` frame from |
| 164 |
// _field-block.scss; here we only add the per-sub-field title + spacing. |
| 165 |
.wppb-fb-woo-address { |
| 166 |
&__field:not(:last-child) { |
| 167 |
margin-bottom: var(--wppb-fb-space-lg); |
| 168 |
} |
| 169 |
|
| 170 |
&__label { |
| 171 |
display: block; |
| 172 |
color: var(--wppb-fb-text-primary); |
| 173 |
font-size: var(--wppb-fb-font-md); |
| 174 |
font-weight: 500; |
| 175 |
margin-bottom: var(--wppb-fb-space-2xs); |
| 176 |
} |
| 177 |
} |
| 178 |
|