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.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. text: 'text',
  32. 'not-allowed': 'not-allowed',
  33. },
  34. // Define font sizes
  35. fontSize: {
  36. code: ['0.875rem', '1.125rem'], // 14px / 18px
  37. xs: ['0.75rem', '1rem'], // 12px / 16px
  38. sm: ['0.875rem', '1.25rem'], // 14px / 20px
  39. base: ['1rem', '1.5rem'], // 16px / 24px
  40. md: ['1.313rem', '1.75rem'], // 21px / 28px
  41. lg: ['1.5rem', '1.75rem'], // 24px / 28px
  42. xl: ['2.25rem', '3rem'], // 36px / 48px
  43. },
  44. // Define font weights
  45. fontWeight: {
  46. regular: 400,
  47. semibold: 600,
  48. bold: 700,
  49. },
  50. // Define font families
  51. fontFamily: {
  52. sans: ['Inter', ...fontFamily.sans],
  53. mono: ['Ubuntu Mono', ...fontFamily.mono],
  54. },
  55. // Define less order properties than default
  56. order: {
  57. first: '-9999',
  58. last: '9999',
  59. none: '0',
  60. 1: '1',
  61. 2: '2',
  62. 3: '3',
  63. 4: '4',
  64. },
  65. screens: {
  66. sm: '1280px',
  67. lg: '1920px',
  68. },
  69. // Defined spacing values based on our grid size
  70. spacing: {
  71. 0: '0',
  72. '1/2': '0.125rem', // 2px
  73. 1: '0.25rem', // 4px
  74. 2: '0.5rem', // 8px
  75. 3: '0.75rem', // 12px
  76. 4: '1rem', // 16px
  77. 5: '1.25rem', // 20px
  78. 6: '1.5rem', // 24px
  79. 7: '1.75rem', // 28px
  80. 8: '2rem', // 32px
  81. 9: '2.25rem', // 36px
  82. 10: '2.5rem', // 40px
  83. 12: '3rem', // 48px
  84. 14: '3.75rem', // 60px
  85. 16: '4rem', // 64px
  86. 24: '6rem', // 96px
  87. 32: '8rem', // 128px
  88. 40: '10rem', // 160px
  89. 64: '16rem', // 256px
  90. page: '1.25rem', // 20px
  91. },
  92. maxHeight: (twTheme) => twTheme('height'),
  93. maxWidth: (twTheme) => twTheme('width'),
  94. minHeight: (twTheme) => twTheme('height'),
  95. minWidth: (twTheme) => twTheme('width'),
  96. borderRadius: {
  97. 0: '0',
  98. '1/2': '0.125rem', // 2px
  99. 1: '0.25rem', // 4px
  100. 2: '0.5rem', // 8px
  101. pill: '625rem',
  102. },
  103. zIndex: {
  104. normal: '2',
  105. 'project-list-header': '30',
  106. filterbar: '50',
  107. 'content-popup': '52',
  108. 'filterbar-header': '55',
  109. 'dropdown-menu-page': '100',
  110. 'top-navbar': '419',
  111. popup: '420',
  112. 'global-navbar': '421',
  113. sidebar: '421',
  114. 'core-concepts': '422',
  115. 'global-popup': '5000',
  116. 'dropdown-menu': '7500',
  117. 'modal-overlay': 8500,
  118. modal: '9000',
  119. tooltip: '9001',
  120. },
  121. extend: {
  122. width: {
  123. 'abs-150': '150px',
  124. 'abs-200': '200px',
  125. 'abs-250': '250px',
  126. 'abs-300': '300px',
  127. 'abs-350': '350px',
  128. 'abs-400': '400px',
  129. 'abs-500': '500px',
  130. 'abs-600': '600px',
  131. 'abs-800': '800px',
  132. 'input-small': '150px',
  133. 'input-medium': '250px',
  134. 'input-large': '350px',
  135. icon: '1rem', // 16px
  136. },
  137. height: {
  138. 'abs-200': '200px',
  139. icon: '1rem', // 16px
  140. control: '2.25rem', // 36px
  141. },
  142. },
  143. },
  144. corePlugins: {
  145. // Please respect the alphabetical order in the below plugins
  146. alignItems: true, // .sw-items-x classes
  147. alignSelf: true, // .sw-self-x classes
  148. borderRadius: true, // .sw-rounded-x classes
  149. boxSizing: true, // .sw-box-x classes
  150. cursor: true, // .sw-cursor-not-allowed
  151. display: true, // display classes .sw-grid .sw-flex
  152. flex: true, // .sw-flex-1 .sw-flex-auto ... classes
  153. flexDirection: true, // .sw-flex-row .sw-flex-col-reverse ... classes
  154. flexGrow: true, // .sw-flex-grow .sw-flex-grow-0 classes
  155. flexShrink: true, // .sw-flex-shrink .sw-flex-shrink-0 classes
  156. flexWrap: true, // .sw-flex-wrap sw-flex-nowrap ... classes
  157. fontFamily: true, // .sw-font-sans .sw-font-mono classes
  158. fontSize: true, // .sw-text-sm and similar classes
  159. fontWeight: true, // .sw-font-x classes
  160. gap: true, // .sw-gap-x classes based on spacing
  161. gridAutoFlow: true, // all css grid related classes: .sw-grid-cols-x .sw-col-span-x
  162. gridColumn: true,
  163. gridColumnEnd: true,
  164. gridColumnStart: true,
  165. gridRow: true,
  166. gridRowEnd: true,
  167. gridRowStart: true,
  168. gridTemplateColumns: true,
  169. gridTemplateRows: true,
  170. height: true, // height classes .sw-h-x based on spacing + some more
  171. inset: true, // placement classes .sw-top-x based on spacing + some more
  172. justifyContent: true, // .sw-justify-x classes
  173. lineHeight: true, // .sw-leading-x classes
  174. margin: true, // .sw-m-x classes based on spacing
  175. maxHeight: true, // sw-max-height classes .sw-max-h-x based on spacing + some more
  176. maxWidth: true, // sw-max-width classes .sw-max-w-x based on spacing + some more
  177. minHeight: true, // sw-min-height classes .sw-min-h-x based on spacing + some more
  178. minWidth: true, // sw-min-width classes .sw-min-w-x based on spacing + some more
  179. opacity: true, // sw-opacity-x classes
  180. order: true, // .sw-order-x classes
  181. overflow: true, // .sw-overflow-x classes
  182. padding: true, // .sw-p-x classes based on spacing
  183. pointerEvents: true, //.sw-pointer-events-none .sw-pointer-events-auto
  184. position: true, // position classes .sw-relative .sw-absolute
  185. preflight: false, // disable preflight
  186. textAlign: true, // .sw-text-x classes
  187. textOverflow: true, // .sw-text-ellipsis, .sw-truncate
  188. textTransform: true, // sw-uppercase, .sw-capitalize
  189. userSelect: true, // .sw-select-none classes
  190. verticalAlign: true, // .sw-align-x classes
  191. width: true, // .sw-w-x classes based on spacing + some more
  192. whitespace: true, // sw-whitespace-x classes
  193. wordBreak: true, // .sw-break-normal, sw-break-all, sw-break-words classes
  194. zIndex: true, // .sw-z-x classes
  195. },
  196. plugins: [utilities],
  197. content: [
  198. path.resolve(__dirname, './src/**/!(__tests__|@types|api)/*.{ts,tsx}'),
  199. path.resolve(__dirname, './design-system/src/**/!(__tests__|@types|theme|helpers)/*.{ts,tsx}'),
  200. ],
  201. };