_input-base.scss 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. @use '../../tools' as *;
  2. /**
  3. * Field styles reusable across **all** fields, including:
  4. * Text input, textarea, checkbox, radio, select, etc.
  5. */
  6. @mixin input-base() {
  7. appearance: none;
  8. border-radius: theme('borderRadius.DEFAULT');
  9. color: theme('colors.text-context');
  10. background-color: theme('colors.surface-field');
  11. border: 1px solid theme('colors.border-field-default');
  12. @include more-contrast-interactive();
  13. &:hover {
  14. border-color: theme('colors.border-field-hover');
  15. }
  16. &[disabled],
  17. &[disabled]:hover {
  18. color: theme('colors.text-placeholder');
  19. background-color: theme('colors.surface-field-inactive');
  20. border-color: theme('colors.border-field-inactive');
  21. cursor: not-allowed;
  22. }
  23. // Only show the error state for the specific field in error.
  24. .w-field--error > .w-field__input > &,
  25. // Allow for one wrapper level within StreamField.
  26. .w-field--error > .w-field__input > * > &,
  27. // Ideally, individual widgets should show they are in error state with aria-invalid.
  28. &[aria-invalid='true'] {
  29. border-color: theme('colors.critical.200');
  30. }
  31. &::placeholder {
  32. color: theme('colors.text-placeholder');
  33. }
  34. }