qc-trousse-sdg 1.4.6 → 1.4.8

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 (62) hide show
  1. package/README.md +14 -0
  2. package/dist/css/qc-sdg-no-grid.min.css +1 -1
  3. package/dist/css/qc-sdg.min.css +1 -1
  4. package/dist/js/qc-sdg.min.js +1 -1
  5. package/package.json +1 -1
  6. package/public/css/qc-doc-sdg.css +38 -6
  7. package/public/css/qc-sdg-no-grid.css +67 -40
  8. package/public/css/qc-sdg.css +67 -40
  9. package/public/index.html +77 -23
  10. package/public/js/qc-doc-sdg.js +381 -225
  11. package/public/js/qc-sdg.js +1053 -633
  12. package/src/doc/qc-doc-sdg.js +6 -1
  13. package/src/doc/scss/components/_exemple.scss +5 -1
  14. package/src/doc/scss/qc-doc-sdg.scss +22 -4
  15. package/src/sdg/bases/Icon/Icon.svelte +2 -0
  16. package/src/sdg/bases/links/_links.scss +18 -12
  17. package/src/sdg/components/Alert/Alert.svelte +28 -9
  18. package/src/sdg/components/Alert/AlertWC.svelte +20 -5
  19. package/src/sdg/components/Alert/Test/AlertSvelteTest.svelte +25 -0
  20. package/src/sdg/components/Alert/Test/alertBaselineTest.html +13 -0
  21. package/src/sdg/components/Alert/Test/alertSvelteTest.html +1 -0
  22. package/src/sdg/components/Alert/_alert.html +23 -11
  23. package/src/sdg/components/Checkbox/Checkbox.svelte +6 -5
  24. package/src/sdg/components/DropdownList/DropdownList.svelte +65 -14
  25. package/src/sdg/components/DropdownList/DropdownListButton/DropdownListButton.svelte +2 -6
  26. package/src/sdg/components/DropdownList/DropdownListItems/DropdownListItems.svelte +4 -22
  27. package/src/sdg/components/DropdownList/DropdownListItems/DropdownListItemsMultiple/DropdownListItemsMultiple.svelte +2 -1
  28. package/src/sdg/components/DropdownList/DropdownListItems/DropdownListItemsSingle/DropdownListItemsSingle.svelte +2 -1
  29. package/src/sdg/components/DropdownList/SelectWC.svelte +39 -13
  30. package/src/sdg/components/DropdownList/Test/DropdownListSvelteTest.svelte +2 -2
  31. package/src/sdg/components/DropdownList/Test/dropdownListBaselineTest.html +7 -0
  32. package/src/sdg/components/DropdownList/_dropdownList.scss +7 -5
  33. package/src/sdg/components/DropdownList/_select.html +31 -5
  34. package/src/sdg/components/ExternalLink/ExternalLink.svelte +36 -74
  35. package/src/sdg/components/ExternalLink/ExternalLinkWC.svelte +44 -1
  36. package/src/sdg/components/ExternalLink/externalLinkBaselineTest.html +45 -0
  37. package/src/sdg/components/Fieldset/_fieldset.scss +1 -1
  38. package/src/sdg/components/Label/LabelText.svelte +2 -1
  39. package/src/sdg/components/Label/_label.scss +10 -2
  40. package/src/sdg/components/PivFooter/_pivFooter.html +4 -4
  41. package/src/sdg/components/SearchInput/SearchInput.svelte +14 -2
  42. package/src/sdg/components/SearchInput/SearchInputWC.svelte +2 -0
  43. package/src/sdg/components/SearchInput/_searchInput.html +18 -2
  44. package/src/sdg/components/SearchInput/_searchInput.scss +10 -1
  45. package/src/sdg/components/TextField/Test/TextFieldEmbededTest.svelte +19 -3
  46. package/src/sdg/components/TextField/Test/textFieldBaselineTest.html +5 -2
  47. package/src/sdg/components/TextField/TextField.svelte +12 -6
  48. package/src/sdg/components/TextField/TextFieldWC.svelte +19 -4
  49. package/src/sdg/components/TextField/_textField.html +1 -1
  50. package/src/sdg/components/TextField/_textField.scss +0 -6
  51. package/src/sdg/components/TextField/textFieldUtils.js +3 -2
  52. package/src/sdg/components/utils.js +23 -0
  53. package/src/sdg/qc-sdg-test.js +2 -1
  54. package/src/sdg/scss/lib/_mixins.scss +6 -0
  55. package/src/sdg/scss/utilities/_states.scss +1 -1
  56. package/tests/alert-baseline.spec.ts +23 -0
  57. package/tests/alert-svelte.spec.ts +23 -0
  58. package/tests/buildSvelteTestsIgnore.json +2 -1
  59. package/tests/dropdown-list-baseline.spec.ts +8 -0
  60. package/tests/external-link-baseline.spec.ts +30 -0
  61. package/tests/textfield-baseline.spec.ts +5 -5
  62. package/tests/textfield-svelte.spec.ts +5 -5
@@ -9087,6 +9087,29 @@
9087
9087
  // Convertit le mot en minuscules.
9088
9088
  return word.toLowerCase();
9089
9089
  }
9090
+
9091
+ static now() {
9092
+ return (new Date()).getTime();
9093
+ }
9094
+
9095
+ /**
9096
+ * Creates a MutationObserver instance with selector nesting check
9097
+ * @param rootElement
9098
+ * @param callback
9099
+ * @param selector
9100
+ * @returns {MutationObserver | null}
9101
+ */
9102
+ static createMutationObserver(rootElement, callback, selector) {
9103
+ if (!selector) {
9104
+ selector = rootElement.tagName.toLowerCase();
9105
+ }
9106
+ if (rootElement.querySelector(selector)) {
9107
+ console.warn(`Imbrication d'éléments "${selector}" détectée. Le MutationObserver n'est pas créé`);
9108
+ return null;
9109
+ }
9110
+
9111
+ return new MutationObserver(callback);
9112
+ }
9090
9113
  }
9091
9114
 
9092
9115
  function getCacheBustingParam(cssPath, currentScriptSrc) {
@@ -9133,7 +9156,7 @@
9133
9156
 
9134
9157
  Icon[FILENAME] = 'src/sdg/bases/Icon/Icon.svelte';
9135
9158
 
9136
- var root$n = add_locations(from_html(`<div></div>`), Icon[FILENAME], [[16, 0]]);
9159
+ var root$n = add_locations(from_html(`<div></div>`), Icon[FILENAME], [[17, 0]]);
9137
9160
 
9138
9161
  function Icon($$anchor, $$props) {
9139
9162
  check_target(new.target);
@@ -9147,6 +9170,7 @@
9147
9170
  height = prop($$props, 'height', 7, 'auto'),
9148
9171
  src = prop($$props, 'src', 7, ''),
9149
9172
  rotate = prop($$props, 'rotate', 7, 0),
9173
+ rootElement = prop($$props, 'rootElement', 15),
9150
9174
  rest = rest_props(
9151
9175
  $$props,
9152
9176
  [
@@ -9161,7 +9185,8 @@
9161
9185
  'width',
9162
9186
  'height',
9163
9187
  'src',
9164
- 'rotate'
9188
+ 'rotate',
9189
+ 'rootElement'
9165
9190
  ]);
9166
9191
 
9167
9192
  let attributes = tag(user_derived(() => strict_equals(width(), 'auto') ? { 'data-img-size': size() } : {}), 'attributes');
@@ -9239,6 +9264,15 @@
9239
9264
  flushSync();
9240
9265
  },
9241
9266
 
9267
+ get rootElement() {
9268
+ return rootElement();
9269
+ },
9270
+
9271
+ set rootElement($$value) {
9272
+ rootElement($$value);
9273
+ flushSync();
9274
+ },
9275
+
9242
9276
  ...legacy_api()
9243
9277
  };
9244
9278
 
@@ -9262,6 +9296,7 @@
9262
9296
  [STYLE]: { '--img-rotate': rotate() && rotate() + "deg" }
9263
9297
  }));
9264
9298
 
9299
+ bind_this(div, ($$value) => rootElement($$value), () => rootElement());
9265
9300
  append($$anchor, div);
9266
9301
 
9267
9302
  return pop($$exports);
@@ -9277,7 +9312,8 @@
9277
9312
  width: {},
9278
9313
  height: {},
9279
9314
  src: {},
9280
- rotate: {}
9315
+ rotate: {},
9316
+ rootElement: {}
9281
9317
  },
9282
9318
  [],
9283
9319
  [],
@@ -10874,7 +10910,7 @@
10874
10910
 
10875
10911
  Alert[FILENAME] = 'src/sdg/components/Alert/Alert.svelte';
10876
10912
 
10877
- var root_1$7 = add_locations(from_html(`<div role="alert"><div><div class="qc-general-alert-elements"><!> <div class="qc-alert-content"><!> <!></div> <!></div></div></div>`), Alert[FILENAME], [[40, 4, [[43, 8, [[44, 12, [[50, 16]]]]]]]]);
10913
+ var root_1$7 = add_locations(from_html(`<div role="alert"><div><div class="qc-general-alert-elements"><!> <div class="qc-alert-content"><!> <!></div> <!></div></div></div>`), Alert[FILENAME], [[59, 4, [[62, 8, [[63, 12, [[69, 16]]]]]]]]);
10878
10914
 
10879
10915
  function Alert($$anchor, $$props) {
10880
10916
  check_target(new.target);
@@ -10883,9 +10919,14 @@
10883
10919
  let type = prop($$props, 'type', 7, "general"),
10884
10920
  maskable = prop($$props, 'maskable', 7, ""),
10885
10921
  content = prop($$props, 'content', 7, ""),
10886
- hide = prop($$props, 'hide', 7, "false"),
10922
+ hide = prop($$props, 'hide', 15, "false"),
10887
10923
  fullWidth = prop($$props, 'fullWidth', 7, "false"),
10888
- slotContent = prop($$props, 'slotContent', 7);
10924
+ slotContent = prop($$props, 'slotContent', 7),
10925
+ id = prop($$props, 'id', 7),
10926
+ persistenceKey = prop($$props, 'persistenceKey', 7),
10927
+ persistHidden = prop($$props, 'persistHidden', 7, false),
10928
+ rootElement = prop($$props, 'rootElement', 15),
10929
+ hideAlertCallback = prop($$props, 'hideAlertCallback', 7, () => {});
10889
10930
 
10890
10931
  const language = Utils.getPageLanguage();
10891
10932
  const typeClass = strict_equals(type(), "", false) ? type() : 'general';
@@ -10897,12 +10938,38 @@
10897
10938
 
10898
10939
  const generalLabel = strict_equals(language, 'fr') ? "Information importante" : "Important information";
10899
10940
  const label = strict_equals(type(), 'general') ? generalLabel : warningLabel;
10900
- let rootElement = tag(state(null), 'rootElement');
10901
10941
  let containerClass = "qc-container" + (strict_equals(fullWidth(), 'true') ? '-fluid' : '');
10902
10942
 
10943
+ onMount(() => {
10944
+ const key = getPersistenceKey();
10945
+
10946
+ if (!key) return;
10947
+
10948
+ hide(sessionStorage.getItem(key) ? "true" : "false");
10949
+ });
10950
+
10903
10951
  function hideAlert() {
10904
10952
  hide("true");
10905
- get(rootElement).dispatchEvent(new CustomEvent('qc.alert.hide', { bubbles: true, composed: true }));
10953
+ persistHiddenState();
10954
+ hideAlertCallback()();
10955
+ }
10956
+
10957
+ function getPersistenceKey() {
10958
+ if (!persistHidden()) return false;
10959
+
10960
+ const key = persistenceKey() || id();
10961
+
10962
+ if (!key) return false;
10963
+
10964
+ return 'qc-alert:' + key;
10965
+ }
10966
+
10967
+ function persistHiddenState() {
10968
+ const key = getPersistenceKey();
10969
+
10970
+ if (!key) return;
10971
+
10972
+ sessionStorage.setItem(key, Utils.now());
10906
10973
  }
10907
10974
 
10908
10975
  var $$exports = {
@@ -10960,6 +11027,51 @@
10960
11027
  flushSync();
10961
11028
  },
10962
11029
 
11030
+ get id() {
11031
+ return id();
11032
+ },
11033
+
11034
+ set id($$value) {
11035
+ id($$value);
11036
+ flushSync();
11037
+ },
11038
+
11039
+ get persistenceKey() {
11040
+ return persistenceKey();
11041
+ },
11042
+
11043
+ set persistenceKey($$value) {
11044
+ persistenceKey($$value);
11045
+ flushSync();
11046
+ },
11047
+
11048
+ get persistHidden() {
11049
+ return persistHidden();
11050
+ },
11051
+
11052
+ set persistHidden($$value = false) {
11053
+ persistHidden($$value);
11054
+ flushSync();
11055
+ },
11056
+
11057
+ get rootElement() {
11058
+ return rootElement();
11059
+ },
11060
+
11061
+ set rootElement($$value) {
11062
+ rootElement($$value);
11063
+ flushSync();
11064
+ },
11065
+
11066
+ get hideAlertCallback() {
11067
+ return hideAlertCallback();
11068
+ },
11069
+
11070
+ set hideAlertCallback($$value = () => {}) {
11071
+ hideAlertCallback($$value);
11072
+ flushSync();
11073
+ },
11074
+
10963
11075
  ...legacy_api()
10964
11076
  };
10965
11077
 
@@ -10995,7 +11107,7 @@
10995
11107
  }),
10996
11108
  'component',
10997
11109
  Alert,
10998
- 45,
11110
+ 64,
10999
11111
  16,
11000
11112
  { componentTag: 'Icon' }
11001
11113
  );
@@ -11029,7 +11141,7 @@
11029
11141
  }),
11030
11142
  'component',
11031
11143
  Alert,
11032
- 55,
11144
+ 74,
11033
11145
  20,
11034
11146
  { componentTag: 'IconButton' }
11035
11147
  );
@@ -11041,7 +11153,7 @@
11041
11153
  }),
11042
11154
  'if',
11043
11155
  Alert,
11044
- 54,
11156
+ 73,
11045
11157
  16
11046
11158
  );
11047
11159
  }
@@ -11049,7 +11161,7 @@
11049
11161
  reset(div_2);
11050
11162
  reset(div_1);
11051
11163
  reset(div);
11052
- bind_this(div, ($$value) => set(rootElement, $$value), () => get(rootElement));
11164
+ bind_this(div, ($$value) => rootElement($$value), () => rootElement());
11053
11165
 
11054
11166
  template_effect(() => {
11055
11167
  set_class(div, 1, `qc-general-alert ${typeClass ?? ''}`);
@@ -11065,7 +11177,7 @@
11065
11177
  }),
11066
11178
  'if',
11067
11179
  Alert,
11068
- 39,
11180
+ 58,
11069
11181
  0
11070
11182
  );
11071
11183
  }
@@ -11083,7 +11195,12 @@
11083
11195
  content: {},
11084
11196
  hide: {},
11085
11197
  fullWidth: {},
11086
- slotContent: {}
11198
+ slotContent: {},
11199
+ id: {},
11200
+ persistenceKey: {},
11201
+ persistHidden: {},
11202
+ rootElement: {},
11203
+ hideAlertCallback: {}
11087
11204
  },
11088
11205
  [],
11089
11206
  [],
@@ -11092,18 +11209,69 @@
11092
11209
 
11093
11210
  AlertWC[FILENAME] = 'src/sdg/components/Alert/AlertWC.svelte';
11094
11211
 
11095
- var root$f = add_locations(from_html(`<!> <link rel="stylesheet"/>`, 1), AlertWC[FILENAME], [[25, 0]]);
11212
+ var root$f = add_locations(from_html(`<!> <link rel="stylesheet"/>`, 1), AlertWC[FILENAME], [[40, 0]]);
11096
11213
 
11097
11214
  function AlertWC($$anchor, $$props) {
11098
11215
  check_target(new.target);
11099
11216
  push($$props, true);
11100
11217
 
11101
- const props = rest_props($$props, ['$$slots', '$$events', '$$legacy', '$$host']);
11102
- var $$exports = { ...legacy_api() };
11218
+ var $$ownership_validator = create_ownership_validator($$props);
11219
+
11220
+ let hide = prop($$props, 'hide', 7, "false"),
11221
+ props = rest_props($$props, ['$$slots', '$$events', '$$legacy', '$$host', 'hide']);
11222
+
11223
+ let rootElement = tag(state(void 0), 'rootElement');
11224
+
11225
+ function hideAlertCallback() {
11226
+ get(rootElement)?.dispatchEvent(new CustomEvent('qc.alert.hide', { bubbles: true, composed: true }));
11227
+ }
11228
+
11229
+ var $$exports = {
11230
+ get hide() {
11231
+ return hide();
11232
+ },
11233
+
11234
+ set hide($$value = "false") {
11235
+ hide($$value);
11236
+ flushSync();
11237
+ },
11238
+
11239
+ ...legacy_api()
11240
+ };
11241
+
11103
11242
  var fragment = root$f();
11104
11243
  var node = first_child(fragment);
11105
11244
 
11106
- add_svelte_meta(() => Alert(node, spread_props(() => props, { slotContent: `<slot />` })), 'component', AlertWC, 21, 1, { componentTag: 'Alert' });
11245
+ {
11246
+ $$ownership_validator.binding('hide', Alert, hide);
11247
+
11248
+ add_svelte_meta(
11249
+ () => Alert(node, spread_props({ hideAlertCallback }, () => props, {
11250
+ slotContent: `<slot />`,
11251
+
11252
+ get hide() {
11253
+ return hide();
11254
+ },
11255
+
11256
+ set hide($$value) {
11257
+ hide($$value);
11258
+ },
11259
+
11260
+ get rootElement() {
11261
+ return get(rootElement);
11262
+ },
11263
+
11264
+ set rootElement($$value) {
11265
+ set(rootElement, $$value, true);
11266
+ }
11267
+ })),
11268
+ 'component',
11269
+ AlertWC,
11270
+ 33,
11271
+ 1,
11272
+ { componentTag: 'Alert' }
11273
+ );
11274
+ }
11107
11275
 
11108
11276
  var link = sibling(node, 2);
11109
11277
 
@@ -11120,7 +11288,9 @@
11120
11288
  maskable: { attribute: 'maskable' },
11121
11289
  fullWidth: { attribute: 'full-width' },
11122
11290
  content: { attribute: 'content' },
11123
- hide: { attribute: 'hide' }
11291
+ hide: { attribute: 'hide', reflect: true },
11292
+ persistHidden: { attribute: 'persist-hidden', type: 'Boolean' },
11293
+ persistenceKey: { attribute: 'persistence-key', type: 'String' }
11124
11294
  },
11125
11295
  [],
11126
11296
  [],
@@ -11267,91 +11437,49 @@
11267
11437
 
11268
11438
  ExternalLink[FILENAME] = 'src/sdg/components/ExternalLink/ExternalLink.svelte';
11269
11439
 
11270
- var root$d = add_locations(from_html(`<span role="img" class="qc-ext-link-img"></span>`), ExternalLink[FILENAME], [[89, 0]]);
11440
+ var root$d = add_locations(from_html(`<div hidden=""><!></div>`), ExternalLink[FILENAME], [[48, 0]]);
11271
11441
 
11272
11442
  function ExternalLink($$anchor, $$props) {
11273
11443
  check_target(new.target);
11274
11444
  push($$props, true);
11275
11445
 
11276
- const externalIconAlt = prop($$props, 'externalIconAlt', 23, () => strict_equals(Utils.getPageLanguage(), 'fr')
11277
- ? "Ce lien dirige vers un autre site."
11278
- : "This link directs to another site.");
11446
+ let externalIconAlt = prop($$props, 'externalIconAlt', 23, () => strict_equals(Utils.getPageLanguage(), 'fr')
11447
+ ? "Ce lien dirige vers un autre site."
11448
+ : "This link directs to another site."),
11449
+ links = prop($$props, 'links', 23, () => []),
11450
+ isUpdating = prop($$props, 'isUpdating', 15, false),
11451
+ nestedExternalLinks = prop($$props, 'nestedExternalLinks', 7, false);
11279
11452
 
11280
11453
  let imgElement = tag(state(void 0), 'imgElement');
11454
+ let processedLinks = new Set();
11281
11455
 
11282
- function createVisibleNodesTreeWalker() {
11283
- return document.createTreeWalker(get(imgElement).parentElement, NodeFilter.SHOW_ALL, {
11284
- acceptNode: (node) => {
11285
- if (node instanceof Element) {
11286
- if (node.hasAttribute('hidden')) {
11287
- return NodeFilter.FILTER_REJECT;
11288
- }
11289
-
11290
- const style = window.getComputedStyle(node);
11291
-
11292
- // Si l'élément est masqué par CSS (display ou visibility), on l'ignore
11293
- if (strict_equals(style.display, 'none') || strict_equals(style.visibility, 'hidden') || strict_equals(style.position, 'absolute')) {
11294
- return NodeFilter.FILTER_REJECT;
11295
- }
11296
- }
11297
-
11298
- if (!node instanceof Text) {
11299
- return NodeFilter.FILTER_SKIP;
11300
- }
11301
-
11302
- // Ignore les nœuds vides
11303
- if (!(/\S/).test(node.textContent)) {
11304
- return NodeFilter.FILTER_SKIP;
11305
- }
11306
-
11307
- return NodeFilter.FILTER_ACCEPT;
11308
- }
11309
- });
11310
- }
11311
-
11312
- onMount(() => {
11313
- get(imgElement).parentElement.querySelectorAll('a').forEach((link) => {
11314
- // Crée un TreeWalker pour parcourir uniquement les nœuds texte visibles
11315
- const walker = createVisibleNodesTreeWalker();
11316
-
11317
- let lastTextNode = null;
11318
-
11319
- while (walker.nextNode()) {
11320
- lastTextNode = walker.currentNode;
11321
- }
11322
-
11323
- // S'il n'y a pas de nœud texte visible, on ne fait rien
11324
- if (!lastTextNode) {
11456
+ function addExternalLinkIcon(links) {
11457
+ links.forEach((link) => {
11458
+ if (processedLinks.has(link.innerHTML)) {
11325
11459
  return;
11326
11460
  }
11327
11461
 
11328
- // Séparer le contenu du dernier nœud texte en deux parties :
11329
- // le préfixe (éventuel) et le dernier mot
11330
- const text = lastTextNode.textContent;
11462
+ let linkContent = link.innerHTML;
11331
11463
 
11332
- const match = text.match(/^([\s\S]*\s)?(\S+)\s*$/m);
11333
-
11334
- if (!match) {
11335
- return;
11336
- }
11464
+ linkContent = `<span class="qc-ext-link-text">${linkContent}</span>&nbsp;${get(imgElement).outerHTML}`;
11465
+ link.innerHTML = linkContent;
11466
+ processedLinks.add(linkContent);
11467
+ });
11468
+ }
11337
11469
 
11338
- const prefix = match[1] || "";
11339
- const lastWord = match[2].replace(/([\/\-\u2013\u2014])/g, "$1<wbr>");
11470
+ user_effect(() => {
11471
+ if (nestedExternalLinks() || links().length <= 0 || !get(imgElement)) {
11472
+ return;
11473
+ }
11340
11474
 
11341
- // Crée un span avec white-space: nowrap pour empêcher le saut de ligne de l'image de lien externe
11342
- const span = document.createElement('span');
11475
+ isUpdating(true);
11343
11476
 
11344
- span.classList.add('img-wrap');
11345
- span.innerHTML = `${lastWord}`;
11346
- span.appendChild(get(imgElement));
11477
+ tick().then(() => {
11478
+ addExternalLinkIcon(links());
11347
11479
 
11348
- // Met à jour le nœud texte : on garde le préfixe et on insère le span après
11349
- if (prefix) {
11350
- lastTextNode.textContent = prefix;
11351
- lastTextNode.parentNode.insertBefore(span, lastTextNode.nextSibling);
11352
- } else {
11353
- lastTextNode.parentNode.replaceChild(span, lastTextNode);
11354
- }
11480
+ return tick();
11481
+ }).then(() => {
11482
+ isUpdating(false);
11355
11483
  });
11356
11484
  });
11357
11485
 
@@ -11369,19 +11497,82 @@
11369
11497
  flushSync();
11370
11498
  },
11371
11499
 
11500
+ get links() {
11501
+ return links();
11502
+ },
11503
+
11504
+ set links($$value = []) {
11505
+ links($$value);
11506
+ flushSync();
11507
+ },
11508
+
11509
+ get isUpdating() {
11510
+ return isUpdating();
11511
+ },
11512
+
11513
+ set isUpdating($$value = false) {
11514
+ isUpdating($$value);
11515
+ flushSync();
11516
+ },
11517
+
11518
+ get nestedExternalLinks() {
11519
+ return nestedExternalLinks();
11520
+ },
11521
+
11522
+ set nestedExternalLinks($$value = false) {
11523
+ nestedExternalLinks($$value);
11524
+ flushSync();
11525
+ },
11526
+
11372
11527
  ...legacy_api()
11373
11528
  };
11374
11529
 
11375
- var span_1 = root$d();
11530
+ var div = root$d();
11531
+ var node = child(div);
11532
+
11533
+ add_svelte_meta(
11534
+ () => Icon(node, {
11535
+ type: 'external-link',
11536
+
11537
+ get alt() {
11538
+ return externalIconAlt();
11539
+ },
11540
+
11541
+ class: 'qc-ext-link-img',
11542
+
11543
+ get rootElement() {
11544
+ return get(imgElement);
11545
+ },
11546
+
11547
+ set rootElement($$value) {
11548
+ set(imgElement, $$value, true);
11549
+ }
11550
+ }),
11551
+ 'component',
11552
+ ExternalLink,
11553
+ 49,
11554
+ 4,
11555
+ { componentTag: 'Icon' }
11556
+ );
11376
11557
 
11377
- bind_this(span_1, ($$value) => set(imgElement, $$value), () => get(imgElement));
11378
- template_effect(() => set_attribute(span_1, 'aria-label', externalIconAlt()));
11379
- append($$anchor, span_1);
11558
+ reset(div);
11559
+ append($$anchor, div);
11380
11560
 
11381
11561
  return pop($$exports);
11382
11562
  }
11383
11563
 
11384
- create_custom_element(ExternalLink, { externalIconAlt: {} }, [], [], true);
11564
+ create_custom_element(
11565
+ ExternalLink,
11566
+ {
11567
+ externalIconAlt: {},
11568
+ links: {},
11569
+ isUpdating: {},
11570
+ nestedExternalLinks: {}
11571
+ },
11572
+ [],
11573
+ [],
11574
+ true
11575
+ );
11385
11576
 
11386
11577
  ExternalLinkWC[FILENAME] = 'src/sdg/components/ExternalLink/ExternalLinkWC.svelte';
11387
11578
 
@@ -11390,48 +11581,341 @@
11390
11581
  push($$props, true);
11391
11582
 
11392
11583
  const props = rest_props($$props, ['$$slots', '$$events', '$$legacy', '$$host']);
11584
+ const nestedExternalLinks = $$props.$$host.querySelector('qc-external-link');
11585
+ let links = tag(state(proxy([])), 'links');
11586
+ const observer = Utils.createMutationObserver($$props.$$host, refreshLinks);
11587
+ let isUpdating = tag(state(false), 'isUpdating');
11588
+ let pendingUpdate = false;
11589
+
11590
+ function queryLinks() {
11591
+ return Array.from($$props.$$host.querySelectorAll('a'));
11592
+ }
11593
+
11594
+ function refreshLinks() {
11595
+ if (get(isUpdating) || pendingUpdate) {
11596
+ return;
11597
+ }
11598
+
11599
+ pendingUpdate = true;
11600
+
11601
+ tick().then(() => {
11602
+ if (get(isUpdating)) {
11603
+ pendingUpdate = false;
11604
+
11605
+ return;
11606
+ }
11607
+
11608
+ set(links, queryLinks(), true);
11609
+ pendingUpdate = false;
11610
+ });
11611
+ }
11612
+
11613
+ onMount(() => {
11614
+ $$props.$$host.classList.add('qc-external-link');
11615
+ set(links, queryLinks(), true);
11616
+ observer?.observe($$props.$$host, { childList: true, characterData: true, subtree: true });
11617
+ });
11618
+
11619
+ onDestroy(() => {
11620
+ observer?.disconnect();
11621
+ });
11622
+
11393
11623
  var $$exports = { ...legacy_api() };
11394
11624
 
11395
- add_svelte_meta(() => ExternalLink($$anchor, spread_props(() => props)), 'component', ExternalLinkWC, 15, 0, { componentTag: 'ExternalLink' });
11625
+ add_svelte_meta(
11626
+ () => ExternalLink($$anchor, spread_props(
11627
+ {
11628
+ get links() {
11629
+ return get(links);
11630
+ },
11631
+
11632
+ get nestedExternalLinks() {
11633
+ return nestedExternalLinks;
11634
+ }
11635
+ },
11636
+ () => props,
11637
+ {
11638
+ get isUpdating() {
11639
+ return get(isUpdating);
11640
+ },
11641
+
11642
+ set isUpdating($$value) {
11643
+ set(isUpdating, $$value, true);
11644
+ }
11645
+ }
11646
+ )),
11647
+ 'component',
11648
+ ExternalLinkWC,
11649
+ 58,
11650
+ 0,
11651
+ { componentTag: 'ExternalLink' }
11652
+ );
11396
11653
 
11397
11654
  return pop($$exports);
11398
11655
  }
11399
11656
 
11400
11657
  customElements.define('qc-external-link', create_custom_element(ExternalLinkWC, { externalIconAlt: { attribute: 'img-alt' } }, [], [], false));
11401
11658
 
11402
- SearchInput[FILENAME] = 'src/sdg/components/SearchInput/SearchInput.svelte';
11659
+ LabelText[FILENAME] = 'src/sdg/components/Label/LabelText.svelte';
11403
11660
 
11404
- var root$c = add_locations(from_html(`<div><!> <input/> <!></div>`), SearchInput[FILENAME], [[28, 0, [[39, 4]]]]);
11661
+ var root_1$6 = add_locations(from_html(`<span class="qc-required" aria-hidden="true">*</span>`), LabelText[FILENAME], [[5, 61]]);
11662
+ var root$c = add_locations(from_html(`<span class="qc-label-text"><!></span><!>`, 1), LabelText[FILENAME], [[5, 0]]);
11405
11663
 
11406
- function SearchInput($$anchor, $$props) {
11664
+ function LabelText($$anchor, $$props) {
11407
11665
  check_target(new.target);
11408
11666
  push($$props, true);
11409
11667
 
11410
- const lang = Utils.getPageLanguage();
11411
-
11412
- let value = prop($$props, 'value', 15, ''),
11413
- ariaLabel = prop($$props, 'ariaLabel', 23, () => strict_equals(lang, "fr") ? "Rechercher..." : "Search..."),
11414
- clearAriaLabel = prop($$props, 'clearAriaLabel', 23, () => strict_equals(lang, "fr") ? "Effacer le texte" : "Clear text"),
11415
- leftIcon = prop($$props, 'leftIcon', 7, false),
11416
- id = prop($$props, 'id', 23, () => `qc-search-input-${Math.random().toString(36).slice(2, 11)}`),
11417
- rest = rest_props(
11418
- $$props,
11419
- [
11420
- '$$slots',
11421
- '$$events',
11422
- '$$legacy',
11423
- '$$host',
11424
- 'value',
11425
- 'ariaLabel',
11426
- 'clearAriaLabel',
11427
- 'leftIcon',
11428
- 'id'
11429
- ]);
11668
+ let text = prop($$props, 'text', 7),
11669
+ required = prop($$props, 'required', 7);
11430
11670
 
11431
- leftIcon(strict_equals(leftIcon(), true) || strict_equals(leftIcon(), "true") || strict_equals(leftIcon(), ""));
11671
+ var $$exports = {
11672
+ get text() {
11673
+ return text();
11674
+ },
11432
11675
 
11433
- const isDisabled = strict_equals($$props.disabled, true) || strict_equals($$props.disabled, "true") || strict_equals($$props.disabled, "");
11434
- let searchInput;
11676
+ set text($$value) {
11677
+ text($$value);
11678
+ flushSync();
11679
+ },
11680
+
11681
+ get required() {
11682
+ return required();
11683
+ },
11684
+
11685
+ set required($$value) {
11686
+ required($$value);
11687
+ flushSync();
11688
+ },
11689
+
11690
+ ...legacy_api()
11691
+ };
11692
+
11693
+ var fragment = root$c();
11694
+ var span = first_child(fragment);
11695
+ var node = child(span);
11696
+
11697
+ html(node, text);
11698
+ reset(span);
11699
+
11700
+ var node_1 = sibling(span);
11701
+
11702
+ {
11703
+ var consequent = ($$anchor) => {
11704
+ var span_1 = root_1$6();
11705
+
11706
+ append($$anchor, span_1);
11707
+ };
11708
+
11709
+ add_svelte_meta(
11710
+ () => if_block(node_1, ($$render) => {
11711
+ if (required()) $$render(consequent);
11712
+ }),
11713
+ 'if',
11714
+ LabelText,
11715
+ 5,
11716
+ 47
11717
+ );
11718
+ }
11719
+
11720
+ append($$anchor, fragment);
11721
+
11722
+ return pop($$exports);
11723
+ }
11724
+
11725
+ create_custom_element(LabelText, { text: {}, required: {} }, [], [], true);
11726
+
11727
+ Label[FILENAME] = 'src/sdg/components/Label/Label.svelte';
11728
+
11729
+ var root$b = add_locations(from_html(`<label><!></label>`), Label[FILENAME], [[16, 0]]);
11730
+
11731
+ function Label($$anchor, $$props) {
11732
+ check_target(new.target);
11733
+ push($$props, true);
11734
+
11735
+ let forId = prop($$props, 'forId', 7),
11736
+ text = prop($$props, 'text', 7),
11737
+ required = prop($$props, 'required', 7, false),
11738
+ compact = prop($$props, 'compact', 7, false),
11739
+ bold = prop($$props, 'bold', 7, false),
11740
+ disabled = prop($$props, 'disabled', 7, false),
11741
+ rootElement = prop($$props, 'rootElement', 15),
11742
+ rest = rest_props(
11743
+ $$props,
11744
+ [
11745
+ '$$slots',
11746
+ '$$events',
11747
+ '$$legacy',
11748
+ '$$host',
11749
+ 'forId',
11750
+ 'text',
11751
+ 'required',
11752
+ 'compact',
11753
+ 'bold',
11754
+ 'disabled',
11755
+ 'rootElement'
11756
+ ]);
11757
+
11758
+ var $$exports = {
11759
+ get forId() {
11760
+ return forId();
11761
+ },
11762
+
11763
+ set forId($$value) {
11764
+ forId($$value);
11765
+ flushSync();
11766
+ },
11767
+
11768
+ get text() {
11769
+ return text();
11770
+ },
11771
+
11772
+ set text($$value) {
11773
+ text($$value);
11774
+ flushSync();
11775
+ },
11776
+
11777
+ get required() {
11778
+ return required();
11779
+ },
11780
+
11781
+ set required($$value = false) {
11782
+ required($$value);
11783
+ flushSync();
11784
+ },
11785
+
11786
+ get compact() {
11787
+ return compact();
11788
+ },
11789
+
11790
+ set compact($$value = false) {
11791
+ compact($$value);
11792
+ flushSync();
11793
+ },
11794
+
11795
+ get bold() {
11796
+ return bold();
11797
+ },
11798
+
11799
+ set bold($$value = false) {
11800
+ bold($$value);
11801
+ flushSync();
11802
+ },
11803
+
11804
+ get disabled() {
11805
+ return disabled();
11806
+ },
11807
+
11808
+ set disabled($$value = false) {
11809
+ disabled($$value);
11810
+ flushSync();
11811
+ },
11812
+
11813
+ get rootElement() {
11814
+ return rootElement();
11815
+ },
11816
+
11817
+ set rootElement($$value) {
11818
+ rootElement($$value);
11819
+ flushSync();
11820
+ },
11821
+
11822
+ ...legacy_api()
11823
+ };
11824
+
11825
+ var label = root$b();
11826
+
11827
+ attribute_effect(label, () => ({
11828
+ for: forId(),
11829
+
11830
+ class: [
11831
+ "qc-label",
11832
+ compact() && "qc-compact",
11833
+ bold() && "qc-bold",
11834
+ disabled() && "qc-disabled"
11835
+ ],
11836
+
11837
+ ...rest
11838
+ }));
11839
+
11840
+ var node = child(label);
11841
+
11842
+ add_svelte_meta(
11843
+ () => LabelText(node, {
11844
+ get text() {
11845
+ return text();
11846
+ },
11847
+
11848
+ get required() {
11849
+ return required();
11850
+ }
11851
+ }),
11852
+ 'component',
11853
+ Label,
11854
+ 27,
11855
+ 4,
11856
+ { componentTag: 'LabelText' }
11857
+ );
11858
+
11859
+ reset(label);
11860
+ bind_this(label, ($$value) => rootElement($$value), () => rootElement());
11861
+ append($$anchor, label);
11862
+
11863
+ return pop($$exports);
11864
+ }
11865
+
11866
+ create_custom_element(
11867
+ Label,
11868
+ {
11869
+ forId: {},
11870
+ text: {},
11871
+ required: {},
11872
+ compact: {},
11873
+ bold: {},
11874
+ disabled: {},
11875
+ rootElement: {}
11876
+ },
11877
+ [],
11878
+ [],
11879
+ true
11880
+ );
11881
+
11882
+ SearchInput[FILENAME] = 'src/sdg/components/SearchInput/SearchInput.svelte';
11883
+
11884
+ var root$a = add_locations(from_html(`<!> <div><!> <input/> <!></div>`, 1), SearchInput[FILENAME], [[38, 0, [[51, 4]]]]);
11885
+
11886
+ function SearchInput($$anchor, $$props) {
11887
+ check_target(new.target);
11888
+ push($$props, true);
11889
+
11890
+ const lang = Utils.getPageLanguage();
11891
+
11892
+ let value = prop($$props, 'value', 15, ''),
11893
+ label = prop($$props, 'label', 7, ''),
11894
+ size = prop($$props, 'size', 7, ''),
11895
+ ariaLabel = prop($$props, 'ariaLabel', 23, () => strict_equals(lang, "fr") ? "Rechercher..." : "Search..."),
11896
+ clearAriaLabel = prop($$props, 'clearAriaLabel', 23, () => strict_equals(lang, "fr") ? "Effacer le texte" : "Clear text"),
11897
+ leftIcon = prop($$props, 'leftIcon', 7, false),
11898
+ id = prop($$props, 'id', 23, () => `qc-search-input-${Math.random().toString(36).slice(2, 11)}`),
11899
+ rest = rest_props(
11900
+ $$props,
11901
+ [
11902
+ '$$slots',
11903
+ '$$events',
11904
+ '$$legacy',
11905
+ '$$host',
11906
+ 'value',
11907
+ 'label',
11908
+ 'size',
11909
+ 'ariaLabel',
11910
+ 'clearAriaLabel',
11911
+ 'leftIcon',
11912
+ 'id'
11913
+ ]);
11914
+
11915
+ leftIcon(strict_equals(leftIcon(), true) || strict_equals(leftIcon(), "true") || strict_equals(leftIcon(), ""));
11916
+
11917
+ const isDisabled = strict_equals($$props.disabled, true) || strict_equals($$props.disabled, "true") || strict_equals($$props.disabled, "");
11918
+ let searchInput;
11435
11919
 
11436
11920
  function focus() {
11437
11921
  searchInput?.focus();
@@ -11451,6 +11935,24 @@
11451
11935
  flushSync();
11452
11936
  },
11453
11937
 
11938
+ get label() {
11939
+ return label();
11940
+ },
11941
+
11942
+ set label($$value = '') {
11943
+ label($$value);
11944
+ flushSync();
11945
+ },
11946
+
11947
+ get size() {
11948
+ return size();
11949
+ },
11950
+
11951
+ set size($$value = '') {
11952
+ size($$value);
11953
+ flushSync();
11954
+ },
11955
+
11454
11956
  get ariaLabel() {
11455
11957
  return ariaLabel();
11456
11958
  },
@@ -11489,14 +11991,52 @@
11489
11991
  flushSync();
11490
11992
  },
11491
11993
 
11492
- ...legacy_api()
11493
- };
11994
+ ...legacy_api()
11995
+ };
11996
+
11997
+ var fragment = root$a();
11998
+ var node = first_child(fragment);
11999
+
12000
+ {
12001
+ var consequent = ($$anchor) => {
12002
+ add_svelte_meta(
12003
+ () => Label($$anchor, {
12004
+ get disabled() {
12005
+ return isDisabled;
12006
+ },
12007
+
12008
+ get text() {
12009
+ return label();
12010
+ },
12011
+
12012
+ get forId() {
12013
+ return id();
12014
+ }
12015
+ }),
12016
+ 'component',
12017
+ SearchInput,
12018
+ 32,
12019
+ 4,
12020
+ { componentTag: 'Label' }
12021
+ );
12022
+ };
12023
+
12024
+ add_svelte_meta(
12025
+ () => if_block(node, ($$render) => {
12026
+ if (label()) $$render(consequent);
12027
+ }),
12028
+ 'if',
12029
+ SearchInput,
12030
+ 31,
12031
+ 0
12032
+ );
12033
+ }
11494
12034
 
11495
- var div = root$c();
11496
- var node = child(div);
12035
+ var div = sibling(node, 2);
12036
+ var node_1 = child(div);
11497
12037
 
11498
12038
  {
11499
- var consequent = ($$anchor) => {
12039
+ var consequent_1 = ($$anchor) => {
11500
12040
  {
11501
12041
  let $0 = user_derived(() => `qc-icon${isDisabled ? ' is-disabled' : ''}`);
11502
12042
 
@@ -11511,7 +12051,7 @@
11511
12051
  }),
11512
12052
  'component',
11513
12053
  SearchInput,
11514
- 34,
12054
+ 46,
11515
12055
  8,
11516
12056
  { componentTag: 'Icon' }
11517
12057
  );
@@ -11519,24 +12059,24 @@
11519
12059
  };
11520
12060
 
11521
12061
  add_svelte_meta(
11522
- () => if_block(node, ($$render) => {
11523
- if (leftIcon()) $$render(consequent);
12062
+ () => if_block(node_1, ($$render) => {
12063
+ if (leftIcon()) $$render(consequent_1);
11524
12064
  }),
11525
12065
  'if',
11526
12066
  SearchInput,
11527
- 33,
12067
+ 45,
11528
12068
  4
11529
12069
  );
11530
12070
  }
11531
12071
 
11532
- var input = sibling(node, 2);
12072
+ var input = sibling(node_1, 2);
11533
12073
 
11534
12074
  attribute_effect(
11535
12075
  input,
11536
12076
  () => ({
11537
12077
  type: 'search',
11538
12078
  autocomplete: 'off',
11539
- 'aria-label': ariaLabel(),
12079
+ 'aria-label': label() ? undefined : ariaLabel(),
11540
12080
  class: isDisabled ? "qc-disabled" : "",
11541
12081
  id: id(),
11542
12082
  ...rest
@@ -11550,10 +12090,10 @@
11550
12090
 
11551
12091
  bind_this(input, ($$value) => searchInput = $$value, () => searchInput);
11552
12092
 
11553
- var node_1 = sibling(input, 2);
12093
+ var node_2 = sibling(input, 2);
11554
12094
 
11555
12095
  {
11556
- var consequent_1 = ($$anchor) => {
12096
+ var consequent_2 = ($$anchor) => {
11557
12097
  add_svelte_meta(
11558
12098
  () => IconButton($$anchor, {
11559
12099
  type: 'button',
@@ -11573,33 +12113,37 @@
11573
12113
  }),
11574
12114
  'component',
11575
12115
  SearchInput,
11576
- 49,
12116
+ 61,
11577
12117
  4,
11578
12118
  { componentTag: 'IconButton' }
11579
12119
  );
11580
12120
  };
11581
12121
 
11582
12122
  add_svelte_meta(
11583
- () => if_block(node_1, ($$render) => {
11584
- if (value()) $$render(consequent_1);
12123
+ () => if_block(node_2, ($$render) => {
12124
+ if (value()) $$render(consequent_2);
11585
12125
  }),
11586
12126
  'if',
11587
12127
  SearchInput,
11588
- 48,
12128
+ 60,
11589
12129
  4
11590
12130
  );
11591
12131
  }
11592
12132
 
11593
12133
  reset(div);
11594
12134
 
11595
- template_effect(() => set_class(div, 1, clsx([
11596
- "qc-search-input",
11597
- leftIcon() && "qc-search-left-icon",
11598
- leftIcon() && isDisabled && "qc-search-left-icon-disabled"
11599
- ])));
12135
+ template_effect(() => {
12136
+ set_class(div, 1, clsx([
12137
+ "qc-search-input",
12138
+ leftIcon() && "qc-search-left-icon",
12139
+ leftIcon() && isDisabled && "qc-search-left-icon-disabled"
12140
+ ]));
12141
+
12142
+ set_attribute(div, 'size', size());
12143
+ });
11600
12144
 
11601
12145
  bind_value(input, value);
11602
- append($$anchor, div);
12146
+ append($$anchor, fragment);
11603
12147
 
11604
12148
  return pop($$exports);
11605
12149
  }
@@ -11608,6 +12152,8 @@
11608
12152
  SearchInput,
11609
12153
  {
11610
12154
  value: {},
12155
+ label: {},
12156
+ size: {},
11611
12157
  ariaLabel: {},
11612
12158
  clearAriaLabel: {},
11613
12159
  leftIcon: {},
@@ -11620,7 +12166,7 @@
11620
12166
 
11621
12167
  SearchBar[FILENAME] = 'src/sdg/components/SearchBar/SearchBar.svelte';
11622
12168
 
11623
- var root$b = add_locations(from_html(`<div><!> <!></div>`), SearchBar[FILENAME], [[37, 0]]);
12169
+ var root$9 = add_locations(from_html(`<div><!> <!></div>`), SearchBar[FILENAME], [[37, 0]]);
11624
12170
 
11625
12171
  function SearchBar($$anchor, $$props) {
11626
12172
  check_target(new.target);
@@ -11702,7 +12248,7 @@
11702
12248
  ...legacy_api()
11703
12249
  };
11704
12250
 
11705
- var div = root$b();
12251
+ var div = root$9();
11706
12252
  let classes;
11707
12253
  var node = child(div);
11708
12254
 
@@ -11798,7 +12344,7 @@
11798
12344
  const props = rest_props($$props, ['$$slots', '$$events', '$$legacy', '$$host']);
11799
12345
  var $$exports = { ...legacy_api() };
11800
12346
 
11801
- add_svelte_meta(() => SearchInput($$anchor, spread_props(() => props)), 'component', SearchInputWC, 18, 0, { componentTag: 'SearchInput' });
12347
+ add_svelte_meta(() => SearchInput($$anchor, spread_props(() => props)), 'component', SearchInputWC, 20, 0, { componentTag: 'SearchInput' });
11802
12348
 
11803
12349
  return pop($$exports);
11804
12350
  }
@@ -11809,6 +12355,8 @@
11809
12355
  id: { attribute: 'id' },
11810
12356
  ariaLabel: { attribute: 'aria-label' },
11811
12357
  clearAriaLabel: { attribute: 'clear-aria-label' },
12358
+ label: { attribute: 'label' },
12359
+ size: { attribute: 'size' },
11812
12360
  leftIcon: { attribute: 'left-icon' }
11813
12361
  },
11814
12362
  [],
@@ -11878,7 +12426,7 @@
11878
12426
  FormError[FILENAME] = 'src/sdg/components/FormError/FormError.svelte';
11879
12427
 
11880
12428
  var root_2$6 = add_locations(from_html(`<!> <span><!></span>`, 1), FormError[FILENAME], [[48, 8]]);
11881
- var root_1$6 = add_locations(from_html(`<div role="alert"><!></div>`), FormError[FILENAME], [[35, 0]]);
12429
+ var root_1$5 = add_locations(from_html(`<div role="alert"><!></div>`), FormError[FILENAME], [[35, 0]]);
11882
12430
 
11883
12431
  function FormError($$anchor, $$props) {
11884
12432
  check_target(new.target);
@@ -11974,7 +12522,7 @@
11974
12522
 
11975
12523
  {
11976
12524
  var consequent = ($$anchor) => {
11977
- var div = root_1$6();
12525
+ var div = root_1$5();
11978
12526
  var node_1 = child(div);
11979
12527
 
11980
12528
  add_svelte_meta(
@@ -12054,72 +12602,6 @@
12054
12602
  true
12055
12603
  );
12056
12604
 
12057
- LabelText[FILENAME] = 'src/sdg/components/Label/LabelText.svelte';
12058
-
12059
- var root_1$5 = add_locations(from_html(`<span class="qc-required" aria-hidden="true">*</span>`), LabelText[FILENAME], [[4, 26]]);
12060
- var root$a = add_locations(from_html(`<!><!>`, 1), LabelText[FILENAME], []);
12061
-
12062
- function LabelText($$anchor, $$props) {
12063
- check_target(new.target);
12064
- push($$props, true);
12065
-
12066
- let text = prop($$props, 'text', 7),
12067
- required = prop($$props, 'required', 7);
12068
-
12069
- var $$exports = {
12070
- get text() {
12071
- return text();
12072
- },
12073
-
12074
- set text($$value) {
12075
- text($$value);
12076
- flushSync();
12077
- },
12078
-
12079
- get required() {
12080
- return required();
12081
- },
12082
-
12083
- set required($$value) {
12084
- required($$value);
12085
- flushSync();
12086
- },
12087
-
12088
- ...legacy_api()
12089
- };
12090
-
12091
- var fragment = root$a();
12092
- var node = first_child(fragment);
12093
-
12094
- html(node, text);
12095
-
12096
- var node_1 = sibling(node);
12097
-
12098
- {
12099
- var consequent = ($$anchor) => {
12100
- var span = root_1$5();
12101
-
12102
- append($$anchor, span);
12103
- };
12104
-
12105
- add_svelte_meta(
12106
- () => if_block(node_1, ($$render) => {
12107
- if (required()) $$render(consequent);
12108
- }),
12109
- 'if',
12110
- LabelText,
12111
- 4,
12112
- 12
12113
- );
12114
- }
12115
-
12116
- append($$anchor, fragment);
12117
-
12118
- return pop($$exports);
12119
- }
12120
-
12121
- create_custom_element(LabelText, { text: {}, required: {} }, [], [], true);
12122
-
12123
12605
  Fieldset[FILENAME] = 'src/sdg/components/Fieldset/Fieldset.svelte';
12124
12606
 
12125
12607
  var root_2$5 = add_locations(from_html(`<legend><!></legend>`), Fieldset[FILENAME], [[43, 4]]);
@@ -12718,7 +13200,7 @@
12718
13200
 
12719
13201
  ChoiceGroupWC[FILENAME] = 'src/sdg/components/ChoiceGroup/ChoiceGroupWC.svelte';
12720
13202
 
12721
- var root$9 = add_locations(from_html(`<!> <link rel="stylesheet"/>`, 1), ChoiceGroupWC[FILENAME], [[47, 0]]);
13203
+ var root$8 = add_locations(from_html(`<!> <link rel="stylesheet"/>`, 1), ChoiceGroupWC[FILENAME], [[47, 0]]);
12722
13204
 
12723
13205
  function ChoiceGroupWC($$anchor, $$props) {
12724
13206
  check_target(new.target);
@@ -12821,7 +13303,7 @@
12821
13303
  ...legacy_api()
12822
13304
  };
12823
13305
 
12824
- var fragment = root$9();
13306
+ var fragment = root$8();
12825
13307
  var node = first_child(fragment);
12826
13308
 
12827
13309
  {
@@ -12917,8 +13399,8 @@
12917
13399
 
12918
13400
  Checkbox[FILENAME] = 'src/sdg/components/Checkbox/Checkbox.svelte';
12919
13401
 
12920
- var root_2$4 = add_locations(from_html(`<span class="qc-required" aria-hidden="true">*</span>`), Checkbox[FILENAME], [[56, 4]]);
12921
- var root$8 = add_locations(from_html(`<div><!> <!> <!></div>`), Checkbox[FILENAME], [[64, 4]]);
13402
+ var root_2$4 = add_locations(from_html(`<span class="qc-required" aria-hidden="true">*</span>`), Checkbox[FILENAME], [[57, 4]]);
13403
+ var root$7 = add_locations(from_html(`<div><!> <!> <!></div>`), Checkbox[FILENAME], [[65, 4]]);
12922
13404
 
12923
13405
  function Checkbox($$anchor, $$props) {
12924
13406
  check_target(new.target);
@@ -12944,7 +13426,7 @@
12944
13426
  }),
12945
13427
  'if',
12946
13428
  Checkbox,
12947
- 55,
13429
+ 56,
12948
13430
  4
12949
13431
  );
12950
13432
  }
@@ -12990,10 +13472,11 @@
12990
13472
  user_effect((_) => updateChoiceInput(input(), required(), invalid(), compact(), false, false));
12991
13473
 
12992
13474
  user_effect(() => {
12993
- if (!required()) return;
12994
- if (!labelElement()) return;
13475
+ if (required() && get(label) && requiredSpan()) {
13476
+ const textSpan = labelElement().querySelector('span');
12995
13477
 
12996
- labelElement().appendChild(requiredSpan());
13478
+ textSpan.appendChild(requiredSpan());
13479
+ }
12997
13480
  });
12998
13481
 
12999
13482
  var $$exports = {
@@ -13126,14 +13609,14 @@
13126
13609
  ...legacy_api()
13127
13610
  };
13128
13611
 
13129
- var div = root$8();
13612
+ var div = root$7();
13130
13613
  var node_1 = child(div);
13131
13614
 
13132
- add_svelte_meta(() => requiredSpanSnippet(node_1), 'render', Checkbox, 71, 8);
13615
+ add_svelte_meta(() => requiredSpanSnippet(node_1), 'render', Checkbox, 72, 8);
13133
13616
 
13134
13617
  var node_2 = sibling(node_1, 2);
13135
13618
 
13136
- add_svelte_meta(() => snippet(node_2, () => children() ?? noop), 'render', Checkbox, 72, 8);
13619
+ add_svelte_meta(() => snippet(node_2, () => children() ?? noop), 'render', Checkbox, 73, 8);
13137
13620
 
13138
13621
  var node_3 = sibling(node_2, 2);
13139
13622
 
@@ -13153,7 +13636,7 @@
13153
13636
  }),
13154
13637
  'component',
13155
13638
  Checkbox,
13156
- 73,
13639
+ 74,
13157
13640
  8,
13158
13641
  { componentTag: 'FormError' }
13159
13642
  );
@@ -13200,7 +13683,7 @@
13200
13683
 
13201
13684
  CheckboxWC[FILENAME] = 'src/sdg/components/Checkbox/CheckboxWC.svelte';
13202
13685
 
13203
- var root$7 = add_locations(from_html(`<!> <link rel="stylesheet"/>`, 1), CheckboxWC[FILENAME], [[49, 0]]);
13686
+ var root$6 = add_locations(from_html(`<!> <link rel="stylesheet"/>`, 1), CheckboxWC[FILENAME], [[49, 0]]);
13204
13687
 
13205
13688
  function CheckboxWC($$anchor, $$props) {
13206
13689
  check_target(new.target);
@@ -13265,7 +13748,7 @@
13265
13748
  ...legacy_api()
13266
13749
  };
13267
13750
 
13268
- var fragment = root$7();
13751
+ var fragment = root$6();
13269
13752
  var node = first_child(fragment);
13270
13753
 
13271
13754
  {
@@ -13279,231 +13762,76 @@
13279
13762
 
13280
13763
  get required() {
13281
13764
  return required();
13282
- },
13283
-
13284
- get invalidText() {
13285
- return invalidText();
13286
- },
13287
-
13288
- get labelElement() {
13289
- return get(labelElement);
13290
- },
13291
-
13292
- get input() {
13293
- return get(input);
13294
- },
13295
-
13296
- get invalid() {
13297
- return invalid();
13298
- },
13299
-
13300
- set invalid($$value) {
13301
- invalid($$value);
13302
- },
13303
-
13304
- get requiredSpan() {
13305
- return get(requiredSpan);
13306
- },
13307
-
13308
- set requiredSpan($$value) {
13309
- set(requiredSpan, $$value, true);
13310
- },
13311
-
13312
- children: wrap_snippet(CheckboxWC, ($$anchor, $$slotProps) => {
13313
- var fragment_1 = comment();
13314
- var node_1 = first_child(fragment_1);
13315
-
13316
- slot(node_1, $$props, 'default', {}, null);
13317
- append($$anchor, fragment_1);
13318
- }),
13319
-
13320
- $$slots: { default: true }
13321
- }),
13322
- 'component',
13323
- CheckboxWC,
13324
- 38,
13325
- 0,
13326
- { componentTag: 'Checkbox' }
13327
- );
13328
- }
13329
-
13330
- var link = sibling(node, 2);
13331
-
13332
- template_effect(() => set_attribute(link, 'href', Utils.cssPath));
13333
- append($$anchor, fragment);
13334
-
13335
- return pop($$exports);
13336
- }
13337
-
13338
- customElements.define('qc-checkbox', create_custom_element(
13339
- CheckboxWC,
13340
- {
13341
- required: { attribute: 'required', type: 'Boolean' },
13342
- compact: { attribute: 'compact', type: 'Boolean' },
13343
- invalid: { attribute: 'invalid', type: 'Boolean' },
13344
- invalidText: { attribute: 'invalid-text', type: 'String' }
13345
- },
13346
- ['default'],
13347
- [],
13348
- true
13349
- ));
13350
-
13351
- Label[FILENAME] = 'src/sdg/components/Label/Label.svelte';
13352
-
13353
- var root$6 = add_locations(from_html(`<label><!></label>`), Label[FILENAME], [[16, 0]]);
13354
-
13355
- function Label($$anchor, $$props) {
13356
- check_target(new.target);
13357
- push($$props, true);
13358
-
13359
- let forId = prop($$props, 'forId', 7),
13360
- text = prop($$props, 'text', 7),
13361
- required = prop($$props, 'required', 7, false),
13362
- compact = prop($$props, 'compact', 7, false),
13363
- bold = prop($$props, 'bold', 7, false),
13364
- disabled = prop($$props, 'disabled', 7, false),
13365
- rootElement = prop($$props, 'rootElement', 15),
13366
- rest = rest_props(
13367
- $$props,
13368
- [
13369
- '$$slots',
13370
- '$$events',
13371
- '$$legacy',
13372
- '$$host',
13373
- 'forId',
13374
- 'text',
13375
- 'required',
13376
- 'compact',
13377
- 'bold',
13378
- 'disabled',
13379
- 'rootElement'
13380
- ]);
13381
-
13382
- var $$exports = {
13383
- get forId() {
13384
- return forId();
13385
- },
13386
-
13387
- set forId($$value) {
13388
- forId($$value);
13389
- flushSync();
13390
- },
13391
-
13392
- get text() {
13393
- return text();
13394
- },
13395
-
13396
- set text($$value) {
13397
- text($$value);
13398
- flushSync();
13399
- },
13400
-
13401
- get required() {
13402
- return required();
13403
- },
13404
-
13405
- set required($$value = false) {
13406
- required($$value);
13407
- flushSync();
13408
- },
13409
-
13410
- get compact() {
13411
- return compact();
13412
- },
13413
-
13414
- set compact($$value = false) {
13415
- compact($$value);
13416
- flushSync();
13417
- },
13418
-
13419
- get bold() {
13420
- return bold();
13421
- },
13422
-
13423
- set bold($$value = false) {
13424
- bold($$value);
13425
- flushSync();
13426
- },
13427
-
13428
- get disabled() {
13429
- return disabled();
13430
- },
13431
-
13432
- set disabled($$value = false) {
13433
- disabled($$value);
13434
- flushSync();
13435
- },
13765
+ },
13436
13766
 
13437
- get rootElement() {
13438
- return rootElement();
13439
- },
13767
+ get invalidText() {
13768
+ return invalidText();
13769
+ },
13440
13770
 
13441
- set rootElement($$value) {
13442
- rootElement($$value);
13443
- flushSync();
13444
- },
13771
+ get labelElement() {
13772
+ return get(labelElement);
13773
+ },
13445
13774
 
13446
- ...legacy_api()
13447
- };
13775
+ get input() {
13776
+ return get(input);
13777
+ },
13448
13778
 
13449
- var label = root$6();
13779
+ get invalid() {
13780
+ return invalid();
13781
+ },
13450
13782
 
13451
- attribute_effect(label, () => ({
13452
- for: forId(),
13783
+ set invalid($$value) {
13784
+ invalid($$value);
13785
+ },
13453
13786
 
13454
- class: [
13455
- "qc-label",
13456
- compact() && "qc-compact",
13457
- bold() && "qc-bold",
13458
- disabled() && "qc-disabled"
13459
- ],
13787
+ get requiredSpan() {
13788
+ return get(requiredSpan);
13789
+ },
13460
13790
 
13461
- ...rest
13462
- }));
13791
+ set requiredSpan($$value) {
13792
+ set(requiredSpan, $$value, true);
13793
+ },
13463
13794
 
13464
- var node = child(label);
13795
+ children: wrap_snippet(CheckboxWC, ($$anchor, $$slotProps) => {
13796
+ var fragment_1 = comment();
13797
+ var node_1 = first_child(fragment_1);
13465
13798
 
13466
- add_svelte_meta(
13467
- () => LabelText(node, {
13468
- get text() {
13469
- return text();
13470
- },
13799
+ slot(node_1, $$props, 'default', {}, null);
13800
+ append($$anchor, fragment_1);
13801
+ }),
13471
13802
 
13472
- get required() {
13473
- return required();
13474
- }
13475
- }),
13476
- 'component',
13477
- Label,
13478
- 27,
13479
- 4,
13480
- { componentTag: 'LabelText' }
13481
- );
13803
+ $$slots: { default: true }
13804
+ }),
13805
+ 'component',
13806
+ CheckboxWC,
13807
+ 38,
13808
+ 0,
13809
+ { componentTag: 'Checkbox' }
13810
+ );
13811
+ }
13482
13812
 
13483
- reset(label);
13484
- bind_this(label, ($$value) => rootElement($$value), () => rootElement());
13485
- append($$anchor, label);
13813
+ var link = sibling(node, 2);
13814
+
13815
+ template_effect(() => set_attribute(link, 'href', Utils.cssPath));
13816
+ append($$anchor, fragment);
13486
13817
 
13487
13818
  return pop($$exports);
13488
13819
  }
13489
13820
 
13490
- create_custom_element(
13491
- Label,
13821
+ customElements.define('qc-checkbox', create_custom_element(
13822
+ CheckboxWC,
13492
13823
  {
13493
- forId: {},
13494
- text: {},
13495
- required: {},
13496
- compact: {},
13497
- bold: {},
13498
- disabled: {},
13499
- rootElement: {}
13824
+ required: { attribute: 'required', type: 'Boolean' },
13825
+ compact: { attribute: 'compact', type: 'Boolean' },
13826
+ invalid: { attribute: 'invalid', type: 'Boolean' },
13827
+ invalidText: { attribute: 'invalid-text', type: 'String' }
13500
13828
  },
13501
- [],
13829
+ ['default'],
13502
13830
  [],
13503
13831
  true
13504
- );
13832
+ ));
13505
13833
 
13506
- function onMountInput(input, setTextFieldRow, setValue, setInvalid) {
13834
+ function onMountInput(input, setTextFieldRow, setValue, setInvalid, setRequired) {
13507
13835
  if (!input) return;
13508
13836
  if (!input.autocomplete) {
13509
13837
  input.autocomplete = "off";
@@ -13512,6 +13840,7 @@
13512
13840
  input.id = Utils.generateId(input.type);
13513
13841
  }
13514
13842
  setValue(input.value);
13843
+ setRequired(input.required);
13515
13844
  input.addEventListener(
13516
13845
  'input',
13517
13846
  () => {
@@ -13523,10 +13852,10 @@
13523
13852
 
13524
13853
  TextField[FILENAME] = 'src/sdg/components/TextField/TextField.svelte';
13525
13854
 
13526
- var root_3$2 = add_locations(from_html(`<div class="qc-description"><!></div>`), TextField[FILENAME], [[135, 8]]);
13527
- var root_4$1 = add_locations(from_html(`<div aria-live="polite"><!></div>`), TextField[FILENAME], [[146, 8]]);
13855
+ var root_3$2 = add_locations(from_html(`<div class="qc-description"><!></div>`), TextField[FILENAME], [[141, 8]]);
13856
+ var root_4$1 = add_locations(from_html(`<div aria-live="polite"><!></div>`), TextField[FILENAME], [[152, 8]]);
13528
13857
  var root_1$3 = add_locations(from_html(`<!> <!> <!> <!> <!>`, 1), TextField[FILENAME], []);
13529
- var root_6 = add_locations(from_html(`<div class="qc-textfield"><!></div>`), TextField[FILENAME], [[170, 4]]);
13858
+ var root_6 = add_locations(from_html(`<div class="qc-textfield"><!></div>`), TextField[FILENAME], [[176, 4]]);
13530
13859
 
13531
13860
  function TextField($$anchor, $$props) {
13532
13861
  check_target(new.target);
@@ -13576,7 +13905,7 @@
13576
13905
  }),
13577
13906
  'component',
13578
13907
  TextField,
13579
- 125,
13908
+ 131,
13580
13909
  8,
13581
13910
  { componentTag: 'Label' }
13582
13911
  );
@@ -13589,7 +13918,7 @@
13589
13918
  }),
13590
13919
  'if',
13591
13920
  TextField,
13592
- 124,
13921
+ 130,
13593
13922
  4
13594
13923
  );
13595
13924
  }
@@ -13614,14 +13943,14 @@
13614
13943
  }),
13615
13944
  'if',
13616
13945
  TextField,
13617
- 134,
13946
+ 140,
13618
13947
  4
13619
13948
  );
13620
13949
  }
13621
13950
 
13622
13951
  var node_3 = sibling(node_1, 2);
13623
13952
 
13624
- add_svelte_meta(() => snippet(node_3, children), 'render', TextField, 143, 4);
13953
+ add_svelte_meta(() => snippet(node_3, () => children() ?? noop), 'render', TextField, 149, 4);
13625
13954
 
13626
13955
  var node_4 = sibling(node_3, 2);
13627
13956
 
@@ -13652,7 +13981,7 @@
13652
13981
  }),
13653
13982
  'if',
13654
13983
  TextField,
13655
- 145,
13984
+ 151,
13656
13985
  4
13657
13986
  );
13658
13987
  }
@@ -13699,7 +14028,7 @@
13699
14028
  }),
13700
14029
  'component',
13701
14030
  TextField,
13702
- 159,
14031
+ 165,
13703
14032
  4,
13704
14033
  { componentTag: 'FormError' }
13705
14034
  );
@@ -13736,7 +14065,9 @@
13736
14065
  textFieldRow = tag(state(void 0), 'textFieldRow'),
13737
14066
  defaultInvalidText = tag(
13738
14067
  user_derived(() => {
13739
- if (!maxlengthReached()) return '';
14068
+ if (!maxlengthReached()) {
14069
+ return undefined;
14070
+ }
13740
14071
 
13741
14072
  return strict_equals(lang, 'fr')
13742
14073
  ? `La limite de caractères du champ ${label()} est dépassée.`
@@ -13749,10 +14080,14 @@
13749
14080
  if (webComponentMode) return;
13750
14081
 
13751
14082
  if (!input()) {
13752
- input(get(rootElement).querySelector('input,textarea'));
14083
+ input(get(rootElement)?.querySelector('input,textarea'));
13753
14084
  }
13754
14085
 
13755
- onMountInput(input(), (textFieldRowParam) => set(textFieldRow, textFieldRowParam, true), (valueParam) => value(valueParam), (invalidParam) => invalid(invalidParam));
14086
+ onMountInput(input(), (textFieldRowParam) => set(textFieldRow, textFieldRowParam, true), (valueParam) => value(valueParam), (invalidParam) => invalid(invalidParam), (requiredParam) => {
14087
+ if (requiredParam) {
14088
+ required(requiredParam);
14089
+ }
14090
+ });
13756
14091
  });
13757
14092
 
13758
14093
  user_effect(() => {
@@ -13985,14 +14320,14 @@
13985
14320
 
13986
14321
  {
13987
14322
  var consequent_3 = ($$anchor) => {
13988
- add_svelte_meta(() => textfield($$anchor), 'render', TextField, 168, 4);
14323
+ add_svelte_meta(() => textfield($$anchor), 'render', TextField, 174, 4);
13989
14324
  };
13990
14325
 
13991
14326
  var alternate = ($$anchor) => {
13992
14327
  var div_2 = root_6();
13993
14328
  var node_8 = child(div_2);
13994
14329
 
13995
- add_svelte_meta(() => textfield(node_8), 'render', TextField, 175, 8);
14330
+ add_svelte_meta(() => textfield(node_8), 'render', TextField, 181, 8);
13996
14331
  reset(div_2);
13997
14332
  bind_this(div_2, ($$value) => set(rootElement, $$value), () => get(rootElement));
13998
14333
 
@@ -14010,7 +14345,7 @@
14010
14345
  }),
14011
14346
  'if',
14012
14347
  TextField,
14013
- 167,
14348
+ 173,
14014
14349
  0
14015
14350
  );
14016
14351
  }
@@ -14048,7 +14383,7 @@
14048
14383
 
14049
14384
  TextFieldWC[FILENAME] = 'src/sdg/components/TextField/TextFieldWC.svelte';
14050
14385
 
14051
- var root$5 = add_locations(from_html(`<!> <link rel="stylesheet"/>`, 1), TextFieldWC[FILENAME], [[100, 0]]);
14386
+ var root$5 = add_locations(from_html(`<!> <link rel="stylesheet"/>`, 1), TextFieldWC[FILENAME], [[115, 0]]);
14052
14387
 
14053
14388
  function TextFieldWC($$anchor, $$props) {
14054
14389
  check_target(new.target);
@@ -14077,8 +14412,20 @@
14077
14412
  textFieldRow = tag(state(void 0), 'textFieldRow');
14078
14413
 
14079
14414
  onMount(() => {
14080
- set(input, $$props.$$host.querySelector('input,textarea'), true);
14081
- onMountInput(get(input), (textFieldRowParam) => set(textFieldRow, textFieldRowParam, true), (valueParam) => set(value, valueParam, true), (invalidParam) => invalid(invalidParam));
14415
+ const initialLabelElement = $$props.$$host?.querySelector('label');
14416
+
14417
+ if (initialLabelElement) {
14418
+ label(initialLabelElement.innerHTML);
14419
+ initialLabelElement.remove();
14420
+ }
14421
+
14422
+ set(input, $$props.$$host?.querySelector('input,textarea'), true);
14423
+
14424
+ onMountInput(get(input), (textFieldRowParam) => set(textFieldRow, textFieldRowParam, true), (valueParam) => set(value, valueParam, true), (invalidParam) => invalid(invalidParam), (requiredParam) => {
14425
+ if (requiredParam) {
14426
+ required(requiredParam);
14427
+ }
14428
+ });
14082
14429
  });
14083
14430
 
14084
14431
  user_effect(() => {
@@ -14090,7 +14437,7 @@
14090
14437
  user_effect(() => {
14091
14438
  if (!get(input)) return;
14092
14439
 
14093
- if (label()) {
14440
+ if (get(labelElement)) {
14094
14441
  get(input).before(get(labelElement));
14095
14442
  }
14096
14443
 
@@ -14109,7 +14456,11 @@
14109
14456
  if (get(textFieldRow)) {
14110
14457
  get(textFieldRow).appendChild(get(formErrorElement));
14111
14458
  } else {
14112
- get(input).after(get(formErrorElement));
14459
+ if (get(maxlengthElement)) {
14460
+ get(maxlengthElement).after(get(formErrorElement));
14461
+ } else {
14462
+ get(input).after(get(formErrorElement));
14463
+ }
14113
14464
  }
14114
14465
  });
14115
14466
 
@@ -14318,7 +14669,7 @@
14318
14669
  }),
14319
14670
  'component',
14320
14671
  TextFieldWC,
14321
- 80,
14672
+ 95,
14322
14673
  0,
14323
14674
  { componentTag: 'TextField' }
14324
14675
  );
@@ -14854,9 +15205,9 @@
14854
15205
 
14855
15206
  DropdownListItemsSingle[FILENAME] = 'src/sdg/components/DropdownList/DropdownListItems/DropdownListItemsSingle/DropdownListItemsSingle.svelte';
14856
15207
 
14857
- var root_3$1 = add_locations(from_html(`<span class="qc-sr-only"><!></span>`), DropdownListItemsSingle[FILENAME], [[129, 20]]);
14858
- var root_2$3 = add_locations(from_html(`<li tabindex="0" role="option"><!></li>`), DropdownListItemsSingle[FILENAME], [[113, 12]]);
14859
- var root_1$2 = add_locations(from_html(`<ul></ul>`), DropdownListItemsSingle[FILENAME], [[111, 4]]);
15208
+ var root_3$1 = add_locations(from_html(`<span class="qc-sr-only"><!></span>`), DropdownListItemsSingle[FILENAME], [[130, 20]]);
15209
+ var root_2$3 = add_locations(from_html(`<li tabindex="0" role="option"><!></li>`), DropdownListItemsSingle[FILENAME], [[114, 12]]);
15210
+ var root_1$2 = add_locations(from_html(`<ul></ul>`), DropdownListItemsSingle[FILENAME], [[112, 4]]);
14860
15211
 
14861
15212
  function DropdownListItemsSingle($$anchor, $$props) {
14862
15213
  check_target(new.target);
@@ -14900,7 +15251,7 @@
14900
15251
  event.preventDefault();
14901
15252
 
14902
15253
  if (!item.disabled) {
14903
- items().forEach((item) => assign(item, 'checked', false, 'src/​sdg/​components/​DropdownList/​DropdownListItems/​DropdownListItemsSingle/​DropdownListItemsSingle.svelte:45:34'));
15254
+ items().forEach((item) => assign(item, 'checked', false, 'src/​sdg/​components/​DropdownList/​DropdownListItems/​DropdownListItemsSingle/​DropdownListItemsSingle.svelte:46:34'));
14904
15255
  items().find((option) => strict_equals(option.value, item.value)).checked = true;
14905
15256
  selectionCallback()();
14906
15257
  }
@@ -14935,7 +15286,7 @@
14935
15286
  handleSelection(event, item);
14936
15287
  }
14937
15288
 
14938
- Utils.sleep(5).then(() => {
15289
+ tick().then(() => {
14939
15290
  if (canExit(event, index)) {
14940
15291
  handleExit()(event.key);
14941
15292
  }
@@ -15087,13 +15438,13 @@
15087
15438
  }),
15088
15439
  'if',
15089
15440
  DropdownListItemsSingle,
15090
- 128,
15441
+ 129,
15091
15442
  16
15092
15443
  );
15093
15444
  }
15094
15445
 
15095
15446
  reset(li);
15096
- validate_binding('bind:this={displayedItemsElements[index]}', [], () => get(displayedItemsElements), () => get(index), 114, 16);
15447
+ validate_binding('bind:this={displayedItemsElements[index]}', [], () => get(displayedItemsElements), () => get(index), 115, 16);
15097
15448
  bind_this(li, ($$value, index) => get(displayedItemsElements)[index] = $$value, (index) => get(displayedItemsElements)?.[index], () => [get(index)]);
15098
15449
 
15099
15450
  template_effect(() => {
@@ -15113,7 +15464,7 @@
15113
15464
  }),
15114
15465
  'each',
15115
15466
  DropdownListItemsSingle,
15116
- 112,
15467
+ 113,
15117
15468
  8
15118
15469
  );
15119
15470
 
@@ -15127,7 +15478,7 @@
15127
15478
  }),
15128
15479
  'if',
15129
15480
  DropdownListItemsSingle,
15130
- 110,
15481
+ 111,
15131
15482
  0
15132
15483
  );
15133
15484
  }
@@ -15161,8 +15512,8 @@
15161
15512
 
15162
15513
  DropdownListItemsMultiple[FILENAME] = 'src/sdg/components/DropdownList/DropdownListItems/DropdownListItemsMultiple/DropdownListItemsMultiple.svelte';
15163
15514
 
15164
- var root_2$2 = add_locations(from_html(`<li><label class="qc-choicefield-label" compact=""><input type="checkbox" class="qc-choicefield qc-compact"/> <span> </span></label></li>`), DropdownListItemsMultiple[FILENAME], [[153, 12, [[163, 16, [[168, 20], [180, 20]]]]]]);
15165
- var root_1$1 = add_locations(from_html(`<ul></ul>`), DropdownListItemsMultiple[FILENAME], [[147, 4]]);
15515
+ var root_2$2 = add_locations(from_html(`<li><label class="qc-choicefield-label" compact=""><input type="checkbox" class="qc-choicefield qc-compact"/> <span> </span></label></li>`), DropdownListItemsMultiple[FILENAME], [[154, 12, [[164, 16, [[169, 20], [181, 20]]]]]]);
15516
+ var root_1$1 = add_locations(from_html(`<ul></ul>`), DropdownListItemsMultiple[FILENAME], [[148, 4]]);
15166
15517
 
15167
15518
  function DropdownListItemsMultiple($$anchor, $$props) {
15168
15519
  check_target(new.target);
@@ -15248,11 +15599,11 @@
15248
15599
 
15249
15600
  if (displayedItems().length > 0 && !displayedItems()[index].disabled) {
15250
15601
  event.target.checked = !event.target.checked;
15251
- $$ownership_validator.mutation('displayedItems', ['displayedItems', index, 'checked'], displayedItems()[index].checked = event.target.checked, 86, 16);
15602
+ $$ownership_validator.mutation('displayedItems', ['displayedItems', index, 'checked'], displayedItems()[index].checked = event.target.checked, 87, 16);
15252
15603
  }
15253
15604
  }
15254
15605
 
15255
- Utils.sleep(5).then(() => {
15606
+ tick().then(() => {
15256
15607
  if (canExit(event, index)) {
15257
15608
  handleExit()(event.key);
15258
15609
  }
@@ -15392,8 +15743,8 @@
15392
15743
  remove_input_defaults(input);
15393
15744
  input.__change = handleChange;
15394
15745
  input.__keydown = (e) => handleKeyDown(e, get(index));
15395
- validate_binding('bind:checked={item.checked}', [], () => get(item), () => 'checked', 175, 28);
15396
- validate_binding('bind:this={displayedItemsElements[index]}', [], () => get(displayedItemsElements), () => get(index), 176, 28);
15746
+ validate_binding('bind:checked={item.checked}', [], () => get(item), () => 'checked', 176, 28);
15747
+ validate_binding('bind:this={displayedItemsElements[index]}', [], () => get(displayedItemsElements), () => get(index), 177, 28);
15397
15748
  bind_this(input, ($$value, index) => get(displayedItemsElements)[index] = $$value, (index) => get(displayedItemsElements)?.[index], () => [get(index)]);
15398
15749
 
15399
15750
  var input_value;
@@ -15428,7 +15779,7 @@
15428
15779
  }),
15429
15780
  'each',
15430
15781
  DropdownListItemsMultiple,
15431
- 148,
15782
+ 149,
15432
15783
  8
15433
15784
  );
15434
15785
 
@@ -15442,7 +15793,7 @@
15442
15793
  }),
15443
15794
  'if',
15444
15795
  DropdownListItemsMultiple,
15445
- 146,
15796
+ 147,
15446
15797
  0
15447
15798
  );
15448
15799
  }
@@ -15474,15 +15825,14 @@
15474
15825
 
15475
15826
  DropdownListItems[FILENAME] = 'src/sdg/components/DropdownList/DropdownListItems/DropdownListItems.svelte';
15476
15827
 
15477
- var root_4 = add_locations(from_html(`<span class="qc-dropdown-list-no-options"><!></span>`), DropdownListItems[FILENAME], [[100, 16]]);
15478
- var root$3 = add_locations(from_html(`<div class="qc-dropdown-list-items" tabindex="-1"><!> <div class="qc-dropdown-list-no-options-container" role="status"><!></div></div>`), DropdownListItems[FILENAME], [[62, 0, [[97, 4]]]]);
15828
+ var root_4 = add_locations(from_html(`<span class="qc-dropdown-list-no-options"><!></span>`), DropdownListItems[FILENAME], [[82, 16]]);
15829
+ var root$3 = add_locations(from_html(`<div class="qc-dropdown-list-items" tabindex="-1"><!> <div class="qc-dropdown-list-no-options-container" role="status"><!></div></div>`), DropdownListItems[FILENAME], [[45, 0, [[79, 4]]]]);
15479
15830
 
15480
15831
  function DropdownListItems($$anchor, $$props) {
15481
15832
  check_target(new.target);
15482
15833
  push($$props, true);
15483
15834
 
15484
15835
  let id = prop($$props, 'id', 7),
15485
- enableSearch = prop($$props, 'enableSearch', 7),
15486
15836
  multiple = prop($$props, 'multiple', 7),
15487
15837
  items = prop($$props, 'items', 7),
15488
15838
  displayedItems = prop($$props, 'displayedItems', 7),
@@ -15497,43 +15847,21 @@
15497
15847
 
15498
15848
  let itemsComponent = tag(state(void 0), 'itemsComponent');
15499
15849
 
15500
- let usedHeight = tag(
15501
- user_derived(() => {
15502
- const maxItemsHeight = 336;
15503
- const searchInputTotalHeight = 56;
15504
-
15505
- if (enableSearch()) {
15506
- if (displayedItems().length > 7) {
15507
- return maxItemsHeight - searchInputTotalHeight - 17;
15508
- }
15509
-
15510
- return maxItemsHeight - searchInputTotalHeight;
15511
- } else {
15512
- if (displayedItems().length > 8) {
15513
- return maxItemsHeight - 33;
15514
- }
15515
-
15516
- return maxItemsHeight;
15517
- }
15518
- }),
15519
- 'usedHeight'
15520
- );
15521
-
15522
15850
  function focus() {
15523
- Utils.sleep(5).then(() => {
15851
+ tick().then(() => {
15524
15852
  get(itemsComponent)?.focusOnFirstElement();
15525
15853
  }).catch(console.error);
15526
15854
  }
15527
15855
 
15528
15856
  function focusOnLastElement() {
15529
- Utils.sleep(5).then(() => {
15857
+ tick().then(() => {
15530
15858
  get(itemsComponent)?.focusOnLastElement();
15531
15859
  }).catch(console.error);
15532
15860
  }
15533
15861
 
15534
15862
  function focusOnFirstMatchingElement(value) {
15535
15863
  if (get(itemsComponent) && value && value.length > 0) {
15536
- Utils.sleep(5).then(() => {
15864
+ tick().then(() => {
15537
15865
  get(itemsComponent)?.focusOnFirstMatchingElement(value);
15538
15866
  }).catch(console.error);
15539
15867
  }
@@ -15561,15 +15889,6 @@
15561
15889
  flushSync();
15562
15890
  },
15563
15891
 
15564
- get enableSearch() {
15565
- return enableSearch();
15566
- },
15567
-
15568
- set enableSearch($$value) {
15569
- enableSearch($$value);
15570
- flushSync();
15571
- },
15572
-
15573
15892
  get multiple() {
15574
15893
  return multiple();
15575
15894
  },
@@ -15711,7 +16030,7 @@
15711
16030
  ),
15712
16031
  'component',
15713
16032
  DropdownListItems,
15714
- 69,
16033
+ 51,
15715
16034
  8,
15716
16035
  { componentTag: 'DropdownListItemsMultiple' }
15717
16036
  );
@@ -15756,7 +16075,7 @@
15756
16075
  ),
15757
16076
  'component',
15758
16077
  DropdownListItems,
15759
- 82,
16078
+ 64,
15760
16079
  8,
15761
16080
  { componentTag: 'DropdownListItemsSingle' }
15762
16081
  );
@@ -15768,7 +16087,7 @@
15768
16087
  }),
15769
16088
  'if',
15770
16089
  DropdownListItems,
15771
- 68,
16090
+ 50,
15772
16091
  4
15773
16092
  );
15774
16093
  }
@@ -15792,7 +16111,7 @@
15792
16111
  }),
15793
16112
  'await',
15794
16113
  DropdownListItems,
15795
- 99,
16114
+ 81,
15796
16115
  12
15797
16116
  );
15798
16117
 
@@ -15805,19 +16124,14 @@
15805
16124
  }),
15806
16125
  'if',
15807
16126
  DropdownListItems,
15808
- 98,
16127
+ 80,
15809
16128
  8
15810
16129
  );
15811
16130
  }
15812
16131
 
15813
16132
  reset(div_1);
15814
16133
  reset(div);
15815
-
15816
- template_effect(() => {
15817
- set_attribute(div, 'id', id());
15818
- set_style(div, `--dropdown-items-height: ${get(usedHeight) ?? ''};`);
15819
- });
15820
-
16134
+ template_effect(() => set_attribute(div, 'id', id()));
15821
16135
  append($$anchor, div);
15822
16136
 
15823
16137
  return pop($$exports);
@@ -15827,7 +16141,6 @@
15827
16141
  DropdownListItems,
15828
16142
  {
15829
16143
  id: {},
15830
- enableSearch: {},
15831
16144
  multiple: {},
15832
16145
  items: {},
15833
16146
  displayedItems: {},
@@ -15847,9 +16160,9 @@
15847
16160
 
15848
16161
  DropdownListButton[FILENAME] = 'src/sdg/components/DropdownList/DropdownListButton/DropdownListButton.svelte';
15849
16162
 
15850
- var root_1 = add_locations(from_html(`<span class="qc-dropdown-choice"><!></span>`), DropdownListButton[FILENAME], [[29, 8]]);
15851
- var root_2$1 = add_locations(from_html(`<span class="qc-dropdown-placeholder"><!></span>`), DropdownListButton[FILENAME], [[31, 8]]);
15852
- var root$2 = add_locations(from_html(`<button><!> <span><!></span></button>`), DropdownListButton[FILENAME], [[19, 0, [[34, 4]]]]);
16163
+ var root_1 = add_locations(from_html(`<span class="qc-dropdown-choice"><!></span>`), DropdownListButton[FILENAME], [[25, 8]]);
16164
+ var root_2$1 = add_locations(from_html(`<span class="qc-dropdown-placeholder"><!></span>`), DropdownListButton[FILENAME], [[27, 8]]);
16165
+ var root$2 = add_locations(from_html(`<button><!> <span><!></span></button>`), DropdownListButton[FILENAME], [[15, 0, [[30, 4]]]]);
15853
16166
 
15854
16167
  function DropdownListButton($$anchor, $$props) {
15855
16168
  check_target(new.target);
@@ -15860,6 +16173,7 @@
15860
16173
  disabled = prop($$props, 'disabled', 7),
15861
16174
  selectedOptionsText = prop($$props, 'selectedOptionsText', 7, ""),
15862
16175
  placeholder = prop($$props, 'placeholder', 7),
16176
+ buttonElement = prop($$props, 'buttonElement', 15),
15863
16177
  rest = rest_props(
15864
16178
  $$props,
15865
16179
  [
@@ -15871,20 +16185,11 @@
15871
16185
  'expanded',
15872
16186
  'disabled',
15873
16187
  'selectedOptionsText',
15874
- 'placeholder'
16188
+ 'placeholder',
16189
+ 'buttonElement'
15875
16190
  ]);
15876
16191
 
15877
- let button;
15878
-
15879
- function focus() {
15880
- button?.focus();
15881
- }
15882
-
15883
16192
  var $$exports = {
15884
- get focus() {
15885
- return focus;
15886
- },
15887
-
15888
16193
  get inputId() {
15889
16194
  return inputId();
15890
16195
  },
@@ -15930,12 +16235,21 @@
15930
16235
  flushSync();
15931
16236
  },
15932
16237
 
16238
+ get buttonElement() {
16239
+ return buttonElement();
16240
+ },
16241
+
16242
+ set buttonElement($$value) {
16243
+ buttonElement($$value);
16244
+ flushSync();
16245
+ },
16246
+
15933
16247
  ...legacy_api()
15934
16248
  };
15935
16249
 
15936
- var button_1 = root$2();
16250
+ var button = root$2();
15937
16251
 
15938
- attribute_effect(button_1, () => ({
16252
+ attribute_effect(button, () => ({
15939
16253
  type: 'button',
15940
16254
  id: inputId(),
15941
16255
  disabled: disabled(),
@@ -15944,7 +16258,7 @@
15944
16258
  ...rest
15945
16259
  }));
15946
16260
 
15947
- var node = child(button_1);
16261
+ var node = child(button);
15948
16262
 
15949
16263
  {
15950
16264
  var consequent = ($$anchor) => {
@@ -15971,7 +16285,7 @@
15971
16285
  }),
15972
16286
  'if',
15973
16287
  DropdownListButton,
15974
- 28,
16288
+ 24,
15975
16289
  4
15976
16290
  );
15977
16291
  }
@@ -16002,16 +16316,16 @@
16002
16316
  }),
16003
16317
  'component',
16004
16318
  DropdownListButton,
16005
- 35,
16319
+ 31,
16006
16320
  8,
16007
16321
  { componentTag: 'Icon' }
16008
16322
  );
16009
16323
  }
16010
16324
 
16011
16325
  reset(span_2);
16012
- reset(button_1);
16013
- bind_this(button_1, ($$value) => button = $$value, () => button);
16014
- append($$anchor, button_1);
16326
+ reset(button);
16327
+ bind_this(button, ($$value) => buttonElement($$value), () => buttonElement());
16328
+ append($$anchor, button);
16015
16329
 
16016
16330
  return pop($$exports);
16017
16331
  }
@@ -16023,18 +16337,19 @@
16023
16337
  expanded: {},
16024
16338
  disabled: {},
16025
16339
  selectedOptionsText: {},
16026
- placeholder: {}
16340
+ placeholder: {},
16341
+ buttonElement: {}
16027
16342
  },
16028
16343
  [],
16029
- ['focus'],
16344
+ [],
16030
16345
  true
16031
16346
  );
16032
16347
 
16033
16348
  DropdownList[FILENAME] = 'src/sdg/components/DropdownList/DropdownList.svelte';
16034
16349
 
16035
- var root_2 = add_locations(from_html(`<div class="qc-dropdown-list-search"><!></div>`), DropdownList[FILENAME], [[334, 20]]);
16036
- var root_3 = add_locations(from_html(`<span> </span>`), DropdownList[FILENAME], [[376, 24]]);
16037
- var root$1 = add_locations(from_html(`<div><div><!> <div tabindex="-1"><!> <div class="qc-dropdown-list-expanded" tabindex="-1" role="listbox"><!> <!> <div role="status" class="qc-sr-only"><!></div></div></div></div> <!></div>`), DropdownList[FILENAME], [[273, 0, [[278, 4, [[297, 8, [[325, 12, [[374, 16]]]]]]]]]]);
16350
+ var root_2 = add_locations(from_html(`<div class="qc-dropdown-list-search"><!></div>`), DropdownList[FILENAME], [[386, 20]]);
16351
+ var root_3 = add_locations(from_html(`<span> </span>`), DropdownList[FILENAME], [[427, 24]]);
16352
+ var root$1 = add_locations(from_html(`<div><div><!> <div tabindex="-1"><!> <div class="qc-dropdown-list-expanded" tabindex="-1" role="listbox"><!> <!> <div role="status" class="qc-sr-only"><!></div></div></div></div> <!></div>`), DropdownList[FILENAME], [[316, 0, [[321, 4, [[340, 8, [[369, 12, [[425, 16]]]]]]]]]]);
16038
16353
 
16039
16354
  function DropdownList($$anchor, $$props) {
16040
16355
  check_target(new.target);
@@ -16060,7 +16375,8 @@
16060
16375
  multiple = prop($$props, 'multiple', 7, false),
16061
16376
  rootElement = prop($$props, 'rootElement', 15),
16062
16377
  errorElement = prop($$props, 'errorElement', 15),
16063
- webComponentMode = prop($$props, 'webComponentMode', 7, false);
16378
+ webComponentMode = prop($$props, 'webComponentMode', 7, false),
16379
+ expanded = prop($$props, 'expanded', 15, false);
16064
16380
 
16065
16381
  const defaultPlaceholder = strict_equals(lang, "fr") ? "Faire une sélection" : "Select an option",
16066
16382
  inputId = `${id()}-input`,
@@ -16068,12 +16384,14 @@
16068
16384
  itemsId = `${id()}-items`,
16069
16385
  labelId = `${id()}-label`,
16070
16386
  errorId = `${id()}-error`,
16071
- availableWidths = ["xs", "sm", "md", "lg", "xl"];
16387
+ availableWidths = ["xs", "sm", "md", "lg", "xl"],
16388
+ buttonHeight = 40;
16072
16389
 
16073
16390
  let instance = tag(state(void 0), 'instance'),
16074
16391
  parentRow = tag(user_derived(() => get(instance)?.closest(".qc-formfield-row")), 'parentRow'),
16075
16392
  button = tag(state(void 0), 'button'),
16076
16393
  searchInput = tag(state(void 0), 'searchInput'),
16394
+ popup = tag(state(void 0), 'popup'),
16077
16395
  dropdownItems = tag(state(void 0), 'dropdownItems'),
16078
16396
  selectedItems = tag(user_derived(() => items().filter((item) => item.checked) ?? []), 'selectedItems'),
16079
16397
  selectedOptionsText = tag(
@@ -16099,7 +16417,6 @@
16099
16417
  'selectedOptionsText'
16100
16418
  ),
16101
16419
  previousValue = tag(state(proxy(value())), 'previousValue'),
16102
- expanded = tag(state(false), 'expanded'),
16103
16420
  searchText = tag(state(""), 'searchText'),
16104
16421
  hiddenSearchText = tag(state(""), 'hiddenSearchText'),
16105
16422
  displayedItems = tag(state(proxy(items())), 'displayedItems'),
@@ -16116,8 +16433,6 @@
16116
16433
  ),
16117
16434
  widthClass = tag(
16118
16435
  user_derived(() => {
16119
- webComponentMode() ? "container" : "root";
16120
-
16121
16436
  if (availableWidths.includes(width())) {
16122
16437
  return `qc-dropdown-list-${width()}`;
16123
16438
  }
@@ -16139,7 +16454,32 @@
16139
16454
  return "";
16140
16455
  }),
16141
16456
  'srItemsCountText'
16142
- );
16457
+ ),
16458
+ buttonElementYPosition = tag(state(0), 'buttonElementYPosition'),
16459
+ usedHeight = tag(
16460
+ user_derived(() => {
16461
+ const maxItemsHeight = 336;
16462
+ const searchInputTotalHeight = 56;
16463
+
16464
+ if (enableSearch()) {
16465
+ if (get(displayedItems).length > 7) {
16466
+ return maxItemsHeight - searchInputTotalHeight - 17;
16467
+ }
16468
+
16469
+ return maxItemsHeight - searchInputTotalHeight;
16470
+ } else {
16471
+ if (get(displayedItems).length > 8) {
16472
+ return maxItemsHeight - 33;
16473
+ }
16474
+
16475
+ return maxItemsHeight;
16476
+ }
16477
+ }),
16478
+ 'usedHeight'
16479
+ ),
16480
+ topOffset = tag(state(0), 'topOffset'),
16481
+ popupTopBorderThickness = tag(user_derived(() => get(topOffset) && get(topOffset) < 0 ? 1 : 0), 'popupTopBorderThickness'),
16482
+ popupBottomBorderThickness = tag(user_derived(() => get(topOffset) && get(topOffset) >= 0 ? 1 : 0), 'popupBottomBorderThickness');
16143
16483
 
16144
16484
  function focusOnSelectedOption(value) {
16145
16485
  if (get(displayedItems).length > 0) {
@@ -16153,28 +16493,28 @@
16153
16493
 
16154
16494
  function handleDropdownButtonClick(event) {
16155
16495
  event.preventDefault();
16156
- set(expanded, !get(expanded));
16496
+ expanded(!expanded());
16157
16497
  }
16158
16498
 
16159
16499
  function handleOuterEvent() {
16160
16500
  if (!Utils.componentIsActive(get(instance))) {
16161
- set(expanded, false);
16501
+ expanded(false);
16162
16502
  }
16163
16503
  }
16164
16504
 
16165
16505
  function handleTab(event) {
16166
16506
  // Le changement de focus a lieu après le lancement de l'événement clavier.
16167
16507
  // Il faut donc faire un court sleep pour avoir le nouvel élément en focus.
16168
- Utils.sleep(5).then(() => {
16508
+ tick().then(() => {
16169
16509
  if (strict_equals(event.key, "Tab") && !Utils.componentIsActive(get(instance))) {
16170
- set(expanded, false);
16510
+ expanded(false);
16171
16511
  }
16172
16512
  }).catch(console.error);
16173
16513
  }
16174
16514
 
16175
16515
  function handleEscape(event) {
16176
16516
  if (strict_equals(event.key, "Escape")) {
16177
- set(expanded, false);
16517
+ expanded(false);
16178
16518
  }
16179
16519
  }
16180
16520
 
@@ -16188,7 +16528,7 @@
16188
16528
  function handleArrowDown(event, targetComponent) {
16189
16529
  if (strict_equals(event.key, "ArrowDown") && targetComponent) {
16190
16530
  event.preventDefault();
16191
- set(expanded, true);
16531
+ expanded(true);
16192
16532
  targetComponent.focus();
16193
16533
  }
16194
16534
  }
@@ -16200,10 +16540,10 @@
16200
16540
  if (strict_equals(event.key, "ArrowDown")) {
16201
16541
  event.preventDefault();
16202
16542
 
16203
- if (get(expanded)) {
16543
+ if (expanded()) {
16204
16544
  targetComponent.focus();
16205
16545
  } else {
16206
- set(expanded, true);
16546
+ expanded(true);
16207
16547
  focusOnSelectedOption(value());
16208
16548
  }
16209
16549
  }
@@ -16211,7 +16551,7 @@
16211
16551
  if (strict_equals(event.key, "ArrowUp")) {
16212
16552
  event.preventDefault();
16213
16553
 
16214
- if (get(expanded)) {
16554
+ if (expanded()) {
16215
16555
  get(dropdownItems)?.focusOnLastElement();
16216
16556
  }
16217
16557
  }
@@ -16223,7 +16563,7 @@
16223
16563
  } else {
16224
16564
  set(hiddenSearchText, get(hiddenSearchText) + event.key);
16225
16565
 
16226
- if (get(hiddenSearchText).length > 0 && get(expanded)) {
16566
+ if (get(hiddenSearchText).length > 0 && expanded()) {
16227
16567
  get(dropdownItems)?.focusOnFirstMatchingElement(get(hiddenSearchText));
16228
16568
  }
16229
16569
  }
@@ -16238,7 +16578,7 @@
16238
16578
  }
16239
16579
 
16240
16580
  function closeDropdown(key) {
16241
- set(expanded, false);
16581
+ expanded(false);
16242
16582
  set(hiddenSearchText, "");
16243
16583
 
16244
16584
  if (strict_equals(key, "Escape") && get(button)) {
@@ -16264,12 +16604,13 @@
16264
16604
 
16265
16605
  user_effect(() => {
16266
16606
  if (strict_equals(get(previousValue)?.toString(), value()?.toString(), false)) {
16607
+ set(previousValue, value(), true);
16267
16608
  invalid(false);
16268
16609
  }
16269
16610
  });
16270
16611
 
16271
16612
  user_effect(() => {
16272
- if (!get(expanded)) {
16613
+ if (!expanded()) {
16273
16614
  set(hiddenSearchText, "");
16274
16615
  set(searchText, "");
16275
16616
  }
@@ -16309,10 +16650,34 @@
16309
16650
  placeholder(strict_equals(optionWithEmptyValue.label, "", false) ? optionWithEmptyValue.label : defaultPlaceholder);
16310
16651
  });
16311
16652
 
16653
+ user_effect(() => {
16654
+ if (expanded()) {
16655
+ const borderThickness = 2 * (invalid() ? 2 : 1);
16656
+
16657
+ const popupHeight = get(popup)
16658
+ ? get(popup).getBoundingClientRect().height
16659
+ : get(usedHeight);
16660
+
16661
+ set(topOffset, get(buttonElementYPosition) + buttonHeight > innerHeight - popupHeight ? -popupHeight : buttonHeight - borderThickness, true);
16662
+ }
16663
+ });
16664
+
16312
16665
  function findOptionWithEmptyValue() {
16313
16666
  return items()?.find((item) => strict_equals(item.value, "") || strict_equals(item.value, null) || strict_equals(item.value, undefined));
16314
16667
  }
16315
16668
 
16669
+ function setRemainingBottomHeight() {
16670
+ if (!get(button)) {
16671
+ return;
16672
+ }
16673
+
16674
+ set(buttonElementYPosition, get(button).getBoundingClientRect().y, true);
16675
+ }
16676
+
16677
+ onMount(() => {
16678
+ setRemainingBottomHeight();
16679
+ });
16680
+
16316
16681
  var $$exports = {
16317
16682
  get id() {
16318
16683
  return id();
@@ -16476,6 +16841,15 @@
16476
16841
  flushSync();
16477
16842
  },
16478
16843
 
16844
+ get expanded() {
16845
+ return expanded();
16846
+ },
16847
+
16848
+ set expanded($$value = false) {
16849
+ expanded($$value);
16850
+ flushSync();
16851
+ },
16852
+
16479
16853
  ...legacy_api()
16480
16854
  };
16481
16855
 
@@ -16483,6 +16857,7 @@
16483
16857
 
16484
16858
  event('click', $document.body, handleOuterEvent);
16485
16859
  event('keydown', $document.body, handleTab);
16860
+ event('scroll', $window, setRemainingBottomHeight);
16486
16861
 
16487
16862
  var div_1 = child(div);
16488
16863
 
@@ -16523,7 +16898,7 @@
16523
16898
  }),
16524
16899
  'component',
16525
16900
  DropdownList,
16526
- 284,
16901
+ 327,
16527
16902
  12,
16528
16903
  { componentTag: 'Label' }
16529
16904
  );
@@ -16535,7 +16910,7 @@
16535
16910
  }),
16536
16911
  'if',
16537
16912
  DropdownList,
16538
- 283,
16913
+ 326,
16539
16914
  8
16540
16915
  );
16541
16916
  }
@@ -16544,62 +16919,70 @@
16544
16919
  var node_1 = child(div_2);
16545
16920
 
16546
16921
  add_svelte_meta(
16547
- () => bind_this(
16548
- DropdownListButton(node_1, {
16549
- get inputId() {
16550
- return inputId;
16551
- },
16922
+ () => DropdownListButton(node_1, {
16923
+ get inputId() {
16924
+ return inputId;
16925
+ },
16552
16926
 
16553
- get disabled() {
16554
- return disabled();
16555
- },
16927
+ get disabled() {
16928
+ return disabled();
16929
+ },
16556
16930
 
16557
- get expanded() {
16558
- return get(expanded);
16559
- },
16931
+ get expanded() {
16932
+ return expanded();
16933
+ },
16560
16934
 
16561
- get 'aria-labelledby'() {
16562
- return labelId;
16563
- },
16935
+ get 'aria-labelledby'() {
16936
+ return labelId;
16937
+ },
16564
16938
 
16565
- get 'aria-required'() {
16566
- return required();
16567
- },
16939
+ get 'aria-required'() {
16940
+ return required();
16941
+ },
16568
16942
 
16569
- get 'aria-expanded'() {
16570
- return get(expanded);
16571
- },
16943
+ get 'aria-expanded'() {
16944
+ return expanded();
16945
+ },
16572
16946
 
16573
- 'aria-haspopup': 'listbox',
16947
+ 'aria-haspopup': 'listbox',
16574
16948
 
16575
- get 'aria-controls'() {
16576
- return itemsId;
16577
- },
16949
+ get 'aria-controls'() {
16950
+ return itemsId;
16951
+ },
16578
16952
 
16579
- get 'aria-invalid'() {
16580
- return invalid();
16581
- },
16953
+ get 'aria-invalid'() {
16954
+ return invalid();
16955
+ },
16582
16956
 
16583
- get selectedOptionsText() {
16584
- return get(selectedOptionsText);
16585
- },
16957
+ get selectedOptionsText() {
16958
+ return get(selectedOptionsText);
16959
+ },
16586
16960
 
16587
- get placeholder() {
16588
- return placeholder();
16589
- },
16961
+ get placeholder() {
16962
+ return placeholder();
16963
+ },
16590
16964
 
16591
- onclick: handleDropdownButtonClick,
16965
+ get usedHeight() {
16966
+ return get(usedHeight);
16967
+ },
16592
16968
 
16593
- onkeydown: (e) => {
16594
- handleButtonKeyDown(e, enableSearch() ? get(searchInput) : get(dropdownItems));
16595
- }
16596
- }),
16597
- ($$value) => set(button, $$value, true),
16598
- () => get(button)
16599
- ),
16969
+ onclick: handleDropdownButtonClick,
16970
+
16971
+ onkeydown: (e) => {
16972
+ handleButtonKeyDown(e, enableSearch() ? get(searchInput) : get(dropdownItems));
16973
+ },
16974
+
16975
+ get buttonElement() {
16976
+ return get(button);
16977
+ },
16978
+
16979
+ set buttonElement($$value) {
16980
+ set(button, $$value, true);
16981
+ }
16982
+ }),
16600
16983
  'component',
16601
16984
  DropdownList,
16602
- 306,
16985
+ 349,
16603
16986
  12,
16604
16987
  { componentTag: 'DropdownListButton' }
16605
16988
  );
@@ -16654,7 +17037,7 @@
16654
17037
  ),
16655
17038
  'component',
16656
17039
  DropdownList,
16657
- 335,
17040
+ 387,
16658
17041
  24,
16659
17042
  { componentTag: 'SearchInput' }
16660
17043
  );
@@ -16670,7 +17053,7 @@
16670
17053
  }),
16671
17054
  'if',
16672
17055
  DropdownList,
16673
- 333,
17056
+ 385,
16674
17057
  16
16675
17058
  );
16676
17059
  }
@@ -16687,10 +17070,6 @@
16687
17070
  return itemsId;
16688
17071
  },
16689
17072
 
16690
- get enableSearch() {
16691
- return enableSearch();
16692
- },
16693
-
16694
17073
  get placeholder() {
16695
17074
  return placeholder();
16696
17075
  },
@@ -16734,7 +17113,7 @@
16734
17113
  ),
16735
17114
  'component',
16736
17115
  DropdownList,
16737
- 353,
17116
+ 405,
16738
17117
  16,
16739
17118
  { componentTag: 'DropdownListItems' }
16740
17119
  );
@@ -16754,12 +17133,13 @@
16754
17133
  }),
16755
17134
  'key',
16756
17135
  DropdownList,
16757
- 375,
17136
+ 426,
16758
17137
  20
16759
17138
  );
16760
17139
 
16761
17140
  reset(div_5);
16762
17141
  reset(div_3);
17142
+ bind_this(div_3, ($$value) => set(popup, $$value), () => get(popup));
16763
17143
  reset(div_2);
16764
17144
  bind_this(div_2, ($$value) => set(instance, $$value), () => get(instance));
16765
17145
  reset(div_1);
@@ -16801,7 +17181,7 @@
16801
17181
  }),
16802
17182
  'component',
16803
17183
  DropdownList,
16804
- 384,
17184
+ 435,
16805
17185
  4,
16806
17186
  { componentTag: 'FormError' }
16807
17187
  );
@@ -16820,7 +17200,16 @@
16820
17200
  ]));
16821
17201
 
16822
17202
  set_attribute(div_3, 'id', popupId);
16823
- set_attribute(div_3, 'hidden', !get(expanded));
17203
+
17204
+ set_style(div_3, `
17205
+ --dropdown-items-top-offset: ${get(topOffset)};
17206
+ --dropdown-items-height: ${get(usedHeight)};
17207
+ --dropdown-items-bottom-border: ${get(popupBottomBorderThickness)};
17208
+ --dropdown-items-top-border: ${get(popupTopBorderThickness)};
17209
+ --dropdown-button-border: ${invalid() ? 2 : 1};
17210
+ `);
17211
+
17212
+ set_attribute(div_3, 'hidden', !expanded());
16824
17213
  });
16825
17214
 
16826
17215
  append($$anchor, div);
@@ -16848,7 +17237,8 @@
16848
17237
  multiple: {},
16849
17238
  rootElement: {},
16850
17239
  errorElement: {},
16851
- webComponentMode: {}
17240
+ webComponentMode: {},
17241
+ expanded: {}
16852
17242
  },
16853
17243
  [],
16854
17244
  [],
@@ -16857,7 +17247,7 @@
16857
17247
 
16858
17248
  SelectWC[FILENAME] = 'src/sdg/components/DropdownList/SelectWC.svelte';
16859
17249
 
16860
- var root = add_locations(from_html(`<div hidden=""><!></div> <!> <link rel="stylesheet"/>`, 1), SelectWC[FILENAME], [[119, 0], [139, 0]]);
17250
+ var root = add_locations(from_html(`<div hidden=""><!></div> <!> <link rel="stylesheet"/>`, 1), SelectWC[FILENAME], [[144, 0], [165, 0]]);
16861
17251
 
16862
17252
  function SelectWC($$anchor, $$props) {
16863
17253
  check_target(new.target);
@@ -16873,6 +17263,7 @@
16873
17263
  label = prop($$props, 'label', 7),
16874
17264
  placeholder = prop($$props, 'placeholder', 7),
16875
17265
  width = prop($$props, 'width', 7),
17266
+ expanded = prop($$props, 'expanded', 15, false),
16876
17267
  rest = rest_props(
16877
17268
  $$props,
16878
17269
  [
@@ -16887,15 +17278,16 @@
16887
17278
  'required',
16888
17279
  'label',
16889
17280
  'placeholder',
16890
- 'width'
17281
+ 'width',
17282
+ 'expanded'
16891
17283
  ]);
16892
17284
 
16893
17285
  let selectElement = tag(state(void 0), 'selectElement');
16894
17286
  let items = tag(state(void 0), 'items');
16895
17287
  let labelElement = tag(state(void 0), 'labelElement');
16896
- let observer = new MutationObserver(setupItemsList);
17288
+ const observer = Utils.createMutationObserver($$props.$$host, setupItemsList);
16897
17289
 
16898
- let observerOptions = {
17290
+ const observerOptions = {
16899
17291
  childList: true,
16900
17292
  attributes: true,
16901
17293
  subtree: true,
@@ -16906,6 +17298,7 @@
16906
17298
  let errorElement = tag(state(void 0), 'errorElement');
16907
17299
  let parentRow = tag(user_derived(() => $$props.$$host.closest(".qc-formfield-row")), 'parentRow');
16908
17300
  let internalChange = false;
17301
+ let previousValue = tag(state(proxy(value())), 'previousValue');
16909
17302
 
16910
17303
  onMount(() => {
16911
17304
  set(selectElement, $$props.$$host.querySelector("select"), true);
@@ -16919,7 +17312,7 @@
16919
17312
  multiple(get(selectElement).multiple);
16920
17313
  disabled(get(selectElement).disabled);
16921
17314
  get(selectElement).addEventListener("change", handleSelectChange);
16922
- observer.observe(get(selectElement), observerOptions);
17315
+ observer?.observe(get(selectElement), observerOptions);
16923
17316
  }
16924
17317
 
16925
17318
  setupItemsList();
@@ -16937,23 +17330,31 @@
16937
17330
 
16938
17331
  internalChange = true;
16939
17332
 
16940
- let newOptionSelected = false;
16941
-
16942
17333
  for (const option of get(selectElement).options) {
16943
17334
  const selected = value().includes(option.value);
16944
17335
 
16945
17336
  if (strict_equals(selected, option.selected, false)) {
16946
17337
  option.toggleAttribute("selected", selected);
16947
17338
  option.selected = selected;
16948
- newOptionSelected = true;
16949
17339
  }
16950
17340
  }
16951
17341
 
16952
- if (newOptionSelected) {
16953
- get(selectElement).dispatchEvent(new Event('change'));
17342
+ tick().then(() => internalChange = false);
17343
+ });
17344
+
17345
+ user_effect(() => {
17346
+ if (strict_equals(get(previousValue).toString(), value().toString(), false)) {
17347
+ set(previousValue, value(), true);
17348
+ get(selectElement)?.dispatchEvent(new CustomEvent('change', { detail: value() }));
16954
17349
  }
17350
+ });
16955
17351
 
16956
- tick().then(() => internalChange = false);
17352
+ user_effect(() => {
17353
+ if (expanded()) {
17354
+ get(selectElement)?.dispatchEvent(new CustomEvent('qc.select.show', { bubbles: true, composed: true }));
17355
+ } else {
17356
+ get(selectElement)?.dispatchEvent(new CustomEvent('qc.select.hide', { bubbles: true, composed: true }));
17357
+ }
16957
17358
  });
16958
17359
 
16959
17360
  user_effect(() => {
@@ -17060,6 +17461,15 @@
17060
17461
  flushSync();
17061
17462
  },
17062
17463
 
17464
+ get expanded() {
17465
+ return expanded();
17466
+ },
17467
+
17468
+ set expanded($$value = false) {
17469
+ expanded($$value);
17470
+ flushSync();
17471
+ },
17472
+
17063
17473
  ...legacy_api()
17064
17474
  };
17065
17475
 
@@ -17077,6 +17487,7 @@
17077
17487
 
17078
17488
  $$ownership_validator.binding('value', DropdownList, value);
17079
17489
  $$ownership_validator.binding('invalid', DropdownList, invalid);
17490
+ $$ownership_validator.binding('expanded', DropdownList, expanded);
17080
17491
 
17081
17492
  add_svelte_meta(
17082
17493
  () => DropdownList(node_1, spread_props(
@@ -17147,12 +17558,20 @@
17147
17558
 
17148
17559
  set rootElement($$value) {
17149
17560
  set(instance, $$value, true);
17561
+ },
17562
+
17563
+ get expanded() {
17564
+ return expanded();
17565
+ },
17566
+
17567
+ set expanded($$value) {
17568
+ expanded($$value);
17150
17569
  }
17151
17570
  }
17152
17571
  )),
17153
17572
  'component',
17154
17573
  SelectWC,
17155
- 123,
17574
+ 148,
17156
17575
  0,
17157
17576
  { componentTag: 'DropdownList' }
17158
17577
  );
@@ -17181,7 +17600,8 @@
17181
17600
  placeholder: { attribute: 'placeholder', type: 'String' },
17182
17601
  searchPlaceholder: { attribute: 'search-placeholder', type: 'String' },
17183
17602
  noOptionsMessage: { attribute: 'no-options-message', type: 'String' },
17184
- multiple: { attribute: 'multiple', type: 'Boolean' }
17603
+ multiple: { attribute: 'multiple', type: 'Boolean' },
17604
+ expanded: { attribute: 'expanded', reflect: true, type: 'Boolean' }
17185
17605
  },
17186
17606
  ['default'],
17187
17607
  [],