zammadTailwindPlugin.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. const defaultTheme = require('tailwindcss/defaultTheme')
  3. const plugin = require('tailwindcss/plugin')
  4. module.exports = plugin(
  5. ({ addVariant, matchUtilities, theme }) => {
  6. matchUtilities(
  7. {
  8. 'pb-safe': (value) => ({
  9. paddingBottom: `calc(var(--safe-bottom, 0) + ${value})`,
  10. }),
  11. 'mb-safe': (value) => ({
  12. marginBottom: `calc(var(--safe-bottom, 0) + ${value})`,
  13. }),
  14. },
  15. { values: theme('padding') },
  16. )
  17. addVariant('formkit-populated', [
  18. '&[data-populated]',
  19. '[data-populated] &',
  20. '[data-populated]&',
  21. ])
  22. addVariant('formkit-required', [
  23. '&[data-required]',
  24. '[data-required] &',
  25. '[data-required]&',
  26. ])
  27. addVariant('formkit-dirty', [
  28. '&[data-dirty]',
  29. '[data-dirty] &',
  30. '[data-dirty]&',
  31. ])
  32. addVariant('formkit-is-checked', [
  33. '&[data-is-checked]',
  34. '[data-is-checked] &',
  35. '[data-is-checked]&',
  36. ])
  37. addVariant('formkit-label-hidden', [
  38. '&[data-label-hidden]',
  39. '[data-label-hidden] &',
  40. '[data-label-hidden]&',
  41. ])
  42. addVariant('formkit-variant-primary', [
  43. '[data-variant="primary"] &',
  44. '[data-variant="primary"]&',
  45. ])
  46. addVariant('formkit-variant-secondary', [
  47. '[data-variant="secondary"] &',
  48. '[data-variant="secondary"]&',
  49. ])
  50. addVariant('formkit-variant-submit', [
  51. '[data-variant="submit"] &',
  52. '[data-variant="submit"]&',
  53. ])
  54. addVariant('formkit-variant-danger', [
  55. '[data-variant="danger"] &',
  56. '[data-variant="danger"]&',
  57. ])
  58. },
  59. {
  60. theme: {
  61. extend: {
  62. fontFamily: {
  63. sans: [
  64. '"Fira Sans"',
  65. '"Helvetica Neue"',
  66. 'Helvetica',
  67. 'Arial',
  68. 'sans-serif',
  69. ],
  70. mono: ['"Fira Mono"', ...defaultTheme.fontFamily.mono],
  71. },
  72. colors: {
  73. transparent: 'transparent',
  74. current: 'currentColor',
  75. },
  76. minWidth: {
  77. '1/2': '50%',
  78. },
  79. },
  80. },
  81. },
  82. )