diff --git a/CHANGELOG.md b/CHANGELOG.md index ae4a917..15f6f1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.9] - 2025-07-24 +### Added +- Message component + +### Changed +- Badge compoent icon + ## [1.0.8] - 2025-07-23 ### Added - ProgressBar component diff --git a/README.md b/README.md index 11390d3..44e4ef0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # visua-vue -**Current version: v1.0.8** \ No newline at end of file +**Current version: v1.0.9** \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index f5dab22..2cc8904 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@cellule-financiere-pmo/visua-vue", - "version": "1.0.8", + "version": "1.0.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@cellule-financiere-pmo/visua-vue", - "version": "1.0.8", + "version": "1.0.9", "license": "ISC", "dependencies": { "@cellule-financiere-pmo/visua": "1.1.3", diff --git a/package.json b/package.json index 4f3f114..04b8ff0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cellule-financiere-pmo/visua-vue", - "version": "1.0.8", + "version": "1.0.9", "type": "module", "scripts": { "dev": "vite", diff --git a/src/App.vue b/src/App.vue index 9c3f67f..61efa4d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,20 +5,22 @@ // import VAccordionView from '../template/VAccordionView.vue'; // import VInputView from '../template/VInputView.vue'; // import VCheckboxView from '../template/VCheckboxView.vue'; -// import VBadgeView from '../template/VBadgeView.vue'; -// import VSelectView from '../template/VSelectView.vue'; -import VProgressBarView from '../template/VProgressBarView.vue'; +import VBadgeView from '../template/VBadgeView.vue'; +import VSelectView from '../template/VSelectView.vue'; +// import VProgressBarView from '../template/VProgressBarView.vue'; +import VMessageView from '../template/VMessageView.vue'; diff --git a/src/components/badge/VBadge.vue b/src/components/badge/VBadge.vue index e474e5d..49c2c7b 100644 --- a/src/components/badge/VBadge.vue +++ b/src/components/badge/VBadge.vue @@ -23,11 +23,11 @@ const severity = computed(() => { const icon = computed(() => { switch (props.type) { - case 'error': return 'ri-close-circle-line'; - case 'warning' : return 'ri-alert-line'; - case 'success' : return 'ri-checkbox-circle-line'; - case 'info': return 'ri-information-line'; - case 'new': return 'ri-flashlight-line'; + case 'error': return 'ri-spam-fill'; + case 'warning' : return 'ri-alert-fill'; + case 'success' : return 'ri-checkbox-circle-fill'; + case 'info': return 'ri-information-fill'; + case 'new': return 'ri-flashlight-fill'; default: return undefined; } @@ -45,7 +45,7 @@ const limit = computed(() => props.maxWidth); class="p-tag" :class="{'small': props.small}" > - + {{ props.label }} diff --git a/src/components/message/IVMessage.type.ts b/src/components/message/IVMessage.type.ts new file mode 100644 index 0000000..9d03036 --- /dev/null +++ b/src/components/message/IVMessage.type.ts @@ -0,0 +1,25 @@ +/** + * Interface representing the structure of a message notice component. + */ +export default interface IVMessage { + /** + * The title or main text of the notice. + */ + title: string; + + /** + * The type of notice, which affects its visual style and semantics. + * - `info`: Informational message + * - `warning`: Warning message + * - `alert`: Error or critical alert + * - `success`: Confirmation or success message + * - undefined: No specific type + */ + type?: 'info' | 'warning' | 'alert' | 'success' | undefined; + + /** + * If true, the notice can be closed by the user. + * @default false + */ + closable?: boolean; +} diff --git a/src/components/message/VMessage.vue b/src/components/message/VMessage.vue new file mode 100644 index 0000000..b834126 --- /dev/null +++ b/src/components/message/VMessage.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/test/VMessage.spec.ts b/test/VMessage.spec.ts new file mode 100644 index 0000000..5804f37 --- /dev/null +++ b/test/VMessage.spec.ts @@ -0,0 +1,37 @@ +import { describe, it, expect } from 'vitest' +import { mount } from '@vue/test-utils' +import VMessage from '../src/components/message/VMessage.vue' + +describe('VMessage.vue', () => { + it('renders the title', () => { + const wrapper = mount(VMessage, { + props: { title: 'Test Message' } + }) + expect(wrapper.text()).toContain('Test Message') + }) + + it('shows the correct icon class for type "alert"', () => { + const wrapper = mount(VMessage, { + props: { title: 'Alert Message', type: 'alert' } + }) + const icon = wrapper.find('i') + expect(icon.classes()).toContain('ri-spam-fill') + }) + + it('shows the close button if closable is true', () => { + const wrapper = mount(VMessage, { + props: { title: 'Closable Message', closable: true } + }) + const button = wrapper.find('button[aria-label="Fermer"]') + expect(button.exists()).toBe(true) + }) + + it('emits close event when close button is clicked', async () => { + const wrapper = mount(VMessage, { + props: { title: 'Closable Message', closable: true } + }) + const button = wrapper.find('button[aria-label="Fermer"]') + await button.trigger('click') + expect(wrapper.emitted()).toHaveProperty('close') + }) +})