@cnamts/synapse 0.0.16-alpha → 1.0.0

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 (106) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +39 -0
  2. package/dist/components/Accordion/config.d.ts +9 -0
  3. package/dist/components/ChipList/ChipList.d.ts +1 -1
  4. package/dist/components/CopyBtn/CopyBtn.d.ts +2 -0
  5. package/dist/components/Customs/SyInputSelect/SyInputSelect.d.ts +12 -0
  6. package/dist/components/Customs/SySelect/SySelect.d.ts +43 -16
  7. package/dist/components/Customs/SyTextField/SyTextField.d.ts +17 -17
  8. package/dist/components/DatePicker/DatePicker.d.ts +34 -34
  9. package/dist/components/DatePicker/DateTextInput.d.ts +16 -16
  10. package/dist/components/DiacriticPicker/DiacriticPicker.d.ts +27 -0
  11. package/dist/components/DiacriticPicker/config.d.ts +14 -0
  12. package/dist/components/DiacriticPicker/locales.d.ts +6 -0
  13. package/dist/components/DownloadBtn/DownloadBtn.d.ts +1 -1
  14. package/dist/components/FooterBar/FooterBar.d.ts +1 -1
  15. package/dist/components/NirField/NirField.d.ts +34 -32
  16. package/dist/components/NotificationBar/NotificationBar.d.ts +1 -1
  17. package/dist/components/PasswordField/PasswordField.d.ts +1 -1
  18. package/dist/components/PeriodField/PeriodField.d.ts +64 -64
  19. package/dist/components/PhoneField/PhoneField.d.ts +1 -0
  20. package/dist/components/PhoneField/tests/types.d.ts +18 -0
  21. package/dist/components/SyTextArea/SyTextArea.d.ts +900 -0
  22. package/dist/components/SyTextArea/locales.d.ts +3 -0
  23. package/dist/components/SyTextArea/trimStartOnUpdate.d.ts +1 -0
  24. package/dist/components/SyTextArea/useTextActions.d.ts +13 -0
  25. package/dist/components/SyTextArea/wrapText.d.ts +1 -0
  26. package/dist/components/TableToolbar/TableToolbar.d.ts +10 -4
  27. package/dist/components/TableToolbar/config.d.ts +3 -2
  28. package/dist/components/index.d.ts +3 -0
  29. package/dist/composables/date/useHolidayDay.d.ts +36 -0
  30. package/dist/design-system-v3.js +4202 -3529
  31. package/dist/design-system-v3.umd.cjs +4 -1
  32. package/dist/designTokens/tokens/pa/paLightTheme.d.ts +1 -32
  33. package/dist/style.css +1 -1
  34. package/dist/utils/rules/index.d.ts +1 -0
  35. package/dist/utils/rules/isHolidayDay/index.d.ts +11 -0
  36. package/dist/utils/rules/isHolidayDay/locales.d.ts +2 -0
  37. package/package.json +3 -2
  38. package/src/assets/settings.scss +12 -0
  39. package/src/components/Accordion/Accordion.mdx +69 -0
  40. package/src/components/Accordion/Accordion.stories.ts +262 -0
  41. package/src/components/Accordion/Accordion.vue +319 -0
  42. package/src/components/Accordion/config.ts +9 -0
  43. package/src/components/Accordion/tests/__snapshots__/accordion.spec.ts.snap +155 -0
  44. package/src/components/Accordion/tests/accordion.spec.ts +492 -0
  45. package/src/components/CopyBtn/CopyBtn.stories.ts +189 -0
  46. package/src/components/CopyBtn/CopyBtn.vue +29 -1
  47. package/src/components/CopyBtn/tests/CopyBtn.spec.ts +102 -0
  48. package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +155 -1
  49. package/src/components/Customs/SyInputSelect/SyInputSelect.vue +97 -14
  50. package/src/components/Customs/SyInputSelect/tests/SyInputSelect.spec.ts +386 -106
  51. package/src/components/Customs/SySelect/SySelect.stories.ts +121 -2
  52. package/src/components/Customs/SySelect/SySelect.vue +33 -8
  53. package/src/components/Customs/SySelect/tests/SySelect.spec.ts +290 -1
  54. package/src/components/Customs/SyTextField/SyTextField.vue +5 -3
  55. package/src/components/DatePicker/DatePicker.vue +16 -3
  56. package/src/components/DatePicker/DateTextInput.vue +16 -5
  57. package/src/components/DatePicker/examples/DatePickerHolidayRule.vue +130 -0
  58. package/src/components/DiacriticPicker/DiacriticPicker.mdx +104 -0
  59. package/src/components/DiacriticPicker/DiacriticPicker.stories.ts +447 -0
  60. package/src/components/DiacriticPicker/DiacriticPicker.vue +262 -0
  61. package/src/components/DiacriticPicker/config.ts +15 -0
  62. package/src/components/DiacriticPicker/locales.ts +6 -0
  63. package/src/components/DiacriticPicker/tests/DiatriticPicker.spec.ts +132 -0
  64. package/src/components/DialogBox/DialogBox.vue +1 -3
  65. package/src/components/NirField/NirField.stories.ts +172 -0
  66. package/src/components/NirField/NirField.vue +15 -7
  67. package/src/components/NotificationBar/Accessibilite.stories.ts +1 -1
  68. package/src/components/NotificationBar/NotificationBar.stories.ts +14 -0
  69. package/src/components/NotificationBar/NotificationBar.vue +26 -3
  70. package/src/components/NotificationBar/{options.ts → config.ts} +0 -1
  71. package/src/components/PaginatedTable/PaginatedTable.vue +0 -11
  72. package/src/components/PasswordField/PasswordField.stories.ts +4 -3
  73. package/src/components/PasswordField/PasswordField.vue +26 -18
  74. package/src/components/PasswordField/tests/PasswordField.spec.ts +1 -10
  75. package/src/components/PhoneField/PhoneField.stories.ts +143 -0
  76. package/src/components/PhoneField/PhoneField.vue +88 -30
  77. package/src/components/PhoneField/tests/PhoneField.additional.spec.ts +266 -0
  78. package/src/components/PhoneField/tests/PhoneField.spec.ts +248 -28
  79. package/src/components/PhoneField/tests/types.d.ts +19 -0
  80. package/src/components/SyTextArea/SyTextArea.mdx +17 -0
  81. package/src/components/SyTextArea/SyTextArea.stories.ts +322 -0
  82. package/src/components/SyTextArea/SyTextArea.vue +113 -0
  83. package/src/components/SyTextArea/locales.ts +3 -0
  84. package/src/components/SyTextArea/tests/SyTextArea.spec.ts +194 -0
  85. package/src/components/SyTextArea/trimStartOnUpdate.ts +12 -0
  86. package/src/components/SyTextArea/useTextActions.ts +52 -0
  87. package/src/components/SyTextArea/wrapText.ts +42 -0
  88. package/src/components/TableToolbar/TableToolbar.mdx +86 -1
  89. package/src/components/TableToolbar/TableToolbar.stories.ts +422 -74
  90. package/src/components/TableToolbar/TableToolbar.vue +25 -8
  91. package/src/components/TableToolbar/config.ts +3 -2
  92. package/src/components/TableToolbar/tests/__snapshots__/TableToolbar.spec.ts.snap +35 -12
  93. package/src/components/index.ts +3 -0
  94. package/src/composables/date/useHolidayDay.ts +98 -0
  95. package/src/composables/rules/useFieldValidation.ts +16 -3
  96. package/src/composables/validation/useValidation.ts +2 -1
  97. package/src/designTokens/tokens/pa/paLightTheme.ts +10 -41
  98. package/src/stories/Accessibilite/Introduction.mdx +5 -2
  99. package/src/stories/DesignTokens/colors.stories.ts +100 -41
  100. package/src/utils/rules/index.ts +1 -0
  101. package/src/utils/rules/isHolidayDay/IsHolidayDay.mdx +52 -0
  102. package/src/utils/rules/isHolidayDay/IsHolidayDay.stories.ts +129 -0
  103. package/src/utils/rules/isHolidayDay/index.ts +36 -0
  104. package/src/utils/rules/isHolidayDay/locales.ts +5 -0
  105. package/src/utils/rules/isHolidayDay/tests/isHolidayDay.spec.ts +35 -0
  106. /package/dist/components/NotificationBar/{options.d.ts → config.d.ts} +0 -0
@@ -0,0 +1,42 @@
1
+ export function wrapText(maxLength: number) {
2
+ return (value: string) => {
3
+ const lines = value.split('\n')
4
+ const newLines: string[] = []
5
+ for (const line of lines) {
6
+ if (line.length > maxLength) {
7
+ const words = line.split(' ')
8
+ let currentLine = ''
9
+ for (const word of words) {
10
+ if (currentLine.length + word.length + 1 > maxLength) {
11
+ if (word.length > maxLength) {
12
+ if (currentLine) {
13
+ newLines.push(currentLine)
14
+ }
15
+ const wordRegex = new RegExp(`.{1,${maxLength - 1}}`, 'g')
16
+ const wordLines = word.match(wordRegex)
17
+ for (let i = 0; i < wordLines!.length - 1; i++) {
18
+ wordLines![i] += '-'
19
+ newLines.push(wordLines![i])
20
+ }
21
+ currentLine = wordLines![wordLines!.length - 1]
22
+ }
23
+ else {
24
+ newLines.push(currentLine)
25
+ currentLine = word
26
+ }
27
+ }
28
+ else {
29
+ currentLine += (currentLine.length ? ' ' : '') + word
30
+ }
31
+ }
32
+ if (currentLine) {
33
+ newLines.push(currentLine)
34
+ }
35
+ }
36
+ else {
37
+ newLines.push(line)
38
+ }
39
+ }
40
+ return newLines.join('\n')
41
+ }
42
+ }
@@ -42,10 +42,95 @@ Vous pouvez personnaliser les différents labels en utilisant les props `addButt
42
42
 
43
43
  ## Slots
44
44
 
45
+ Vous pouvez utiliser le slot `filters` pour ajouter des filtres à gauche du champ de recherche.
46
+
47
+ <Canvas
48
+ of={TableToolbarStories.SlotFilters}
49
+ source={{
50
+ language: 'html',
51
+ format: 'dedent',
52
+ code: `
53
+ <script setup lang="ts">
54
+ import { TableToolbar, SySelect } from '@cnamts/synapse'
55
+ import { VDataTable } from 'vuetify/components'
56
+ import { ref } from 'vue'
57
+
58
+ const headers = [
59
+ {
60
+ title: 'Nom',
61
+ value: 'lastname',
62
+ },
63
+ {
64
+ title: 'Prénom',
65
+ value: 'firstname',
66
+ },
67
+ {
68
+ title: 'Email',
69
+ value: 'email',
70
+ },
71
+ ]
72
+
73
+ const items = [
74
+ {
75
+ firstname: 'Virginie',
76
+ lastname: 'Beauchesne',
77
+ email: 'virginie.beauchesne@example.com',
78
+ },
79
+ {
80
+ firstname: 'Étienne',
81
+ lastname: 'Salois',
82
+ email: 'etienne.salois@example.com',
83
+ },
84
+ ]
85
+
86
+ const search = ref('')
87
+
88
+ const filterItems = ref<{ text: string, value: string }[]>([])
89
+
90
+ items.forEach((item) => {
91
+ filterItems.value.push({
92
+ text: item.lastname,
93
+ value: item.lastname,
94
+ })
95
+ })
96
+ </script>
97
+
98
+ <template>
99
+ <VDataTable
100
+ :headers="headers"
101
+ :items="items"
102
+ :search="search"
103
+ hide-default-footer
104
+ >
105
+ <template #top>
106
+ <TableToolbar
107
+ v-model:search="search"
108
+ :nb-total="items.length"
109
+ >
110
+ <template #filters>
111
+ <div class="py-4">
112
+ <SySelect
113
+ v-model="search"
114
+ :items="filterItems"
115
+ label="Nom"
116
+ density="compact"
117
+ hide-messages
118
+ clearable
119
+ />
120
+ </div>
121
+ </template>
122
+ </TableToolbar>
123
+ </template>
124
+ </VDataTable>
125
+ </template>
126
+ `
127
+ }}
128
+ />
129
+
45
130
  Vous pouvez utiliser les slots `search-left` ou `search-right` pour ajouter du contenu à gauche ou à droite du champ de recherche.
46
131
 
47
132
  <Canvas
48
- of={TableToolbarStories.Slots}
133
+ of={TableToolbarStories.OtherSlots}
49
134
  source={{
50
135
  language: 'html',
51
136
  format: 'dedent',