You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tailwind.base.config.js 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2024 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. const path = require('path');
  21. const { fontFamily } = require('tailwindcss/defaultTheme');
  22. const utilities = require('./tailwind-utilities');
  23. module.exports = {
  24. prefix: 'sw-', // Prefix all tailwind classes with the sw- prefix to avoid collisions
  25. theme: {
  26. // Define cursors
  27. cursor: {
  28. auto: 'auto',
  29. default: 'default',
  30. pointer: 'pointer',
  31. 'not-allowed': 'not-allowed',
  32. },
  33. // Define font sizes
  34. fontSize: {
  35. code: ['0.875rem', '1.125rem'], // 14px / 18px
  36. xs: ['0.75rem', '1rem'], // 12px / 16px
  37. sm: ['0.875rem', '1.25rem'], // 14px / 20px
  38. base: ['1rem', '1.5rem'], // 16px / 24px
  39. md: ['1.313rem', '1.75rem'], // 21px / 28px
  40. lg: ['1.5rem', '1.75rem'], // 24px / 28px
  41. xl: ['2.25rem', '3rem'], // 36px / 48px
  42. },
  43. // Define font weights
  44. fontWeight: {
  45. regular: 400,
  46. semibold: 600,
  47. bold: 700,
  48. },
  49. // Define font families
  50. fontFamily: {
  51. sans: ['Inter', ...fontFamily.sans],
  52. mono: ['Ubuntu Mono', ...fontFamily.mono],
  53. },
  54. // Define less order properties than default
  55. order: {
  56. first: '-9999',
  57. last: '9999',
  58. none: '0',
  59. 1: '1',
  60. 2: '2',
  61. 3: '3',
  62. 4: '4',
  63. },
  64. screens: {
  65. sm: '1280px',
  66. lg: '1920px',
  67. },
  68. // Defined spacing values based on our grid size
  69. spacing: {
  70. 0: '0',
  71. '1/2': '0.125rem', // 2px
  72. 1: '0.25rem', // 4px
  73. 2: '0.5rem', // 8px
  74. 3: '0.75rem', // 12px
  75. 4: '1rem', // 16px
  76. 5: '1.25rem', // 20px
  77. 6: '1.5rem', // 24px
  78. 7: '1.75rem', // 28px
  79. 8: '2rem', // 32px
  80. 9: '2.25rem', // 36px
  81. 10: '2.5rem', // 40px
  82. 12: '3rem', // 48px
  83. 14: '3.75rem', // 60px
  84. 16: '4rem', // 64px
  85. 24: '6rem', // 96px
  86. 32: '8rem', // 128px
  87. 40: '10rem', // 160px
  88. 64: '16rem', // 256px
  89. page: '1.25rem', // 20px
  90. },
  91. maxHeight: (twTheme) => twTheme('height'),
  92. maxWidth: (twTheme) => twTheme('width'),
  93. minHeight: (twTheme) => twTheme('height'),
  94. minWidth: (twTheme) => twTheme('width'),
  95. borderRadius: {
  96. 0: '0',
  97. '1/2': '0.125rem', // 2px
  98. 1: '0.25rem', // 4px
  99. 2: '0.5rem', // 8px
  100. pill: '625rem',
  101. },
  102. zIndex: {
  103. normal: '2',
  104. 'project-list-header': '30',
  105. filterbar: '50',
  106. 'content-popup': '52',
  107. 'filterbar-header': '55',
  108. 'dropdown-menu-page': '100',
  109. 'top-navbar': '419',
  110. popup: '420',
  111. 'global-navbar': '421',
  112. sidebar: '421',
  113. 'core-concepts': '422',
  114. 'global-popup': '5000',
  115. 'dropdown-menu': '7500',
  116. 'modal-overlay': 8500,
  117. modal: '9000',
  118. tooltip: '9001',
  119. },
  120. extend: {
  121. width: {
  122. 'abs-150': '150px',
  123. 'abs-200': '200px',
  124. 'abs-250': '250px',
  125. 'abs-300': '300px',
  126. 'abs-350': '350px',
  127. 'abs-400': '400px',
  128. 'abs-500': '500px',
  129. 'abs-600': '600px',
  130. 'abs-800': '800px',
  131. 'input-small': '150px',
  132. 'input-medium': '250px',
  133. 'input-large': '350px',
  134. icon: '1rem', // 16px
  135. },
  136. height: {
  137. 'abs-200': '200px',
  138. icon: '1rem', // 16px
  139. control: '2.25rem', // 36px
  140. },
  141. },
  142. },
  143. corePlugins: {
  144. // Please respect the alphabetical order in the below plugins
  145. alignItems: true, // .sw-items-x classes
  146. alignSelf: true, // .sw-self-x classes
  147. borderRadius: true, // .sw-rounded-x classes
  148. boxSizing: true, // .sw-box-x classes
  149. cursor: true, // .sw-cursor-not-allowed
  150. display: true, // display classes .sw-grid .sw-flex
  151. flex: true, // .sw-flex-1 .sw-flex-auto ... classes
  152. flexDirection: true, // .sw-flex-row .sw-flex-col-reverse ... classes
  153. flexGrow: true, // .sw-flex-grow .sw-flex-grow-0 classes
  154. flexShrink: true, // .sw-flex-shrink .sw-flex-shrink-0 classes
  155. flexWrap: true, // .sw-flex-wrap sw-flex-nowrap ... classes
  156. fontFamily: true, // .sw-font-sans .sw-font-mono classes
  157. fontSize: true, // .sw-text-sm and similar classes
  158. fontWeight: true, // .sw-font-x classes
  159. gap: true, // .sw-gap-x classes based on spacing
  160. gridAutoFlow: true, // all css grid related classes: .sw-grid-cols-x .sw-col-span-x
  161. gridColumn: true,
  162. gridColumnEnd: true,
  163. gridColumnStart: true,
  164. gridRow: true,
  165. gridRowEnd: true,
  166. gridRowStart: true,
  167. gridTemplateColumns: true,
  168. gridTemplateRows: true,
  169. height: true, // height classes .sw-h-x based on spacing + some more
  170. inset: true, // placement classes .sw-top-x based on spacing + some more
  171. justifyContent: true, // .sw-justify-x classes
  172. lineHeight: true, // .sw-leading-x classes
  173. margin: true, // .sw-m-x classes based on spacing
  174. maxHeight: true, // sw-max-height classes .sw-max-h-x based on spacing + some more
  175. maxWidth: true, // sw-max-width classes .sw-max-w-x based on spacing + some more
  176. minHeight: true, // sw-min-height classes .sw-min-h-x based on spacing + some more
  177. minWidth: true, // sw-min-width classes .sw-min-w-x based on spacing + some more
  178. opacity: true, // sw-opacity-x classes
  179. order: true, // .sw-order-x classes
  180. overflow: true, // .sw-overflow-x classes
  181. padding: true, // .sw-p-x classes based on spacing
  182. pointerEvents: true, //.sw-pointer-events-none .sw-pointer-events-auto
  183. position: true, // position classes .sw-relative .sw-absolute
  184. preflight: false, // disable preflight
  185. textAlign: true, // .sw-text-x classes
  186. textOverflow: true, // .sw-text-ellipsis, .sw-truncate
  187. textTransform: true, // sw-uppercase, .sw-capitalize
  188. userSelect: true, // .sw-select-none classes
  189. verticalAlign: true, // .sw-align-x classes
  190. width: true, // .sw-w-x classes based on spacing + some more
  191. whitespace: true, // sw-whitespace-x classes
  192. wordBreak: true, // .sw-break-normal, sw-break-all, sw-break-words classes
  193. zIndex: true, // .sw-z-x classes
  194. },
  195. plugins: [utilities],
  196. content: [
  197. path.resolve(__dirname, './src/**/!(__tests__|@types|api)/*.{ts,tsx}'),
  198. path.resolve(__dirname, './design-system/src/**/!(__tests__|@types|theme|helpers)/*.{ts,tsx}'),
  199. ],
  200. };