@1024pix/pix-ui 23.1.1 → 23.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Pix-UI Changelog
2
2
 
3
+ ## v23.1.2 (16/12/2022)
4
+
5
+
6
+ ### :bug: Correction
7
+ - [#308](https://github.com/1024pix/pix-ui/pull/308) [BUGFIX] Support de l'état `disabled` et correction de la taille de l'élement Pix Select
8
+
9
+ ### :coffee: Autre
10
+ - [#310](https://github.com/1024pix/pix-ui/pull/310) [DOCS] Ajout infos v20.2.4 au changelog
11
+
3
12
  ## v23.1.1 (15/12/2022)
4
13
 
5
14
 
@@ -90,6 +99,12 @@ Ember v4 obligatoire.
90
99
  - [#278](https://github.com/1024pix/pix-ui/pull/278) [BREAKING CHANGES][TECH] Améliorer le composant PixMultiSelect (Pix-6025)
91
100
  - [#266](https://github.com/1024pix/pix-ui/pull/266) [BREAKING CHANGES][FEATURE] Créer un nouveau PixSelect accessible basé sur PixDropdown/PixSelect (Pix-6018)
92
101
 
102
+ ## v20.2.4 (16/12/2022)
103
+
104
+
105
+ ### :coffee: Autre
106
+ - [f9a35c](https://github.com/1024pix/pix-ui/commit/f9a35c4787dc2ae6c7fa62e2cb538bfec84982a9) Relaxer nos version Node.js et npm
107
+
93
108
  ## v20.2.3 (15/11/2022)
94
109
 
95
110
 
@@ -31,6 +31,7 @@
31
31
  {{on "click" this.toggleDropdown}}
32
32
  aria-expanded={{this.isAriaExpanded}}
33
33
  aria-controls={{this.listId}}
34
+ aria-disabled={{@isDisabled}}
34
35
  >
35
36
  {{this.placeholder}}
36
37
 
@@ -59,22 +60,20 @@
59
60
  </div>
60
61
  {{/if}}
61
62
  <div role="listbox" id={{this.listId}} class="pix-select__options">
62
- {{#if this.displayDefaultOption}}
63
- <li
64
- class="pix-select-options-category__option{{unless
65
- @value
66
- ' pix-select-options-category__option--selected'
67
- }}"
68
- role="option"
69
- tabindex={{if this.isExpanded "0" "-1"}}
70
- aria-selected={{if @value "false" "true"}}
71
- {{on "click" (fn this.onChange this.defaultOption)}}
72
- {{on-enter-action (fn this.onChange this.defaultOption)}}
73
- {{on-space-action (fn this.onChange this.defaultOption)}}
74
- >
75
- {{@placeholder}}
76
- </li>
77
- {{/if}}
63
+ <li
64
+ class="pix-select-options-category__option{{unless
65
+ @value
66
+ ' pix-select-options-category__option--selected'
67
+ }}{{unless this.displayDefaultOption ' pix-select-options-category__option--hidden'}}"
68
+ role="option"
69
+ tabindex={{if this.isExpanded "0" "-1"}}
70
+ aria-selected={{if @value "false" "true"}}
71
+ {{on "click" (fn this.onChange this.defaultOption)}}
72
+ {{on-enter-action (fn this.onChange this.defaultOption)}}
73
+ {{on-space-action (fn this.onChange this.defaultOption)}}
74
+ >
75
+ {{@placeholder}}
76
+ </li>
78
77
  {{#if this.results}}
79
78
  {{#if this.displayCategory}}
80
79
  {{#each this.results as |element index|}}
@@ -41,6 +41,9 @@ export default class PixSelect extends Component {
41
41
  if (this.args.errorMessage) {
42
42
  classes.push('pix-select-button--error');
43
43
  }
44
+ if (this.args.isDisabled) {
45
+ classes.push('pix-select-button--disabled');
46
+ }
44
47
  return classes.join(' ');
45
48
  }
46
49
 
@@ -103,6 +106,7 @@ export default class PixSelect extends Component {
103
106
  @action
104
107
  showDropdown(event) {
105
108
  event.preventDefault();
109
+ if (this.args.isDisabled) return;
106
110
 
107
111
  this.isExpanded = true;
108
112
  }
@@ -118,6 +122,8 @@ export default class PixSelect extends Component {
118
122
 
119
123
  @action
120
124
  onChange(option, event) {
125
+ if (this.args.isDisabled) return;
126
+
121
127
  this.args.onChange(option.value);
122
128
 
123
129
  this.hideDropdown(event);
@@ -156,6 +162,21 @@ export default class PixSelect extends Component {
156
162
  const checkIconWidth = 16;
157
163
  const listWidth = document.getElementById(this.listId).getBoundingClientRect().width;
158
164
  const selectWidth = (listWidth + checkIconWidth) / baseFontRemRatio;
159
- document.getElementById(`container-${this.selectId}`).style.width = `${selectWidth}rem`;
165
+
166
+ const className = `sizing-select-${this.selectId}`;
167
+ this.createClass(`.${className}`, `width: ${selectWidth}rem;`);
168
+
169
+ const element = document.getElementById(`container-${this.selectId}`);
170
+
171
+ element.className = element.className + ' ' + className;
172
+ }
173
+
174
+ createClass(name, rules) {
175
+ var style = document.createElement('style');
176
+ style.type = 'text/css';
177
+ document.getElementsByTagName('head')[0].appendChild(style);
178
+
179
+ if (!(style.sheet || {}).insertRule) (style.styleSheet || style.sheet).addRule(name, rules);
180
+ else style.sheet.insertRule(name + '{' + rules + '}', 0);
160
181
  }
161
182
  }
@@ -5,6 +5,17 @@
5
5
  }
6
6
  }
7
7
 
8
+ @mixin hoverFormElementDisabled() {
9
+ &:hover {
10
+ box-shadow: inset 0px 0px 0px 0.6px $pix-neutral-70;
11
+ background-color: $pix-neutral-20;
12
+ }
13
+ }
14
+
15
+ @mixin formElementDisabled() {
16
+ background-color: $pix-neutral-20;
17
+ }
18
+
8
19
  @mixin focusFormElement() {
9
20
  &:focus {
10
21
  border-color: $pix-primary;
@@ -99,6 +99,11 @@
99
99
  @include hoverFormElement();
100
100
  @include focusWithinFormElement();
101
101
 
102
+ &--disabled {
103
+ @include formElementDisabled();
104
+ @include hoverFormElementDisabled();
105
+ }
106
+
102
107
  &--error {
103
108
  @include formElementInError();
104
109
  }
@@ -156,6 +161,11 @@
156
161
  opacity: 1;
157
162
  }
158
163
  }
164
+
165
+ &--hidden {
166
+ visibility: hidden;
167
+ height: 0;
168
+ }
159
169
  }
160
170
  }
161
171
 
@@ -34,6 +34,7 @@ export const Template = (args) => {
34
34
  @emptySearchMessage={{this.emptySearchMessage}}
35
35
  @requiredText={{this.requiredText}}
36
36
  @errorMessage={{this.errorMessage}}
37
+ @isDisabled={{this.isDisabled}}
37
38
  />
38
39
  `,
39
40
  context: args,
@@ -303,4 +304,12 @@ export const argTypes = {
303
304
  type: { summary: 'string' },
304
305
  },
305
306
  },
307
+ isDisabled: {
308
+ name: 'isDisabled',
309
+ description: "Permet de désactiver l'affichage des options possible",
310
+ type: { name: 'boolean', required: false },
311
+ table: {
312
+ type: { summary: false },
313
+ },
314
+ },
306
315
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "23.1.1",
3
+ "version": "23.1.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"