@terrahq/design-system 0.8.0 → 0.11.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.
Files changed (32) hide show
  1. package/README.md +7 -4
  2. package/bin/terra-ds.mjs +0 -4
  3. package/dist/icons.css +1 -0
  4. package/dist/style.css +1 -1
  5. package/package.json +1 -1
  6. package/src/scss/framework/_var/_vars.scss +14 -15
  7. package/src/scss/framework/components/btn.scss +1 -0
  8. package/src/scss/framework/foundation/font/_make-font.scss +12 -12
  9. package/src/scss/framework/foundation/gap/_make-gap.scss +10 -10
  10. package/src/scss/framework/foundation/grid/_columns.scss +51 -10
  11. package/src/scss/framework/foundation/grid/_container.scss +0 -7
  12. package/src/scss/framework/foundation/grid/_make-container.scss +3 -3
  13. package/src/scss/framework/foundation/section/_make-section.scss +18 -18
  14. package/src/scss/framework/foundation/spaces/_make-spaces.scss +10 -10
  15. package/src/scss/framework/utilities/_align-items.scss +5 -5
  16. package/src/scss/framework/utilities/_aspect-ratio.scss +5 -5
  17. package/src/scss/framework/utilities/_display.scss +6 -5
  18. package/src/scss/framework/utilities/_flex-direction.scss +5 -5
  19. package/src/scss/framework/utilities/_font-style.scss +5 -5
  20. package/src/scss/framework/utilities/_font-weight.scss +5 -5
  21. package/src/scss/framework/utilities/_height.scss +5 -5
  22. package/src/scss/framework/utilities/_justify-content.scss +5 -5
  23. package/src/scss/framework/utilities/_order.scss +5 -5
  24. package/src/scss/framework/utilities/_overflow.scss +6 -5
  25. package/src/scss/framework/utilities/_position.scss +5 -5
  26. package/src/scss/framework/utilities/_spacing.scss +26 -26
  27. package/src/scss/framework/utilities/_states.scss +48 -45
  28. package/src/scss/framework/utilities/_text-align.scss +7 -7
  29. package/src/scss/framework/utilities/_text-transform.scss +47 -0
  30. package/src/scss/framework/utilities/_utilities.scss +1 -0
  31. package/src/scss/framework/utilities/_width.scss +5 -5
  32. package/terra.config.example.js +1 -2
@@ -2,76 +2,79 @@
2
2
  @use "sass:math";
3
3
  @use "@scss/framework/_var/_vars.scss" as *;
4
4
 
5
- // States live in the class name, with no colons: u--hover-background-d, u--focus-ring, u--active-scale-95...
6
- // Hover only applies on devices that can hover. States have no breakpoint variants.
5
+ // States use the same grammar as Punky's breakpoints: u--{property}-[breakpoint]-[state]-{value}. The breakpoint
6
+ // (u--padding-tablets-4) and the state (u--background-hover-c) sit between the property and the value, the breakpoint first:
7
+ // u--background-tablets-hover-c is the hover background from 580px up.
8
+ // Hover only applies on devices that can hover.
9
+
10
+ // The properties that get a hover, one list so every breakpoint and the group version use the same code.
11
+ @mixin hover-rules($bp-name, $bp-value, $group: false) {
12
+ $infix: if($bp-name == all, "", "#{$bp-name}-");
13
+ $sel: if($group, "group-hover", "hover");
7
14
 
8
- @media (hover: hover) {
9
- // u--hover-color-{letter}, u--hover-border-{letter} (border color only: pair with u--border-*)
10
15
  @each $name, $color in $color-options {
11
- .u--hover-color-#{$name}:hover {
12
- color: $color;
13
- }
14
- .u--hover-border-#{$name}:hover {
15
- border-color: $color;
16
- }
16
+ @include on-hover($bp-value, $group, ".u--color-#{$infix}#{$sel}-#{$name}") { color: $color; }
17
+ @include on-hover($bp-value, $group, ".u--border-#{$infix}#{$sel}-#{$name}") { border-color: $color; }
17
18
  }
18
-
19
- // u--hover-background-{letter}: the letters that also have f--background-*
20
19
  @each $name in $colorbg-keys {
21
20
  @if map.has-key($color-options, $name) {
22
- .u--hover-background-#{$name}:hover {
23
- background-color: map.get($color-options, $name);
24
- }
25
- }
26
- }
27
-
28
- // u--hover-tint-{letter}: a faint wash of the color (10%) on hover, for quiet buttons: pair it with the same f--color-{letter}
29
- @each $name, $color in $color-options {
30
- .u--hover-tint-#{$name}:hover {
31
- background-color: rgba($color, $tint-alpha);
32
- }
33
- }
34
-
35
- // u--group on a parent, u--group-hover-* on its children
36
- @each $name, $color in $color-options {
37
- .u--group:hover .u--group-hover-color-#{$name} {
38
- color: $color;
39
- }
40
- .u--group:hover .u--group-hover-border-#{$name} {
41
- border-color: $color;
21
+ @include on-hover($bp-value, $group, ".u--background-#{$infix}#{$sel}-#{$name}") { background-color: map.get($color-options, $name); }
42
22
  }
43
23
  }
44
- @each $name in $colorbg-keys {
45
- @if map.has-key($color-options, $name) {
46
- .u--group:hover .u--group-hover-background-#{$name} {
47
- background-color: map.get($color-options, $name);
24
+ }
25
+ @mixin on-hover($bp-value, $group, $selector) {
26
+ @media (hover: hover) {
27
+ @if $bp-value == 0 {
28
+ @if $group {
29
+ .u--group:hover #{$selector} { @content; }
30
+ } @else {
31
+ #{$selector}:hover { @content; }
32
+ }
33
+ } @else {
34
+ @media screen and ($viewport-type: $bp-value) {
35
+ @if $group {
36
+ .u--group:hover #{$selector} { @content; }
37
+ } @else {
38
+ #{$selector}:hover { @content; }
39
+ }
48
40
  }
49
41
  }
50
42
  }
51
43
  }
52
44
 
45
+ // u--color-hover-{letter}, u--border-hover-{letter} (border color only: pair with u--border-*), u--background-hover-{letter}
46
+ // (the letters that also have f--background-*), and the same with a breakpoint: u--color-tablets-hover-a.
47
+ @each $bp-name, $bp-value in $breakpoints-grid {
48
+ @include hover-rules($bp-name, $bp-value);
49
+ }
50
+
51
+ // u--group on a parent, u--color-group-hover-{letter} (and border, background) on its children
52
+ @include hover-rules(all, 0, true);
53
+
53
54
  // u--group is a marker: it sets only a custom property so the class exists in the CSS.
54
55
  .u--group {
55
56
  --u-group: 1;
56
57
  }
57
58
 
58
- // u--focus-ring: a 2px ring in color a, only for keyboard focus
59
- .u--focus-ring:focus-visible {
60
- outline: 2px solid map.get($color-options, a);
61
- outline-offset: 2px;
59
+ // u--outline-focus-{letter}: a 2px outline in that color, only for keyboard focus
60
+ @each $name, $color in $color-options {
61
+ .u--outline-focus-#{$name}:focus-visible {
62
+ outline: 2px solid $color;
63
+ outline-offset: 2px;
64
+ }
62
65
  }
63
66
 
64
- // u--active-scale-{90|95|98}: pressed
67
+ // u--transform-active-scale-{90|95|98}: pressed
65
68
  @each $step in (90, 95, 98) {
66
- .u--active-scale-#{$step}:active {
69
+ .u--transform-active-scale-#{$step}:active {
67
70
  transform: scale(math.div($step, 100));
68
71
  }
69
72
  }
70
73
 
71
- // u--disabled-opacity-{25|50|75}: on :disabled and [aria-disabled="true"]
74
+ // u--opacity-disabled-{25|50|75}: on :disabled and [aria-disabled="true"]
72
75
  @each $step in (25, 50, 75) {
73
- .u--disabled-opacity-#{$step}:disabled,
74
- .u--disabled-opacity-#{$step}[aria-disabled="true"] {
76
+ .u--opacity-disabled-#{$step}:disabled,
77
+ .u--opacity-disabled-#{$step}[aria-disabled="true"] {
75
78
  opacity: math.div($step, 100);
76
79
  }
77
80
  }
@@ -9,26 +9,26 @@ $text-align-values: (
9
9
 
10
10
  $text-align-breakpoints: (
11
11
  all: $all,
12
- desktop: $desktop,
13
- laptop: $laptop,
14
- tabletl: $tabletl,
15
- tabletm: $tabletm,
16
12
  tablets: $tablets,
17
- mobile: $mobile,
13
+ tabletm: $tabletm,
14
+ tabletl: $tabletl,
15
+ laptop: $laptop,
16
+ desktop: $desktop,
17
+ wide: $wide,
18
18
  );
19
19
 
20
20
  @mixin text-align-utility($text-prop, $breakpoints) {
21
21
  @each $breakpoint-name, $breakpoint-value in $breakpoints {
22
22
  @if ($breakpoint-value == 0) {
23
23
  @each $name, $property in $text-prop {
24
- .u--text-align-#{$name} {
24
+ .u--text-#{$name} {
25
25
  text-align: $property;
26
26
  }
27
27
  }
28
28
  } @else {
29
29
  @media screen and ($viewport-type: $breakpoint-value) {
30
30
  @each $name, $property in $text-prop {
31
- .u--text-align-#{$breakpoint-name}-#{$name} {
31
+ .u--text-#{$breakpoint-name}-#{$name} {
32
32
  text-align: $property;
33
33
  }
34
34
  }
@@ -0,0 +1,47 @@
1
+ @use "@scss/framework/_var/_vars.scss" as *;
2
+ @use "sass:meta";
3
+
4
+ $text-transform-values: (
5
+ // capitalize: capitalize,
6
+ uppercase: uppercase,
7
+ // lowercase:lowercase,
8
+ // none:none,
9
+ );
10
+
11
+ $text-transform-breakpoints: (
12
+ all: $all,
13
+ // tablets: $tablets,
14
+ // tabletm: $tabletm,
15
+ //tabletl: $tabletl,
16
+ // laptop: $laptop,
17
+ // desktop: $desktop,
18
+ // wide: $wide,
19
+ );
20
+
21
+ @mixin text-transform-utility($text-prop, $breakpoints) {
22
+ @each $breakpoint-name, $breakpoint-value in $breakpoints {
23
+ @if ($breakpoint-value == 0) {
24
+ @each $name, $property in $text-prop {
25
+ .u--text-#{$name} {
26
+ text-transform: $property;
27
+ }
28
+ }
29
+ } @else {
30
+ @media screen and ($viewport-type: $breakpoint-value) {
31
+ @each $name, $property in $text-prop {
32
+ .u--text-#{$breakpoint-name}-#{$name} {
33
+ text-transform: $property;
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+ @if meta.variable-exists(text-transform-breakpoints) {
41
+ @include text-transform-utility(
42
+ $text-transform-values,
43
+ $text-transform-breakpoints
44
+ );
45
+ } @else {
46
+ @include text-transform-utility($text-transform-values, $breakpoints-grid);
47
+ }
@@ -26,3 +26,4 @@
26
26
  @forward './min-width.scss';
27
27
  @forward './cursor.scss';
28
28
  @forward './size.scss';
29
+ @forward './text-transform.scss';
@@ -11,12 +11,12 @@ $width-values: (
11
11
 
12
12
  $width-breakpoints: (
13
13
  all: $all,
14
- desktop: $desktop,
15
- laptop: $laptop,
16
- tabletl: $tabletl,
17
- tabletm: $tabletm,
18
14
  tablets: $tablets,
19
- mobile: $mobile,
15
+ tabletm: $tabletm,
16
+ tabletl: $tabletl,
17
+ laptop: $laptop,
18
+ desktop: $desktop,
19
+ wide: $wide,
20
20
  );
21
21
 
22
22
  @mixin width-utility($width-prop, $breakpoints) {
@@ -11,13 +11,12 @@ export default {
11
11
  shadows: { a: '0 1px 2px rgb(15 15 15 / .06), 0 4px 16px rgb(15 15 15 / .08)' }, // f--shadow-* (default a, b, c)
12
12
 
13
13
  // Scales of the utilities (each step is a class)
14
- spacing: [0, 1, 2, 4, 8], // u--p-*, u--m-*, u--gap-* (x 8px; default 0 to 10, 12 and 15)
14
+ spacing: [0, 1, 2, 4, 8], // u--padding-*, u--margin-*, u--gap-* (x 8px; default 0 to 10, 12 and 15)
15
15
  sizes: [2, 4, 5, 6, 8], // u--height-*, u--width-* (x 8px; default 2, 3, 4, 5, 6, 8, 10, 12)
16
16
  minWidth: [10, 20, 30, 40], // u--min-width-* (x 8px; this is the default)
17
17
  opacity: { 100: 1, 85: 0.85, 70: 0.7, 50: 0.5 }, // u--opacity-* (this is the default)
18
18
  zIndex: [0, 10, 20, 40], // u--z-index-* (this is the default)
19
19
  offsets: { 0: '0', 100: '100%' }, // u--top-*, u--right-*, u--bottom-*, u--left-* (this is the default)
20
- tint: 0.1, // strength of u--hover-tint-* (this is the default)
21
20
 
22
21
  // Motion
23
22
  time: { a: '0.1s', b: '0.3s', c: '0.6s' }, // micro-interactions, expansion, background dimming (this is the default)