@mozaic-ds/vue 1.0.0-beta.5 → 1.0.0-beta.7

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.
@@ -0,0 +1,56 @@
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, it, expect } from 'vitest';
3
+ import MNumberBadge from './MNumberBadge.vue';
4
+
5
+ describe('MNumberBadge component', () => {
6
+ it('renders the label correctly', () => {
7
+ const wrapper = mount(MNumberBadge, {
8
+ props: { label: 42 },
9
+ });
10
+ expect(wrapper.text()).toBe('42');
11
+ });
12
+
13
+ it('applies no modifier class by default', () => {
14
+ const wrapper = mount(MNumberBadge, {
15
+ props: { label: 1 },
16
+ });
17
+ expect(wrapper.classes()).toContain('mc-number-badge');
18
+ expect(wrapper.classes()).not.toContain('mc-number-badge--standard');
19
+ expect(wrapper.classes()).not.toContain('mc-number-badge--s');
20
+ });
21
+
22
+ it('applies appearance modifier class when set to danger', () => {
23
+ const wrapper = mount(MNumberBadge, {
24
+ props: {
25
+ label: 5,
26
+ appearance: 'danger',
27
+ },
28
+ });
29
+ expect(wrapper.classes()).toContain('mc-number-badge');
30
+ expect(wrapper.classes()).toContain('mc-number-badge--danger');
31
+ });
32
+
33
+ it('applies size modifier class when size is m', () => {
34
+ const wrapper = mount(MNumberBadge, {
35
+ props: {
36
+ label: 10,
37
+ size: 'm',
38
+ },
39
+ });
40
+ expect(wrapper.classes()).toContain('mc-number-badge');
41
+ expect(wrapper.classes()).toContain('mc-number-badge--m');
42
+ });
43
+
44
+ it('applies both appearance and size modifier classes when set', () => {
45
+ const wrapper = mount(MNumberBadge, {
46
+ props: {
47
+ label: 3,
48
+ appearance: 'accent',
49
+ size: 'm',
50
+ },
51
+ });
52
+ expect(wrapper.classes()).toContain('mc-number-badge');
53
+ expect(wrapper.classes()).toContain('mc-number-badge--accent');
54
+ expect(wrapper.classes()).toContain('mc-number-badge--m');
55
+ });
56
+ });
@@ -1,30 +1,30 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3';
2
- import MBadge from './MBadge.vue';
2
+ import MNumberBadge from './MNumberBadge.vue';
3
3
 
4
- const meta: Meta<typeof MBadge> = {
5
- title: 'Indicators/Badge (number)',
6
- component: MBadge,
4
+ const meta: Meta<typeof MNumberBadge> = {
5
+ title: 'Indicators/Number Badge',
6
+ component: MNumberBadge,
7
7
  parameters: {
8
8
  docs: {
9
9
  description: {
10
10
  component:
11
- 'A Badge represents a numeric count, often used to indicate notifications, updates, or items requiring attention. Its distinct appearance makes it easy to spot changes at a glance, ensuring users stay informed without breaking their workflow. Badges are commonly attached to icons, buttons, or tabs to provide contextual awareness.',
11
+ 'A Number Badge represents a numeric count, often used to indicate notifications, updates, or items requiring attention. Its distinct appearance makes it easy to spot changes at a glance, ensuring users stay informed without breaking their workflow. Badges are commonly attached to icons, buttons, or tabs to provide contextual awareness.',
12
12
  },
13
13
  },
14
14
  },
15
15
  args: { label: 99 },
16
16
  render: (args) => ({
17
- components: { MBadge },
17
+ components: { MNumberBadge },
18
18
  setup() {
19
19
  return { args };
20
20
  },
21
21
  template: `
22
- <MBadge v-bind="args"></MBadge>
22
+ <MNumberBadge v-bind="args"></MNumberBadge>
23
23
  `,
24
24
  }),
25
25
  };
26
26
  export default meta;
27
- type Story = StoryObj<typeof MBadge>;
27
+ type Story = StoryObj<typeof MNumberBadge>;
28
28
 
29
29
  export const Standard: Story = {};
30
30
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <span class="mc-badge" :class="classObject">
2
+ <span class="mc-number-badge" :class="classObject">
3
3
  {{ label }}
4
4
  </span>
5
5
  </template>
@@ -33,13 +33,13 @@ const props = withDefaults(
33
33
 
34
34
  const classObject = computed(() => {
35
35
  return {
36
- [`mc-badge--${props.appearance}`]:
36
+ [`mc-number-badge--${props.appearance}`]:
37
37
  props.appearance && props.appearance != 'standard',
38
- [`mc-badge--${props.size}`]: props.size && props.size != 's',
38
+ [`mc-number-badge--${props.size}`]: props.size && props.size != 's',
39
39
  };
40
40
  });
41
41
  </script>
42
42
 
43
43
  <style lang="scss" scoped>
44
- @use '@mozaic-ds/styles/components/badge';
44
+ @use '@mozaic-ds/styles/components/number-badge';
45
45
  </style>
package/src/main.ts CHANGED
@@ -1,47 +1,22 @@
1
- import MBadge from './components/badge/MBadge.vue';
2
- import MBreadcrumb from './components/breadcrumb/MBreadcrumb.vue';
3
- import MButton from './components/button/MButton.vue';
4
- import MCheckbox from './components/checkbox/MCheckbox.vue';
5
- import MCheckboxGroup from './components/checkboxgroup/MCheckboxGroup.vue';
6
- import MField from './components/field/MField.vue';
7
- import MFieldGroup from './components/fieldgroup/MFieldGroup.vue';
8
- import MIconButton from './components/iconbutton/MIconButton.vue';
9
- import MLink from './components/link/MLink.vue';
10
- import MLoader from './components/loader/MLoader.vue';
11
- import MOverlay from './components/overlay/MOverlay.vue';
12
- import MPasswordInput from './components/passwordinput/MPasswordInput.vue';
13
- import MQuantitySelector from './components/quantityselector/MQuantitySelector.vue';
14
- import MRadio from './components/radio/MRadio.vue';
15
- import MRadioGroup from './components/radiogroup/MRadioGroup.vue';
16
- import MSelect from './components/select/MSelect.vue';
17
- import MStatusBadge from './components/statusbadge/MStatusBadge.vue';
18
- import MStatusNotification from './components/statusnotification/MStatusNotification.vue';
19
- import MTextArea from './components/textarea/MTextArea.vue';
20
- import MTextInput from './components/textinput/MTextInput.vue';
21
- import MToggle from './components/toggle/MToggle.vue';
22
- import MToggleGroup from './components/togglegroup/MToggleGroup.vue';
23
-
24
- export {
25
- MBadge,
26
- MBreadcrumb,
27
- MButton,
28
- MCheckbox,
29
- MCheckboxGroup,
30
- MField,
31
- MFieldGroup,
32
- MIconButton,
33
- MLink,
34
- MLoader,
35
- MOverlay,
36
- MPasswordInput,
37
- MQuantitySelector,
38
- MRadio,
39
- MRadioGroup,
40
- MSelect,
41
- MStatusBadge,
42
- MStatusNotification,
43
- MTextArea,
44
- MTextInput,
45
- MToggle,
46
- MToggleGroup,
47
- };
1
+ export { default as MBreadcrumb } from './components/breadcrumb/MBreadcrumb.vue';
2
+ export { default as MButton } from './components/button/MButton.vue';
3
+ export { default as MCheckbox } from './components/checkbox/MCheckbox.vue';
4
+ export { default as MCheckboxGroup } from './components/checkboxgroup/MCheckboxGroup.vue';
5
+ export { default as MField } from './components/field/MField.vue';
6
+ export { default as MFieldGroup } from './components/fieldgroup/MFieldGroup.vue';
7
+ export { default as MIconButton } from './components/iconbutton/MIconButton.vue';
8
+ export { default as MLink } from './components/link/MLink.vue';
9
+ export { default as MLoader } from './components/loader/MLoader.vue';
10
+ export { default as MNumberBadge } from './components/numberbadge/MNumberBadge.vue';
11
+ export { default as MOverlay } from './components/overlay/MOverlay.vue';
12
+ export { default as MPasswordInput } from './components/passwordinput/MPasswordInput.vue';
13
+ export { default as MQuantitySelector } from './components/quantityselector/MQuantitySelector.vue';
14
+ export { default as MRadio } from './components/radio/MRadio.vue';
15
+ export { default as MRadioGroup } from './components/radiogroup/MRadioGroup.vue';
16
+ export { default as MSelect } from './components/select/MSelect.vue';
17
+ export { default as MStatusBadge } from './components/statusbadge/MStatusBadge.vue';
18
+ export { default as MStatusNotification } from './components/statusnotification/MStatusNotification.vue';
19
+ export { default as MTextArea } from './components/textarea/MTextArea.vue';
20
+ export { default as MTextInput } from './components/textinput/MTextInput.vue';
21
+ export { default as MToggle } from './components/toggle/MToggle.vue';
22
+ export { default as MToggleGroup } from './components/togglegroup/MToggleGroup.vue';
@@ -1,16 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
-
3
- import { mount } from '@vue/test-utils';
4
- import MBadge from './MBadge.vue';
5
-
6
- describe('MBadge component', () => {
7
- it('renders properly', () => {
8
- const wrapper = mount(MBadge, {
9
- props: {
10
- label: 99,
11
- },
12
- });
13
-
14
- expect(wrapper.text()).toContain('99');
15
- });
16
- });