@1024pix/pix-ui 46.3.1 → 46.3.2

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.
@@ -1,15 +1,5 @@
1
1
  <div class="pix-checkbox {{@class}}">
2
- <input
3
- type="checkbox"
4
- id={{this.id}}
5
- class={{this.inputClasses}}
6
- checked={{@checked}}
7
- aria-disabled={{this.isDisabled}}
8
- {{on "click" this.avoidCheckedStateChangeIfIsDisabled}}
9
- ...attributes
10
- />
11
-
12
- <PixLabel
2
+ <PixLabelWrapped
13
3
  @for={{this.id}}
14
4
  @requiredLabel={{@requiredLabel}}
15
5
  @subLabel={{@subLabel}}
@@ -18,6 +8,19 @@
18
8
  @screenReaderOnly={{@screenReaderOnly}}
19
9
  @isDisabled={{this.isDisabled}}
20
10
  >
21
- {{yield to="label"}}
22
- </PixLabel>
11
+ <:inputElement>
12
+ <input
13
+ type="checkbox"
14
+ id={{this.id}}
15
+ class={{this.inputClasses}}
16
+ checked={{@checked}}
17
+ aria-disabled={{this.isDisabled}}
18
+ {{on "click" this.avoidCheckedStateChangeIfIsDisabled}}
19
+ ...attributes
20
+ />
21
+ </:inputElement>
22
+ <:default>
23
+ {{yield to="label"}}
24
+ </:default>
25
+ </PixLabelWrapped>
23
26
  </div>
@@ -0,0 +1,15 @@
1
+ <label for={{@for}} class={{this.className}} ...attributes>
2
+ {{yield to="inputElement"}}
3
+
4
+ <span class="{{if @screenReaderOnly 'screen-reader-only'}}">
5
+ {{#if @requiredLabel}}
6
+ <abbr title={{@requiredLabel}} class="mandatory-mark">*</abbr>
7
+ {{/if}}
8
+
9
+ {{yield}}
10
+
11
+ {{#if @subLabel}}
12
+ <span class="pix-label__sub-label">{{@subLabel}}</span>
13
+ {{/if}}
14
+ </span>
15
+ </label>
@@ -0,0 +1,16 @@
1
+ import Component from '@glimmer/component';
2
+
3
+ export default class PixLabelWrapped extends Component {
4
+ get className() {
5
+ const classes = ['pix-label', 'pix-label--wrapped'];
6
+
7
+ if (this.args.inlineLabel) classes.push('pix-label--inline-label');
8
+ if (this.args.isDisabled) classes.push('pix-label--disabled');
9
+
10
+ const size = ['small', 'large'].includes(this.args.size) ? this.args.size : 'default';
11
+
12
+ classes.push(`pix-label--${size}`);
13
+
14
+ return classes.join(' ');
15
+ }
16
+ }
@@ -1,15 +1,5 @@
1
1
  <div class="pix-radio-button {{@class}}">
2
- <input
3
- type="radio"
4
- id={{this.id}}
5
- class="pix-radio-button__input"
6
- value={{@value}}
7
- aria-disabled={{this.isDisabled}}
8
- {{on "click" this.avoidCheckedStateChangeIfIsDisabled}}
9
- ...attributes
10
- />
11
-
12
- <PixLabel
2
+ <PixLabelWrapped
13
3
  @for={{this.id}}
14
4
  @requiredLabel={{@requiredLabel}}
15
5
  @subLabel={{@subLabel}}
@@ -18,6 +8,19 @@
18
8
  @isDisabled={{this.isDisabled}}
19
9
  @inlineLabel={{true}}
20
10
  >
21
- {{yield to="label"}}
22
- </PixLabel>
11
+ <:inputElement>
12
+ <input
13
+ type="radio"
14
+ id={{this.id}}
15
+ class="pix-radio-button__input"
16
+ value={{@value}}
17
+ aria-disabled={{this.isDisabled}}
18
+ {{on "click" this.avoidCheckedStateChangeIfIsDisabled}}
19
+ ...attributes
20
+ />
21
+ </:inputElement>
22
+ <:default>
23
+ {{yield to="label"}}
24
+ </:default>
25
+ </PixLabelWrapped>
23
26
  </div>
@@ -1,8 +1,6 @@
1
1
  .pix-checkbox {
2
2
  position: relative;
3
3
  z-index: 0;
4
- display: flex;
5
- align-items: center;
6
4
 
7
5
  & + .pix-checkbox {
8
6
  margin-top: var(--pix-spacing-4x);
@@ -3,6 +3,12 @@
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
+
6
12
  &--disabled {
7
13
  color: var(--pix-neutral-500);
8
14
  }
@@ -20,8 +26,6 @@
20
26
  }
21
27
 
22
28
  &--inline-label {
23
- margin: 0;
24
- padding: 0 var(--pix-spacing-2x);
25
29
  font-weight: var(--pix-font-normal);
26
30
  }
27
31
 
@@ -1,8 +1,6 @@
1
1
  .pix-radio-button {
2
2
  position: relative;
3
3
  z-index: 0;
4
- display: flex;
5
- align-items: center;
6
4
 
7
5
  & + .pix-radio-button {
8
6
  margin-top: var(--pix-spacing-4x);
@@ -0,0 +1 @@
1
+ export { default } from '@1024pix/pix-ui/components/pix-label-wrapped';
@@ -18,6 +18,12 @@ En ce sens, nous avons déjà prévu un espace vertical pour séparer 2 composan
18
18
 
19
19
  <Story of={ComponentStories.multiple} height={140} />
20
20
 
21
+ ### Dimensions du label
22
+
23
+ La PixCheckbox prend tout l'espace à sa disposition.
24
+
25
+ <Story of={ComponentStories.FullWidth} height={100} />
26
+
21
27
  ## États de la Checkbox
22
28
 
23
29
  <br />
@@ -108,6 +108,18 @@ const Template = (args) => {
108
108
  };
109
109
  };
110
110
 
111
+ const FullWidthTemplate = (args) => {
112
+ return {
113
+ template: hbs`{{! template-lint-disable no-inline-styles }}
114
+ <div
115
+ style='border: 1px solid var(--pix-neutral-500); background: var(--pix-neutral-20); padding: var(--pix-spacing-4x); width: 500px'
116
+ ><PixCheckbox @id={{this.id}} @isIndeterminate={{false}}>
117
+ <:label>{{this.label}}</:label>
118
+ </PixCheckbox></div>`,
119
+ context: args,
120
+ };
121
+ };
122
+
111
123
  export const Default = Template.bind({});
112
124
  Default.args = {
113
125
  id: 'accept-newsletter',
@@ -121,6 +133,12 @@ DefaultChecked.args = {
121
133
  checked: true,
122
134
  };
123
135
 
136
+ export const FullWidth = FullWidthTemplate.bind({});
137
+ FullWidth.args = {
138
+ id: 'proposal',
139
+ label: 'Une réponse',
140
+ };
141
+
124
142
  export const isIndeterminate = Template.bind({});
125
143
  isIndeterminate.args = {
126
144
  id: 'accept-newsletter-2',
@@ -6,6 +6,7 @@ import * as ComponentStories from './pix-label.stories';
6
6
  # Pix Label
7
7
 
8
8
  Le `PixLabel` permet de créer label pour un input donnée.
9
+ Il existe une version `PixLabelWrapped` pour les `PixCheckox` / `PixRadioButton` qui permet d'inclure l'`input` à l'intérieur du son `label`
9
10
 
10
11
  ## Accessibilité
11
12
 
@@ -24,6 +24,12 @@ 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
28
+
29
+ PixRadioButton prend tout l'espace à sa disposition.
30
+
31
+ <Story of={ComponentStories.FullWidth} height={100} />
32
+
27
33
  ## Disabled
28
34
 
29
35
  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.
@@ -102,6 +102,18 @@ const Template = (args) => {
102
102
  };
103
103
  };
104
104
 
105
+ const FullWidthTemplate = (args) => {
106
+ return {
107
+ template: hbs`{{! template-lint-disable no-inline-styles }}
108
+ <div
109
+ style='border: 1px solid var(--pix-neutral-500); background: var(--pix-neutral-20); padding: var(--pix-spacing-4x); width: 500px'
110
+ ><PixRadioButton @id={{this.id}}>
111
+ <:label>{{this.label}}</:label>
112
+ </PixRadioButton></div>`,
113
+ context: args,
114
+ };
115
+ };
116
+
105
117
  export const Default = Template.bind({});
106
118
  Default.args = {
107
119
  label: 'Poivron',
@@ -113,6 +125,11 @@ defaultChecked.args = {
113
125
  checked: true,
114
126
  };
115
127
 
128
+ export const FullWidth = FullWidthTemplate.bind({});
129
+ FullWidth.args = {
130
+ label: 'Une réponse',
131
+ };
132
+
116
133
  export const isDisabled = Template.bind({});
117
134
  isDisabled.args = {
118
135
  ...Default.args,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "46.3.1",
3
+ "version": "46.3.2",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"