| 1 |
// ===== ai-shared/tokens.scss — design tokens + keyframes for the BetterDocs AI surfaces ===== |
| 2 |
// Ported from the "BetterDocs AI Studio" mockup. The kit components (kit.js, |
| 3 |
// PreviewAccept.js) reference these CSS custom properties via inline `var(--x)` |
| 4 |
// styles, so the variables are scoped to `.bd-ai-scope` — every portal root the |
| 5 |
// kit renders (modal overlay, injected header button) carries that class, and |
| 6 |
// CSS custom properties inherit down the DOM subtree of the portal element. |
| 7 |
|
| 8 |
.bd-ai-scope { |
| 9 |
--bg: #f4f6f8; |
| 10 |
--card: #ffffff; |
| 11 |
--border: #e6e8ec; |
| 12 |
--border-soft: #eef0f3; |
| 13 |
--ink: #0f172a; |
| 14 |
--ink-2: #1f2937; |
| 15 |
--muted: #6b7280; |
| 16 |
--muted-2: #94a3b8; |
| 17 |
--green: #00b884; |
| 18 |
--green-600: #00956b; |
| 19 |
--green-700: #007557; |
| 20 |
--green-50: #e0f6ef; |
| 21 |
--green-100: #b8ecdb; |
| 22 |
--rose-50: #feecec; |
| 23 |
--rose-700: #b91c1c; |
| 24 |
--shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04); |
| 25 |
--shadow-md: 0 4px 14px rgba(15, 23, 42, 0.06); |
| 26 |
--shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.18); |
| 27 |
--shadow-pop: 0 12px 34px rgba(15, 23, 42, 0.16); |
| 28 |
--radius: 16px; |
| 29 |
--radius-sm: 10px; |
| 30 |
// AI accent — aligned to the BetterDocs green design system (was pink). |
| 31 |
--ai: #00b884; |
| 32 |
--ai-600: #00956b; |
| 33 |
--ai-100: #b8ecdb; |
| 34 |
--ai-50: #e0f6ef; |
| 35 |
// WP-admin notice + link |
| 36 |
--wp-red: #d63638; |
| 37 |
--wp-red-50: #fbebed; |
| 38 |
--wp-blue: #3858e9; |
| 39 |
|
| 40 |
// BetterDocs admin neutral ramp (mirrored from react-src/admin/scss/utils/ |
| 41 |
// _common.scss) so the shared FAQ-builder markup reused here (dropdown, |
| 42 |
// page-tabs, close button) resolves the same `--text-color-*` tokens. |
| 43 |
--text-color-25: #fcfcfd; |
| 44 |
--text-color-50: #f9fafb; |
| 45 |
--text-color-100: #f0f0f0; |
| 46 |
--text-color-150: #eff2f7; |
| 47 |
--text-color-200: #eaecf0; |
| 48 |
--text-color-300: #dde2e4; |
| 49 |
--text-color-400: #d0d5dd; |
| 50 |
--text-color-500: #98a2b3; |
| 51 |
--text-color-600: #667085; |
| 52 |
--text-color-700: #344054; |
| 53 |
--text-color-800: #202223; |
| 54 |
--text-color-850: #475467; |
| 55 |
--text-color-900: #101828; |
| 56 |
--text-color-950: #1d2939; |
| 57 |
|
| 58 |
// Match the BetterDocs admin design system font (was "Plus Jakarta Sans"). |
| 59 |
font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; |
| 60 |
|
| 61 |
* { |
| 62 |
box-sizing: border-box; |
| 63 |
} |
| 64 |
|
| 65 |
// Native <select> styled to match the BetterDocs dashboard select control |
| 66 |
// (.bd-faq-select__control): white surface, 1px neutral border, 8px radius, |
| 67 |
// 40px control height, subtle shadow, green focus ring. Used by every picker |
| 68 |
// in the AI modals (language, source, git, tone, length). |
| 69 |
.bd-ai-select { |
| 70 |
width: 100%; |
| 71 |
appearance: none; |
| 72 |
-webkit-appearance: none; |
| 73 |
height: 40px; |
| 74 |
min-height: 40px; |
| 75 |
padding: 0 34px 0 14px; |
| 76 |
border: 1px solid #d0d5dd; // --text-color-400 |
| 77 |
border-radius: 8px; |
| 78 |
background: var(--card); |
| 79 |
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); |
| 80 |
font-family: inherit; |
| 81 |
font-size: 13.5px; |
| 82 |
font-weight: 500; |
| 83 |
line-height: 1.4; |
| 84 |
color: var(--ink-2); |
| 85 |
outline: none; |
| 86 |
cursor: pointer; |
| 87 |
transition: border-color 0.14s, box-shadow 0.14s; |
| 88 |
|
| 89 |
&:hover { |
| 90 |
border-color: #98a2b3; // --text-color-500 |
| 91 |
} |
| 92 |
&:focus { |
| 93 |
border-color: var(--green); |
| 94 |
box-shadow: 0 0 0 3px rgba(0, 184, 132, 0.16); |
| 95 |
} |
| 96 |
&:disabled { |
| 97 |
background: var(--bg); |
| 98 |
color: var(--muted); |
| 99 |
cursor: not-allowed; |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
// react-select dropdown that mirrors the BetterDocs dashboard |
| 104 |
// "betterdocs-dropdown" control (FAQ order / bulk actions): 1px neutral |
| 105 |
// border, 8px radius, 40px control, green focus ring, and a styled option |
| 106 |
// menu with rounded "pill" options + a green tick on the selected one. |
| 107 |
// Used for the source / git / language pickers in the AI modals. |
| 108 |
.betterdocs-dropdown-wrapper { |
| 109 |
position: relative; |
| 110 |
|
| 111 |
.betterdocs-dropdown-select { |
| 112 |
font-family: inherit; |
| 113 |
font-size: 13.5px; |
| 114 |
font-weight: 500; |
| 115 |
|
| 116 |
.betterdocs-dropdown__control { |
| 117 |
min-height: 36px; |
| 118 |
border: 1px solid #d0d5dd; |
| 119 |
border-radius: 8px; |
| 120 |
background-color: var(--card); |
| 121 |
color: var(--ink); |
| 122 |
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); |
| 123 |
cursor: pointer; |
| 124 |
transition: border-color 0.14s, box-shadow 0.14s; |
| 125 |
|
| 126 |
&:hover { |
| 127 |
border-color: #98a2b3; |
| 128 |
} |
| 129 |
&--is-focused { |
| 130 |
border-color: var(--green); |
| 131 |
box-shadow: 0 0 0 3px rgba(0, 184, 132, 0.16); |
| 132 |
outline: none; |
| 133 |
} |
| 134 |
} |
| 135 |
|
| 136 |
.betterdocs-dropdown__value-container { |
| 137 |
padding: 0 6px 0 12px; |
| 138 |
} |
| 139 |
.betterdocs-dropdown__single-value { |
| 140 |
color: var(--ink-2); |
| 141 |
} |
| 142 |
.betterdocs-dropdown__placeholder { |
| 143 |
color: var(--muted); |
| 144 |
} |
| 145 |
.betterdocs-dropdown__input-container { |
| 146 |
color: var(--ink-2); |
| 147 |
} |
| 148 |
// react-select renders a bare <input class="betterdocs-dropdown__input"> |
| 149 |
// for typing/search. wp-admin's global `input:focus` paints its blue ring |
| 150 |
// on that input — reset it so the only focus indicator is the green ring on |
| 151 |
// .betterdocs-dropdown__control--is-focused. Applies to every react-select |
| 152 |
// input in the AI modals (source / git / language pickers). |
| 153 |
.betterdocs-dropdown__input, |
| 154 |
.betterdocs-dropdown__input:focus, |
| 155 |
.betterdocs-dropdown__input input, |
| 156 |
.betterdocs-dropdown__input input:focus { |
| 157 |
border: 0 !important; |
| 158 |
outline: none !important; |
| 159 |
box-shadow: none !important; |
| 160 |
} |
| 161 |
.betterdocs-dropdown__indicator-separator { |
| 162 |
display: none; |
| 163 |
} |
| 164 |
.betterdocs-dropdown__dropdown-indicator { |
| 165 |
color: var(--muted); |
| 166 |
padding: 0 10px 0 4px; |
| 167 |
|
| 168 |
svg { |
| 169 |
width: 18px; |
| 170 |
height: 18px; |
| 171 |
} |
| 172 |
} |
| 173 |
|
| 174 |
.betterdocs-dropdown__menu { |
| 175 |
margin-top: 6px; |
| 176 |
border-radius: 8px; |
| 177 |
overflow: hidden; |
| 178 |
background-color: var(--card); |
| 179 |
box-shadow: 0 4px 16px rgba(16, 24, 40, 0.12); |
| 180 |
z-index: 30; |
| 181 |
|
| 182 |
.betterdocs-dropdown__menu-list { |
| 183 |
padding: 8px; |
| 184 |
display: flex; |
| 185 |
flex-direction: column; |
| 186 |
gap: 4px; |
| 187 |
} |
| 188 |
.betterdocs-dropdown__option { |
| 189 |
display: flex; |
| 190 |
align-items: center; |
| 191 |
padding: 8px 12px; |
| 192 |
border-radius: 6px; |
| 193 |
font-size: 13px; |
| 194 |
color: var(--ink-2); |
| 195 |
background-color: transparent; |
| 196 |
cursor: pointer; |
| 197 |
|
| 198 |
&--is-focused { |
| 199 |
background-color: #f9fafb; // --text-color-50 |
| 200 |
} |
| 201 |
&--is-selected { |
| 202 |
background-color: #f9fafb; // --text-color-50 (ash, not green) |
| 203 |
color: var(--green-600); |
| 204 |
font-weight: 600; |
| 205 |
|
| 206 |
&::after { |
| 207 |
content: ""; |
| 208 |
margin-left: auto; |
| 209 |
width: 16px; |
| 210 |
height: 16px; |
| 211 |
flex-shrink: 0; |
| 212 |
background: no-repeat center / contain |
| 213 |
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2300956b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); |
| 214 |
} |
| 215 |
} |
| 216 |
} |
| 217 |
} |
| 218 |
} |
| 219 |
} |
| 220 |
|
| 221 |
::-webkit-scrollbar { |
| 222 |
width: 10px; |
| 223 |
height: 10px; |
| 224 |
} |
| 225 |
::-webkit-scrollbar-thumb { |
| 226 |
background: #d8dde3; |
| 227 |
border-radius: 10px; |
| 228 |
} |
| 229 |
::-webkit-scrollbar-track { |
| 230 |
background: transparent; |
| 231 |
} |
| 232 |
} |
| 233 |
|
| 234 |
// Keyframes are global by spec — define once; referenced from inline `animation`. |
| 235 |
@keyframes bd-ai-fadeIn { |
| 236 |
from { opacity: 0; } |
| 237 |
to { opacity: 1; } |
| 238 |
} |
| 239 |
@keyframes bd-ai-modalIn { |
| 240 |
from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); } |
| 241 |
to { opacity: 1; transform: translate(-50%, -50%) scale(1); } |
| 242 |
} |
| 243 |
@keyframes bd-ai-popIn { |
| 244 |
from { opacity: 0; transform: translateY(6px) scale(0.97); } |
| 245 |
to { opacity: 1; transform: translateY(0) scale(1); } |
| 246 |
} |
| 247 |
@keyframes bd-ai-barIn { |
| 248 |
from { opacity: 0; transform: translateY(6px) scale(0.96); } |
| 249 |
to { opacity: 1; transform: translateY(0) scale(1); } |
| 250 |
} |
| 251 |
@keyframes bd-ai-spin { |
| 252 |
to { transform: rotate(360deg); } |
| 253 |
} |
| 254 |
@keyframes bd-ai-shimmer { |
| 255 |
0% { background-position: -480px 0; } |
| 256 |
100% { background-position: 480px 0; } |
| 257 |
} |
| 258 |
@keyframes bd-ai-blockIn { |
| 259 |
from { opacity: 0; transform: translateY(8px); } |
| 260 |
to { opacity: 1; transform: translateY(0); } |
| 261 |
} |
| 262 |
@keyframes bd-ai-dotPulse { |
| 263 |
0%, 80%, 100% { opacity: 0.25; } |
| 264 |
40% { opacity: 1; } |
| 265 |
} |
| 266 |
|