@1024pix/pix-ui 33.1.0 → 34.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.
@@ -64,4 +64,4 @@ jobs:
64
64
  - restore_cache:
65
65
  name: Restore node modules
66
66
  key: node_modules
67
- - run: npm run chromatic -- --exit-zero-on-changes
67
+ - run: npm run chromatic -- --auto-accept-changes
@@ -1,12 +1,7 @@
1
1
  module.exports = {
2
- addons: [
3
- '@storybook/addon-essentials',
4
- '@storybook/addon-a11y',
5
- ],
6
- stories: [
7
- '../docs/**/*.stories.@(mdx)',
8
- '../app/**/*.stories.@(js|mdx)',
9
- ],
2
+ addons: ['@storybook/addon-essentials', '@storybook/addon-a11y'],
3
+ stories: ['../docs/**/*.stories.@(mdx)', '../app/**/*.stories.@(js|mdx)'],
4
+ staticDirs: ['../dist'],
10
5
  core: {
11
6
  builder: 'webpack5',
12
7
  },
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Pix-UI Changelog
2
2
 
3
+ ## v34.1.0 (05/05/2023)
4
+
5
+
6
+ ### :rocket: Amélioration
7
+ - [#397](https://github.com/1024pix/pix-ui/pull/397) [FEATURE] Améliorer le composant PixFilterbanner (PIX-7854)
8
+
9
+ ## v34.0.0 (04/05/2023)
10
+
11
+
12
+ ### :rocket: Amélioration
13
+ - [#393](https://github.com/1024pix/pix-ui/pull/393) [FEATURE] Uniformiser PixRadioButton et PixCheckbox (PIX-7900)
14
+
15
+ ### :building_construction: Tech
16
+ - [#354](https://github.com/1024pix/pix-ui/pull/354) [TECH] Améliorer l'expérience de dev
17
+ - [#394](https://github.com/1024pix/pix-ui/pull/394) [TECH] Rendre Chromatic non bloquant lors du run de la CI (PIX-7932)
18
+
19
+ ### :bug: Correction
20
+ - [#392](https://github.com/1024pix/pix-ui/pull/392) [BUGFIX] Éviter le rétrécissement des inputs checkbox et radio (PIX-7896).
21
+
3
22
  ## v33.1.0 (27/04/2023)
4
23
 
5
24
 
@@ -13,8 +13,8 @@
13
13
  class={{this.className}}
14
14
  {{on "click" this.triggerAction}}
15
15
  ...attributes
16
- disabled={{this.isButtonLoadingOrDisabled}}
17
- aria-disabled="{{this.ariaDisabled}}"
16
+ disabled={{this.isDisabled}}
17
+ aria-disabled="{{this.isDisabled}}"
18
18
  >
19
19
  {{#if this.isLoading}}
20
20
  <div class="loader loader--{{this.loadingColor}}">
@@ -21,21 +21,17 @@ export default class PixButton extends PixButtonBase {
21
21
  return this.args.loadingColor || this.args['loading-color'] || 'white';
22
22
  }
23
23
 
24
- get isButtonLoadingOrDisabled() {
24
+ get isDisabled() {
25
25
  return this.isLoading || this.args.isDisabled;
26
26
  }
27
27
 
28
- get ariaDisabled() {
29
- return this.isButtonLoadingOrDisabled;
30
- }
31
-
32
28
  get className() {
33
29
  return super.baseClassNames.join(' ');
34
30
  }
35
31
 
36
32
  @action
37
33
  async triggerAction(params) {
38
- if (this.type === 'submit' && !this.args.triggerAction) return;
34
+ if (this.isDisabled || (this.type === 'submit' && !this.args.triggerAction)) return;
39
35
  if (!this.args.triggerAction) {
40
36
  throw new Error('@triggerAction params is required for PixButton !');
41
37
  }
@@ -1,18 +1,17 @@
1
- <label class="pix-checkbox {{@class}}" for={{@id}}>
1
+ <div class="pix-checkbox {{@class}}">
2
2
  <input
3
- id={{@id}}
4
3
  type="checkbox"
4
+ id={{this.id}}
5
5
  class={{this.inputClasses}}
6
6
  checked={{@checked}}
7
7
  ...attributes
8
8
  />
9
9
 
10
- {{#if (has-block)}}
11
- <span class={{this.labelClasses}}>{{yield}}</span>
12
- {{else}}
13
- <span>
14
- yield required to give a label for PixCheckbox
15
- {{@id}}.
16
- </span>
17
- {{/if}}
18
- </label>
10
+ <label class={{this.labelClasses}} for={{this.id}}>
11
+ {{#if (has-block)}}
12
+ {{yield}}
13
+ {{else}}
14
+ <span>yield required to give a label for PixCheckbox.</span>
15
+ {{/if}}
16
+ </label>
17
+ </div>
@@ -1,12 +1,13 @@
1
1
  import Component from '@glimmer/component';
2
+ import { guidFor } from '@ember/object/internals';
2
3
 
3
4
  export default class PixCheckbox extends Component {
4
5
  constructor() {
5
6
  super(...arguments);
7
+ }
6
8
 
7
- if (!this.args.id || !this.args.id.toString().trim()) {
8
- throw new Error('ERROR in PixCheckbox component, @id param is not provided');
9
- }
9
+ get id() {
10
+ return this.args.id || guidFor(this);
10
11
  }
11
12
 
12
13
  get inputClasses() {
@@ -22,8 +22,7 @@
22
22
  @shape="squircle"
23
23
  @size="small"
24
24
  @triggerAction={{@onClearFilters}}
25
- @iconBefore="trash-can"
26
- @prefixIconBefore="far"
25
+ @isDisabled={{@isClearFilterButtonDisabled}}
27
26
  >
28
27
  {{@clearFiltersLabel}}
29
28
  </PixButton>
@@ -4,9 +4,11 @@ export default class PixFilterBanner extends Component {
4
4
  get displayTitle() {
5
5
  return Boolean(this.args.title);
6
6
  }
7
+
7
8
  get displayDetails() {
8
9
  return Boolean(this.args.details);
9
10
  }
11
+
10
12
  get displayClearFilters() {
11
13
  return Boolean(this.args.clearFiltersLabel);
12
14
  }
@@ -1,10 +1,16 @@
1
- <label class="pix-radio-button">
1
+ <div class="pix-radio-button {{@class}}">
2
2
  <input
3
- class="pix-radio-button__input"
4
3
  type="radio"
4
+ id={{this.id}}
5
+ class="pix-radio-button__input"
5
6
  value={{@value}}
6
- disabled={{@isDisabled}}
7
7
  ...attributes
8
8
  />
9
- <span class="pix-radio-button__label">{{@label}}</span>
10
- </label>
9
+ <label class="pix-radio-button__label" for={{this.id}}>
10
+ {{#if (has-block)}}
11
+ {{yield}}
12
+ {{else}}
13
+ <span>yield required to give a label for PixRadioButton.</span>
14
+ {{/if}}
15
+ </label>
16
+ </div>
@@ -1,5 +1,10 @@
1
1
  import Component from '@glimmer/component';
2
+ import { guidFor } from '@ember/object/internals';
2
3
 
3
4
  export default class PixRadioButton extends Component {
4
5
  text = 'pix-radio-button';
6
+
7
+ get id() {
8
+ return this.args.id || guidFor(this);
9
+ }
5
10
  }
@@ -4,7 +4,6 @@
4
4
  align-items: center;
5
5
  display: flex;
6
6
  color: $pix-neutral-70;
7
- cursor: pointer;
8
7
 
9
8
  & + .pix-checkbox {
10
9
  margin-top: $pix-spacing-s;
@@ -17,6 +16,7 @@
17
16
  color: $pix-neutral-90;
18
17
  font-size: 1rem;
19
18
  line-height: 1.5;
19
+ cursor: pointer;
20
20
 
21
21
  &--small {
22
22
  font-size: 0.875rem;
@@ -32,6 +32,7 @@
32
32
  position: relative;
33
33
  width: 1rem;
34
34
  height: 1rem;
35
+ flex-shrink: 0;
35
36
  background-color: $pix-neutral-0;
36
37
  border: 1.5px solid $pix-neutral-70;
37
38
  border-radius: 2px;
@@ -1,7 +1,6 @@
1
1
  .pix-radio-button {
2
2
  display: flex;
3
3
  align-items: center;
4
- cursor: pointer;
5
4
 
6
5
  & + .pix-radio-button {
7
6
  margin-top: $pix-spacing-s;
@@ -12,16 +11,19 @@
12
11
  color: $pix-neutral-90;
13
12
  font-size: 1rem;
14
13
  line-height: 1.5;
14
+ cursor: pointer;
15
15
  }
16
16
 
17
17
  &__input {
18
18
  position: relative;
19
19
  width: 1rem;
20
20
  height: 1rem;
21
+ flex-shrink: 0;
21
22
  background-color: $pix-neutral-0;
22
23
  border: 1.5px solid $pix-neutral-70;
23
24
  border-radius: 50%;
24
25
  appearance: none;
26
+ cursor: pointer;
25
27
 
26
28
  // Hover effect
27
29
  &::before {
@@ -5,6 +5,7 @@ export const Template = (args) => {
5
5
  template: hbs`
6
6
  <PixCheckbox
7
7
  @id={{this.id}}
8
+ @class={{this.class}}
8
9
  @screenReaderOnly={{this.screenReaderOnly}}
9
10
  @isIndeterminate={{this.isIndeterminate}}
10
11
  @labelSize={{this.labelSize}}
@@ -75,6 +76,7 @@ export const MultipleTemplate = (args) => {
75
76
  template: hbs`
76
77
  <PixCheckbox
77
78
  @id="one"
79
+ @class={{this.class}}
78
80
  @screenReaderOnly={{this.screenReaderOnly}}
79
81
  @isIndeterminate={{this.isIndeterminate}}
80
82
  @labelSize={{this.labelSize}}
@@ -85,6 +87,7 @@ export const MultipleTemplate = (args) => {
85
87
  </PixCheckbox>
86
88
  <PixCheckbox
87
89
  @id="two"
90
+ @class={{this.class}}
88
91
  @screenReaderOnly={{this.screenReaderOnly}}
89
92
  @isIndeterminate={{this.isIndeterminate}}
90
93
  @labelSize={{this.labelSize}}
@@ -106,8 +109,9 @@ multiple.args = {
106
109
  export const argTypes = {
107
110
  id: {
108
111
  name: 'id',
109
- description: 'Identifiant du champ permettant de lui attacher un label',
110
- type: { name: 'string', required: true },
112
+ description:
113
+ 'Identifiant du champ permettant de lui attacher un label. Généré automatiquement si non renseigné.',
114
+ type: { name: 'string' },
111
115
  },
112
116
  label: {
113
117
  name: 'label',
@@ -115,7 +119,7 @@ export const argTypes = {
115
119
  },
116
120
  class: {
117
121
  name: 'class',
118
- description: "Permet d'ajouter une classe css à la checkbox.",
122
+ description: "Permet d'ajouter une classe au parent du composant.",
119
123
  type: { name: 'string' },
120
124
  },
121
125
  screenReaderOnly: {
@@ -59,7 +59,6 @@ En ce sens, nous avons déjà prévu un espace vertical pour séparer 2 composan
59
59
 
60
60
  ```html
61
61
  <PixCheckbox
62
- @id="superId"
63
62
  @screenReaderOnly="{{false}}"
64
63
  @isIndeterminate="{{false}}"
65
64
  @labelSize="small"
@@ -8,6 +8,7 @@ export const filterBanner = (args) => {
8
8
  @details={{this.details}}
9
9
  @clearFiltersLabel={{this.clearFiltersLabel}}
10
10
  @onClearFilters={{this.onClearFilters}}
11
+ @isClearFilterButtonDisabled={{this.isClearFilterButtonDisabled}}
11
12
  >
12
13
  <PixSelect @options={{this.options}} @onChange={{this.onChange}} @label="mon label" @screenReaderOnly={{true}} @placeholder="placeholer"/>
13
14
  <PixSelect @options={{this.options}} @onChange={{this.onChange}} @label="mon label" @screenReaderOnly={{true}} @placeholder="placeholer"/>
@@ -49,4 +50,14 @@ export const argTypes = {
49
50
  description: 'fonction à appeler pour déclencher l’action de suppression des filtres',
50
51
  type: { required: false },
51
52
  },
53
+ isClearFilterButtonDisabled: {
54
+ name: 'isClearFilterButtonDisabled',
55
+ description: 'Désactiver le button de la suppresion des filtres',
56
+ type: { name: 'boolean', required: true },
57
+ control: { type: 'boolean' },
58
+ table: {
59
+ type: { summary: 'boolean' },
60
+ defaultValue: { summary: false },
61
+ },
62
+ },
52
63
  };
@@ -3,7 +3,15 @@ import { hbs } from 'ember-cli-htmlbars';
3
3
  /* Default stories */
4
4
  const Template = (args) => {
5
5
  return {
6
- template: hbs`<PixRadioButton @label={{this.label}} @value={{this.value}} @isDisabled={{this.isDisabled}} />`,
6
+ template: hbs`
7
+ <PixRadioButton
8
+ @value={{this.value}}
9
+ @id={{this.id}}
10
+ @class={{this.class}}
11
+ disabled={{this.disabled}}
12
+ >
13
+ {{this.label}}
14
+ </PixRadioButton>`,
7
15
  context: args,
8
16
  };
9
17
  };
@@ -16,13 +24,14 @@ Default.args = {
16
24
  export const isDisabled = Template.bind({});
17
25
  isDisabled.args = {
18
26
  ...Default.args,
19
- isDisabled: true,
27
+ disabled: true,
20
28
  };
21
29
 
22
30
  /* Checked stories */
23
31
  const checked = (args) => {
24
32
  return {
25
- template: hbs`<PixRadioButton @label={{this.label}} @isDisabled={{this.isDisabled}} checked />`,
33
+ template: hbs`
34
+ <PixRadioButton @value={{this.value}} disabled={{this.disabled}} checked>{{this.label}}</PixRadioButton>`,
26
35
  context: args,
27
36
  };
28
37
  };
@@ -30,7 +39,7 @@ const checked = (args) => {
30
39
  export const disabledChecked = checked.bind({});
31
40
  disabledChecked.args = {
32
41
  ...Default.args,
33
- isDisabled: true,
42
+ disabled: true,
34
43
  };
35
44
 
36
45
  export const defaultChecked = checked.bind({});
@@ -40,9 +49,9 @@ defaultChecked.args = Default.args;
40
49
  const multipleTemplate = (args) => {
41
50
  return {
42
51
  template: hbs`
43
- <PixRadioButton @label={{this.label}} @isDisabled={{this.isDisabled}} name="radio" />
44
- <PixRadioButton @label={{this.label}} @isDisabled={{this.isDisabled}} name="radio" />
45
- <PixRadioButton @label={{this.label}} @isDisabled={{this.isDisabled}} name="radio" />
52
+ <PixRadioButton disabled={{this.disabled}} name="radio">{{this.label}}</PixRadioButton>
53
+ <PixRadioButton disabled={{this.disabled}} name="radio">{{this.label}}</PixRadioButton>
54
+ <PixRadioButton disabled={{this.disabled}} name="radio">{{this.label}}</PixRadioButton>
46
55
  `,
47
56
  context: args,
48
57
  };
@@ -54,18 +63,29 @@ multiple.args = {
54
63
  };
55
64
 
56
65
  export const argTypes = {
66
+ id: {
67
+ name: 'id',
68
+ description:
69
+ 'Identifiant du champ permettant de lui attacher un label. Généré automatiquement si non renseigné.',
70
+ type: { name: 'string' },
71
+ },
57
72
  label: {
58
73
  name: 'label',
59
74
  description: 'Le label du bouton radio',
60
75
  type: { name: 'string', required: true },
61
76
  },
77
+ class: {
78
+ name: 'class',
79
+ description: "Permet d'ajouter une classe CSS au parent du composant.",
80
+ type: { name: 'string' },
81
+ },
62
82
  value: {
63
83
  name: 'value',
64
84
  description: "Valeur permettant d'identifier l'option sélectionnée",
65
85
  type: { name: 'string', required: false },
66
86
  },
67
- isDisabled: {
68
- name: 'isDisabled',
87
+ disabled: {
88
+ name: 'disabled',
69
89
  description: 'Pour désactiver/activer le bouton radio',
70
90
  type: { name: 'boolean', required: false },
71
91
  table: {
@@ -27,7 +27,7 @@ Pour les considérer comme un seul groupe d'inputs, **il est nécessaire qu'ils
27
27
  <Story name="Multiple" story={stories.multiple} height={140} />
28
28
  </Canvas>
29
29
 
30
- ## IsDisabled
30
+ ## Disabled
31
31
 
32
32
  État inactif du bouton radio.
33
33
 
@@ -39,12 +39,7 @@ Pour les considérer comme un seul groupe d'inputs, **il est nécessaire qu'ils
39
39
  ## Usage
40
40
 
41
41
  ```html
42
- <PixRadioButton
43
- name="input-name"
44
- @label="{{label}}"
45
- @value="{{value}}"
46
- @isDisabled="{{isDisabled}}"
47
- />
42
+ <PixRadioButton name="input-name" @value="{{value}}"> Exemple de label </PixRadioButton>
48
43
  ```
49
44
 
50
45
  ## Arguments
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "33.1.0",
3
+ "version": "34.1.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"
@@ -26,8 +26,8 @@
26
26
  "build": "./scripts/build.sh",
27
27
  "build-ember": "ember build --environment=production",
28
28
  "serve-ember": "ember serve",
29
- "build-storybook": "ember build && cp -v CNAME dist && build-storybook -s dist",
30
- "serve-storybook": "start-storybook --port 9001 --static-dir dist",
29
+ "build-storybook": "ember build && cp -v CNAME dist && build-storybook",
30
+ "serve-storybook": "start-storybook --port 9001",
31
31
  "clean": "rm -rf dist node_modules",
32
32
  "deploy-storybook": "storybook-to-ghpages",
33
33
  "lint": "npm-run-all --aggregate-output --parallel --continue-on-error 'lint:!(fix)'",