@obosbbl/grunnmuren-tailwind 0.4.2 → 0.5.0

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/tailwind-base.cjs +69 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-tailwind",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Grunnmuren Tailwind preset",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -16,10 +16,10 @@
16
16
  ],
17
17
  "dependencies": {
18
18
  "@tailwindcss/aspect-ratio": "0.4.0",
19
- "@tailwindcss/typography": "0.5.2"
19
+ "@tailwindcss/typography": "0.5.4"
20
20
  },
21
21
  "devDependencies": {
22
- "tailwindcss": "3.1.4"
22
+ "tailwindcss": "3.1.8"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "tailwindcss": "^3"
package/tailwind-base.cjs CHANGED
@@ -47,12 +47,30 @@ const obosFonts = [
47
47
  },
48
48
  ];
49
49
 
50
- const button = plugin(function ({ addComponents }) {
51
- // adds a shade on the button when hovered
52
- // ideally this would be solved by just darkening the button background,
53
- // but that doesn't really work since some of the button variations have transparent backgrounds
50
+ const button = plugin(function ({ addComponents, theme }) {
54
51
  addComponents({
55
52
  '.button': {
53
+ // 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...
54
+ '@apply focus:outline-none focus-visible:ring-2 focus-visible:ring-black ring-offset-2':
55
+ {},
56
+ position: 'relative',
57
+ textDecorationLine: 'none',
58
+ display: 'inline-block',
59
+ border: '2px solid',
60
+ padding: `${theme('spacing.2')} ${theme('spacing.6')}`,
61
+ borderRadius: '0.75rem',
62
+ transition: `all 200ms ${theme('transitionTimingFunction.DEFAULT')}`,
63
+ fontWeight: theme('fontWeight.medium'),
64
+ width: 'fit-content',
65
+ '&:disabled': {
66
+ backgroundColor: theme('colors.gray.light'),
67
+ borderColor: theme('colors.gray.light'),
68
+ color: theme('colors.black'),
69
+ pointerEvents: 'none',
70
+ },
71
+ '&:hover': {
72
+ borderRadius: '0.375rem',
73
+ },
56
74
  '&::after': {
57
75
  content: '""',
58
76
  position: 'absolute',
@@ -64,10 +82,55 @@ const button = plugin(function ({ addComponents }) {
64
82
  bottom: '-2px',
65
83
  borderRadius: '0.75rem',
66
84
  },
85
+ // adds a shade on the button when hovered
86
+ // ideally this would be solved by just darkening the button background,
87
+ // but that doesn't really work since some of the button variations have transparent backgrounds
67
88
  '&:hover::after': {
68
89
  backgroundColor: 'rgba(0, 0, 0, 0.1)',
69
90
  borderRadius: '0.375rem',
70
- transition: 'all 200ms cubic-bezier(0.4, 0, 0.2, 1)',
91
+ transition: `all 200ms ${theme('transitionTimingFunction.DEFAULT')}`,
92
+ },
93
+ },
94
+ });
95
+ });
96
+
97
+ const radio = plugin(function ({ addComponents, theme }) {
98
+ addComponents({
99
+ '.radio': {
100
+ // hide the native radio input
101
+ appearance: 'none',
102
+ // not removed via appeareance
103
+ margin: 0,
104
+ height: '1.25rem',
105
+ width: '1.25rem',
106
+ borderRadius: '50%',
107
+ border: `2px solid ${theme('colors.gray.dark')}`,
108
+ cursor: 'pointer',
109
+ marginRight: '0.75rem',
110
+ // use grid to handle the checked:before styles
111
+ display: 'inline-grid',
112
+ placeContent: 'center',
113
+ '&:checked': {
114
+ borderColor: theme('colors.green.DEFAULT'),
115
+ },
116
+ '&:focus-visible': {
117
+ outline: '1px solid currentColor',
118
+ outlineOffset: '4px',
119
+ },
120
+ '&::before': {
121
+ content: '""',
122
+ display: 'block',
123
+ borderRadius: '50%',
124
+ transform: 'scale(0)',
125
+ width: '0.65em',
126
+ height: '0.65em',
127
+ transition: '120ms transform ease-in-out',
128
+ boxShadow: `inset 1em 1em ${theme('colors.green.DEFAULT')}`,
129
+ /* Windows High Contrast Mode */
130
+ backgroundColor: 'CanvasText',
131
+ },
132
+ '&:checked::before': {
133
+ transform: 'scale(1)',
71
134
  },
72
135
  },
73
136
  });
@@ -187,6 +250,7 @@ module.exports = (userOptions) => {
187
250
  headings,
188
251
  checkbox,
189
252
  snackbar,
253
+ radio,
190
254
  plugin(function ({ addBase, addUtilities, addComponents, theme }) {
191
255
  addBase({
192
256
  html: {