@1024pix/pix-ui 26.0.2 → 26.0.4

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Pix-UI Changelog
2
2
 
3
+ ## v26.0.4 (20/02/2023)
4
+
5
+
6
+ ### :building_construction: Tech
7
+ - [#335](https://github.com/1024pix/pix-ui/pull/335) [TECH] Améliorations techniques diverses
8
+
9
+ ### :bug: Correction
10
+ - [#340](https://github.com/1024pix/pix-ui/pull/340) [BUGFIX] Ne pas permettre le focus de l'option par défaut cachée du PixSelect (PIX-7196)
11
+
12
+ ## v26.0.3 (16/02/2023)
13
+
14
+
15
+ ### :bug: Correction
16
+ - [#337](https://github.com/1024pix/pix-ui/pull/337) [BUGFIX] utiliser la font-size du navigateur pour le calcul de la taille du PixSelect (PIX-7128)
17
+
3
18
  ## v26.0.2 (14/02/2023)
4
19
 
5
20
 
@@ -66,7 +66,7 @@
66
66
  ' pix-select-options-category__option--selected'
67
67
  }}{{unless this.displayDefaultOption ' pix-select-options-category__option--hidden'}}"
68
68
  role="option"
69
- tabindex={{if this.isExpanded "0" "-1"}}
69
+ tabindex={{if this.isDefaultOptionHidden "-1" "0"}}
70
70
  aria-selected={{if @value "false" "true"}}
71
71
  {{on "click" (fn this.onChange this.defaultOption)}}
72
72
  {{on-enter-action (fn this.onChange this.defaultOption)}}
@@ -33,6 +33,10 @@ export default class PixSelect extends Component {
33
33
  return !this.searchValue && !this.args.hideDefaultOption;
34
34
  }
35
35
 
36
+ get isDefaultOptionHidden() {
37
+ return !this.isExpanded || this.args.hideDefaultOption;
38
+ }
39
+
36
40
  get className() {
37
41
  const classes = ['pix-select-button'];
38
42
  if (this.args.className) {
@@ -158,8 +162,10 @@ export default class PixSelect extends Component {
158
162
 
159
163
  @action
160
164
  setSelectWidth() {
161
- const baseFontRemRatio = 16;
162
- const checkIconWidth = 16;
165
+ const baseFontRemRatio = Number(
166
+ getComputedStyle(document.querySelector('html')).fontSize.match(/\d+(\.\d+)?/)[0]
167
+ );
168
+ const checkIconWidth = 1.125 * baseFontRemRatio;
163
169
  const listWidth = document.getElementById(this.listId).getBoundingClientRect().width;
164
170
  const selectWidth = (listWidth + checkIconWidth) / baseFontRemRatio;
165
171
 
@@ -13,11 +13,10 @@
13
13
  &__dropdown {
14
14
  z-index: 200;
15
15
  position: absolute;
16
- border-top: none;
17
- border-radius: 0 0 4px 4px;
18
- overflow-y: auto;
19
16
  max-height: 200px;
20
17
  width: inherit;
18
+ border-top: none;
19
+ border-radius: 0 0 4px 4px;
21
20
  list-style-type: none;
22
21
  padding: 0;
23
22
  background-color: $pix-neutral-0;
@@ -69,6 +68,8 @@
69
68
  }
70
69
 
71
70
  &__options {
71
+ overflow-y: auto;
72
+ max-height: inherit;
72
73
  border-top: 1px solid $pix-neutral-20;
73
74
  }
74
75
 
@@ -1,4 +1,5 @@
1
1
  import { hbs } from 'ember-cli-htmlbars';
2
+ import { action } from '@storybook/addon-actions';
2
3
 
3
4
  const Template = (args) => {
4
5
  return {
@@ -35,46 +36,22 @@ Default.args = {
35
36
  { value: '4', label: 'Steak', category: 'Hamburger' },
36
37
  { value: '5', label: 'Cheddar', category: 'Hamburger' },
37
38
  ],
38
- onChange: () => {},
39
+ onChange: action('onChange'),
39
40
  categoriesLabel: 'Mon multi select label',
40
41
  categoriesPlaceholder: 'Mon multi select placeholder',
41
42
  };
42
43
 
43
44
  export const Searchable = Template.bind({});
44
45
  Searchable.args = {
45
- label: 'Are you hungry?',
46
- subLabel: 'To help you choose your food, you can filter on different categories',
47
- placeholder: 'Mon select placeholder',
46
+ ...Default.args,
48
47
  isSearchable: true,
49
- options: [
50
- { value: '1', label: 'Salade', category: 'Kebab' },
51
- { value: '2', label: 'Tomate', category: 'Kebab' },
52
- { value: '3', label: 'Oignons', category: 'Kebab' },
53
- { value: '4', label: 'Steak', category: 'Hamburger' },
54
- { value: '5', label: 'Cheddar', category: 'Hamburger' },
55
- ],
56
- onChange: () => {},
57
- categoriesLabel: 'Mon multi select label',
58
- categoriesPlaceholder: 'Mon multi select placeholder',
59
48
  };
60
49
 
61
50
  export const WithLabelsOnlyForScreenReaders = Template.bind({});
62
51
  WithLabelsOnlyForScreenReaders.args = {
63
- label: 'Are you hungry?',
64
- subLabel: 'To help you choose your food, you can filter on different categories',
52
+ ...Default.args,
65
53
  screenReaderOnly: true,
66
- placeholder: 'Mon select placeholder',
67
54
  isSearchable: true,
68
- options: [
69
- { value: '1', label: 'Salade', category: 'Kebab' },
70
- { value: '2', label: 'Tomate', category: 'Kebab' },
71
- { value: '3', label: 'Oignons', category: 'Kebab' },
72
- { value: '4', label: 'Steak', category: 'Hamburger' },
73
- { value: '5', label: 'Cheddar', category: 'Hamburger' },
74
- ],
75
- onChange: () => {},
76
- categoriesLabel: 'Mon multi select label',
77
- categoriesPlaceholder: 'Mon multi select placeholder',
78
55
  };
79
56
 
80
57
  export const argTypes = {
@@ -46,8 +46,11 @@ const DEFAULT_OPTIONS = [
46
46
 
47
47
  export const Default = Template.bind({});
48
48
  Default.args = {
49
+ label: 'Label du champ',
49
50
  options: DEFAULT_OPTIONS,
50
51
  onChange: action('onChange'),
52
+ emptyMessage: 'pas de résultat',
53
+ values: ['1', '3'],
51
54
  placeholder: 'placeholder',
52
55
  };
53
56
 
@@ -76,6 +79,7 @@ export const multiSelectWithChildComponent = (args) => {
76
79
  };
77
80
 
78
81
  multiSelectWithChildComponent.args = {
82
+ ...Default.args,
79
83
  placeholder: 'Sélectionner le niveau souhaité',
80
84
  label: 'Résultat évaluation',
81
85
  options: [
@@ -149,59 +153,53 @@ export const argTypes = {
149
153
  description:
150
154
  'Rempli le contenu interne du composant, `placeholder` pour `isSearchable` `true`, sinon rawContent du `button`',
151
155
  type: { name: 'string', required: true },
152
- defaultValue: 'Rechercher un condiment',
153
156
  },
154
157
  label: {
155
158
  name: 'label',
156
159
  description:
157
160
  "Donne un label au champ qui sera celui vocalisé par le lecteur d'écran. **⚠️ Le`label` est obligatoire que si l'`id` n'est pas donné. ⚠️**",
158
161
  type: { name: 'string' },
159
- defaultValue: 'Label du champ',
160
162
  },
161
163
  screenReaderOnly: {
162
164
  name: 'screenReaderOnly',
163
165
  description: "Permet de cacher à l'écran le label tout en restant vocalisable",
164
166
  type: { name: 'boolean', required: false },
165
- defaultValue: false,
167
+ table: { defaultValue: { summary: false } },
166
168
  },
167
169
  emptyMessage: {
168
170
  name: 'emptyMessage',
169
171
  description:
170
172
  'Un intitulé de choix indisponible (dans le cas ou certains filtres seraient excluant)',
171
173
  type: { name: 'string', required: true },
172
- defaultValue: 'pas de résultat',
173
174
  },
174
175
  options: {
175
176
  name: 'options',
176
177
  description:
177
178
  'Les options sont représentées par un tableau d‘objet contenant les propriétés ``value`` et ``label``. ``value`` doit être de type ``String`` pour être conforme au traitement des input value.',
178
179
  type: { name: 'array', required: false },
179
- defaultValue: DEFAULT_OPTIONS,
180
180
  },
181
181
  onChange: {
182
182
  name: 'onChange',
183
183
  description: "Une fonction permettant d'effectuer une action à chaque sélection",
184
184
  type: { required: true },
185
- defaultValue: action('onChange'),
186
185
  },
187
186
  values: {
188
187
  name: 'values',
189
188
  description: 'Une pré-sélection peut être donnée au composant',
190
189
  type: { name: 'array', required: false },
191
- defaultValue: ['1', '4'],
192
190
  },
193
191
  isSearchable: {
194
192
  name: 'isSearchable',
195
193
  description: 'Permet de rajouter une saisie utilisateur pour faciliter la recherche',
196
194
  type: { name: 'boolean', required: false },
197
- defaultValue: true,
195
+ table: { defaultValue: { summary: false } },
198
196
  },
199
197
  strictSearch: {
200
198
  name: 'strictSearch',
201
199
  description:
202
200
  'Permet de rendre sensible à la casse et au diacritiques lorsque ``isSearchable`` à ``true``',
203
201
  type: { name: 'boolean', required: false },
204
- defaultValue: false,
202
+ table: { defaultValue: { summary: false } },
205
203
  },
206
204
  className: {
207
205
  name: 'className',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "26.0.2",
3
+ "version": "26.0.4",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"