@nexxtmove/ui 0.1.30 → 0.1.31
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/index.d.ts +9 -0
- package/dist/index.js +51 -20
- package/dist/nuxt.js +26 -25
- package/package.json +1 -1
- package/src/components/Avatar/Avatar.stories.ts +28 -0
- package/src/components/Avatar/Avatar.test.ts +55 -0
- package/src/components/Avatar/Avatar.vue +49 -0
- package/src/components.json +1 -0
- package/src/index.ts +1 -0
package/dist/nuxt.js
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { defineNuxtModule as c, addComponent as s, addTemplate as
|
|
2
|
-
const
|
|
3
|
-
NexxtAnimatedNumber:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { defineNuxtModule as c, addComponent as s, addTemplate as a } from "@nuxt/kit";
|
|
2
|
+
const i = "components/AnimatedNumber/AnimatedNumber.vue", m = "components/Avatar/Avatar.vue", x = "components/Button/Button.vue", u = "components/Calendar/Calendar.vue", p = "components/Checkbox/Checkbox.vue", l = "components/Chip/Chip.vue", r = "components/CustomerJourneyTile/CustomerJourneyTile.vue", d = "components/DatePicker/DatePicker.vue", v = "components/DropdownButton/DropdownButton.vue", N = "components/Header/Header.vue", T = "components/Icon/Icon.vue", C = "components/InfoBlock/InfoBlock.vue", S = "components/ProgressBar/ProgressBar.vue", b = "components/SocialIcons/SocialIcons.vue", f = "components/SocialMediaCustomTemplate/SocialMediaCustomTemplate.vue", h = "components/SocialMediaTemplate/SocialMediaTemplate.vue", k = "components/SocialMediaType/SocialMediaType.vue", B = "components/StepperHeader/StepperHeader.vue", M = "components/Table/Table.vue", P = "components/TimelineEvent/TimelineEvent.vue", I = "components/TimelinePhaseblock/TimelinePhaseblock.vue", y = "components/Tooltip/Tooltip.vue", A = {
|
|
3
|
+
NexxtAnimatedNumber: i,
|
|
4
|
+
NexxtAvatar: m,
|
|
5
|
+
NexxtButton: x,
|
|
6
|
+
NexxtCalendar: u,
|
|
7
|
+
NexxtCheckbox: p,
|
|
8
|
+
NexxtChip: l,
|
|
9
|
+
NexxtCustomerJourneyTile: r,
|
|
10
|
+
NexxtDatePicker: d,
|
|
11
|
+
NexxtDropdownButton: v,
|
|
12
|
+
NexxtHeader: N,
|
|
13
|
+
NexxtIcon: T,
|
|
14
|
+
NexxtInfoBlock: C,
|
|
15
|
+
NexxtProgressBar: S,
|
|
16
|
+
NexxtSocialIcons: b,
|
|
17
|
+
NexxtSocialMediaCustomTemplate: f,
|
|
18
|
+
NexxtSocialMediaTemplate: h,
|
|
19
|
+
NexxtSocialMediaType: k,
|
|
20
|
+
NexxtStepperHeader: B,
|
|
21
|
+
NexxtTable: M,
|
|
22
|
+
NexxtTimelineEvent: P,
|
|
23
|
+
NexxtTimelinePhaseblock: I,
|
|
24
|
+
NexxtTooltip: y
|
|
24
25
|
}, H = c({
|
|
25
26
|
meta: {
|
|
26
27
|
name: "@nexxtmove/ui",
|
|
@@ -33,13 +34,13 @@ const a = "components/AnimatedNumber/AnimatedNumber.vue", m = "components/Button
|
|
|
33
34
|
addCSS: !0
|
|
34
35
|
},
|
|
35
36
|
setup(e, o) {
|
|
36
|
-
for (const [t, n] of Object.entries(
|
|
37
|
+
for (const [t, n] of Object.entries(A))
|
|
37
38
|
s({
|
|
38
39
|
name: t,
|
|
39
40
|
export: "default",
|
|
40
41
|
filePath: `@nexxtmove/ui/${n}`
|
|
41
42
|
});
|
|
42
|
-
e.addCSS && (
|
|
43
|
+
e.addCSS && (a({
|
|
43
44
|
filename: "nexxtmove-ui.css",
|
|
44
45
|
getContents: () => `
|
|
45
46
|
@import "tailwindcss";
|
package/package.json
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
|
2
|
+
import Avatar from './Avatar.vue'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Components/Atoms/Avatar',
|
|
6
|
+
component: Avatar,
|
|
7
|
+
parameters: {
|
|
8
|
+
design: {
|
|
9
|
+
type: 'figma',
|
|
10
|
+
url: 'https://www.figma.com/design/CdbFJ7qUga6mtjagcPDvYK/Design-System',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
size: {
|
|
15
|
+
control: 'select',
|
|
16
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
} satisfies Meta<typeof Avatar>
|
|
20
|
+
|
|
21
|
+
type Story = StoryObj<typeof Avatar>
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
name: 'Peter van der Sloot',
|
|
26
|
+
size: 'sm',
|
|
27
|
+
},
|
|
28
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { mount } from '@vue/test-utils'
|
|
3
|
+
import Avatar from './Avatar.vue'
|
|
4
|
+
|
|
5
|
+
describe('Avatar', () => {
|
|
6
|
+
it('generates 2 character initials from name with multiple words', () => {
|
|
7
|
+
const wrapper = mount(Avatar, {
|
|
8
|
+
props: {
|
|
9
|
+
name: 'Peter Vink',
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
expect(wrapper.text()).toContain('PV')
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('generates 2 character initials from name with single word', () => {
|
|
17
|
+
const wrapper = mount(Avatar, {
|
|
18
|
+
props: {
|
|
19
|
+
name: 'Peter',
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
expect(wrapper.text()).toContain('PE')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('generates 2 character initials picking first and last words for names with tussenvoegsels', () => {
|
|
27
|
+
const wrapper = mount(Avatar, {
|
|
28
|
+
props: {
|
|
29
|
+
name: 'Peter van der Sloot',
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
expect(wrapper.text()).toContain('PS')
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('handles empty strings gracefully by returning no text', () => {
|
|
37
|
+
const wrapper = mount(Avatar, {
|
|
38
|
+
props: {
|
|
39
|
+
name: '',
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
expect(wrapper.text()).toBe('')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('handles whitespace-only strings gracefully by returning no text', () => {
|
|
47
|
+
const wrapper = mount(Avatar, {
|
|
48
|
+
props: {
|
|
49
|
+
name: ' ',
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
expect(wrapper.text()).toBe('')
|
|
54
|
+
})
|
|
55
|
+
})
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
interface NexxtAvatarProps {
|
|
5
|
+
name: string
|
|
6
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
defineOptions({
|
|
10
|
+
name: 'NexxtAvatar',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const props = withDefaults(defineProps<NexxtAvatarProps>(), {
|
|
14
|
+
size: 'sm',
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const computedInitials = computed(() => {
|
|
18
|
+
if (!props.name?.trim()) return ''
|
|
19
|
+
|
|
20
|
+
const parts = props.name.trim().split(/\s+/)
|
|
21
|
+
if (parts.length >= 2) {
|
|
22
|
+
const firstInitial = parts[0][0]
|
|
23
|
+
const lastInitial = parts[parts.length - 1][0]
|
|
24
|
+
|
|
25
|
+
return (firstInitial + lastInitial).toUpperCase()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return parts[0].substring(0, 2).toUpperCase()
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const sizeClasses = {
|
|
32
|
+
xs: 'h-6 w-6 text-[10px]',
|
|
33
|
+
sm: 'h-8 w-8 text-sm',
|
|
34
|
+
md: 'h-10 w-10 text-base',
|
|
35
|
+
lg: 'h-12 w-12 text-lg',
|
|
36
|
+
xl: 'h-16 w-16 text-xl',
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div
|
|
42
|
+
:class="[
|
|
43
|
+
'relative flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-cornflower-blue-50 font-semibold text-cornflower-blue-500',
|
|
44
|
+
sizeClasses[size],
|
|
45
|
+
]"
|
|
46
|
+
>
|
|
47
|
+
{{ computedInitials }}
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
package/src/components.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"NexxtAnimatedNumber": "components/AnimatedNumber/AnimatedNumber.vue",
|
|
3
|
+
"NexxtAvatar": "components/Avatar/Avatar.vue",
|
|
3
4
|
"NexxtButton": "components/Button/Button.vue",
|
|
4
5
|
"NexxtCalendar": "components/Calendar/Calendar.vue",
|
|
5
6
|
"NexxtCheckbox": "components/Checkbox/Checkbox.vue",
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// This file is auto-generated by scripts/generate-index.ts
|
|
2
2
|
export { default as NexxtAnimatedNumber } from './components/AnimatedNumber/AnimatedNumber.vue'
|
|
3
|
+
export { default as NexxtAvatar } from './components/Avatar/Avatar.vue'
|
|
3
4
|
export { default as NexxtButton } from './components/Button/Button.vue'
|
|
4
5
|
export { default as NexxtCalendar } from './components/Calendar/Calendar.vue'
|
|
5
6
|
export { default as NexxtCheckbox } from './components/Checkbox/Checkbox.vue'
|