@onereach/styles 2.9.6 → 2.9.7-beta.686.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": "2.9.6",
3
+ "version": "2.9.7-beta.686.0",
4
4
  "description": "Styles for or-ui-next",
5
5
  "main": "./main.css",
6
6
  "unpkg": "./main.css",
@@ -31,6 +31,7 @@
31
31
  ],
32
32
  "license": "UNLICENSED",
33
33
  "devDependencies": {
34
+ "@tailwindcss/typography": "^0.5.4",
34
35
  "autoprefixer": "^10.2.5",
35
36
  "clean-css-cli": "^5.2.2",
36
37
  "json-to-scss": "^1.6.2",
@@ -41,6 +42,5 @@
41
42
  "postcss-preset-env": "^7.7.1",
42
43
  "sass": "^1.35.1",
43
44
  "tailwindcss": "^3.1.3"
44
- },
45
- "gitHead": "9e7c3a53eb4f45940e6c9a78a66548fb95cd2498"
45
+ }
46
46
  }
@@ -359,6 +359,62 @@
359
359
  {
360
360
  "name" : "dark-primary-opacity-0-16",
361
361
  "value" : "rgba(164,200,255,0.16)"
362
+ },
363
+ {
364
+ "name" : "light-primary-hover",
365
+ "value" : "rgba(0,119,220,1)"
366
+ },
367
+ {
368
+ "name" : "light-error-hover",
369
+ "value" : "rgba(221,55,48,1)"
370
+ },
371
+ {
372
+ "name" : "light-success-hover",
373
+ "value" : "rgba(56,166,0,1)"
374
+ },
375
+ {
376
+ "name" : "light-warning-hover",
377
+ "value" : "rgba(153,112,0,1)"
378
+ },
379
+ {
380
+ "name" : "light-error-opacity-0-08",
381
+ "value" : "rgba(186,27,27,0.08)"
382
+ },
383
+ {
384
+ "name" : "light-error-opacity-0-12",
385
+ "value" : "rgba(186,27,27,0.12)"
386
+ },
387
+ {
388
+ "name" : "light-error-opacity-0-16",
389
+ "value" : "rgba(186,27,27,0.16)"
390
+ },
391
+ {
392
+ "name" : "dark-primary-hover",
393
+ "value" : "rgba(111,174,255,1)"
394
+ },
395
+ {
396
+ "name" : "dark-error-hover",
397
+ "value" : "rgba(255,137,122,1)"
398
+ },
399
+ {
400
+ "name" : "dark-success-hover",
401
+ "value" : "rgba(81,195,20,1)"
402
+ },
403
+ {
404
+ "name" : "dark-warning-hover",
405
+ "value" : "rgba(219,162,0,1)"
406
+ },
407
+ {
408
+ "name" : "dark-error-opacity-0-08",
409
+ "value" : "rgba(255,180,169,0.08)"
410
+ },
411
+ {
412
+ "name" : "dark-error-opacity-0-12",
413
+ "value" : "rgba(255,180,169,0.12)"
414
+ },
415
+ {
416
+ "name" : "dark-error-opacity-0-16",
417
+ "value" : "rgba(255,180,169,0.16)"
362
418
  }
363
419
  ],
364
420
  "Gradients" : [
@@ -430,106 +486,150 @@
430
486
  {
431
487
  "name" : "inter",
432
488
  "fontFamily" : "Inter"
489
+ },
490
+ {
491
+ "name" : "inter-700",
492
+ "fontFamily" : "Inter"
493
+ },
494
+ {
495
+ "name" : "inter-500",
496
+ "fontFamily" : "Inter"
497
+ },
498
+ {
499
+ "name" : "inter-600",
500
+ "fontFamily" : "Inter"
433
501
  }
434
502
  ],
435
503
  "typeStyles" : [
436
- {
437
- "name" : "headline-1",
438
- "fontFamily" : "Inter",
439
- "fontSize" : "24px",
440
- "lineHeight" : "29px",
441
- "letterSpacing" : "0px"
442
- },
443
504
  {
444
505
  "name" : "headline-2",
445
506
  "fontFamily" : "Inter",
446
507
  "fontSize" : "20px",
447
508
  "lineHeight" : "24px",
448
- "letterSpacing" : "0px"
509
+ "letterSpacing" : "0px",
510
+ "fontWeight": "700",
511
+ "fontSizeRem" : "1.25",
512
+ "lineHeightRem" : "1.5"
449
513
  },
450
514
  {
451
515
  "name" : "headline-3",
452
516
  "fontFamily" : "Inter",
453
517
  "fontSize" : "16px",
454
518
  "lineHeight" : "24px",
455
- "letterSpacing" : "0px"
519
+ "letterSpacing" : "0px",
520
+ "fontWeight": "700",
521
+ "fontSizeRem" : "1",
522
+ "lineHeightRem" : "1.5"
456
523
  },
457
524
  {
458
525
  "name" : "headline-4",
459
526
  "fontFamily" : "Inter",
460
527
  "fontSize" : "14px",
461
528
  "lineHeight" : "21px",
462
- "letterSpacing" : "0px"
529
+ "letterSpacing" : "0px",
530
+ "fontWeight": "700",
531
+ "fontSizeRem" : "0.875",
532
+ "lineHeightRem" : "1.3125"
463
533
  },
464
534
  {
465
535
  "name" : "button",
466
536
  "fontFamily" : "Inter",
467
537
  "fontSize" : "14px",
468
538
  "lineHeight" : "20px",
469
- "letterSpacing" : "0px"
539
+ "letterSpacing" : "0px",
540
+ "fontWeight": "600",
541
+ "fontSizeRem" : "0.875",
542
+ "lineHeightRem" : "1.25"
470
543
  },
471
544
  {
472
545
  "name" : "body-1-regular",
473
546
  "fontFamily" : "Inter",
474
547
  "fontSize" : "16px",
475
548
  "lineHeight" : "24px",
476
- "letterSpacing" : "0px"
549
+ "letterSpacing" : "0px",
550
+ "fontWeight": "400",
551
+ "fontSizeRem" : "1",
552
+ "lineHeightRem" : "1.5"
477
553
  },
478
554
  {
479
555
  "name" : "body-1-semibold",
480
556
  "fontFamily" : "Inter",
481
557
  "fontSize" : "16px",
482
558
  "lineHeight" : "24px",
483
- "letterSpacing" : "0px"
559
+ "letterSpacing" : "0px",
560
+ "fontWeight": "600",
561
+ "fontSizeRem" : "1",
562
+ "lineHeightRem" : "1.5"
484
563
  },
485
564
  {
486
565
  "name" : "body-1-bold",
487
566
  "fontFamily" : "Inter",
488
567
  "fontSize" : "16px",
489
568
  "lineHeight" : "24px",
490
- "letterSpacing" : "0px"
569
+ "letterSpacing" : "0px",
570
+ "fontWeight": "700",
571
+ "fontSizeRem" : "1",
572
+ "lineHeightRem" : "1.5"
491
573
  },
492
574
  {
493
575
  "name" : "body-2-regular",
494
576
  "fontFamily" : "Inter",
495
577
  "fontSize" : "14px",
496
578
  "lineHeight" : "21px",
497
- "letterSpacing" : "0px"
579
+ "letterSpacing" : "0px",
580
+ "fontWeight": "400",
581
+ "fontSizeRem" : "0.875",
582
+ "lineHeightRem" : "1.3125"
498
583
  },
499
584
  {
500
585
  "name" : "body-2-semibold",
501
586
  "fontFamily" : "Inter",
502
587
  "fontSize" : "14px",
503
588
  "lineHeight" : "21px",
504
- "letterSpacing" : "0px"
589
+ "letterSpacing" : "0px",
590
+ "fontWeight": "600",
591
+ "fontSizeRem" : "0.875",
592
+ "lineHeightRem" : "1.3125"
505
593
  },
506
594
  {
507
595
  "name" : "body-2-bold",
508
596
  "fontFamily" : "Inter",
509
597
  "fontSize" : "14px",
510
598
  "lineHeight" : "21px",
511
- "letterSpacing" : "0px"
599
+ "letterSpacing" : "0px",
600
+ "fontWeight": "700",
601
+ "fontSizeRem" : "0.875",
602
+ "lineHeightRem" : "1.3125"
512
603
  },
513
604
  {
514
605
  "name" : "caption-regular",
515
606
  "fontFamily" : "Inter",
516
607
  "fontSize" : "12px",
517
608
  "lineHeight" : "18px",
518
- "letterSpacing" : "0px"
609
+ "letterSpacing" : "0px",
610
+ "fontWeight": "400",
611
+ "fontSizeRem" : "0.75",
612
+ "lineHeightRem" : "1.125"
519
613
  },
520
614
  {
521
615
  "name" : "caption-semibold",
522
616
  "fontFamily" : "Inter",
523
617
  "fontSize" : "12px",
524
618
  "lineHeight" : "18px",
525
- "letterSpacing" : "0px"
619
+ "letterSpacing" : "0px",
620
+ "fontWeight": "600",
621
+ "fontSizeRem" : "0.75",
622
+ "lineHeightRem" : "1.125"
526
623
  },
527
624
  {
528
625
  "name" : "caption-bold",
529
626
  "fontFamily" : "Inter",
530
627
  "fontSize" : "12px",
531
628
  "lineHeight" : "18px",
532
- "letterSpacing" : "0px"
629
+ "letterSpacing" : "0px",
630
+ "fontWeight": "700",
631
+ "fontSizeRem" : "0.75",
632
+ "lineHeightRem" : "1.125"
533
633
  }
534
634
  ],
535
635
  "SpacePatterns" : [
package/tailwind-utils.js CHANGED
@@ -1,4 +1,17 @@
1
1
  module.exports = {
2
+ parseSpacingTokens(designTokens) {
3
+ return Object.values(designTokens)
4
+ .map(({ value }) => value)
5
+ .map((value) => ({
6
+ name: value.slice(0, -2),
7
+ value,
8
+ }))
9
+ .reduce((preset, { name, value }) => ({
10
+ ...preset,
11
+ [name]: value,
12
+ }), {});
13
+ },
14
+
2
15
  parseColorTokens(designTokens, colorGroups) {
3
16
  const isBackground = (name) => /\b(?:container|background|surface)\b/.test(name) && !isText(name);
4
17
  const isText = (name) => /\b(?:on)\b/.test(name);
@@ -40,35 +53,18 @@ module.exports = {
40
53
  }), {});
41
54
  },
42
55
 
43
- parseSpacingTokens(designTokens) {
56
+ parseTypographyTokens(designTokens) {
44
57
  return Object.values(designTokens)
45
- .map(({ value }) => value)
46
- .map((value) => ({
47
- name: value.slice(0, -2),
48
- value,
49
- }))
50
- .reduce((preset, { name, value }) => ({
51
- ...preset,
52
- [name]: value,
53
- }), {});
54
- },
55
-
56
- parseBoxShadowTokens(designTokens) {
57
- return Object.values(designTokens)
58
- .map(({ name, value }) => ({
59
- ...name.match(/^(?:(?<theme>light|dark)-)?(?<name>.+)$/).groups,
60
- value,
61
- }))
62
- .map(({ name, theme, value }) => ({
58
+ .map(({ name, fontFamily, fontWeight, fontSizeRem, lineHeightRem }) => ({
63
59
  name,
64
- theme,
65
- value: value
66
- .replace(/\b0px\b/g, '0')
67
- .replace(/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/g, 'rgba($1 $2 $3 / $4)'),
60
+ fontFamily,
61
+ fontWeight,
62
+ fontSize: `${fontSizeRem}rem`,
63
+ lineHeight: `${lineHeightRem}rem`,
68
64
  }))
69
- .reduce((preset, { name, theme, value }) => ({
65
+ .reduce((preset, { name, ...css }) => ({
70
66
  ...preset,
71
- [!theme || theme === 'light' ? name : `${name}-${theme}`]: value,
67
+ [name]: { css },
72
68
  }), {});
73
69
  },
74
70
 
@@ -97,4 +93,23 @@ module.exports = {
97
93
  [name]: value,
98
94
  }), {});
99
95
  },
96
+
97
+ parseBoxShadowTokens(designTokens) {
98
+ return Object.values(designTokens)
99
+ .map(({ name, value }) => ({
100
+ ...name.match(/^(?:(?<theme>light|dark)-)?(?<name>.+)$/).groups,
101
+ value,
102
+ }))
103
+ .map(({ name, theme, value }) => ({
104
+ name,
105
+ theme,
106
+ value: value
107
+ .replace(/\b0px\b/g, '0')
108
+ .replace(/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/g, 'rgba($1 $2 $3 / $4)'),
109
+ }))
110
+ .reduce((preset, { name, theme, value }) => ({
111
+ ...preset,
112
+ [!theme || theme === 'light' ? name : `${name}-${theme}`]: value,
113
+ }), {});
114
+ },
100
115
  };
@@ -1,60 +1,49 @@
1
- const defaultTheme = require('tailwindcss/defaultTheme');
2
1
  const plugin = require('tailwindcss/plugin');
3
2
 
4
3
  const {
5
- parseColorTokens,
6
4
  parseSpacingTokens,
7
- parseBoxShadowTokens,
5
+ parseColorTokens,
6
+ parseTypographyTokens,
8
7
  parseBorderRadiusTokens,
9
8
  parseBorderWidthTokens,
9
+ parseBoxShadowTokens,
10
10
  } = require('./tailwind-utils');
11
11
 
12
12
  const {
13
- colors: colorTokens,
14
13
  SpacePatterns: spacingTokens,
15
- Shadows: boxShadowTokens,
14
+ colors: colorTokens,
15
+ typeStyles: typographyTokens,
16
16
  BorderRadiuses: borderRadiusTokens,
17
17
  Borders: borderWidthTokens,
18
+ Shadows: boxShadowTokens,
18
19
  } = require('./src/variables/tokens/design-tokens-next.json');
19
20
 
20
21
  module.exports = {
21
22
  darkMode: 'class',
22
23
 
23
24
  theme: {
25
+ spacing: parseSpacingTokens(spacingTokens),
26
+
24
27
  backgroundColor: parseColorTokens(colorTokens, ['generic', 'background']),
25
28
  textColor: parseColorTokens(colorTokens, ['generic', 'text']),
26
29
  borderColor: parseColorTokens(colorTokens, ['generic']),
27
- spacing: parseSpacingTokens(spacingTokens),
28
- boxShadow: parseBoxShadowTokens(boxShadowTokens),
30
+
31
+ typography: parseTypographyTokens(typographyTokens),
32
+
29
33
  borderRadius: parseBorderRadiusTokens(borderRadiusTokens),
30
34
  borderWidth: parseBorderWidthTokens(borderWidthTokens),
31
-
35
+ boxShadow: parseBoxShadowTokens(boxShadowTokens),
36
+ fontFamily: false,
37
+ fontSize: false,
38
+ fontWeight: false,
32
39
  letterSpacing: false,
33
40
  lineHeight: false,
34
41
  opacity: false,
35
-
36
- extend: {
37
- fontFamily: {
38
- 'sans': ['Inter', ...defaultTheme.fontFamily.sans],
39
- 'inter': ['Inter', ...defaultTheme.fontFamily.sans],
40
- },
41
-
42
- fontSize: {
43
- 'xs': ['.75rem', '1.125rem'],
44
- 'sm': ['.875rem', '1.3125rem'],
45
- },
46
-
47
- zIndex: { // TODO: css vars
48
- selectDropdown: 10, // TODO: move to the project level
49
- overlayZIndex: 25, // ?
50
- modal: 50,
51
- headerPopup: 45, // modal - 5 // TODO: move to the project level
52
- headerLoader: 40, // headerPopup - 5 // TODO: project level
53
- },
54
- },
55
42
  },
56
43
 
57
44
  plugins: [
45
+ require('@tailwindcss/typography'),
46
+
58
47
  plugin(({ addBase, addVariant, addUtilities, theme }) => {
59
48
  addBase({
60
49
  '@font-face': [
@@ -65,6 +54,7 @@ module.exports = {
65
54
  'font-display': 'swap',
66
55
  'src': 'url("https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19") format("woff2")',
67
56
  },
57
+
68
58
  {
69
59
  'font-family': '"Inter"',
70
60
  'font-style': 'normal',
@@ -72,6 +62,7 @@ module.exports = {
72
62
  'font-display': 'swap',
73
63
  'src': 'url("https://rsms.me/inter/font-files/Inter-Medium.woff2?v=3.19") format("woff2")',
74
64
  },
65
+
75
66
  {
76
67
  'font-family': '"Inter"',
77
68
  'font-style': 'normal',
@@ -79,6 +70,7 @@ module.exports = {
79
70
  'font-display': 'swap',
80
71
  'src': 'url("https://rsms.me/inter/font-files/Inter-SemiBold.woff2?v=3.19") format("woff2")',
81
72
  },
73
+
82
74
  {
83
75
  'font-family': '"Inter"',
84
76
  'font-style': 'normal',
@@ -88,31 +80,8 @@ module.exports = {
88
80
  },
89
81
  ],
90
82
 
91
- 'body': {
92
- fontSize: '0.875rem',
93
- lineHeight: '1.3125rem',
94
- color: 'rgb(var(--tw-c-on-background))',
95
- },
96
-
97
- // default - https://html.spec.whatwg.org/multipage/rendering.html#sections-and-headings
98
- 'h1': { // TODO: add
99
- fontSize: theme('fontSize.2xl'),
100
- fontWeight: theme('fontWeight.bold'),
101
- lineHeight: '1.8125rem',
102
- },
103
- 'h2': {
104
- fontSize: theme('fontSize.2xl'),
105
- fontWeight: theme('fontWeight.bold'),
106
- lineHeight: '1.8125rem',
107
- },
108
- 'h3': {
109
- fontSize: theme('fontSize.xl'),
110
- fontWeight: theme('fontWeight.bold'),
111
- lineHeight: '1.5rem',
112
- },
113
- 'h4': {
114
- fontSize: theme('fontSize.base'),
115
- fontWeight: theme('fontWeight.bold'),
83
+ ':root': {
84
+ ...theme('typography.body-1-regular.css'),
116
85
  },
117
86
  });
118
87