@1024pix/pix-ui 46.6.4 → 46.8.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
 
@@ -7,6 +7,7 @@
7
7
  @screenReaderOnly={{@screenReaderOnly}}
8
8
  @isDisabled={{this.isDisabled}}
9
9
  @inlineLabel={{true}}
10
+ @variant={{@variant}}
10
11
  >
11
12
  <:inputElement>
12
13
  <input
@@ -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
@@ -24,12 +24,16 @@ Pour les considérer comme un seul groupe d'inputs, **il est nécessaire qu'ils
24
24
 
25
25
  <Story of={ComponentStories.multiple} height={140} />
26
26
 
27
- ### Dimensions du label
27
+ ### Variations graphiques du composant
28
28
 
29
- PixRadioButton prend tout l'espace à sa disposition.
29
+ Le PixRadioButton prend toute la largeur à sa disposition.
30
30
 
31
31
  <Story of={ComponentStories.FullWidth} height={100} />
32
32
 
33
+ Si le paramètre `variant` est précisé avec la valeur `tile`, le radiobutton et son label sont visuellement regroupés dans un ensemble intégralement cliquable.
34
+
35
+ <Story of={ComponentStories.VariantTile} height={100} />
36
+
33
37
  ## Disabled
34
38
 
35
39
  L'attribut `@isDisabled` permet de désactiver la radio 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.
@@ -114,6 +114,23 @@ const FullWidthTemplate = (args) => {
114
114
  };
115
115
  };
116
116
 
117
+ const VariantTileTemplate = (args) => {
118
+ return {
119
+ template: hbs`{{! template-lint-disable no-inline-styles }}
120
+ <div
121
+ style='border: 1px solid var(--pix-neutral-500); background: var(--pix-neutral-20); padding: var(--pix-spacing-4x); width: 500px'
122
+ ><PixRadioButton
123
+ @id={{this.id}}
124
+ @isDisabled={{this.isDisabled}}
125
+ checked={{this.checked}}
126
+ @variant='tile'
127
+ >
128
+ <:label>{{this.label}}</:label>
129
+ </PixRadioButton></div>`,
130
+ context: args,
131
+ };
132
+ };
133
+
117
134
  export const Default = Template.bind({});
118
135
  Default.args = {
119
136
  label: 'Poivron',
@@ -130,12 +147,25 @@ FullWidth.args = {
130
147
  label: 'Une réponse',
131
148
  };
132
149
 
150
+ export const VariantTile = VariantTileTemplate.bind({});
151
+ VariantTile.args = {
152
+ id: 'proposal',
153
+ label: 'Une réponse',
154
+ };
155
+
133
156
  export const isDisabled = Template.bind({});
134
157
  isDisabled.args = {
135
158
  ...Default.args,
136
159
  isDisabled: true,
137
160
  };
138
161
 
162
+ export const isDisabledVariantTile = VariantTileTemplate.bind({});
163
+ isDisabledVariantTile.args = {
164
+ id: 'accept-newsletter-2',
165
+ label: 'Recevoir la newsletter',
166
+ isDisabled: true,
167
+ };
168
+
139
169
  export const checkedIsDisabled = Template.bind({});
140
170
  checkedIsDisabled.args = {
141
171
  ...Default.args,
@@ -143,6 +173,14 @@ checkedIsDisabled.args = {
143
173
  checked: true,
144
174
  };
145
175
 
176
+ export const checkedIsDisabledVariantTile = VariantTileTemplate.bind({});
177
+ checkedIsDisabledVariantTile.args = {
178
+ id: 'accept-newsletter-2',
179
+ label: 'Recevoir la newsletter',
180
+ isDisabled: true,
181
+ checked: true,
182
+ };
183
+
146
184
  /* Multiple components story */
147
185
  const multipleTemplate = (args) => {
148
186
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "46.6.4",
3
+ "version": "46.8.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"