@cnamts/synapse 0.0.15-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 (133) 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/CookiesSelection/CookiesSelection.d.ts +26 -26
  5. package/dist/components/CopyBtn/CopyBtn.d.ts +2 -0
  6. package/dist/components/Customs/SyInputSelect/SyInputSelect.d.ts +12 -0
  7. package/dist/components/Customs/SySelect/SySelect.d.ts +43 -16
  8. package/dist/components/Customs/SyTextField/SyTextField.d.ts +1391 -1
  9. package/dist/components/DatePicker/DatePicker.d.ts +2810 -16
  10. package/dist/components/DatePicker/DateTextInput.d.ts +1401 -4
  11. package/dist/components/DiacriticPicker/DiacriticPicker.d.ts +27 -0
  12. package/dist/components/DiacriticPicker/config.d.ts +14 -0
  13. package/dist/components/DiacriticPicker/locales.d.ts +6 -0
  14. package/dist/components/DownloadBtn/DownloadBtn.d.ts +1 -1
  15. package/dist/components/FooterBar/FooterBar.d.ts +1 -1
  16. package/dist/components/LangBtn/LangBtn.d.ts +4 -4
  17. package/dist/components/NirField/NirField.d.ts +2796 -4
  18. package/dist/components/NotificationBar/NotificationBar.d.ts +1 -1
  19. package/dist/components/PasswordField/PasswordField.d.ts +1 -1
  20. package/dist/components/PeriodField/PeriodField.d.ts +5636 -48
  21. package/dist/components/PhoneField/PhoneField.d.ts +1 -0
  22. package/dist/components/PhoneField/tests/types.d.ts +18 -0
  23. package/dist/components/SyAlert/SyAlert.d.ts +72 -1
  24. package/dist/components/SyTextArea/SyTextArea.d.ts +900 -0
  25. package/dist/components/SyTextArea/locales.d.ts +3 -0
  26. package/dist/components/SyTextArea/trimStartOnUpdate.d.ts +1 -0
  27. package/dist/components/SyTextArea/useTextActions.d.ts +13 -0
  28. package/dist/components/SyTextArea/wrapText.d.ts +1 -0
  29. package/dist/components/TableToolbar/TableToolbar.d.ts +10 -4
  30. package/dist/components/TableToolbar/config.d.ts +3 -2
  31. package/dist/components/UploadWorkflow/UploadWorkflow.d.ts +26 -26
  32. package/dist/components/index.d.ts +4 -0
  33. package/dist/composables/date/useDateFormat.d.ts +2 -2
  34. package/dist/composables/date/useDateFormatDayjs.d.ts +23 -0
  35. package/dist/composables/date/useDateInitializationDayjs.d.ts +18 -0
  36. package/dist/composables/date/useHolidayDay.d.ts +36 -0
  37. package/dist/design-system-v3.js +5106 -4208
  38. package/dist/design-system-v3.umd.cjs +4 -1
  39. package/dist/designTokens/tokens/pa/paLightTheme.d.ts +1 -32
  40. package/dist/style.css +1 -1
  41. package/dist/utils/rules/index.d.ts +1 -0
  42. package/dist/utils/rules/isHolidayDay/index.d.ts +11 -0
  43. package/dist/utils/rules/isHolidayDay/locales.d.ts +2 -0
  44. package/package.json +3 -2
  45. package/src/assets/settings.scss +12 -0
  46. package/src/components/Accordion/Accordion.mdx +69 -0
  47. package/src/components/Accordion/Accordion.stories.ts +262 -0
  48. package/src/components/Accordion/Accordion.vue +319 -0
  49. package/src/components/Accordion/config.ts +9 -0
  50. package/src/components/Accordion/tests/__snapshots__/accordion.spec.ts.snap +155 -0
  51. package/src/components/Accordion/tests/accordion.spec.ts +492 -0
  52. package/src/components/CopyBtn/CopyBtn.stories.ts +189 -0
  53. package/src/components/CopyBtn/CopyBtn.vue +29 -1
  54. package/src/components/CopyBtn/tests/CopyBtn.spec.ts +102 -0
  55. package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +155 -1
  56. package/src/components/Customs/SyInputSelect/SyInputSelect.vue +97 -14
  57. package/src/components/Customs/SyInputSelect/tests/SyInputSelect.spec.ts +386 -106
  58. package/src/components/Customs/SySelect/SySelect.stories.ts +121 -2
  59. package/src/components/Customs/SySelect/SySelect.vue +33 -8
  60. package/src/components/Customs/SySelect/tests/SySelect.spec.ts +290 -1
  61. package/src/components/Customs/SyTextField/Accessibilite.stories.ts +7 -0
  62. package/src/components/Customs/SyTextField/SyTextField.stories.ts +13 -0
  63. package/src/components/Customs/SyTextField/SyTextField.vue +87 -20
  64. package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +795 -0
  65. package/src/components/DatePicker/DatePicker.stories.ts +432 -1
  66. package/src/components/DatePicker/DatePicker.vue +82 -27
  67. package/src/components/DatePicker/DatePickerValidation.stories.ts +9 -1
  68. package/src/components/DatePicker/DateTextInput.vue +101 -138
  69. package/src/components/DatePicker/docExamples/DatePickerBidirectionalValidation.vue +282 -0
  70. package/src/components/DatePicker/examples/DatePickerHolidayRule.vue +130 -0
  71. package/src/components/DatePicker/tests/DatePicker.spec.ts +33 -32
  72. package/src/components/DatePicker/tests/DateTextInput.spec.ts +81 -33
  73. package/src/components/DiacriticPicker/DiacriticPicker.mdx +104 -0
  74. package/src/components/DiacriticPicker/DiacriticPicker.stories.ts +447 -0
  75. package/src/components/DiacriticPicker/DiacriticPicker.vue +262 -0
  76. package/src/components/DiacriticPicker/config.ts +15 -0
  77. package/src/components/DiacriticPicker/locales.ts +6 -0
  78. package/src/components/DiacriticPicker/tests/DiatriticPicker.spec.ts +132 -0
  79. package/src/components/DialogBox/DialogBox.vue +1 -3
  80. package/src/components/NirField/NirField.stories.ts +172 -0
  81. package/src/components/NirField/NirField.vue +15 -7
  82. package/src/components/NotificationBar/Accessibilite.stories.ts +1 -1
  83. package/src/components/NotificationBar/NotificationBar.stories.ts +14 -0
  84. package/src/components/NotificationBar/NotificationBar.vue +26 -3
  85. package/src/components/NotificationBar/{options.ts → config.ts} +0 -1
  86. package/src/components/PaginatedTable/PaginatedTable.vue +0 -11
  87. package/src/components/PasswordField/PasswordField.stories.ts +4 -3
  88. package/src/components/PasswordField/PasswordField.vue +26 -18
  89. package/src/components/PasswordField/tests/PasswordField.spec.ts +1 -10
  90. package/src/components/PhoneField/PhoneField.stories.ts +143 -0
  91. package/src/components/PhoneField/PhoneField.vue +88 -30
  92. package/src/components/PhoneField/tests/PhoneField.additional.spec.ts +266 -0
  93. package/src/components/PhoneField/tests/PhoneField.spec.ts +248 -28
  94. package/src/components/PhoneField/tests/types.d.ts +19 -0
  95. package/src/components/SyAlert/Accessibilite.stories.ts +4 -0
  96. package/src/components/SyAlert/SyAlert.mdx +3 -7
  97. package/src/components/SyAlert/SyAlert.stories.ts +19 -12
  98. package/src/components/SyAlert/SyAlert.vue +88 -51
  99. package/src/components/SyAlert/tests/SyAlert.spec.ts +20 -2
  100. package/src/components/SyAlert/tests/__snapshots__/SyAlert.spec.ts.snap +83 -75
  101. package/src/components/SyTextArea/SyTextArea.mdx +17 -0
  102. package/src/components/SyTextArea/SyTextArea.stories.ts +322 -0
  103. package/src/components/SyTextArea/SyTextArea.vue +113 -0
  104. package/src/components/SyTextArea/locales.ts +3 -0
  105. package/src/components/SyTextArea/tests/SyTextArea.spec.ts +194 -0
  106. package/src/components/SyTextArea/trimStartOnUpdate.ts +12 -0
  107. package/src/components/SyTextArea/useTextActions.ts +52 -0
  108. package/src/components/SyTextArea/wrapText.ts +42 -0
  109. package/src/components/TableToolbar/TableToolbar.mdx +86 -1
  110. package/src/components/TableToolbar/TableToolbar.stories.ts +422 -74
  111. package/src/components/TableToolbar/TableToolbar.vue +25 -8
  112. package/src/components/TableToolbar/config.ts +3 -2
  113. package/src/components/TableToolbar/tests/__snapshots__/TableToolbar.spec.ts.snap +35 -12
  114. package/src/components/index.ts +4 -0
  115. package/src/composables/date/useDateFormat.ts +17 -1
  116. package/src/composables/date/useDateFormatDayjs.ts +84 -0
  117. package/src/composables/date/useDateInitializationDayjs.ts +133 -0
  118. package/src/composables/date/useHolidayDay.ts +98 -0
  119. package/src/composables/rules/useFieldValidation.ts +16 -3
  120. package/src/composables/validation/useValidation.ts +2 -1
  121. package/src/designTokens/tokens/pa/paLightTheme.ts +10 -41
  122. package/src/stories/Accessibilite/Avancement/Avancement.mdx +12 -0
  123. package/src/stories/Accessibilite/Avancement/Avancement.stories.ts +134 -0
  124. package/src/stories/Accessibilite/Introduction.mdx +5 -2
  125. package/src/stories/DesignTokens/colors.stories.ts +100 -41
  126. package/src/utils/rules/index.ts +1 -0
  127. package/src/utils/rules/isHolidayDay/IsHolidayDay.mdx +52 -0
  128. package/src/utils/rules/isHolidayDay/IsHolidayDay.stories.ts +129 -0
  129. package/src/utils/rules/isHolidayDay/index.ts +36 -0
  130. package/src/utils/rules/isHolidayDay/locales.ts +5 -0
  131. package/src/utils/rules/isHolidayDay/tests/isHolidayDay.spec.ts +35 -0
  132. /package/dist/components/NotificationBar/{options.d.ts → config.d.ts} +0 -0
  133. /package/src/components/DatePicker/{DatePickerValidationExamples.vue → docExamples/DatePickerValidationExamples.vue} +0 -0
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed } from 'vue'
2
+ import { computed, ref, onMounted, useAttrs } from 'vue'
3
3
  import { locales } from './locales'
4
4
  import {
5
5
  mdiAlertOutline,
@@ -8,6 +8,7 @@
8
8
  mdiInformationOutline,
9
9
  mdiClose,
10
10
  } from '@mdi/js'
11
+ import type { VIcon } from 'vuetify/components'
11
12
 
12
13
  const show = defineModel<boolean>({
13
14
  default: true,
@@ -23,6 +24,8 @@
23
24
  variant: 'tonal',
24
25
  })
25
26
 
27
+ const attrs = useAttrs()
28
+
26
29
  const prependIcon = computed(() => {
27
30
  return {
28
31
  info: mdiInformationOutline,
@@ -43,58 +46,71 @@
43
46
  prependIcon,
44
47
  dismissAlert,
45
48
  })
49
+
50
+ const alertIcon = ref<typeof VIcon | null>(null)
51
+ onMounted(() => {
52
+ alertIcon.value?.$el?.querySelector('svg')?.setAttribute('role', 'presentation')
53
+ })
46
54
  </script>
47
55
 
48
56
  <template>
49
- <VAlert
50
- v-model="show"
51
- :type="props.type"
52
- :closable="props.closable"
53
- :variant="props.variant"
54
- :class="`alert alert--${props.type}`"
55
- :color="props.type"
56
- :border="props.variant === 'tonal' ? 'start' : false"
57
+ <div
58
+ class="sy-alert"
59
+ role="alert"
57
60
  >
58
- <template #prepend>
59
- <VIcon
60
- class="alert-icon"
61
- size="1.5rem"
62
- >
63
- <slot name="icon">
64
- {{ prependIcon }}
65
- </slot>
66
- </VIcon>
67
- </template>
68
-
69
- <template #default>
70
- <slot />
71
- </template>
72
-
73
- <template
74
- v-if="props.closable"
75
- #close
61
+ <VAlert
62
+ v-model="show"
63
+ v-bind="attrs"
64
+ :type="props.type"
65
+ :closable="props.closable"
66
+ :variant="props.variant"
67
+ :class="`alert alert--${props.type}`"
68
+ :color="props.type"
69
+ :border="props.variant === 'tonal' ? 'start' : false"
76
70
  >
77
- <VBtn
78
- :color="props.variant === 'outlined' ? undefined : 'primary'"
79
- :ripple="false"
80
- variant="text"
81
- width="auto"
82
- height="100%"
83
- class="alert-close-btn"
84
- @click="dismissAlert"
85
- >
71
+ <template #prepend>
86
72
  <VIcon
87
- size="small"
73
+ ref="alertIcon"
74
+ class="alert-icon"
75
+ size="1.5rem"
76
+ role="presentation"
88
77
  >
89
- {{ mdiClose }}
78
+ <slot name="icon">
79
+ {{ prependIcon }}
80
+ </slot>
90
81
  </VIcon>
82
+ </template>
83
+
84
+ <template #default>
85
+ <slot />
86
+ </template>
91
87
 
92
- <span>
93
- {{ locales.close }}
94
- </span>
95
- </VBtn>
96
- </template>
97
- </VAlert>
88
+ <template
89
+ v-if="props.closable"
90
+ #close
91
+ >
92
+ <VBtn
93
+ :color="props.variant === 'outlined' ? undefined : 'primary'"
94
+ :ripple="false"
95
+ variant="text"
96
+ width="auto"
97
+ height="100%"
98
+ class="alert-close-btn"
99
+ @click="dismissAlert"
100
+ >
101
+ <VIcon
102
+ size="small"
103
+ >
104
+ {{ mdiClose }}
105
+ </VIcon>
106
+
107
+ <span>
108
+ {{ locales.close }}
109
+ </span>
110
+ </VBtn>
111
+ </template>
112
+ </VAlert>
113
+ </div>
98
114
  </template>
99
115
 
100
116
  <style lang="scss" scoped>
@@ -128,17 +144,24 @@
128
144
  .alert-close-btn {
129
145
  cursor: pointer;
130
146
  line-height: 0;
131
-
132
- .v-btn__overlay {
133
- display: none;
134
- }
135
- }
136
-
137
- .v-btn {
138
147
  text-transform: none;
139
148
  font-weight: bold;
140
149
  font-size: 0.75rem;
141
150
  letter-spacing: normal;
151
+
152
+ &:focus-visible {
153
+ outline: solid 2px black !important;
154
+ outline-color: var(--v-primary-base) !important;
155
+ outline-offset: 2px !important;
156
+
157
+ &::after {
158
+ visibility: hidden;
159
+ }
160
+ }
161
+
162
+ .v-btn__overlay {
163
+ display: none;
164
+ }
142
165
  }
143
166
 
144
167
  @media screen and (width <= 440px) {
@@ -254,4 +277,18 @@
254
277
  )
255
278
  );
256
279
  }
280
+
281
+ .v-alert.v-theme--dark {
282
+ &.v-alert--variant-outlined {
283
+ background-color: tokens.$white-base !important;
284
+ }
285
+
286
+ .alert-close-btn {
287
+ color: black !important;
288
+
289
+ &:focus-visible {
290
+ outline-color: black !important;
291
+ }
292
+ }
293
+ }
257
294
  </style>
@@ -46,7 +46,16 @@ describe('Alert', () => {
46
46
  modelValue: false,
47
47
  })
48
48
 
49
- expect(wrapper.html()).toBeFalsy()
49
+ expect(wrapper.html()).toMatchInlineSnapshot(`
50
+ <div
51
+ class="sy-alert"
52
+ message="message"
53
+ role="alert"
54
+ title="title"
55
+ >
56
+ <!---->
57
+ </div>
58
+ `)
50
59
 
51
60
  await wrapper.setProps({
52
61
  modelValue: true,
@@ -79,7 +88,16 @@ describe('Alert', () => {
79
88
 
80
89
  await closeBtn.element.click()
81
90
 
82
- expect(wrapper.html()).toBeFalsy()
91
+ expect(wrapper.html()).toMatchInlineSnapshot(`
92
+ <div
93
+ class="sy-alert"
94
+ message="message"
95
+ role="alert"
96
+ title="title"
97
+ >
98
+ <!---->
99
+ </div>
100
+ `)
83
101
  expect(wrapper.emitted('update:modelValue')![0]![0]).toBe(false)
84
102
  })
85
103
 
@@ -2,86 +2,94 @@
2
2
 
3
3
  exports[`Alert > render correctly 1`] = `
4
4
  <div
5
- class="
6
- alert
7
- alert--success
8
- text-success
9
- v-alert
10
- v-alert--border
11
- v-alert--border-start
12
- v-alert--density-default
13
- v-alert--variant-tonal
14
- v-theme--light
15
- "
5
+ class="sy-alert"
16
6
  message="message"
17
7
  role="alert"
8
+ title="title"
18
9
  >
19
- <!---->
20
- <span class="v-alert__underlay"></span>
21
- <div class="v-alert__border"></div>
22
- <div class="v-alert__prepend">
23
- <i
24
- aria-hidden="true"
25
- class="
26
- 11.59L6
27
- 12
28
- 12
29
- 12
30
- 12
31
- 12
32
- 12
33
- 12S6.5
34
- 12S7.59
35
- 13L10
36
- 14.17L7.41
37
- 16.41
38
- 16.41
39
- 17.5
40
- 17.5
41
- 17L18
42
- 2
43
- 2
44
- 2
45
- 2
46
- 20
47
- 20
48
- 20
49
- 20
50
- 20C7.59
51
- 20M16.59
52
- 22
53
- 22
54
- 22
55
- 22
56
- 2C6.5
57
- 2M12
58
- 4
59
- 4
60
- 4
61
- 4
62
- 6.5
63
- 7.58L10
64
- 7.58Z
65
- 7.59
66
- 9L16.59
67
- M12
68
- alert-icon
69
- mdi
70
- notranslate
71
- v-icon
72
- v-theme--light
73
- "
74
- style="font-size: 1.5rem; height: 1.5rem; width: 1.5rem;"
75
- ></i>
76
- </div>
77
- <div class="v-alert__content">
78
- <div class="v-alert-title">
79
- title
10
+ <div
11
+ class="
12
+ alert
13
+ alert--success
14
+ text-success
15
+ v-alert
16
+ v-alert--border
17
+ v-alert--border-start
18
+ v-alert--density-default
19
+ v-alert--variant-tonal
20
+ v-theme--light
21
+ "
22
+ message="message"
23
+ role="alert"
24
+ >
25
+ <!---->
26
+ <span class="v-alert__underlay"></span>
27
+ <div class="v-alert__border"></div>
28
+ <div class="v-alert__prepend">
29
+ <i
30
+ aria-hidden="true"
31
+ class="
32
+ 11.59L6
33
+ 12
34
+ 12
35
+ 12
36
+ 12
37
+ 12
38
+ 12
39
+ 12S6.5
40
+ 12S7.59
41
+ 13L10
42
+ 14.17L7.41
43
+ 16.41
44
+ 16.41
45
+ 17.5
46
+ 17.5
47
+ 17L18
48
+ 2
49
+ 2
50
+ 2
51
+ 2
52
+ 20
53
+ 20
54
+ 20
55
+ 20
56
+ 20C7.59
57
+ 20M16.59
58
+ 22
59
+ 22
60
+ 22
61
+ 22
62
+ 2C6.5
63
+ 2M12
64
+ 4
65
+ 4
66
+ 4
67
+ 4
68
+ 6.5
69
+ 7.58L10
70
+ 7.58Z
71
+ 7.59
72
+ 9L16.59
73
+ M12
74
+ alert-icon
75
+ mdi
76
+ notranslate
77
+ v-icon
78
+ v-theme--light
79
+ "
80
+ role="presentation"
81
+ style="font-size: 1.5rem; height: 1.5rem; width: 1.5rem;"
82
+ ></i>
80
83
  </div>
84
+ <div class="v-alert__content">
85
+ <div class="v-alert-title">
86
+ title
87
+ </div>
88
+ <!---->
89
+ slot content
90
+ </div>
91
+ <!---->
81
92
  <!---->
82
- slot content
83
93
  </div>
84
- <!---->
85
- <!---->
86
94
  </div>
87
95
  `;
@@ -0,0 +1,17 @@
1
+ import {Controls, Canvas, Meta, Source} from '@storybook/blocks';
2
+
3
+ import * as SyTextAreaStories from './SyTextArea.stories';
4
+
5
+ <Meta of={SyTextAreaStories} />
6
+
7
+ # SyTextArea
8
+
9
+ Le composant `SyTextArea` étend les fonctionnalitées du composants `VTextArea` de `Vuetify` en ajoutant des contraintes.
10
+
11
+ <Canvas of={SyTextAreaStories.Default} />
12
+
13
+ # API
14
+
15
+ Les props du composant `SyTextArea` sont les mêmes que celles du composant `VTextArea` de `Vuetify`, avec quelques ajouts :
16
+
17
+ <Controls of={SyTextAreaStories.Default} />