@justeattakeaway/pie-css 0.32.0 → 1.1.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.
@@ -528,12 +528,12 @@
528
528
  --btn-inline-size: 100%;
529
529
  }
530
530
 
531
- .c-button--disabled {
531
+ .is-disabled {
532
532
  --btn-text-color: var(--dt-color-content-disabled-solid);
533
533
  cursor: not-allowed;
534
534
  pointer-events: none;
535
535
  }
536
- .c-button--disabled:not(.c-button--ghost,
536
+ .is-disabled:not(.c-button--ghost,
537
537
  .c-button--ghost-dark,
538
538
  .c-button--ghost-inverse,
539
539
  .c-button--ghost-inverse-light,
@@ -541,7 +541,7 @@
541
541
  --int-states-mixin-bg-color: var(--dt-color-disabled-01);
542
542
  --btn-text-color: var(--dt-color-content-disabled);
543
543
  }
544
- .c-button--disabled.c-button--outline, .c-button--disabled.c-button--outline-inverse {
544
+ .is-disabled.c-button--outline, .is-disabled.c-button--outline-inverse {
545
545
  border-color: var(--dt-color-disabled-01);
546
546
  }
547
547
 
@@ -111,41 +111,41 @@
111
111
  }
112
112
  }
113
113
 
114
- .c-radio--error {
114
+ .has-error {
115
115
  --radio-bg-color--checked: var(--dt-color-support-error);
116
116
  --radio-border-color: var(--dt-color-support-error);
117
117
  }
118
- .c-radio--error:hover:not(:checked, :disabled) {
118
+ .has-error:hover:not(:checked, :disabled) {
119
119
  --radio-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--dt-color-hover-01));
120
120
  }
121
121
  @supports (background-color: color-mix(in srgb, black, white)) {
122
- .c-radio--error:hover:not(:checked, :disabled) {
122
+ .has-error:hover:not(:checked, :disabled) {
123
123
  --radio-bg-color: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), transparent);
124
124
  }
125
125
  }
126
- .c-radio--error:active:not(:checked, :disabled) {
126
+ .has-error:active:not(:checked, :disabled) {
127
127
  --radio-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--dt-color-active-01));
128
128
  }
129
129
  @supports (background-color: color-mix(in srgb, black, white)) {
130
- .c-radio--error:active:not(:checked, :disabled) {
130
+ .has-error:active:not(:checked, :disabled) {
131
131
  --radio-bg-color: color-mix(in srgb, var(--dt-color-active-01-bg) var(--dt-color-active-01), transparent);
132
132
  }
133
133
  }
134
- .c-radio--error:hover:checked:not(:disabled):before {
134
+ .has-error:hover:checked:not(:disabled):before {
135
135
  --radio-bg-color--checked: hsl(var(--dt-color-support-error-h), var(--dt-color-support-error-s), calc(var(--dt-color-support-error-l) - var(--dt-color-hover-01)));
136
136
  --radio-border-color: hsl(var(--dt-color-support-error-h), var(--dt-color-support-error-s), calc(var(--dt-color-support-error-l) - var(--dt-color-hover-01)));
137
137
  }
138
138
  @supports (background-color: color-mix(in srgb, black, white)) {
139
- .c-radio--error:hover:checked:not(:disabled):before {
139
+ .has-error:hover:checked:not(:disabled):before {
140
140
  --radio-bg-color--checked: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), var(--dt-color-support-error));
141
141
  }
142
142
  }
143
- .c-radio--error:active:checked:not(:disabled):before {
143
+ .has-error:active:checked:not(:disabled):before {
144
144
  --radio-bg-color--checked: hsl(var(--dt-color-support-error-h), var(--dt-color-support-error-s), calc(var(--dt-color-support-error-l) - var(--dt-color-active-01)));
145
145
  --radio-border-color: hsl(var(--dt-color-support-error-h), var(--dt-color-support-error-s), calc(var(--dt-color-support-error-l) - var(--dt-color-active-01)));
146
146
  }
147
147
  @supports (background-color: color-mix(in srgb, black, white)) {
148
- .c-radio--error:active:checked:not(:disabled):before {
148
+ .has-error:active:checked:not(:disabled):before {
149
149
  --radio-bg-color--checked: color-mix(in srgb, var(--dt-color-active-01-bg) var(--dt-color-active-01), var(--dt-color-support-error));
150
150
  }
151
151
  }
@@ -98,7 +98,7 @@ Apply the `c-button` class along with variant and size modifiers to a static ele
98
98
  </div>
99
99
 
100
100
  <!-- Disabled state -->
101
- <div class="c-button c-button--primary c-button--medium c-button--disabled">
101
+ <div class="c-button c-button--primary c-button--medium is-disabled">
102
102
  Disabled
103
103
  </div>
104
104
 
@@ -148,7 +148,7 @@ Apply the `c-button` class along with variant and size modifiers to a static ele
148
148
 
149
149
  | Class | Description |
150
150
  |-------|-------------|
151
- | `.c-button--disabled` | Disabled appearance (cursor: not-allowed, pointer-events: none) |
151
+ | `.is-disabled` | Disabled appearance (cursor: not-allowed, pointer-events: none) |
152
152
  | `.c-button--fullWidth` | Makes the button span 100% of its container |
153
153
  | `.c-button--truncate` | Truncates the label with an ellipsis when text overflows the button's width |
154
154
  | `.c-button--responsive` | Enables responsive size bumping at wider viewports |
@@ -194,10 +194,10 @@ Outline variants (`outline`, `outline-inverse`) include a 1px border and automat
194
194
 
195
195
  ### Disabled
196
196
 
197
- The disabled modifier uses class-based selectors (`.c-button--disabled`) rather than the `:disabled` pseudo-class, because these CSS classes target non-interactive elements where `:disabled` is not applicable.
197
+ The disabled modifier uses class-based selectors (`.is-disabled`) rather than the `:disabled` pseudo-class, because these CSS classes target non-interactive elements where `:disabled` is not applicable.
198
198
 
199
199
  ```html
200
- <div class="c-button c-button--primary c-button--medium c-button--disabled">
200
+ <div class="c-button c-button--primary c-button--medium is-disabled">
201
201
  Disabled
202
202
  </div>
203
203
  ```
@@ -86,7 +86,7 @@ Apply the `c-radio` class to a native radio input:
86
86
  </label>
87
87
 
88
88
  <!-- Error state -->
89
- <input type="radio" class="c-radio c-radio--error" name="option" value="3">
89
+ <input type="radio" class="c-radio has-error" name="option" value="3">
90
90
  ```
91
91
 
92
92
  ## Available Classes
@@ -94,7 +94,7 @@ Apply the `c-radio` class to a native radio input:
94
94
  | Class | Description |
95
95
  |-------|-------------|
96
96
  | `.c-radio` | Base radio input styling with all default states |
97
- | `.c-radio--error` | Error state styling |
97
+ | `.has-error` | Error state styling |
98
98
 
99
99
  **Note:** All other visual states (`:checked`, `:disabled`, `:hover`, `:active`, `:focus-visible`) are handled automatically by CSS pseudo-classes.
100
100
 
@@ -104,7 +104,7 @@ All states are applied automatically via CSS pseudo-classes, except for error wh
104
104
 
105
105
  | State | CSS Selector | Appearance | When Applied |
106
106
  |-------|--------------|------------|--------------|
107
- | **Error** | `.c-radio--error` | Error border color | Add `c-radio--error` class |
107
+ | **Error** | `.has-error` | Error border color | Add `has-error` class |
108
108
  | **Unchecked** | `.c-radio` | Empty circle with border | Default state |
109
109
  | **Checked** | `.c-radio:checked` | Filled circle with center dot | When selected |
110
110
  | **Disabled** | `.c-radio:disabled` | Faded, not-allowed cursor | When `disabled` attribute is present |
@@ -20,10 +20,6 @@ All of our design tokens can be added to your project by following our [CSS setu
20
20
  - [Stack items with spacing token](#stack-items-with-spacing-token)
21
21
  - [Add padding using spacing alias](#add-padding-using-spacing-alias)
22
22
  - [Typography](#typography)
23
- - [Font size](#font-size)
24
- - [Body text](#body-text)
25
- - [Heading example](#heading-example)
26
- - [Line height](#line-height)
27
23
  - [Radius](#radius)
28
24
  - [Rounded card](#rounded-card)
29
25
  - [Motion](#motion)
@@ -89,50 +85,8 @@ A spacing token (`--dt-spacing-e`) is applied to padding, providing internal spa
89
85
 
90
86
  ## Typography
91
87
 
92
- **Note:** Whenever you set a `font-size`, you must also set a compatible `line-height` rule to ensure the font looks correct.
93
-
94
- ### Font size
95
- Our font-size tokens only store the raw number, not a `px` unit. Therefore, you must multiply the token by `1px` to create a `px` value that CSS will understand.
96
-
97
- ```css
98
- .font-size-example {
99
- font-size: calc(var(--dt-font-body-l-size) * 1px);
100
- }
101
- ```
102
-
103
- ### Body text
104
- Font tokens define the typography for body content, including font family, size, weight, and line height. Each token maps to a specific design choice in the type scale, and using them ensures that text remains visually consistent and readable, even as underlying type styles evolve in the system.
105
-
106
- ```css
107
- .body-text {
108
- font-family: var(--dt-font-body-l-family);
109
- font-size: calc(var(--dt-font-body-l-size) * 1px);
110
- font-weight: var(--dt-font-body-l-weight);
111
- line-height: calc(var(--dt-font-body-l-line-height) * 1px);
112
- }
113
- ```
114
-
115
- ### Heading example
116
- Typography tokens are again used here, but with heading-specific values - including a `--wide` variant for font size and line height. This demonstrates how token modifiers allow flexibility (e.g. tighter vs wider spacing) without diverging from the core type system.
117
-
118
- ```css
119
- .heading-m {
120
- font-family: var(--dt-font-heading-m-family);
121
- font-size: calc(var(--dt-font-heading-m-size--wide) * 1px);
122
- font-weight: var(--dt-font-heading-m-weight);
123
- line-height: calc(var(--dt-font-heading-m-line-height--wide) * 1px);
124
- }
125
- ```
126
-
127
- ### Line height
128
-
129
- Line height tokens only contain the raw number, not a `px` unit. Therefore they must be multipled by `1px` to create a `px` value CSS will understand.
130
-
131
- ```css
132
- .applied-lineheight {
133
- line-height: calc(var(--dt-font-heading-m-line-height--wide) * 1px);
134
- }
135
- ```
88
+ For typography, we recommend using the utility classes provided by `pie-css` instead of directly applying font tokens. These classes ensure consistent application of our type scale and responsive adjustments across all components.
89
+ Documentation and examples can be found in Storybook [here](https://webc.pie.design/?path=/docs/additional-libraries-pie-css-typography-utility-classes--docs).
136
90
 
137
91
  ## Radius
138
92
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-css",
3
- "version": "0.32.0",
3
+ "version": "1.1.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
  "repository": {
6
6
  "type": "git",
@@ -25,13 +25,19 @@
25
25
  "generate:typography-docs": "node scripts/generate-typography-docs.js",
26
26
  "lint:scripts": "run -T eslint .",
27
27
  "lint:scripts:fix": "yarn lint:scripts --fix",
28
- "lint:style": "run -T stylelint ./**/*.{css,scss}",
28
+ "lint:style": "run -T stylelint './**/*.{css,scss}'",
29
29
  "lint:style:fix": "yarn lint:style --fix",
30
30
  "prepublishOnly": "yarn lint:style && yarn lint:scripts && yarn build && yarn test",
31
31
  "test": "run -T vitest run --config ../../../vite.config.js",
32
32
  "test:ci": "yarn test",
33
33
  "test:watch": "run -T vitest"
34
34
  },
35
+ "stylelint": {
36
+ "extends": [
37
+ "@justeattakeaway/stylelint-config-pie/base",
38
+ "@justeattakeaway/stylelint-config-pie/style"
39
+ ]
40
+ },
35
41
  "keywords": [
36
42
  "PIE",
37
43
  "CSS",
@@ -47,7 +53,7 @@
47
53
  "include-media": "2.0.0",
48
54
  "postcss": "8.4.32",
49
55
  "postcss-import": "15.1.0",
50
- "w3c-css-validator": "1.3.2"
56
+ "w3c-css-validator": "1.4.1"
51
57
  },
52
58
  "volta": {
53
59
  "extends": "../../../package.json"
@@ -85,7 +85,7 @@
85
85
  }
86
86
 
87
87
  // Disabled
88
- .c-button--disabled {
88
+ .is-disabled {
89
89
  @include button.button-disabled;
90
90
  }
91
91
 
@@ -6,7 +6,7 @@
6
6
  @include radio.radio-animations;
7
7
  }
8
8
 
9
- .c-radio--error {
9
+ .has-error {
10
10
  @include radio.radio-error;
11
11
  @include radio.radio-interactive-state('dt-color-support-error');
12
12
  }
@@ -374,6 +374,7 @@
374
374
  pointer-events: none;
375
375
  }
376
376
 
377
+ // stylelint-disable @stylistic/indentation
377
378
  // For every variant except ghost variants, set the disabled background colour
378
379
  &:not(
379
380
  .#{$prefix}--ghost,
@@ -385,6 +386,7 @@
385
386
  --int-states-mixin-bg-color: var(--dt-color-disabled-01);
386
387
  --btn-text-color: var(--dt-color-content-disabled);
387
388
  }
389
+ // stylelint-enable @stylistic/indentation
388
390
 
389
391
  // For outline variants, set the border to the disabled colour
390
392
  &.#{$prefix}--outline,
@@ -103,7 +103,7 @@
103
103
  /// @include radio-interactive-state('dt-color-interactive-brand');
104
104
  /// }
105
105
  /// @example scss - Using with error color
106
- /// .my-radio--error {
106
+ /// .has-error {
107
107
  /// @include radio-interactive-state('dt-color-support-error');
108
108
  /// }
109
109
  @mixin radio-interactive-state($bg-color) {
@@ -156,7 +156,7 @@
156
156
 
157
157
  /// Error state modifier that overrides color custom properties
158
158
  /// @example scss - Applying error state
159
- /// .my-radio--error {
159
+ /// .has-error {
160
160
  /// @include radio-error();
161
161
  /// }
162
162
  @mixin radio-error() {