@obosbbl/grunnmuren-tailwind 2.0.0-canary.0 → 2.0.0-canary.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @obosbbl/grunnmuren-tailwind
2
2
 
3
- [![npm version](https://badge.fury.io/js/@obosbbl%2Fgrunnmuren-tailwind.svg)](https://www.npmjs.com/package/@obosbbl/grunnmuren-tailwind)
3
+ [![npm canary version](https://img.shields.io/npm/v/@obosbbl%2Fgrunnmuren-tailwind/canary.svg)](https://www.npmjs.com/package/@obosbbl/grunnmuren-tailwind)
4
4
 
5
5
  Grunnmuren Tailwind preset. See the [Tailwind documentation](https://tailwindcss.com/docs/presets) for more information about how presets work.
6
6
 
@@ -8,14 +8,10 @@ Grunnmuren Tailwind preset. See the [Tailwind documentation](https://tailwindcss
8
8
 
9
9
  ```sh
10
10
  # npm
11
- npm install -D @obosbbl/grunnmuren-tailwind tailwindcss postcss autoprefixer
11
+ npm install -D @obosbbl/grunnmuren-tailwind@canary tailwindcss postcss autoprefixer
12
12
 
13
13
  # pnpm
14
- pnpm add -D @obosbbl/grunnmuren-tailwind tailwindcss postcss autoprefixer
15
-
16
- # yarn
17
- yarn add -D @obosbbl/grunnmuren-tailwind tailwindcss postcss autoprefixer
18
-
14
+ pnpm add -D @obosbbl/grunnmuren-tailwind@canary tailwindcss postcss autoprefixer
19
15
  ```
20
16
 
21
17
  ## Usage
@@ -33,7 +29,7 @@ module.exports = {
33
29
  './src/app/**/*.{js,ts,jsx,tsx,}',
34
30
 
35
31
  // If you're using Grunnmuren's React components
36
- './node_modules/@obosbbl/grunnmuren-react/dist/**/*.js',
32
+ './node_modules/@obosbbl/grunnmuren-react/dist/**/*.{mjs,js}',
37
33
  ],
38
34
  };
39
35
  ```
@@ -61,19 +57,39 @@ module.exports = {
61
57
  };
62
58
  ```
63
59
 
60
+ ## Fonts
61
+
62
+ Fonts are automatically loaded from OBOS' CDN, so you don't have to host the font files yourself.
63
+
64
+ If you use [Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP), you have to allow `https://www.obos.no` as a [font-src](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/font-src), otherwise the fonts will be blocked from loading.
65
+
66
+ The preset includes a (local) fallback font to prevent [CLS](https://web.dev/articles/cls) while the fonts are loading. This is similar to the [font optimization in Next](https://nextjs.org/docs/app/building-your-application/optimizing/fonts). This is enabled by default, but can be disabled with the `includeFontFallback` option.
67
+
68
+ The fallback font metrics is generated with a script that can be run with `pnpm font-fallback` (requires [Bun](https://bun.sh/)). If the fonts are changed, the script must be rerun and the resulting file commited.
69
+
64
70
  ## Migrating from v1?
65
71
 
66
72
  To ease the transition from v1 to v2 of Grunnmuren, it is possible to configure the preset to be (partially) compatible with v1. This allows you to use v2 of the Tailwind preset with v1 of the React components, and upgrade your application over time instead of a full migration.
67
73
 
68
74
  To do that you need to configure the preset with `legacyV1Compatibility` option.
69
75
 
76
+ ## Options
77
+
70
78
  ```js
71
79
  // tailwind.config.js
72
80
 
73
81
  /** @type {import('tailwindcss').Config} */
74
82
  module.exports = {
75
83
  presets: [
76
- require('@obosbbl/grunnmuren-tailwind')({ legacyV1Compatibility: true }),
84
+ require('@obosbbl/grunnmuren-tailwind')({ includeFontFallback: false }),
77
85
  ],
86
+ // content: [ ... ]
78
87
  };
79
88
  ```
89
+
90
+ The preset supports the following options:
91
+
92
+ | Name | Default value | Description |
93
+ | --------------------- | ------------- | --------------------------------------------------- |
94
+ | includeFontFallback | `true` | Whether the preset includes a font fallback |
95
+ | legacyV1Compatibility | `false` | Configures partial compatibility with Grunnmuren v1 |
@@ -0,0 +1 @@
1
+ module.exports = {"OBOSText":{"font-family":"\"__OBOSText_Fallback\"","src":"local(\"Arial\")","size-adjust":"100%","ascent-override":"94%","descent-override":"26%","line-gap-override":"0%"},"OBOSDisplay":{"font-family":"\"__OBOSDisplay_Fallback\"","src":"local(\"Arial\")","size-adjust":"100%","ascent-override":"94%","descent-override":"26%","line-gap-override":"0%"}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-tailwind",
3
- "version": "2.0.0-canary.0",
3
+ "version": "2.0.0-canary.10",
4
4
  "description": "Grunnmuren Tailwind preset",
5
5
  "repository": {
6
6
  "url": "https://github.com/code-obos/grunnmuren"
@@ -11,16 +11,21 @@
11
11
  ".": "./tailwind-base.cjs"
12
12
  },
13
13
  "files": [
14
- "tailwind-base.cjs"
14
+ "tailwind-base.cjs",
15
+ "fonts/font-fallback.js"
15
16
  ],
16
17
  "dependencies": {
17
18
  "@tailwindcss/aspect-ratio": "^0.4.2",
18
- "@tailwindcss/typography": "^0.5.10"
19
+ "@tailwindcss/typography": "^0.5.10",
20
+ "tailwindcss-animate": "^1.0.7"
19
21
  },
20
22
  "devDependencies": {
21
- "tailwindcss": "3.3.5"
23
+ "tailwindcss": "3.4.17"
22
24
  },
23
25
  "peerDependencies": {
24
- "tailwindcss": "^3.3.5"
26
+ "tailwindcss": "^3.4.0"
27
+ },
28
+ "scripts": {
29
+ "font-fallback": "bun --cwd=./fonts ./generate-font-fallback.ts"
25
30
  }
26
31
  }
package/tailwind-base.cjs CHANGED
@@ -1,32 +1,148 @@
1
+ const defaultTheme = require('tailwindcss/defaultTheme');
1
2
  const plugin = require('tailwindcss/plugin');
3
+ const fontFallbacks = require('./fonts/font-fallback');
2
4
 
3
- const obosFonts = [
4
- {
5
- fontWeight: 400,
6
- fontStyle: 'normal',
7
- url: 'https://www.obos.no/fonts/OBOSText-Regular.woff2',
5
+ const fontDeclarations = {
6
+ OBOSText: [
7
+ {
8
+ fontWeight: 400,
9
+ fontStyle: 'normal',
10
+ url: 'https://www.obos.no/fonts/OBOSText-Regular.woff2',
11
+ },
12
+ {
13
+ fontWeight: 400,
14
+ fontStyle: 'italic',
15
+ url: 'https://www.obos.no/fonts/OBOSText-Italic.woff2',
16
+ },
17
+ {
18
+ fontWeight: 500,
19
+ fontStyle: 'normal',
20
+ url: 'https://www.obos.no/fonts/OBOSText-Medium.woff2',
21
+ },
22
+ ],
23
+ OBOSDisplay: [
24
+ {
25
+ url: 'https://www.obos.no/fonts/OBOSDisplay-SemiBold.woff2',
26
+ },
27
+ ],
28
+ };
29
+
30
+ /**
31
+ * Styles for typography that are reused in both component classes and prose (through the tailwind typography plugin)
32
+ */
33
+ const typography = {
34
+ headingXlText: {
35
+ fontWeight: 'semibold',
36
+ small: {
37
+ fontSize: '2.8125rem',
38
+ lineHeight: '3.625rem',
39
+ },
40
+ large: {
41
+ fontSize: '3.9375rem',
42
+ lineHeight: '5.125rem',
43
+ },
44
+ },
45
+ headingLText: {
46
+ fontWeight: 'semibold',
47
+ small: {
48
+ fontSize: '1.8125rem',
49
+ lineHeight: '2.75rem',
50
+ },
51
+ large: {
52
+ fontSize: '2.25rem',
53
+ lineHeight: '3.5rem',
54
+ },
55
+ },
56
+ headingMText: {
57
+ fontWeight: 'medium',
58
+ small: {
59
+ fontSize: '1.4375rem',
60
+ lineHeight: '2.25rem',
61
+ },
62
+ large: {
63
+ fontSize: '1.625rem',
64
+ lineHeight: '2.5625rem',
65
+ },
66
+ },
67
+ headingSText: {
68
+ fontWeight: 'medium',
69
+ small: {
70
+ fontSize: '1.1875rem',
71
+ lineHeight: '1.1875rem',
72
+ },
73
+ large: {
74
+ fontSize: '1.3125rem',
75
+ lineHeight: '2.125rem',
76
+ },
77
+ },
78
+ headingXsText: {
79
+ fontWeight: 'medium',
80
+ small: {
81
+ fontSize: '1.125rem',
82
+ lineHeight: '1.75rem',
83
+ },
84
+ large: {
85
+ fontSize: '1.1875rem',
86
+ lineHeight: '1.9375rem',
87
+ },
88
+ },
89
+ paragraphText: {
90
+ fontSize: '1rem', // 1rem is the base font size, which is obviously the default size. But it is set explicitly here to make it easier to configure in the future, if this size changes.
91
+ lineHeight: '1.625rem',
8
92
  },
9
- {
10
- fontWeight: 400,
11
- fontStyle: 'italic',
12
- url: 'https://www.obos.no/fonts/OBOSText-Italic.woff2',
93
+ leadText: {
94
+ fontWeight: 'medium',
95
+ small: {
96
+ fontSize: '1.4375rem',
97
+ lineHeight: '2.25rem',
98
+ },
99
+ large: {
100
+ fontSize: '1.625rem',
101
+ lineHeight: '2.5625rem',
102
+ },
13
103
  },
14
- {
15
- fontWeight: 500,
16
- fontStyle: 'normal',
17
- url: 'https://www.obos.no/fonts/OBOSText-Medium.woff2',
104
+ blockquoteText: {
105
+ fontWeight: 'medium',
106
+ display: 'grid',
107
+ gridTemplateColumns: '3rem 1fr',
108
+ columnGap: '0.4375rem',
109
+ small: {
110
+ fontSize: '1.4375rem',
111
+ lineHeight: '2.25rem',
112
+ },
113
+ large: {
114
+ fontSize: '1.625rem',
115
+ lineHeight: '2.5625rem',
116
+ },
117
+ before: {
118
+ content: '"“"',
119
+ fontFamily: 'OBOSDisplay',
120
+ fontSize: '4.6875rem',
121
+ lineHeight: '1.6875rem',
122
+ fontWeight: '400',
123
+ fontStyle: 'normal',
124
+ },
18
125
  },
19
- {
20
- fontWeight: 700,
21
- fontStyle: 'normal',
22
- url: 'https://www.obos.no/fonts/OBOSText-Bold.woff2',
126
+ descriptionText: {
127
+ small: {
128
+ fontSize: '0.875rem',
129
+ lineHeight: '1.4375rem',
130
+ },
131
+ large: {
132
+ fontSize: '0.875rem',
133
+ lineHeight: '1.375rem',
134
+ },
23
135
  },
24
- ];
136
+ };
25
137
 
26
138
  /**
139
+ * @param {boolean} options.includeFontFallback
27
140
  * @param {boolean} options.legacyV1Compatibility
28
141
  */
29
142
  module.exports = (options = {}) => {
143
+ options.includeFontFallback ??= true;
144
+ options.legacyV1Compatibility ??= false;
145
+
30
146
  const v1CompatibilityPlugins = [];
31
147
 
32
148
  if (options.legacyV1Compatibility) {
@@ -39,18 +155,15 @@ module.exports = (options = {}) => {
39
155
  );
40
156
  }
41
157
 
42
- const fontFamily = 'OBOSFont';
43
- const fonts = obosFonts;
44
- const containerSize = '92rem';
45
-
46
158
  return {
47
159
  plugins: [
48
160
  ...v1CompatibilityPlugins,
49
161
  require('@tailwindcss/typography'),
50
- plugin(function ({ addBase, addComponents }) {
162
+ require('tailwindcss-animate'),
163
+ plugin(({ addBase, addComponents, theme }) => {
51
164
  addBase({
52
165
  html: {
53
- '@apply text-black antialiased font-normal': {},
166
+ '@apply text-black antialiased font-normal font-text': {},
54
167
  },
55
168
  b: {
56
169
  fontWeight: 500,
@@ -62,21 +175,68 @@ module.exports = (options = {}) => {
62
175
  'text-decoration': 'underline',
63
176
  },
64
177
  '::selection': { '@apply bg-mint text-black': {} },
178
+ ':root': {
179
+ '--gm-container-width': '92rem',
180
+ '--gm-container-gutter-width': '1rem',
181
+
182
+ '--gm-color-black': hexToRgb('#333'),
183
+ '--gm-color-white': hexToRgb('#fff'),
184
+
185
+ '--gm-color-gray': hexToRgb('#818181'),
186
+ '--gm-color-gray-dark': hexToRgb('#595959'),
187
+ '--gm-color-gray-light': hexToRgb('#e6e6e6'),
188
+ '--gm-color-gray-lightest': hexToRgb('#f1f1f1'),
189
+
190
+ '--gm-color-sky': hexToRgb('#bedfec'),
191
+ '--gm-color-sky-light': hexToRgb('#deeff5'),
192
+ '--gm-color-sky-lightest': hexToRgb('#ebf5f9'),
193
+
194
+ '--gm-color-mint': hexToRgb('#cdece2'),
195
+ '--gm-color-mint-light': hexToRgb('#e6f5f0'),
196
+ '--gm-color-mint-lightest': hexToRgb('#f0f9f6'),
197
+
198
+ '--gm-color-blue': hexToRgb('#0047ba'),
199
+ '--gm-color-blue-light': hexToRgb('#bedfec'),
200
+ '--gm-color-blue-lightest': hexToRgb('#deeff5'),
201
+ '--gm-color-blue-dark': hexToRgb('#002169'),
202
+
203
+ '--gm-color-green': hexToRgb('#008761'),
204
+ '--gm-color-green-dark': hexToRgb('#00524c'),
205
+ '--gm-color-green-light': hexToRgb('#cdece2'),
206
+ '--gm-color-green-lightest': hexToRgb('#e6f5f0'),
207
+
208
+ '--gm-color-red': hexToRgb('#c0385d'),
209
+ '--gm-color-red-light': hexToRgb('#faedef'),
210
+
211
+ '--gm-color-orange': hexToRgb('#e8a74a'),
212
+ '--gm-color-orange-light': hexToRgb('#f8e5c9'),
213
+
214
+ '--gm-color-yellow': hexToRgb('#fff5d2'),
215
+ },
65
216
  });
66
217
 
67
218
  addComponents({
219
+ '.page-layout': {
220
+ display: 'flex',
221
+ flexDirection: 'column',
222
+ minHeight: '100vh',
223
+ },
224
+ '.page-layout-main': {
225
+ backgroundColor: theme('colors.white'),
226
+ flexGrow: '1',
227
+ },
68
228
  '.container': {
69
229
  width: '100%',
70
- paddingLeft: '1rem',
71
- paddingRight: '1rem',
230
+ paddingLeft: 'var(--gm-container-gutter-width)',
231
+ paddingRight: 'var(--gm-container-gutter-width)',
72
232
  marginLeft: 'auto',
73
233
  marginRight: 'auto',
74
- maxWidth: containerSize,
234
+ maxWidth: 'var(--gm-container-width)',
75
235
  },
76
236
  '.container-prose': {
77
237
  width: '100%',
78
- paddingLeft: '1rem',
79
- paddingRight: '1rem',
238
+ paddingLeft: 'var(--gm-container-gutter-width)',
239
+ paddingRight: 'var(--gm-container-gutter-width)',
80
240
  marginLeft: 'auto',
81
241
  marginRight: 'auto',
82
242
  maxWidth: '45.5rem',
@@ -84,56 +244,141 @@ module.exports = (options = {}) => {
84
244
  });
85
245
  }),
86
246
 
87
- plugin(function ({ addBase, addComponents }) {
88
- const h1 = '@apply font-bold text-3xl md:text-5xl';
89
- const h2 = '@apply font-bold text-2xl md:text-4xl';
90
- const h3 = '@apply font-bold text-xl md:text-2xl';
91
- const h4 = '@apply font-bold text-lg md:text-xl';
247
+ plugin(({ addBase, addComponents }) => {
248
+ const {
249
+ headingXlText,
250
+ headingLText,
251
+ headingMText,
252
+ headingSText,
253
+ headingXsText,
254
+ paragraphText,
255
+ leadText,
256
+ blockquoteText,
257
+ descriptionText,
258
+ } = typography;
259
+
260
+ // This is tailwind syntax for setting both the font-size and the line-height
261
+ const headingXl = `@apply font-display font-${headingXlText.fontWeight} text-[${headingXlText.small.fontSize}]/[${headingXlText.small.lineHeight}] lg:text-[${headingXlText.large.fontSize}]/[${headingXlText.large.lineHeight}]`;
262
+ const headingL = `@apply font-display font-${headingLText.fontWeight} text-[${headingLText.small.fontSize}]/[${headingLText.small.lineHeight}] lg:text-[${headingLText.large.fontSize}]/[${headingLText.large.lineHeight}]`;
263
+ const headingM = `@apply font-text font-${headingMText.fontWeight} text-[${headingMText.small.fontSize}]/[${headingMText.small.lineHeight}] lg:text-[${headingMText.large.fontSize}]/[${headingMText.large.lineHeight}]`;
264
+ const headingS = `@apply font-text font-${headingSText.fontWeight} text-[${headingSText.small.fontSize}]/[${headingSText.small.lineHeight}] lg:text-[${headingSText.large.fontSize}]/[${headingSText.large.lineHeight}]`;
265
+ const headingXs = `@apply font-text font-${headingXsText.fontWeight} text-[${headingXsText.small.fontSize}]/[${headingXsText.small.lineHeight}] lg:text-[${headingXsText.large.fontSize}]/[${headingXsText.large.lineHeight}]`;
266
+
267
+ const paragraph = `@apply text-[${paragraphText.fontSize}]/[${paragraphText.lineHeight}]`;
268
+ const lead = `@apply font-medium text-[${leadText.small.fontSize}]/[${leadText.small.lineHeight}] lg:text-[${leadText.large.fontSize}]/[${leadText.large.lineHeight}]`;
269
+
270
+ const blockquote = `@apply font-${blockquoteText.fontWeight} italic grid grid-cols-[${blockquoteText.gridTemplateColumns.split(' ').join('_')}] gap-x-[${blockquoteText.columnGap}] pt-4
271
+ text-[${blockquoteText.large.fontSize}]/[${blockquoteText.large.lineHeight}] lg:text-[${blockquoteText.small.fontSize}]/[${blockquoteText.small.lineHeight}]
272
+ before:text-[${blockquoteText.before.fontSize}]/[${blockquoteText.before.lineHeight}] before:content-[${blockquoteText.before.content}] before:font-display before:not-italic`;
273
+
274
+ const description = `@apply text-[${descriptionText.large.fontSize}]/[${descriptionText.large.lineHeight}] lg:text-[${descriptionText.small.fontSize}]/[${descriptionText.small.lineHeight}]`;
92
275
 
93
276
  if (options.legacyV1Compatibility) {
94
277
  addBase({
95
278
  h1: {
96
- [h1]: {},
279
+ [headingXl]: {},
97
280
  },
98
281
  h2: {
99
- [h2]: {},
282
+ [headingL]: {},
100
283
  },
101
284
  h3: {
102
- [h3]: {},
285
+ [headingM]: {},
103
286
  },
104
287
  h4: {
105
- [h4]: {},
288
+ [headingS]: {},
106
289
  },
107
290
  });
108
291
  }
109
292
 
110
293
  addComponents({
294
+ /** @deprecated Will be replaced by heading-xl */
111
295
  '.h1': {
112
- [h1]: {},
296
+ [headingXl]: {},
113
297
  },
298
+ /** @deprecated Will be replaced by heading-l */
114
299
  '.h2': {
115
- [h2]: {},
300
+ [headingL]: {},
116
301
  },
302
+ /** @deprecated Will be replaced by heading-m */
117
303
  '.h3': {
118
- [h3]: {},
304
+ [headingM]: {},
119
305
  },
306
+ /** @deprecated Will be replaced by heading-s */
120
307
  '.h4': {
121
- [h4]: {},
308
+ [headingS]: {},
309
+ },
310
+ '.heading-xl': {
311
+ [headingXl]: {},
312
+ },
313
+ '.heading-l': {
314
+ [headingL]: {},
315
+ },
316
+ '.heading-m': {
317
+ [headingM]: {},
318
+ },
319
+ '.heading-s': {
320
+ [headingS]: {},
321
+ },
322
+ '.heading-xs': {
323
+ [headingXs]: {},
324
+ },
325
+ '.paragraph': {
326
+ [paragraph]: {},
327
+ },
328
+ '.lead': {
329
+ [lead]: {},
330
+ },
331
+ '.blockquote': {
332
+ [blockquote]: {},
333
+ },
334
+ '.description': {
335
+ [description]: {},
336
+ },
337
+ /** Standard black focus outline */
338
+ '.outline-focus': {
339
+ '@apply outline outline-2 outline-black': {},
340
+ },
341
+ /** Standard black focus outline with offset */
342
+ '.outline-focus-offset': {
343
+ '@apply outline-focus outline-offset-2': {},
344
+ },
345
+ /** Standard black focus outline with negative offset (inset) */
346
+ '.outline-focus-inset': {
347
+ '@apply outline-focus -outline-offset-4': {},
348
+ },
349
+ /** Standard black focus ring */
350
+ '.ring-focus': {
351
+ '@apply ring-2 ring-black': {},
352
+ },
353
+ /** Standard black focus ring with offset */
354
+ '.ring-focus-offset': {
355
+ '@apply ring-focus ring-offset-2': {},
122
356
  },
123
357
  });
124
358
  }),
125
- plugin(function ({ addBase }) {
359
+ plugin(({ addBase }) => {
126
360
  addBase(
127
- fonts.map((font) => ({
128
- '@font-face': {
129
- fontFamily,
130
- fontWeight: font.fontWeight,
131
- fontStyle: font.fontStyle,
132
- src: `url('${font.url}') format('woff2')`,
133
- fontDisplay: 'swap',
134
- },
135
- })),
361
+ Object.entries(fontDeclarations).flatMap(
362
+ ([fontFamily, fontFamilyDeclarations]) =>
363
+ fontFamilyDeclarations.map((font) => ({
364
+ '@font-face': {
365
+ fontFamily,
366
+ fontWeight: font.fontWeight,
367
+ fontStyle: font.fontStyle,
368
+ src: `url('${font.url}') format('woff2')`,
369
+ fontDisplay: 'swap',
370
+ },
371
+ })),
372
+ ),
136
373
  );
374
+
375
+ if (options.includeFontFallback) {
376
+ addBase(
377
+ Object.values(fontFallbacks).map((fontFallback) => ({
378
+ '@font-face': fontFallback,
379
+ })),
380
+ );
381
+ }
137
382
  }),
138
383
  ],
139
384
  theme: {
@@ -141,56 +386,68 @@ module.exports = (options = {}) => {
141
386
  inherit: 'inherit',
142
387
  current: 'currentColor',
143
388
  transparent: 'transparent',
144
- black: '#333',
145
- white: '#fff',
389
+ black: 'rgb(var(--gm-color-black))',
390
+ white: 'rgb(var(--gm-color-white))',
146
391
  gray: {
147
- DEFAULT: '#818181',
148
- dark: '#595959',
149
- light: '#E6E6E6',
150
- lightest: '#f1f1f1',
392
+ DEFAULT: 'rgb(var(--gm-color-gray))',
393
+ dark: 'rgb(var(--gm-color-gray-dark))',
394
+ light: 'rgb(var(--gm-color-gray-light))',
395
+ lightest: 'rgb(var(--gm-color-gray-lightest))',
151
396
  },
152
397
  sky: {
153
- DEFAULT: '#BEDFEC',
154
- light: '#DEEFF5',
155
- lightest: '#EBF5F9',
398
+ DEFAULT: 'rgb(var(--gm-color-sky))',
399
+ light: 'rgb(var(--gm-color-sky-light))',
400
+ lightest: 'rgb(var(--gm-color-sky-lightest))',
156
401
  },
157
402
  mint: {
158
- DEFAULT: '#CDECE2',
159
- light: '#E6F5F0',
160
- lightest: '#F0F9F6',
403
+ DEFAULT: 'rgb(var(--gm-color-mint))',
404
+ light: 'rgb(var(--gm-color-mint-light))',
405
+ lightest: 'rgb(var(--gm-color-mint-lightest))',
161
406
  },
162
407
  blue: {
163
408
  // OBOS Blue/Primary brand
164
- DEFAULT: '#0047BA',
165
- light: '#BEDFEC',
166
- lightest: '#DEEFF5',
409
+ DEFAULT: 'rgb(var(--gm-color-blue))',
167
410
  // OBOS Ocean
168
- dark: '#002169',
411
+ dark: 'rgb(var(--gm-color-blue-dark))',
412
+ light: 'rgb(var(--gm-color-blue-light))',
413
+ lightest: 'rgb(var(--gm-color-blue-lightest))',
169
414
  },
170
415
  green: {
171
416
  // OBOS Green/Primary brand
172
- DEFAULT: '#008761',
173
- lightest: '#E6F5F0',
174
- light: '#CDECE2',
417
+ DEFAULT: 'rgb(var(--gm-color-green))',
175
418
  // OBOS Forest
176
- dark: '#00524C',
419
+ dark: 'rgb(var(--gm-color-green-dark))',
420
+ light: 'rgb(var(--gm-color-green-light))',
421
+ lightest: 'rgb(var(--gm-color-green-lightest))',
177
422
  },
178
423
  red: {
179
- DEFAULT: '#C0385D',
424
+ DEFAULT: 'rgb(var(--gm-color-red))',
180
425
  // error red
181
- light: '#FAEDEF',
426
+ light: 'rgb(var(--gm-color-red-light))',
182
427
  },
183
428
  orange: {
184
- DEFAULT: '#e8a74a',
185
- light: '#f8e5c9',
429
+ DEFAULT: 'rgb(var(--gm-color-orange))',
430
+ light: 'rgb(var(--gm-color-orange-light))',
186
431
  },
187
432
  yellow: {
188
433
  // open house
189
- DEFAULT: '#fff5d2',
434
+ DEFAULT: 'rgb(var(--gm-color-yellow))',
190
435
  },
191
436
  },
192
437
  fontFamily: {
193
- sans: [fontFamily, 'sans-serif'],
438
+ text: [
439
+ 'OBOSText',
440
+ options.includeFontFallback && fontFallbacks.OBOSText['font-family'],
441
+ 'sans-serif',
442
+ ].filter((f) => f),
443
+ display: [
444
+ 'OBOSDisplay',
445
+ options.includeFontFallback &&
446
+ fontFallbacks.OBOSDisplay['font-family'],
447
+ 'sans-serif',
448
+ ],
449
+ // OBOS doesn't have monospaced font, so we keep Tailwind's default here
450
+ mono: defaultTheme.fontFamily.mono,
194
451
  },
195
452
  extend: {
196
453
  maxWidth: {
@@ -214,59 +471,98 @@ module.exports = (options = {}) => {
214
471
  '--tw-prose-headings': 'inherit',
215
472
  '--tw-prose-lead': 'inherit',
216
473
  '--tw-prose-links': 'inherit',
217
- '--tw-prose-quotes': theme('colors.blue.dark'),
218
- '--tw-prose-quote-borders': theme('colors.green.DEFAULT'),
474
+ '--tw-prose-quotes': 'inherit',
219
475
  '--tw-prose-counters': theme('colors.black'),
220
- '--tw-prose-bullets': theme('colors.green.DEFAULT'),
476
+ '--tw-prose-bullets': theme('colors.black'),
221
477
  color: theme('colors.black'),
222
478
  maxWidth: theme('maxWidth.prose'),
223
479
  a: {
224
480
  fontWeight: 400,
225
481
  },
226
482
  h1: {
227
- fontWeight: theme('fontWeight.bold'),
228
- fontSize: theme('fontSize.3xl'),
229
- '@media (min-width: theme("screens.md"))': {
230
- fontSize: theme('fontSize.5xl'),
483
+ fontFamily: 'OBOSDisplay',
484
+ fontWeight: theme('fontWeight.semibold'),
485
+ ...typography.headingXlText.small,
486
+ '@media (min-width: theme("screens.lg"))': {
487
+ ...typography.headingXlText.large,
231
488
  },
232
489
  },
233
490
  h2: {
234
- fontWeight: theme('fontWeight.bold'),
235
- fontSize: theme('fontSize.2xl'),
236
- '@media (min-width: theme("screens.md"))': {
237
- fontSize: theme('fontSize.4xl'),
491
+ fontFamily: 'OBOSDisplay',
492
+ fontWeight: theme('fontWeight.semibold'),
493
+ ...typography.headingLText.small,
494
+ '@media (min-width: theme("screens.lg"))': {
495
+ ...typography.headingLText.large,
238
496
  },
239
497
  },
240
498
  h3: {
241
- fontWeight: theme('fontWeight.bold'),
242
- fontSize: theme('fontSize.xl'),
243
- '@media (min-width: theme("screens.md"))': {
244
- fontSize: theme('fontSize.2xl'),
499
+ fontFamily: 'OBOSText',
500
+ fontWeight: theme('fontWeight.medium'),
501
+ ...typography.headingMText.small,
502
+ '@media (min-width: theme("screens.lg"))': {
503
+ ...typography.headingMText.large,
245
504
  },
246
505
  },
247
506
  h4: {
507
+ fontFamily: 'OBOSText',
508
+ fontWeight: theme('fontWeight.medium'),
509
+ ...typography.headingSText.small,
510
+ '@media (min-width: theme("screens.lg"))': {
511
+ ...typography.headingSText.large,
512
+ },
513
+ },
514
+ h5: {
515
+ fontFamily: 'OBOSText',
248
516
  fontWeight: theme('fontWeight.bold'),
249
- fontSize: theme('fontSize.lg'),
250
- '@media (min-width: theme("screens.md"))': {
251
- fontSize: theme('fontSize.xl'),
517
+ ...typography.headingXsText.small,
518
+ '@media (min-width: theme("screens.lg"))': {
519
+ ...typography.headingXsText.large,
252
520
  },
253
521
  },
254
522
  li: {
255
- marginTop: '1.5em',
256
- marginBottom: '1.5em',
523
+ ...typography.paragraphText.small,
524
+ '@media (min-width: theme("screens.lg"))': {
525
+ ...typography.paragraphText.large,
526
+ },
257
527
  },
258
- blockquote: {
259
- fontWeight: theme('fontWeight.bold'),
260
- fontStyle: 'normal',
528
+ p: {
529
+ ...typography.paragraphText.small,
530
+ '@media (min-width: theme("screens.lg"))': {
531
+ ...typography.paragraphText.large,
532
+ },
261
533
  },
262
- 'blockquote p:first-of-type::before': {
263
- content: '"«"',
534
+ blockquote: {
535
+ // Reset defaults:
536
+ marginBottom: 'unset',
537
+ padding: 'unset',
538
+ border: 'unset',
539
+ fontWeight: theme('fontWeight.medium'),
540
+ fontStyle: 'italic',
541
+ display: typography.blockquoteText.display,
542
+ gridTemplateColumns:
543
+ typography.blockquoteText.gridTemplateColumns,
544
+ columnGap: typography.blockquoteText.columnGap,
545
+ paddingTop: '1rem',
546
+ ...typography.blockquoteText.small,
547
+ '@media (min-width: theme("screens.lg"))': {
548
+ ...typography.blockquoteText.large,
549
+ },
264
550
  },
265
- 'blockquote p:last-of-type::after': {
266
- content: '"»"',
551
+ 'blockquote::before': {
552
+ ...typography.blockquoteText.before,
267
553
  },
268
554
  '[class~="lead"]': {
269
555
  fontWeight: theme('fontWeight.medium'),
556
+ ...typography.leadText.small,
557
+ '@media (min-width: theme("screens.lg"))': {
558
+ ...typography.leadText.large,
559
+ },
560
+ },
561
+ '[class~="description"]': {
562
+ ...typography.descriptionText.small,
563
+ '@media (min-width: theme("screens.lg"))': {
564
+ ...typography.descriptionText.large,
565
+ },
270
566
  },
271
567
  },
272
568
  },
@@ -276,8 +572,34 @@ module.exports = (options = {}) => {
276
572
  };
277
573
  };
278
574
 
575
+ /**
576
+ * A function that takes in a hex color as a string and returns a string with the color's rgb values.
577
+ * @param {string} hex
578
+ * @returns {string} The rgb values of the color.
579
+ */
580
+ function hexToRgb(hex) {
581
+ // Remove the hash (#) at the start if it's there
582
+ let hexValue = hex.replace(/^#/, '');
583
+
584
+ // If the hex value is shorthand (3 characters), expand it to 6 characters
585
+ if (hexValue.length === 3) {
586
+ hexValue = hexValue
587
+ .split('')
588
+ .map((char) => char + char)
589
+ .join('');
590
+ }
591
+
592
+ // Parse the r, g, and b values from the hex string
593
+ const r = Number.parseInt(hexValue.substring(0, 2), 16);
594
+ const g = Number.parseInt(hexValue.substring(2, 4), 16);
595
+ const b = Number.parseInt(hexValue.substring(4, 6), 16);
596
+
597
+ // Return the RGB values as a whitespace-separated string
598
+ return `${r} ${g} ${b}`;
599
+ }
600
+
279
601
  // These custom components are only used for v1 compat
280
- const button = plugin(function ({ addComponents, theme }) {
602
+ const button = plugin(({ addComponents, theme }) => {
281
603
  const hoverLoadingBgColor = 'rgba(0, 0, 0, 0.1)';
282
604
 
283
605
  addComponents({
@@ -334,7 +656,7 @@ const button = plugin(function ({ addComponents, theme }) {
334
656
  });
335
657
  });
336
658
 
337
- const radio = plugin(function ({ addComponents, theme }) {
659
+ const radio = plugin(({ addComponents, theme }) => {
338
660
  addComponents({
339
661
  '.radio': {
340
662
  // hide the native radio input
@@ -379,7 +701,7 @@ const radio = plugin(function ({ addComponents, theme }) {
379
701
  });
380
702
  });
381
703
 
382
- const checkbox = plugin(function ({ addComponents, theme }) {
704
+ const checkbox = plugin(({ addComponents, theme }) => {
383
705
  addComponents({
384
706
  '.checkbox': {
385
707
  '&::before': {
@@ -400,7 +722,7 @@ const checkbox = plugin(function ({ addComponents, theme }) {
400
722
  });
401
723
  });
402
724
 
403
- const snackbar = plugin(function ({ addComponents, theme }) {
725
+ const snackbar = plugin(({ addComponents, theme }) => {
404
726
  addComponents({
405
727
  '.snackbar': {
406
728
  'grid-template-columns': 'min-content auto',