@obosbbl/grunnmuren-tailwind 0.4.1 → 0.5.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/tailwind-base.cjs +73 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-tailwind",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
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,32 @@ 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-flex',
59
+ alignItems: 'center',
60
+ gap: theme('spacing.3'),
61
+ border: '2px solid',
62
+ padding: `${theme('spacing.2')} ${theme('spacing.6')}`,
63
+ borderRadius: '0.75rem',
64
+ transition: `all 200ms ${theme('transitionTimingFunction.DEFAULT')}`,
65
+ fontWeight: theme('fontWeight.medium'),
66
+ width: 'fit-content',
67
+ '&:disabled': {
68
+ backgroundColor: theme('colors.gray.light'),
69
+ borderColor: theme('colors.gray.light'),
70
+ color: theme('colors.black'),
71
+ pointerEvents: 'none',
72
+ },
73
+ '&:hover': {
74
+ borderRadius: '0.375rem',
75
+ },
56
76
  '&::after': {
57
77
  content: '""',
58
78
  position: 'absolute',
@@ -64,16 +84,61 @@ const button = plugin(function ({ addComponents }) {
64
84
  bottom: '-2px',
65
85
  borderRadius: '0.75rem',
66
86
  },
87
+ // adds a shade on the button when hovered
88
+ // ideally this would be solved by just darkening the button background,
89
+ // but that doesn't really work since some of the button variations have transparent backgrounds
67
90
  '&:hover::after': {
68
91
  backgroundColor: 'rgba(0, 0, 0, 0.1)',
69
92
  borderRadius: '0.375rem',
70
- transition: 'all 200ms cubic-bezier(0.4, 0, 0.2, 1)',
93
+ transition: `all 200ms ${theme('transitionTimingFunction.DEFAULT')}`,
94
+ },
95
+ },
96
+ });
97
+ });
98
+
99
+ const radio = plugin(function ({ addComponents, theme }) {
100
+ addComponents({
101
+ '.radio': {
102
+ // hide the native radio input
103
+ appearance: 'none',
104
+ // not removed via appeareance
105
+ margin: 0,
106
+ height: '1.25rem',
107
+ width: '1.25rem',
108
+ borderRadius: '50%',
109
+ border: `2px solid ${theme('colors.gray.dark')}`,
110
+ cursor: 'pointer',
111
+ marginRight: '0.75rem',
112
+ // use grid to handle the checked:before styles
113
+ display: 'inline-grid',
114
+ placeContent: 'center',
115
+ '&:checked': {
116
+ borderColor: theme('colors.green.DEFAULT'),
117
+ },
118
+ '&:focus-visible': {
119
+ outline: '1px solid currentColor',
120
+ outlineOffset: '4px',
121
+ },
122
+ '&::before': {
123
+ content: '""',
124
+ display: 'block',
125
+ borderRadius: '50%',
126
+ transform: 'scale(0)',
127
+ width: '0.65em',
128
+ height: '0.65em',
129
+ transition: '120ms transform ease-in-out',
130
+ boxShadow: `inset 1em 1em ${theme('colors.green.DEFAULT')}`,
131
+ /* Windows High Contrast Mode */
132
+ backgroundColor: 'CanvasText',
133
+ },
134
+ '&:checked::before': {
135
+ transform: 'scale(1)',
71
136
  },
72
137
  },
73
138
  });
74
139
  });
75
140
 
76
- const checkbox = plugin(function ({ addComponents }) {
141
+ const checkbox = plugin(function ({ addComponents, theme }) {
77
142
  addComponents({
78
143
  '.checkbox': {
79
144
  '&::before': {
@@ -82,6 +147,7 @@ const checkbox = plugin(function ({ addComponents }) {
82
147
  height: '0.65em',
83
148
  transform: 'scale(0)',
84
149
  transition: '120ms transform ease-in-out',
150
+ backgroundColor: theme('colors.white'),
85
151
  'box-shadow': 'inset 1em 1em currentColor',
86
152
  'clip-path':
87
153
  'polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%)',
@@ -186,6 +252,7 @@ module.exports = (userOptions) => {
186
252
  headings,
187
253
  checkbox,
188
254
  snackbar,
255
+ radio,
189
256
  plugin(function ({ addBase, addUtilities, addComponents, theme }) {
190
257
  addBase({
191
258
  html: {