@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.
- package/dist/components/Accordion/Accordion.d.ts +39 -0
- package/dist/components/Accordion/config.d.ts +9 -0
- package/dist/components/ChipList/ChipList.d.ts +1 -1
- package/dist/components/CopyBtn/CopyBtn.d.ts +2 -0
- package/dist/components/Customs/SyInputSelect/SyInputSelect.d.ts +12 -0
- package/dist/components/Customs/SySelect/SySelect.d.ts +43 -16
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +17 -17
- package/dist/components/DatePicker/DatePicker.d.ts +34 -34
- package/dist/components/DatePicker/DateTextInput.d.ts +16 -16
- package/dist/components/DiacriticPicker/DiacriticPicker.d.ts +27 -0
- package/dist/components/DiacriticPicker/config.d.ts +14 -0
- package/dist/components/DiacriticPicker/locales.d.ts +6 -0
- package/dist/components/DownloadBtn/DownloadBtn.d.ts +1 -1
- package/dist/components/FooterBar/FooterBar.d.ts +1 -1
- package/dist/components/NirField/NirField.d.ts +34 -32
- package/dist/components/NotificationBar/NotificationBar.d.ts +1 -1
- package/dist/components/PasswordField/PasswordField.d.ts +1 -1
- package/dist/components/PeriodField/PeriodField.d.ts +64 -64
- package/dist/components/PhoneField/PhoneField.d.ts +1 -0
- package/dist/components/PhoneField/tests/types.d.ts +18 -0
- package/dist/components/SyTextArea/SyTextArea.d.ts +900 -0
- package/dist/components/SyTextArea/locales.d.ts +3 -0
- package/dist/components/SyTextArea/trimStartOnUpdate.d.ts +1 -0
- package/dist/components/SyTextArea/useTextActions.d.ts +13 -0
- package/dist/components/SyTextArea/wrapText.d.ts +1 -0
- package/dist/components/TableToolbar/TableToolbar.d.ts +10 -4
- package/dist/components/TableToolbar/config.d.ts +3 -2
- package/dist/components/index.d.ts +3 -0
- package/dist/composables/date/useHolidayDay.d.ts +36 -0
- package/dist/design-system-v3.js +4202 -3529
- package/dist/design-system-v3.umd.cjs +4 -1
- package/dist/designTokens/tokens/pa/paLightTheme.d.ts +1 -32
- package/dist/style.css +1 -1
- package/dist/utils/rules/index.d.ts +1 -0
- package/dist/utils/rules/isHolidayDay/index.d.ts +11 -0
- package/dist/utils/rules/isHolidayDay/locales.d.ts +2 -0
- package/package.json +3 -2
- package/src/assets/settings.scss +12 -0
- package/src/components/Accordion/Accordion.mdx +69 -0
- package/src/components/Accordion/Accordion.stories.ts +262 -0
- package/src/components/Accordion/Accordion.vue +319 -0
- package/src/components/Accordion/config.ts +9 -0
- package/src/components/Accordion/tests/__snapshots__/accordion.spec.ts.snap +155 -0
- package/src/components/Accordion/tests/accordion.spec.ts +492 -0
- package/src/components/CopyBtn/CopyBtn.stories.ts +189 -0
- package/src/components/CopyBtn/CopyBtn.vue +29 -1
- package/src/components/CopyBtn/tests/CopyBtn.spec.ts +102 -0
- package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +155 -1
- package/src/components/Customs/SyInputSelect/SyInputSelect.vue +97 -14
- package/src/components/Customs/SyInputSelect/tests/SyInputSelect.spec.ts +386 -106
- package/src/components/Customs/SySelect/SySelect.stories.ts +121 -2
- package/src/components/Customs/SySelect/SySelect.vue +33 -8
- package/src/components/Customs/SySelect/tests/SySelect.spec.ts +290 -1
- package/src/components/Customs/SyTextField/SyTextField.vue +5 -3
- package/src/components/DatePicker/DatePicker.vue +16 -3
- package/src/components/DatePicker/DateTextInput.vue +16 -5
- package/src/components/DatePicker/examples/DatePickerHolidayRule.vue +130 -0
- package/src/components/DiacriticPicker/DiacriticPicker.mdx +104 -0
- package/src/components/DiacriticPicker/DiacriticPicker.stories.ts +447 -0
- package/src/components/DiacriticPicker/DiacriticPicker.vue +262 -0
- package/src/components/DiacriticPicker/config.ts +15 -0
- package/src/components/DiacriticPicker/locales.ts +6 -0
- package/src/components/DiacriticPicker/tests/DiatriticPicker.spec.ts +132 -0
- package/src/components/DialogBox/DialogBox.vue +1 -3
- package/src/components/NirField/NirField.stories.ts +172 -0
- package/src/components/NirField/NirField.vue +15 -7
- package/src/components/NotificationBar/Accessibilite.stories.ts +1 -1
- package/src/components/NotificationBar/NotificationBar.stories.ts +14 -0
- package/src/components/NotificationBar/NotificationBar.vue +26 -3
- package/src/components/NotificationBar/{options.ts → config.ts} +0 -1
- package/src/components/PaginatedTable/PaginatedTable.vue +0 -11
- package/src/components/PasswordField/PasswordField.stories.ts +4 -3
- package/src/components/PasswordField/PasswordField.vue +26 -18
- package/src/components/PasswordField/tests/PasswordField.spec.ts +1 -10
- package/src/components/PhoneField/PhoneField.stories.ts +143 -0
- package/src/components/PhoneField/PhoneField.vue +88 -30
- package/src/components/PhoneField/tests/PhoneField.additional.spec.ts +266 -0
- package/src/components/PhoneField/tests/PhoneField.spec.ts +248 -28
- package/src/components/PhoneField/tests/types.d.ts +19 -0
- package/src/components/SyTextArea/SyTextArea.mdx +17 -0
- package/src/components/SyTextArea/SyTextArea.stories.ts +322 -0
- package/src/components/SyTextArea/SyTextArea.vue +113 -0
- package/src/components/SyTextArea/locales.ts +3 -0
- package/src/components/SyTextArea/tests/SyTextArea.spec.ts +194 -0
- package/src/components/SyTextArea/trimStartOnUpdate.ts +12 -0
- package/src/components/SyTextArea/useTextActions.ts +52 -0
- package/src/components/SyTextArea/wrapText.ts +42 -0
- package/src/components/TableToolbar/TableToolbar.mdx +86 -1
- package/src/components/TableToolbar/TableToolbar.stories.ts +422 -74
- package/src/components/TableToolbar/TableToolbar.vue +25 -8
- package/src/components/TableToolbar/config.ts +3 -2
- package/src/components/TableToolbar/tests/__snapshots__/TableToolbar.spec.ts.snap +35 -12
- package/src/components/index.ts +3 -0
- package/src/composables/date/useHolidayDay.ts +98 -0
- package/src/composables/rules/useFieldValidation.ts +16 -3
- package/src/composables/validation/useValidation.ts +2 -1
- package/src/designTokens/tokens/pa/paLightTheme.ts +10 -41
- package/src/stories/Accessibilite/Introduction.mdx +5 -2
- package/src/stories/DesignTokens/colors.stories.ts +100 -41
- package/src/utils/rules/index.ts +1 -0
- package/src/utils/rules/isHolidayDay/IsHolidayDay.mdx +52 -0
- package/src/utils/rules/isHolidayDay/IsHolidayDay.stories.ts +129 -0
- package/src/utils/rules/isHolidayDay/index.ts +36 -0
- package/src/utils/rules/isHolidayDay/locales.ts +5 -0
- package/src/utils/rules/isHolidayDay/tests/isHolidayDay.spec.ts +35 -0
- /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.
|
|
133
|
+
of={TableToolbarStories.OtherSlots}
|
|
49
134
|
source={{
|
|
50
135
|
language: 'html',
|
|
51
136
|
format: 'dedent',
|