qc-trousse-sdg 1.4.3 → 1.4.5

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.
Files changed (60) hide show
  1. package/README.md +76 -51
  2. package/dist/css/qc-sdg-design-tokens.min.css +1 -1
  3. package/dist/css/qc-sdg-no-grid.min.css +1 -1
  4. package/dist/css/qc-sdg.min.css +1 -1
  5. package/dist/img/QUEBEC_blanc.svg +3 -12
  6. package/dist/img/QUEBEC_couleur.svg +3 -23
  7. package/dist/js/qc-sdg.min.js +1 -1
  8. package/index.html +1 -1
  9. package/package.json +1 -1
  10. package/public/css/qc-sdg-design-tokens.css +0 -2
  11. package/public/css/qc-sdg-no-grid.css +154 -110
  12. package/public/css/qc-sdg.css +154 -110
  13. package/public/img/QUEBEC_blanc.svg +3 -12
  14. package/public/img/QUEBEC_couleur.svg +3 -23
  15. package/public/img/favicon.ico +0 -0
  16. package/public/index.html +13 -0
  17. package/public/js/qc-doc-sdg.js +31 -34
  18. package/public/js/qc-sdg.js +2049 -1268
  19. package/src/doc/_index.html +3 -0
  20. package/src/sdg/_components.js +0 -1
  21. package/src/sdg/bases/form/_form.scss +0 -4
  22. package/src/sdg/components/Alert/Alert.svelte +1 -1
  23. package/src/sdg/components/Button/_button.scss +35 -12
  24. package/src/sdg/components/Checkbox/Checkbox.svelte +3 -3
  25. package/src/sdg/components/Checkbox/CheckboxWC.svelte +3 -3
  26. package/src/sdg/components/Checkbox/{updateInput.svelte.js → updateChoiceInput.svelte.js} +6 -1
  27. package/src/sdg/components/ChoiceGroup/ChoiceGroup.svelte +2 -2
  28. package/src/sdg/components/ChoiceGroup/Test/ChoiceGroupeEmbededTest.svelte +3 -0
  29. package/src/sdg/components/ChoiceGroup/Test/checkboxBaselineTest.html +3 -0
  30. package/src/sdg/components/DropdownList/DropdownList.svelte +4 -7
  31. package/src/sdg/components/DropdownList/DropdownListItems/DropdownListItems.svelte +1 -6
  32. package/src/sdg/components/DropdownList/DropdownListItems/DropdownListItemsMultiple/_dropdownListItemsMultiple.scss +3 -8
  33. package/src/sdg/components/DropdownList/DropdownListItems/DropdownListItemsSingle/_dropdownListItemsSingle.scss +1 -2
  34. package/src/sdg/components/DropdownList/DropdownListItems/_dropdownListItems.scss +2 -4
  35. package/src/sdg/components/DropdownList/SelectWC.svelte +31 -50
  36. package/src/sdg/components/DropdownList/Test/DropdownListSvelteTest.svelte +37 -2
  37. package/src/sdg/components/DropdownList/Test/{dropdownListTest.html → dropdownListBaselineTest.html} +19 -1
  38. package/src/sdg/components/DropdownList/Test/dropdownListTestUtils.js +14 -0
  39. package/src/sdg/components/DropdownList/_dropdownList.scss +11 -16
  40. package/src/sdg/components/DropdownList/_select.html +9 -0
  41. package/src/sdg/components/Fieldset/_fieldset.scss +17 -4
  42. package/src/sdg/components/Label/_label.scss +1 -0
  43. package/src/sdg/components/PivFooter/PivFooter.svelte +2 -2
  44. package/src/sdg/components/PivHeader/PivHeader.svelte +79 -74
  45. package/src/sdg/components/PivHeader/Test/pivHeaderBaselineTest.html +12 -1
  46. package/src/sdg/components/PivHeader/Test/pivHeaderTest.js +9 -0
  47. package/src/sdg/components/PivHeader/_pivHeader.html +1 -0
  48. package/src/sdg/components/PivHeader/_pivHeader.scss +46 -19
  49. package/src/sdg/components/TextField/Test/textFieldBaselineTest.html +24 -5
  50. package/src/sdg/components/TextField/TextField.svelte +29 -25
  51. package/src/sdg/components/TextField/TextFieldWC.svelte +8 -0
  52. package/src/sdg/components/TextField/_textField.scss +6 -13
  53. package/src/sdg/qc-sdg-test.js +4 -0
  54. package/src/sdg/scss/settings/_tokens.scss +0 -4
  55. package/tests/buildSvelteTestsIgnore.json +2 -1
  56. package/tests/dropdown-list-baseline.spec.ts +51 -4
  57. package/tests/piv-header-baseline.spec.ts +3 -0
  58. package/src/sdg/components/Button/Button.svelte +0 -50
  59. package/src/sdg/components/Button/ButtonWC.svelte +0 -36
  60. package/tests/piv-header-svelte.spec.ts +0 -11
@@ -18,6 +18,9 @@
18
18
  src='js/qc-doc-sdg.js'
19
19
  sdg-css-filename="qc-doc-sdg.css">
20
20
  </script>
21
+ <link rel="icon"
22
+ type="image/x-icon"
23
+ href="img/favicon.ico">
21
24
  </head>
22
25
  <body>
23
26
  <header>
@@ -11,7 +11,6 @@ export * from './components/IconButton/IconButtonWC.svelte'
11
11
  export * from './components/ChoiceGroup/ChoiceGroupWC.svelte'
12
12
  export * from './components/Checkbox/CheckboxWC.svelte'
13
13
  export * from './components/TextField/TextFieldWC.svelte'
14
- export * from './components/Button/ButtonWC.svelte'
15
14
  export * from './components/ToggleSwitch/ToggleSwitchWC.svelte'
16
15
  export * from './components/ChoiceGroup/ToggleSwitchGroupWC.svelte'
17
16
  export * from './components/DropdownList/SelectWC.svelte'
@@ -15,7 +15,3 @@ label {
15
15
  legend {
16
16
  padding: 0;
17
17
  }
18
-
19
- qc-select select {
20
- appearance: none;
21
- }
@@ -57,7 +57,7 @@
57
57
  size="nm"
58
58
  icon="xclose"
59
59
  iconSize="sm"
60
- iconColor="text-primary"
60
+ iconColor="blue-piv"
61
61
  />
62
62
  {/if}
63
63
  </div>
@@ -1,6 +1,12 @@
1
1
  @use "qc-sdg-lib" as *;
2
2
  @use "sass:map";
3
3
 
4
+ %button-disabled {
5
+ cursor: not-allowed;
6
+ box-shadow: none;
7
+ opacity: 1;
8
+ }
9
+
4
10
  .qc-button {
5
11
  font-family: token-value(font family, content);
6
12
  font-size: token-value(font size, md);
@@ -66,6 +72,14 @@
66
72
  background-color: token-value(color blue, regular_light);
67
73
  border-color: token-value(color blue, regular_light);
68
74
  }
75
+
76
+ &:disabled,
77
+ &.qc-disabled {
78
+ background-color: token-value(color grey, light);
79
+ border-color: token-value(color grey, light);
80
+ color: token-value(color white);
81
+ @extend %button-disabled;
82
+ }
69
83
  }
70
84
 
71
85
  &.qc-secondary {
@@ -90,6 +104,13 @@
90
104
  &.qc-active {
91
105
  background-color: rgba(map.get(map.get(map.get($xl-tokens, color), blue), piv), 0.08);
92
106
  }
107
+
108
+ &:disabled,
109
+ &.qc-disabled {
110
+ border-color: token-value(color grey, regular);
111
+ color: token-value(color grey regular);
112
+ @extend %button-disabled;
113
+ }
93
114
  }
94
115
 
95
116
  &.qc-tertiary {
@@ -114,6 +135,12 @@
114
135
  &.qc-active {
115
136
  background-color: rgba(map.get(map.get(map.get($xl-tokens, color), grey), light), 0.16);
116
137
  }
138
+
139
+ &:disabled,
140
+ &.qc-disabled {
141
+ color: token-value(color grey regular);
142
+ @extend %button-disabled;
143
+ }
117
144
  }
118
145
 
119
146
  &.qc-danger {
@@ -137,16 +164,14 @@
137
164
  &.qc-active {
138
165
  background-color: token-value(color red regular_light);
139
166
  }
140
- }
141
167
 
142
- &:disabled,
143
- &.qc-disabled {
144
- background-color: token-value(color grey, light);
145
- border-color: token-value(color grey, light);
146
- color: token-value(color white);
147
- cursor: not-allowed;
148
- box-shadow: none;
149
- opacity: 1;
168
+ &:disabled,
169
+ &.qc-disabled {
170
+ background-color: token-value(color grey, light);
171
+ border-color: token-value(color grey, light);
172
+ color: token-value(color white);
173
+ @extend %button-disabled;
174
+ }
150
175
  }
151
176
 
152
177
  .qc-icon {
@@ -190,9 +215,7 @@
190
215
  &:disabled,
191
216
  &.qc-disabled {
192
217
  color: token-value(color, grey regular);
193
- cursor: not-allowed;
194
- box-shadow: none;
195
- opacity: 1;
218
+ @extend %button-disabled;
196
219
  }
197
220
  }
198
221
 
@@ -2,7 +2,7 @@
2
2
  import { Utils } from "../utils";
3
3
  import FormError from "../FormError/FormError.svelte";
4
4
  import {getContext, onMount} from "svelte";
5
- import {updateInput, onChange} from "./updateInput.svelte";
5
+ import {updateChoiceInput, onChange} from "./updateChoiceInput.svelte.js";
6
6
 
7
7
  const lang = Utils.getPageLanguage(),
8
8
  qcCheckoxContext = getContext("qc-checkbox");
@@ -32,7 +32,7 @@
32
32
  onMount(() => {
33
33
  if (qcCheckoxContext) return;
34
34
  labelElement = rootElement?.querySelector('label')
35
- input = rootElement?.querySelector('input')
35
+ input = rootElement?.querySelector('input[type="checkbox"]')
36
36
  onChange(input, _invalid => invalid = _invalid)
37
37
  })
38
38
 
@@ -42,7 +42,7 @@
42
42
  }
43
43
  })
44
44
 
45
- $effect(_ => updateInput(input, required, invalid, compact, false, false))
45
+ $effect(_ => updateChoiceInput(input, required, invalid, compact, false, false))
46
46
 
47
47
  $effect(() => {
48
48
  if (!required) return;
@@ -12,7 +12,7 @@
12
12
  import Checkbox from "./Checkbox.svelte";
13
13
  import {onMount, setContext} from "svelte";
14
14
  import {Utils} from "../utils";
15
- import {onChange} from "./updateInput.svelte";
15
+ import {onChange} from "./updateChoiceInput.svelte.js";
16
16
 
17
17
  setContext('qc-checkbox', true);
18
18
 
@@ -29,8 +29,8 @@
29
29
 
30
30
  onMount(() => {
31
31
  labelElement = $host()
32
- .querySelector('label')
33
- input = $host().querySelector('input')
32
+ .querySelector("label")
33
+ input = $host().querySelector('input[type="checkbox"]')
34
34
  onChange(input, _invalid => invalid = _invalid)
35
35
  })
36
36
 
@@ -1,7 +1,12 @@
1
- export function updateInput(input, required, invalid, compact, selectionButton, inline, name) {
1
+ export function updateChoiceInput(input, required, invalid, compact, selectionButton, inline, name) {
2
2
  if (!input ) return;
3
3
  if (input.role === "switch") return;
4
+ if (input.type === "hidden") return;
4
5
  let label = input.closest('label');
6
+ if (!label) {
7
+ console.warn("Pas d'élément label parent pour l'input", input);
8
+ return;
9
+ }
5
10
  input.classList.add('qc-choicefield')
6
11
  label.classList.add('qc-choicefield-label')
7
12
  input.classList.toggle('qc-selection-button', selectionButton)
@@ -1,7 +1,7 @@
1
1
  <script>
2
2
  import Fieldset from "../Fieldset/Fieldset.svelte";
3
3
  import {onMount} from "svelte";
4
- import {updateInput} from "../Checkbox/updateInput.svelte";
4
+ import {updateChoiceInput} from "../Checkbox/updateChoiceInput.svelte.js";
5
5
 
6
6
  let {
7
7
  invalid = $bindable(false),
@@ -27,7 +27,7 @@
27
27
  .querySelectorAll('input, .qc-choicefield')
28
28
  .forEach(
29
29
  input =>
30
- updateInput(
30
+ updateChoiceInput(
31
31
  input,
32
32
  required,
33
33
  invalid,
@@ -15,6 +15,7 @@
15
15
  name="tile-1"
16
16
  >
17
17
  <label>
18
+ <input type="hidden">
18
19
  <input {type}
19
20
 
20
21
  value="1"
@@ -27,6 +28,7 @@
27
28
  </label>
28
29
 
29
30
  <label>
31
+ <input type="hidden">
30
32
  <input {type}
31
33
 
32
34
  value="2"
@@ -36,6 +38,7 @@
36
38
  </span>
37
39
  </label>
38
40
  <label>
41
+ <input type="hidden">
39
42
  <input {type}
40
43
 
41
44
  value="3"
@@ -5,6 +5,7 @@
5
5
  name="tile-1"
6
6
  >
7
7
  <label>
8
+ <input type="hidden">
8
9
  <input type="checkbox"
9
10
 
10
11
  value="1"
@@ -17,6 +18,7 @@
17
18
  </label>
18
19
 
19
20
  <label>
21
+ <input type="hidden">
20
22
  <input type="checkbox"
21
23
 
22
24
  value="2"
@@ -26,6 +28,7 @@
26
28
  </span>
27
29
  </label>
28
30
  <label>
31
+ <input type="hidden">
29
32
  <input type="checkbox"
30
33
 
31
34
  value="3"
@@ -27,7 +27,6 @@
27
27
  rootElement = $bindable(),
28
28
  errorElement = $bindable(),
29
29
  webComponentMode = false,
30
- webComponentParentRow,
31
30
  } = $props();
32
31
 
33
32
  const
@@ -81,9 +80,9 @@
81
80
  const keyword = webComponentMode ? "container" : "root";
82
81
 
83
82
  if (availableWidths.includes(width)) {
84
- return `qc-dropdown-list-${keyword}-${width}`;
83
+ return `qc-dropdown-list-${width}`;
85
84
  }
86
- return `qc-dropdown-list-${keyword}-md`;
85
+ return `qc-dropdown-list-md`;
87
86
  }),
88
87
  srItemsCountText = $derived.by(() => {
89
88
  const s = displayedItems.length > 1 ? "s" : "";
@@ -273,14 +272,11 @@
273
272
  <svelte:body onclick={handleOuterEvent} onkeydown={handleTab}/>
274
273
  <div
275
274
  class={[
276
- "qc-dropdown-list-root",
277
- !webComponentMode && widthClass,
278
- !(parentRow || webComponentParentRow) && "qc-dropdown-list-margin"
275
+ !parentRow && !webComponentMode && "qc-select"
279
276
  ]} bind:this={rootElement}
280
277
  >
281
278
  <div class={[
282
279
  "qc-dropdown-list-container",
283
- webComponentMode && widthClass
284
280
  ]}>
285
281
  <!-- svelte-ignore a11y_click_events_have_key_events -->
286
282
  <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
@@ -301,6 +297,7 @@
301
297
  <div
302
298
  class={[
303
299
  `qc-dropdown-list`,
300
+ widthClass,
304
301
  invalid && "qc-dropdown-list-invalid",
305
302
  ]}
306
303
  tabindex="-1"
@@ -20,11 +20,6 @@
20
20
  placeholder,
21
21
  } = $props()
22
22
 
23
- const
24
- precentRootFontSize = 62.5,
25
- remRatio = 0.16
26
- ;
27
-
28
23
  let itemsComponent = $state();
29
24
  let usedHeight = $derived.by(() => {
30
25
  const maxItemsHeight = 336;
@@ -68,7 +63,7 @@
68
63
  id={id}
69
64
  class="qc-dropdown-list-items"
70
65
  tabindex="-1"
71
- style="--dropdown-items-height: {usedHeight / (remRatio * precentRootFontSize)}rem;"
66
+ style="--dropdown-items-height: {usedHeight};"
72
67
  >
73
68
  {#if multiple}
74
69
  <DropdownListItemsMultiple
@@ -5,15 +5,10 @@
5
5
 
6
6
  label {
7
7
  margin: 0;
8
- padding-left: token-value(spacer, xs);
9
- padding-right: token-value(spacer, xs);
8
+ padding: token-value(spacer, xs);
10
9
  flex-grow: 1;
11
- align-items: center;
12
10
  }
13
- .qc-choicefield {
14
- margin-top: 0 !important;
15
- &:focus {
16
- outline: none;
17
- }
11
+ .qc-choicefield:focus {
12
+ outline: none;
18
13
  }
19
14
  }
@@ -1,8 +1,7 @@
1
1
  @use "../../../../scss/qc-sdg-lib" as *;
2
2
 
3
3
  .qc-dropdown-list-single {
4
- padding-left: token-value(spacer, xs);
5
- padding-right: token-value(spacer, xs);
4
+ padding: token-value(spacer, xs);
6
5
  margin: 0;
7
6
  }
8
7
 
@@ -5,7 +5,7 @@
5
5
  $min-height: 40;
6
6
 
7
7
  .qc-dropdown-list-items {
8
- max-height: var(--dropdown-items-height);
8
+ max-height: calc(var(--dropdown-items-height) * $rem-ratio * 1rem);
9
9
  overflow-y: auto;
10
10
  overflow-x: hidden;
11
11
 
@@ -38,15 +38,13 @@ $min-height: 40;
38
38
 
39
39
  * {
40
40
  overflow: hidden;
41
- white-space: nowrap;
42
- text-overflow: ellipsis;
43
41
  }
44
42
  }
45
43
 
46
44
  .qc-dropdown-list-multiple, .qc-dropdown-list-single {
47
45
  display: flex;
48
46
  align-items: center;
49
- height: rem($min-height);
47
+ min-height: rem($min-height);
50
48
 
51
49
  &.qc-dropdown-list-active:hover {
52
50
  background-color: token-value(color, grey, pale);
@@ -18,7 +18,7 @@
18
18
  }}"/>
19
19
 
20
20
  <script>
21
- import {onDestroy, onMount} from "svelte";
21
+ import {onDestroy, onMount, tick} from "svelte";
22
22
  import DropdownList from "./DropdownList.svelte";
23
23
  import {Utils} from "../utils";
24
24
 
@@ -34,60 +34,60 @@
34
34
  ...rest
35
35
  } = $props();
36
36
 
37
- const availableWidths = ["xs", "sm", "md", "lg", "xl"];
38
-
39
37
  let selectElement = $state();
40
38
  let items = $state();
41
39
  let labelElement = $state();
42
- let observer;
40
+ let observer = new MutationObserver(setupItemsList);
41
+ let observerOptions = {
42
+ childList: true,
43
+ attributes: true,
44
+ subtree: true,
45
+ attributeFilter: ["label", "value", "disabled", "selected"]
46
+ };
43
47
  let instance = $state();
44
48
  let errorElement = $state();
45
49
  let parentRow = $derived($host().closest(".qc-formfield-row"));
46
- let widthClass = $derived.by(() => {
47
- if (availableWidths.includes(width)) {
48
- return `qc-dropdown-list-root-${width}`;
49
- }
50
- return `qc-dropdown-list-root-md`;
51
- });
50
+ let internalChange = false;
52
51
 
53
52
  onMount(() => {
54
53
  selectElement = $host().querySelector("select");
55
54
  labelElement = $host().querySelector("label");
56
-
57
55
  if (labelElement) {
58
56
  label = labelElement.innerHTML;
59
57
  }
60
58
  if (selectElement) {
61
59
  multiple = selectElement.multiple;
62
60
  disabled = selectElement.disabled;
63
- }
64
61
 
62
+ selectElement.addEventListener("change", handleSelectChange);
63
+ observer.observe(selectElement, observerOptions);
64
+ }
65
65
  setupItemsList();
66
- setupObserver();
66
+ $host().classList.add("qc-select");
67
67
  });
68
68
 
69
69
  onDestroy(() => {
70
70
  observer?.disconnect();
71
+ selectElement.removeEventListener("change", handleSelectChange);
71
72
  });
72
73
 
73
74
  $effect(() => {
74
- if (
75
- selectElement
76
- && selectElement.options
77
- && selectElement.options.length > 0
78
- && value
79
- && value.length > 0
80
- ) {
81
- for (const option of selectElement.options) {
82
- if (value.includes(option.value)) {
83
- option.setAttribute('selected', '');
84
- option.selected = true;
85
- } else {
86
- option.removeAttribute('selected');
87
- option.selected = false;
88
- }
75
+ if (!selectElement) return;
76
+ if (!selectElement.options) return;
77
+ internalChange = true;
78
+ let newOptionSelected = false;
79
+ for (const option of selectElement.options) {
80
+ const selected = value.includes(option.value);
81
+ if (selected !== option.selected) {
82
+ option.toggleAttribute("selected", selected);
83
+ option.selected = selected;
84
+ newOptionSelected = true;
89
85
  }
90
86
  }
87
+ if (newOptionSelected) {
88
+ selectElement.dispatchEvent(new Event('change'));
89
+ }
90
+ tick().then(() => internalChange = false)
91
91
  });
92
92
 
93
93
  $effect(() => {
@@ -96,13 +96,6 @@
96
96
  }
97
97
  });
98
98
 
99
- $effect(() => {
100
- if (widthClass) {
101
- $host().classList.add("qc-dropdown-list-root");
102
- $host().classList.add(widthClass);
103
- }
104
- });
105
-
106
99
  function setupItemsList() {
107
100
  const options = selectElement?.querySelectorAll("option");
108
101
  if (options && options.length > 0) {
@@ -117,21 +110,10 @@
117
110
  }
118
111
  }
119
112
 
120
- function setupObserver() {
121
- if (selectElement) {
122
- if (observer) {
123
- return;
124
- }
125
- observer = new MutationObserver(setupItemsList);
126
- observer.observe(selectElement, {
127
- childList: true,
128
- attributes: true,
129
- attributeFilter: ["label", "value", "disabled", "selected"]
130
- });
131
- }
113
+ function handleSelectChange() {
114
+ if (internalChange) return;
115
+ setupItemsList();
132
116
  }
133
-
134
-
135
117
  </script>
136
118
 
137
119
  <div hidden>
@@ -145,7 +127,6 @@
145
127
  {placeholder}
146
128
  {width}
147
129
  webComponentMode={true}
148
- webComponentParentRow={parentRow}
149
130
  bind:value
150
131
  bind:errorElement
151
132
  bind:invalid
@@ -6,7 +6,6 @@
6
6
  import DropdownList from "../DropdownList.svelte";
7
7
  import {Utils} from "../../utils";
8
8
  import * as dropdownListTest from "./dropdownListTestUtils";
9
- import Button from "../../Button/Button.svelte";
10
9
 
11
10
  let singleChoiceOptions = $state(dropdownListTest.genericOptions());
12
11
  let singleChoiceWithSearchOptions = $state(dropdownListTest.genericOptions());
@@ -15,8 +14,29 @@
15
14
  let restaurants = $state(dropdownListTest.restaurantsArray());
16
15
  let regions = $state(dropdownListTest.regionsArray());
17
16
 
17
+ let restaurantsDropdownList = $state(null);
18
+ let regionsDropdownList = $state(null);
19
+
18
20
  singleChoiceOptions[0].checked = true;
19
21
  singleChoiceWithSearchOptions[0].checked = true;
22
+
23
+ function validateForm(event) {
24
+ event.preventDefault();
25
+
26
+ if (restaurantsDropdownList && regionsDropdownList) {
27
+ let isValid = restaurantsDropdownList.value && restaurantsDropdownList.value.length > 0;
28
+ restaurantsDropdownList.invalid = !isValid;
29
+
30
+ if (isValid) {
31
+ const alertParts = [
32
+ "Formulaire soumis avec les données suivantes :",
33
+ "Type de restaurant: " + restaurantsDropdownList.value.join(", "),
34
+ "Régions desservies: " + regionsDropdownList.value.join(", ")
35
+ ]
36
+ alert(alertParts.join("\n"));
37
+ }
38
+ }
39
+ }
20
40
  </script>
21
41
 
22
42
  <DropdownList
@@ -62,8 +82,17 @@
62
82
  items={JSON.parse(JSON.stringify(multipleChoiceOptions))}
63
83
  />
64
84
 
85
+ <DropdownList
86
+ id="dropdown-list-multiple-sm"
87
+ label="Débordement"
88
+ multiple
89
+ width="sm"
90
+ items={dropdownListTest.overflowOptions()}
91
+ />
92
+
65
93
  <form id="dropdown-list-embedded-test-form">
66
94
  <DropdownList
95
+ bind:this={restaurantsDropdownList}
67
96
  label="Types de restaurants"
68
97
  required="true"
69
98
  placeholder="Types de restaurants"
@@ -74,6 +103,7 @@
74
103
  />
75
104
 
76
105
  <DropdownList
106
+ bind:this={regionsDropdownList}
77
107
  label="Régions desservies"
78
108
  multiple="true"
79
109
  placeholder="Sélectionner une région"
@@ -83,7 +113,12 @@
83
113
  width="lg"
84
114
  />
85
115
 
86
- <Button label="Envoyer" type="submit" compact="true" />
116
+ <button
117
+ type="submit" class="qc-button qc-primary qc-compact"
118
+ onclick={(event) => validateForm(event)}
119
+ >
120
+ Envoyer
121
+ </button>
87
122
  </form>
88
123
 
89
124
  <link rel='stylesheet' href='{Utils.cssPath}'>
@@ -20,6 +20,15 @@
20
20
  </select>
21
21
  </qc-select>
22
22
 
23
+ <script>
24
+ const selectElement = document.getElementById("select-single-choice");
25
+ console.log("Select element options[0]:", selectElement.options[0]);
26
+
27
+ selectElement.addEventListener("change", (event) => {
28
+ console.log("Option sélectionnée :", event.target.value);
29
+ });
30
+ </script>
31
+
23
32
  <div style="height: 40rem;">
24
33
  <qc-select id="qc-select-single-choice-search" enable-search>
25
34
  <label for="select-single-choice-search">Choix unique avec recherche</label>
@@ -68,7 +77,7 @@
68
77
 
69
78
  <div class="qc-formfield-row">
70
79
  <qc-select id="qc-select-invalid" invalid>
71
- <label for="select-invalid">État invalide</label>
80
+ <label for="select-invalid">État initialement invalide dans .qc-formfield-row</label>
72
81
  <select multiple id="select-invalid">
73
82
  <option value="1">Option 1</option>
74
83
  <option value="2">Option 2</option>
@@ -117,6 +126,15 @@
117
126
  <select id="select-disabled" disabled>disabled</select>
118
127
  </qc-select>
119
128
 
129
+ <qc-select id="qc-select-multiple-choices-sm" width="sm">
130
+ <label for="select-multiple-choices-sm">Débordement</label>
131
+ <select id="select-multiple-choices-sm" multiple>
132
+ <option value="1">Option 1 + texte de remplissage</option>
133
+ <option value="2">Option 2 + texte de remplissage</option>
134
+ <option value="3">Option 3 + texte de remplissage</option>
135
+ </select>
136
+ </qc-select>
137
+
120
138
  <form id="dropdown-list-form">
121
139
  <qc-select
122
140
  id="dropdown-list-restaurants"
@@ -12,6 +12,20 @@ export function genericOptions() {
12
12
  return genericOptions;
13
13
  }
14
14
 
15
+ export function overflowOptions() {
16
+ let overflowOptions = [];
17
+ for (let i = 1; i <= 3; i++) {
18
+ overflowOptions.push({
19
+ value: i,
20
+ label: `Option ${i} + texte de remplissage`,
21
+ disabled: false,
22
+ checked: false,
23
+ });
24
+ }
25
+
26
+ return overflowOptions;
27
+ }
28
+
15
29
  export function restaurantsArray() {
16
30
  return [
17
31
  {