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