@1024pix/pix-ui 40.0.0 → 41.0.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.
@@ -26,7 +26,6 @@
26
26
  @import 'pix-sidebar';
27
27
  @import 'pix-input-code';
28
28
  @import 'pix-selectable-tag';
29
- @import 'pix-dropdown';
30
29
  @import 'pix-pagination';
31
30
  @import 'pix-checkbox';
32
31
  @import 'pix-toggle';
@@ -35,4 +34,4 @@
35
34
  @import 'pix-search-input';
36
35
 
37
36
  // at the end so it can override it's children scss
38
- @import 'pix-filterable-and-searchable-select';
37
+ @import 'pix-filterable-and-searchable-select';
@@ -57,19 +57,6 @@ export const form = (args) => {
57
57
  />
58
58
  <br />
59
59
 
60
- <PixDropdown
61
- @id='form__searchable-pix-dropdown'
62
- @options={{this.selectOptions}}
63
- @placeholder='Choisir votre fruit'
64
- @isSearchable={{true}}
65
- @searchPlaceholder='Rechercher'
66
- @label='Votre fruit préféré est : '
67
- @clearLabel='Supprimer la sélection'
68
- @expandLabel='Ouvrir la liste'
69
- @collapseLabel='Réduire la liste'
70
- />
71
- <br />
72
-
73
60
  <PixTextarea
74
61
  @id='form__pix-textarea'
75
62
  @value=''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "40.0.0",
3
+ "version": "41.0.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"
@@ -8,7 +8,7 @@
8
8
  "license": "MIT",
9
9
  "author": "GIP Pix",
10
10
  "engines": {
11
- "node": "^16.17 || ^18"
11
+ "node": "^20"
12
12
  },
13
13
  "ember": {
14
14
  "edition": "octane"
@@ -44,7 +44,7 @@
44
44
  "test": "ember test",
45
45
  "test:ember": "ember test",
46
46
  "test:ember-compatibility": "ember try:each",
47
- "chromatic": "npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN"
47
+ "chromatic": "npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN --only-changed"
48
48
  },
49
49
  "dependencies": {
50
50
  "@formatjs/intl": "^2.5.1",
@@ -99,7 +99,7 @@
99
99
  "ember-export-application-global": "^2.0.1",
100
100
  "ember-load-initializers": "^2.1.2",
101
101
  "ember-page-title": "^8.0.0",
102
- "ember-qunit": "^7.0.0",
102
+ "ember-qunit": "^8.0.0",
103
103
  "ember-resolver": "^11.0.0",
104
104
  "ember-sinon": "^5.0.0",
105
105
  "ember-source": "^4.0.1",
@@ -125,7 +125,7 @@
125
125
  "storybook": "^7.1.0",
126
126
  "stylelint": "^15.0.0",
127
127
  "stylelint-config-rational-order": "^0.1.2",
128
- "stylelint-config-standard-scss": "^10.0.0",
128
+ "stylelint-config-standard-scss": "^11.0.0",
129
129
  "webpack": "^5.75.0"
130
130
  },
131
131
  "bugs": {
@@ -1,101 +0,0 @@
1
- <div class="pix-dropdown">
2
-
3
- {{#if this.label}}
4
- <label id={{@id}} class="pix-dropdown__label">
5
- {{#if @requiredLabel}}
6
- <abbr title={{@requiredLabel}} class="mandatory-mark" aria-hidden="true">*</abbr>
7
- {{/if}}
8
- {{this.label}}
9
- </label>
10
- {{/if}}
11
-
12
- <div class="pix-dropdown__controller">
13
- <button
14
- type="button"
15
- class="pix-dropdown__controller--placeholder{{if this.isExpanded ' expanded'}}"
16
- aria-label={{if this.isExpanded @collapseLabel @expandLabel}}
17
- {{on "click" this.toggleDropdown}}
18
- {{on "keyup" this.navigateThroughOptions}}
19
- ...attributes
20
- >
21
- <p
22
- title={{this.placeholder}}
23
- class="pix-dropdown__controller--placeholder-text
24
- {{unless this.hasSelectedOption ' default'}}"
25
- aria-required={{if this.requiredLabel true false}}
26
- >{{this.placeholder}}</p>
27
- </button>
28
-
29
- {{#if this.hasSelectedOption}}
30
- <button
31
- type="button"
32
- class="pix-dropdown__controller--clear"
33
- aria-label={{@clearLabel}}
34
- {{on "click" this.clearSelection}}
35
- >
36
- <FaIcon @icon="xmark" />
37
- </button>
38
- {{/if}}
39
-
40
- <button
41
- type="button"
42
- tabindex="-1"
43
- class="pix-dropdown__controller--chevron"
44
- {{on "click" this.toggleDropdown}}
45
- >
46
- <FaIcon @icon={{if this.isExpanded "chevron-up" "chevron-down"}} />
47
- </button>
48
- </div>
49
-
50
- <div
51
- role="listbox"
52
- id={{this.menuId}}
53
- tabindex="-1"
54
- class="pix-dropdown__menu{{if this.isExpanded ' expanded'}}"
55
- aria-labelledby={{if this.label @id}}
56
- aria-label={{unless this.label @placeholder}}
57
- aria-hidden={{if this.isExpanded "false" "true"}}
58
- {{on "keyup" this.navigateThroughOptions}}
59
- {{on "scroll" this.incrementPage}}
60
- >
61
-
62
- {{#if @isSearchable}}
63
- <div class="pix-dropdown__menu--search">
64
- <FaIcon class="pix-dropdown__menu--search-icon" @icon="magnifying-glass" />
65
- <label
66
- class="pix-dropdown__menu--search-input-label"
67
- for={{this.searchInputId}}
68
- >{{@searchPlaceholder}}</label>
69
- <input
70
- class="pix-dropdown__menu--search-input"
71
- id={{this.searchInputId}}
72
- autocomplete="off"
73
- tabindex={{unless this.isExpanded "-1"}}
74
- placeholder={{@searchPlaceholder}}
75
- {{on "input" this.filterOptions}}
76
- />
77
- </div>
78
- {{/if}}
79
-
80
- {{#each this.options as |opt index|}}
81
- {{#if (lt index this.showLimit)}}
82
- <div
83
- role="option"
84
- id={{opt.value}}
85
- tabindex="-1"
86
- class="pix-dropdown__menu--option{{if
87
- (eq this.selectedOption.value opt.value)
88
- ' selected'
89
- }}"
90
- aria-selected={{if (eq this.selectedOption.value opt.value) "true"}}
91
- {{on "click" (fn this.selectOption opt)}}
92
- {{on "mouseover" this.resetPreviouslyFocused}}
93
- {{on "keypress" (fn this.onOptionKeyPress opt)}}
94
- >
95
- {{opt.label}}
96
- </div>
97
- {{/if}}
98
- {{/each}}
99
- </div>
100
-
101
- </div>
@@ -1,181 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { tracked } from '@glimmer/tracking';
3
- import { action } from '@ember/object';
4
-
5
- export default class PixDropdown extends Component {
6
- defaultId = Math.floor(Math.random() * 100);
7
- focusedOption = null;
8
- focusedIndex = null;
9
- @tracked page = 1;
10
- @tracked selectedOption = null;
11
- @tracked isExpanded = false;
12
- @tracked options = this.args.options;
13
- @tracked menuId = `menu-${this.defaultId}`;
14
- @tracked searchInputId = `search-input-${this.defaultId}`;
15
-
16
- constructor() {
17
- super(...arguments);
18
-
19
- if (!this.args.label && !this.args.placeholder) {
20
- throw new Error(
21
- 'ERROR in PixDropdown component, you need to provide a label and/or a placeholder',
22
- );
23
- }
24
-
25
- if (this.args.selectedOption) {
26
- this.selectedOption = this.args.options.find(
27
- ({ value }) => value === this.args.selectedOption,
28
- );
29
- }
30
- }
31
-
32
- get hasSelectedOption() {
33
- return !!this.selectedOption;
34
- }
35
-
36
- get placeholder() {
37
- return this.selectedOption?.label || this.args.placeholder;
38
- }
39
-
40
- get label() {
41
- const labelIsDefined = this.args.label?.trim();
42
- const idIsNotDefined = !this.args.id?.trim();
43
-
44
- if (labelIsDefined && idIsNotDefined) {
45
- throw new Error('ERROR in PixDropdown component, @id param is necessary when giving @label');
46
- }
47
- return this.args.label || null;
48
- }
49
-
50
- get showLimit() {
51
- if (!this.args.pageSize) return this.options.length;
52
-
53
- const numberOfOptionsAccordingToPage = this.args.pageSize * this.page;
54
- return Math.min(this.options.length, numberOfOptionsAccordingToPage);
55
- }
56
-
57
- @action
58
- resetPreviouslyFocused() {
59
- if (!this.focusedOption) return;
60
-
61
- const previouslyFocusedElement = document.getElementById(this.focusedOption.value);
62
- previouslyFocusedElement?.blur();
63
- this.focusedOption = undefined;
64
- this.focusedIndex = undefined;
65
- }
66
-
67
- _navigateToOption(option, index) {
68
- if (!option) return;
69
-
70
- this.resetPreviouslyFocused();
71
- this.focusedOption = option;
72
- this.focusedIndex = index;
73
- const focusedElement = document.getElementById(option.value);
74
- focusedElement?.scrollIntoView({ block: 'nearest' });
75
- focusedElement?.focus();
76
- }
77
-
78
- _computeNextIndex(isArrowDown, index) {
79
- const length = this.showLimit;
80
- let nextIndex;
81
- if (index === undefined || index === null) {
82
- nextIndex = isArrowDown ? 0 : length - 1;
83
- } else {
84
- const delta = isArrowDown ? 1 : -1;
85
- nextIndex = index + delta;
86
- }
87
- // navigate through array in a circle
88
- // (i.e. go back to first after last or last after first)
89
- return ((nextIndex % length) + length) % length;
90
- }
91
-
92
- @action
93
- navigateThroughOptions(event) {
94
- const isArrowDown = event.code === 'ArrowDown';
95
- if (event.code !== 'ArrowUp' && !isArrowDown) return;
96
- const nextIndex = this._computeNextIndex(isArrowDown, this.focusedIndex);
97
- this._navigateToOption(this.options[nextIndex], nextIndex);
98
- }
99
-
100
- @action
101
- toggleDropdown() {
102
- this.isExpanded = !this.isExpanded;
103
-
104
- if (this.isExpanded) {
105
- this.resetPreviouslyFocused();
106
- const searchInput = document.getElementById(this.searchInputId);
107
- if (searchInput) {
108
- searchInput.focus();
109
- } else {
110
- this._navigateToOption(this.options[0], 0);
111
- }
112
- }
113
-
114
- const menu = document.getElementById(this.menuId);
115
- menu.scrollTop = 0;
116
- this.page = 1;
117
- }
118
-
119
- @action
120
- selectOption(option) {
121
- if (this.selectedOption?.value !== option.value) {
122
- this.args.onSelect?.(option.value);
123
- this.selectedOption = option;
124
- }
125
- this.isExpanded = false;
126
-
127
- const searchInput = document.getElementById(this.searchInputId);
128
- if (searchInput) {
129
- searchInput.value = '';
130
- this.options = this.args.options;
131
- }
132
- }
133
-
134
- @action
135
- onOptionKeyPress(option, event) {
136
- if (event.code === 'Enter' || event.code === 'Space') this.selectOption(option);
137
- }
138
-
139
- @action
140
- clearSelection(event) {
141
- event.stopPropagation();
142
- event.preventDefault();
143
- this.selectedOption = null;
144
- this._navigateToOption(this.options[0], 0);
145
- this.args.onSelect?.();
146
- }
147
-
148
- @action
149
- onClearKeyPress(event) {
150
- if (event.code === 'Enter' || event.code === 'Space') this.clearSelection(event);
151
- }
152
-
153
- @action
154
- filterOptions(event) {
155
- this.resetPreviouslyFocused();
156
- const filterValue = event.target?.value.toLowerCase();
157
- this.page = 1;
158
- this.options = filterValue
159
- ? this.args.options.filter(({ label }) => label.toLowerCase().includes(filterValue))
160
- : this.args.options;
161
- }
162
-
163
- _isLastOptionVisible(option) {
164
- const lastVisibleOption = document.getElementById(option.value);
165
- const menu = document.getElementById(this.menuId);
166
-
167
- const { bottom, height, top } = lastVisibleOption.getBoundingClientRect();
168
- const menuRect = menu.getBoundingClientRect();
169
-
170
- return top <= menuRect.top ? menuRect.top - top <= height : bottom - menuRect.bottom <= height;
171
- }
172
-
173
- @action
174
- incrementPage() {
175
- if (!this.args.pageSize) return;
176
-
177
- if (this._isLastOptionVisible(this.options[this.showLimit - 1])) {
178
- this.page += 1;
179
- }
180
- }
181
- }
@@ -1,157 +0,0 @@
1
- .pix-dropdown {
2
- position: relative;
3
- width: 100%;
4
-
5
- button {
6
- margin: 0;
7
- text-align: left;
8
- cursor: pointer;
9
- }
10
-
11
- &__label {
12
- @include label();
13
- }
14
-
15
- &__controller {
16
- position: relative;
17
- width: 100%;
18
-
19
- &--placeholder {
20
- @include hoverFormElement();
21
- @include focusFormElement();
22
-
23
- width: 100%;
24
- min-width: 250px;
25
- min-height: 34px;
26
- padding: 0;
27
- background: $pix-neutral-0;
28
- border: 1px solid $pix-neutral-40;
29
- border-radius: $pix-spacing-xxs;
30
-
31
- &.expanded {
32
- border-bottom-right-radius: 0;
33
- border-bottom-left-radius: 0;
34
- }
35
- }
36
-
37
- &--placeholder-text {
38
- margin: 0;
39
- padding: 8px 68px 8px 16px;
40
- overflow: hidden;
41
- color: $pix-neutral-90;
42
- font-size: 0.875rem;
43
- white-space: nowrap;
44
- text-overflow: ellipsis;
45
-
46
- &.default {
47
- padding-right: 36px;
48
- color: $pix-neutral-60;
49
- }
50
- }
51
-
52
- &--clear {
53
- position: absolute;
54
- top: 1px;
55
- right: 38px;
56
- width: fit-content;
57
- padding: 8px 8px 6px;
58
- color: $pix-neutral-50;
59
- font-size: 1rem;
60
- background: transparent;
61
- border: none;
62
- border-right: 2px solid $pix-neutral-40;
63
-
64
- &:hover {
65
- color: $pix-neutral-70;
66
- }
67
- }
68
-
69
- &--chevron {
70
- position: absolute;
71
- top: 9px;
72
- right: 12px;
73
- padding: 0;
74
- color: $pix-neutral-50;
75
- background: transparent;
76
- border: none;
77
- cursor: pointer;
78
-
79
- &:hover {
80
- color: $pix-neutral-70;
81
- }
82
- }
83
- }
84
-
85
- &__menu {
86
- position: absolute;
87
- top: 100%;
88
- z-index: 1;
89
- width: 100%;
90
- max-height: 0;
91
- overflow: hidden;
92
- overflow-y: auto;
93
- background: $pix-neutral-0;
94
- transition: max-height ease-in 0.5s;
95
-
96
- &.expanded {
97
- max-height: 300px;
98
- border: 1px solid $pix-neutral-40;
99
- border-top: none;
100
- border-radius: 0 0 $pix-spacing-xxs $pix-spacing-xxs;
101
- }
102
-
103
- &--search {
104
- position: relative;
105
- display: flex;
106
-
107
- &-icon {
108
- position: absolute;
109
- top: 12px;
110
- left: 16px;
111
- margin: 4px;
112
- color: $pix-neutral-30;
113
- }
114
-
115
- &-input {
116
- flex-grow: 1;
117
- margin: 12px 12px 8px;
118
- padding: 4px 4px 4px 32px;
119
- font-size: 0.875rem;
120
- border: none;
121
- border-bottom: 1px solid $pix-neutral-40;
122
- outline: none;
123
-
124
- &:hover {
125
- box-shadow: inset 0 -0.7px 0 0 $pix-neutral-40;
126
- }
127
-
128
- &:focus {
129
- border-color: $pix-primary;
130
- box-shadow: inset 0 -0.7px 0 0 $pix-primary;
131
- }
132
-
133
- &-label {
134
- width: 0;
135
- height: 0;
136
- overflow: hidden;
137
- }
138
- }
139
- }
140
-
141
- &--option {
142
- padding: 8px 12px;
143
- font-size: 0.875rem;
144
- cursor: pointer;
145
-
146
- &.selected {
147
- color: $pix-neutral-70;
148
- }
149
-
150
- &:focus,
151
- &:hover {
152
- background: $pix-neutral-15;
153
- outline: none;
154
- }
155
- }
156
- }
157
- }
@@ -1 +0,0 @@
1
- export { default } from '@1024pix/pix-ui/components/pix-dropdown';
@@ -1,57 +0,0 @@
1
- import { Meta, Story, ArgTypes } from '@storybook/blocks';
2
- import * as ComponentStories from './pix-dropdown.stories';
3
-
4
- <Meta of={ComponentStories} />
5
-
6
- # Pix Dropdown
7
-
8
- Affiche un menu déroulant avec la liste des options fournies.
9
-
10
- Les options sont représentées par un tableau d'objet contenant les propriétés value et label.
11
-
12
- > **⚠️** **Il est nécessaire d'avoir au moins un label ou un placeholder !**
13
-
14
- > **⚠️** **N'oubliez pas de rajouter un searchLabel dans le cas ou le menu déroulant est cherchable pour le rendre accessible !**
15
-
16
- > Pour aider l'utilisateur, rajoutez un placeholder cohérent !
17
-
18
- ## Default
19
-
20
- <Story of={ComponentStories.Default} height={200} />
21
-
22
- ## With label
23
-
24
- <Story of={ComponentStories.withLabel} height={200} />
25
-
26
- ## Searchable
27
-
28
- <Story of={ComponentStories.searchableDropdown} height={200} />
29
-
30
-
31
- ## Infinite scroll
32
-
33
- <Story of={ComponentStories.paginatedDropdown} height={200} />
34
-
35
- ## Usage
36
-
37
- ```html
38
- <PixDropdown
39
- @id="{{id}}"
40
- @options="{{options}}"
41
- @onSelect="{{onSelect}}"
42
- @selectedOption="1"
43
- @isSearchable="{{false}}"
44
- @placeholder="Choisissez une option"
45
- @searchPlaceholder="Rechercher"
46
- @label="Mon menu déroulant"
47
- @requiredLabel="Requis"
48
- @clearLabel="Supprimer la sélection"
49
- @expandLabel="Ouvrir le menu déroulant"
50
- @collapseLabel="Réduire le menu déroulant"
51
- @pageSize="{{10}}"
52
- />
53
- ```
54
-
55
- ## Arguments
56
-
57
- <ArgTypes of={ComponentStories} />
@@ -1,193 +0,0 @@
1
- import { hbs } from 'ember-cli-htmlbars';
2
- import { action } from '@storybook/addon-actions';
3
-
4
- export default {
5
- title: 'Form/Dropdown',
6
- argTypes: {
7
- options: {
8
- name: 'options',
9
- description:
10
- 'Les options sont représentées par un tableau d‘objet contenant les propriétés ``value`` et ``label``.',
11
- type: { name: 'array', required: true },
12
- },
13
- selectedOption: {
14
- name: 'selectedOption',
15
- description: 'Option sélectionnée',
16
- options: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
17
- control: { type: 'select' },
18
- type: { name: 'string', required: false },
19
- table: {
20
- type: { summary: 'string' },
21
- },
22
- },
23
- onSelect: {
24
- name: 'onSelect',
25
- description: 'Fonction à appeler quand une option est sélectionnée.',
26
- type: { required: true },
27
- control: { disable: true },
28
- },
29
- isSearchable: {
30
- name: 'isSearchable',
31
- description:
32
- "Rend le champ cherchable, le paramètre @searchPlaceholder devient requis pour l'accessibilité.",
33
- control: { type: 'boolean' },
34
- type: { name: 'boolean', required: false },
35
- table: {
36
- type: { summary: 'boolean' },
37
- defaultValue: { summary: false },
38
- },
39
- },
40
- searchPlaceholder: {
41
- name: 'searchPlaceholder',
42
- description: 'Placeholder du champ de recherche. Requis si le menu est cherchable.',
43
- type: { name: 'string', required: false },
44
- table: {
45
- type: { summary: 'string' },
46
- },
47
- },
48
- placeholder: {
49
- name: 'placeholder',
50
- description: "Un texte donnant une indication a l'utilisateur sur le choix des options.",
51
- type: { name: 'string', required: false },
52
- table: {
53
- type: { summary: 'string' },
54
- },
55
- },
56
- label: {
57
- name: 'label',
58
- description:
59
- 'Label du menu déroulant, le paramètre @id devient obligatoire avec ce paramètre.',
60
- type: { name: 'string', required: false },
61
- table: {
62
- type: { summary: 'string' },
63
- },
64
- },
65
- requiredLabel: {
66
- name: 'requiredLabel',
67
- description:
68
- 'Label indiquant que le champ est requis, le paramètre @label devient obligatoire avec ce paramètre.',
69
- type: { name: 'string', required: false },
70
- table: {
71
- type: { summary: 'string' },
72
- },
73
- },
74
- id: {
75
- name: 'id',
76
- description: "L'id du label",
77
- type: { name: 'string', required: false },
78
- table: {
79
- type: { summary: 'string' },
80
- },
81
- },
82
- pageSize: {
83
- name: 'pageSize',
84
- description: "Le nombre d'élément à afficher dans la liste.",
85
- type: { name: 'number', required: false },
86
- table: {
87
- type: { summary: 'number' },
88
- },
89
- },
90
- clearLabel: {
91
- name: 'clearLabel',
92
- description: "Label de l'icône pour éliminer la sélection. Requis pour l'accessibilité.",
93
- type: { name: 'string', required: false },
94
- table: {
95
- type: { summary: 'string' },
96
- },
97
- },
98
- expandLabel: {
99
- name: 'expandLabel',
100
- description: "Label de l'icône pour ouvrir le menu déroulant. Requis pour l'accessibilité.",
101
- type: { name: 'string', required: false },
102
- table: {
103
- type: { summary: 'string' },
104
- },
105
- },
106
- collapseLabel: {
107
- name: 'collapseLabel',
108
- description: "Label de l'icône pour réduire le menu déroulant. Requis pour l'accessibilité.",
109
- type: { name: 'string', required: false },
110
- table: {
111
- type: { summary: 'string' },
112
- },
113
- },
114
- },
115
- };
116
-
117
- const Template = (args) => {
118
- return {
119
- template: hbs`<div style='width: 300px;'>
120
- <PixDropdown
121
- @id={{this.id}}
122
- @options={{this.options}}
123
- @onSelect={{this.onSelect}}
124
- @placeholder={{this.placeholder}}
125
- @selectedOption={{this.selectedOption}}
126
- @isSearchable={{this.isSearchable}}
127
- @searchPlaceholder={{this.searchPlaceholder}}
128
- @label={{this.label}}
129
- @clearLabel={{this.clearLabel}}
130
- @expandLabel={{this.expandLabel}}
131
- @collapseLabel={{this.collapseLabel}}
132
- @pageSize={{this.pageSize}}
133
- @requiredLabel={{this.requiredLabel}}
134
- />
135
- </div>`,
136
- context: args,
137
- };
138
- };
139
-
140
- export const Default = Template.bind({});
141
- Default.args = {
142
- options: [
143
- { value: '1', label: 'Figues' },
144
- { value: '2', label: 'Bananes' },
145
- { value: '3', label: 'Noix' },
146
- { value: '4', label: 'Papayes' },
147
- { value: '5', label: 'Fèves de chocolat' },
148
- { value: '6', label: 'Dattes' },
149
- { value: '7', label: 'Mangues' },
150
- { value: '8', label: 'Jujube' },
151
- { value: '9', label: 'Avocat' },
152
- { value: '10', label: 'Fraises' },
153
- { value: '11', label: 'Kaki' },
154
- { value: '12', label: 'Asiminier trilobé oblong vert (à ne pas confondre avec la papaye)' },
155
- ],
156
- placeholder: 'Choisissez une option',
157
- onSelect: action('onSelect'),
158
- id: 'default-dropdown',
159
- clearLabel: 'Supprimer la sélection',
160
- expandLabel: 'Ouvrir la liste',
161
- collapseLabel: 'Réduire la liste',
162
- };
163
-
164
- export const withLabel = Template.bind({});
165
- withLabel.args = {
166
- ...Default.args,
167
- id: 'dropdown-with-label',
168
- label: 'Ton fruit préféré: ',
169
- requiredLabel: 'Champ requis',
170
- };
171
-
172
- export const searchableDropdown = Template.bind({});
173
- searchableDropdown.args = {
174
- ...Default.args,
175
- isSearchable: true,
176
- id: 'searchable-dropdown',
177
- placeholder: 'Fraises, Mangues...',
178
- searchPlaceholder: 'Rechercher',
179
- };
180
-
181
- export const paginatedDropdown = Template.bind({});
182
- paginatedDropdown.args = {
183
- ...Default.args,
184
- id: 'paginated-dropdown',
185
- placeholder: 'Quel est ton fruit préféré ?',
186
- pageSize: 10,
187
- isSearchable: true,
188
- searchPlaceholder: 'Rechercher',
189
- options: Array.from({ length: 100 }, (_, index) => ({
190
- value: `${index}`,
191
- label: `${index}abc`,
192
- })),
193
- };