@cnamts/synapse 1.1.0 → 1.1.1

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 (202) hide show
  1. package/dist/{AutocompleteFilter-DXd4szWO.js → AutocompleteFilter-CGF33skz.js} +1 -1
  2. package/dist/{DateFilter-BD59Kgwf.js → DateFilter-D7-MsKtx.js} +1 -1
  3. package/dist/{NumberFilter-BSMZE7uw.js → NumberFilter-bjQPPfsj.js} +1 -1
  4. package/dist/{PeriodFilter-keUdSSk0.js → PeriodFilter-B3wJpK8-.js} +1 -1
  5. package/dist/{SelectFilter-Dhvvwazl.js → SelectFilter-BN6DbKAV.js} +1 -1
  6. package/dist/{TextFilter-CU8FpXz0.js → TextFilter-BffP0J2f.js} +1 -1
  7. package/dist/{apLightTheme2026-DbS7BPUf.js → apLightTheme2026-C4ygwMHC.js} +11 -11
  8. package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +6 -6
  9. package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +6 -6
  10. package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +6 -6
  11. package/dist/components/Captcha/Captcha.d.ts +27 -16
  12. package/dist/components/Captcha/CaptchaForm.d.ts +29 -3
  13. package/dist/components/Captcha/types.d.ts +14 -0
  14. package/dist/components/Captcha/useCaptchaValidation.d.ts +37 -0
  15. package/dist/components/Customs/Selects/SelectBtnField/SelectBtnField.d.ts +33 -13
  16. package/dist/components/Customs/Selects/SelectBtnField/composables/useSelectBtnFieldValidation.d.ts +23 -0
  17. package/dist/components/Customs/Selects/SyAutocomplete/composables/useSyAutocompleteValidation.d.ts +2 -2
  18. package/dist/components/Customs/Selects/SySelect/composables/useSySelectValidation.d.ts +2 -2
  19. package/dist/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.d.ts +17 -48
  20. package/dist/components/Customs/SyCheckBoxGroup/composables/useSyCheckBoxGroupValidation.d.ts +29 -0
  21. package/dist/components/Customs/SyCheckBoxGroup/types.d.ts +46 -0
  22. package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +16 -51
  23. package/dist/components/Customs/SyCheckbox/composables/useSyCheckboxValidation.d.ts +27 -0
  24. package/dist/components/Customs/SyCheckbox/types.d.ts +49 -0
  25. package/dist/components/Customs/SyTextField/FieldState.d.ts +5 -0
  26. package/dist/components/Customs/SyTextField/useSyTextFieldValidation.d.ts +3 -3
  27. package/dist/components/DialogBox/DialogBox.d.ts +2 -0
  28. package/dist/components/DialogBox/locales.d.ts +1 -0
  29. package/dist/components/FilterSideBar/FilterSideBar.d.ts +4 -0
  30. package/dist/components/LunarCalendar/LunarCalendar.d.ts +43 -14
  31. package/dist/components/LunarCalendar/types.d.ts +35 -0
  32. package/dist/components/LunarCalendar/useLunarCalendarValidation.d.ts +11 -12
  33. package/dist/components/MonthPicker/MonthPicker.d.ts +72 -1747
  34. package/dist/components/MonthPicker/MonthPickerText/MonthPickerInput.d.ts +21 -1733
  35. package/dist/components/MonthPicker/MonthPickerText/useTextField.d.ts +5 -0
  36. package/dist/components/MonthPicker/locales.d.ts +1 -0
  37. package/dist/components/MonthPicker/types.d.ts +11 -0
  38. package/dist/components/MonthPicker/useMonthPickerValidation.d.ts +37 -24
  39. package/dist/components/NirField/NirField.d.ts +6 -4
  40. package/dist/components/NirField/useNirValidation.d.ts +7 -5
  41. package/dist/components/PageContainer/PageContainer.d.ts +8 -0
  42. package/dist/components/PasswordField/PasswordField.d.ts +2 -2
  43. package/dist/components/PasswordField/usePasswordFieldValidation.d.ts +2 -2
  44. package/dist/components/PhoneField/PhoneField.d.ts +960 -1938
  45. package/dist/components/PhoneField/indicatifs.d.ts +715 -8
  46. package/dist/components/PhoneField/locales.d.ts +7 -0
  47. package/dist/components/PhoneField/types.d.ts +29 -0
  48. package/dist/components/PhoneField/usePhoneFieldValidation.d.ts +45 -0
  49. package/dist/components/PhoneField/usePhoneIndicatifs.d.ts +947 -0
  50. package/dist/components/SyTextArea/composables/useSyTextAreaValidation.d.ts +2 -2
  51. package/dist/composables/unifyValidation/documentationValidationProps.d.ts +1 -1
  52. package/dist/composables/unifyValidation/useValidation.d.ts +4 -5
  53. package/dist/design-system-v3.js +2 -2
  54. package/dist/designTokens/tokens/amelipro/apLightTheme.d.ts +10 -10
  55. package/dist/designTokens/tokens/baseTokens.d.ts +18 -18
  56. package/dist/designTokens/tokens/cnam/cnamLightTheme.d.ts +10 -10
  57. package/dist/designTokens/tokens/pa/paLightTheme.d.ts +10 -10
  58. package/dist/designTokens/tokens/semanticTokens.d.ts +14 -14
  59. package/dist/{main-D8ryUoS5.js → main-C4wAktOs.js} +13718 -12991
  60. package/dist/synapse.css +1 -1
  61. package/dist/vuetifyConfig.js +1 -1
  62. package/package.json +7 -7
  63. package/src/assets/compat/_legacy-tokens.scss +91 -0
  64. package/src/assets/overrides/_utilities.scss +23 -0
  65. package/src/components/Accordion/Accordion.stories.ts +121 -1
  66. package/src/components/BackBtn/BackBtn.mdx +1 -1
  67. package/src/components/BackToTopBtn/BackToTopBtn.mdx +0 -1
  68. package/src/components/Captcha/Captcha.stories.ts +134 -31
  69. package/src/components/Captcha/Captcha.vue +95 -28
  70. package/src/components/Captcha/CaptchaForm.vue +51 -22
  71. package/src/components/Captcha/tests/Captcha.focus.spec.ts +214 -0
  72. package/src/components/Captcha/tests/Captcha.spec.ts +233 -24
  73. package/src/components/Captcha/tests/CaptchaForm.spec.ts +82 -0
  74. package/src/components/Captcha/tests/__snapshots__/Captcha.spec.ts.snap +16 -42
  75. package/src/components/Captcha/types.ts +15 -0
  76. package/src/components/Captcha/useCaptchaValidation.ts +87 -0
  77. package/src/components/Captcha/validation/validation.stories.ts +1194 -0
  78. package/src/components/ChipList/ChipList.mdx +0 -1
  79. package/src/components/CollapsibleList/CollapsibleList.mdx +0 -1
  80. package/src/components/CookieBanner/CookieBanner.mdx +0 -1
  81. package/src/components/CopyBtn/CopyBtn.mdx +0 -1
  82. package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.stories.ts +123 -439
  83. package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.vue +147 -41
  84. package/src/components/Customs/Selects/SelectBtnField/Validation/Validation.stories.ts +600 -0
  85. package/src/components/Customs/Selects/SelectBtnField/composables/useSelectBtnFieldValidation.ts +87 -0
  86. package/src/components/Customs/Selects/SelectBtnField/tests/SelectBtnField.spec.ts +402 -33
  87. package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/SelectBtnField.spec.ts.snap +52 -38
  88. package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.stories.ts +342 -162
  89. package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.vue +77 -129
  90. package/src/components/Customs/SyCheckBoxGroup/Validation/Validation.stories.ts +1008 -0
  91. package/src/components/Customs/SyCheckBoxGroup/composables/useSyCheckBoxGroupValidation.ts +107 -0
  92. package/src/components/Customs/SyCheckBoxGroup/tests/SyCheckBoxGroup.spec.ts +180 -7
  93. package/src/components/Customs/SyCheckBoxGroup/types.ts +49 -0
  94. package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +41 -161
  95. package/src/components/Customs/SyCheckbox/SyCheckbox.vue +71 -148
  96. package/src/components/Customs/SyCheckbox/Validation/Validation.stories.ts +654 -0
  97. package/src/components/Customs/SyCheckbox/composables/useSyCheckboxValidation.ts +105 -0
  98. package/src/components/Customs/SyCheckbox/tests/SyCheckbox.spec.ts +106 -0
  99. package/src/components/Customs/SyCheckbox/tests/useSyCheckboxValidation.spec.ts +98 -0
  100. package/src/components/Customs/SyCheckbox/types.ts +51 -0
  101. package/src/components/Customs/SyTextField/FieldState.vue +50 -0
  102. package/src/components/Customs/SyTextField/SyTextField.vue +12 -9
  103. package/src/components/Customs/SyTextField/useSyTextFieldValidation.ts +2 -11
  104. package/src/components/DataList/DataList.mdx +0 -1
  105. package/src/components/DataListGroup/DataListGroup.mdx +0 -1
  106. package/src/components/DiacriticPicker/DiacriticPicker.mdx +0 -1
  107. package/src/components/DialogBox/DialogBox.mdx +0 -1
  108. package/src/components/DialogBox/DialogBox.stories.ts +399 -4
  109. package/src/components/DialogBox/DialogBox.vue +20 -0
  110. package/src/components/DialogBox/locales.ts +1 -0
  111. package/src/components/DialogBox/tests/DialogBox.spec.ts +73 -0
  112. package/src/components/DialogBox/tests/DialogBox.visual.cy.ts +24 -0
  113. package/src/components/ErrorPage/ErrorPage.mdx +1 -1
  114. package/src/components/ExternalLinks/ExternalLinks.mdx +0 -1
  115. package/src/components/FileList/FileList.mdx +0 -1
  116. package/src/components/FilterInline/FilterInline.mdx +0 -1
  117. package/src/components/FilterSideBar/FilterSideBar.mdx +8 -1
  118. package/src/components/FilterSideBar/FilterSideBar.stories.ts +133 -1
  119. package/src/components/FilterSideBar/FilterSideBar.vue +19 -2
  120. package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +55 -0
  121. package/src/components/FooterBar/FooterBar.mdx +0 -1
  122. package/src/components/FranceConnectBtn/FranceConnectBtn.mdx +0 -1
  123. package/src/components/HeaderBar/HeaderBar.mdx +0 -1
  124. package/src/components/HeaderLoading/HeaderLoading.mdx +0 -1
  125. package/src/components/LangBtn/LangBtn.mdx +0 -1
  126. package/src/components/Logo/Logo.mdx +1 -1
  127. package/src/components/LunarCalendar/LunarCalendar.mdx +6 -9
  128. package/src/components/LunarCalendar/LunarCalendar.stories.ts +243 -46
  129. package/src/components/LunarCalendar/LunarCalendar.vue +61 -26
  130. package/src/components/LunarCalendar/Validation/Validation.stories.ts +717 -0
  131. package/src/components/LunarCalendar/tests/LunarCalendar.a11y.spec.ts +1 -1
  132. package/src/components/LunarCalendar/tests/LunarCalendar.spec.ts +197 -6
  133. package/src/components/LunarCalendar/tests/useLunarCalendarValidation.spec.ts +287 -0
  134. package/src/components/LunarCalendar/types.ts +39 -0
  135. package/src/components/LunarCalendar/useLunarCalendarValidation.ts +115 -39
  136. package/src/components/MonthPicker/MonthPicker.stories.ts +38 -281
  137. package/src/components/MonthPicker/MonthPicker.vue +66 -17
  138. package/src/components/MonthPicker/MonthPickerText/MonthPickerInput.vue +44 -20
  139. package/src/components/MonthPicker/MonthPickerText/useTextField.ts +5 -0
  140. package/src/components/MonthPicker/Validation/Validation.stories.ts +1117 -0
  141. package/src/components/MonthPicker/locales.ts +1 -0
  142. package/src/components/MonthPicker/tests/MonthPicker.spec.ts +353 -2
  143. package/src/components/MonthPicker/tests/__snapshots__/MonthPicker.spec.ts.snap +12 -8
  144. package/src/components/MonthPicker/types.ts +16 -0
  145. package/src/components/MonthPicker/useMonthPickerValidation.ts +64 -27
  146. package/src/components/NirField/NirField.mdx +120 -66
  147. package/src/components/NirField/NirField.stories.ts +216 -0
  148. package/src/components/NirField/useNirValidation.ts +16 -17
  149. package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +263 -245
  150. package/src/components/NotificationBar/NotificationBar.mdx +0 -1
  151. package/src/components/PageContainer/PageContainer.mdx +0 -1
  152. package/src/components/PageContainer/PageContainer.stories.ts +170 -2
  153. package/src/components/PageContainer/PageContainer.vue +63 -8
  154. package/src/components/PageContainer/tests/__snapshots__/PageContainer.spec.ts.snap +19 -11
  155. package/src/components/PaginatedTable/PaginatedTable.mdx +0 -1
  156. package/src/components/PeriodField/PeriodField.mdx +0 -1
  157. package/src/components/PhoneField/PhoneField.mdx +2 -3
  158. package/src/components/PhoneField/PhoneField.stories.ts +227 -410
  159. package/src/components/PhoneField/PhoneField.vue +204 -438
  160. package/src/components/PhoneField/indicatifs.ts +1 -1
  161. package/src/components/PhoneField/locales.ts +7 -0
  162. package/src/components/PhoneField/tests/PhoneField.a11y.spec.ts +0 -1
  163. package/src/components/PhoneField/tests/PhoneField.spec.ts +517 -220
  164. package/src/components/PhoneField/types.ts +30 -0
  165. package/src/components/PhoneField/usePhoneFieldValidation.ts +119 -0
  166. package/src/components/PhoneField/usePhoneIndicatifs.ts +89 -0
  167. package/src/components/PhoneField/validation/validation.stories.ts +717 -0
  168. package/src/components/RangeField/RangeField.mdx +0 -1
  169. package/src/components/RatingPicker/RatingPicker.mdx +0 -1
  170. package/src/components/SocialMediaLinks/SocialMediaLinks.mdx +0 -1
  171. package/src/components/StatusPage/StatusPage.vue +1 -0
  172. package/src/components/StatusPage/tests/__snapshots__/StatusPage.spec.ts.snap +248 -230
  173. package/src/components/SubHeader/SubHeader.mdx +5 -6
  174. package/src/components/Tables/common/tests/SyTableFilter.spec.ts +11 -12
  175. package/src/components/UploadWorkflow/UploadWorkflow.mdx +0 -1
  176. package/src/components/UserMenuBtn/UserMenuBtn.mdx +0 -1
  177. package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +177 -0
  178. package/src/composables/unifyValidation/documentationValidationProps.ts +1 -1
  179. package/src/composables/unifyValidation/tests/useValidation.spec.ts +13 -1
  180. package/src/composables/unifyValidation/useValidation.ts +37 -33
  181. package/src/composantsVuetify/VCard/VCard.mdx +4 -0
  182. package/src/composantsVuetify/VCard/v-card.stories.ts +93 -1
  183. package/src/composantsVuetify/VCarousel/VCarousel.mdx +74 -0
  184. package/src/composantsVuetify/VCarousel/v-carousel.stories.ts +531 -0
  185. package/src/composantsVuetify/VNavigationDrawer/VNavgationDrawer.mdx +53 -0
  186. package/src/composantsVuetify/VNavigationDrawer/v-navigation-drawer.stories.ts +310 -0
  187. package/src/composantsVuetify/VSlideGroup/VSlideGroup.mdx +105 -0
  188. package/src/composantsVuetify/VSlideGroup/v-slide-group.stories.ts +463 -0
  189. package/src/designTokens/tokens/baseColors.ts +1 -1
  190. package/src/designTokens/tokens/baseTokens.ts +18 -18
  191. package/src/stories/Components/Components.stories.ts +34 -1
  192. package/src/stories/Demarrer/Releases.stories.ts +16 -2
  193. package/src/stories/DesignTokens/Arrondis.mdx +1 -1
  194. package/src/stories/DesignTokens/Correspondances.mdx +219 -0
  195. package/src/stories/DesignTokens/UtiliserLesTokens.mdx +235 -0
  196. package/src/stories/DesignTokens/colors.stories.ts +569 -569
  197. package/src/stories/GuideDuDev/Amelipro.stories.ts +335 -267
  198. package/dist/components/LunarCalendar/useLunarCalendarRules.d.ts +0 -5
  199. package/dist/components/PhoneField/tests/types.d.ts +0 -18
  200. package/src/components/LunarCalendar/tests/useLunarCalendarRules.spec.ts +0 -184
  201. package/src/components/LunarCalendar/useLunarCalendarRules.ts +0 -96
  202. package/src/components/PhoneField/tests/types.d.ts +0 -19
@@ -1,8 +1,9 @@
1
1
  <script lang="ts" setup>
2
2
  import SyIcon from '@/components/Customs/SyIcon/SyIcon.vue'
3
3
  import { mdiCheck } from '@mdi/js'
4
- import { computed, onMounted, ref, watch } from 'vue'
5
- import { useTheme } from 'vuetify'
4
+ import { computed, ref, watch } from 'vue'
5
+ import { validationPropsDefaults, type FieldValidationProps } from '@/composables/unifyValidation/useValidation'
6
+ import { useSelectBtnFieldValidation } from './composables/useSelectBtnFieldValidation'
6
7
  import type { SelectBtnItem, SelectBtnValue } from './types'
7
8
 
8
9
  const props = withDefaults(defineProps<{
@@ -12,39 +13,51 @@
12
13
  ariaLabelledby?: string | undefined
13
14
  multiple?: boolean
14
15
  inline?: boolean
15
- hint?: string
16
- error?: boolean
17
- errorMessages?: string[]
18
- readonly?: boolean
19
- }>(), {
16
+ helpText?: string
17
+ hideDetails?: boolean
18
+ } & FieldValidationProps>(), {
20
19
  modelValue: null,
21
20
  items: () => [],
22
21
  label: undefined,
23
22
  ariaLabelledby: undefined,
24
23
  multiple: false,
25
24
  inline: false,
26
- hint: undefined,
27
- error: false,
28
- errorMessages: undefined,
29
- readonly: false,
25
+ helpText: undefined,
26
+ hideDetails: false,
27
+ ...validationPropsDefaults,
28
+ isValidateOnBlur: false, // La validation se déclenche immédiatement à la sélection
30
29
  })
31
30
 
32
31
  const emits = defineEmits<{
33
32
  (e: 'update:modelValue', value: SelectBtnValue): void
34
- (e: 'update:error', value: boolean): void
35
- (e: 'update:error-messages', value: string[] | undefined): void
36
33
  }>()
37
34
 
38
35
  const internalValue = ref<SelectBtnValue>(props.multiple ? [] : null)
39
- const darktheme = ref<boolean>(false)
40
36
  const listRef = ref<HTMLElement | null>(null)
41
37
  const optionsRef = ref<Array<HTMLElement>>([])
42
38
 
43
- onMounted(() => {
44
- const theme = useTheme().current
45
- if (theme && theme.value) {
46
- darktheme.value = theme.value.dark
47
- }
39
+ const {
40
+ focused,
41
+ validate,
42
+ clearValidation,
43
+ errors,
44
+ warnings,
45
+ successes,
46
+ hasError,
47
+ hasWarning,
48
+ hasSuccess,
49
+ } = useSelectBtnFieldValidation(props)
50
+
51
+ defineExpose({
52
+ validateOnSubmit: validate,
53
+ validate,
54
+ clearValidation,
55
+ errors,
56
+ warnings,
57
+ successes,
58
+ hasError,
59
+ hasWarning,
60
+ hasSuccess,
48
61
  })
49
62
 
50
63
  watch(() => props.modelValue, (value) => {
@@ -58,6 +71,23 @@
58
71
  immediate: true,
59
72
  deep: true,
60
73
  })
74
+
75
+ const messages = computed<string[]>(() => {
76
+ if (hasError.value) return errors.value
77
+ if (hasWarning.value) return warnings.value
78
+ if (hasSuccess.value && props.showSuccessMessages) return successes.value
79
+ return []
80
+ })
81
+
82
+ const messageClass = computed(() => {
83
+ if (hasError.value) return 'select-btn-field__message--error'
84
+ if (hasWarning.value) return 'select-btn-field__message--warning'
85
+ if (hasSuccess.value) return 'select-btn-field__message--success'
86
+ return ''
87
+ })
88
+
89
+ const showHelpText = computed(() => !!props.helpText && messages.value.length === 0)
90
+
61
91
  const filteredItems = computed(() => props.items.filter((item) => {
62
92
  return item.value !== null && item.value !== undefined
63
93
  }))
@@ -118,13 +148,11 @@
118
148
  }
119
149
 
120
150
  function toggleItem(item: SelectBtnItem): void {
121
- if (props.readonly) {
151
+ if (props.readonly || props.disabled) {
122
152
  return
123
153
  }
124
154
 
125
155
  internalValue.value = getNewValue(item)
126
- emits('update:error', false)
127
- emits('update:error-messages', undefined)
128
156
  emits('update:modelValue', internalValue.value)
129
157
  }
130
158
 
@@ -192,10 +220,17 @@
192
220
  optionsRef.value[optionsRef.value.length - 1]?.focus()
193
221
  }
194
222
 
223
+ function handleFocusIn(): void {
224
+ focused.value = true
225
+ }
226
+
195
227
  function handleBlur(): void {
196
228
  if ((!listRef.value?.contains(document.activeElement) || !(listRef.value === document.activeElement))) {
197
229
  focusedIndex.value = -1
198
230
  }
231
+ if (!listRef.value?.contains(document.activeElement)) {
232
+ focused.value = false
233
+ }
199
234
  }
200
235
 
201
236
  function handleInitFocus(e: FocusEvent): void {
@@ -237,17 +272,23 @@
237
272
  :class="{
238
273
  'select-btn-field__options--inline': props.inline,
239
274
  'select-btn-field__options--column': !props.inline,
240
- 'select-btn-field__options--error': error,
275
+ 'select-btn-field__options--error': hasError,
276
+ 'select-btn-field__options--warning': hasWarning && !hasError,
277
+ 'select-btn-field__options--success': hasSuccess && !hasError && !hasWarning,
241
278
  'select-btn-field__options--readonly': readonly,
279
+ 'select-btn-field__options--disabled': disabled,
242
280
  }"
243
281
  :aria-label="props.label"
244
282
  :aria-labelledby="props.ariaLabelledby ?? undefined"
245
283
  role="listbox"
246
284
  :aria-orientation="props.inline ? 'horizontal' : 'vertical'"
247
285
  :aria-multiselectable="props.multiple ? 'true' : 'false'"
248
- :aria-invalid="error ? 'true' : 'false'"
286
+ :aria-invalid="hasError ? 'true' : 'false'"
287
+ :aria-required="props.required ? 'true' : undefined"
249
288
  :aria-readonly="readonly ? 'true' : 'false'"
289
+ :aria-disabled="disabled ? 'true' : undefined"
250
290
  :tabindex="focusedIndex === -1 ? '0' : '-1'"
291
+ @focusin="handleFocusIn"
251
292
  @focusout="handleBlur"
252
293
  @keydown.left.prevent="focusPrevious"
253
294
  @keydown.right.prevent="focusNext"
@@ -260,7 +301,7 @@
260
301
  v-for="(item, index) in filteredItems"
261
302
  :key="`select-btn-field-item-${index}`"
262
303
  ref="optionsRef"
263
- v-ripple="!props.readonly"
304
+ v-ripple="!props.readonly && !props.disabled"
264
305
  class="select-btn-field__item"
265
306
  :class="{
266
307
  'select-btn-field__item--selected': isSelected(item.value),
@@ -288,24 +329,29 @@
288
329
  </div>
289
330
  </li>
290
331
  </ul>
291
- <template v-if="errorMessages">
332
+
333
+ <div
334
+ v-if="!props.hideDetails && (messages.length > 0 || showHelpText)"
335
+ class="select-btn-field__messages px-3 mt-2"
336
+ >
337
+ <template v-if="messages.length > 0">
338
+ <p
339
+ v-for="(message, index) in messages"
340
+ :key="`select-btn-field-message-${index}`"
341
+ class="select-btn-field__message v-messages mb-0 opacity-100"
342
+ :class="messageClass"
343
+ >
344
+ {{ message }}
345
+ </p>
346
+ </template>
347
+
292
348
  <p
293
- v-for="(errorMessage, index) in errorMessages"
294
- :key="index"
295
- :class="darktheme ? 'theme--dark' : 'theme--light'"
296
- class="v-messages text-error px-3 mt-2 mb-0 opacity-100"
349
+ v-else-if="showHelpText"
350
+ class="select-btn-field__help-text mb-0"
297
351
  >
298
- {{ errorMessage }}
352
+ {{ props.helpText }}
299
353
  </p>
300
- </template>
301
-
302
- <p
303
- v-else-if="hint"
304
- :class="darktheme ? 'theme--dark' : 'theme--light'"
305
- class="v-messages px-3 mt-2 mb-0 opacity-100"
306
- >
307
- {{ hint }}
308
- </p>
354
+ </div>
309
355
  </div>
310
356
  </template>
311
357
 
@@ -377,8 +423,68 @@
377
423
  gap: 4px;
378
424
  }
379
425
 
380
- .select-btn-field__options--error .select-btn-field__item {
426
+ // États de validation :
427
+ // - item non sélectionné : contour + texte à la couleur de l'état ;
428
+ // - item sélectionné : fond rempli de la couleur de l'état, texte et icône en blanc.
429
+ .select-btn-field__options--error .select-btn-field__item:not(.select-btn-field__item--selected) {
381
430
  color: rgb(var(--v-theme-error));
382
431
  border-color: rgb(var(--v-theme-error));
383
432
  }
433
+
434
+ .select-btn-field__options--error .select-btn-field__item--selected {
435
+ background-color: rgb(var(--v-theme-error));
436
+ border-color: rgb(var(--v-theme-error));
437
+ color: rgb(var(--v-theme-onPrimary));
438
+ }
439
+
440
+ .select-btn-field__options--warning .select-btn-field__item:not(.select-btn-field__item--selected) {
441
+ color: rgb(var(--v-theme-onWarningVariant));
442
+ border-color: rgb(var(--v-theme-onWarningVariant));
443
+ }
444
+
445
+ .select-btn-field__options--warning .select-btn-field__item--selected {
446
+ background-color: rgb(var(--v-theme-onWarningVariant));
447
+ border-color: rgb(var(--v-theme-onWarningVariant));
448
+ color: rgb(var(--v-theme-onPrimary));
449
+ }
450
+
451
+ .select-btn-field__options--success .select-btn-field__item:not(.select-btn-field__item--selected) {
452
+ color: rgb(var(--v-theme-onSuccessVariant));
453
+ border-color: rgb(var(--v-theme-onSuccessVariant));
454
+ }
455
+
456
+ .select-btn-field__options--success .select-btn-field__item--selected {
457
+ background-color: rgb(var(--v-theme-onSuccessVariant));
458
+ border-color: rgb(var(--v-theme-onSuccessVariant));
459
+ color: rgb(var(--v-theme-onPrimary));
460
+ }
461
+
462
+ .select-btn-field__options--disabled {
463
+ opacity: var(--v-disabled-opacity, 0.38);
464
+ pointer-events: none;
465
+ }
466
+
467
+ .select-btn-field__messages {
468
+ display: flex;
469
+ flex-direction: column;
470
+ gap: 4px;
471
+ }
472
+
473
+ .select-btn-field__message--error {
474
+ color: rgb(var(--v-theme-error));
475
+ }
476
+
477
+ .select-btn-field__message--warning {
478
+ color: rgb(var(--v-theme-onWarningVariant));
479
+ }
480
+
481
+ .select-btn-field__message--success {
482
+ color: rgb(var(--v-theme-onSuccessVariant));
483
+ }
484
+
485
+ .select-btn-field__help-text {
486
+ color: rgba(var(--v-theme-onSurface), var(--v-medium-emphasis-opacity));
487
+ font-size: var(--v-fontSize-liensEtLibelles);
488
+ line-height: 1.2;
489
+ }
384
490
  </style>