@apolitical/component-library 6.6.26 → 7.0.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/form/types/invite-form/invite-form.d.ts +1 -10
- package/index.js +26 -26
- package/index.mjs +1269 -1289
- package/modals/components/modal/index.d.ts +1 -1
- package/modals/components/modal/modal.d.ts +2 -5
- package/package.json +1 -1
- package/style.css +1 -1
- package/styles/README.md +5 -5
- package/styles/base/_accessibility.scss +1 -0
- package/styles/base/form/_checkbox.scss +1 -1
- package/styles/base/form/_radio.scss +1 -1
- package/styles/functions/_maps.scss +2 -0
- package/styles/mixins/_breakpoints.scss +1 -0
- package/styles/mixins/_styles.scss +1 -0
- package/styles/variables/colors/theme/_modals.scss +0 -1
package/styles/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
We're using [CSS cascade layers (`@layer`)](https://www.smashingmagazine.com/2022/01/introduction-css-cascade-layers/) to organise our styles, to help us avoid specificity issues and to make it easier to find and update styles.
|
|
12
12
|
|
|
13
|
-
The
|
|
13
|
+
The `./index.scss` file defines the order of our layers, with the browser reset as the lowest.
|
|
14
14
|
|
|
15
15
|
If you need to overwrite CSS, you don't need to create an overly specific (and less performant) rule or add an `!important` (as an aside: please, please [never add an `!important`](https://dev.to/alvaromontoro/using-important-in-css-75c)) - just put the styling in a higher layer.
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ The only 'gotcha' with this is importing external CSS; any styling that _isn't_
|
|
|
20
20
|
|
|
21
21
|
## Colour variables
|
|
22
22
|
|
|
23
|
-
Our colour variables are defined in
|
|
23
|
+
Our colour variables are defined in `./variables/colors`.
|
|
24
24
|
|
|
25
25
|
We have two separate files:
|
|
26
26
|
|
|
@@ -30,11 +30,11 @@ Because the colours are described as colours (`b700`), rather than by what they'
|
|
|
30
30
|
|
|
31
31
|
We can't rely on these colours making sense in the future, so we don't use them directly in the code.
|
|
32
32
|
|
|
33
|
-
-
|
|
33
|
+
- `./theme/index.scss` defines a `$theme` map which describes where the colours are used, rather than what the colours look like, e.g. `card_bg` for the default background colour of cards and `card_hover_bg` for the background colour cards should change to on hover.
|
|
34
34
|
|
|
35
35
|
Using these names, rather than the direct colour values, future-proofs the code against redesigns and makes it easy to maintain; when we redesign the platform, we can update the colours in one place, rather than having to amend every component.
|
|
36
36
|
|
|
37
|
-
To avoid `theme` being a giant, difficult-to-navigate file, we split out all the values by the component directory they're in (e.g. `base`, `buttons`, `cards`, etc.) and then import them into
|
|
37
|
+
To avoid `theme` being a giant, difficult-to-navigate file, we split out all the values by the component directory they're in (e.g. `base`, `buttons`, `cards`, etc.) and then import them into `./theme/index.scss`. We use a Sass function to pull everything into the `$theme` variable, so we don't need to know exactly what's in each file.
|
|
38
38
|
|
|
39
39
|
---
|
|
40
40
|
|
|
@@ -52,7 +52,7 @@ By default, buttons are `medium`. They don't need a class to be styled. Buttons
|
|
|
52
52
|
|
|
53
53
|
### Icons
|
|
54
54
|
|
|
55
|
-
Buttons can have an icon but - because we can't mix pre-processing and data passed into CSS for file names, like CSS variables or data attributes - icons on buttons need to be set up in advance with classes. The list of available icons is maintained in
|
|
55
|
+
Buttons can have an icon but - because we can't mix pre-processing and data passed into CSS for file names, like CSS variables or data attributes - icons on buttons need to be set up in advance with classes. The list of available icons is maintained in `./base/buttons/_icons.scss`. To add a new icon, add a new item to the list with arguments for the sizes on large, medium, and small buttons.
|
|
56
56
|
|
|
57
57
|
To add an icon to a button, add the class name `icon [file name of icon without file extension]`, e.g. `icon heart_empty`.
|
|
58
58
|
|
|
@@ -12,11 +12,13 @@
|
|
|
12
12
|
@return map.get($map, $children);
|
|
13
13
|
} @else {
|
|
14
14
|
$new-list: ();
|
|
15
|
+
|
|
15
16
|
@for $i from 1 through length($children) {
|
|
16
17
|
@if $i != 1 {
|
|
17
18
|
$new-list: list.append($new-list, list.nth($children, $i), 'space');
|
|
18
19
|
}
|
|
19
20
|
}
|
|
21
|
+
|
|
20
22
|
@return get-map($map, list.nth($children, 1), $new-list);
|
|
21
23
|
}
|
|
22
24
|
} @else {
|
|
@@ -13,6 +13,7 @@ $breakpoint-sizes: (
|
|
|
13
13
|
// breakpoints a bit faster by not having to type out the full media query each time.
|
|
14
14
|
@mixin breakpoint($types, $breakpoints) {
|
|
15
15
|
$media: ('only screen');
|
|
16
|
+
|
|
16
17
|
@for $i from 1 through length($types) {
|
|
17
18
|
$type: list.nth($types, $i);
|
|
18
19
|
$breakpoint: list.nth($breakpoints, $i);
|