@onereach/styles 27.0.2-beta.6093.0 → 27.0.2-beta.6095.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/styles",
3
- "version": "27.0.2-beta.6093.0",
3
+ "version": "27.0.2-beta.6095.0",
4
4
  "description": "Styles for or-ui-next",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -34,7 +34,7 @@
34
34
  "lint": "stylelint '**/*.scss'"
35
35
  },
36
36
  "dependencies": {
37
- "@onereach/font-icons": "^27.0.2-beta.6093.0",
37
+ "@onereach/font-icons": "^27.0.2-beta.6095.0",
38
38
  "tailwindcss": "4.3.2"
39
39
  },
40
40
  "devDependencies": {
@@ -0,0 +1,162 @@
1
+ const plugin = require('tailwindcss/plugin');
2
+
3
+ const screens = require('../../screens.json');
4
+
5
+ const spacingUtilities = {
6
+ p: ['padding'],
7
+ px: ['paddingInline'],
8
+ py: ['paddingBlock'],
9
+ pt: ['paddingTop'],
10
+ pr: ['paddingRight'],
11
+ pb: ['paddingBottom'],
12
+ pl: ['paddingLeft'],
13
+ ps: ['paddingInlineStart'],
14
+ pe: ['paddingInlineEnd'],
15
+ m: ['margin'],
16
+ mx: ['marginInline'],
17
+ my: ['marginBlock'],
18
+ mt: ['marginTop'],
19
+ mr: ['marginRight'],
20
+ mb: ['marginBottom'],
21
+ ml: ['marginLeft'],
22
+ ms: ['marginInlineStart'],
23
+ me: ['marginInlineEnd'],
24
+ gap: ['gap'],
25
+ w: ['width'],
26
+ h: ['height'],
27
+ 'min-w': ['minWidth'],
28
+ 'min-h': ['minHeight'],
29
+ 'max-w': ['maxWidth'],
30
+ 'max-h': ['maxHeight'],
31
+ };
32
+
33
+ const childrenUtilities = {
34
+ p: ['padding'],
35
+ px: ['paddingInline'],
36
+ py: ['paddingBlock'],
37
+ pt: ['paddingTop'],
38
+ pr: ['paddingRight'],
39
+ pb: ['paddingBottom'],
40
+ pl: ['paddingLeft'],
41
+ ps: ['paddingInlineStart'],
42
+ pe: ['paddingInlineEnd'],
43
+ m: ['margin'],
44
+ mx: ['marginInline'],
45
+ my: ['marginBlock'],
46
+ mt: ['marginTop'],
47
+ mr: ['marginRight'],
48
+ mb: ['marginBottom'],
49
+ ml: ['marginLeft'],
50
+ ms: ['marginInlineStart'],
51
+ me: ['marginInlineEnd'],
52
+ };
53
+
54
+ const firstLastChildrenUtilities = {
55
+ ms: ['marginInlineStart'],
56
+ me: ['marginInlineEnd'],
57
+ };
58
+
59
+ const escapeClassName = (className) => className
60
+ .replace(/!/g, '\\!')
61
+ .replace(/:/g, '\\:')
62
+ .replace(/\[/g, '\\[')
63
+ .replace(/\]/g, '\\]')
64
+ .replace(/\+/g, '\\+')
65
+ .replace(/\*/g, '\\*');
66
+
67
+ const toSelector = (className) => `.${escapeClassName(className)}`;
68
+
69
+ const toRule = (properties, value) => properties.reduce((rule, property) => {
70
+ rule[property] = value;
71
+ return rule;
72
+ }, {});
73
+
74
+ const important = (rule) => Object.fromEntries(
75
+ Object.entries(rule).map(([property, value]) => [property, `${value} !important`]),
76
+ );
77
+
78
+ const negate = (value) => `calc(${value} * -1)`;
79
+
80
+ const childSelector = (className) => `${toSelector(className)} > *`;
81
+
82
+ const addChildUtility = (utilities, className, rule) => {
83
+ utilities[childSelector(className)] = rule;
84
+ };
85
+
86
+ const addStateChildUtility = (utilities, state, className, rule) => {
87
+ utilities[`${toSelector(`${state}:children:${className}`)}:is([${state}]:not([${state}="false"])) > *`] = rule;
88
+ utilities[`${toSelector(`${state}:children:${className}`)}[force-state~="${state}"] > *`] = rule;
89
+ };
90
+
91
+ module.exports = {
92
+ plugin: plugin(({ addBase, theme }) => {
93
+ const spacing = theme('spacing');
94
+ const spacingEntries = Object.entries(spacing);
95
+
96
+ const utilities = {};
97
+
98
+ spacingEntries.forEach(([name, value]) => {
99
+ Object.entries(spacingUtilities).forEach(([utility, properties]) => {
100
+ utilities[toSelector(`${utility}-${name}`)] = toRule(properties, value);
101
+ utilities[toSelector(`!${utility}-${name}`)] = important(toRule(properties, value));
102
+ });
103
+
104
+ Object.entries(childrenUtilities).forEach(([utility, properties]) => {
105
+ addChildUtility(utilities, `children:${utility}-${name}`, toRule(properties, value));
106
+ addChildUtility(utilities, `children:!${utility}-${name}`, important(toRule(properties, value)));
107
+ addStateChildUtility(utilities, 'activated', `${utility}-${name}`, toRule(properties, value));
108
+ });
109
+
110
+ Object.entries(firstLastChildrenUtilities).forEach(([utility, properties]) => {
111
+ utilities[`${toSelector(`first:children:${utility}-${name}`)} > :first-child`] = toRule(properties, value);
112
+ utilities[`${toSelector(`last:children:${utility}-${name}`)} > :last-child`] = toRule(properties, value);
113
+ utilities[`${toSelector(`first:children:!${utility}-${name}`)} > :first-child`] = important(toRule(properties, value));
114
+ utilities[`${toSelector(`last:children:!${utility}-${name}`)} > :last-child`] = important(toRule(properties, value));
115
+ });
116
+
117
+ ['m', 'mx', 'my', 'mt', 'mr', 'mb', 'ml', 'ms', 'me'].forEach((utility) => {
118
+ utilities[toSelector(`-${utility}-${name}`)] = toRule(spacingUtilities[utility], negate(value));
119
+ utilities[toSelector(`!-${utility}-${name}`)] = important(toRule(spacingUtilities[utility], negate(value)));
120
+ });
121
+ });
122
+
123
+ addChildUtility(utilities, 'children:outline-none', { outlineStyle: 'none' });
124
+ addChildUtility(utilities, 'children:min-h-[46px]', { minHeight: '46px' });
125
+ addChildUtility(utilities, 'children:min-h-[34px]', { minHeight: '34px' });
126
+ addChildUtility(utilities, 'children:min-h-[30px]', { minHeight: '30px' });
127
+ addChildUtility(utilities, 'children:relative', { position: 'relative' });
128
+ addChildUtility(utilities, 'children:z-10', { zIndex: '10' });
129
+ addStateChildUtility(utilities, 'active', 'z-10', { zIndex: '10' });
130
+ addChildUtility(utilities, 'children:grow', { flexGrow: '1' });
131
+ addChildUtility(utilities, 'children:rounded-l-0', {
132
+ borderTopLeftRadius: '0',
133
+ borderBottomLeftRadius: '0',
134
+ });
135
+ addChildUtility(utilities, 'children:rounded-r-0', {
136
+ borderTopRightRadius: '0',
137
+ borderBottomRightRadius: '0',
138
+ });
139
+ addChildUtility(utilities, 'children:-ml-[1px]', { marginLeft: '-1px' });
140
+ utilities[toSelector('m-[10px]')] = { margin: '10px' };
141
+
142
+ const responsiveUtilities = {};
143
+
144
+ Object.entries(screens).forEach(([screen, width]) => {
145
+ const screenUtilities = {};
146
+
147
+ Object.entries(utilities).forEach(([selector, rule]) => {
148
+ const responsiveSelector = `.${escapeClassName(`${screen}:`)}${selector.slice(1)}`;
149
+ screenUtilities[responsiveSelector] = rule;
150
+ responsiveUtilities[`${responsiveSelector}[force-screen~="${screen}"]`] = rule;
151
+ responsiveUtilities[`[force-screen~="${screen}"] ${responsiveSelector}`] = rule;
152
+ });
153
+
154
+ responsiveUtilities[`@media (min-width: ${width})`] = screenUtilities;
155
+ });
156
+
157
+ addBase({
158
+ ...utilities,
159
+ ...responsiveUtilities,
160
+ });
161
+ }),
162
+ };
@@ -36,9 +36,6 @@ module.exports = {
36
36
  color: resolveThemeValue(theme, `textColor.on-${token}` + suffix),
37
37
  backgroundColor: resolveThemeValue(theme, `backgroundColor.${token}` + suffix),
38
38
 
39
- borderStyle: 'none',
40
- outlineStyle: 'none',
41
-
42
39
  [variants['mobile']]: {
43
40
  [variants['active']]: {
44
41
  backgroundColor: resolveThemeValue(theme, `backgroundColor.${token}-hover` + suffix),
@@ -77,9 +74,6 @@ module.exports = {
77
74
  color: resolveThemeValue(theme, `textColor.${token}` + suffix),
78
75
  backgroundColor: resolveThemeValue(theme, `backgroundColor.${token}-opacity-0-08` + suffix),
79
76
 
80
- borderStyle: 'none',
81
- outlineStyle: 'none',
82
-
83
77
  [variants['mobile']]: {
84
78
  [variants['active']]: {
85
79
  backgroundColor: resolveThemeValue(theme, `backgroundColor.${token}-opacity-0-12` + suffix),
@@ -118,9 +112,6 @@ module.exports = {
118
112
  color: resolveThemeValue(theme, `textColor.${token}` + suffix),
119
113
  backgroundColor: 'transparent',
120
114
 
121
- borderStyle: 'none',
122
- outlineStyle: 'none',
123
-
124
115
  [variants['mobile']]: {
125
116
  [variants['active']]: {
126
117
  backgroundColor: resolveThemeValue(theme, `backgroundColor.${token}-opacity-0-08` + suffix),
@@ -159,9 +150,6 @@ module.exports = {
159
150
  color: resolveThemeValue(theme, `textColor.${token}` + suffix),
160
151
  backgroundColor: 'transparent',
161
152
 
162
- borderStyle: 'none',
163
- outlineStyle: 'none',
164
-
165
153
  [variants['mobile']]: {
166
154
  [variants['active']]: {
167
155
  color: resolveThemeValue(theme, `textColor.${token}-hover` + suffix),
@@ -13,6 +13,7 @@ const { plugin: core } = require('./tailwind/plugins/core');
13
13
  const { plugin: iconography } = require('./tailwind/plugins/iconography');
14
14
  const { plugin: interactivity } = require('./tailwind/plugins/interactivity');
15
15
  const { plugin: layout } = require('./tailwind/plugins/layout');
16
+ const { plugin: legacySpacing } = require('./tailwind/plugins/legacy-spacing');
16
17
  const { plugin: themeResponsive } = require('./tailwind/plugins/responsive');
17
18
  const { plugin: scrollbar } = require('./tailwind/plugins/scrollbar');
18
19
  const { plugin: themeBackground } = require('./tailwind/plugins/theme-background');
@@ -214,6 +215,7 @@ module.exports = {
214
215
  interactivity,
215
216
  typography,
216
217
  iconography,
218
+ legacySpacing,
217
219
 
218
220
  animationDelay,
219
221