@nexxtmove/ui 0.1.41 → 0.1.43
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 +63 -14
- package/dist/index.js +1311 -1157
- package/dist/nuxt.js +12 -11
- package/package.json +1 -1
- package/src/components/DropdownButton/DropdownButton.vue +55 -15
- package/src/components/Modal/Modal.vue +123 -0
- package/src/components.json +1 -0
- package/src/index.ts +1 -0
package/dist/nuxt.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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/InputField/InputField.vue", b = "components/Pagination/Pagination.vue",
|
|
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/InputField/InputField.vue", b = "components/Modal/Modal.vue", f = "components/Pagination/Pagination.vue", h = "components/ProgressBar/ProgressBar.vue", M = "components/SocialIcons/SocialIcons.vue", P = "components/SocialMediaCustomTemplate/SocialMediaCustomTemplate.vue", k = "components/SocialMediaTemplate/SocialMediaTemplate.vue", B = "components/SocialMediaType/SocialMediaType.vue", I = "components/StepperHeader/StepperHeader.vue", g = "components/Table/Table.vue", y = "components/TimelineEvent/TimelineEvent.vue", A = "components/TimelinePhaseblock/TimelinePhaseblock.vue", D = "components/Tooltip/Tooltip.vue", H = {
|
|
3
3
|
NexxtAnimatedNumber: i,
|
|
4
4
|
NexxtAvatar: m,
|
|
5
5
|
NexxtButton: x,
|
|
@@ -13,18 +13,19 @@ const i = "components/AnimatedNumber/AnimatedNumber.vue", m = "components/Avatar
|
|
|
13
13
|
NexxtIcon: T,
|
|
14
14
|
NexxtInfoBlock: C,
|
|
15
15
|
NexxtInputField: S,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
NexxtModal: b,
|
|
17
|
+
NexxtPagination: f,
|
|
18
|
+
NexxtProgressBar: h,
|
|
19
|
+
NexxtSocialIcons: M,
|
|
19
20
|
NexxtSocialMediaCustomTemplate: P,
|
|
20
21
|
NexxtSocialMediaTemplate: k,
|
|
21
22
|
NexxtSocialMediaType: B,
|
|
22
23
|
NexxtStepperHeader: I,
|
|
23
|
-
NexxtTable:
|
|
24
|
-
NexxtTimelineEvent:
|
|
25
|
-
NexxtTimelinePhaseblock:
|
|
26
|
-
NexxtTooltip:
|
|
27
|
-
},
|
|
24
|
+
NexxtTable: g,
|
|
25
|
+
NexxtTimelineEvent: y,
|
|
26
|
+
NexxtTimelinePhaseblock: A,
|
|
27
|
+
NexxtTooltip: D
|
|
28
|
+
}, E = c({
|
|
28
29
|
meta: {
|
|
29
30
|
name: "@nexxtmove/ui",
|
|
30
31
|
configKey: "nexxtmoveUi",
|
|
@@ -36,7 +37,7 @@ const i = "components/AnimatedNumber/AnimatedNumber.vue", m = "components/Avatar
|
|
|
36
37
|
addCSS: !0
|
|
37
38
|
},
|
|
38
39
|
setup(e, o) {
|
|
39
|
-
for (const [t, n] of Object.entries(
|
|
40
|
+
for (const [t, n] of Object.entries(H))
|
|
40
41
|
s({
|
|
41
42
|
name: t,
|
|
42
43
|
export: "default",
|
|
@@ -55,5 +56,5 @@ const i = "components/AnimatedNumber/AnimatedNumber.vue", m = "components/Avatar
|
|
|
55
56
|
}
|
|
56
57
|
});
|
|
57
58
|
export {
|
|
58
|
-
|
|
59
|
+
E as default
|
|
59
60
|
};
|
package/package.json
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { ref, onMounted, onUnmounted, computed } from 'vue'
|
|
3
3
|
import NexxtIcon from '../Icon/Icon.vue'
|
|
4
|
+
import NexxtCheckbox from '../Checkbox/Checkbox.vue'
|
|
4
5
|
|
|
5
6
|
interface NexxtDropdownButton {
|
|
6
7
|
label: string
|
|
7
8
|
action: string | (() => void)
|
|
8
9
|
icon?: InstanceType<typeof NexxtIcon>['name']
|
|
9
10
|
selected?: boolean
|
|
11
|
+
checkbox?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface NexxtDropdownButtonGroup {
|
|
15
|
+
title: string
|
|
16
|
+
items: NexxtDropdownButton[]
|
|
10
17
|
}
|
|
11
18
|
|
|
12
19
|
type NexxtDropdownButtonBase = {
|
|
13
20
|
variant?: 'primary' | 'secondary'
|
|
14
|
-
options: NexxtDropdownButton[]
|
|
21
|
+
options: NexxtDropdownButton[] | NexxtDropdownButtonGroup[]
|
|
15
22
|
placement?: 'left' | 'right'
|
|
16
23
|
triggerIcon?: InstanceType<typeof NexxtIcon>['name']
|
|
17
24
|
icon?: InstanceType<typeof NexxtIcon>['name']
|
|
@@ -34,10 +41,12 @@ const {
|
|
|
34
41
|
|
|
35
42
|
const emit = defineEmits<{
|
|
36
43
|
navigate: [url: string]
|
|
44
|
+
checkboxChange: [label: string, checked: boolean]
|
|
37
45
|
}>()
|
|
38
46
|
|
|
39
47
|
const isOpen = ref(false)
|
|
40
48
|
const wrapperRef = ref<HTMLElement | null>(null)
|
|
49
|
+
const checkedItems = ref<Record<string, boolean>>({})
|
|
41
50
|
|
|
42
51
|
const handleAction = (action: string | (() => void)) => {
|
|
43
52
|
if (typeof action === 'function') {
|
|
@@ -51,9 +60,15 @@ const toggleDropdown = () => {
|
|
|
51
60
|
isOpen.value = !isOpen.value
|
|
52
61
|
}
|
|
53
62
|
|
|
54
|
-
const handleOptionClick = (
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
const handleOptionClick = (option: NexxtDropdownButton) => {
|
|
64
|
+
if (option.checkbox) {
|
|
65
|
+
const newValue = !checkedItems.value[option.label]
|
|
66
|
+
checkedItems.value[option.label] = newValue
|
|
67
|
+
emit('checkboxChange', option.label, newValue)
|
|
68
|
+
} else {
|
|
69
|
+
isOpen.value = false
|
|
70
|
+
}
|
|
71
|
+
handleAction(option.action)
|
|
57
72
|
}
|
|
58
73
|
|
|
59
74
|
const handleClickOutside = (event: MouseEvent) => {
|
|
@@ -70,6 +85,15 @@ onUnmounted(() => {
|
|
|
70
85
|
document.removeEventListener('mousedown', handleClickOutside)
|
|
71
86
|
})
|
|
72
87
|
|
|
88
|
+
const isGrouped = (
|
|
89
|
+
opts: NexxtDropdownButton[] | NexxtDropdownButtonGroup[],
|
|
90
|
+
): opts is NexxtDropdownButtonGroup[] => opts.length > 0 && 'items' in opts[0]
|
|
91
|
+
|
|
92
|
+
const groupedOptions = computed<NexxtDropdownButtonGroup[]>(() => {
|
|
93
|
+
if (isGrouped(options)) return options
|
|
94
|
+
return [{ title: '', items: options }]
|
|
95
|
+
})
|
|
96
|
+
|
|
73
97
|
const componentClasses = computed(() => {
|
|
74
98
|
if (variant === 'primary') {
|
|
75
99
|
return 'bg-button-bg-primary-default text-button-text-primary-default'
|
|
@@ -154,17 +178,33 @@ const transitionClasses = computed(() => {
|
|
|
154
178
|
class="absolute top-full z-10 mt-2.5 min-w-full rounded-md border border-gray-200 bg-white whitespace-nowrap"
|
|
155
179
|
:class="placement === 'right' ? 'right-0' : 'left-0'"
|
|
156
180
|
>
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
<
|
|
166
|
-
|
|
167
|
-
|
|
181
|
+
<template v-for="(group, groupIndex) in groupedOptions" :key="group.title || groupIndex">
|
|
182
|
+
<div
|
|
183
|
+
v-if="group.title"
|
|
184
|
+
class="border-b border-gray-100 px-4 py-1.5 extra-small-normal text-gray-600"
|
|
185
|
+
:class="groupIndex > 0 ? 'mt-1 border-t pt-2' : ''"
|
|
186
|
+
>
|
|
187
|
+
{{ group.title }}
|
|
188
|
+
</div>
|
|
189
|
+
<button
|
|
190
|
+
v-for="option in group.items"
|
|
191
|
+
:key="option.label"
|
|
192
|
+
:role="option.checkbox ? 'menuitemcheckbox' : 'menuitem'"
|
|
193
|
+
:aria-checked="option.checkbox ? (checkedItems[option.label] ?? false) : undefined"
|
|
194
|
+
class="flex w-full min-w-42 cursor-pointer items-center gap-2 px-4 py-2 text-left text-sm whitespace-nowrap text-gray-700 transition-colors duration-200 hover:bg-gray-100 hover:text-purple-600 focus:bg-gray-100 focus:outline-none"
|
|
195
|
+
:class="!option.checkbox && option.selected ? 'bg-cornflower-blue-100' : ''"
|
|
196
|
+
@click="handleOptionClick(option)"
|
|
197
|
+
>
|
|
198
|
+
<template v-if="option.checkbox">
|
|
199
|
+
<NexxtCheckbox
|
|
200
|
+
:model-value="checkedItems[option.label] ?? false"
|
|
201
|
+
class="pointer-events-none"
|
|
202
|
+
/>
|
|
203
|
+
</template>
|
|
204
|
+
<NexxtIcon v-else-if="option.icon" :name="option.icon" aria-hidden="true" />
|
|
205
|
+
{{ option.label }}
|
|
206
|
+
</button>
|
|
207
|
+
</template>
|
|
168
208
|
</div>
|
|
169
209
|
</Transition>
|
|
170
210
|
</div>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
DialogClose,
|
|
4
|
+
DialogContent,
|
|
5
|
+
DialogDescription,
|
|
6
|
+
DialogOverlay,
|
|
7
|
+
DialogPortal,
|
|
8
|
+
DialogRoot,
|
|
9
|
+
DialogTitle,
|
|
10
|
+
} from 'reka-ui'
|
|
11
|
+
import { computed } from 'vue'
|
|
12
|
+
import NexxtIcon from '../Icon/Icon.vue'
|
|
13
|
+
|
|
14
|
+
defineOptions({
|
|
15
|
+
name: 'NexxtModal',
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
interface NexxtModalProps {
|
|
19
|
+
title?: string
|
|
20
|
+
description?: string
|
|
21
|
+
size?: 'sm' | 'md' | 'lg'
|
|
22
|
+
dismissible?: boolean
|
|
23
|
+
showClose?: boolean
|
|
24
|
+
beforeClose?: () => boolean | Promise<boolean>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
size = 'md',
|
|
29
|
+
dismissible = true,
|
|
30
|
+
showClose = true,
|
|
31
|
+
description: rawDescription,
|
|
32
|
+
beforeClose,
|
|
33
|
+
} = defineProps<NexxtModalProps>()
|
|
34
|
+
|
|
35
|
+
const open = defineModel<boolean>({ default: false })
|
|
36
|
+
|
|
37
|
+
const description = computed(() => rawDescription?.trim() || undefined)
|
|
38
|
+
|
|
39
|
+
const handleOpenChange = async (val: boolean) => {
|
|
40
|
+
if (val) {
|
|
41
|
+
open.value = true
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
if (beforeClose && !(await beforeClose())) return
|
|
45
|
+
open.value = false
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const sizeClass = {
|
|
49
|
+
sm: 'max-w-xl',
|
|
50
|
+
md: 'max-w-3xl',
|
|
51
|
+
lg: 'max-w-5xl',
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<template>
|
|
56
|
+
<DialogRoot :open="open" @update:open="handleOpenChange">
|
|
57
|
+
<DialogPortal>
|
|
58
|
+
<div class="pointer-events-none fixed inset-0 z-50 grid place-items-center px-8">
|
|
59
|
+
<Transition
|
|
60
|
+
enter-active-class="transition-opacity duration-200 ease-out"
|
|
61
|
+
enter-from-class="opacity-0"
|
|
62
|
+
leave-active-class="transition-opacity duration-150 ease-in"
|
|
63
|
+
leave-to-class="opacity-0"
|
|
64
|
+
>
|
|
65
|
+
<DialogOverlay
|
|
66
|
+
v-if="open"
|
|
67
|
+
class="pointer-events-auto absolute inset-0 bg-black/40 backdrop-blur-sm"
|
|
68
|
+
/>
|
|
69
|
+
</Transition>
|
|
70
|
+
<Transition
|
|
71
|
+
enter-active-class="transition-[opacity,translate] duration-200 ease-out"
|
|
72
|
+
enter-from-class="opacity-0 translate-y-5"
|
|
73
|
+
leave-active-class="transition-[opacity,translate] duration-150 ease-in"
|
|
74
|
+
leave-to-class="opacity-0 translate-y-5"
|
|
75
|
+
>
|
|
76
|
+
<DialogContent
|
|
77
|
+
v-if="open"
|
|
78
|
+
:class="[
|
|
79
|
+
'pointer-events-auto relative z-10 flex max-h-[85vh] w-full flex-col overflow-x-auto rounded-3xl bg-white shadow-lg',
|
|
80
|
+
sizeClass[size],
|
|
81
|
+
]"
|
|
82
|
+
:aria-describedby="description ? undefined : 'undefined'"
|
|
83
|
+
@pointer-down-outside="!dismissible && $event.preventDefault()"
|
|
84
|
+
@interact-outside="!dismissible && $event.preventDefault()"
|
|
85
|
+
@escape-key-down="!dismissible && $event.preventDefault()"
|
|
86
|
+
>
|
|
87
|
+
<div
|
|
88
|
+
v-if="title || description"
|
|
89
|
+
class="flex items-start justify-between border-b border-gray-200 px-6 py-5"
|
|
90
|
+
>
|
|
91
|
+
<div>
|
|
92
|
+
<DialogTitle v-if="title" class="heading-2">{{ title }}</DialogTitle>
|
|
93
|
+
<DialogDescription v-if="description" class="small-normal">
|
|
94
|
+
{{ description }}
|
|
95
|
+
</DialogDescription>
|
|
96
|
+
</div>
|
|
97
|
+
<DialogClose
|
|
98
|
+
v-if="showClose"
|
|
99
|
+
class="ml-4 shrink-0 cursor-pointer rounded p-1 focus-visible:outline-2"
|
|
100
|
+
>
|
|
101
|
+
<NexxtIcon name="xmark" />
|
|
102
|
+
</DialogClose>
|
|
103
|
+
</div>
|
|
104
|
+
<DialogClose
|
|
105
|
+
v-else-if="showClose"
|
|
106
|
+
class="absolute top-3 right-3 cursor-pointer rounded p-1 focus-visible:outline-2"
|
|
107
|
+
>
|
|
108
|
+
<NexxtIcon name="xmark" />
|
|
109
|
+
</DialogClose>
|
|
110
|
+
|
|
111
|
+
<div :class="['overflow-y-auto px-6 pt-5', $slots.footer ? 'pb-5' : 'pb-6']">
|
|
112
|
+
<slot />
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<div v-if="$slots.footer" class="flex justify-end gap-2 px-6 py-5">
|
|
116
|
+
<slot name="footer" />
|
|
117
|
+
</div>
|
|
118
|
+
</DialogContent>
|
|
119
|
+
</Transition>
|
|
120
|
+
</div>
|
|
121
|
+
</DialogPortal>
|
|
122
|
+
</DialogRoot>
|
|
123
|
+
</template>
|
package/src/components.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"NexxtIcon": "components/Icon/Icon.vue",
|
|
13
13
|
"NexxtInfoBlock": "components/InfoBlock/InfoBlock.vue",
|
|
14
14
|
"NexxtInputField": "components/InputField/InputField.vue",
|
|
15
|
+
"NexxtModal": "components/Modal/Modal.vue",
|
|
15
16
|
"NexxtPagination": "components/Pagination/Pagination.vue",
|
|
16
17
|
"NexxtProgressBar": "components/ProgressBar/ProgressBar.vue",
|
|
17
18
|
"NexxtSocialIcons": "components/SocialIcons/SocialIcons.vue",
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { default as NexxtHeader } from './components/Header/Header.vue'
|
|
|
12
12
|
export { default as NexxtIcon } from './components/Icon/Icon.vue'
|
|
13
13
|
export { default as NexxtInfoBlock } from './components/InfoBlock/InfoBlock.vue'
|
|
14
14
|
export { default as NexxtInputField } from './components/InputField/InputField.vue'
|
|
15
|
+
export { default as NexxtModal } from './components/Modal/Modal.vue'
|
|
15
16
|
export { default as NexxtPagination } from './components/Pagination/Pagination.vue'
|
|
16
17
|
export { default as NexxtProgressBar } from './components/ProgressBar/ProgressBar.vue'
|
|
17
18
|
export { default as NexxtSocialIcons } from './components/SocialIcons/SocialIcons.vue'
|