@cnamts/synapse 0.0.3-alpha → 0.0.4-alpha
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/design-system-v3.d.ts +712 -27
- package/dist/design-system-v3.js +2715 -1485
- package/dist/design-system-v3.umd.cjs +10 -1
- package/dist/style.css +1 -1
- package/package.json +5 -2
- package/src/components/Alert/Alert.mdx +1 -1
- package/src/components/Alert/Alert.stories.ts +91 -1
- package/src/components/BackBtn/BackBtn.mdx +1 -1
- package/src/components/BackBtn/BackBtn.stories.ts +84 -1
- package/src/components/BackToTopBtn/BackToTopBtn.mdx +3 -3
- package/src/components/BackToTopBtn/BackToTopBtn.stories.ts +172 -11
- package/src/components/CollapsibleList/CollapsibleList.mdx +2 -2
- package/src/components/CollapsibleList/CollapsibleList.stories.ts +37 -1
- package/src/components/CopyBtn/CopyBtn.mdx +1 -1
- package/src/components/CopyBtn/CopyBtn.stories.ts +120 -1
- package/src/components/CopyBtn/CopyBtn.vue +1 -1
- package/src/components/Customs/CustomInputSelect/CustomInputSelect.mdx +6 -8
- package/src/components/Customs/CustomInputSelect/CustomInputSelect.stories.ts +270 -4
- package/src/components/Customs/CustomInputSelect/CustomInputSelect.vue +80 -53
- package/src/components/Customs/CustomInputSelect/config.ts +10 -0
- package/src/components/Customs/CustomSelect/CustomSelect.mdx +3 -3
- package/src/components/Customs/CustomSelect/CustomSelect.stories.ts +158 -2
- package/src/components/Customs/CustomSelect/CustomSelect.vue +25 -6
- package/src/components/Customs/CustomTextField/CustomTextField.mdx +44 -0
- package/src/components/Customs/CustomTextField/CustomTextField.stories.ts +403 -0
- package/src/components/Customs/CustomTextField/CustomTextField.vue +110 -0
- package/src/components/Customs/CustomTextField/tests/CustomTextField.spec.ts +93 -0
- package/src/components/Customs/CustomTextField/tests/__snapshots__/CustomTextField.spec.ts.snap +59 -0
- package/src/components/Customs/CustomTextField/types.d.ts +3 -0
- package/src/components/DataList/DataList.mdx +77 -0
- package/src/components/DataList/DataList.stories.ts +960 -0
- package/src/components/DataList/DataList.vue +140 -0
- package/src/components/DataList/DataListLoading/DataListLoading.vue +56 -0
- package/src/components/DataList/DataListLoading/tests/DataListLoading.spec.ts +23 -0
- package/src/components/DataList/locales.ts +3 -0
- package/src/components/DataList/tests/DataList.spec.ts +194 -0
- package/src/components/DataList/types.d.ts +23 -0
- package/src/components/DataListGroup/DataListGroup.mdx +77 -0
- package/src/components/DataListGroup/DataListGroup.stories.ts +987 -0
- package/src/components/DataListGroup/DataListGroup.vue +59 -0
- package/src/components/DataListGroup/tests/DataListGroup.spec.ts +54 -0
- package/src/components/DataListGroup/tests/data/dataListGroupItems.ts +41 -0
- package/src/components/DataListGroup/types.d.ts +15 -0
- package/src/components/DataListItem/DataListItem.vue +135 -0
- package/src/components/DataListItem/config.ts +17 -0
- package/src/components/DataListItem/locales.ts +3 -0
- package/src/components/DataListItem/tests/DataListItem.spec.ts +156 -0
- package/src/components/DataListItem/types.d.ts +23 -0
- package/src/components/DownloadBtn/Accessibilite.mdx +14 -0
- package/src/components/DownloadBtn/Accessibilite.stories.ts +166 -0
- package/src/components/DownloadBtn/AccessibiliteItems.ts +129 -0
- package/src/components/DownloadBtn/DownloadBtn.mdx +5 -6
- package/src/components/DownloadBtn/DownloadBtn.stories.ts +207 -2
- package/src/components/DownloadBtn/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/FooterBar/FooterBar.mdx +2 -2
- package/src/components/FooterBar/FooterBar.stories.ts +1 -1
- package/src/components/FranceConnectBtn/FranceConnectBtn.mdx +1 -1
- package/src/components/FranceConnectBtn/FranceConnectBtn.stories.ts +58 -1
- package/src/components/HeaderBar/HeaderBar.mdx +164 -45
- package/src/components/HeaderBar/HeaderBar.stories.ts +559 -15
- package/src/components/HeaderBar/HeaderBar.vue +60 -22
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.mdx +433 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.stories.ts +1089 -0
- package/src/components/HeaderBar/{HeaderComplexMenu/HeaderComplexMenu.vue → HeaderBurgerMenu/HeaderBurgerMenu.vue} +74 -45
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.mdx +38 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.stories.ts +89 -0
- package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuItem/tests/__snapshots__/HeaderMenuItem.spec.ts.snap +1 -1
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/HeaderMenuSection.mdx +17 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/HeaderMenuSection.stories.ts +121 -0
- package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuSection/HeaderMenuSection.vue +2 -2
- package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuSection/tests/HeaderMenuSection.spec.ts +1 -3
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.mdx +43 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.stories.ts +261 -0
- package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderSubMenu/HeaderSubMenu.vue +17 -3
- package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderSubMenu/tests/HeaderSubMenu.spec.ts +1 -1
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/HeaderBurgerMenu.spec.ts +180 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/HeaderBurgerMenu.spec.ts.snap +13 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/HeaderComplexMenu.spec.ts.snap +13 -0
- package/src/components/HeaderBar/HeaderLogo/HeaderLogo.vue +62 -25
- package/src/components/HeaderBar/HeaderLogo/tests/HeaderLogo.spec.ts +49 -1
- package/src/components/HeaderBar/HeaderMenuBtn/HeaderMenuBtn.vue +19 -23
- package/src/components/HeaderBar/HeaderMenuBtn/tests/HeaderMenuBtn.spec.ts +70 -0
- package/src/components/HeaderBar/Usages.mdx +85 -0
- package/src/components/HeaderBar/consts.scss +0 -1
- package/src/components/HeaderBar/tests/HeaderBar.spec.ts +8 -2
- package/src/components/HeaderBar/tests/__snapshots__/HeaderBar.spec.ts.snap +5 -10
- package/src/components/HeaderLoading/HeaderLoading.mdx +28 -0
- package/src/components/HeaderLoading/HeaderLoading.stories.ts +62 -0
- package/src/components/HeaderLoading/HeaderLoading.vue +45 -0
- package/src/components/HeaderLoading/tests/HeaderLoading.spec.ts +22 -0
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.mdx +128 -0
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.stories.ts +784 -0
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.vue +194 -0
- package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +74 -0
- package/src/components/HeaderNavigationBar/HorizontalNavbar/config.ts +18 -0
- package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +127 -0
- package/src/components/HeaderNavigationBar/types.ts +7 -0
- package/src/components/HeaderToolbar/HeaderToolbar.mdx +31 -0
- package/src/components/HeaderToolbar/HeaderToolbar.stories.ts +343 -0
- package/src/components/HeaderToolbar/HeaderToolbar.vue +487 -0
- package/src/components/HeaderToolbar/tests/HeaderToolbar.spec.ts +196 -0
- package/src/components/HeaderToolbar/types.d.ts +20 -0
- package/src/components/LangBtn/LangBtn.mdx +1 -1
- package/src/components/LangBtn/LangBtn.stories.ts +125 -8
- package/src/components/Logo/Logo.mdx +2 -2
- package/src/components/Logo/Logo.stories.ts +147 -1
- package/src/components/LogoBrandSection/LogoBrandSection.mdx +14 -0
- package/src/components/LogoBrandSection/LogoBrandSection.stories.ts +158 -0
- package/src/components/LogoBrandSection/LogoBrandSection.vue +312 -0
- package/src/components/LogoBrandSection/assets/ameli-pro.svg +1 -0
- package/src/components/LogoBrandSection/assets/ameli.svg +1 -0
- package/src/components/LogoBrandSection/assets/cnam.svg +1 -0
- package/src/components/LogoBrandSection/assets/compte-ameli.svg +1 -0
- package/src/components/LogoBrandSection/dividerDimensionsMapping.ts +14 -0
- package/src/components/LogoBrandSection/locales.ts +14 -0
- package/src/components/LogoBrandSection/secondaryLogoMapping.ts +24 -0
- package/src/components/LogoBrandSection/tests/LogoBrandSection.spec.ts +365 -0
- package/src/components/LogoBrandSection/tests/__snapshots__/LogoBrandSection.spec.ts.snap +14 -0
- package/src/components/LogoBrandSection/types.ts +8 -0
- package/src/components/NotificationBar/NotificationBar.mdx +6 -6
- package/src/components/NotificationBar/NotificationBar.stories.ts +1 -1
- package/src/components/NotificationBar/NotificationBar.vue +2 -2
- package/src/components/NotificationBar/tests/NotificationBar.spec.ts +1 -1
- package/src/components/PageContainer/PageContainer.mdx +1 -1
- package/src/components/PageContainer/PageContainer.stories.ts +86 -1
- package/src/components/PhoneField/PhoneField.mdx +49 -0
- package/src/components/PhoneField/PhoneField.stories.ts +869 -0
- package/src/components/PhoneField/PhoneField.vue +230 -0
- package/src/components/PhoneField/indicatifs.ts +104 -0
- package/src/components/PhoneField/locales.ts +4 -0
- package/src/components/PhoneField/tests/PhoneField.spec.ts +179 -0
- package/src/components/SkipLink/SkipLink.stories.ts +50 -1
- package/src/components/SocialMediaLinks/SocialMediaLinks.mdx +28 -1
- package/src/components/SocialMediaLinks/SocialMediaLinks.stories.ts +37 -1
- package/src/components/SubHeader/SubHeader.mdx +31 -0
- package/src/components/SubHeader/SubHeader.stories.ts +1032 -0
- package/src/components/SubHeader/SubHeader.vue +185 -0
- package/src/components/SubHeader/config.ts +12 -0
- package/src/components/SubHeader/locales.ts +3 -0
- package/src/components/SubHeader/tests/SubHeader.spec.ts +144 -0
- package/src/components/index.ts +24 -7
- package/src/composables/widthable/index.ts +29 -0
- package/src/composables/widthable/tests/widthable.spec.ts +52 -0
- package/src/designTokens/tokens/cnam/cnamLightTheme.ts +2 -2
- package/src/main.ts +1 -0
- package/src/modules.d.ts +4 -0
- package/src/services/index.ts +1 -0
- package/src/stories/Demarrer/Accueil.mdx +10 -0
- package/src/stories/Demarrer/Accueil.stories.ts +76 -0
- package/src/stories/Demarrer/PolitiqueDeConfidentialite.mdx +9 -0
- package/src/stories/Demarrer/PolitiqueDeConfidentialite.stories.ts +20 -0
- package/src/stories/Fondamentaux/Accessibilite/Accessibilite.mdx +1 -2
- package/src/stories/Fondamentaux/Accessibilite/Accessibilite.stories.ts +1 -1
- package/src/stories/Fondamentaux/EcoConception/Econception.stories.ts +1 -1
- package/src/stories/GuideDuDev/moduleDeNotification.mdx +52 -48
- package/src/stories/GuideDuDev/vuetifyOptions.mdx +31 -28
- package/src/stories/Guidelines/CustomisationEtThemes.mdx +1 -1
- package/src/utils/functions/throttleDisplayFn/tests/throttleDisplayFn.spec.ts +47 -0
- package/src/utils/functions/throttleDisplayFn/throttleDisplayFn.ts +26 -0
- package/src/utils/rules/exactLength/index.ts +33 -0
- package/src/utils/rules/exactLength/locales.ts +6 -0
- package/src/utils/rules/required/index.ts +25 -0
- package/src/utils/rules/required/locales.ts +5 -0
- package/src/utils/rules/required/ruleMessageHelper.ts +14 -0
- package/src/utils/rules/required/tests/index.spec.ts +47 -0
- package/src/utils/rules/required/tests/rulesMessageHelper.spec.ts +22 -0
- package/src/utils/rules/types.d.ts +15 -0
- package/src/components/Beta/beta.mdx +0 -5
- package/src/components/Deprecated/deprecated.mdx +0 -5
- package/src/components/HeaderBar/HeaderComplexMenu/HeaderComplexMenu.stories.ts +0 -272
- package/src/components/HeaderBar/HeaderComplexMenu/HeaderMenuItem/HeaderMenuItem.stories.ts +0 -49
- package/src/components/HeaderBar/HeaderComplexMenu/HeaderMenuSection/HeaderMenuSection.stories.ts +0 -56
- package/src/components/HeaderBar/HeaderComplexMenu/HeaderSubMenu/HeaderSubMenu.stories.ts +0 -137
- package/src/components/HeaderBar/HeaderComplexMenu/tests/HeaderComplexMenu.spec.ts +0 -129
- package/src/components/HeaderBar/HeaderComplexMenu/tests/__snapshots__/HeaderComplexMenu.spec.ts.snap +0 -18
- package/src/stories/Home/Accueil.mdx +0 -7
- package/src/stories/Home/PolitiqueDeConfidentialite.mdx +0 -4
- package/src/stories/Home/synapse.webp +0 -0
- /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuItem/HeaderMenuItem.vue +0 -0
- /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuItem/tests/HeaderMenuItem.spec.ts +0 -0
- /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/conts.ts +0 -0
- /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/locals.ts +0 -0
- /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/tests/useHandleSubMenus.spec.ts +0 -0
- /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/useHandleSubMenus.ts +0 -0
- /package/src/components/Logo/{types.d.ts → types.ts} +0 -0
|
@@ -5,7 +5,7 @@ import { ref } from 'vue'
|
|
|
5
5
|
import Alert from '../../Alert/Alert.vue'
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
|
-
title: '
|
|
8
|
+
title: 'Composants/Formulaires/CustomSelect',
|
|
9
9
|
component: CustomSelect,
|
|
10
10
|
parameters: {
|
|
11
11
|
layout: 'fullscreen',
|
|
@@ -23,6 +23,34 @@ export default meta
|
|
|
23
23
|
|
|
24
24
|
type Story = StoryObj<typeof meta>
|
|
25
25
|
export const Default: Story = {
|
|
26
|
+
parameters: {
|
|
27
|
+
sourceCode: [
|
|
28
|
+
{
|
|
29
|
+
name: 'Template',
|
|
30
|
+
code: `
|
|
31
|
+
<template>
|
|
32
|
+
<CustomSelect
|
|
33
|
+
v-model="value"
|
|
34
|
+
:items="items"
|
|
35
|
+
/>
|
|
36
|
+
</template>
|
|
37
|
+
`,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Script',
|
|
41
|
+
code: `
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
import CustomSelect from '@cnamts/CustomSelect'
|
|
44
|
+
|
|
45
|
+
const items = [
|
|
46
|
+
{ text: 'Option 1', value: '1' },
|
|
47
|
+
{ text: 'Option 2', value: '2' },
|
|
48
|
+
],
|
|
49
|
+
</script>
|
|
50
|
+
`,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
26
54
|
args: {
|
|
27
55
|
items: [
|
|
28
56
|
{ text: 'Option 1', value: '1' },
|
|
@@ -48,6 +76,35 @@ export const Default: Story = {
|
|
|
48
76
|
}
|
|
49
77
|
|
|
50
78
|
export const Outlined: Story = {
|
|
79
|
+
parameters: {
|
|
80
|
+
sourceCode: [
|
|
81
|
+
{
|
|
82
|
+
name: 'Template',
|
|
83
|
+
code: `
|
|
84
|
+
<template>
|
|
85
|
+
<CustomSelect
|
|
86
|
+
v-model="value"
|
|
87
|
+
:items="items"
|
|
88
|
+
outlined
|
|
89
|
+
/>
|
|
90
|
+
</template>
|
|
91
|
+
`,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'Script',
|
|
95
|
+
code: `
|
|
96
|
+
<script setup lang="ts">
|
|
97
|
+
import CustomSelect from '@cnamts/CustomSelect'
|
|
98
|
+
|
|
99
|
+
const items = [
|
|
100
|
+
{ text: 'Option 1', value: '1' },
|
|
101
|
+
{ text: 'Option 2', value: '2' },
|
|
102
|
+
],
|
|
103
|
+
</script>
|
|
104
|
+
`,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
51
108
|
args: {
|
|
52
109
|
items: [
|
|
53
110
|
{ text: 'Option 1', value: '1' },
|
|
@@ -73,11 +130,41 @@ export const Outlined: Story = {
|
|
|
73
130
|
}
|
|
74
131
|
|
|
75
132
|
export const Required: Story = {
|
|
133
|
+
parameters: {
|
|
134
|
+
sourceCode: [
|
|
135
|
+
{
|
|
136
|
+
name: 'Template',
|
|
137
|
+
code: `
|
|
138
|
+
<template>
|
|
139
|
+
<CustomSelect
|
|
140
|
+
v-model="value"
|
|
141
|
+
:items="items"
|
|
142
|
+
required
|
|
143
|
+
/>
|
|
144
|
+
</template>
|
|
145
|
+
`,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'Script',
|
|
149
|
+
code: `
|
|
150
|
+
<script setup lang="ts">
|
|
151
|
+
import CustomSelect from '@cnamts/CustomSelect'
|
|
152
|
+
|
|
153
|
+
const items = [
|
|
154
|
+
{ text: 'Option 1', value: '1' },
|
|
155
|
+
{ text: 'Option 2', value: '2' },
|
|
156
|
+
],
|
|
157
|
+
</script>
|
|
158
|
+
`,
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
},
|
|
76
162
|
args: {
|
|
77
163
|
items: [
|
|
78
164
|
{ text: 'Option 1', value: '1' },
|
|
79
165
|
{ text: 'Option 2', value: '2' },
|
|
80
166
|
],
|
|
167
|
+
required: true,
|
|
81
168
|
},
|
|
82
169
|
render: (args) => {
|
|
83
170
|
return {
|
|
@@ -89,7 +176,7 @@ export const Required: Story = {
|
|
|
89
176
|
<div class="d-flex flex-wrap align-center pa-4">
|
|
90
177
|
<CustomSelect
|
|
91
178
|
v-bind="args"
|
|
92
|
-
required
|
|
179
|
+
:required="args.required"
|
|
93
180
|
/>
|
|
94
181
|
</div>
|
|
95
182
|
`,
|
|
@@ -98,6 +185,45 @@ export const Required: Story = {
|
|
|
98
185
|
}
|
|
99
186
|
|
|
100
187
|
export const withCustomError: Story = {
|
|
188
|
+
parameters: {
|
|
189
|
+
sourceCode: [
|
|
190
|
+
{
|
|
191
|
+
name: 'Template',
|
|
192
|
+
code: `
|
|
193
|
+
<template>
|
|
194
|
+
<CustomSelect
|
|
195
|
+
v-model="value"
|
|
196
|
+
:items="items"
|
|
197
|
+
:error-messages="errorMessages"
|
|
198
|
+
/>
|
|
199
|
+
<VBtn @click="triggerError">
|
|
200
|
+
Trigger Error
|
|
201
|
+
</VBtn>
|
|
202
|
+
</template>
|
|
203
|
+
`,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: 'Script',
|
|
207
|
+
code: `
|
|
208
|
+
<script setup lang="ts">
|
|
209
|
+
import CustomSelect from '@cnamts/CustomSelect'
|
|
210
|
+
import { ref } from 'vue'
|
|
211
|
+
|
|
212
|
+
const items = [
|
|
213
|
+
{ text: 'Option 1', value: '1' },
|
|
214
|
+
{ text: 'Option 2', value: '2' },
|
|
215
|
+
],
|
|
216
|
+
|
|
217
|
+
const errorMessages = ref([])
|
|
218
|
+
|
|
219
|
+
const triggerError = () => {
|
|
220
|
+
errorMessages.value = ['This is a test error message']
|
|
221
|
+
}
|
|
222
|
+
</script>
|
|
223
|
+
`,
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
},
|
|
101
227
|
args: {
|
|
102
228
|
items: [
|
|
103
229
|
{ text: 'Option 1', value: '1' },
|
|
@@ -133,6 +259,36 @@ export const withCustomError: Story = {
|
|
|
133
259
|
}
|
|
134
260
|
|
|
135
261
|
export const withCustomKey: Story = {
|
|
262
|
+
parameters: {
|
|
263
|
+
sourceCode: [
|
|
264
|
+
{
|
|
265
|
+
name: 'Template',
|
|
266
|
+
code: `
|
|
267
|
+
<template>
|
|
268
|
+
<CustomSelect
|
|
269
|
+
v-model="value"
|
|
270
|
+
:items="items"
|
|
271
|
+
text-key="customKey"
|
|
272
|
+
outlined
|
|
273
|
+
/>
|
|
274
|
+
</template>
|
|
275
|
+
`,
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: 'Script',
|
|
279
|
+
code: `
|
|
280
|
+
<script setup lang="ts">
|
|
281
|
+
import CustomSelect from '@cnamts/CustomSelect'
|
|
282
|
+
|
|
283
|
+
const items = [
|
|
284
|
+
{ customKey: 'Choix 1', value: '1' },
|
|
285
|
+
{ customKey: 'Choix 2', value: '2' },
|
|
286
|
+
],
|
|
287
|
+
</script>
|
|
288
|
+
`,
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
},
|
|
136
292
|
args: {
|
|
137
293
|
items: [
|
|
138
294
|
{ customKey: 'Choix 1', value: '1' },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { mdiMenuDown } from '@mdi/js'
|
|
2
|
+
import { mdiInformation, mdiMenuDown } from '@mdi/js'
|
|
3
3
|
import { ref, watch, computed, type PropType } from 'vue'
|
|
4
4
|
import { VIcon, VTextField, VList, VListItem, VListItemTitle } from 'vuetify/components'
|
|
5
5
|
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
const isOpen = ref(false)
|
|
48
48
|
const selectedItem = ref<Record<string, unknown > | string | null>(props.modelValue)
|
|
49
|
+
const hasError = ref(false)
|
|
49
50
|
|
|
50
51
|
const toggleMenu = () => {
|
|
51
52
|
isOpen.value = !isOpen.value
|
|
@@ -91,10 +92,15 @@
|
|
|
91
92
|
watch(() => props.modelValue, (newValue) => {
|
|
92
93
|
selectedItem.value = newValue
|
|
93
94
|
})
|
|
95
|
+
|
|
96
|
+
watch(isOpen, (newValue) => {
|
|
97
|
+
hasError.value = !newValue && !selectedItem.value && isRequired.value
|
|
98
|
+
})
|
|
99
|
+
|
|
94
100
|
</script>
|
|
95
101
|
|
|
96
102
|
<template>
|
|
97
|
-
<div
|
|
103
|
+
<div>
|
|
98
104
|
<VTextField
|
|
99
105
|
:id="inputId"
|
|
100
106
|
ref="input"
|
|
@@ -114,7 +120,17 @@
|
|
|
114
120
|
@keydown.enter.prevent="toggleMenu"
|
|
115
121
|
@keydown.space.prevent="toggleMenu"
|
|
116
122
|
>
|
|
117
|
-
<
|
|
123
|
+
<template #append-inner>
|
|
124
|
+
<VIcon
|
|
125
|
+
v-if="hasError"
|
|
126
|
+
class="mr-6"
|
|
127
|
+
>
|
|
128
|
+
{{ mdiInformation }}
|
|
129
|
+
</VIcon>
|
|
130
|
+
<VIcon>
|
|
131
|
+
{{ mdiMenuDown }}
|
|
132
|
+
</VIcon>
|
|
133
|
+
</template>
|
|
118
134
|
</VTextField>
|
|
119
135
|
<VList
|
|
120
136
|
v-if="isOpen"
|
|
@@ -146,6 +162,7 @@
|
|
|
146
162
|
.custom-select {
|
|
147
163
|
display: flex;
|
|
148
164
|
flex-direction: column;
|
|
165
|
+
min-width: 225px;
|
|
149
166
|
}
|
|
150
167
|
|
|
151
168
|
.v-field {
|
|
@@ -153,7 +170,7 @@
|
|
|
153
170
|
}
|
|
154
171
|
.v-field--focused {
|
|
155
172
|
.v-icon {
|
|
156
|
-
transform: rotateX(180deg)
|
|
173
|
+
transform: rotateX(180deg);
|
|
157
174
|
}
|
|
158
175
|
}
|
|
159
176
|
|
|
@@ -181,8 +198,10 @@
|
|
|
181
198
|
.v-icon {
|
|
182
199
|
position: absolute;
|
|
183
200
|
right: 10px;
|
|
184
|
-
top: 50%;
|
|
185
|
-
transform: translateY(-50%);
|
|
186
201
|
color: tokens.$grey-darken-20;
|
|
187
202
|
}
|
|
203
|
+
|
|
204
|
+
:deep(.v-field__input) {
|
|
205
|
+
color: tokens.$grey-darken-20
|
|
206
|
+
}
|
|
188
207
|
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls, Source } from '@storybook/blocks';
|
|
2
|
+
import * as CustomTextFieldStories from "./CustomTextField.stories";
|
|
3
|
+
|
|
4
|
+
<Meta of={CustomTextFieldStories} />
|
|
5
|
+
|
|
6
|
+
# CustomTextField
|
|
7
|
+
|
|
8
|
+
Le composant `CustomTextField` est utilisé pour proposer une alternative au `TextField` de Vuetify, conforme au style du design-system et qui respecte les règles d'accessibilité RGAA.
|
|
9
|
+
|
|
10
|
+
<Canvas of={CustomTextFieldStories.Default} />
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# API
|
|
14
|
+
|
|
15
|
+
<Controls of={CustomTextFieldStories.Default} />
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# Exemple d'utilisation
|
|
19
|
+
|
|
20
|
+
<Source
|
|
21
|
+
dark code={`
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { ref } from 'vue'
|
|
24
|
+
import CustomSelect from '@cnamts/synapse'
|
|
25
|
+
|
|
26
|
+
const model = ref('')
|
|
27
|
+
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<main class="ma-12">
|
|
32
|
+
Text saisie: {{ model }}
|
|
33
|
+
<div class="d-flex flex-wrap align-center">
|
|
34
|
+
<CustomTextField
|
|
35
|
+
v-model="model"
|
|
36
|
+
label="Label"
|
|
37
|
+
color="primary"
|
|
38
|
+
is-clearable
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
</main>
|
|
42
|
+
</template>
|
|
43
|
+
`}
|
|
44
|
+
/>
|