@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,10 +1,21 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import { ref, watch } from 'vue'
2
3
  import LunarCalendar from './LunarCalendar.vue'
4
+ import { getValidationDocumentation } from '@/composables/unifyValidation/documentationValidationProps'
3
5
 
4
6
  const meta = {
5
7
  title: 'Composants/Formulaires/LunarCalendar',
6
8
  component: LunarCalendar,
9
+ decorators: [
10
+ () => ({
11
+ template: '<div style="padding: 20px;"><story/></div>',
12
+ }),
13
+ ],
14
+ parameters: {
15
+ layout: 'fullscreen',
16
+ },
7
17
  argTypes: {
18
+ ...getValidationDocumentation('date'),
8
19
  modelValue: {
9
20
  description: 'La valeur du calendrier lunaire au format DD/MM/YYYY',
10
21
  control: { type: 'text' },
@@ -13,10 +24,6 @@ const meta = {
13
24
  category: 'props',
14
25
  },
15
26
  },
16
- successMessages: {
17
- description: 'Messages de succès à afficher sous le champ',
18
- control: { type: 'text' },
19
- },
20
27
  minYear: {
21
28
  description: 'Année minimale autorisée',
22
29
  control: { type: 'number' },
@@ -25,10 +32,6 @@ const meta = {
25
32
  description: 'Année maximale autorisée',
26
33
  control: { type: 'number' },
27
34
  },
28
- required: {
29
- description: 'Indique si le champ est requis',
30
- control: { type: 'boolean' },
31
- },
32
35
  placeholder: {
33
36
  description: 'Texte affiché lorsque le champ est vide',
34
37
  control: { type: 'text' },
@@ -45,10 +48,58 @@ const meta = {
45
48
  description: 'Affiche une icône à la fin du champ',
46
49
  control: { type: 'boolean' },
47
50
  },
51
+ // Nouvelles props iso SyTextField
52
+ helpText: {
53
+ description: 'Texte d\'aide affiché sous le champ',
54
+ control: { type: 'text' },
55
+ },
56
+ noIcon: {
57
+ description: 'Désactive les icônes du champ',
58
+ control: { type: 'boolean' },
59
+ },
60
+ displayAsterisk: {
61
+ description: 'Affiche l\'astérisque pour les champs requis',
62
+ control: { type: 'boolean' },
63
+ },
64
+ variantStyle: {
65
+ description: 'Style visuel du champ',
66
+ control: { type: 'select' },
67
+ options: ['outlined', 'plain', 'underlined', 'filled', 'solo', 'solo-inverted', 'solo-filled'],
68
+ },
69
+ color: {
70
+ description: 'Couleur du champ',
71
+ control: { type: 'select' },
72
+ options: ['primary', 'secondary', 'success', 'info', 'warning', 'error'],
73
+ },
74
+ density: {
75
+ description: 'Densité du champ',
76
+ control: { type: 'select' },
77
+ options: ['default', 'comfortable', 'compact'],
78
+ },
79
+ loading: {
80
+ description: 'État de chargement du champ',
81
+ control: { type: 'boolean' },
82
+ },
83
+ hint: {
84
+ description: 'Indice affiché sous le champ',
85
+ control: { type: 'text' },
86
+ },
87
+ bgColor: {
88
+ description: 'Couleur de fond du champ',
89
+ control: { type: 'text' },
90
+ },
91
+ counter: {
92
+ description: 'Compteur de caractères',
93
+ control: { type: 'boolean' },
94
+ },
48
95
  },
49
96
  args: {
50
97
  label: 'Date de naissance',
51
98
  modelValue: '',
99
+ required: false,
100
+ readonly: false,
101
+ disabled: false,
102
+ isValidateOnBlur: true,
52
103
  },
53
104
  } satisfies Meta<typeof LunarCalendar>
54
105
 
@@ -56,9 +107,50 @@ export default meta
56
107
  type Story = StoryObj<typeof meta>
57
108
 
58
109
  export const Default: Story = {
110
+ parameters: {
111
+ sourceCode: [
112
+ {
113
+ name: 'Template',
114
+ code: `
115
+ <template>
116
+ <LunarCalendar
117
+ label="Date de naissance"
118
+ v-model="dateValue"
119
+ />
120
+ </template>
121
+
122
+ <script setup lang="ts">
123
+ import { ref } from 'vue'
124
+
125
+ const dateValue = ref('')
126
+ </script>
127
+ `,
128
+ },
129
+ ],
130
+ },
59
131
  args: {
60
132
  modelValue: '',
61
133
  },
134
+ render: (args) => {
135
+ return {
136
+ components: { LunarCalendar },
137
+ setup() {
138
+ const value = ref(args.modelValue)
139
+ watch(() => args.modelValue, (newValue) => {
140
+ value.value = newValue
141
+ })
142
+ return { args, value }
143
+ },
144
+ template: `
145
+ <div class="d-flex flex-wrap align-center">
146
+ <LunarCalendar v-bind="args" v-model="value" />
147
+ </div>
148
+ `,
149
+ }
150
+ },
151
+ }
152
+
153
+ export const Required: Story = {
62
154
  parameters: {
63
155
  sourceCode: [
64
156
  {
@@ -68,6 +160,7 @@ export const Default: Story = {
68
160
  <LunarCalendar
69
161
  label="Date de naissance"
70
162
  v-model="dateValue"
163
+ required
71
164
  />
72
165
  </template>
73
166
 
@@ -80,14 +173,30 @@ export const Default: Story = {
80
173
  },
81
174
  ],
82
175
  },
83
- }
84
-
85
- export const WithYearConstraints: Story = {
86
176
  args: {
87
- modelValue: '16/08/1550',
88
- minYear: 1400,
89
- maxYear: 1500,
177
+ modelValue: '',
178
+ required: true,
179
+ },
180
+ render: (args) => {
181
+ return {
182
+ components: { LunarCalendar },
183
+ setup() {
184
+ const value = ref(args.modelValue)
185
+ watch(() => args.modelValue, (newValue) => {
186
+ value.value = newValue
187
+ })
188
+ return { args, value }
189
+ },
190
+ template: `
191
+ <div class="d-flex flex-wrap align-center">
192
+ <LunarCalendar v-bind="args" v-model="value" />
193
+ </div>
194
+ `,
195
+ }
90
196
  },
197
+ }
198
+
199
+ export const WithClearable: Story = {
91
200
  parameters: {
92
201
  sourceCode: [
93
202
  {
@@ -97,27 +206,45 @@ export const WithYearConstraints: Story = {
97
206
  <LunarCalendar
98
207
  label="Date de naissance"
99
208
  v-model="dateValue"
100
- :min-year="1400"
101
- :max-year="1500"
209
+ placeholder="21/13/1442"
210
+ is-clearable
102
211
  />
103
212
  </template>
104
213
 
105
214
  <script setup lang="ts">
106
215
  import { ref } from 'vue'
107
216
 
108
- const dateValue = ref('16/08/1550')
217
+ const dateValue = ref('12/13/1564')
109
218
  </script>
110
219
  `,
111
220
  },
112
221
  ],
113
222
  },
114
- }
115
-
116
- export const WithMinYearOnly: Story = {
117
223
  args: {
118
- modelValue: '12/12/1445',
119
- minYear: 1420,
224
+ modelValue: '12/13/1564',
225
+ placeholder: '21/13/1442',
226
+ isClearable: true,
120
227
  },
228
+ render: (args) => {
229
+ return {
230
+ components: { LunarCalendar },
231
+ setup() {
232
+ const value = ref(args.modelValue)
233
+ watch(() => args.modelValue, (newValue) => {
234
+ value.value = newValue
235
+ })
236
+ return { args, value }
237
+ },
238
+ template: `
239
+ <div class="d-flex flex-wrap align-center">
240
+ <LunarCalendar v-bind="args" v-model="value" />
241
+ </div>
242
+ `,
243
+ }
244
+ },
245
+ }
246
+
247
+ export const HelpText: Story = {
121
248
  parameters: {
122
249
  sourceCode: [
123
250
  {
@@ -127,26 +254,43 @@ export const WithMinYearOnly: Story = {
127
254
  <LunarCalendar
128
255
  label="Date de naissance"
129
256
  v-model="dateValue"
130
- :min-year="1420"
257
+ help-text="Format attendu : JJ/MM/AAAA"
131
258
  />
132
259
  </template>
133
260
 
134
261
  <script setup lang="ts">
135
262
  import { ref } from 'vue'
136
263
 
137
- const dateValue = ref('12/12/1445')
264
+ const dateValue = ref('')
138
265
  </script>
139
266
  `,
140
267
  },
141
268
  ],
142
269
  },
143
- }
144
-
145
- export const WithMaxYearOnly: Story = {
146
270
  args: {
147
- modelValue: '12/12/1445',
148
- maxYear: 1450,
271
+ modelValue: '',
272
+ helpText: 'Format attendu : JJ/MM/AAAA',
149
273
  },
274
+ render: (args) => {
275
+ return {
276
+ components: { LunarCalendar },
277
+ setup() {
278
+ const value = ref(args.modelValue)
279
+ watch(() => args.modelValue, (newValue) => {
280
+ value.value = newValue
281
+ })
282
+ return { args, value }
283
+ },
284
+ template: `
285
+ <div class="d-flex flex-wrap align-center">
286
+ <LunarCalendar v-bind="args" v-model="value" />
287
+ </div>
288
+ `,
289
+ }
290
+ },
291
+ }
292
+
293
+ export const WithLoading: Story = {
150
294
  parameters: {
151
295
  sourceCode: [
152
296
  {
@@ -156,7 +300,7 @@ export const WithMaxYearOnly: Story = {
156
300
  <LunarCalendar
157
301
  label="Date de naissance"
158
302
  v-model="dateValue"
159
- :max-year="1450"
303
+ loading
160
304
  />
161
305
  </template>
162
306
 
@@ -169,13 +313,30 @@ export const WithMaxYearOnly: Story = {
169
313
  },
170
314
  ],
171
315
  },
172
- }
173
-
174
- export const required: Story = {
175
316
  args: {
176
- modelValue: '',
177
- required: true,
317
+ modelValue: '12/12/1445',
318
+ loading: true,
319
+ },
320
+ render: (args) => {
321
+ return {
322
+ components: { LunarCalendar },
323
+ setup() {
324
+ const value = ref(args.modelValue)
325
+ watch(() => args.modelValue, (newValue) => {
326
+ value.value = newValue
327
+ })
328
+ return { args, value }
329
+ },
330
+ template: `
331
+ <div class="d-flex flex-wrap align-center">
332
+ <LunarCalendar v-bind="args" v-model="value" />
333
+ </div>
334
+ `,
335
+ }
178
336
  },
337
+ }
338
+
339
+ export const Disabled: Story = {
179
340
  parameters: {
180
341
  sourceCode: [
181
342
  {
@@ -185,27 +346,43 @@ export const required: Story = {
185
346
  <LunarCalendar
186
347
  label="Date de naissance"
187
348
  v-model="dateValue"
188
- required
349
+ disabled
189
350
  />
190
351
  </template>
191
352
 
192
353
  <script setup lang="ts">
193
354
  import { ref } from 'vue'
194
355
 
195
- const dateValue = ref('')
356
+ const dateValue = ref('12/12/1445')
196
357
  </script>
197
358
  `,
198
359
  },
199
360
  ],
200
361
  },
201
- }
202
-
203
- export const WithClearable: Story = {
204
362
  args: {
205
- modelValue: '12/13/1564',
206
- placeholder: '21/13/1442',
207
- isClearable: true,
363
+ modelValue: '12/12/1445',
364
+ disabled: true,
365
+ },
366
+ render: (args) => {
367
+ return {
368
+ components: { LunarCalendar },
369
+ setup() {
370
+ const value = ref(args.modelValue)
371
+ watch(() => args.modelValue, (newValue) => {
372
+ value.value = newValue
373
+ })
374
+ return { args, value }
375
+ },
376
+ template: `
377
+ <div class="d-flex flex-wrap align-center">
378
+ <LunarCalendar v-bind="args" v-model="value" />
379
+ </div>
380
+ `,
381
+ }
208
382
  },
383
+ }
384
+
385
+ export const Readonly: Story = {
209
386
  parameters: {
210
387
  sourceCode: [
211
388
  {
@@ -215,18 +392,38 @@ export const WithClearable: Story = {
215
392
  <LunarCalendar
216
393
  label="Date de naissance"
217
394
  v-model="dateValue"
218
- :placeholder="'21/13/1442'"
219
- :is-clearable="true"
395
+ readonly
220
396
  />
221
397
  </template>
222
398
 
223
399
  <script setup lang="ts">
224
400
  import { ref } from 'vue'
225
401
 
226
- const dateValue = ref('12/13/1564')
402
+ const dateValue = ref('12/12/1445')
227
403
  </script>
228
404
  `,
229
405
  },
230
406
  ],
231
407
  },
408
+ args: {
409
+ modelValue: '12/12/1445',
410
+ readonly: true,
411
+ },
412
+ render: (args) => {
413
+ return {
414
+ components: { LunarCalendar },
415
+ setup() {
416
+ const value = ref(args.modelValue)
417
+ watch(() => args.modelValue, (newValue) => {
418
+ value.value = newValue
419
+ })
420
+ return { args, value }
421
+ },
422
+ template: `
423
+ <div class="d-flex flex-wrap align-center">
424
+ <LunarCalendar v-bind="args" v-model="value" />
425
+ </div>
426
+ `,
427
+ }
428
+ },
232
429
  }
@@ -2,56 +2,91 @@
2
2
  import { vMaska } from 'maska/vue'
3
3
  import { computed } from 'vue'
4
4
  import SyTextField from '../Customs/SyTextField/SyTextField.vue'
5
+ import { validationPropsDefaults, type FieldValidationProps } from '@/composables/unifyValidation/useValidation'
5
6
  import { useLunarCalendarValidation } from './useLunarCalendarValidation'
7
+ import type { LunarCalendarProps } from './types'
6
8
 
7
9
  const model = defineModel<string>()
8
10
  const mask = '##/##/####'
9
11
 
10
- const props = withDefaults(defineProps<{
11
- label: string
12
- successMessages?: string
13
- required?: boolean
14
- maxYear?: number
15
- minYear?: number
16
- placeholder?: string
17
- isClearable?: boolean
18
- displayPrependIcon?: boolean
19
- displayAppendIcon?: boolean
20
- }>(), {
21
- successMessages: undefined,
22
- required: false,
12
+ const props = withDefaults(defineProps<LunarCalendarProps & FieldValidationProps>(), {
13
+ label: '',
23
14
  maxYear: undefined,
24
15
  minYear: undefined,
25
16
  placeholder: undefined,
26
17
  isClearable: false,
27
18
  displayAppendIcon: false,
28
19
  displayPrependIcon: true,
20
+ // Nouvelles props avec defaults
21
+ helpText: '',
22
+ noIcon: false,
23
+ displayAsterisk: false,
24
+ prependTooltip: undefined,
25
+ appendTooltip: undefined,
26
+ tooltipLocation: 'top',
27
+ variantStyle: 'outlined',
28
+ color: 'primary',
29
+ density: 'default',
30
+ loading: false,
31
+ hint: undefined,
32
+ bgColor: 'white',
33
+ baseColor: undefined,
34
+ counter: false,
35
+ id: undefined,
36
+ name: undefined,
37
+ hideDetails: false,
38
+ autocomplete: 'off',
39
+ ...validationPropsDefaults,
29
40
  })
30
41
 
31
- const validation = useLunarCalendarValidation(
32
- computed(() => model.value),
33
- computed(() => props.label),
34
- computed(() => props.successMessages),
35
- computed(() => props.required),
36
- computed(() => props.minYear),
37
- computed(() => props.maxYear),
38
- )
42
+ const { focused, validate, errors, warnings, successes, hasError, hasWarning, hasSuccess, clearValidation } = useLunarCalendarValidation(computed(() => model.value), props)
43
+
44
+ defineExpose({
45
+ validateOnSubmit: validate,
46
+ clearValidation,
47
+ })
39
48
 
40
49
  </script>
41
50
 
42
51
  <template>
43
52
  <SyTextField
53
+ :id="props.id"
44
54
  v-model="model"
45
55
  v-maska="mask"
46
56
  :label="props.label"
47
- :error-messages="validation.errors.value"
48
- :show-success-messages="props.successMessages !== undefined"
49
- :success-messages="validation.successes.value"
50
- :has-success="validation.successes.value.length > 0"
57
+ :error-messages="errors"
58
+ :warning-messages="warnings"
59
+ :success-messages="successes"
60
+ :has-error="hasError"
61
+ :has-warning="hasWarning"
62
+ :has-success="hasSuccess"
63
+ :show-success-messages="props.showSuccessMessages"
51
64
  :placeholder
52
65
  :is-clearable
53
66
  :append-icon="props.displayAppendIcon ? 'calendar' : undefined"
54
67
  :prepend-icon="props.displayPrependIcon ? 'calendar' : undefined"
55
- @blur="validation.validate()"
68
+ :help-text="props.helpText"
69
+ :no-icon="props.noIcon"
70
+ :display-asterisk="props.displayAsterisk"
71
+ :prepend-tooltip="props.prependTooltip"
72
+ :append-tooltip="props.appendTooltip"
73
+ :tooltip-location="props.tooltipLocation"
74
+ :variant-style="props.variantStyle"
75
+ :color="props.color"
76
+ :density="props.density"
77
+ :loading="props.loading"
78
+ :hint="props.hint"
79
+ :bg-color="props.bgColor"
80
+ :base-color="props.baseColor"
81
+ :counter="props.counter"
82
+ :name="props.name"
83
+ :autocomplete="props.autocomplete"
84
+ :disabled="props.disabled"
85
+ :readonly="props.readonly"
86
+ :required="props.required"
87
+ :hide-details="props.hideDetails"
88
+ :disable-error-handling="true"
89
+ @focus="focused = true"
90
+ @blur="focused = false"
56
91
  />
57
92
  </template>