@apolitical/component-library 0.0.4-beta.6 → 0.0.5

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 (39) hide show
  1. package/fonts/Moderat-Black-Italic.woff2 +0 -0
  2. package/fonts/Moderat-Black.woff2 +0 -0
  3. package/fonts/Moderat-Bold-Italic.woff2 +0 -0
  4. package/fonts/Moderat-Bold.woff2 +0 -0
  5. package/fonts/Moderat-Medium-Italic.woff2 +0 -0
  6. package/fonts/Moderat-Medium.woff2 +0 -0
  7. package/index.d.ts +1 -0
  8. package/index.js +1 -1
  9. package/index.mjs +32 -6
  10. package/layout/index.d.ts +1 -0
  11. package/layout/layout.d.ts +6 -0
  12. package/package.json +1 -1
  13. package/style.css +1 -1
  14. package/styles/README.md +2 -20
  15. package/styles/base/_accessibility.scss +26 -0
  16. package/styles/base/_blockquotes.scss +29 -0
  17. package/styles/base/_fonts.scss +41 -0
  18. package/styles/base/_hr.scss +15 -0
  19. package/styles/{base-styles → base}/_index.scss +3 -1
  20. package/styles/base/_links.scss +16 -0
  21. package/styles/base/_lists.scss +27 -0
  22. package/styles/base/_text.scss +80 -0
  23. package/styles/base/_titles.scss +130 -0
  24. package/styles/base/buttons/_buttons.scss +234 -0
  25. package/styles/index.scss +4 -2
  26. package/styles/mixins/_index.scss +0 -1
  27. package/styles/variables/assets/_assets.scss +1 -3
  28. package/styles/base-styles/_accessibility.scss +0 -31
  29. package/styles/base-styles/_blockquotes.scss +0 -31
  30. package/styles/base-styles/_hr.scss +0 -17
  31. package/styles/base-styles/_links.scss +0 -18
  32. package/styles/base-styles/_lists.scss +0 -30
  33. package/styles/base-styles/_text.scss +0 -83
  34. package/styles/base-styles/_titles.scss +0 -132
  35. package/styles/base-styles/buttons/_buttons.scss +0 -236
  36. package/styles/mixins/_selectors.scss +0 -8
  37. /package/styles/{base-styles → base}/buttons/_icons.scss +0 -0
  38. /package/styles/{base-styles → base}/buttons/_index.scss +0 -0
  39. /package/styles/{base-styles → base}/buttons/_mixins.scss +0 -0
@@ -1,132 +0,0 @@
1
- @use 'sass:map';
2
- @import './../functions',
3
- './../mixins',
4
- './../variables';
5
-
6
- $pre-title: ('font-size': 14, 'font-size_md': 16, 'letter-spacing': 1.28, 'line-height': 16, 'line-height_md': 20, 'margin-bottom': 24);
7
- $title: ('font-size': 32, 'font-size_md': 52, 'letter-spacing': -0.16, 'line-height': 40, 'line-height_md': 64, 'margin-bottom': 16, 'margin-bottom_md': 32);
8
- $h1: ('font-size': 28, 'font-size_md': 40, 'line-height': 32, 'line-height_md': 48, 'letter-spacing': -0.16, 'margin-bottom': 16);
9
- $h2: ('font-size': 24, 'font-size_md': 28, 'line-height': 32, 'line-height_md': 40, 'margin-top': 40, 'margin-bottom': 16);
10
- $h3: ('font-size': 20, 'font-size_md': 24, 'line-height': 28, 'line-height_md': 32, 'margin-top': 60, 'margin-bottom': 20);
11
- $h4: ('font-size': 18, 'font-size_md': 20, 'line-height': 24, 'line-height_md': 28, 'margin-top': 40, 'margin-bottom': 20);
12
- $h5: ('font-size': 12, 'font-size_md': 14, 'line-height': 16, 'margin-top': 16, 'margin-bottom': 16);
13
- $h6: ('font-size': 12, 'font-size_md': 11, 'line-height': 16);
14
- $subtitle: ('font-size': 20, 'font-size_md': 24, 'line-height': 28, 'line-height_md': 32, 'margin-bottom': 20);
15
-
16
- @layer base {
17
- #root {
18
- .pre-title, h5, h6 {
19
- color: map.get($theme, 'title');
20
- text-transform: uppercase;
21
- font-weight: 700;
22
- }
23
-
24
- .title, h1, h2, h3, h4 {
25
- color: map.get($theme, 'title');
26
- font-weight: 900;
27
- }
28
-
29
- .pre-title {
30
- margin-bottom: px-to-rem(map.get($pre-title, 'margin-bottom'));
31
- font-size: px-to-rem(map.get($pre-title, 'font-size'));
32
- line-height: px-to-rem(map.get($pre-title, 'line-height'));
33
- letter-spacing: px-to-rem(map.get($pre-title, 'letter-spacing'));
34
- text-transform: uppercase;
35
-
36
- @include breakpoint('min-width', 'md') {
37
- font-size: px-to-rem(map.get($pre-title, 'font-size_md'));
38
- line-height: px-to-rem(map.get($title, 'line-height_md'));
39
- }
40
- }
41
-
42
- .title {
43
- margin-bottom: px-to-rem(map.get($title, 'margin-bottom'));
44
- font-size: px-to-rem(map.get($title, 'font-size'));
45
- line-height: px-to-rem(map.get($title, 'line-height'));
46
- letter-spacing: px-to-rem(map.get($title, 'letter-spacing'));
47
-
48
- @include breakpoint('min-width', 'md') {
49
- font-size: px-to-rem(map.get($title, 'font-size_md'));
50
- line-height: px-to-rem(map.get($title, 'line-height_md'));
51
- }
52
- }
53
-
54
- h1 {
55
- margin-bottom: px-to-rem(map.get($h1, 'margin-bottom'));
56
- font-size: px-to-rem(map.get($h1, 'font-size'));
57
- line-height: px-to-rem(map.get($h1, 'line-height'));
58
- letter-spacing: px-to-rem(map.get($h1, 'letter-spacing'));
59
-
60
- @include breakpoint('min-width', 'md') {
61
- font-size: px-to-rem(map.get($h1, 'font-size_md'));
62
- line-height: px-to-rem(map.get($h1, 'line-height_md'));
63
- }
64
- }
65
-
66
- h2 {
67
- margin: px-to-rem(map.get($h2, 'margin-top')) 0 px-to-rem(map.get($h2, 'margin-bottom')) 0;
68
- font-size: px-to-rem(map.get($h2, 'font-size'));
69
- line-height: px-to-rem(map.get($h2, 'line-height'));
70
-
71
- @include breakpoint('min-width', 'md') {
72
- font-size: px-to-rem(map.get($h2, 'font-size_md'));
73
- line-height: px-to-rem(map.get($h2, 'line-height_md'));
74
- }
75
- }
76
-
77
- h3 {
78
- margin: px-to-rem(map.get($h3, 'margin-top')) 0 px-to-rem(map.get($h3, 'margin-bottom')) 0;
79
- font-size: px-to-rem(map.get($h3, 'font-size'));
80
- line-height: px-to-rem(map.get($h3, 'line-height'));
81
-
82
- @include breakpoint('min-width', 'md') {
83
- font-size: px-to-rem(map.get($h3, 'font-size_md'));
84
- line-height: px-to-rem(map.get($h3, 'line-height_md'));
85
- }
86
- }
87
-
88
- h4 {
89
- margin: px-to-rem(map.get($h4, 'margin-top')) 0 px-to-rem(map.get($h4, 'margin-bottom')) 0;
90
- font-size: px-to-rem(map.get($h4, 'font-size'));
91
- line-height: px-to-rem(map.get($h4, 'line-height'));
92
-
93
- @include breakpoint('min-width', 'md') {
94
- font-size: px-to-rem(map.get($h4, 'font-size_md'));
95
- line-height: px-to-rem(map.get($h4, 'line-height_md'));
96
- }
97
- }
98
-
99
-
100
- h5 {
101
- margin: px-to-rem(map.get($h5, 'margin-top')) 0 px-to-rem(map.get($h5, 'margin-bottom')) 0;
102
- font-size: px-to-rem(map.get($h5, 'font-size'));
103
- line-height: px-to-rem(map.get($h5, 'line-height'));
104
-
105
- @include breakpoint('min-width', 'md') {
106
- font-size: px-to-rem(map.get($h5, 'font-size_md'));
107
- }
108
- }
109
-
110
- h6 {
111
- font-size: px-to-rem(map.get($h6, 'font-size'));
112
- line-height: px-to-rem(map.get($h6, 'line-height'));
113
-
114
- @include breakpoint('min-width', 'md') {
115
- font-size: px-to-rem(map.get($h6, 'font-size_md'));
116
- }
117
- }
118
-
119
- .subtitle {
120
- margin-bottom: px-to-rem(map.get($subtitle, 'margin-bottom'));
121
- font-size: px-to-rem(map.get($subtitle, 'font-size'));
122
- color: map.get($theme, 'subtitle');
123
- font-weight: 400;
124
- line-height: px-to-rem(map.get($subtitle, 'line-height'));
125
-
126
- @include breakpoint('min-width', 'md') {
127
- font-size: px-to-rem(map.get($subtitle, 'font-size_md'));
128
- line-height: px-to-rem(map.get($subtitle, 'line-height_md'));
129
- }
130
- }
131
- }
132
- }
@@ -1,236 +0,0 @@
1
- @use 'sass:map';
2
- @use 'sass:meta';
3
- @import './../../functions',
4
- './../../mixins',
5
- './../../variables';
6
- @import './icons', './mixins';
7
-
8
- // The button defaults to the primary variant and medium styling so are not added as classes - they live on the default `button` styling
9
- $large: ('font-size': 18, 'padding-top': 14, 'padding-horizontal': 24, 'padding-bottom': 16, 'icon-width': 18, 'icon-offset': 2, 'icon-gutter': 12);
10
- $medium: ('font-size': 16, 'padding-top': 10, 'padding-horizontal': 24, 'padding-bottom': 12, 'icon-width': 16, 'icon-offset': 2, 'icon-gutter': 10);
11
- $small: ('font-size': 14, 'padding-top': 8, 'padding-horizontal': 16, 'padding-bottom': 10, 'icon-width': 12, 'icon-offset': 2, 'icon-gutter': 8);
12
- $sizes: ('large', $large), ('small', $small);
13
- $secondary: ('border': 1);
14
-
15
- // The tertiary styling has its own padding; regardless of size, we add a tiny amount of padding to accommodate
16
- // the focus outline and to ensure any icons are centered
17
- $tertiary: ('padding-top': 1.6, 'padding-horizontal': 8,'padding-bottom': 3.2);
18
- $animation: ('scale': 1.1, 'duration': 0.5, 'iteration': 1);
19
-
20
- @layer base {
21
- #root {
22
- button, .button {
23
- background: map.get($theme, 'button_primary_bg');
24
- padding: px-to-rem(map.get($medium, 'padding-top')) px-to-rem(map.get($medium, 'padding-horizontal'))
25
- px-to-rem(map.get($medium, 'padding-bottom')) px-to-rem(map.get($medium, 'padding-horizontal'));
26
- position: relative;
27
- text-align: center;
28
- font-size: px-to-rem(map.get($medium, 'font-size'));
29
- color: map.get($theme, 'button_primary');
30
- font-weight: 700;
31
- text-decoration: none;
32
- border-radius: 360rem; // Completely round corners. This could be any large number but 360 evokes a circle well!
33
- border: none;
34
- cursor: pointer;
35
- box-sizing: border-box;
36
- display: inline-block;
37
-
38
- &:hover {
39
- background: map.get($theme, 'button_primary_bg_hover');
40
- }
41
-
42
- &:active {
43
- background: map.get($theme, 'button_primary_bg_active');
44
- }
45
-
46
- &:focus, &:focus-visible {
47
- background: map.get($theme, 'button_primary_bg_focus');
48
- }
49
-
50
- @each $size, $styles in $sizes {
51
- &.#{$size} {
52
- padding: px-to-rem(map.get($styles, 'padding-top')) px-to-rem(map.get($styles, 'padding-horizontal'))
53
- px-to-rem(map.get($styles, 'padding-bottom')) px-to-rem(map.get($styles, 'padding-horizontal'));
54
- font-size: px-to-rem(map.get($styles, 'font-size'));
55
-
56
- &.icon {
57
- margin-top: px-to-rem(map.get($styles, 'icon-offset'));
58
-
59
- &.left::before { margin-right: px-to-rem(map.get($styles, 'icon-gutter')); }
60
- &.right::before { margin-left: px-to-rem(map.get($styles, 'icon-gutter')); }
61
- }
62
- }
63
- }
64
-
65
- &.full-width {
66
- width: 100%;
67
- }
68
-
69
- &.destructive {
70
- &, &:hover, &:active, &:focus, &:focus-visible {
71
- background: map.get($theme, 'button_primary_destructive_bg');
72
- color: map.get($theme, 'button_primary_destructive');
73
- }
74
-
75
- &:hover, &:active {
76
- background: map.get($theme, 'button_primary_destructive_bg_hover');
77
- }
78
-
79
- &:focus, &:focus-visible {
80
- box-shadow: $outline map.get($theme, 'button_primary_destructive_box-shadow');
81
- }
82
-
83
- }
84
-
85
- &.secondary {
86
- background: map.get($theme, 'button_secondary_bg');
87
- color: map.get($theme, 'button_secondary');
88
- border: px-to-rem(map.get($secondary, 'border')) solid map.get($theme, 'button_secondary_border');
89
-
90
- &:hover {
91
- background: map.get($theme, 'button_secondary_bg_hover');
92
- }
93
-
94
- &:active, &:focus, &:focus-visible {
95
- color: map.get($theme, 'button_secondary_focus');
96
- border-color: map.get($theme, 'button_secondary_border_focus');
97
- }
98
-
99
- &:active {
100
- background: map.get($theme, 'button_secondary_bg_active');
101
- }
102
-
103
- &:focus, &:focus-visible {
104
- background: map.get($theme, 'button_secondary_bg_focus');
105
- }
106
-
107
- &.muted {
108
- border-color: map.get($theme, 'button_secondary_border_muted');
109
-
110
- &, &:hover, &:active, &:focus, &:focus-visible {
111
- background: map.get($theme, 'button_secondary_bg_muted');
112
- color: map.get($theme, 'button_secondary_muted');
113
- }
114
-
115
- &:hover, &:focus, &:focus-visible {
116
- color: map.get($theme, 'button_secondary_muted_hover');
117
- }
118
- }
119
-
120
- &.disabled {
121
- &, &:hover, &:active, &:focus, &:focus-visible {
122
- background: map.get($theme, 'button_secondary_bg_disabled');
123
- color: map.get($theme, 'button_secondary_disabled');
124
- border-color: map.get($theme, 'button_secondary_border_disabled');
125
- }
126
- }
127
- }
128
-
129
- &.tertiary {
130
- @include transition(color text-decoration-color);
131
-
132
- padding: px-to-rem(map.get($tertiary, 'padding-top')) px-to-rem(map.get($tertiary, 'padding-horizontal'))
133
- px-to-rem(map.get($tertiary, 'padding-bottom')) px-to-rem(map.get($tertiary, 'padding-horizontal'));
134
- bottom: px-to-rem(map.get($tertiary, 'padding-top'));
135
- right: px-to-rem(map.get($tertiary, 'padding-horizontal'));
136
- text-decoration: underline;
137
- text-decoration-color: transparent;
138
-
139
- &, &:focus, &:focus-visible {
140
- background: map.get($theme, 'button_tertiary_bg');
141
- color: map.get($theme, 'button_tertiary');
142
- text-decoration-color: map.get($theme, 'button_tertiary_text-decoration');
143
- }
144
-
145
- &:hover, &:active {
146
- text-decoration-color: currentcolor;
147
- }
148
-
149
- &:hover {
150
- color: map.get($theme, 'button_tertiary_hover');
151
- }
152
-
153
- &:active {
154
- color: map.get($theme, 'button_tertiary_active');
155
- }
156
-
157
- &.muted {
158
- color: map.get($theme, 'button_tertiary_muted');
159
-
160
- &:hover, &:focus, &:focus-visible {
161
- color: map.get($theme, 'button_tertiary_muted_hover');
162
- }
163
- }
164
-
165
- &.disabled {
166
- &, &:hover, &:active, &:focus, &:focus-visible {
167
- background: map.get($theme, 'button_tertiary_disabled_bg');
168
- color: map.get($theme, 'button_tertiary_disabled');
169
- text-decoration-color: map.get($theme, 'button_tertiary_disabled_text-decoration');
170
- }
171
- }
172
-
173
- }
174
-
175
- &.icon {
176
- display: inline-flex;
177
- flex-flow: row;
178
- align-content: center;
179
- justify-content: center;
180
-
181
- &::before {
182
- content: '';
183
- background: currentcolor;
184
- width: px-to-rem(map.get($medium, 'icon-width'));
185
- height: px-to-rem(map.get($medium, 'icon-width'));
186
- display: block;
187
- }
188
-
189
- &.right::before { order: 2; }
190
-
191
- @each $icon, $large-icon, $medium-icon, $small-icon in $icons {
192
- $icon-sizes: ('large', $large-icon), ('medium', $medium-icon), ('small', $small-icon);
193
-
194
- %icon-#{$icon} {
195
- @include icon-styling($icon, $icon-sizes);
196
- }
197
-
198
- &.#{$icon} {
199
- @extend %icon-#{$icon};
200
- }
201
-
202
- &.hover_#{$icon} {
203
- &:hover, &:focus, &:focus-visible {
204
- @extend %icon-#{$icon};
205
- }
206
- }
207
-
208
- }
209
-
210
- &.animate {
211
- @include animate {
212
- @keyframes bounce {
213
- 0%, 100% { transform: scale(1); }
214
-
215
- 70% {
216
- transform: scale(#{map.get($animation, 'scale')});
217
- }
218
- }
219
-
220
- &:focus, &:active, &.do-animation {
221
- &::before { animation: bounce #{map.get($animation, 'duration')}s #{map.get($animation, 'iteration')}; }
222
- }
223
-
224
- }
225
- }
226
- }
227
-
228
- &.disabled {
229
- cursor: not-allowed;
230
- opacity: 0.3;
231
- }
232
-
233
- }
234
- }
235
- }
236
-
@@ -1,8 +0,0 @@
1
- // We need to scope everything to #root, but that stops us adding a parent before the
2
- // current selector. This mixin puts the selector path in the expected order. See the README for
3
- // more details.
4
- @mixin selector-after-root($selector) {
5
- @at-root #root #{selector-replace(&, '#root', $selector)} {
6
- @content;
7
- }
8
- }