@onereach/styles 3.2.0 → 3.2.1-beta.3201.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.
@@ -0,0 +1,190 @@
1
+ const plugin = require('tailwindcss/plugin');
2
+ const { variants } = require('./core');
3
+
4
+ const values = {
5
+ 'primary': 'primary',
6
+ 'primary-dark': 'primary..-dark',
7
+
8
+ 'secondary': 'secondary',
9
+ 'secondary-dark': 'secondary..-dark',
10
+
11
+ 'tertiary': 'tertiary',
12
+ 'tertiary-dark': 'tertiary..-dark',
13
+
14
+ 'success': 'success',
15
+ 'success-dark': 'success..-dark',
16
+
17
+ 'warning': 'warning',
18
+ 'warning-dark': 'warning..-dark',
19
+
20
+ 'error': 'error',
21
+ 'error-dark': 'error..-dark',
22
+ };
23
+
24
+ module.exports = {
25
+ values,
26
+
27
+ plugin: plugin(({ matchUtilities, theme }) => {
28
+ matchUtilities({
29
+ 'theme-preset-1': (value) => {
30
+ const [token, suffix = ''] = value.split('..');
31
+
32
+ return {
33
+ backgroundColor: theme(`backgroundColor.${token}` + suffix),
34
+ color: theme(`textColor.on-${token}` + suffix),
35
+
36
+ borderStyle: 'none',
37
+ outlineStyle: 'none',
38
+
39
+ [variants['disabled']]: {
40
+ backgroundColor: `${theme('backgroundColor.disabled' + suffix)} !important`,
41
+ color: `${theme('textColor.on-disabled' + suffix)} !important`,
42
+ },
43
+
44
+ [variants['active']]: {
45
+ backgroundColor: theme(`backgroundColor.${token}-hover` + suffix),
46
+ },
47
+
48
+ // Desktop
49
+ '@media (any-hover: hover)': {
50
+ [variants['hover']]: {
51
+ backgroundColor: theme(`backgroundColor.${token}-hover` + suffix),
52
+ },
53
+
54
+ [variants['focus-visible']]: {
55
+ backgroundColor: theme(`backgroundColor.${token}-hover` + suffix),
56
+ },
57
+
58
+ [variants['active']]: {
59
+ backgroundColor: theme(`backgroundColor.${token}` + suffix),
60
+ },
61
+ },
62
+
63
+ transitionProperty: 'color, background-color, border-color, outline-color',
64
+ transitionDuration: theme('transitionDuration.short'),
65
+ transitionTimingFunction: theme('transitionTimingFunction.standard'),
66
+ };
67
+ },
68
+
69
+ 'theme-preset-2': (value) => {
70
+ const [token, suffix = ''] = value.split('..');
71
+
72
+ return {
73
+ backgroundColor: theme(`backgroundColor.${token}-opacity-0-08` + suffix),
74
+ color: theme(`textColor.${token}` + suffix),
75
+
76
+ borderStyle: 'none',
77
+ outlineStyle: 'none',
78
+
79
+ [variants['disabled']]: {
80
+ backgroundColor: `${theme('backgroundColor.disabled' + suffix)} !important`,
81
+ color: `${theme('textColor.on-disabled' + suffix)} !important`,
82
+ },
83
+
84
+ [variants['active']]: {
85
+ backgroundColor: theme(`backgroundColor.${token}-opacity-0-12` + suffix),
86
+ },
87
+
88
+ // Desktop
89
+ '@media (any-hover: hover)': {
90
+ [variants['hover']]: {
91
+ backgroundColor: theme(`backgroundColor.${token}-opacity-0-12` + suffix),
92
+ },
93
+
94
+ [variants['focus-visible']]: {
95
+ backgroundColor: theme(`backgroundColor.${token}-opacity-0-12` + suffix),
96
+ },
97
+
98
+ [variants['active']]: {
99
+ backgroundColor: theme(`backgroundColor.${token}-opacity-0-16` + suffix),
100
+ },
101
+ },
102
+
103
+ transitionProperty: 'color, background-color, border-color, outline-color',
104
+ transitionDuration: theme('transitionDuration.short'),
105
+ transitionTimingFunction: theme('transitionTimingFunction.standard'),
106
+ };
107
+ },
108
+
109
+ 'theme-preset-3': (value) => {
110
+ const [token, suffix = ''] = value.split('..');
111
+
112
+ return {
113
+ backgroundColor: 'transparent',
114
+ color: theme(`textColor.${token}` + suffix),
115
+
116
+ borderStyle: 'none',
117
+ outlineStyle: 'none',
118
+
119
+ [variants['disabled']]: {
120
+ backgroundColor: 'transparent !important',
121
+ color: `${theme('textColor.on-disabled' + suffix)} !important`,
122
+ },
123
+
124
+ [variants['active']]: {
125
+ backgroundColor: theme(`backgroundColor.${token}-opacity-0-08` + suffix),
126
+ },
127
+
128
+ // Desktop
129
+ '@media (any-hover: hover)': {
130
+ [variants['hover']]: {
131
+ backgroundColor: theme(`backgroundColor.${token}-opacity-0-08` + suffix),
132
+ },
133
+
134
+ [variants['focus-visible']]: {
135
+ backgroundColor: theme(`backgroundColor.${token}-opacity-0-08` + suffix),
136
+ },
137
+
138
+ [variants['active']]: {
139
+ backgroundColor: theme(`backgroundColor.${token}-opacity-0-16` + suffix),
140
+ },
141
+ },
142
+
143
+ transitionProperty: 'color, background-color, border-color, outline-color',
144
+ transitionDuration: theme('transitionDuration.short'),
145
+ transitionTimingFunction: theme('transitionTimingFunction.standard'),
146
+ };
147
+ },
148
+
149
+ 'theme-preset-4': (value) => {
150
+ const [token, suffix = ''] = value.split('..');
151
+
152
+ return {
153
+ backgroundColor: 'transparent',
154
+ color: theme(`textColor.${token}` + suffix),
155
+
156
+ borderStyle: 'none',
157
+ outlineStyle: 'none',
158
+
159
+ [variants['disabled']]: {
160
+ backgroundColor: 'transparent !important',
161
+ color: `${theme('textColor.on-disabled' + suffix)} !important`,
162
+ },
163
+
164
+ [variants['active']]: {
165
+ color: theme(`textColor.${token}-hover` + suffix),
166
+ },
167
+
168
+ // Desktop
169
+ '@media (any-hover: hover)': {
170
+ [variants['hover']]: {
171
+ color: theme(`textColor.${token}-hover` + suffix),
172
+ },
173
+
174
+ [variants['focus-visible']]: {
175
+ color: theme(`textColor.${token}-hover` + suffix),
176
+ },
177
+
178
+ [variants['active']]: {
179
+ color: theme(`textColor.${token}` + suffix),
180
+ },
181
+ },
182
+
183
+ transitionProperty: 'color, background-color, border-color, outline-color',
184
+ transitionDuration: theme('transitionDuration.short'),
185
+ transitionTimingFunction: theme('transitionTimingFunction.standard'),
186
+ };
187
+ },
188
+ }, { values });
189
+ }),
190
+ };
@@ -0,0 +1,73 @@
1
+ const plugin = require('tailwindcss/plugin');
2
+ const { screens } = require('./core');
3
+
4
+ const values = {
5
+ 'display-large': 'display-large',
6
+ 'display-medium': 'display-medium',
7
+ 'display-small': 'display-small',
8
+
9
+ 'headline-1': 'headline-1',
10
+ 'headline-2': 'headline-2',
11
+ 'headline-3': 'headline-3',
12
+ 'headline-4': 'headline-4',
13
+
14
+ 'body-1-regular': 'body-1-regular',
15
+ 'body-1-semibold': 'body-1-semibold',
16
+ 'body-1-bold': 'body-1-bold',
17
+
18
+ 'body-2-regular': 'body-2-regular',
19
+ 'body-2-semibold': 'body-2-semibold',
20
+ 'body-2-bold': 'body-2-bold',
21
+
22
+ 'caption-regular': 'caption-regular',
23
+ 'caption-semibold': 'caption-semibold',
24
+ 'caption-bold': 'caption-bold',
25
+
26
+ 'button': 'button',
27
+
28
+ 'inherit': 'inherit',
29
+ };
30
+
31
+ module.exports = {
32
+ values,
33
+
34
+ plugin: plugin(({ matchUtilities, theme }) => {
35
+ matchUtilities({
36
+ 'typography': (value) => {
37
+ const fontSizeConfig = theme('fontSize');
38
+
39
+ const [fontSizeDesktop, optionsDesktop] = fontSizeConfig[value] ?? [];
40
+ const [fontSizeMobile, optionsMobile] = fontSizeConfig[`mobile-${value}`] ?? [];
41
+
42
+ return {
43
+ fontFamily: theme(`fontFamily.mobile-${value}`) ?? theme(`fontFamily.${value}`),
44
+ fontWeight: theme(`fontWeight.mobile-${value}`) ?? theme(`fontWeight.${value}`),
45
+ fontSize: fontSizeMobile ?? fontSizeDesktop,
46
+ lineHeight: optionsMobile?.lineHeight ?? optionsDesktop?.lineHeight,
47
+
48
+ // Desktop
49
+ [`@media (min-width: ${screens.md})`]: {
50
+ fontFamily: theme(`fontFamily.${value}`),
51
+ fontWeight: theme(`fontWeight.${value}`),
52
+ fontSize: fontSizeDesktop,
53
+ lineHeight: optionsDesktop?.lineHeight,
54
+ },
55
+
56
+ '[force-screen~="md"] &': {
57
+ fontFamily: theme(`fontFamily.${value}`),
58
+ fontWeight: theme(`fontWeight.${value}`),
59
+ fontSize: fontSizeDesktop,
60
+ lineHeight: optionsDesktop?.lineHeight,
61
+ },
62
+
63
+ '&[force-screen~="md"]': {
64
+ fontFamily: theme(`fontFamily.${value}`),
65
+ fontWeight: theme(`fontWeight.${value}`),
66
+ fontSize: fontSizeDesktop,
67
+ lineHeight: optionsDesktop?.lineHeight,
68
+ },
69
+ };
70
+ },
71
+ }, { values });
72
+ }),
73
+ };
@@ -3624,6 +3624,10 @@
3624
3624
  "content"
3625
3625
  ],
3626
3626
  "plugins": [
3627
+ {},
3628
+ {},
3629
+ {},
3630
+ {},
3627
3631
  {},
3628
3632
  {},
3629
3633
  {},