@coopdigital/styles 0.16.6 → 0.18.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,184 @@
1
+ @use "sass:selector";
2
+ @use "sass:string";
3
+ @use "../breakpoints" as *;
4
+
5
+ $columns: 12;
6
+ $breakpoints: (
7
+ // "xxs" 320 2,
8
+ // "xs" 414 2,
9
+ "sm" $mq-small 6,
10
+ "md" $mq-medium 12,
11
+ "lg" $mq-large 12,
12
+ "xl" $mq-xlarge 12,
13
+ "xxl" $mq-xxlarge 12
14
+ );
15
+
16
+ /* prettier-ignore */
17
+ $gaps: (
18
+ 2,
19
+ 4 "sm",
20
+ 6,
21
+ 8 "md",
22
+ 12 "lg"
23
+ );
24
+
25
+ /**
26
+ * Generate .gap-* classes
27
+ * Currently does not generate .gap-x-* or .gap-y-*
28
+ */
29
+
30
+ @function get-safe-prefix($prefix: "") {
31
+ $safe-prefix: "";
32
+
33
+ @if string.length($prefix) > 0 {
34
+ $safe-prefix: $prefix + "\\:";
35
+ }
36
+
37
+ @return $safe-prefix;
38
+ }
39
+
40
+ /**
41
+ * Generate .gap-* classes
42
+ * Currently does not generate .gap-x-* or .gap-y-*
43
+ */
44
+
45
+ @mixin gap-classes($prefix: "") {
46
+ $safe-prefix: get-safe-prefix($prefix);
47
+
48
+ @each $size, $name in $gaps {
49
+ $px: ".#{$safe-prefix}gap-#{$size}";
50
+ $selector: ($px);
51
+
52
+ @if $name {
53
+ $selector: selector.extend($selector, $px, (".#{$safe-prefix}gap-#{$name}"));
54
+ }
55
+ #{$selector} {
56
+ gap: calc(var(--spacing-4) * $size);
57
+ }
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Generate .grid-* classes
63
+ * Generally of the format .grid-cols-*
64
+ */
65
+
66
+ @mixin grid-classes($prefix: "") {
67
+ $safe-prefix: get-safe-prefix($prefix);
68
+
69
+ @for $number from 1 through $columns {
70
+ .#{$safe-prefix}grid-cols-#{$number} {
71
+ grid-template-columns: repeat(#{$number}, minmax(0, 1fr));
72
+ }
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Generate .col-* classes
78
+ */
79
+
80
+ @mixin column-classes($prefix: "") {
81
+ $safe-prefix: get-safe-prefix($prefix);
82
+
83
+ @for $number from 1 through $columns {
84
+ .#{$safe-prefix}col-span-#{$number} {
85
+ grid-column: span #{$number} / span #{$number};
86
+ }
87
+ .#{$safe-prefix}col-start-#{$number} {
88
+ grid-column-start: #{$number};
89
+ }
90
+ .#{$safe-prefix}col-end-#{$number} {
91
+ grid-column-end: #{$number};
92
+ }
93
+ }
94
+ }
95
+
96
+ @include gap-classes;
97
+
98
+ @include grid-classes;
99
+
100
+ @include column-classes;
101
+
102
+ // Static .grid-cols-* classes
103
+
104
+ .grid-cols-none {
105
+ grid-template-columns: none;
106
+ }
107
+
108
+ .grid-cols-subgrid {
109
+ grid-template-columns: subgrid;
110
+ }
111
+
112
+ // Static .col-* classes
113
+
114
+ .col-span-full {
115
+ grid-column: 1 / -1;
116
+ }
117
+
118
+ .col-span-stretch {
119
+ grid-column-end: -1;
120
+ }
121
+
122
+ .col-start-auto {
123
+ grid-column-start: auto;
124
+ }
125
+
126
+ .col-end-auto {
127
+ grid-column-end: auto;
128
+ }
129
+
130
+ .col-auto {
131
+ grid-column: auto;
132
+ }
133
+
134
+ // Static .grid-flow-* classes
135
+
136
+ .grid-flow-col {
137
+ grid-auto-flow: column;
138
+ }
139
+
140
+ .grid-flow-dense {
141
+ grid-auto-flow: dense;
142
+ }
143
+
144
+ .grid-flow-col-dense {
145
+ grid-auto-flow: column dense;
146
+ }
147
+
148
+ // Static .auto-cols-* classes
149
+
150
+ .auto-cols-auto {
151
+ grid-auto-columns: auto;
152
+ }
153
+
154
+ .auto-cols-min {
155
+ grid-auto-columns: min-content;
156
+ }
157
+
158
+ .auto-cols-max {
159
+ grid-auto-columns: max-content;
160
+ }
161
+
162
+ .auto-cols-fr {
163
+ grid-auto-columns: minmax(0, 1fr);
164
+ }
165
+
166
+ @each $breakpoint, $size, $cols in $breakpoints {
167
+ @media (min-width: $size) {
168
+
169
+ @include gap-classes($breakpoint);
170
+
171
+ @include grid-classes($breakpoint);
172
+
173
+ @include column-classes($breakpoint);
174
+ }
175
+ }
176
+
177
+ // Static gap-* classes
178
+ .gap-auto {
179
+ gap: 1rem;
180
+
181
+ @media (min-width: $mq-medium) {
182
+ gap: 2rem;
183
+ }
184
+ }
@@ -0,0 +1,46 @@
1
+ $spacing: ("64", "56", "48", "32", "24", "20", "18", "16", "14", "12", "10", "8", "6", "4", "2");
2
+
3
+ @each $k in $spacing {
4
+ .m-#{$k} {
5
+ margin: var(--spacing-#{$k});
6
+ }
7
+ .mx-#{$k} {
8
+ margin-inline: var(--spacing-#{$k});
9
+ }
10
+ .my-#{$k} {
11
+ margin-block: var(--spacing-#{$k});
12
+ }
13
+ .mt-#{$k} {
14
+ margin-top: var(--spacing-#{$k});
15
+ }
16
+ .mb-#{$k} {
17
+ margin-bottom: var(--spacing-#{$k});
18
+ }
19
+ .ml-#{$k} {
20
+ margin-left: var(--spacing-#{$k});
21
+ }
22
+ .mr-#{$k} {
23
+ margin-right: var(--spacing-#{$k});
24
+ }
25
+ .p-#{$k} {
26
+ padding: var(--spacing-#{$k});
27
+ }
28
+ .px-#{$k} {
29
+ padding-inline: var(--spacing-#{$k});
30
+ }
31
+ .py-#{$k} {
32
+ padding-block: var(--spacing-#{$k});
33
+ }
34
+ .pt-#{$k} {
35
+ padding-top: var(--spacing-#{$k});
36
+ }
37
+ .pb-#{$k} {
38
+ padding-bottom: var(--spacing-#{$k});
39
+ }
40
+ .pl-#{$k} {
41
+ padding-left: var(--spacing-#{$k});
42
+ }
43
+ .pr-#{$k} {
44
+ padding-right: var(--spacing-#{$k});
45
+ }
46
+ }
@@ -1,63 +1,37 @@
1
1
  @use "sass:selector";
2
2
 
3
3
  $sizes: (
4
- 10: (),
5
- 11: (),
6
- 12: (
7
- "xs",
8
- ),
9
- 13: (),
10
- 14: (
11
- "sm",
12
- ),
13
- 16: (
14
- "base",
15
- ),
16
- 18: (
17
- "lg",
18
- ),
19
- 20: (
20
- "xl",
21
- ),
22
- 22: (),
23
- 24: (
24
- "2xl",
25
- ),
26
- 26: (),
27
- 28: (),
28
- 30: (
29
- "3xl",
30
- ),
31
- 32: (),
32
- 36: (
33
- "4xl",
34
- ),
35
- 40: (),
36
- 46: (),
37
- 48: (
38
- "5xl",
39
- ),
40
- 56: (),
41
- 60: (
42
- "6xl",
43
- ),
44
- 64: (),
45
- 72: (
46
- "7xl",
47
- ),
48
- 82: (
49
- "mega",
50
- ),
51
- 96: (
52
- "8xl",
53
- ),
4
+ 10,
5
+ 11,
6
+ 12 "xs",
7
+ 13,
8
+ 14 "sm",
9
+ 16 "base",
10
+ 18 "lg",
11
+ 20 "xl",
12
+ 22,
13
+ 24 "2xl",
14
+ 26,
15
+ 28,
16
+ 30 "3xl",
17
+ 32,
18
+ 36 "4xl",
19
+ 40,
20
+ 46,
21
+ 48 "5xl",
22
+ 56,
23
+ 60 "6xl",
24
+ 64,
25
+ 72 "7xl",
26
+ 82 "mega",
27
+ 96 "8xl"
54
28
  );
55
29
 
56
- @each $size, $names in $sizes {
30
+ @each $size, $name in $sizes {
57
31
  $px: ".text-#{$size}";
58
32
  $selector: ($px);
59
33
 
60
- @each $name in $names {
34
+ @if $name {
61
35
  $selector: selector.extend($selector, $px, (".text-#{$name}"));
62
36
  }
63
37
 
@@ -1,2 +1,5 @@
1
1
  @use "./utilities/color";
2
2
  @use "./utilities/text-size";
3
+ @use "./utilities/grid";
4
+ @use "./utilities/display";
5
+ @use "./utilities/spacing";
@@ -1,7 +1,9 @@
1
1
  :root {
2
2
  /* Spacing */
3
3
  --spacing-64: 4rem;
4
+ --spacing-60: 3.75rem;
4
5
  --spacing-58: 3.625rem;
6
+ --spacing-56: 3.5rem;
5
7
  --spacing-54: 3.375rem;
6
8
  --spacing-52: 3.25rem;
7
9
  --spacing-48: 3rem;
@@ -1,5 +1,5 @@
1
1
  :root {
2
- --font-family: "Avenir-Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
2
+ --font-family: "Avenir Next", "Avenir-Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
3
3
  --font-family-headline: "Co-opHeadline", "Impact", Helvetica, Arial, sans-serif;
4
4
 
5
5
  /* Weights */
@@ -1,5 +1,5 @@
1
1
  :root {
2
- --font-family: "Avenir-Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
2
+ --font-family: "Avenir Next", "Avenir-Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
3
3
  --font-family-headline: "Co-opHeadline", "Impact", Helvetica, Arial, sans-serif;
4
4
 
5
5
  /* Typography */