Skip to content

Commit 9890856

Browse files
authored
Merge pull request #847 from dnum-mi/develop
Develop
2 parents 1252bfa + 52e18f0 commit 9890856

File tree

22 files changed

+2351
-1811
lines changed

22 files changed

+2351
-1811
lines changed

demo-app/App.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import DsfrHeader, { type DsfrHeaderProps } from '../src/components/DsfrHeader/D
1010
import DsfrNavigation, { type DsfrNavigationProps } from '../src/components/DsfrNavigation/DsfrNavigation.vue'
1111
import DsfrSkipLinks, { type DsfrSkipLinksProps } from '../src/components/DsfrSkipLinks/DsfrSkipLinks.vue'
1212
import DsfrBreadcrumb from '../src/components/DsfrBreadcrumb/DsfrBreadcrumb.vue'
13+
import DsfrFooter from '../src/components/DsfrFooter/DsfrFooter.vue'
1314
1415
const toaster = useToaster()
1516
@@ -298,6 +299,10 @@ const currentRoute = computed(() => route.name)
298299
:licence-link-props="licenceLinkProps"
299300
:after-mandatory-links="afterMandatoryLinks"
300301
:before-mandatory-links="beforeMandatoryLinks"
302+
operator-img-src="https://loremflickr.com/300/200/cat"
303+
operator-img-alt="L'opérateur petit chat"
304+
operator-to="/"
305+
:operator-img-style="{ 'margin-left': '0.5px', padding: '1rem', 'max-width': '15rem' }"
301306
/>
302307
</div>
303308

demo-app/views/SimpleModal.vue

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
<script setup>
2-
import { ref } from 'vue'
1+
<script setup lang="ts">
2+
import { ref, reactive, onMounted, watchEffect } from 'vue'
33
import DsfrModal from '@/components/DsfrModal/DsfrModal.vue'
4+
import type { Preferences, UseSchemeResult } from '@/composables/index'
5+
import { useScheme } from '@/composables/index'
6+
import lightThemeSvg from '@gouvfr/dsfr/dist/artwork/pictograms/environment/sun.svg'
7+
import darkThemeSvg from '@gouvfr/dsfr/dist/artwork/pictograms/environment/moon.svg'
8+
import systemThemeSvg from '@gouvfr/dsfr/dist/artwork/pictograms/system/system.svg'
49
510
const isModalOpen = ref(false)
11+
const isThemeModalOpen = ref(false)
612
const displayAlert = ref(false)
713
const close = () => {
814
displayAlert.value = false
@@ -29,6 +35,41 @@ const actions = [
2935
onClick: () => { isModalOpen.value = false },
3036
},
3137
]
38+
39+
const preferences: Preferences = reactive({
40+
theme: 'light',
41+
scheme: 'light',
42+
})
43+
44+
onMounted(() => {
45+
const { theme, scheme, setScheme } = useScheme() as UseSchemeResult
46+
preferences.scheme = scheme.value
47+
48+
watchEffect(() => {
49+
preferences.theme = theme.value
50+
})
51+
52+
watchEffect(() => setScheme(preferences.scheme))
53+
})
54+
55+
const options = [
56+
{
57+
label: 'Thème clair',
58+
value: 'light',
59+
svgPath: lightThemeSvg,
60+
},
61+
{
62+
label: 'Thème sombre',
63+
value: 'dark',
64+
svgPath: darkThemeSvg,
65+
},
66+
{
67+
label: 'Thème système',
68+
value: 'system',
69+
hint: 'Utilise les paramètres système',
70+
svgPath: systemThemeSvg,
71+
},
72+
]
3273
</script>
3374

3475
<template>
@@ -37,10 +78,45 @@ const actions = [
3778
class="my-1"
3879
@click="isModalOpen = true"
3980
>
40-
Open modal
81+
Ouvrir modal
4182
</DsfrButton>
4283
</div>
4384

85+
<DsfrButton
86+
ref="modalOrigin"
87+
label="Changer le thème"
88+
@click="isThemeModalOpen = true"
89+
/>
90+
<DsfrModal
91+
:opened="isThemeModalOpen"
92+
title="Changer le thème"
93+
:origin="$refs.modalOrigin"
94+
@close="isThemeModalOpen = false"
95+
>
96+
<DsfrRadioButtonSet
97+
v-model="preferences.scheme"
98+
:options="options"
99+
name="theme-selector"
100+
legend="Choisissez un thème pour personnaliser l’apparence du site."
101+
/>
102+
</DsfrModal>
103+
104+
<DsfrModal
105+
v-if="isThemeModalOpen"
106+
title="Exemple de modale"
107+
:opened="isModalOpen"
108+
:actions="actions"
109+
@close="isModalOpen = false"
110+
>
111+
<DsfrAlert
112+
:closed="!displayAlert"
113+
type="success"
114+
small
115+
description="Opération terminée avec succès"
116+
/>
117+
Ceci est une modale. Elle peut se fermer sans aucun changement au clic sur le bouton "Fermer" ou bien simplement avec la touche <kbd>Échap</kbd>
118+
</DsfrModal>
119+
44120
<DsfrModal
45121
title="Exemple de modale"
46122
:opened="isModalOpen"

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
"import": "./dist/vue-dsfr.css"
2222
}
2323
},
24-
"main": "./dist/vue-dsfr.js",
24+
"main": "./dist/vue-dsfr.umd.cjs",
2525
"module": "./dist/vue-dsfr.js",
26-
"types": "./types/index.d.ts",
26+
"types": "./types",
2727
"files": [
2828
"LICENSE",
2929
"README.md",
@@ -128,6 +128,7 @@
128128
"eslint-plugin-vue": "^9.26.0",
129129
"husky": "^9.0.11",
130130
"jsdom": "^24.0.0",
131+
"lightningcss": "^1.25.1",
131132
"lint-staged": "^15.2.2",
132133
"npm-run-all": "^4.1.5",
133134
"p-debounce": "^4.0.0",

0 commit comments

Comments
 (0)