@justeattakeaway/pie-css 0.6.0 → 0.7.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/README.md
CHANGED
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
|
|
13
13
|
# Table of Contents
|
|
14
14
|
|
|
15
|
-
1. [Introduction](#
|
|
16
|
-
2. [
|
|
15
|
+
1. [Introduction](#introduction)
|
|
16
|
+
2. [Using pie-css for building web applications](#using-pie-css-for-building-web-applications)
|
|
17
17
|
1. JS or Framework import (via bundler)
|
|
18
18
|
2. NuxtJS
|
|
19
19
|
3. Sass /SCSS
|
|
20
20
|
4. Native HTML
|
|
21
|
-
3. [Using
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
3. [Using pie-css for building web components](#using-pie-css-for-building-web-components)
|
|
22
|
+
- [Z-index](#z-index)
|
|
23
|
+
4. [Testing](#testing)
|
|
24
24
|
- [CSS](#css)
|
|
25
25
|
- [SCSS](#scss )
|
|
26
26
|
|
|
@@ -30,7 +30,8 @@ PIE CSS is A styling library that provides both a shared collection of ready to
|
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
|
-
##
|
|
33
|
+
## Using pie-css for building web applications
|
|
34
|
+
`pie-css` provides a base stylesheet that sets up some basic styles used by our components. It is essential that this stylesheet is included in any application that uses PIE Web Components. The stylesheet provides some basic styles for things like typography and provides the design tokens that are used by our components.
|
|
34
35
|
|
|
35
36
|
To install the PIE CSS library, run the following on your command line:
|
|
36
37
|
|
|
@@ -121,15 +122,17 @@ Of course, you could include the styles straight inside your HTML document – m
|
|
|
121
122
|
|
|
122
123
|
|
|
123
124
|
|
|
124
|
-
## Using
|
|
125
|
+
## Using pie-css for building web components
|
|
126
|
+
> [!NOTE]
|
|
127
|
+
> The following section is only relevant if you are building web components as a part of our component library within the PIE monorepo.
|
|
125
128
|
|
|
126
|
-
PIE CSS
|
|
129
|
+
PIE CSS provides an optional set of SCSS helpers that are used by the PIE Web Components.
|
|
127
130
|
|
|
128
131
|
These are for carrying out common tasks in our styles, such as setting font sizes in consistent ways and sharing styles across components via SCSS mixins and functions.
|
|
129
132
|
|
|
130
133
|
We will be writing more in-depth docs on these SCSS helpers shortly, but for now, feel free to browse the [SCSS code in the PIE mono-repo](https://github.com/justeattakeaway/pie/tree/main/packages/tools/pie-css/scss).
|
|
131
134
|
|
|
132
|
-
|
|
135
|
+
### z-index
|
|
133
136
|
|
|
134
137
|
Some PIE Web Components use a z-index value to control how they stack on a webpage. These values are defined in the `pie-css` package as css variables and are utilized internally. In most cases, a webpage should follow the DOM's natural stacking order and the default z-index order assigned for each component. However, if you're creating custom components, refer to the following table to make sure they don't conflict with other components.
|
|
135
138
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "A styling library that provides both a shared collection of ready to use CSS styles to be used across JET web front-ends, and SCSS-based style helpers for our PIE Web Component library.",
|
|
5
5
|
"author": "Just Eat Takeaway.com - Design System Team",
|
|
6
6
|
"files": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"repository": "https://github.com/justeattakeaway/pie.git",
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@types/postcss-import": "14.0.
|
|
30
|
+
"@types/postcss-import": "14.0.2",
|
|
31
31
|
"postcss": "8.4.31",
|
|
32
32
|
"postcss-import": "15.1.0",
|
|
33
33
|
"w3c-css-validator": "1.3.1"
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
// -
|
|
8
8
|
// @example
|
|
9
9
|
// .foo {
|
|
10
|
-
// &[isdraggable]
|
|
10
|
+
// &[isdraggable] {
|
|
11
11
|
// @extend %has-grab-cursor;
|
|
12
12
|
// }
|
|
13
13
|
// }
|
|
14
14
|
// -
|
|
15
15
|
// Outputs:
|
|
16
|
-
// .foo[isdraggable]
|
|
16
|
+
// .foo[isdraggable] {
|
|
17
17
|
// cursor: grab;
|
|
18
18
|
// &:active {
|
|
19
19
|
// cursor: grabbing;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// ----------------------------------------------
|
|
2
|
+
// Mixin to define button states for hover, active and loading.
|
|
3
|
+
// $bg-color: design token name to be used for the states
|
|
4
|
+
// $mode: 'default': apply the default lighten/darken to the color via hsl
|
|
5
|
+
// 'transparent': uses hsla syntax to make the color semi-opaque (used for ghost and outline button variants)
|
|
6
|
+
// }
|
|
7
|
+
// ----------------------------------------------
|
|
8
|
+
@mixin button-interactive-states($bg-color, $mode: 'default') {
|
|
9
|
+
&:hover:not(:disabled) {
|
|
10
|
+
@if $mode == 'alt' {
|
|
11
|
+
--hover-modifier: calc(-1 * var(--dt-color-hover-02));
|
|
12
|
+
} @else {
|
|
13
|
+
--hover-modifier: calc(-1 * var(--dt-color-hover-01));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// for mode=transparent, use the hsla syntax to make the button background opaque by a set percentage
|
|
17
|
+
@if $mode == 'transparent' {
|
|
18
|
+
--hover-modifier: var(--dt-color-hover-01);
|
|
19
|
+
--btn-bg-color: hsl(var(#{$bg-color}-h), var(#{$bg-color}-s), var(#{$bg-color}-l), var(--hover-modifier));
|
|
20
|
+
} @else {
|
|
21
|
+
--btn-bg-color: hsl(var(#{$bg-color}-h), var(#{$bg-color}-s), calc(var(#{$bg-color}-l) + var(--hover-modifier)));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:active:not(:disabled),
|
|
26
|
+
&[isLoading]:not(:disabled) {
|
|
27
|
+
@if $mode == 'alt' {
|
|
28
|
+
--active-modifier: calc(-1 * var(--dt-color-active-02));
|
|
29
|
+
} @else {
|
|
30
|
+
--active-modifier: calc(-1 * var(--dt-color-active-01));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@if $mode == 'transparent' {
|
|
34
|
+
--active-modifier: var(--dt-color-active-01);
|
|
35
|
+
--btn-bg-color: hsl(var(#{$bg-color}-h), var(#{$bg-color}-s), var(#{$bg-color}-l), var(--active-modifier));
|
|
36
|
+
} @else {
|
|
37
|
+
--btn-bg-color: hsl(var(#{$bg-color}-h), var(#{$bg-color}-s), calc(var(#{$bg-color}-l) + var(--active-modifier)));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
package/scss/mixins/index.scss
CHANGED