@justeattakeaway/pie-css 0.5.1 → 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 +26 -6
- package/dist/index.css +13 -0
- package/package.json +3 -3
- package/scss/helpers/_has-grab-cursor.scss +2 -2
- package/scss/mixins/_buttonInteractiveStates.scss +40 -0
- package/scss/mixins/_visuallyHidden.scss +10 -0
- package/scss/mixins/index.scss +2 -0
- package/LICENSE +0 -17
package/README.md
CHANGED
|
@@ -12,13 +12,14 @@
|
|
|
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
|
|
21
|
+
3. [Using pie-css for building web components](#using-pie-css-for-building-web-components)
|
|
22
|
+
- [Z-index](#z-index)
|
|
22
23
|
4. [Testing](#testing)
|
|
23
24
|
- [CSS](#css)
|
|
24
25
|
- [SCSS](#scss )
|
|
@@ -29,7 +30,8 @@ PIE CSS is A styling library that provides both a shared collection of ready to
|
|
|
29
30
|
|
|
30
31
|
---
|
|
31
32
|
|
|
32
|
-
##
|
|
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.
|
|
33
35
|
|
|
34
36
|
To install the PIE CSS library, run the following on your command line:
|
|
35
37
|
|
|
@@ -120,14 +122,32 @@ Of course, you could include the styles straight inside your HTML document – m
|
|
|
120
122
|
|
|
121
123
|
|
|
122
124
|
|
|
123
|
-
## 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.
|
|
124
128
|
|
|
125
|
-
PIE CSS
|
|
129
|
+
PIE CSS provides an optional set of SCSS helpers that are used by the PIE Web Components.
|
|
126
130
|
|
|
127
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.
|
|
128
132
|
|
|
129
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).
|
|
130
134
|
|
|
135
|
+
### z-index
|
|
136
|
+
|
|
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.
|
|
138
|
+
|
|
139
|
+
| Token | Z-Index Value |
|
|
140
|
+
| -------------------------- | ---------------|
|
|
141
|
+
| --dt-z-index-dropdown | 1000 |
|
|
142
|
+
| --dt-z-index-fab | 1000 |
|
|
143
|
+
| --dt-z-index-tooltip | 2000 |
|
|
144
|
+
| --dt-z-index-popover | 3000 |
|
|
145
|
+
| --dt-z-index-bottom-sheet | 4000 |
|
|
146
|
+
| --dt-z-index-side-sheet | 4000 |
|
|
147
|
+
| --dt-z-index-modal | 4000 |
|
|
148
|
+
| --dt-z-index-cookie-banner | 5000 |
|
|
149
|
+
| --dt-z-index-toast | 6000 |
|
|
150
|
+
|
|
131
151
|
## Testing
|
|
132
152
|
|
|
133
153
|
We strive to ensure all styles are appropriately tested. How we test the styles differs for CSS and SCSS. Below, we outline both approaches.
|
package/dist/index.css
CHANGED
|
@@ -1105,3 +1105,16 @@ html {
|
|
|
1105
1105
|
*:after {
|
|
1106
1106
|
box-sizing: inherit;
|
|
1107
1107
|
}
|
|
1108
|
+
/* The z-index priority order of different components.
|
|
1109
|
+
The values start at a high and specific number to avoid any conflicts */
|
|
1110
|
+
:root {
|
|
1111
|
+
--dt-z-index-dropdown: 1000;
|
|
1112
|
+
--dt-z-index-fab: 1000;
|
|
1113
|
+
--dt-z-index-tooltip: 2000;
|
|
1114
|
+
--dt-z-index-popover: 3000;
|
|
1115
|
+
--dt-z-index-bottom-sheet: 4000;
|
|
1116
|
+
--dt-z-index-side-sheet: 4000;
|
|
1117
|
+
--dt-z-index-modal: 4000;
|
|
1118
|
+
--dt-z-index-cookie-banner: 5000;
|
|
1119
|
+
--dt-z-index-toast: 6000;
|
|
1120
|
+
}
|
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,8 +27,8 @@
|
|
|
27
27
|
"repository": "https://github.com/justeattakeaway/pie.git",
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@types/postcss-import": "14.0.
|
|
31
|
-
"postcss": "8.4.
|
|
30
|
+
"@types/postcss-import": "14.0.2",
|
|
31
|
+
"postcss": "8.4.31",
|
|
32
32
|
"postcss-import": "15.1.0",
|
|
33
33
|
"w3c-css-validator": "1.3.1"
|
|
34
34
|
}
|
|
@@ -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
package/LICENSE
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
Copyright (c) Just Eat Takeaway.com
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|