@1024pix/pix-ui 46.6.3 → 46.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.
@@ -7,6 +7,7 @@
7
7
  @inlineLabel={{true}}
8
8
  @screenReaderOnly={{@screenReaderOnly}}
9
9
  @isDisabled={{this.isDisabled}}
10
+ @variant={{@variant}}
10
11
  >
11
12
  <:inputElement>
12
13
  <input
@@ -2,10 +2,11 @@ import Component from '@glimmer/component';
2
2
 
3
3
  export default class PixLabelWrapped extends Component {
4
4
  get className() {
5
- const classes = ['pix-label', 'pix-label--wrapped'];
5
+ const classes = ['pix-label', 'pix-label-wrapped'];
6
6
 
7
7
  if (this.args.inlineLabel) classes.push('pix-label--inline-label');
8
- if (this.args.isDisabled) classes.push('pix-label--disabled');
8
+ if (this.args.isDisabled) classes.push('pix-label-wrapped--disabled');
9
+ if (this.args.variant === 'tile') classes.push('pix-label-wrapped--variant-tile');
9
10
 
10
11
  const size = ['small', 'large'].includes(this.args.size) ? this.args.size : 'default';
11
12
 
@@ -0,0 +1,41 @@
1
+ .pix-label-wrapped {
2
+ display: flex;
3
+ gap: var(--pix-spacing-2x);
4
+ align-items: center;
5
+ cursor: pointer;
6
+
7
+ &--variant-tile {
8
+ position: relative;
9
+ z-index: -2;
10
+ padding: var(--pix-spacing-3x) var(--pix-spacing-4x);
11
+ background: var(--pix-neutral-0);
12
+ border: 1px solid var(--pix-neutral-100);
13
+ border-radius: 4px;
14
+
15
+ &:focus-within {
16
+ border: 1px solid var(--pix-primary-500);
17
+ outline: 2px solid var(--pix-primary-300);
18
+ }
19
+
20
+ &:hover,
21
+ &:active {
22
+ background: var(--pix-primary-10);
23
+ }
24
+
25
+ &.pix-label-wrapped {
26
+ &--disabled {
27
+ background: var(--pix-neutral-20);
28
+ border-color: var(--pix-neutral-100);
29
+
30
+ &:hover,
31
+ &:active {
32
+ background: var(--pix-neutral-20);
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ &--disabled {
39
+ cursor: not-allowed;
40
+ }
41
+ }
@@ -3,12 +3,6 @@
3
3
  color: var(--pix-neutral-900);
4
4
  font-weight: var(--pix-font-medium);
5
5
 
6
- &--wrapped {
7
- display: flex;
8
- gap: var(--pix-spacing-2x);
9
- align-items: center;
10
- }
11
-
12
6
  &--disabled {
13
7
  color: var(--pix-neutral-500);
14
8
  }
@@ -21,6 +21,7 @@
21
21
  @import 'pix-button-upload';
22
22
  @import 'pix-input';
23
23
  @import 'pix-label';
24
+ @import 'pix-label-wrapped';
24
25
  @import 'pix-input-password';
25
26
  @import 'pix-radio-button';
26
27
  @import 'pix-modal';
@@ -6,6 +6,7 @@ import * as ComponentStories from './pix-checkbox.stories';
6
6
  # PixCheckbox
7
7
 
8
8
  La PixCheckbox permet de créer des checkbox basiques ou des checkbox mixées (checkbox servant d'indicateur lors d'une sélection multiple).
9
+ Un cursor `pointer` est défini sur la checkbox et son label par défaut.
9
10
 
10
11
  <Story of={ComponentStories.Default} height={60} />
11
12
 
@@ -18,12 +19,16 @@ En ce sens, nous avons déjà prévu un espace vertical pour séparer 2 composan
18
19
 
19
20
  <Story of={ComponentStories.multiple} height={140} />
20
21
 
21
- ### Dimensions du label
22
+ ### Variations graphiques du composant
22
23
 
23
- La PixCheckbox prend tout l'espace à sa disposition.
24
+ La PixCheckbox prend toute la largeur à sa disposition par défaut.
24
25
 
25
26
  <Story of={ComponentStories.FullWidth} height={100} />
26
27
 
28
+ Si le paramètre `variant` est précisé avec la valeur `tile`, la checkbox et son label sont visuellement regroupés dans un ensemble intégralement cliquable.
29
+
30
+ <Story of={ComponentStories.VariantTile} height={100} />
31
+
27
32
  ## États de la Checkbox
28
33
 
29
34
  <br />
@@ -35,11 +40,16 @@ La PixCheckbox prend tout l'espace à sa disposition.
35
40
  ### Checkbox désactivée
36
41
 
37
42
  L'attribut `@isDisabled` permet de désactiver la checkbox en conservant la possibilité de naviguer avec le clavier ou le lecteur d'écran. Il est préféré à l'attribut natif `disabled` qui empêche ces usages.
43
+ Un cursor `not-allowed` est défini sur la checkbox et son label lorsqu'elle est dans un état `disabled`.
38
44
 
39
45
  <Story of={ComponentStories.isDisabled} height={60} />
40
46
  <Story of={ComponentStories.checkedIsDisabled} height={60} />
41
47
  <Story of={ComponentStories.isIndeterminateIsDisabled} height={60} />
42
48
 
49
+ <Story of={ComponentStories.isDisabledVariantTile} height={100} />
50
+ <Story of={ComponentStories.checkedIsDisabledVariantTile} height={100} />
51
+ <Story of={ComponentStories.isIndeterminateIsDisabledVariantTile} height={100} />
52
+
43
53
  ## Autres tailles de police du label
44
54
 
45
55
  <br />
@@ -120,6 +120,24 @@ const FullWidthTemplate = (args) => {
120
120
  };
121
121
  };
122
122
 
123
+ const VariantTileTemplate = (args) => {
124
+ return {
125
+ template: hbs`{{! template-lint-disable no-inline-styles }}
126
+ <div
127
+ style='border: 1px solid var(--pix-neutral-500); padding: var(--pix-spacing-4x); width: 500px'
128
+ ><PixCheckbox
129
+ @id={{this.id}}
130
+ @isIndeterminate={{this.isIndeterminate}}
131
+ @checked={{this.checked}}
132
+ @isDisabled={{this.isDisabled}}
133
+ @variant='tile'
134
+ >
135
+ <:label>{{this.label}}</:label>
136
+ </PixCheckbox></div>`,
137
+ context: args,
138
+ };
139
+ };
140
+
123
141
  export const Default = Template.bind({});
124
142
  Default.args = {
125
143
  id: 'accept-newsletter',
@@ -139,6 +157,12 @@ FullWidth.args = {
139
157
  label: 'Une réponse',
140
158
  };
141
159
 
160
+ export const VariantTile = VariantTileTemplate.bind({});
161
+ VariantTile.args = {
162
+ id: 'proposal',
163
+ label: 'Une réponse',
164
+ };
165
+
142
166
  export const isIndeterminate = Template.bind({});
143
167
  isIndeterminate.args = {
144
168
  id: 'accept-newsletter-2',
@@ -185,6 +209,30 @@ isIndeterminateIsDisabled.args = {
185
209
  isIndeterminate: true,
186
210
  };
187
211
 
212
+ export const isDisabledVariantTile = VariantTileTemplate.bind({});
213
+ isDisabledVariantTile.args = {
214
+ id: 'accept-newsletter-2',
215
+ label: 'Recevoir la newsletter',
216
+ isDisabled: true,
217
+ };
218
+
219
+ export const checkedIsDisabledVariantTile = VariantTileTemplate.bind({});
220
+ checkedIsDisabledVariantTile.args = {
221
+ id: 'accept-newsletter-2',
222
+ label: 'Recevoir la newsletter',
223
+ isDisabled: true,
224
+ checked: true,
225
+ };
226
+
227
+ export const isIndeterminateIsDisabledVariantTile = VariantTileTemplate.bind({});
228
+ isIndeterminateIsDisabledVariantTile.args = {
229
+ id: 'accept-newsletter-2',
230
+ label: 'Recevoir la newsletter',
231
+ isDisabled: true,
232
+ checked: true,
233
+ isIndeterminate: true,
234
+ };
235
+
188
236
  const MultipleTemplate = (args) => {
189
237
  return {
190
238
  template: hbs`<PixCheckbox
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "46.6.3",
3
+ "version": "46.7.0",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -8,7 +8,7 @@
8
8
  "license": "MIT",
9
9
  "author": "GIP Pix",
10
10
  "engines": {
11
- "node": "^20.13.1"
11
+ "node": "^20.14.0"
12
12
  },
13
13
  "ember": {
14
14
  "edition": "octane"