@onereach/styles 26.2.2-beta.5850.0 → 26.2.2-beta.5851.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 +2 -2
- package/src/variables/tokens/custom-tokens.json +8 -0
- package/tailwind/utils.js +18 -0
- package/tailwind.config.json +6 -6
- package/tailwind.config.preset.js +3 -6
- package/tokens-v3.css +8 -0
- package/tokens.css +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/styles",
|
|
3
|
-
"version": "26.2.2-beta.
|
|
3
|
+
"version": "26.2.2-beta.5851.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": "^26.2.2-beta.
|
|
37
|
+
"@onereach/font-icons": "^26.2.2-beta.5851.0",
|
|
38
38
|
"tailwindcss": "3.4.16"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
package/tailwind/utils.js
CHANGED
|
@@ -228,4 +228,22 @@ module.exports = {
|
|
|
228
228
|
|
|
229
229
|
return colorMap;
|
|
230
230
|
},
|
|
231
|
+
|
|
232
|
+
// Converts a flat key:value object of custom tokens into CSS variable-based references
|
|
233
|
+
// Example: { "min-button-width": "96px" } -> { "min-button-width": "var(--or-t-min-button-width, 96px)" }
|
|
234
|
+
parseCustomTokensNames(customTokens, options = {}) {
|
|
235
|
+
const { prefix = 'or-t', withFallback = true } = options;
|
|
236
|
+
const sanitizeForVar = (name) => String(name).replace(/\+/g, 'plus').replace(/\*/g, 'star');
|
|
237
|
+
|
|
238
|
+
const toVar = (varName, fallback) =>
|
|
239
|
+
withFallback && typeof fallback === 'string'
|
|
240
|
+
? `var(--${varName}, ${fallback})`
|
|
241
|
+
: `var(--${varName})`;
|
|
242
|
+
|
|
243
|
+
return Object.entries(customTokens).reduce((preset, [name, value]) => {
|
|
244
|
+
const varName = `${prefix}-${sanitizeForVar(name)}`;
|
|
245
|
+
preset[name] = toVar(varName, value);
|
|
246
|
+
return preset;
|
|
247
|
+
}, {});
|
|
248
|
+
},
|
|
231
249
|
};
|
package/tailwind.config.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"theme": {
|
|
3
3
|
"tokens": {
|
|
4
|
-
"min-button-width": "96px",
|
|
5
|
-
"confirm-dialog-width": "320px",
|
|
6
|
-
"confirm-dialog-action-width": "128px",
|
|
7
|
-
"max-select-dropdown-height": "172px",
|
|
8
|
-
"desktop-toast-width": "512px",
|
|
9
|
-
"mobile-toast-width": "343px"
|
|
4
|
+
"min-button-width": "var(--or-t-min-button-width, 96px)",
|
|
5
|
+
"confirm-dialog-width": "var(--or-t-confirm-dialog-width, 320px)",
|
|
6
|
+
"confirm-dialog-action-width": "var(--or-t-confirm-dialog-action-width, 128px)",
|
|
7
|
+
"max-select-dropdown-height": "var(--or-t-max-select-dropdown-height, 172px)",
|
|
8
|
+
"desktop-toast-width": "var(--or-t-desktop-toast-width, 512px)",
|
|
9
|
+
"mobile-toast-width": "var(--or-t-mobile-toast-width, 343px)"
|
|
10
10
|
},
|
|
11
11
|
"screens": {},
|
|
12
12
|
"spacing": {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const customTokens = require('./src/variables/tokens/custom-tokens.json');
|
|
1
2
|
const {
|
|
2
3
|
SpacePatterns: spacingTokens,
|
|
3
4
|
colors: colorTokens,
|
|
@@ -30,6 +31,7 @@ const {
|
|
|
30
31
|
parseColorTokensNames,
|
|
31
32
|
parseSpacingTokensNames,
|
|
32
33
|
parseBorderRadiusTokensNames,
|
|
34
|
+
parseCustomTokensNames,
|
|
33
35
|
} = require('./tailwind/utils');
|
|
34
36
|
|
|
35
37
|
|
|
@@ -38,12 +40,7 @@ module.exports = {
|
|
|
38
40
|
|
|
39
41
|
theme: {
|
|
40
42
|
tokens: {
|
|
41
|
-
|
|
42
|
-
'confirm-dialog-width': '320px',
|
|
43
|
-
'confirm-dialog-action-width': '128px',
|
|
44
|
-
'max-select-dropdown-height': '172px',
|
|
45
|
-
'desktop-toast-width': '512px',
|
|
46
|
-
'mobile-toast-width': '343px',
|
|
43
|
+
...parseCustomTokensNames(customTokens),
|
|
47
44
|
},
|
|
48
45
|
|
|
49
46
|
screens: {},
|
package/tokens-v3.css
CHANGED
|
@@ -331,4 +331,12 @@
|
|
|
331
331
|
--or-r-md: 4px;
|
|
332
332
|
--or-r-lg: 8px;
|
|
333
333
|
--or-r-xl: 16px;
|
|
334
|
+
}
|
|
335
|
+
:root {
|
|
336
|
+
--or-t-min-button-width: 96px;
|
|
337
|
+
--or-t-confirm-dialog-width: 320px;
|
|
338
|
+
--or-t-confirm-dialog-action-width: 128px;
|
|
339
|
+
--or-t-max-select-dropdown-height: 172px;
|
|
340
|
+
--or-t-desktop-toast-width: 512px;
|
|
341
|
+
--or-t-mobile-toast-width: 343px;
|
|
334
342
|
}
|
package/tokens.css
CHANGED
|
@@ -329,4 +329,12 @@
|
|
|
329
329
|
--or-r-md: 4px;
|
|
330
330
|
--or-r-lg: 8px;
|
|
331
331
|
--or-r-xl: 16px;
|
|
332
|
+
}
|
|
333
|
+
:root {
|
|
334
|
+
--or-t-min-button-width: 96px;
|
|
335
|
+
--or-t-confirm-dialog-width: 320px;
|
|
336
|
+
--or-t-confirm-dialog-action-width: 128px;
|
|
337
|
+
--or-t-max-select-dropdown-height: 172px;
|
|
338
|
+
--or-t-desktop-toast-width: 512px;
|
|
339
|
+
--or-t-mobile-toast-width: 343px;
|
|
332
340
|
}
|