@obosbbl/grunnmuren-tailwind 2.0.0-canary.9 → 2.0.1
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 +45 -34
- package/package.json +5 -6
- package/tailwind-base.css +171 -0
- package/fonts/font-fallback.js +0 -1
- package/tailwind-base.cjs +0 -724
package/README.md
CHANGED
|
@@ -18,43 +18,14 @@ pnpm add -D @obosbbl/grunnmuren-tailwind@canary tailwindcss postcss autoprefixer
|
|
|
18
18
|
|
|
19
19
|
Configure Tailwind to use the preset
|
|
20
20
|
|
|
21
|
-
```js
|
|
22
|
-
// tailwind.config.js
|
|
23
|
-
|
|
24
|
-
/** @type {import('tailwindcss').Config} */
|
|
25
|
-
module.exports = {
|
|
26
|
-
presets: [require('@obosbbl/grunnmuren-tailwind')],
|
|
27
|
-
content: [
|
|
28
|
-
// Add your own content sources as needed, eg:
|
|
29
|
-
'./src/app/**/*.{js,ts,jsx,tsx,}',
|
|
30
|
-
|
|
31
|
-
// If you're using Grunnmuren's React components
|
|
32
|
-
'./node_modules/@obosbbl/grunnmuren-react/dist/**/*.{mjs,js}',
|
|
33
|
-
],
|
|
34
|
-
};
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Add the Tailwind directives to your CSS
|
|
38
|
-
|
|
39
21
|
```css
|
|
40
22
|
/* globals.css */
|
|
41
23
|
|
|
42
|
-
@tailwind
|
|
43
|
-
@tailwind components;
|
|
44
|
-
@tailwind utilities;
|
|
45
|
-
```
|
|
24
|
+
@import "@obosbbl/grunnmuren-tailwind";
|
|
46
25
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// postcss.config.js
|
|
51
|
-
|
|
52
|
-
module.exports = {
|
|
53
|
-
plugins: {
|
|
54
|
-
tailwindcss: {},
|
|
55
|
-
autoprefixer: {},
|
|
56
|
-
},
|
|
57
|
-
};
|
|
26
|
+
/** Add any auto excluded sources (typically residing in node_modules) */
|
|
27
|
+
@source "../../node_modules/@obosbbl/grunnmuren-react/dist";
|
|
28
|
+
@source "../../node_modules/@code-obos/obos-layout/dist"
|
|
58
29
|
```
|
|
59
30
|
|
|
60
31
|
## Fonts
|
|
@@ -63,7 +34,7 @@ Fonts are automatically loaded from OBOS' CDN, so you don't have to host the fon
|
|
|
63
34
|
|
|
64
35
|
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
36
|
|
|
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,
|
|
37
|
+
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, and can only be disabled by a @theme override of the font variables in your own main tailwind CSS file.
|
|
67
38
|
|
|
68
39
|
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
40
|
|
|
@@ -93,3 +64,43 @@ The preset supports the following options:
|
|
|
93
64
|
| --------------------- | ------------- | --------------------------------------------------- |
|
|
94
65
|
| includeFontFallback | `true` | Whether the preset includes a font fallback |
|
|
95
66
|
| legacyV1Compatibility | `false` | Configures partial compatibility with Grunnmuren v1 |
|
|
67
|
+
|
|
68
|
+
## Migrating from v2?
|
|
69
|
+
Tailwind is upgraded to v4. The `grunnmuren-tailwind` package is now CSS-first configured. And the previously exposed JS config file is now replaced by a CSS config file.
|
|
70
|
+
|
|
71
|
+
The `legacyV1Compatibility` option is removed, so your project has to be fully upgraded to Grunnmuren v2.
|
|
72
|
+
|
|
73
|
+
The `includeFontFallback` option is also removed, and a font fallback will automatically be applied to the OBOS fonts by defaullt.
|
|
74
|
+
|
|
75
|
+
## Migration
|
|
76
|
+
1. Upgrade your project to Tailwind 4. You can try the [migration guide](https://tailwindcss.com/docs/upgrade-guide)
|
|
77
|
+
from tailwind.
|
|
78
|
+
2. Add `@import "@obosbbl/grunnmuren-tailwind";` to the top of the main CSS file of your project. This is the new CSS configuration file for Grunnmuren.
|
|
79
|
+
3. If you have a JS/TS `tailwind.config` in your project and would like to keep it. You can include it in the main CSS file (mentioned in step 2), by using the `@config` directive, e.g: `@config '../tailwind.config.ts';`. Read more [here](https://tailwindcss.com/docs/functions-and-directives#compatibility).
|
|
80
|
+
4. Finally, if you would like to get rid of the old `tailwind.config`. You can move all your configuration to the main CSS file of your project. Tailwind 4 has automatic content detection, but if you need to include some excluded source you can use the `@source` directive, e.g: `@source "./node_modules/@obosbbl/grunnmuren-react/dist";`. You can also extend the `@obosbbl/grunnmuren-tailwind` config by using various directives such as `@base` or `@theme`.
|
|
81
|
+
|
|
82
|
+
Here is an example of what your main CSS file __might__ look like after migration:
|
|
83
|
+
|
|
84
|
+
``` CSS
|
|
85
|
+
@import "@obosbbl/grunnmuren-tailwind";
|
|
86
|
+
|
|
87
|
+
@source "../../node_modules/@obosbbl/grunnmuren-react/dist";
|
|
88
|
+
@source "../../node_modules/@code-obos/obos-layout/dist"
|
|
89
|
+
|
|
90
|
+
@theme {
|
|
91
|
+
--animate-custom: custom-animation 1s ease-in-out infinite;
|
|
92
|
+
@keyframes custom-animation {
|
|
93
|
+
0%,
|
|
94
|
+
100% {
|
|
95
|
+
transform: rotate(-3deg);
|
|
96
|
+
}
|
|
97
|
+
50% {
|
|
98
|
+
transform: rotate(3deg);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@utility my-custom-util {
|
|
104
|
+
@apply flex flex-col min-h-screen;
|
|
105
|
+
}
|
|
106
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@obosbbl/grunnmuren-tailwind",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Grunnmuren Tailwind preset",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/code-obos/grunnmuren"
|
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"type": "commonjs",
|
|
10
10
|
"exports": {
|
|
11
|
-
".": "./tailwind-base.
|
|
11
|
+
".": "./tailwind-base.css"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
|
-
"tailwind-base.
|
|
15
|
-
"fonts/font-fallback.js"
|
|
14
|
+
"tailwind-base.css"
|
|
16
15
|
],
|
|
17
16
|
"dependencies": {
|
|
18
17
|
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
@@ -20,10 +19,10 @@
|
|
|
20
19
|
"tailwindcss-animate": "^1.0.7"
|
|
21
20
|
},
|
|
22
21
|
"devDependencies": {
|
|
23
|
-
"tailwindcss": "
|
|
22
|
+
"tailwindcss": "4.0.17"
|
|
24
23
|
},
|
|
25
24
|
"peerDependencies": {
|
|
26
|
-
"tailwindcss": "^
|
|
25
|
+
"tailwindcss": "^4.0.0"
|
|
27
26
|
},
|
|
28
27
|
"scripts": {
|
|
29
28
|
"font-fallback": "bun --cwd=./fonts ./generate-font-fallback.ts"
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "./tailwind-typography";
|
|
3
|
+
@import "./font";
|
|
4
|
+
|
|
5
|
+
@theme {
|
|
6
|
+
/*** Font stacks ***/
|
|
7
|
+
--font-text: OBOSText, __OBOSText_Fallback, sans-serif;
|
|
8
|
+
--font-display: OBOSDisplay, __OBOSDisplay_Fallback, sans-serif;
|
|
9
|
+
|
|
10
|
+
/*** Widths ***/
|
|
11
|
+
--container-width: 92rem;
|
|
12
|
+
--container-gutter-width: 1rem;
|
|
13
|
+
|
|
14
|
+
/*** Colors ***/
|
|
15
|
+
--color-black: #333;
|
|
16
|
+
--color-white: #fff;
|
|
17
|
+
--color-gray: #818181;
|
|
18
|
+
--color-gray-dark: #595959;
|
|
19
|
+
--color-gray-light: #e6e6e6;
|
|
20
|
+
--color-gray-lightest: #f1f1f1;
|
|
21
|
+
--color-sky: #bedfec;
|
|
22
|
+
--color-sky-light: #deeff5;
|
|
23
|
+
--color-sky-lightest: #ebf5f9;
|
|
24
|
+
--color-mint: #cdece2;
|
|
25
|
+
--color-mint-light: #e6f5f0;
|
|
26
|
+
--color-mint-lightest: #f0f9f6;
|
|
27
|
+
--color-blue: #0047ba;
|
|
28
|
+
--color-blue-light: #bedfec;
|
|
29
|
+
--color-blue-lightest: #deeff5;
|
|
30
|
+
--color-blue-dark: #002169;
|
|
31
|
+
--color-green: #008761;
|
|
32
|
+
--color-green-dark: #00524c;
|
|
33
|
+
--color-green-light: #cdece2;
|
|
34
|
+
--color-green-lightest: #e6f5f0;
|
|
35
|
+
--color-red: #c0385d;
|
|
36
|
+
--color-red-light: #faedef;
|
|
37
|
+
--color-orange: #e8a74a;
|
|
38
|
+
--color-orange-light: #f8e5c9;
|
|
39
|
+
--color-yellow: #fff5d2;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@layer base {
|
|
43
|
+
@font-face {
|
|
44
|
+
font-family: OBOSText;
|
|
45
|
+
font-weight: 400;
|
|
46
|
+
font-style: normal;
|
|
47
|
+
src: url("https://www.obos.no/fonts/OBOSText-Regular.woff2") format("woff2");
|
|
48
|
+
font-display: swap;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@font-face {
|
|
52
|
+
font-family: OBOSText;
|
|
53
|
+
font-weight: 400;
|
|
54
|
+
font-style: italic;
|
|
55
|
+
src: url("https://www.obos.no/fonts/OBOSText-Italic.woff2") format("woff2");
|
|
56
|
+
font-display: swap;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@font-face {
|
|
60
|
+
font-family: OBOSText;
|
|
61
|
+
font-weight: 500;
|
|
62
|
+
font-style: normal;
|
|
63
|
+
src: url("https://www.obos.no/fonts/OBOSText-Medium.woff2") format("woff2");
|
|
64
|
+
font-display: swap;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@font-face {
|
|
68
|
+
font-family: OBOSDisplay;
|
|
69
|
+
font-weight: 600; /* SemiBold */
|
|
70
|
+
font-style: normal;
|
|
71
|
+
src: url("https://www.obos.no/fonts/OBOSDisplay-SemiBold.woff2")
|
|
72
|
+
format("woff2");
|
|
73
|
+
font-display: swap;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
html {
|
|
77
|
+
@apply text-black antialiased font-normal font-text;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
b {
|
|
81
|
+
font-weight: 500;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
strong {
|
|
85
|
+
font-weight: 500;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
a {
|
|
89
|
+
text-decoration: underline;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
::selection {
|
|
93
|
+
@apply bg-mint text-black;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/*** Layout ***/
|
|
98
|
+
@utility page-layout {
|
|
99
|
+
@apply flex flex-col min-h-screen;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@utility page-layout-main {
|
|
103
|
+
@apply bg-white grow;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@utility container {
|
|
107
|
+
@apply w-full px-(--container-gutter-width) mx-auto max-w-(--container-width);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@utility container-prose {
|
|
111
|
+
@apply w-full px-(--container-gutter-width) mx-auto;
|
|
112
|
+
max-width: 45.5rem;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/*** Typography styles ***/
|
|
116
|
+
@utility heading-xl {
|
|
117
|
+
@apply font-display font-semibold text-[2.8125rem]/[3.625rem] lg:text-[3.9375rem]/[5.125rem];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@utility heading-l {
|
|
121
|
+
@apply font-display font-semibold text-[1.8125rem]/[2.75rem] lg:text-[2.25rem]/[3.5rem];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@utility heading-m {
|
|
125
|
+
@apply font-text font-medium text-[1.4375rem]/[2.25rem] lg:text-[1.625rem]/[2.5625rem];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@utility heading-s {
|
|
129
|
+
@apply font-text font-medium text-[1.1875rem]/[1.1875rem] lg:text-[1.3125rem]/[2.125rem];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@utility heading-xs {
|
|
133
|
+
@apply font-text font-medium text-[1.125rem]/[1.75rem] lg:text-[1.1875rem]/[1.9375rem];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@utility paragraph {
|
|
137
|
+
@apply text-[1rem]/[1.625rem];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@utility lead {
|
|
141
|
+
@apply font-medium text-[1.4375rem]/[2.25rem] lg:text-[1.625rem]/[2.5625rem];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@utility blockquote {
|
|
145
|
+
@apply font-medium italic grid grid-cols-[3rem_1fr] gap-x-[0.4375rem] pt-4 text-[1.625rem]/[2.5625rem] lg:text-[1.4375rem]/[2.25rem] before:text-[4.6875rem]/[1.6875rem] before:font-display before:not-italic before:content-["“"];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@utility description {
|
|
149
|
+
@apply text-[0.875rem]/[1.375rem] lg:text-[0.875rem]/[1.4375rem];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* Focus styles */
|
|
153
|
+
@utility outline-focus {
|
|
154
|
+
@apply outline-2 outline-black;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@utility outline-focus-offset {
|
|
158
|
+
@apply outline-focus outline-offset-2;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@utility outline-focus-inset {
|
|
162
|
+
@apply outline-focus -outline-offset-4;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@utility ring-focus {
|
|
166
|
+
@apply ring-2 ring-black;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@utility ring-focus-offset {
|
|
170
|
+
@apply ring-focus ring-offset-2;
|
|
171
|
+
}
|
package/fonts/font-fallback.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/tailwind-base.cjs
DELETED
|
@@ -1,724 +0,0 @@
|
|
|
1
|
-
const defaultTheme = require('tailwindcss/defaultTheme');
|
|
2
|
-
const plugin = require('tailwindcss/plugin');
|
|
3
|
-
const fontFallbacks = require('./fonts/font-fallback');
|
|
4
|
-
|
|
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',
|
|
92
|
-
},
|
|
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
|
-
},
|
|
103
|
-
},
|
|
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
|
-
},
|
|
125
|
-
},
|
|
126
|
-
descriptionText: {
|
|
127
|
-
small: {
|
|
128
|
-
fontSize: '0.875rem',
|
|
129
|
-
lineHeight: '1.4375rem',
|
|
130
|
-
},
|
|
131
|
-
large: {
|
|
132
|
-
fontSize: '0.875rem',
|
|
133
|
-
lineHeight: '1.375rem',
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* @param {boolean} options.includeFontFallback
|
|
140
|
-
* @param {boolean} options.legacyV1Compatibility
|
|
141
|
-
*/
|
|
142
|
-
module.exports = (options = {}) => {
|
|
143
|
-
options.includeFontFallback ??= true;
|
|
144
|
-
options.legacyV1Compatibility ??= false;
|
|
145
|
-
|
|
146
|
-
const v1CompatibilityPlugins = [];
|
|
147
|
-
|
|
148
|
-
if (options.legacyV1Compatibility) {
|
|
149
|
-
v1CompatibilityPlugins.push(
|
|
150
|
-
button,
|
|
151
|
-
checkbox,
|
|
152
|
-
radio,
|
|
153
|
-
snackbar,
|
|
154
|
-
require('@tailwindcss/aspect-ratio'),
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return {
|
|
159
|
-
plugins: [
|
|
160
|
-
...v1CompatibilityPlugins,
|
|
161
|
-
require('@tailwindcss/typography'),
|
|
162
|
-
require('tailwindcss-animate'),
|
|
163
|
-
plugin(({ addBase, addComponents, theme }) => {
|
|
164
|
-
addBase({
|
|
165
|
-
html: {
|
|
166
|
-
'@apply text-black antialiased font-normal font-text': {},
|
|
167
|
-
},
|
|
168
|
-
b: {
|
|
169
|
-
fontWeight: 500,
|
|
170
|
-
},
|
|
171
|
-
strong: {
|
|
172
|
-
fontWeight: 500,
|
|
173
|
-
},
|
|
174
|
-
a: {
|
|
175
|
-
'text-decoration': 'underline',
|
|
176
|
-
},
|
|
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': '#333',
|
|
183
|
-
'--gm-color-white': '#fff',
|
|
184
|
-
|
|
185
|
-
'--gm-color-gray': '#818181',
|
|
186
|
-
'--gm-color-gray-dark': '#595959',
|
|
187
|
-
'--gm-color-gray-light': '#e6e6e6',
|
|
188
|
-
'--gm-color-gray-lightest': '#f1f1f1',
|
|
189
|
-
|
|
190
|
-
'--gm-color-sky': '#bedfec',
|
|
191
|
-
'--gm-color-sky-light': '#deeff5',
|
|
192
|
-
'--gm-color-sky-lightest': '#ebf5f9',
|
|
193
|
-
|
|
194
|
-
'--gm-color-mint': '#cdece2',
|
|
195
|
-
'--gm-color-mint-light': '#e6f5f0',
|
|
196
|
-
'--gm-color-mint-lightest': '#f0f9f6',
|
|
197
|
-
|
|
198
|
-
'--gm-color-blue': '#0047ba',
|
|
199
|
-
'--gm-color-blue-light': '#bedfec',
|
|
200
|
-
'--gm-color-blue-lightest': '#deeff5',
|
|
201
|
-
'--gm-color-blue-dark': '#002169',
|
|
202
|
-
|
|
203
|
-
'--gm-color-green': '#008761',
|
|
204
|
-
'--gm-color-green-dark': '#00524c',
|
|
205
|
-
'--gm-color-green-light': '#cdece2',
|
|
206
|
-
'--gm-color-green-lightest': '#e6f5f0',
|
|
207
|
-
|
|
208
|
-
'--gm-color-red': '#c0385d',
|
|
209
|
-
'--gm-color-red-light': '#faedef',
|
|
210
|
-
|
|
211
|
-
'--gm-color-orange': '#e8a74a',
|
|
212
|
-
'--gm-color-orange-light': '#f8e5c9',
|
|
213
|
-
|
|
214
|
-
'--gm-color-yellow': '#fff5d2',
|
|
215
|
-
},
|
|
216
|
-
});
|
|
217
|
-
|
|
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
|
-
},
|
|
228
|
-
'.container': {
|
|
229
|
-
width: '100%',
|
|
230
|
-
paddingLeft: 'var(--gm-container-gutter-width)',
|
|
231
|
-
paddingRight: 'var(--gm-container-gutter-width)',
|
|
232
|
-
marginLeft: 'auto',
|
|
233
|
-
marginRight: 'auto',
|
|
234
|
-
maxWidth: 'var(--gm-container-width)',
|
|
235
|
-
},
|
|
236
|
-
'.container-prose': {
|
|
237
|
-
width: '100%',
|
|
238
|
-
paddingLeft: 'var(--gm-container-gutter-width)',
|
|
239
|
-
paddingRight: 'var(--gm-container-gutter-width)',
|
|
240
|
-
marginLeft: 'auto',
|
|
241
|
-
marginRight: 'auto',
|
|
242
|
-
maxWidth: '45.5rem',
|
|
243
|
-
},
|
|
244
|
-
});
|
|
245
|
-
}),
|
|
246
|
-
|
|
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}]`;
|
|
275
|
-
|
|
276
|
-
if (options.legacyV1Compatibility) {
|
|
277
|
-
addBase({
|
|
278
|
-
h1: {
|
|
279
|
-
[headingXl]: {},
|
|
280
|
-
},
|
|
281
|
-
h2: {
|
|
282
|
-
[headingL]: {},
|
|
283
|
-
},
|
|
284
|
-
h3: {
|
|
285
|
-
[headingM]: {},
|
|
286
|
-
},
|
|
287
|
-
h4: {
|
|
288
|
-
[headingS]: {},
|
|
289
|
-
},
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
addComponents({
|
|
294
|
-
/** @deprecated Will be replaced by heading-xl */
|
|
295
|
-
'.h1': {
|
|
296
|
-
[headingXl]: {},
|
|
297
|
-
},
|
|
298
|
-
/** @deprecated Will be replaced by heading-l */
|
|
299
|
-
'.h2': {
|
|
300
|
-
[headingL]: {},
|
|
301
|
-
},
|
|
302
|
-
/** @deprecated Will be replaced by heading-m */
|
|
303
|
-
'.h3': {
|
|
304
|
-
[headingM]: {},
|
|
305
|
-
},
|
|
306
|
-
/** @deprecated Will be replaced by heading-s */
|
|
307
|
-
'.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': {},
|
|
356
|
-
},
|
|
357
|
-
});
|
|
358
|
-
}),
|
|
359
|
-
plugin(({ addBase }) => {
|
|
360
|
-
addBase(
|
|
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
|
-
),
|
|
373
|
-
);
|
|
374
|
-
|
|
375
|
-
if (options.includeFontFallback) {
|
|
376
|
-
addBase(
|
|
377
|
-
Object.values(fontFallbacks).map((fontFallback) => ({
|
|
378
|
-
'@font-face': fontFallback,
|
|
379
|
-
})),
|
|
380
|
-
);
|
|
381
|
-
}
|
|
382
|
-
}),
|
|
383
|
-
],
|
|
384
|
-
theme: {
|
|
385
|
-
colors: {
|
|
386
|
-
inherit: 'inherit',
|
|
387
|
-
current: 'currentColor',
|
|
388
|
-
transparent: 'transparent',
|
|
389
|
-
black: 'var(--gm-color-black)',
|
|
390
|
-
white: 'var(--gm-color-white)',
|
|
391
|
-
gray: {
|
|
392
|
-
DEFAULT: 'var(--gm-color-gray)',
|
|
393
|
-
dark: 'var(--gm-color-gray-dark)',
|
|
394
|
-
light: 'var(--gm-color-gray-light)',
|
|
395
|
-
lightest: 'var(--gm-color-gray-lightest)',
|
|
396
|
-
},
|
|
397
|
-
sky: {
|
|
398
|
-
DEFAULT: 'var(--gm-color-sky)',
|
|
399
|
-
light: 'var(--gm-color-sky-light)',
|
|
400
|
-
lightest: 'var(--gm-color-sky-lightest)',
|
|
401
|
-
},
|
|
402
|
-
mint: {
|
|
403
|
-
DEFAULT: 'var(--gm-color-mint)',
|
|
404
|
-
light: 'var(--gm-color-mint-light)',
|
|
405
|
-
lightest: 'var(--gm-color-mint-lightest)',
|
|
406
|
-
},
|
|
407
|
-
blue: {
|
|
408
|
-
// OBOS Blue/Primary brand
|
|
409
|
-
DEFAULT: 'var(--gm-color-blue)',
|
|
410
|
-
// OBOS Ocean
|
|
411
|
-
dark: 'var(--gm-color-blue-dark)',
|
|
412
|
-
light: 'var(--gm-color-blue-light)',
|
|
413
|
-
lightest: 'var(--gm-color-blue-lightest)',
|
|
414
|
-
},
|
|
415
|
-
green: {
|
|
416
|
-
// OBOS Green/Primary brand
|
|
417
|
-
DEFAULT: 'var(--gm-color-green)',
|
|
418
|
-
// OBOS Forest
|
|
419
|
-
dark: 'var(--gm-color-green-dark)',
|
|
420
|
-
light: 'var(--gm-color-green-light)',
|
|
421
|
-
lightest: 'var(--gm-color-green-lightest)',
|
|
422
|
-
},
|
|
423
|
-
red: {
|
|
424
|
-
DEFAULT: 'var(--gm-color-red)',
|
|
425
|
-
// error red
|
|
426
|
-
light: 'var(--gm-color-red-light)',
|
|
427
|
-
},
|
|
428
|
-
orange: {
|
|
429
|
-
DEFAULT: 'var(--gm-color-orange)',
|
|
430
|
-
light: 'var(--gm-color-orange-light)',
|
|
431
|
-
},
|
|
432
|
-
yellow: {
|
|
433
|
-
// open house
|
|
434
|
-
DEFAULT: 'var(--gm-color-yellow)',
|
|
435
|
-
},
|
|
436
|
-
},
|
|
437
|
-
fontFamily: {
|
|
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,
|
|
451
|
-
},
|
|
452
|
-
extend: {
|
|
453
|
-
maxWidth: {
|
|
454
|
-
// Override Tailwinds default prose width of 60 chars.
|
|
455
|
-
prose: '696px',
|
|
456
|
-
},
|
|
457
|
-
width: {
|
|
458
|
-
prose: '696px',
|
|
459
|
-
},
|
|
460
|
-
spacing: {
|
|
461
|
-
18: '4.5rem',
|
|
462
|
-
},
|
|
463
|
-
borderColor: options.legacyV1Compatibility
|
|
464
|
-
? ({ theme }) => ({
|
|
465
|
-
DEFAULT: theme('colors.gray.light', 'currentColor'),
|
|
466
|
-
})
|
|
467
|
-
: undefined,
|
|
468
|
-
typography: (theme) => ({
|
|
469
|
-
DEFAULT: {
|
|
470
|
-
css: {
|
|
471
|
-
'--tw-prose-headings': 'inherit',
|
|
472
|
-
'--tw-prose-lead': 'inherit',
|
|
473
|
-
'--tw-prose-links': 'inherit',
|
|
474
|
-
'--tw-prose-quotes': 'inherit',
|
|
475
|
-
'--tw-prose-counters': theme('colors.black'),
|
|
476
|
-
'--tw-prose-bullets': theme('colors.black'),
|
|
477
|
-
color: theme('colors.black'),
|
|
478
|
-
maxWidth: theme('maxWidth.prose'),
|
|
479
|
-
a: {
|
|
480
|
-
fontWeight: 400,
|
|
481
|
-
},
|
|
482
|
-
h1: {
|
|
483
|
-
fontFamily: 'OBOSDisplay',
|
|
484
|
-
fontWeight: theme('fontWeight.semibold'),
|
|
485
|
-
...typography.headingXlText.small,
|
|
486
|
-
'@media (min-width: theme("screens.lg"))': {
|
|
487
|
-
...typography.headingXlText.large,
|
|
488
|
-
},
|
|
489
|
-
},
|
|
490
|
-
h2: {
|
|
491
|
-
fontFamily: 'OBOSDisplay',
|
|
492
|
-
fontWeight: theme('fontWeight.semibold'),
|
|
493
|
-
...typography.headingLText.small,
|
|
494
|
-
'@media (min-width: theme("screens.lg"))': {
|
|
495
|
-
...typography.headingLText.large,
|
|
496
|
-
},
|
|
497
|
-
},
|
|
498
|
-
h3: {
|
|
499
|
-
fontFamily: 'OBOSText',
|
|
500
|
-
fontWeight: theme('fontWeight.medium'),
|
|
501
|
-
...typography.headingMText.small,
|
|
502
|
-
'@media (min-width: theme("screens.lg"))': {
|
|
503
|
-
...typography.headingMText.large,
|
|
504
|
-
},
|
|
505
|
-
},
|
|
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',
|
|
516
|
-
fontWeight: theme('fontWeight.bold'),
|
|
517
|
-
...typography.headingXsText.small,
|
|
518
|
-
'@media (min-width: theme("screens.lg"))': {
|
|
519
|
-
...typography.headingXsText.large,
|
|
520
|
-
},
|
|
521
|
-
},
|
|
522
|
-
li: {
|
|
523
|
-
...typography.paragraphText.small,
|
|
524
|
-
'@media (min-width: theme("screens.lg"))': {
|
|
525
|
-
...typography.paragraphText.large,
|
|
526
|
-
},
|
|
527
|
-
},
|
|
528
|
-
p: {
|
|
529
|
-
...typography.paragraphText.small,
|
|
530
|
-
'@media (min-width: theme("screens.lg"))': {
|
|
531
|
-
...typography.paragraphText.large,
|
|
532
|
-
},
|
|
533
|
-
},
|
|
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
|
-
},
|
|
550
|
-
},
|
|
551
|
-
'blockquote::before': {
|
|
552
|
-
...typography.blockquoteText.before,
|
|
553
|
-
},
|
|
554
|
-
'[class~="lead"]': {
|
|
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
|
-
},
|
|
566
|
-
},
|
|
567
|
-
},
|
|
568
|
-
},
|
|
569
|
-
}),
|
|
570
|
-
},
|
|
571
|
-
},
|
|
572
|
-
};
|
|
573
|
-
};
|
|
574
|
-
|
|
575
|
-
// These custom components are only used for v1 compat
|
|
576
|
-
const button = plugin(({ addComponents, theme }) => {
|
|
577
|
-
const hoverLoadingBgColor = 'rgba(0, 0, 0, 0.1)';
|
|
578
|
-
|
|
579
|
-
addComponents({
|
|
580
|
-
'.button': {
|
|
581
|
-
// The Tailwind utilities we use for focus styling are kinda hard to "translate", so using the @apply utility here, even though mixing styles are meh...
|
|
582
|
-
'@apply focus:outline-none focus-visible:ring-2 focus-visible:ring-black ring-offset-2':
|
|
583
|
-
{},
|
|
584
|
-
position: 'relative',
|
|
585
|
-
textDecorationLine: 'none',
|
|
586
|
-
display: 'inline-flex',
|
|
587
|
-
alignItems: 'center',
|
|
588
|
-
gap: theme('spacing.3'),
|
|
589
|
-
border: '2px solid',
|
|
590
|
-
padding: `${theme('spacing.2')} ${theme('spacing.6')}`,
|
|
591
|
-
borderRadius: '0.75rem',
|
|
592
|
-
transition: `all 200ms ${theme('transitionTimingFunction.DEFAULT')}`,
|
|
593
|
-
fontWeight: theme('fontWeight.medium'),
|
|
594
|
-
width: 'fit-content',
|
|
595
|
-
'&:disabled': {
|
|
596
|
-
backgroundColor: theme('colors.gray.light'),
|
|
597
|
-
borderColor: theme('colors.gray.light'),
|
|
598
|
-
color: theme('colors.black'),
|
|
599
|
-
pointerEvents: 'none',
|
|
600
|
-
},
|
|
601
|
-
'&:hover': {
|
|
602
|
-
borderRadius: '0.375rem',
|
|
603
|
-
},
|
|
604
|
-
'&::after': {
|
|
605
|
-
content: '""',
|
|
606
|
-
position: 'absolute',
|
|
607
|
-
backgroundColor: 'transparent',
|
|
608
|
-
display: 'block',
|
|
609
|
-
top: '-2px',
|
|
610
|
-
left: '-2px',
|
|
611
|
-
right: '-2px',
|
|
612
|
-
bottom: '-2px',
|
|
613
|
-
borderRadius: 'inherit',
|
|
614
|
-
},
|
|
615
|
-
// adds a shade on the button when hovered
|
|
616
|
-
// ideally this would be solved by just darkening the button background,
|
|
617
|
-
// but that doesn't really work since some of the button variations have transparent backgrounds
|
|
618
|
-
'&:hover::after': {
|
|
619
|
-
backgroundColor: hoverLoadingBgColor,
|
|
620
|
-
transition: `all 200ms ${theme('transitionTimingFunction.DEFAULT')}`,
|
|
621
|
-
},
|
|
622
|
-
// We use aria-busy to indicate loading state
|
|
623
|
-
'&[aria-busy="true"] > *': {
|
|
624
|
-
visibility: 'hidden',
|
|
625
|
-
},
|
|
626
|
-
'&[aria-busy="true"]::after': {
|
|
627
|
-
backgroundColor: hoverLoadingBgColor,
|
|
628
|
-
},
|
|
629
|
-
},
|
|
630
|
-
});
|
|
631
|
-
});
|
|
632
|
-
|
|
633
|
-
const radio = plugin(({ addComponents, theme }) => {
|
|
634
|
-
addComponents({
|
|
635
|
-
'.radio': {
|
|
636
|
-
// hide the native radio input
|
|
637
|
-
appearance: 'none',
|
|
638
|
-
// not removed via appeareance
|
|
639
|
-
margin: 0,
|
|
640
|
-
height: '1.25rem',
|
|
641
|
-
width: '1.25rem',
|
|
642
|
-
borderRadius: '50%',
|
|
643
|
-
border: `2px solid ${theme('colors.gray.dark')}`,
|
|
644
|
-
cursor: 'pointer',
|
|
645
|
-
// use grid to handle the checked:before styles
|
|
646
|
-
display: 'inline-grid',
|
|
647
|
-
placeContent: 'center',
|
|
648
|
-
// Prevent flex container from altering the size of the radio button
|
|
649
|
-
flex: '0 0 auto',
|
|
650
|
-
// magic number that tries to keep the input horizontally centered in relation to the first line of the label text
|
|
651
|
-
transform: 'translateY(0.095em)',
|
|
652
|
-
'&:checked': {
|
|
653
|
-
borderColor: theme('colors.green.DEFAULT'),
|
|
654
|
-
},
|
|
655
|
-
'&:focus-visible': {
|
|
656
|
-
outline: '1px solid currentColor',
|
|
657
|
-
outlineOffset: '4px',
|
|
658
|
-
},
|
|
659
|
-
'&::before': {
|
|
660
|
-
content: '""',
|
|
661
|
-
display: 'block',
|
|
662
|
-
borderRadius: '50%',
|
|
663
|
-
transform: 'scale(0)',
|
|
664
|
-
width: '0.65em',
|
|
665
|
-
height: '0.65em',
|
|
666
|
-
transition: '120ms transform ease-in-out',
|
|
667
|
-
boxShadow: `inset 1em 1em ${theme('colors.green.DEFAULT')}`,
|
|
668
|
-
/* Windows High Contrast Mode */
|
|
669
|
-
backgroundColor: 'CanvasText',
|
|
670
|
-
},
|
|
671
|
-
'&:checked::before': {
|
|
672
|
-
transform: 'scale(1)',
|
|
673
|
-
},
|
|
674
|
-
},
|
|
675
|
-
});
|
|
676
|
-
});
|
|
677
|
-
|
|
678
|
-
const checkbox = plugin(({ addComponents, theme }) => {
|
|
679
|
-
addComponents({
|
|
680
|
-
'.checkbox': {
|
|
681
|
-
'&::before': {
|
|
682
|
-
content: '""',
|
|
683
|
-
width: '0.65em',
|
|
684
|
-
height: '0.65em',
|
|
685
|
-
transform: 'scale(0)',
|
|
686
|
-
transition: '120ms transform ease-in-out',
|
|
687
|
-
backgroundColor: theme('colors.white'),
|
|
688
|
-
'box-shadow': 'inset 1em 1em currentColor',
|
|
689
|
-
'clip-path':
|
|
690
|
-
'polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%)',
|
|
691
|
-
},
|
|
692
|
-
'&:checked::before': {
|
|
693
|
-
transform: 'scale(1)',
|
|
694
|
-
},
|
|
695
|
-
},
|
|
696
|
-
});
|
|
697
|
-
});
|
|
698
|
-
|
|
699
|
-
const snackbar = plugin(({ addComponents, theme }) => {
|
|
700
|
-
addComponents({
|
|
701
|
-
'.snackbar': {
|
|
702
|
-
'grid-template-columns': 'min-content auto',
|
|
703
|
-
'grid-template-areas': '"icon header" ". content" "actions actions"',
|
|
704
|
-
},
|
|
705
|
-
[`@media(min-width: ${theme('screens.md')})`]: {
|
|
706
|
-
'.snackbar': {
|
|
707
|
-
'grid-template-columns': 'min-content auto auto',
|
|
708
|
-
'grid-template-areas': '"icon header actions" ". content content"',
|
|
709
|
-
},
|
|
710
|
-
},
|
|
711
|
-
'.snackbar-icon': {
|
|
712
|
-
'grid-area': 'icon',
|
|
713
|
-
},
|
|
714
|
-
'.snackbar-header': {
|
|
715
|
-
'grid-area': 'header',
|
|
716
|
-
},
|
|
717
|
-
'.snackbar-content': {
|
|
718
|
-
'grid-area': 'content',
|
|
719
|
-
},
|
|
720
|
-
'.snackbar-actions': {
|
|
721
|
-
'grid-area': 'actions',
|
|
722
|
-
},
|
|
723
|
-
});
|
|
724
|
-
});
|