@allovoisins/sequoia 0.1.0-next.11 → 0.1.0-next.13

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 (70) hide show
  1. package/README.md +23 -1
  2. package/dist/components/SqAddressAutocomplete/SqAddressAutocomplete.css +0 -27
  3. package/dist/components/SqAddressAutocomplete/SqAddressAutocomplete.types.d.ts +7 -7
  4. package/dist/components/SqAddressAutocomplete/SqAddressAutocomplete.types.d.ts.map +1 -1
  5. package/dist/components/SqAddressAutocomplete/SqAddressAutocomplete.vue_vue_type_script_setup_true_lang.js +19 -19
  6. package/dist/components/SqAddressAutocomplete/SqAddressAutocomplete.vue_vue_type_script_setup_true_lang.js.map +1 -1
  7. package/dist/components/SqAddressAutocomplete/SqAddressAutocomplete2.js.map +1 -1
  8. package/dist/components/SqButton/SqButton.css +14 -0
  9. package/dist/components/SqButton/SqButton.types.d.ts +29 -9
  10. package/dist/components/SqButton/SqButton.types.d.ts.map +1 -1
  11. package/dist/components/SqButton/SqButton.vue_vue_type_script_setup_true_lang.js +10 -10
  12. package/dist/components/SqButton/SqButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  13. package/dist/components/SqButton/SqButton2.js.map +1 -1
  14. package/dist/components/SqButton/index.d.ts +1 -1
  15. package/dist/components/SqButton/index.d.ts.map +1 -1
  16. package/dist/components/SqCheckInput/SqCheckInput.css +1 -1
  17. package/dist/components/SqCheckInput/SqCheckInput.types.d.ts +3 -3
  18. package/dist/components/SqCheckInput/SqCheckInput.types.d.ts.map +1 -1
  19. package/dist/components/SqCheckInput/SqCheckInput.vue_vue_type_script_setup_true_lang.js +9 -9
  20. package/dist/components/SqCheckInput/SqCheckInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  21. package/dist/components/SqCheckInput/SqCheckInput2.js.map +1 -1
  22. package/dist/components/SqInput/SqInput.types.d.ts +5 -5
  23. package/dist/components/SqInput/SqInput.types.d.ts.map +1 -1
  24. package/dist/components/SqInput/SqInput.vue_vue_type_script_setup_true_lang.js +13 -13
  25. package/dist/components/SqInput/SqInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/dist/components/SqInput/SqInput2.js.map +1 -1
  27. package/dist/components/SqNumeric/SqNumeric.texts.d.ts +3 -0
  28. package/dist/components/SqNumeric/SqNumeric.texts.d.ts.map +1 -0
  29. package/dist/components/SqNumeric/SqNumeric.texts.js +10 -0
  30. package/dist/components/SqNumeric/SqNumeric.texts.js.map +1 -0
  31. package/dist/components/SqNumeric/SqNumeric.types.d.ts +26 -6
  32. package/dist/components/SqNumeric/SqNumeric.types.d.ts.map +1 -1
  33. package/dist/components/SqNumeric/SqNumeric.vue.d.ts.map +1 -1
  34. package/dist/components/SqNumeric/SqNumeric.vue_vue_type_script_setup_true_lang.js +63 -21
  35. package/dist/components/SqNumeric/SqNumeric.vue_vue_type_script_setup_true_lang.js.map +1 -1
  36. package/dist/components/SqNumeric/SqNumeric2.js.map +1 -1
  37. package/dist/components/SqNumeric/index.d.ts +1 -1
  38. package/dist/components/SqNumeric/index.d.ts.map +1 -1
  39. package/dist/components/SqPassword/SqPassword.types.d.ts +3 -3
  40. package/dist/components/SqPassword/SqPassword.types.d.ts.map +1 -1
  41. package/dist/components/SqPassword/SqPassword.vue_vue_type_script_setup_true_lang.js +11 -11
  42. package/dist/components/SqPassword/SqPassword.vue_vue_type_script_setup_true_lang.js.map +1 -1
  43. package/dist/components/SqPassword/SqPassword2.js.map +1 -1
  44. package/dist/components/SqSquareButton/SqSquareButton.types.d.ts +1 -1
  45. package/dist/components/SqSquareButton/SqSquareButton.types.d.ts.map +1 -1
  46. package/dist/components/SqSquareButton/SqSquareButton.vue_vue_type_script_setup_true_lang.js +2 -2
  47. package/dist/components/SqSquareButton/SqSquareButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  48. package/dist/components/SqSquareButton/SqSquareButton2.js.map +1 -1
  49. package/dist/components/SqTextArea/SqTextArea.css +1 -27
  50. package/dist/components/SqTextArea/SqTextArea.d.vue.ts +4 -1
  51. package/dist/components/SqTextArea/SqTextArea.types.d.ts +17 -7
  52. package/dist/components/SqTextArea/SqTextArea.types.d.ts.map +1 -1
  53. package/dist/components/SqTextArea/SqTextArea.vue.d.ts +4 -1
  54. package/dist/components/SqTextArea/SqTextArea.vue.d.ts.map +1 -1
  55. package/dist/components/SqTextArea/SqTextArea.vue_vue_type_script_setup_true_lang.js +37 -22
  56. package/dist/components/SqTextArea/SqTextArea.vue_vue_type_script_setup_true_lang.js.map +1 -1
  57. package/dist/components/SqTextArea/SqTextArea2.js.map +1 -1
  58. package/dist/index.d.ts +2 -2
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/internal/SqField/SqField.css +27 -0
  61. package/dist/internal/SqField/SqField.types.d.ts +3 -3
  62. package/dist/internal/SqField/SqField.types.d.ts.map +1 -1
  63. package/dist/internal/SqField/SqField.vue_vue_type_script_setup_true_lang.js +8 -8
  64. package/dist/internal/SqField/SqField.vue_vue_type_script_setup_true_lang.js.map +1 -1
  65. package/dist/internal/SqField/SqField2.js.map +1 -1
  66. package/dist/texts/SqTexts.types.d.ts +3 -1
  67. package/dist/texts/SqTexts.types.d.ts.map +1 -1
  68. package/dist/texts-keys.json +21 -1
  69. package/package.json +1 -1
  70. package/src/styles/abstracts/_button-themes.scss +58 -11
package/README.md CHANGED
@@ -37,6 +37,27 @@ Un consommateur SSR qui inline tout son CSS global dans le `<head>` a intérêt
37
37
  tenir à `@allovoisins/sequoia/scss`, qui compile en 0 octet, et à ne prendre
38
38
  `@allovoisins/sequoia/styles` que s'il thème au runtime.
39
39
 
40
+ ## Thèmes de bouton
41
+
42
+ `SqButton` livre quinze thèmes, opt-in : `@include sq.button-themes('white', 'green')` depuis
43
+ `/scss`. Une application peut aussi fournir les siens, par une map qui reprend les clés du
44
+ contrat, et déclarer leurs noms au typage :
45
+
46
+ ```scss
47
+ @include sq.button-themes-from($mes-themes);
48
+ ```
49
+
50
+ ```ts
51
+ declare module '@allovoisins/sequoia' {
52
+ interface SqButtonCustomThemes {
53
+ 'orange-premier': true;
54
+ }
55
+ }
56
+ ```
57
+
58
+ Le contraste de ces thèmes-là n'est vérifié par aucun test du package. Contrat de la map et
59
+ pièges dans `docs/CONSUMERS.md`.
60
+
40
61
  ## Traduire les libellés
41
62
 
42
63
  Deux familles de chaînes, séparées par une seule question — le design system peut-il connaître
@@ -87,6 +108,7 @@ La liste complète et les pièges sont dans [`docs/CONSUMERS.md`](../../docs/CON
87
108
  | `field` | tous les champs | `optional` |
88
109
  | `password` | `SqPassword` | `show`, `minLength`, `categories`, `uppercase`, `lowercase`, `digit`, `special`, `met`, `unmet` |
89
110
  | `textArea` | `SqTextArea` | `loading` |
111
+ | `numeric` | `SqNumeric` | `loading` |
90
112
  | `addressAutocomplete` | `SqAddressAutocomplete` | `listLabel`, `geolocate`, `loading`, `geolocating`, `noResults`, `results`, `clear` |
91
113
  | `toast` | `SqToast`, `SqToastRegion` | `close`, `info`, `success`, `warning`, `error` |
92
114
 
@@ -94,7 +116,7 @@ La résolution va du plus général au plus précis — défaut du composant, sc
94
116
  composant, prop `texts` de l'instance :
95
117
 
96
118
  ```vue
97
- <SqButton loading :texts="{ loading: t('checkout.sending') }">Payer</SqButton>
119
+ <SqButton is-loading :texts="{ loading: t('checkout.sending') }">Payer</SqButton>
98
120
  ```
99
121
 
100
122
  Une clé **absente ou à `undefined`** garde la couche du dessous : une clé d'i18n manquante retombe
@@ -179,31 +179,4 @@
179
179
  overflow: hidden;
180
180
  clip-path: inset(50%);
181
181
  white-space: nowrap;
182
- }
183
-
184
- .sq-spinner-icon {
185
- margin: 0;
186
- padding: 0;
187
- border: 0;
188
- box-sizing: border-box;
189
- background: transparent;
190
- line-height: inherit;
191
- text-align: inherit;
192
- text-transform: inherit;
193
- letter-spacing: inherit;
194
- vertical-align: baseline;
195
- height: 1em;
196
- width: auto;
197
- animation: sq-spinner-rotate 900ms linear infinite;
198
- }
199
- @media (prefers-reduced-motion: reduce) {
200
- .sq-spinner-icon {
201
- animation-duration: 0s;
202
- }
203
- }
204
-
205
- @keyframes sq-spinner-rotate {
206
- to {
207
- transform: rotate(360deg);
208
- }
209
182
  }
@@ -60,15 +60,15 @@ export interface SqAddressAutocompleteProps {
60
60
  * L'état vide n'est pas affiché tant qu'il est vrai : « aucune adresse » pendant
61
61
  * le chargement serait un mensonge d'une frappe.
62
62
  */
63
- loading?: boolean;
63
+ isLoading?: boolean;
64
64
  /**
65
65
  * Propose « utiliser ma position » en tête de liste. L'option émet `geolocate` :
66
66
  * le design system n'appelle pas `navigator.geolocation` lui-même, il ne saurait
67
67
  * ni demander la permission au bon moment, ni signaler un refus (§2.6).
68
68
  */
69
69
  geolocation?: boolean;
70
- /** Géolocalisation en cours. Même spinner que `loading`. */
71
- geolocationLoading?: boolean;
70
+ /** Géolocalisation en cours. Même spinner que `isLoading`. */
71
+ isGeolocationLoading?: boolean;
72
72
  /**
73
73
  * Longueur de saisie à partir de laquelle `search` est émis, et en deçà de
74
74
  * laquelle l'état vide reste muet.
@@ -101,7 +101,7 @@ export interface SqAddressAutocompleteProps {
101
101
  /** Masque le libellé **visuellement**, sans le retirer de l'arbre d'accessibilité. */
102
102
  labelHidden?: boolean;
103
103
  /** Marque le champ comme facultatif, à côté du libellé. */
104
- optional?: boolean;
104
+ isOptional?: boolean;
105
105
  /** Texte d'aide, sous le champ. Masqué tant qu'une erreur est affichée. */
106
106
  helperText?: string;
107
107
  /**
@@ -110,11 +110,11 @@ export interface SqAddressAutocompleteProps {
110
110
  */
111
111
  errorText?: string;
112
112
  placeholder?: string;
113
- disabled?: boolean;
113
+ isDisabled?: boolean;
114
114
  /** Champ en lecture seule. La liste ne s'ouvre plus : il n'y a rien à choisir. */
115
- readonly?: boolean;
115
+ isReadonly?: boolean;
116
116
  /** Marque le champ comme obligatoire côté natif et côté ARIA. */
117
- required?: boolean;
117
+ isRequired?: boolean;
118
118
  /** Libellés, fusionnés aux défauts français clé à clé. */
119
119
  texts?: Partial<SqAddressAutocompleteTexts>;
120
120
  /** Icônes structurelles, fusionnées par-dessus `provideSqIcons`. Clé absente : glyphe embarqué. */
@@ -1 +1 @@
1
- {"version":3,"file":"SqAddressAutocomplete.types.d.ts","sourceRoot":"","sources":["../../../src/components/SqAddressAutocomplete/SqAddressAutocomplete.types.ts"],"names":[],"mappings":"AAAA;mFACmF;AACnF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,WAAW,+BAA+B;IAC9C,wFAAwF;IACxF,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAEpB;+FAC2F;IAC3F,KAAK,EAAE,MAAM,CAAC;CACf;AAED;iFACiF;AACjF,MAAM,WAAW,0BAA2B,SAAQ,YAAY;IAC9D,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAElB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAElB,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAEhB;mFAC+E;IAC/E,WAAW,EAAE,MAAM,CAAC;IAEpB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAEnC,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,+BAA+B,EAAE,CAAC;IAEzD;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,4DAA4D;IAC5D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;;OAKG;IACH,cAAc,C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AAO,CAAC;CACtB"}
1
+ {"version":3,"file":"SqAddressAutocomplete.types.d.ts","sourceRoot":"","sources":["../../../src/components/SqAddressAutocomplete/SqAddressAutocomplete.types.ts"],"names":[],"mappings":"AAAA;mFACmF;AACnF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,WAAW,+BAA+B;IAC9C,wFAAwF;IACxF,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAEpB;+FAC2F;IAC3F,KAAK,EAAE,MAAM,CAAC;CACf;AAED;iFACiF;AACjF,MAAM,WAAW,0BAA2B,SAAQ,YAAY;IAC9D,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAElB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAElB,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAEhB;mFAC+E;IAC/E,WAAW,EAAE,MAAM,CAAC;IAEpB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAEnC,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,+BAA+B,EAAE,CAAC;IAEzD;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,8DAA8D;IAC9D,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,QAAQ,GA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UR
71
71
  props: {
72
72
  modelValue: { default: "" },
73
73
  suggestions: { default: () => [] },
74
- loading: {
74
+ isLoading: {
75
75
  type: Boolean,
76
76
  default: false
77
77
  },
@@ -79,7 +79,7 @@ var SqAddressAutocomplete_vue_vue_type_script_setup_true_lang_default = /*@__PUR
79
79
  type: Boolean,
80
80
  default: false
81
81
  },
82
- geolocationLoading: {
82
+ isGeolocationLoading: {
83
83
  type: Boolean,
84
84
  default: false
85
85
  },
@@ -94,22 +94,22 @@ var SqAddressAutocomplete_vue_vue_type_script_setup_true_lang_default = /*@__PUR
94
94
  type: Boolean,
95
95
  default: false
96
96
  },
97
- optional: {
97
+ isOptional: {
98
98
  type: Boolean,
99
99
  default: false
100
100
  },
101
101
  helperText: {},
102
102
  errorText: {},
103
103
  placeholder: {},
104
- disabled: {
104
+ isDisabled: {
105
105
  type: Boolean,
106
106
  default: false
107
107
  },
108
- readonly: {
108
+ isReadonly: {
109
109
  type: Boolean,
110
110
  default: false
111
111
  },
112
- required: {
112
+ isRequired: {
113
113
  type: Boolean,
114
114
  default: false
115
115
  },
@@ -146,7 +146,7 @@ var SqAddressAutocomplete_vue_vue_type_script_setup_true_lang_default = /*@__PUR
146
146
  const root = ref(null);
147
147
  const open = ref(false);
148
148
  const activeIndex = ref(-1);
149
- const busy = computed(() => __props.loading || __props.geolocationLoading);
149
+ const busy = computed(() => __props.isLoading || __props.isGeolocationLoading);
150
150
  const options = computed(() => [...__props.geolocation ? [{
151
151
  kind: "geolocate",
152
152
  key: "geolocate"
@@ -156,18 +156,18 @@ var SqAddressAutocomplete_vue_vue_type_script_setup_true_lang_default = /*@__PUR
156
156
  suggestion
157
157
  }))]);
158
158
  const showEmpty = computed(() => !busy.value && __props.suggestions.length === 0 && __props.modelValue.trim().length >= __props.minQueryLength);
159
- const panelVisible = computed(() => open.value && !__props.disabled && !__props.readonly && (options.value.length > 0 || showEmpty.value));
159
+ const panelVisible = computed(() => open.value && !__props.isDisabled && !__props.isReadonly && (options.value.length > 0 || showEmpty.value));
160
160
  const expanded = computed(() => panelVisible.value && options.value.length > 0);
161
161
  const activeId = computed(() => expanded.value && activeIndex.value >= 0 ? optionId(activeIndex.value) : void 0);
162
- const showClear = computed(() => __props.clearable && __props.modelValue.length > 0 && !__props.disabled && !__props.readonly);
162
+ const showClear = computed(() => __props.clearable && __props.modelValue.length > 0 && !__props.isDisabled && !__props.isReadonly);
163
163
  /**
164
164
  * Annonce d'état (SC 4.1.3). Le nœud `role="status"` est rendu en permanence et
165
165
  * seul son texte change : une région live insérée en même temps que son contenu
166
166
  * n'est pas annoncée de façon fiable.
167
167
  */
168
168
  const announcement = computed(() => {
169
- if (__props.geolocationLoading) return t.value.geolocating;
170
- if (__props.loading) return t.value.loading;
169
+ if (__props.isGeolocationLoading) return t.value.geolocating;
170
+ if (__props.isLoading) return t.value.loading;
171
171
  if (!panelVisible.value) return "";
172
172
  if (showEmpty.value) return t.value.noResults;
173
173
  return __props.suggestions.length > 0 ? t.value.results(__props.suggestions.length) : "";
@@ -278,14 +278,14 @@ var SqAddressAutocomplete_vue_vue_type_script_setup_true_lang_default = /*@__PUR
278
278
  "model-value": __props.modelValue,
279
279
  label: __props.label,
280
280
  "label-hidden": __props.labelHidden,
281
- optional: __props.optional,
281
+ "is-optional": __props.isOptional,
282
282
  texts: { optional: unref(t).optional },
283
283
  "helper-text": __props.helperText,
284
284
  "error-text": __props.errorText,
285
285
  placeholder: __props.placeholder,
286
- disabled: __props.disabled,
287
- readonly: __props.readonly,
288
- required: __props.required,
286
+ "is-disabled": __props.isDisabled,
287
+ "is-readonly": __props.isReadonly,
288
+ "is-required": __props.isRequired,
289
289
  role: "combobox",
290
290
  "aria-autocomplete": "list",
291
291
  "aria-expanded": expanded.value ? "true" : "false",
@@ -338,14 +338,14 @@ var SqAddressAutocomplete_vue_vue_type_script_setup_true_lang_default = /*@__PUR
338
338
  "model-value",
339
339
  "label",
340
340
  "label-hidden",
341
- "optional",
341
+ "is-optional",
342
342
  "texts",
343
343
  "helper-text",
344
344
  "error-text",
345
345
  "placeholder",
346
- "disabled",
347
- "readonly",
348
- "required",
346
+ "is-disabled",
347
+ "is-readonly",
348
+ "is-required",
349
349
  "aria-expanded",
350
350
  "aria-controls",
351
351
  "aria-activedescendant",
@@ -1 +1 @@
1
- {"version":3,"file":"SqAddressAutocomplete.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"sources":["../../../src/components/SqAddressAutocomplete/SqAddressAutocomplete.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/** Champ d'adresse : un `SqInput` en `role=\"combobox\"` et la liste qu'il déplie. Il ne\n * cherche pas les adresses, et douze écarts avec la source sont dans DIVERGENCES.md. */\nimport { computed, nextTick, ref, useAttrs, useId, watch } from 'vue';\nimport SqInput from '../SqInput/SqInput.vue';\nimport { useSqIcons } from '../../icons/SqIcons.js';\nimport { useSqTexts } from '../../texts/SqTexts.js';\nimport { sqAddressAutocompleteTexts } from './SqAddressAutocomplete.texts.js';\nimport type {\n SqAddressAutocompleteEmits,\n SqAddressAutocompleteProps,\n SqAddressAutocompleteSlots,\n SqAddressAutocompleteSuggestion,\n} from './SqAddressAutocomplete.types.js';\n\nimport './SqAddressAutocomplete.scss';\n\nconst {\n modelValue = '',\n suggestions = [],\n loading = false,\n geolocation = false,\n geolocationLoading = false,\n minQueryLength = 3,\n placement = 'bottom',\n clearable = true,\n label,\n labelHidden = false,\n optional = false,\n helperText,\n errorText,\n placeholder,\n disabled = false,\n readonly = false,\n required = false,\n texts,\n icons,\n} = defineProps<SqAddressAutocompleteProps>();\n\nconst emit = defineEmits<SqAddressAutocompleteEmits>();\n\nconst sqIcons = useSqIcons(() => icons);\n\n// `inheritAttrs: false` avec raison écrite, comme l'exige le contrat de composant :\n// la racine ancre la liste dépliée, alors que `name` ou `aria-label` n'ont de sens\n// que sur le contrôle. `class` et `style` restent dirigés vers la racine.\ndefineOptions({ name: 'SqAddressAutocomplete', inheritAttrs: false });\n\ndefineSlots<SqAddressAutocompleteSlots>();\n\nconst attrs = useAttrs();\n\n// Clés omises plutôt que passées à `undefined` : Vue normalise `style: undefined`\n// en `style=\"\"`, qui part alors dans le HTML SSR de chaque champ.\nconst rootAttrs = computed(() => ({\n ...(attrs['class'] !== undefined && { class: attrs['class'] }),\n ...(attrs['style'] !== undefined && { style: attrs['style'] }),\n}));\n\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs;\n return rest;\n});\n\nconst t = useSqTexts(['field', 'addressAutocomplete'], sqAddressAutocompleteTexts, () => texts);\n\nconst uid = useId();\nconst listboxId = computed(() => `sq-address-autocomplete-${uid}-listbox`);\nconst optionId = (index: number) => `sq-address-autocomplete-${uid}-option-${index}`;\n\nconst root = ref<HTMLElement | null>(null);\nconst open = ref(false);\nconst activeIndex = ref(-1);\n\nconst busy = computed(() => loading || geolocationLoading);\n\ntype Option =\n | { kind: 'geolocate'; key: string }\n | { kind: 'suggestion'; key: string; suggestion: SqAddressAutocompleteSuggestion };\n\nconst options = computed<Option[]>(() => [\n ...(geolocation ? ([{ kind: 'geolocate', key: 'geolocate' }] as Option[]) : []),\n ...suggestions.map<Option>((suggestion) => ({\n kind: 'suggestion',\n key: `suggestion-${suggestion.id}`,\n suggestion,\n })),\n]);\n\n// L'état vide se tait pendant une recherche et sous la longueur minimale : annoncer\n// « aucune adresse » à la deuxième lettre, ou avant la première réponse, décrit un\n// état que le composant ne connaît pas encore.\nconst showEmpty = computed(\n () => !busy.value && suggestions.length === 0 && modelValue.trim().length >= minQueryLength,\n);\n\nconst panelVisible = computed(\n () => open.value && !disabled && !readonly && (options.value.length > 0 || showEmpty.value),\n);\n\n// `aria-expanded` décrit la LISTE, pas le panneau : sans option, il n'existe aucune\n// liste à désigner, donc le combobox est replié et `aria-controls` ne pointe rien.\n// Un identifiant qui ne résout pas est une valeur d'attribut invalide, et axe la\n// remonte en `critical`. L'état vide reste annoncé par la région live.\nconst expanded = computed(() => panelVisible.value && options.value.length > 0);\n\nconst activeId = computed(() =>\n expanded.value && activeIndex.value >= 0 ? optionId(activeIndex.value) : undefined,\n);\n\nconst showClear = computed(() => clearable && modelValue.length > 0 && !disabled && !readonly);\n\n/**\n * Annonce d'état (SC 4.1.3). Le nœud `role=\"status\"` est rendu en permanence et\n * seul son texte change : une région live insérée en même temps que son contenu\n * n'est pas annoncée de façon fiable.\n */\nconst announcement = computed(() => {\n // Deux attentes distinctes : chercher une adresse n'est pas chercher l'utilisateur.\n if (geolocationLoading) return t.value.geolocating;\n if (loading) return t.value.loading;\n if (!panelVisible.value) return '';\n if (showEmpty.value) return t.value.noResults;\n return suggestions.length > 0 ? t.value.results(suggestions.length) : '';\n});\n\n// Une liste renouvelée sous un curseur immobile ferait valider une autre adresse que\n// celle qui était surlignée. `deep: 1` parce qu'un consommateur qui pousse dans le\n// tableau au lieu de le réassigner ne change pas sa référence.\nwatch(\n () => suggestions,\n () => {\n activeIndex.value = -1;\n },\n { deep: 1 },\n);\n\n// `aria-activedescendant` ne déplace jamais le focus DOM : sans ce défilement, la\n// flèche bas surligne hors de l'écran dès la cinquième adresse. `block: 'nearest'`\n// ne bouge rien tant que l'option est visible, donc la page ne saute pas.\nwatch(activeIndex, async (index) => {\n if (index < 0) return;\n await nextTick();\n\n const option = root.value?.querySelectorAll<HTMLElement>('[role=\"option\"]')[index];\n\n // jsdom n'implémente pas `scrollIntoView` : l'appel optionnel évite de faire\n // échouer les tests unitaires sur une fonction de confort visuel.\n option?.scrollIntoView?.({ block: 'nearest' });\n});\n\nfunction close(): void {\n open.value = false;\n activeIndex.value = -1;\n}\n\nfunction onInput(value: string): void {\n emit('update:modelValue', value);\n activeIndex.value = -1;\n open.value = true;\n\n if (value.trim().length >= minQueryLength) emit('search', value);\n}\n\nfunction onFocus(event: FocusEvent): void {\n open.value = true;\n emit('focus', event);\n}\n\n// `relatedTarget` plutôt que `document.activeElement` : l'information est portée par\n// l'événement, donc rien à interroger, et le composant reste sans accès au document.\nfunction onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (next && root.value?.contains(next)) return;\n close();\n}\n\nfunction selectAt(index: number): void {\n const option = options.value[index];\n if (!option) return;\n\n close();\n\n if (option.kind === 'geolocate') {\n emit('geolocate');\n return;\n }\n\n emit('update:modelValue', option.suggestion.label);\n emit('select', option.suggestion);\n}\n\nfunction move(step: number): void {\n const total = options.value.length;\n if (total === 0) return;\n\n open.value = true;\n activeIndex.value = (activeIndex.value + step + total) % total;\n}\n\nfunction onKeydown(event: KeyboardEvent): void {\n switch (event.key) {\n // `Alt` déplie et replie sans surligner, comme le veut le motif : c'est le geste\n // de celui qui veut VOIR la liste, pas en parcourir les options.\n case 'ArrowDown':\n event.preventDefault();\n if (event.altKey) open.value = true;\n else move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (event.altKey) close();\n else move(-1);\n break;\n case 'Enter':\n // Sans option surlignée, la touche part au formulaire : la soumission ne doit\n // pas être avalée par un champ qui n'a rien à valider.\n if (!expanded.value || activeIndex.value < 0) return;\n event.preventDefault();\n selectAt(activeIndex.value);\n break;\n case 'Escape':\n if (!panelVisible.value) return;\n event.preventDefault();\n close();\n break;\n case 'Tab':\n close();\n break;\n }\n}\n\nfunction onClear(): void {\n emit('update:modelValue', '');\n emit('clear');\n close();\n\n // Le bouton disparaît avec la valeur qu'il efface : sans cette reprise, le focus\n // retomberait sur le `<body>` et la navigation au clavier recommencerait en haut\n // de page (SC 2.4.3). Requête sur la racine du composant, jamais sur `document`.\n root.value?.querySelector('input')?.focus();\n}\n\n/**\n * Découpe un libellé en mots, en marquant ceux que la saisie contient déjà.\n *\n * La source construisait la même mise en valeur en HTML puis l'injectait par\n * `v-html`, sur une chaîne venue du géocodeur : une réponse d'API hostile ou\n * simplement mal échappée s'exécutait dans la page. Ici, Vue rend du texte.\n */\nfunction normalise(mot: string): string {\n return mot\n .toLowerCase()\n .replace(/[\\s,]+/g, ' ')\n .trim();\n}\n\n// Hors de `segments`, qui est appelée une fois par proposition et à chaque rendu : le\n// jeu des mots saisis est le même pour toutes.\nconst motsSaisis = computed(() => new Set(normalise(modelValue).split(' ').filter(Boolean)));\n\nfunction segments(label: string): { key: number; text: string; match: boolean }[] {\n return label.split(/(\\s+)/).map((text, key) => ({\n key,\n text,\n match: text.trim().length > 0 && motsSaisis.value.has(normalise(text)),\n }));\n}\n</script>\n\n<template>\n <div ref=\"root\" v-bind=\"rootAttrs\" class=\"sq-address-autocomplete\" @focusout=\"onFocusOut\">\n <SqInput\n autocomplete=\"off\"\n v-bind=\"inputAttrs\"\n :icons=\"icons\"\n :model-value=\"modelValue\"\n :label=\"label\"\n :label-hidden=\"labelHidden\"\n :optional=\"optional\"\n :texts=\"{ optional: t.optional }\"\n :helper-text=\"helperText\"\n :error-text=\"errorText\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :required=\"required\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n :aria-expanded=\"expanded ? 'true' : 'false'\"\n :aria-controls=\"expanded ? listboxId : undefined\"\n :aria-activedescendant=\"activeId\"\n :aria-busy=\"busy ? 'true' : undefined\"\n @update:model-value=\"onInput\"\n @keydown=\"onKeydown\"\n @focus=\"onFocus\"\n @blur=\"emit('blur', $event)\"\n @mousedown=\"open = true\"\n >\n <template v-if=\"$slots.icon\" #icon><slot name=\"icon\" /></template>\n\n <template v-if=\"busy || showClear\" #iconRight>\n <!--\n Icônes structurelles inlinées, et non extraites en composant : un module\n JS et une feuille CSS de plus, chargés par chaque page qui importe le\n champ pour des états qu'elle ne rend presque jamais (même arbitrage qu'au\n lot 7 sur le spinner du bouton).\n -->\n <component\n :is=\"sqIcons['regular-spinner']\"\n v-if=\"busy && sqIcons['regular-spinner']\"\n class=\"sq-spinner-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else-if=\"busy\"\n class=\"sq-spinner-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"9\"\n stroke=\"currentColor\"\n stroke-opacity=\"0.25\"\n stroke-width=\"3\"\n />\n <path\n d=\"M21 12a9 9 0 0 0-9-9\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n />\n </svg>\n\n <button\n v-else\n type=\"button\"\n class=\"sq-address-autocomplete__clear\"\n :aria-label=\"t.clear\"\n @click=\"onClear\"\n >\n <component\n :is=\"sqIcons['regular-xmark']\"\n v-if=\"sqIcons['regular-xmark']\"\n class=\"sq-address-autocomplete__clear-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else\n class=\"sq-address-autocomplete__clear-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"m6 6 12 12M18 6 6 18\" />\n </svg>\n </button>\n </template>\n </SqInput>\n\n <!-- Sur le PANNEAU et pas seulement sur les options : son rembourrage et sa barre de\n défilement retireraient sinon le focus du champ, refermant la liste sous le curseur. -->\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <div\n v-if=\"panelVisible\"\n class=\"sq-address-autocomplete__panel\"\n :class=\"`sq-address-autocomplete__panel--${placement}`\"\n @mousedown.prevent\n >\n <ul\n v-if=\"options.length\"\n :id=\"listboxId\"\n role=\"listbox\"\n :aria-label=\"t.listLabel\"\n class=\"sq-address-autocomplete__list\"\n >\n <!-- Aucune option n'est focusable, et c'est le motif combobox : le focus reste au\n champ, `aria-activedescendant` désigne l'option courante. -->\n <!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->\n <li\n v-for=\"(option, index) in options\"\n :id=\"optionId(index)\"\n :key=\"option.key\"\n role=\"option\"\n :aria-selected=\"index === activeIndex\"\n class=\"sq-address-autocomplete__option\"\n :class=\"{ 'sq-address-autocomplete__option--active': index === activeIndex }\"\n @mousedown=\"selectAt(index)\"\n >\n <component\n :is=\"\n sqIcons[option.kind === 'geolocate' ? 'regular-crosshairs' : 'regular-location-dot']\n \"\n v-if=\"\n sqIcons[option.kind === 'geolocate' ? 'regular-crosshairs' : 'regular-location-dot']\n \"\n class=\"sq-address-autocomplete__option-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else\n class=\"sq-address-autocomplete__option-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <template v-if=\"option.kind === 'geolocate'\">\n <circle cx=\"12\" cy=\"12\" r=\"6.5\" />\n <path d=\"M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3\" />\n </template>\n <template v-else>\n <path d=\"M12 21.2c3.6-4.4 7-8 7-11.7a7 7 0 1 0-14 0c0 3.7 3.4 7.3 7 11.7Z\" />\n <circle cx=\"12\" cy=\"9.3\" r=\"2.5\" />\n </template>\n </svg>\n\n <span class=\"sq-address-autocomplete__option-label\">\n <template v-if=\"option.kind === 'geolocate'\">{{ t.geolocate }}</template>\n <!-- Un `<span>` par mot, et non une chaîne HTML injectée : la mise en valeur\n est du rendu Vue, donc le libellé du géocodeur reste du texte. -->\n <template v-else>\n <span\n v-for=\"segment in segments(option.suggestion.label)\"\n :key=\"segment.key\"\n :class=\"{ 'sq-address-autocomplete__match': segment.match }\"\n >{{ segment.text }}</span\n >\n </template>\n </span>\n </li>\n </ul>\n\n <!--\n Hors de la liste : ce n'est pas une option, et un `role=\"option\"` non\n sélectionnable ferait compter une proposition de plus à un lecteur d'écran.\n -->\n <p v-if=\"showEmpty\" class=\"sq-address-autocomplete__empty\">\n <component\n :is=\"sqIcons['regular-circle-exclamation']\"\n v-if=\"sqIcons['regular-circle-exclamation']\"\n class=\"sq-address-autocomplete__option-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else\n class=\"sq-address-autocomplete__option-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"9.2\" />\n <path d=\"M12 7.5v5.5\" />\n <path d=\"M12 16.5h.01\" stroke-width=\"2.5\" />\n </svg>\n {{ t.noResults }}\n </p>\n </div>\n\n <p class=\"sq-address-autocomplete__sr-only\" role=\"status\">{{ announcement }}</p>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCA,MAAM,OAAO;EAEb,MAAM,UAAU,iBAAiB,QAAA,KAAK;EAStC,MAAM,QAAQ,SAAS;EAIvB,MAAM,YAAY,gBAAgB;GAChC,GAAI,MAAM,aAAa,KAAA,KAAa,EAAE,OAAO,MAAM,SAAS;GAC5D,GAAI,MAAM,aAAa,KAAA,KAAa,EAAE,OAAO,MAAM,SAAS;EAC9D,EAAE;EAEF,MAAM,aAAa,eAAe;GAChC,MAAM,EAAE,OAAO,QAAQ,OAAO,QAAQ,GAAG,SAAS;GAClD,OAAO;EACT,CAAC;EAED,MAAM,IAAI,WAAW,CAAC,SAAS,qBAAqB,GAAG,kCAAkC,QAAA,KAAK;EAE9F,MAAM,MAAM,MAAM;EAClB,MAAM,YAAY,eAAe,2BAA2B,IAAI,SAAS;EACzE,MAAM,YAAY,UAAkB,2BAA2B,IAAI,UAAU;EAE7E,MAAM,OAAO,IAAwB,IAAI;EACzC,MAAM,OAAO,IAAI,KAAK;EACtB,MAAM,cAAc,IAAI,EAAE;EAE1B,MAAM,OAAO,eAAe,QAAA,WAAW,QAAA,kBAAkB;EAMzD,MAAM,UAAU,eAAyB,CACvC,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A,CAAC,CAAC,SAAS,GAAA,CAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,EAAA,KAAA,mBAAA,IAAA,IAAA;IAIlB,mBAAgF,KAAhF,aAAgF,gBAAnB,aAAA,KAAY,GAAA,CAAA"}
1
+ {"version":3,"file":"SqAddressAutocomplete.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"sources":["../../../src/components/SqAddressAutocomplete/SqAddressAutocomplete.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/** Champ d'adresse : un `SqInput` en `role=\"combobox\"` et la liste qu'il déplie. Il ne\n * cherche pas les adresses, et douze écarts avec la source sont dans DIVERGENCES.md. */\nimport { computed, nextTick, ref, useAttrs, useId, watch } from 'vue';\nimport SqInput from '../SqInput/SqInput.vue';\nimport { useSqIcons } from '../../icons/SqIcons.js';\nimport { useSqTexts } from '../../texts/SqTexts.js';\nimport { sqAddressAutocompleteTexts } from './SqAddressAutocomplete.texts.js';\nimport type {\n SqAddressAutocompleteEmits,\n SqAddressAutocompleteProps,\n SqAddressAutocompleteSlots,\n SqAddressAutocompleteSuggestion,\n} from './SqAddressAutocomplete.types.js';\n\nimport './SqAddressAutocomplete.scss';\n\nconst {\n modelValue = '',\n suggestions = [],\n isLoading = false,\n geolocation = false,\n isGeolocationLoading = false,\n minQueryLength = 3,\n placement = 'bottom',\n clearable = true,\n label,\n labelHidden = false,\n isOptional = false,\n helperText,\n errorText,\n placeholder,\n isDisabled = false,\n isReadonly = false,\n isRequired = false,\n texts,\n icons,\n} = defineProps<SqAddressAutocompleteProps>();\n\nconst emit = defineEmits<SqAddressAutocompleteEmits>();\n\nconst sqIcons = useSqIcons(() => icons);\n\n// `inheritAttrs: false` avec raison écrite, comme l'exige le contrat de composant :\n// la racine ancre la liste dépliée, alors que `name` ou `aria-label` n'ont de sens\n// que sur le contrôle. `class` et `style` restent dirigés vers la racine.\ndefineOptions({ name: 'SqAddressAutocomplete', inheritAttrs: false });\n\ndefineSlots<SqAddressAutocompleteSlots>();\n\nconst attrs = useAttrs();\n\n// Clés omises plutôt que passées à `undefined` : Vue normalise `style: undefined`\n// en `style=\"\"`, qui part alors dans le HTML SSR de chaque champ.\nconst rootAttrs = computed(() => ({\n ...(attrs['class'] !== undefined && { class: attrs['class'] }),\n ...(attrs['style'] !== undefined && { style: attrs['style'] }),\n}));\n\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs;\n return rest;\n});\n\nconst t = useSqTexts(['field', 'addressAutocomplete'], sqAddressAutocompleteTexts, () => texts);\n\nconst uid = useId();\nconst listboxId = computed(() => `sq-address-autocomplete-${uid}-listbox`);\nconst optionId = (index: number) => `sq-address-autocomplete-${uid}-option-${index}`;\n\nconst root = ref<HTMLElement | null>(null);\nconst open = ref(false);\nconst activeIndex = ref(-1);\n\nconst busy = computed(() => isLoading || isGeolocationLoading);\n\ntype Option =\n | { kind: 'geolocate'; key: string }\n | { kind: 'suggestion'; key: string; suggestion: SqAddressAutocompleteSuggestion };\n\nconst options = computed<Option[]>(() => [\n ...(geolocation ? ([{ kind: 'geolocate', key: 'geolocate' }] as Option[]) : []),\n ...suggestions.map<Option>((suggestion) => ({\n kind: 'suggestion',\n key: `suggestion-${suggestion.id}`,\n suggestion,\n })),\n]);\n\n// L'état vide se tait pendant une recherche et sous la longueur minimale : annoncer\n// « aucune adresse » à la deuxième lettre, ou avant la première réponse, décrit un\n// état que le composant ne connaît pas encore.\nconst showEmpty = computed(\n () => !busy.value && suggestions.length === 0 && modelValue.trim().length >= minQueryLength,\n);\n\nconst panelVisible = computed(\n () => open.value && !isDisabled && !isReadonly && (options.value.length > 0 || showEmpty.value),\n);\n\n// `aria-expanded` décrit la LISTE, pas le panneau : sans option, il n'existe aucune\n// liste à désigner, donc le combobox est replié et `aria-controls` ne pointe rien.\n// Un identifiant qui ne résout pas est une valeur d'attribut invalide, et axe la\n// remonte en `critical`. L'état vide reste annoncé par la région live.\nconst expanded = computed(() => panelVisible.value && options.value.length > 0);\n\nconst activeId = computed(() =>\n expanded.value && activeIndex.value >= 0 ? optionId(activeIndex.value) : undefined,\n);\n\nconst showClear = computed(() => clearable && modelValue.length > 0 && !isDisabled && !isReadonly);\n\n/**\n * Annonce d'état (SC 4.1.3). Le nœud `role=\"status\"` est rendu en permanence et\n * seul son texte change : une région live insérée en même temps que son contenu\n * n'est pas annoncée de façon fiable.\n */\nconst announcement = computed(() => {\n // Deux attentes distinctes : chercher une adresse n'est pas chercher l'utilisateur.\n if (isGeolocationLoading) return t.value.geolocating;\n if (isLoading) return t.value.loading;\n if (!panelVisible.value) return '';\n if (showEmpty.value) return t.value.noResults;\n return suggestions.length > 0 ? t.value.results(suggestions.length) : '';\n});\n\n// Une liste renouvelée sous un curseur immobile ferait valider une autre adresse que\n// celle qui était surlignée. `deep: 1` parce qu'un consommateur qui pousse dans le\n// tableau au lieu de le réassigner ne change pas sa référence.\nwatch(\n () => suggestions,\n () => {\n activeIndex.value = -1;\n },\n { deep: 1 },\n);\n\n// `aria-activedescendant` ne déplace jamais le focus DOM : sans ce défilement, la\n// flèche bas surligne hors de l'écran dès la cinquième adresse. `block: 'nearest'`\n// ne bouge rien tant que l'option est visible, donc la page ne saute pas.\nwatch(activeIndex, async (index) => {\n if (index < 0) return;\n await nextTick();\n\n const option = root.value?.querySelectorAll<HTMLElement>('[role=\"option\"]')[index];\n\n // jsdom n'implémente pas `scrollIntoView` : l'appel optionnel évite de faire\n // échouer les tests unitaires sur une fonction de confort visuel.\n option?.scrollIntoView?.({ block: 'nearest' });\n});\n\nfunction close(): void {\n open.value = false;\n activeIndex.value = -1;\n}\n\nfunction onInput(value: string): void {\n emit('update:modelValue', value);\n activeIndex.value = -1;\n open.value = true;\n\n if (value.trim().length >= minQueryLength) emit('search', value);\n}\n\nfunction onFocus(event: FocusEvent): void {\n open.value = true;\n emit('focus', event);\n}\n\n// `relatedTarget` plutôt que `document.activeElement` : l'information est portée par\n// l'événement, donc rien à interroger, et le composant reste sans accès au document.\nfunction onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (next && root.value?.contains(next)) return;\n close();\n}\n\nfunction selectAt(index: number): void {\n const option = options.value[index];\n if (!option) return;\n\n close();\n\n if (option.kind === 'geolocate') {\n emit('geolocate');\n return;\n }\n\n emit('update:modelValue', option.suggestion.label);\n emit('select', option.suggestion);\n}\n\nfunction move(step: number): void {\n const total = options.value.length;\n if (total === 0) return;\n\n open.value = true;\n activeIndex.value = (activeIndex.value + step + total) % total;\n}\n\nfunction onKeydown(event: KeyboardEvent): void {\n switch (event.key) {\n // `Alt` déplie et replie sans surligner, comme le veut le motif : c'est le geste\n // de celui qui veut VOIR la liste, pas en parcourir les options.\n case 'ArrowDown':\n event.preventDefault();\n if (event.altKey) open.value = true;\n else move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (event.altKey) close();\n else move(-1);\n break;\n case 'Enter':\n // Sans option surlignée, la touche part au formulaire : la soumission ne doit\n // pas être avalée par un champ qui n'a rien à valider.\n if (!expanded.value || activeIndex.value < 0) return;\n event.preventDefault();\n selectAt(activeIndex.value);\n break;\n case 'Escape':\n if (!panelVisible.value) return;\n event.preventDefault();\n close();\n break;\n case 'Tab':\n close();\n break;\n }\n}\n\nfunction onClear(): void {\n emit('update:modelValue', '');\n emit('clear');\n close();\n\n // Le bouton disparaît avec la valeur qu'il efface : sans cette reprise, le focus\n // retomberait sur le `<body>` et la navigation au clavier recommencerait en haut\n // de page (SC 2.4.3). Requête sur la racine du composant, jamais sur `document`.\n root.value?.querySelector('input')?.focus();\n}\n\n/**\n * Découpe un libellé en mots, en marquant ceux que la saisie contient déjà.\n *\n * La source construisait la même mise en valeur en HTML puis l'injectait par\n * `v-html`, sur une chaîne venue du géocodeur : une réponse d'API hostile ou\n * simplement mal échappée s'exécutait dans la page. Ici, Vue rend du texte.\n */\nfunction normalise(mot: string): string {\n return mot\n .toLowerCase()\n .replace(/[\\s,]+/g, ' ')\n .trim();\n}\n\n// Hors de `segments`, qui est appelée une fois par proposition et à chaque rendu : le\n// jeu des mots saisis est le même pour toutes.\nconst motsSaisis = computed(() => new Set(normalise(modelValue).split(' ').filter(Boolean)));\n\nfunction segments(label: string): { key: number; text: string; match: boolean }[] {\n return label.split(/(\\s+)/).map((text, key) => ({\n key,\n text,\n match: text.trim().length > 0 && motsSaisis.value.has(normalise(text)),\n }));\n}\n</script>\n\n<template>\n <div ref=\"root\" v-bind=\"rootAttrs\" class=\"sq-address-autocomplete\" @focusout=\"onFocusOut\">\n <SqInput\n autocomplete=\"off\"\n v-bind=\"inputAttrs\"\n :icons=\"icons\"\n :model-value=\"modelValue\"\n :label=\"label\"\n :label-hidden=\"labelHidden\"\n :is-optional=\"isOptional\"\n :texts=\"{ optional: t.optional }\"\n :helper-text=\"helperText\"\n :error-text=\"errorText\"\n :placeholder=\"placeholder\"\n :is-disabled=\"isDisabled\"\n :is-readonly=\"isReadonly\"\n :is-required=\"isRequired\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n :aria-expanded=\"expanded ? 'true' : 'false'\"\n :aria-controls=\"expanded ? listboxId : undefined\"\n :aria-activedescendant=\"activeId\"\n :aria-busy=\"busy ? 'true' : undefined\"\n @update:model-value=\"onInput\"\n @keydown=\"onKeydown\"\n @focus=\"onFocus\"\n @blur=\"emit('blur', $event)\"\n @mousedown=\"open = true\"\n >\n <template v-if=\"$slots.icon\" #icon><slot name=\"icon\" /></template>\n\n <template v-if=\"busy || showClear\" #iconRight>\n <!--\n Icônes structurelles inlinées, et non extraites en composant : un module\n JS et une feuille CSS de plus, chargés par chaque page qui importe le\n champ pour des états qu'elle ne rend presque jamais (même arbitrage qu'au\n lot 7 sur le spinner du bouton).\n -->\n <component\n :is=\"sqIcons['regular-spinner']\"\n v-if=\"busy && sqIcons['regular-spinner']\"\n class=\"sq-spinner-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else-if=\"busy\"\n class=\"sq-spinner-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"9\"\n stroke=\"currentColor\"\n stroke-opacity=\"0.25\"\n stroke-width=\"3\"\n />\n <path\n d=\"M21 12a9 9 0 0 0-9-9\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n />\n </svg>\n\n <button\n v-else\n type=\"button\"\n class=\"sq-address-autocomplete__clear\"\n :aria-label=\"t.clear\"\n @click=\"onClear\"\n >\n <component\n :is=\"sqIcons['regular-xmark']\"\n v-if=\"sqIcons['regular-xmark']\"\n class=\"sq-address-autocomplete__clear-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else\n class=\"sq-address-autocomplete__clear-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"m6 6 12 12M18 6 6 18\" />\n </svg>\n </button>\n </template>\n </SqInput>\n\n <!-- Sur le PANNEAU et pas seulement sur les options : son rembourrage et sa barre de\n défilement retireraient sinon le focus du champ, refermant la liste sous le curseur. -->\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <div\n v-if=\"panelVisible\"\n class=\"sq-address-autocomplete__panel\"\n :class=\"`sq-address-autocomplete__panel--${placement}`\"\n @mousedown.prevent\n >\n <ul\n v-if=\"options.length\"\n :id=\"listboxId\"\n role=\"listbox\"\n :aria-label=\"t.listLabel\"\n class=\"sq-address-autocomplete__list\"\n >\n <!-- Aucune option n'est focusable, et c'est le motif combobox : le focus reste au\n champ, `aria-activedescendant` désigne l'option courante. -->\n <!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->\n <li\n v-for=\"(option, index) in options\"\n :id=\"optionId(index)\"\n :key=\"option.key\"\n role=\"option\"\n :aria-selected=\"index === activeIndex\"\n class=\"sq-address-autocomplete__option\"\n :class=\"{ 'sq-address-autocomplete__option--active': index === activeIndex }\"\n @mousedown=\"selectAt(index)\"\n >\n <component\n :is=\"\n sqIcons[option.kind === 'geolocate' ? 'regular-crosshairs' : 'regular-location-dot']\n \"\n v-if=\"\n sqIcons[option.kind === 'geolocate' ? 'regular-crosshairs' : 'regular-location-dot']\n \"\n class=\"sq-address-autocomplete__option-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else\n class=\"sq-address-autocomplete__option-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <template v-if=\"option.kind === 'geolocate'\">\n <circle cx=\"12\" cy=\"12\" r=\"6.5\" />\n <path d=\"M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3\" />\n </template>\n <template v-else>\n <path d=\"M12 21.2c3.6-4.4 7-8 7-11.7a7 7 0 1 0-14 0c0 3.7 3.4 7.3 7 11.7Z\" />\n <circle cx=\"12\" cy=\"9.3\" r=\"2.5\" />\n </template>\n </svg>\n\n <span class=\"sq-address-autocomplete__option-label\">\n <template v-if=\"option.kind === 'geolocate'\">{{ t.geolocate }}</template>\n <!-- Un `<span>` par mot, et non une chaîne HTML injectée : la mise en valeur\n est du rendu Vue, donc le libellé du géocodeur reste du texte. -->\n <template v-else>\n <span\n v-for=\"segment in segments(option.suggestion.label)\"\n :key=\"segment.key\"\n :class=\"{ 'sq-address-autocomplete__match': segment.match }\"\n >{{ segment.text }}</span\n >\n </template>\n </span>\n </li>\n </ul>\n\n <!--\n Hors de la liste : ce n'est pas une option, et un `role=\"option\"` non\n sélectionnable ferait compter une proposition de plus à un lecteur d'écran.\n -->\n <p v-if=\"showEmpty\" class=\"sq-address-autocomplete__empty\">\n <component\n :is=\"sqIcons['regular-circle-exclamation']\"\n v-if=\"sqIcons['regular-circle-exclamation']\"\n class=\"sq-address-autocomplete__option-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else\n class=\"sq-address-autocomplete__option-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"9.2\" />\n <path d=\"M12 7.5v5.5\" />\n <path d=\"M12 16.5h.01\" stroke-width=\"2.5\" />\n </svg>\n {{ t.noResults }}\n </p>\n </div>\n\n <p class=\"sq-address-autocomplete__sr-only\" role=\"status\">{{ announcement }}</p>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCA,MAAM,OAAO;EAEb,MAAM,UAAU,iBAAiB,QAAA,KAAK;EAStC,MAAM,QAAQ,SAAS;EAIvB,MAAM,YAAY,gBAAgB;GAChC,GAAI,MAAM,aAAa,KAAA,KAAa,EAAE,OAAO,MAAM,SAAS;GAC5D,GAAI,MAAM,aAAa,KAAA,KAAa,EAAE,OAAO,MAAM,SAAS;EAC9D,EAAE;EAEF,MAAM,aAAa,eAAe;GAChC,MAAM,EAAE,OAAO,QAAQ,OAAO,QAAQ,GAAG,SAAS;GAClD,OAAO;EACT,CAAC;EAED,MAAM,IAAI,WAAW,CAAC,SAAS,qBAAqB,GAAG,kCAAkC,QAAA,KAAK;EAE9F,MAAM,MAAM,MAAM;EAClB,MAAM,YAAY,eAAe,2BAA2B,IAAI,SAAS;EACzE,MAAM,YAAY,UAAkB,2BAA2B,IAAI,UAAU;EAE7E,MAAM,OAAO,IAAwB,IAAI;EACzC,MAAM,OAAO,IAAI,KAAK;EACtB,MAAM,cAAc,IAAI,EAAE;EAE1B,MAAM,OAAO,eAAe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BAAa;;IAChC,EAAA,CAAA,IAAA,gBAAA,MACN,gBAAG,MAAA,CAAA,CAAC,CAAC,SAAS,GAAA,CAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,EAAA,KAAA,mBAAA,IAAA,IAAA;IAIlB,mBAAgF,KAAhF,aAAgF,gBAAnB,aAAA,KAAY,GAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SqAddressAutocomplete2.js","names":[],"sources":["../../../src/components/SqAddressAutocomplete/SqAddressAutocomplete.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/** Champ d'adresse : un `SqInput` en `role=\"combobox\"` et la liste qu'il déplie. Il ne\n * cherche pas les adresses, et douze écarts avec la source sont dans DIVERGENCES.md. */\nimport { computed, nextTick, ref, useAttrs, useId, watch } from 'vue';\nimport SqInput from '../SqInput/SqInput.vue';\nimport { useSqIcons } from '../../icons/SqIcons.js';\nimport { useSqTexts } from '../../texts/SqTexts.js';\nimport { sqAddressAutocompleteTexts } from './SqAddressAutocomplete.texts.js';\nimport type {\n SqAddressAutocompleteEmits,\n SqAddressAutocompleteProps,\n SqAddressAutocompleteSlots,\n SqAddressAutocompleteSuggestion,\n} from './SqAddressAutocomplete.types.js';\n\nimport './SqAddressAutocomplete.scss';\n\nconst {\n modelValue = '',\n suggestions = [],\n loading = false,\n geolocation = false,\n geolocationLoading = false,\n minQueryLength = 3,\n placement = 'bottom',\n clearable = true,\n label,\n labelHidden = false,\n optional = false,\n helperText,\n errorText,\n placeholder,\n disabled = false,\n readonly = false,\n required = false,\n texts,\n icons,\n} = defineProps<SqAddressAutocompleteProps>();\n\nconst emit = defineEmits<SqAddressAutocompleteEmits>();\n\nconst sqIcons = useSqIcons(() => icons);\n\n// `inheritAttrs: false` avec raison écrite, comme l'exige le contrat de composant :\n// la racine ancre la liste dépliée, alors que `name` ou `aria-label` n'ont de sens\n// que sur le contrôle. `class` et `style` restent dirigés vers la racine.\ndefineOptions({ name: 'SqAddressAutocomplete', inheritAttrs: false });\n\ndefineSlots<SqAddressAutocompleteSlots>();\n\nconst attrs = useAttrs();\n\n// Clés omises plutôt que passées à `undefined` : Vue normalise `style: undefined`\n// en `style=\"\"`, qui part alors dans le HTML SSR de chaque champ.\nconst rootAttrs = computed(() => ({\n ...(attrs['class'] !== undefined && { class: attrs['class'] }),\n ...(attrs['style'] !== undefined && { style: attrs['style'] }),\n}));\n\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs;\n return rest;\n});\n\nconst t = useSqTexts(['field', 'addressAutocomplete'], sqAddressAutocompleteTexts, () => texts);\n\nconst uid = useId();\nconst listboxId = computed(() => `sq-address-autocomplete-${uid}-listbox`);\nconst optionId = (index: number) => `sq-address-autocomplete-${uid}-option-${index}`;\n\nconst root = ref<HTMLElement | null>(null);\nconst open = ref(false);\nconst activeIndex = ref(-1);\n\nconst busy = computed(() => loading || geolocationLoading);\n\ntype Option =\n | { kind: 'geolocate'; key: string }\n | { kind: 'suggestion'; key: string; suggestion: SqAddressAutocompleteSuggestion };\n\nconst options = computed<Option[]>(() => [\n ...(geolocation ? ([{ kind: 'geolocate', key: 'geolocate' }] as Option[]) : []),\n ...suggestions.map<Option>((suggestion) => ({\n kind: 'suggestion',\n key: `suggestion-${suggestion.id}`,\n suggestion,\n })),\n]);\n\n// L'état vide se tait pendant une recherche et sous la longueur minimale : annoncer\n// « aucune adresse » à la deuxième lettre, ou avant la première réponse, décrit un\n// état que le composant ne connaît pas encore.\nconst showEmpty = computed(\n () => !busy.value && suggestions.length === 0 && modelValue.trim().length >= minQueryLength,\n);\n\nconst panelVisible = computed(\n () => open.value && !disabled && !readonly && (options.value.length > 0 || showEmpty.value),\n);\n\n// `aria-expanded` décrit la LISTE, pas le panneau : sans option, il n'existe aucune\n// liste à désigner, donc le combobox est replié et `aria-controls` ne pointe rien.\n// Un identifiant qui ne résout pas est une valeur d'attribut invalide, et axe la\n// remonte en `critical`. L'état vide reste annoncé par la région live.\nconst expanded = computed(() => panelVisible.value && options.value.length > 0);\n\nconst activeId = computed(() =>\n expanded.value && activeIndex.value >= 0 ? optionId(activeIndex.value) : undefined,\n);\n\nconst showClear = computed(() => clearable && modelValue.length > 0 && !disabled && !readonly);\n\n/**\n * Annonce d'état (SC 4.1.3). Le nœud `role=\"status\"` est rendu en permanence et\n * seul son texte change : une région live insérée en même temps que son contenu\n * n'est pas annoncée de façon fiable.\n */\nconst announcement = computed(() => {\n // Deux attentes distinctes : chercher une adresse n'est pas chercher l'utilisateur.\n if (geolocationLoading) return t.value.geolocating;\n if (loading) return t.value.loading;\n if (!panelVisible.value) return '';\n if (showEmpty.value) return t.value.noResults;\n return suggestions.length > 0 ? t.value.results(suggestions.length) : '';\n});\n\n// Une liste renouvelée sous un curseur immobile ferait valider une autre adresse que\n// celle qui était surlignée. `deep: 1` parce qu'un consommateur qui pousse dans le\n// tableau au lieu de le réassigner ne change pas sa référence.\nwatch(\n () => suggestions,\n () => {\n activeIndex.value = -1;\n },\n { deep: 1 },\n);\n\n// `aria-activedescendant` ne déplace jamais le focus DOM : sans ce défilement, la\n// flèche bas surligne hors de l'écran dès la cinquième adresse. `block: 'nearest'`\n// ne bouge rien tant que l'option est visible, donc la page ne saute pas.\nwatch(activeIndex, async (index) => {\n if (index < 0) return;\n await nextTick();\n\n const option = root.value?.querySelectorAll<HTMLElement>('[role=\"option\"]')[index];\n\n // jsdom n'implémente pas `scrollIntoView` : l'appel optionnel évite de faire\n // échouer les tests unitaires sur une fonction de confort visuel.\n option?.scrollIntoView?.({ block: 'nearest' });\n});\n\nfunction close(): void {\n open.value = false;\n activeIndex.value = -1;\n}\n\nfunction onInput(value: string): void {\n emit('update:modelValue', value);\n activeIndex.value = -1;\n open.value = true;\n\n if (value.trim().length >= minQueryLength) emit('search', value);\n}\n\nfunction onFocus(event: FocusEvent): void {\n open.value = true;\n emit('focus', event);\n}\n\n// `relatedTarget` plutôt que `document.activeElement` : l'information est portée par\n// l'événement, donc rien à interroger, et le composant reste sans accès au document.\nfunction onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (next && root.value?.contains(next)) return;\n close();\n}\n\nfunction selectAt(index: number): void {\n const option = options.value[index];\n if (!option) return;\n\n close();\n\n if (option.kind === 'geolocate') {\n emit('geolocate');\n return;\n }\n\n emit('update:modelValue', option.suggestion.label);\n emit('select', option.suggestion);\n}\n\nfunction move(step: number): void {\n const total = options.value.length;\n if (total === 0) return;\n\n open.value = true;\n activeIndex.value = (activeIndex.value + step + total) % total;\n}\n\nfunction onKeydown(event: KeyboardEvent): void {\n switch (event.key) {\n // `Alt` déplie et replie sans surligner, comme le veut le motif : c'est le geste\n // de celui qui veut VOIR la liste, pas en parcourir les options.\n case 'ArrowDown':\n event.preventDefault();\n if (event.altKey) open.value = true;\n else move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (event.altKey) close();\n else move(-1);\n break;\n case 'Enter':\n // Sans option surlignée, la touche part au formulaire : la soumission ne doit\n // pas être avalée par un champ qui n'a rien à valider.\n if (!expanded.value || activeIndex.value < 0) return;\n event.preventDefault();\n selectAt(activeIndex.value);\n break;\n case 'Escape':\n if (!panelVisible.value) return;\n event.preventDefault();\n close();\n break;\n case 'Tab':\n close();\n break;\n }\n}\n\nfunction onClear(): void {\n emit('update:modelValue', '');\n emit('clear');\n close();\n\n // Le bouton disparaît avec la valeur qu'il efface : sans cette reprise, le focus\n // retomberait sur le `<body>` et la navigation au clavier recommencerait en haut\n // de page (SC 2.4.3). Requête sur la racine du composant, jamais sur `document`.\n root.value?.querySelector('input')?.focus();\n}\n\n/**\n * Découpe un libellé en mots, en marquant ceux que la saisie contient déjà.\n *\n * La source construisait la même mise en valeur en HTML puis l'injectait par\n * `v-html`, sur une chaîne venue du géocodeur : une réponse d'API hostile ou\n * simplement mal échappée s'exécutait dans la page. Ici, Vue rend du texte.\n */\nfunction normalise(mot: string): string {\n return mot\n .toLowerCase()\n .replace(/[\\s,]+/g, ' ')\n .trim();\n}\n\n// Hors de `segments`, qui est appelée une fois par proposition et à chaque rendu : le\n// jeu des mots saisis est le même pour toutes.\nconst motsSaisis = computed(() => new Set(normalise(modelValue).split(' ').filter(Boolean)));\n\nfunction segments(label: string): { key: number; text: string; match: boolean }[] {\n return label.split(/(\\s+)/).map((text, key) => ({\n key,\n text,\n match: text.trim().length > 0 && motsSaisis.value.has(normalise(text)),\n }));\n}\n</script>\n\n<template>\n <div ref=\"root\" v-bind=\"rootAttrs\" class=\"sq-address-autocomplete\" @focusout=\"onFocusOut\">\n <SqInput\n autocomplete=\"off\"\n v-bind=\"inputAttrs\"\n :icons=\"icons\"\n :model-value=\"modelValue\"\n :label=\"label\"\n :label-hidden=\"labelHidden\"\n :optional=\"optional\"\n :texts=\"{ optional: t.optional }\"\n :helper-text=\"helperText\"\n :error-text=\"errorText\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :required=\"required\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n :aria-expanded=\"expanded ? 'true' : 'false'\"\n :aria-controls=\"expanded ? listboxId : undefined\"\n :aria-activedescendant=\"activeId\"\n :aria-busy=\"busy ? 'true' : undefined\"\n @update:model-value=\"onInput\"\n @keydown=\"onKeydown\"\n @focus=\"onFocus\"\n @blur=\"emit('blur', $event)\"\n @mousedown=\"open = true\"\n >\n <template v-if=\"$slots.icon\" #icon><slot name=\"icon\" /></template>\n\n <template v-if=\"busy || showClear\" #iconRight>\n <!--\n Icônes structurelles inlinées, et non extraites en composant : un module\n JS et une feuille CSS de plus, chargés par chaque page qui importe le\n champ pour des états qu'elle ne rend presque jamais (même arbitrage qu'au\n lot 7 sur le spinner du bouton).\n -->\n <component\n :is=\"sqIcons['regular-spinner']\"\n v-if=\"busy && sqIcons['regular-spinner']\"\n class=\"sq-spinner-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else-if=\"busy\"\n class=\"sq-spinner-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"9\"\n stroke=\"currentColor\"\n stroke-opacity=\"0.25\"\n stroke-width=\"3\"\n />\n <path\n d=\"M21 12a9 9 0 0 0-9-9\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n />\n </svg>\n\n <button\n v-else\n type=\"button\"\n class=\"sq-address-autocomplete__clear\"\n :aria-label=\"t.clear\"\n @click=\"onClear\"\n >\n <component\n :is=\"sqIcons['regular-xmark']\"\n v-if=\"sqIcons['regular-xmark']\"\n class=\"sq-address-autocomplete__clear-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else\n class=\"sq-address-autocomplete__clear-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"m6 6 12 12M18 6 6 18\" />\n </svg>\n </button>\n </template>\n </SqInput>\n\n <!-- Sur le PANNEAU et pas seulement sur les options : son rembourrage et sa barre de\n défilement retireraient sinon le focus du champ, refermant la liste sous le curseur. -->\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <div\n v-if=\"panelVisible\"\n class=\"sq-address-autocomplete__panel\"\n :class=\"`sq-address-autocomplete__panel--${placement}`\"\n @mousedown.prevent\n >\n <ul\n v-if=\"options.length\"\n :id=\"listboxId\"\n role=\"listbox\"\n :aria-label=\"t.listLabel\"\n class=\"sq-address-autocomplete__list\"\n >\n <!-- Aucune option n'est focusable, et c'est le motif combobox : le focus reste au\n champ, `aria-activedescendant` désigne l'option courante. -->\n <!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->\n <li\n v-for=\"(option, index) in options\"\n :id=\"optionId(index)\"\n :key=\"option.key\"\n role=\"option\"\n :aria-selected=\"index === activeIndex\"\n class=\"sq-address-autocomplete__option\"\n :class=\"{ 'sq-address-autocomplete__option--active': index === activeIndex }\"\n @mousedown=\"selectAt(index)\"\n >\n <component\n :is=\"\n sqIcons[option.kind === 'geolocate' ? 'regular-crosshairs' : 'regular-location-dot']\n \"\n v-if=\"\n sqIcons[option.kind === 'geolocate' ? 'regular-crosshairs' : 'regular-location-dot']\n \"\n class=\"sq-address-autocomplete__option-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else\n class=\"sq-address-autocomplete__option-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <template v-if=\"option.kind === 'geolocate'\">\n <circle cx=\"12\" cy=\"12\" r=\"6.5\" />\n <path d=\"M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3\" />\n </template>\n <template v-else>\n <path d=\"M12 21.2c3.6-4.4 7-8 7-11.7a7 7 0 1 0-14 0c0 3.7 3.4 7.3 7 11.7Z\" />\n <circle cx=\"12\" cy=\"9.3\" r=\"2.5\" />\n </template>\n </svg>\n\n <span class=\"sq-address-autocomplete__option-label\">\n <template v-if=\"option.kind === 'geolocate'\">{{ t.geolocate }}</template>\n <!-- Un `<span>` par mot, et non une chaîne HTML injectée : la mise en valeur\n est du rendu Vue, donc le libellé du géocodeur reste du texte. -->\n <template v-else>\n <span\n v-for=\"segment in segments(option.suggestion.label)\"\n :key=\"segment.key\"\n :class=\"{ 'sq-address-autocomplete__match': segment.match }\"\n >{{ segment.text }}</span\n >\n </template>\n </span>\n </li>\n </ul>\n\n <!--\n Hors de la liste : ce n'est pas une option, et un `role=\"option\"` non\n sélectionnable ferait compter une proposition de plus à un lecteur d'écran.\n -->\n <p v-if=\"showEmpty\" class=\"sq-address-autocomplete__empty\">\n <component\n :is=\"sqIcons['regular-circle-exclamation']\"\n v-if=\"sqIcons['regular-circle-exclamation']\"\n class=\"sq-address-autocomplete__option-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else\n class=\"sq-address-autocomplete__option-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"9.2\" />\n <path d=\"M12 7.5v5.5\" />\n <path d=\"M12 16.5h.01\" stroke-width=\"2.5\" />\n </svg>\n {{ t.noResults }}\n </p>\n </div>\n\n <p class=\"sq-address-autocomplete__sr-only\" role=\"status\">{{ announcement }}</p>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"SqAddressAutocomplete2.js","names":[],"sources":["../../../src/components/SqAddressAutocomplete/SqAddressAutocomplete.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/** Champ d'adresse : un `SqInput` en `role=\"combobox\"` et la liste qu'il déplie. Il ne\n * cherche pas les adresses, et douze écarts avec la source sont dans DIVERGENCES.md. */\nimport { computed, nextTick, ref, useAttrs, useId, watch } from 'vue';\nimport SqInput from '../SqInput/SqInput.vue';\nimport { useSqIcons } from '../../icons/SqIcons.js';\nimport { useSqTexts } from '../../texts/SqTexts.js';\nimport { sqAddressAutocompleteTexts } from './SqAddressAutocomplete.texts.js';\nimport type {\n SqAddressAutocompleteEmits,\n SqAddressAutocompleteProps,\n SqAddressAutocompleteSlots,\n SqAddressAutocompleteSuggestion,\n} from './SqAddressAutocomplete.types.js';\n\nimport './SqAddressAutocomplete.scss';\n\nconst {\n modelValue = '',\n suggestions = [],\n isLoading = false,\n geolocation = false,\n isGeolocationLoading = false,\n minQueryLength = 3,\n placement = 'bottom',\n clearable = true,\n label,\n labelHidden = false,\n isOptional = false,\n helperText,\n errorText,\n placeholder,\n isDisabled = false,\n isReadonly = false,\n isRequired = false,\n texts,\n icons,\n} = defineProps<SqAddressAutocompleteProps>();\n\nconst emit = defineEmits<SqAddressAutocompleteEmits>();\n\nconst sqIcons = useSqIcons(() => icons);\n\n// `inheritAttrs: false` avec raison écrite, comme l'exige le contrat de composant :\n// la racine ancre la liste dépliée, alors que `name` ou `aria-label` n'ont de sens\n// que sur le contrôle. `class` et `style` restent dirigés vers la racine.\ndefineOptions({ name: 'SqAddressAutocomplete', inheritAttrs: false });\n\ndefineSlots<SqAddressAutocompleteSlots>();\n\nconst attrs = useAttrs();\n\n// Clés omises plutôt que passées à `undefined` : Vue normalise `style: undefined`\n// en `style=\"\"`, qui part alors dans le HTML SSR de chaque champ.\nconst rootAttrs = computed(() => ({\n ...(attrs['class'] !== undefined && { class: attrs['class'] }),\n ...(attrs['style'] !== undefined && { style: attrs['style'] }),\n}));\n\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs;\n return rest;\n});\n\nconst t = useSqTexts(['field', 'addressAutocomplete'], sqAddressAutocompleteTexts, () => texts);\n\nconst uid = useId();\nconst listboxId = computed(() => `sq-address-autocomplete-${uid}-listbox`);\nconst optionId = (index: number) => `sq-address-autocomplete-${uid}-option-${index}`;\n\nconst root = ref<HTMLElement | null>(null);\nconst open = ref(false);\nconst activeIndex = ref(-1);\n\nconst busy = computed(() => isLoading || isGeolocationLoading);\n\ntype Option =\n | { kind: 'geolocate'; key: string }\n | { kind: 'suggestion'; key: string; suggestion: SqAddressAutocompleteSuggestion };\n\nconst options = computed<Option[]>(() => [\n ...(geolocation ? ([{ kind: 'geolocate', key: 'geolocate' }] as Option[]) : []),\n ...suggestions.map<Option>((suggestion) => ({\n kind: 'suggestion',\n key: `suggestion-${suggestion.id}`,\n suggestion,\n })),\n]);\n\n// L'état vide se tait pendant une recherche et sous la longueur minimale : annoncer\n// « aucune adresse » à la deuxième lettre, ou avant la première réponse, décrit un\n// état que le composant ne connaît pas encore.\nconst showEmpty = computed(\n () => !busy.value && suggestions.length === 0 && modelValue.trim().length >= minQueryLength,\n);\n\nconst panelVisible = computed(\n () => open.value && !isDisabled && !isReadonly && (options.value.length > 0 || showEmpty.value),\n);\n\n// `aria-expanded` décrit la LISTE, pas le panneau : sans option, il n'existe aucune\n// liste à désigner, donc le combobox est replié et `aria-controls` ne pointe rien.\n// Un identifiant qui ne résout pas est une valeur d'attribut invalide, et axe la\n// remonte en `critical`. L'état vide reste annoncé par la région live.\nconst expanded = computed(() => panelVisible.value && options.value.length > 0);\n\nconst activeId = computed(() =>\n expanded.value && activeIndex.value >= 0 ? optionId(activeIndex.value) : undefined,\n);\n\nconst showClear = computed(() => clearable && modelValue.length > 0 && !isDisabled && !isReadonly);\n\n/**\n * Annonce d'état (SC 4.1.3). Le nœud `role=\"status\"` est rendu en permanence et\n * seul son texte change : une région live insérée en même temps que son contenu\n * n'est pas annoncée de façon fiable.\n */\nconst announcement = computed(() => {\n // Deux attentes distinctes : chercher une adresse n'est pas chercher l'utilisateur.\n if (isGeolocationLoading) return t.value.geolocating;\n if (isLoading) return t.value.loading;\n if (!panelVisible.value) return '';\n if (showEmpty.value) return t.value.noResults;\n return suggestions.length > 0 ? t.value.results(suggestions.length) : '';\n});\n\n// Une liste renouvelée sous un curseur immobile ferait valider une autre adresse que\n// celle qui était surlignée. `deep: 1` parce qu'un consommateur qui pousse dans le\n// tableau au lieu de le réassigner ne change pas sa référence.\nwatch(\n () => suggestions,\n () => {\n activeIndex.value = -1;\n },\n { deep: 1 },\n);\n\n// `aria-activedescendant` ne déplace jamais le focus DOM : sans ce défilement, la\n// flèche bas surligne hors de l'écran dès la cinquième adresse. `block: 'nearest'`\n// ne bouge rien tant que l'option est visible, donc la page ne saute pas.\nwatch(activeIndex, async (index) => {\n if (index < 0) return;\n await nextTick();\n\n const option = root.value?.querySelectorAll<HTMLElement>('[role=\"option\"]')[index];\n\n // jsdom n'implémente pas `scrollIntoView` : l'appel optionnel évite de faire\n // échouer les tests unitaires sur une fonction de confort visuel.\n option?.scrollIntoView?.({ block: 'nearest' });\n});\n\nfunction close(): void {\n open.value = false;\n activeIndex.value = -1;\n}\n\nfunction onInput(value: string): void {\n emit('update:modelValue', value);\n activeIndex.value = -1;\n open.value = true;\n\n if (value.trim().length >= minQueryLength) emit('search', value);\n}\n\nfunction onFocus(event: FocusEvent): void {\n open.value = true;\n emit('focus', event);\n}\n\n// `relatedTarget` plutôt que `document.activeElement` : l'information est portée par\n// l'événement, donc rien à interroger, et le composant reste sans accès au document.\nfunction onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (next && root.value?.contains(next)) return;\n close();\n}\n\nfunction selectAt(index: number): void {\n const option = options.value[index];\n if (!option) return;\n\n close();\n\n if (option.kind === 'geolocate') {\n emit('geolocate');\n return;\n }\n\n emit('update:modelValue', option.suggestion.label);\n emit('select', option.suggestion);\n}\n\nfunction move(step: number): void {\n const total = options.value.length;\n if (total === 0) return;\n\n open.value = true;\n activeIndex.value = (activeIndex.value + step + total) % total;\n}\n\nfunction onKeydown(event: KeyboardEvent): void {\n switch (event.key) {\n // `Alt` déplie et replie sans surligner, comme le veut le motif : c'est le geste\n // de celui qui veut VOIR la liste, pas en parcourir les options.\n case 'ArrowDown':\n event.preventDefault();\n if (event.altKey) open.value = true;\n else move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (event.altKey) close();\n else move(-1);\n break;\n case 'Enter':\n // Sans option surlignée, la touche part au formulaire : la soumission ne doit\n // pas être avalée par un champ qui n'a rien à valider.\n if (!expanded.value || activeIndex.value < 0) return;\n event.preventDefault();\n selectAt(activeIndex.value);\n break;\n case 'Escape':\n if (!panelVisible.value) return;\n event.preventDefault();\n close();\n break;\n case 'Tab':\n close();\n break;\n }\n}\n\nfunction onClear(): void {\n emit('update:modelValue', '');\n emit('clear');\n close();\n\n // Le bouton disparaît avec la valeur qu'il efface : sans cette reprise, le focus\n // retomberait sur le `<body>` et la navigation au clavier recommencerait en haut\n // de page (SC 2.4.3). Requête sur la racine du composant, jamais sur `document`.\n root.value?.querySelector('input')?.focus();\n}\n\n/**\n * Découpe un libellé en mots, en marquant ceux que la saisie contient déjà.\n *\n * La source construisait la même mise en valeur en HTML puis l'injectait par\n * `v-html`, sur une chaîne venue du géocodeur : une réponse d'API hostile ou\n * simplement mal échappée s'exécutait dans la page. Ici, Vue rend du texte.\n */\nfunction normalise(mot: string): string {\n return mot\n .toLowerCase()\n .replace(/[\\s,]+/g, ' ')\n .trim();\n}\n\n// Hors de `segments`, qui est appelée une fois par proposition et à chaque rendu : le\n// jeu des mots saisis est le même pour toutes.\nconst motsSaisis = computed(() => new Set(normalise(modelValue).split(' ').filter(Boolean)));\n\nfunction segments(label: string): { key: number; text: string; match: boolean }[] {\n return label.split(/(\\s+)/).map((text, key) => ({\n key,\n text,\n match: text.trim().length > 0 && motsSaisis.value.has(normalise(text)),\n }));\n}\n</script>\n\n<template>\n <div ref=\"root\" v-bind=\"rootAttrs\" class=\"sq-address-autocomplete\" @focusout=\"onFocusOut\">\n <SqInput\n autocomplete=\"off\"\n v-bind=\"inputAttrs\"\n :icons=\"icons\"\n :model-value=\"modelValue\"\n :label=\"label\"\n :label-hidden=\"labelHidden\"\n :is-optional=\"isOptional\"\n :texts=\"{ optional: t.optional }\"\n :helper-text=\"helperText\"\n :error-text=\"errorText\"\n :placeholder=\"placeholder\"\n :is-disabled=\"isDisabled\"\n :is-readonly=\"isReadonly\"\n :is-required=\"isRequired\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n :aria-expanded=\"expanded ? 'true' : 'false'\"\n :aria-controls=\"expanded ? listboxId : undefined\"\n :aria-activedescendant=\"activeId\"\n :aria-busy=\"busy ? 'true' : undefined\"\n @update:model-value=\"onInput\"\n @keydown=\"onKeydown\"\n @focus=\"onFocus\"\n @blur=\"emit('blur', $event)\"\n @mousedown=\"open = true\"\n >\n <template v-if=\"$slots.icon\" #icon><slot name=\"icon\" /></template>\n\n <template v-if=\"busy || showClear\" #iconRight>\n <!--\n Icônes structurelles inlinées, et non extraites en composant : un module\n JS et une feuille CSS de plus, chargés par chaque page qui importe le\n champ pour des états qu'elle ne rend presque jamais (même arbitrage qu'au\n lot 7 sur le spinner du bouton).\n -->\n <component\n :is=\"sqIcons['regular-spinner']\"\n v-if=\"busy && sqIcons['regular-spinner']\"\n class=\"sq-spinner-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else-if=\"busy\"\n class=\"sq-spinner-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"9\"\n stroke=\"currentColor\"\n stroke-opacity=\"0.25\"\n stroke-width=\"3\"\n />\n <path\n d=\"M21 12a9 9 0 0 0-9-9\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n />\n </svg>\n\n <button\n v-else\n type=\"button\"\n class=\"sq-address-autocomplete__clear\"\n :aria-label=\"t.clear\"\n @click=\"onClear\"\n >\n <component\n :is=\"sqIcons['regular-xmark']\"\n v-if=\"sqIcons['regular-xmark']\"\n class=\"sq-address-autocomplete__clear-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else\n class=\"sq-address-autocomplete__clear-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"m6 6 12 12M18 6 6 18\" />\n </svg>\n </button>\n </template>\n </SqInput>\n\n <!-- Sur le PANNEAU et pas seulement sur les options : son rembourrage et sa barre de\n défilement retireraient sinon le focus du champ, refermant la liste sous le curseur. -->\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <div\n v-if=\"panelVisible\"\n class=\"sq-address-autocomplete__panel\"\n :class=\"`sq-address-autocomplete__panel--${placement}`\"\n @mousedown.prevent\n >\n <ul\n v-if=\"options.length\"\n :id=\"listboxId\"\n role=\"listbox\"\n :aria-label=\"t.listLabel\"\n class=\"sq-address-autocomplete__list\"\n >\n <!-- Aucune option n'est focusable, et c'est le motif combobox : le focus reste au\n champ, `aria-activedescendant` désigne l'option courante. -->\n <!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->\n <li\n v-for=\"(option, index) in options\"\n :id=\"optionId(index)\"\n :key=\"option.key\"\n role=\"option\"\n :aria-selected=\"index === activeIndex\"\n class=\"sq-address-autocomplete__option\"\n :class=\"{ 'sq-address-autocomplete__option--active': index === activeIndex }\"\n @mousedown=\"selectAt(index)\"\n >\n <component\n :is=\"\n sqIcons[option.kind === 'geolocate' ? 'regular-crosshairs' : 'regular-location-dot']\n \"\n v-if=\"\n sqIcons[option.kind === 'geolocate' ? 'regular-crosshairs' : 'regular-location-dot']\n \"\n class=\"sq-address-autocomplete__option-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else\n class=\"sq-address-autocomplete__option-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <template v-if=\"option.kind === 'geolocate'\">\n <circle cx=\"12\" cy=\"12\" r=\"6.5\" />\n <path d=\"M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3\" />\n </template>\n <template v-else>\n <path d=\"M12 21.2c3.6-4.4 7-8 7-11.7a7 7 0 1 0-14 0c0 3.7 3.4 7.3 7 11.7Z\" />\n <circle cx=\"12\" cy=\"9.3\" r=\"2.5\" />\n </template>\n </svg>\n\n <span class=\"sq-address-autocomplete__option-label\">\n <template v-if=\"option.kind === 'geolocate'\">{{ t.geolocate }}</template>\n <!-- Un `<span>` par mot, et non une chaîne HTML injectée : la mise en valeur\n est du rendu Vue, donc le libellé du géocodeur reste du texte. -->\n <template v-else>\n <span\n v-for=\"segment in segments(option.suggestion.label)\"\n :key=\"segment.key\"\n :class=\"{ 'sq-address-autocomplete__match': segment.match }\"\n >{{ segment.text }}</span\n >\n </template>\n </span>\n </li>\n </ul>\n\n <!--\n Hors de la liste : ce n'est pas une option, et un `role=\"option\"` non\n sélectionnable ferait compter une proposition de plus à un lecteur d'écran.\n -->\n <p v-if=\"showEmpty\" class=\"sq-address-autocomplete__empty\">\n <component\n :is=\"sqIcons['regular-circle-exclamation']\"\n v-if=\"sqIcons['regular-circle-exclamation']\"\n class=\"sq-address-autocomplete__option-icon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n />\n <svg\n v-else\n class=\"sq-address-autocomplete__option-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"9.2\" />\n <path d=\"M12 7.5v5.5\" />\n <path d=\"M12 16.5h.01\" stroke-width=\"2.5\" />\n </svg>\n {{ t.noResults }}\n </p>\n </div>\n\n <p class=\"sq-address-autocomplete__sr-only\" role=\"status\">{{ announcement }}</p>\n </div>\n</template>\n"],"mappings":""}
@@ -49,6 +49,12 @@
49
49
  outline: 2px solid var(--sq-button-focus-ring);
50
50
  outline-offset: 2px;
51
51
  }
52
+ .sq-button--xsmall {
53
+ height: 1.5rem;
54
+ padding-inline: 0.5rem;
55
+ font-size: 0.875rem;
56
+ gap: 0.25rem;
57
+ }
52
58
  .sq-button--small {
53
59
  height: 2rem;
54
60
  padding-inline: 1rem;
@@ -161,6 +167,14 @@
161
167
  height: 1em;
162
168
  width: auto;
163
169
  }
170
+ :where(.sq-button--small) .sq-button__content > svg {
171
+ height: 0.9285714286em;
172
+ }
173
+
174
+ :where(.sq-button--large.sq-button--icon-only) .sq-button__content > svg {
175
+ height: 1.25em;
176
+ }
177
+
164
178
  .sq-button--loading .sq-button__content {
165
179
  opacity: 0;
166
180
  }
@@ -15,11 +15,12 @@ export interface SqButtonTexts {
15
15
  */
16
16
  export type SqButtonVariant = 'solid' | 'line' | 'light' | 'glass';
17
17
  /**
18
- * Hauteur : 32, 40 ou 48 pixels.
18
+ * Hauteur : 24, 32, 40 ou 48 pixels.
19
19
  *
20
- * Il n'y en a que trois. Le `xsmall` (24 px) de la SPA n'est pas repris.
20
+ * `xsmall` est au plancher du SC 2.5.8 (cible de 24 × 24 px) : ne pas le réduire
21
+ * davantage, ni le placer contre une autre cible sans espacement.
21
22
  */
22
- export type SqButtonSize = 'small' | 'medium' | 'large';
23
+ export type SqButtonSize = 'xsmall' | 'small' | 'medium' | 'large';
23
24
  /**
24
25
  * Teinte. Chaque valeur ne fait que redéfinir les custom properties `--sq-button-*`
25
26
  * du bloc ; la variante décide de la façon dont elles sont utilisées.
@@ -37,7 +38,23 @@ export type SqButtonSize = 'small' | 'medium' | 'large';
37
38
  * page : ce fond-là n'est pas connu du design system, et son contraste reste à la
38
39
  * charge du consommateur. Voir `docs/CONSUMERS.md`.
39
40
  */
40
- export type SqButtonTheme = 'neutral' | 'green' | 'pink-70' | 'blue' | 'gold' | 'yellow' | 'orange' | 'red' | 'grape' | 'forest' | 'white' | 'royal' | 'positive' | 'negative' | 'critical';
41
+ export type SqButtonBuiltinTheme = 'neutral' | 'green' | 'pink-70' | 'blue' | 'gold' | 'yellow' | 'orange' | 'red' | 'grape' | 'forest' | 'white' | 'royal' | 'positive' | 'negative' | 'critical';
42
+ /**
43
+ * Thèmes définis par l'application, à déclarer par augmentation de module. Leurs
44
+ * couleurs viennent de `sq.button-themes-from(…)`, et leur contraste n'est vérifié
45
+ * par aucun test du design system. Voir `docs/CONSUMERS.md`.
46
+ *
47
+ * ```ts
48
+ * declare module '@allovoisins/sequoia' {
49
+ * interface SqButtonCustomThemes {
50
+ * 'orange-premier': true;
51
+ * }
52
+ * }
53
+ * ```
54
+ */
55
+ export interface SqButtonCustomThemes {
56
+ }
57
+ export type SqButtonTheme = SqButtonBuiltinTheme | keyof SqButtonCustomThemes;
41
58
  /** Comportement du `<button>` natif. Ignoré lorsque `href` est fourni. */
42
59
  export type SqButtonType = 'button' | 'submit' | 'reset';
43
60
  export interface SqButtonProps {
@@ -48,9 +65,12 @@ export interface SqButtonProps {
48
65
  /**
49
66
  * @default 'neutral'
50
67
  *
51
- * Pour une teinte hors de cette liste — une couleur de marque tierce, par exemple —
52
- * ne pas attendre un nouveau thème : surcharger `--sq-button-base` sur l'instance
53
- * ou sur un conteneur suffit. Voir `docs/CONSUMERS.md`.
68
+ * Pour une teinte ponctuelle hors de cette liste, surcharger `--sq-button-base`
69
+ * avec `.sq-button.ma-classe` ou `.zone .sq-button`. Posée sur un conteneur seul,
70
+ * ou avec une classe seule, la surcharge est ignorée sans rien signaler.
71
+ *
72
+ * Pour une famille de thèmes propres à l'application : `SqButtonCustomThemes`.
73
+ * Voir `docs/CONSUMERS.md`.
54
74
  */
55
75
  theme?: SqButtonTheme;
56
76
  /** Rend un `<a>` au lieu d'un `<button>` ; une chaîne vide vaut absence. Pas de
@@ -73,13 +93,13 @@ export interface SqButtonProps {
73
93
  * pas — le composant retire alors `href`, pose `aria-disabled` et neutralise le
74
94
  * clic.
75
95
  */
76
- disabled?: boolean;
96
+ isDisabled?: boolean;
77
97
  /**
78
98
  * Affiche un spinner et neutralise l'interaction, sans retirer l'élément de
79
99
  * l'ordre de tabulation : l'utilisateur doit pouvoir constater l'état de ce qu'il
80
100
  * vient d'activer.
81
101
  */
82
- loading?: boolean;
102
+ isLoading?: boolean;
83
103
  /** Libellés, fusionnés aux défauts français clé à clé. */
84
104
  texts?: Partial<SqButtonTexts>;
85
105
  /** Icônes structurelles, fusionnées par-dessus `provideSqIcons`. Clé absente : glyphe embarqué. */
@@ -1 +1 @@
1
- {"version":3,"file":"SqButton.types.d.ts","sourceRoot":"","sources":["../../../src/components/SqButton/SqButton.types.ts"],"names":[],"mappings":"AAAA;iFACiF;AACjF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAE5D;iFACiF;AACjF,MAAM,WAAW,aAAa;IAC5B;iDAC6C;IAC7C,OAAO,EAAE,MAAM,CAAC;CACj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