zammadTailwindPlugin.js 2.2 KB

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