Skip to content

Commit 8a1328f

Browse files
authored
Merge pull request #310 from dnum-mi/develop
RC9
2 parents f4cfee3 + 2e40367 commit 8a1328f

38 files changed

+2182
-1223
lines changed

.storybook/main.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ module.exports = {
1919
// builder: 'webpack5'
2020
// }
2121
core: {
22-
builder: 'storybook-builder-vite',
23-
},
24-
}
22+
builder: "@storybook/builder-vite"
23+
}
24+
};

package-lock.json

+1,721-1,004
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+28-28
Original file line numberDiff line numberDiff line change
@@ -82,69 +82,70 @@
8282
"vue-tsc": "vue-tsc --declaration --emitDeclarationOnly"
8383
},
8484
"dependencies": {
85-
"@gouvfr/dsfr": "^1.3.1",
85+
"@gouvfr/dsfr": "^1.4.1",
8686
"focus-trap": "^6.7.3",
8787
"focus-trap-vue": "^3.2.1",
8888
"oh-vue-icons": "^1.0.0-rc2",
8989
"vue": "^3.2.31"
9090
},
9191
"devDependencies": {
92-
"@babel/core": "^7.17.8",
92+
"@babel/core": "^7.17.9",
9393
"@babel/eslint-parser": "^7.17.0",
9494
"@babel/plugin-syntax-jsx": "^7.16.7",
9595
"@babel/preset-env": "^7.16.11",
9696
"@cypress/vite-dev-server": "^2.2.2",
9797
"@cypress/vue": "^3.1.1",
9898
"@rollup/plugin-alias": "^3.1.9",
9999
"@rollup/plugin-babel": "^5.3.1",
100-
"@rollup/plugin-commonjs": "^21.0.2",
100+
"@rollup/plugin-commonjs": "^21.0.3",
101101
"@rollup/plugin-node-resolve": "^13.1.3",
102102
"@rollup/plugin-replace": "^4.0.0",
103103
"@rollup/plugin-url": "^6.1.0",
104104
"@rushstack/eslint-patch": "^1.1.1",
105-
"@storybook/addon-actions": "^6.4.19",
106-
"@storybook/addon-docs": "^6.4.19",
107-
"@storybook/addon-essentials": "^6.4.19",
108-
"@storybook/addon-links": "^6.4.19",
105+
"@storybook/addon-actions": "^6.4.20",
106+
"@storybook/addon-docs": "^6.4.20",
107+
"@storybook/addon-essentials": "^6.4.20",
108+
"@storybook/addon-links": "^6.4.20",
109109
"@storybook/addon-postcss": "^2.0.0",
110-
"@storybook/builder-webpack5": "^6.4.19",
111-
"@storybook/client-api": "^6.4.19",
112-
"@storybook/core-common": "^6.4.19",
113-
"@storybook/manager-webpack5": "^6.4.19",
114-
"@storybook/vue3": "^6.4.19",
115-
"@testing-library/jest-dom": "^5.16.3",
116-
"@testing-library/user-event": "^13.5.0",
110+
"@storybook/builder-vite": "^0.1.24",
111+
"@storybook/builder-webpack5": "^6.4.20",
112+
"@storybook/client-api": "^6.4.20",
113+
"@storybook/core-common": "^6.4.20",
114+
"@storybook/manager-webpack5": "^6.4.20",
115+
"@storybook/vue3": "^6.4.20",
116+
"@testing-library/jest-dom": "^5.16.4",
117+
"@testing-library/user-event": "^14.0.4",
117118
"@testing-library/vue": "^6.5.1",
118119
"@types/jest": "^27.4.1",
119120
"@types/jsdom": "^16.2.14",
120121
"@types/node": "^17.0.23",
121122
"@types/vue": "^2.0.0",
122-
"@typescript-eslint/eslint-plugin": "^5.16.0",
123-
"@typescript-eslint/parser": "^5.16.0",
124-
"@vitejs/plugin-vue": "^2.2.4",
125-
"@vitejs/plugin-vue-jsx": "^1.3.8",
123+
"@typescript-eslint/eslint-plugin": "^5.18.0",
124+
"@typescript-eslint/parser": "^5.18.0",
125+
"@vitejs/plugin-vue": "^2.3.1",
126+
"@vitejs/plugin-vue-jsx": "^1.3.9",
126127
"@vue/compiler-sfc": "^3.2.31",
127128
"@vue/eslint-config-standard": "^6.1.0",
128129
"@vue/eslint-config-typescript": "^10.0.0",
129-
"@vue/test-utils": "^2.0.0-rc.18",
130+
"@vue/test-utils": "2.0.0-rc.19",
130131
"@vue/tsconfig": "^0.1.3",
131132
"autoprefixer": "^10.4.4",
132-
"babel-loader": "^8.2.3",
133+
"babel-loader": "^8.2.4",
133134
"babel-plugin-transform-import-meta": "^2.1.1",
134-
"chalk": "^5.0.1",
135135
"c8": "^7.11.0",
136+
"chalk": "^5.0.1",
136137
"copyfiles": "^2.4.1",
137138
"core-js": "^3.21.1",
138139
"cross-env": "^7.0.3",
139-
"cypress": "^9.5.2",
140+
"cypress": "^9.5.3",
140141
"cypress-plugin-tab": "^1.0.5",
141-
"eslint": "^8.11.0",
142+
"eslint": "^8.12.0",
142143
"eslint-plugin-cypress": "^2.12.1",
143-
"eslint-plugin-import": "^2.25.4",
144+
"eslint-plugin-import": "^2.26.0",
144145
"eslint-plugin-node": "^11.1.0",
145146
"eslint-plugin-promise": "^6.0.0",
146147
"eslint-plugin-storybook": "^0.5.7",
147-
"eslint-plugin-vue": "^8.5.0",
148+
"eslint-plugin-vue": "^8.6.0",
148149
"globby": "^13.1.1",
149150
"inquirer": "^8.2.2",
150151
"jsdom": "^19.0.0",
@@ -167,11 +168,10 @@
167168
"rollup-plugin-vue": "^6.0.0",
168169
"semantic-release": "^19.0.2",
169170
"start-server-and-test": "^1.14.0",
170-
"storybook-builder-vite": "^0.1.21",
171171
"tsd-jsdoc": "^2.5.0",
172172
"typescript": "^4.6.3",
173-
"vite": "^2.8.6",
174-
"vitest": "^0.7.11",
173+
"vite": "^2.9.1",
174+
"vitest": "^0.9.0",
175175
"vue-loader": "^17.0.0",
176176
"vue-router": "^4.0.14",
177177
"vue-router-mock": "^0.1.7",

src/components/DsfrAccordion/DsfrAccordion.stories.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ AccordeonDansUnAccordeon.args = {
137137
export const AccordeonTitreCustom = (args) => ({
138138
components: {
139139
DsfrAccordion,
140-
DsfrAccordionsGroup
140+
DsfrAccordionsGroup,
141141
},
142142

143143
data () {
@@ -178,5 +178,5 @@ export const AccordeonTitreCustom = (args) => ({
178178
AccordeonTitreCustom.args = {
179179
dark: false,
180180
title1: 'Un titre d’accordéon customisé',
181-
title2: 'Un autre titre d’accordéon'
181+
title2: 'Un autre titre d’accordéon',
182182
}

src/components/DsfrAccordion/DsfrAccordion.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default defineComponent({
5050
:aria-controls="id"
5151
@click="toggleExpanded()"
5252
>
53-
<!-- @slot Slot pour le contenu personnalisé du titre de l’accordéon. Une props du même nom est utilisable pour du texte simple sans mise en forme. -->
53+
<!-- @slot Slot pour le contenu personnalisé du titre de l’accordéon. Une props du même nom est utilisable pour du texte simple sans mise en forme. -->
5454
<slot name="title">
5555
<span>{{ title }}</span>
5656
</slot>

src/components/DsfrAlert/DsfrAlert.e2e.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('DsfrAlert', () => {
3333
.should('be.visible')
3434
.contains(description)
3535

36-
cy.get('.close-icon')
36+
cy.get('.fr-btn--close')
3737
.should('be.visible')
3838
})
3939

src/components/DsfrAlert/DsfrAlert.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('DsfrAlert', () => {
6363
await fireEvent.click(closeBtn)
6464

6565
// Then
66-
expect(closeBtn).toHaveClass('close-icon')
66+
expect(closeBtn).toHaveClass('fr-btn--close')
6767
expect(emitted()).toHaveProperty('close')
6868
expect(emitted().close).toHaveLength(1)
6969
})

src/components/DsfrAlert/DsfrAlert.vue

+2-56
Original file line numberDiff line numberDiff line change
@@ -85,71 +85,17 @@ export default defineComponent({
8585
</div>
8686
<button
8787
v-if="closeable"
88-
class="close-icon"
88+
class="fr-btn fr-btn--close"
8989
title="Fermer"
9090
aria-label="Fermer"
9191
@click="onClick"
92-
>
93-
<VIcon
94-
scale="1"
95-
name="ri-close-line"
96-
/>
97-
</button>
92+
/>
9893
</div>
9994
</transition>
10095
</template>
10196

10297
<style src="@gouvfr/dsfr/dist/component/alert/alert.main.min.css" />
10398

10499
<style scoped>
105-
.fr-alert,
106-
.close-icon {
107-
color: var(--text-default-grey);
108-
}
109100
110-
.fr-alert--info::before,
111-
.fr-alert--warning::before,
112-
.fr-alert--success::before,
113-
.fr-alert--error::before
114-
{
115-
height: 40px;
116-
}
117-
.fr-alert--sm {
118-
padding: .575rem 2.25rem .75rem 3.5rem;
119-
height: 40px;
120-
& .fr-alert__description {
121-
margin: 0;
122-
}
123-
}
124-
125-
.alert-content {
126-
display: flex;
127-
flex-direction: column;
128-
}
129-
.close-icon {
130-
position: absolute;
131-
top: 0.25rem;
132-
right: 0.25rem;
133-
width: 2rem;
134-
height: 2rem;
135-
136-
&:hover {
137-
border-radius: 1rem;
138-
}
139-
}
140-
141-
/* Enter and leave animations can use different */
142-
/* durations and timing functions. */
143-
/* .slide-fade-enter-active {
144-
transition: all 0.5s ease-out;
145-
}
146-
.slide-fade-leave-active {
147-
transition: all 0.5s cubic-bezier(1, 0.5, 0.8, 1);
148-
}
149-
.slide-fade-enter-from,
150-
.slide-fade-leave-to {
151-
transform: translateY(-100%);
152-
opacity: 0;
153-
}
154-
*/
155101
</style>
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { render } from '@testing-library/vue'
2+
// import '@gouvfr/dsfr/dist/core/core.module.js'
3+
4+
import DsfrBadge from './DsfrBadge.vue'
5+
6+
describe('DsfrBadge', () => {
7+
it('should render a success badge', async () => {
8+
const label = 'Succès'
9+
const type = 'success'
10+
11+
const { getByText } = render(DsfrBadge, {
12+
props: {
13+
label,
14+
type,
15+
},
16+
})
17+
18+
const badge = getByText(label).parentElement
19+
20+
expect(badge).toHaveClass('fr-badge')
21+
expect(badge).not.toHaveClass('fr-badge--sm')
22+
expect(badge).toHaveClass(`fr-badge--${type}`)
23+
})
24+
25+
it('should render a small error badge', async () => {
26+
const label = 'Error'
27+
const type = 'error'
28+
29+
const { getByText } = render(DsfrBadge, {
30+
props: {
31+
label,
32+
type,
33+
small: true,
34+
},
35+
})
36+
37+
const badge = getByText(label).parentElement
38+
39+
expect(badge).toHaveClass('fr-badge')
40+
expect(badge).toHaveClass('fr-badge--sm')
41+
expect(badge).toHaveClass(`fr-badge--${type}`)
42+
})
43+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import DsfrBadge from './DsfrBadge.vue'
2+
3+
export default {
4+
component: DsfrBadge,
5+
title: 'Composants/Badge - DsfrBadge',
6+
argTypes: {
7+
dark: {
8+
control: 'boolean',
9+
description: 'Permet de voir le composant dans les deux **thèmes** : **clair** (`false`, défaut) et **sombre** (`true`).\n\n*N.B. : Ne fait pas partie du composant.*',
10+
},
11+
label: {
12+
control: 'text',
13+
description: 'Label (texte) du badge',
14+
},
15+
type: {
16+
options: ['error', 'success', 'new', 'info', 'warning', undefined],
17+
control: 'radio',
18+
description: '(Optionnel) **Type** du badge : `error` (Erreur), `success` (Succès), `new` (Nouveau), `info` (Information), `warning` (Avertissement)',
19+
},
20+
noIcon: {
21+
control: 'boolean',
22+
description: 'Permet de ne pas afficher d’icône (si `true`)',
23+
},
24+
small: {
25+
control: 'boolean',
26+
description: 'Permet d’afficher une petite icône (si `true`)',
27+
},
28+
},
29+
}
30+
31+
export const Badge = (args) => ({
32+
components: {
33+
DsfrBadge,
34+
},
35+
data () {
36+
return args
37+
},
38+
template: `
39+
<DsfrBadge :label="label" :small="small" :type="type" :no-icon="noIcon" />
40+
`,
41+
mounted () {
42+
document.body.parentElement.setAttribute('data-fr-theme', this.dark ? 'dark' : 'light')
43+
},
44+
})
45+
Badge.args = {
46+
dark: false,
47+
small: false,
48+
type: 'success',
49+
label: 'Succès au chocolat vert',
50+
noIcon: false,
51+
}
52+
53+
export const TousLesBadges = (args) => ({
54+
components: {
55+
DsfrBadge,
56+
},
57+
data () {
58+
return args
59+
},
60+
template: `
61+
<p>
62+
<DsfrBadge label="Simple" />
63+
</p>
64+
<p>
65+
<DsfrBadge style="width: 300px" ellipsis label="Label très long qui, normalement, devrait être coupé par une ellipse" />
66+
</p>
67+
<p>
68+
<DsfrBadge label="Succès" type="success" />
69+
</p>
70+
<p>
71+
<DsfrBadge label="Erreur" type="error" />
72+
</p>
73+
<p>
74+
<DsfrBadge label="Attention !" type="warning" />
75+
</p>
76+
<p>
77+
<DsfrBadge label="Information" type="info" />
78+
</p>
79+
<p>
80+
<DsfrBadge label="Nouveauté" type="new" />
81+
</p>
82+
`,
83+
mounted () {
84+
document.body.parentElement.setAttribute('data-fr-theme', this.dark ? 'dark' : 'light')
85+
},
86+
})
87+
TousLesBadges.args = {
88+
dark: false,
89+
}

0 commit comments

Comments
 (0)