@dolanske/vui 1.4.0 → 1.4.2
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/components/Accordion/Accordion.vue.d.ts +48 -0
- package/dist/components/Accordion/AccordionGroup.vue.d.ts +21 -0
- package/dist/components/Alert/Alert.vue.d.ts +36 -0
- package/dist/components/Avatar/Avatar.vue.d.ts +25 -0
- package/dist/components/Badge/Badge.vue.d.ts +22 -0
- package/dist/components/Breadcrumbs/BreadcrumbItem.vue.d.ts +22 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.vue.d.ts +18 -0
- package/dist/components/Button/Button.vue.d.ts +32 -0
- package/dist/components/ButtonGroup/ButtonGroup.vue.d.ts +22 -0
- package/dist/components/Calendar/Calendar.vue.d.ts +27 -0
- package/dist/components/Card/Card.vue.d.ts +26 -0
- package/dist/components/Checkbox/Checkbox.vue.d.ts +33 -0
- package/dist/components/CopyClipboard/CopyClipboard.vue.d.ts +46 -0
- package/dist/components/Divider/Divider.vue.d.ts +23 -0
- package/dist/components/Drawer/Drawer.vue.d.ts +53 -0
- package/dist/components/Dropdown/Dropdown.vue.d.ts +177 -0
- package/dist/components/Dropdown/DropdownItem.vue.d.ts +23 -0
- package/dist/components/Dropdown/DropdownTitle.vue.d.ts +21 -0
- package/dist/components/Flex/Flex.vue.d.ts +41 -0
- package/dist/components/Grid/Grid.vue.d.ts +35 -0
- package/dist/components/Input/Color.vue.d.ts +11 -0
- package/dist/components/Input/Counter.vue.d.ts +19 -0
- package/dist/components/Input/Dropzone.vue.d.ts +193 -0
- package/dist/components/Input/File.vue.d.ts +8 -0
- package/dist/components/Input/Input.vue.d.ts +56 -0
- package/dist/components/Input/Password.vue.d.ts +6 -0
- package/dist/components/Input/Textarea.vue.d.ts +31 -0
- package/dist/components/Kbd/Kbd.vue.d.ts +23 -0
- package/dist/components/Kbd/KbdGroup.vue.d.ts +19 -0
- package/dist/components/Modal/Confirm.vue.d.ts +43 -0
- package/dist/components/Modal/Modal.vue.d.ts +58 -0
- package/dist/components/OTP/OTP.vue.d.ts +44 -0
- package/dist/components/OTP/OTPItem.vue.d.ts +5 -0
- package/dist/components/Pagination/Pagination.vue.d.ts +46 -0
- package/dist/components/Pagination/pagination.d.ts +12 -0
- package/dist/components/Popout/Popout.vue.d.ts +36 -0
- package/dist/components/Progress/Progress.vue.d.ts +33 -0
- package/dist/components/Radio/Radio.vue.d.ts +29 -0
- package/dist/components/Radio/RadioGroup.vue.d.ts +27 -0
- package/dist/components/Select/Select.vue.d.ts +35 -0
- package/dist/components/Sheet/Sheet.vue.d.ts +47 -0
- package/dist/components/Sidebar/Sidebar.vue.d.ts +70 -0
- package/dist/components/Skeleton/Skeleton.vue.d.ts +8 -0
- package/dist/components/Spinner/Spinner.vue.d.ts +6 -0
- package/dist/components/Switch/Switch.vue.d.ts +28 -0
- package/dist/components/Table/Cell.vue.d.ts +22 -0
- package/dist/components/Table/Head.vue.d.ts +30 -0
- package/dist/components/Table/Root.vue.d.ts +41 -0
- package/dist/components/Table/SelectAll.vue.d.ts +2 -0
- package/dist/components/Table/SelectRow.vue.d.ts +6 -0
- package/dist/components/Table/index.d.ts +6 -0
- package/dist/components/Table/table.d.ts +68 -0
- package/dist/components/Tabs/Tab.vue.d.ts +22 -0
- package/dist/components/Tabs/Tabs.vue.d.ts +34 -0
- package/dist/components/Toast/Toasts.vue.d.ts +2 -0
- package/dist/components/Toast/toast.d.ts +287 -0
- package/dist/components/Tooltip/Tooltip.vue.d.ts +33 -0
- package/dist/fonts/GeistMono-Regular.ttf +0 -0
- package/dist/fonts/GeistMono-SemiBold.ttf +0 -0
- package/dist/fonts/Inter_18pt-Black.ttf +0 -0
- package/dist/fonts/Inter_18pt-Bold.ttf +0 -0
- package/dist/fonts/Inter_18pt-ExtraBold.ttf +0 -0
- package/dist/fonts/Inter_18pt-Light.ttf +0 -0
- package/dist/fonts/Inter_18pt-Medium.ttf +0 -0
- package/dist/fonts/Inter_18pt-Regular.ttf +0 -0
- package/dist/fonts/Inter_18pt-SemiBold.ttf +0 -0
- package/dist/index.d.ts +56 -0
- package/dist/internal/Backdrop/Backdrop.vue.d.ts +21 -0
- package/dist/shared/helpers.d.ts +34 -0
- package/dist/shared/slots.d.ts +20 -0
- package/dist/shared/theme.d.ts +3 -0
- package/dist/shared/types.d.ts +24 -0
- package/dist/vui.css +1 -0
- package/dist/vui.js +16215 -0
- package/package.json +1 -2
- package/src/App.vue +0 -103
- package/src/components/Accordion/Accordion.vue +0 -98
- package/src/components/Accordion/AccordionGroup.vue +0 -49
- package/src/components/Accordion/accordion.scss +0 -97
- package/src/components/Alert/Alert.vue +0 -59
- package/src/components/Alert/alert.scss +0 -162
- package/src/components/Avatar/Avatar.vue +0 -53
- package/src/components/Avatar/avatar.scss +0 -52
- package/src/components/Badge/Badge.vue +0 -21
- package/src/components/Badge/badge.scss +0 -210
- package/src/components/Breadcrumbs/BreadcrumbItem.vue +0 -26
- package/src/components/Breadcrumbs/Breadcrumbs.vue +0 -29
- package/src/components/Breadcrumbs/breadcrumbs.scss +0 -31
- package/src/components/Button/Button.vue +0 -86
- package/src/components/Button/button.scss +0 -292
- package/src/components/ButtonGroup/ButtonGroup.vue +0 -28
- package/src/components/ButtonGroup/button-group.scss +0 -51
- package/src/components/Calendar/Calendar.vue +0 -66
- package/src/components/Calendar/calendar.scss +0 -88
- package/src/components/Card/Card.vue +0 -48
- package/src/components/Card/card.scss +0 -55
- package/src/components/Checkbox/Checkbox.vue +0 -54
- package/src/components/Checkbox/checkbox.scss +0 -80
- package/src/components/CopyClipboard/CopyClipboard.vue +0 -98
- package/src/components/CopyClipboard/copy-clipboard.scss +0 -25
- package/src/components/Divider/Divider.vue +0 -38
- package/src/components/Divider/divider.scss +0 -37
- package/src/components/Drawer/Drawer.vue +0 -102
- package/src/components/Drawer/drawer.scss +0 -37
- package/src/components/Dropdown/Dropdown.vue +0 -120
- package/src/components/Dropdown/DropdownItem.vue +0 -33
- package/src/components/Dropdown/DropdownTitle.vue +0 -14
- package/src/components/Dropdown/dropdown-item.scss +0 -84
- package/src/components/Dropdown/dropdown.scss +0 -53
- package/src/components/Flex/Flex.vue +0 -113
- package/src/components/Grid/Grid.vue +0 -87
- package/src/components/Input/Color.vue +0 -26
- package/src/components/Input/Counter.vue +0 -66
- package/src/components/Input/Dropzone.vue +0 -65
- package/src/components/Input/File.vue +0 -15
- package/src/components/Input/Input.vue +0 -123
- package/src/components/Input/Password.vue +0 -35
- package/src/components/Input/Textarea.vue +0 -78
- package/src/components/Input/input.scss +0 -302
- package/src/components/Kbd/Kbd.vue +0 -48
- package/src/components/Kbd/KbdGroup.vue +0 -28
- package/src/components/Kbd/kbd.scss +0 -19
- package/src/components/Modal/Confirm.vue +0 -56
- package/src/components/Modal/Modal.vue +0 -103
- package/src/components/Modal/modal.scss +0 -54
- package/src/components/OTP/OTP.vue +0 -133
- package/src/components/OTP/OTPItem.vue +0 -37
- package/src/components/OTP/otp.scss +0 -84
- package/src/components/Pagination/Pagination.vue +0 -92
- package/src/components/Pagination/pagination.ts +0 -78
- package/src/components/Popout/Popout.vue +0 -73
- package/src/components/Popout/popout.scss +0 -16
- package/src/components/Progress/Progress.vue +0 -103
- package/src/components/Progress/progress.scss +0 -47
- package/src/components/Radio/Radio.vue +0 -38
- package/src/components/Radio/RadioGroup.vue +0 -34
- package/src/components/Radio/radio.scss +0 -78
- package/src/components/Select/Select.vue +0 -212
- package/src/components/Select/select.scss +0 -82
- package/src/components/Sheet/Sheet.vue +0 -106
- package/src/components/Sheet/sheet.scss +0 -71
- package/src/components/Sidebar/Sidebar.vue +0 -116
- package/src/components/Sidebar/sidebar.scss +0 -124
- package/src/components/Skeleton/Skeleton.vue +0 -43
- package/src/components/Skeleton/skeleton.scss +0 -14
- package/src/components/Spinner/Spinner.vue +0 -42
- package/src/components/Spinner/spinner.scss +0 -47
- package/src/components/Switch/Switch.vue +0 -31
- package/src/components/Switch/switch.scss +0 -93
- package/src/components/Table/Cell.vue +0 -23
- package/src/components/Table/Head.vue +0 -66
- package/src/components/Table/Root.vue +0 -66
- package/src/components/Table/SelectAll.vue +0 -23
- package/src/components/Table/SelectRow.vue +0 -30
- package/src/components/Table/index.ts +0 -7
- package/src/components/Table/table.scss +0 -155
- package/src/components/Table/table.ts +0 -248
- package/src/components/Tabs/Tab.vue +0 -25
- package/src/components/Tabs/Tabs.vue +0 -90
- package/src/components/Tabs/tabs.scss +0 -87
- package/src/components/Toast/Toasts.vue +0 -52
- package/src/components/Toast/toast.scss +0 -45
- package/src/components/Toast/toast.ts +0 -75
- package/src/components/Tooltip/Tooltip.vue +0 -78
- package/src/components/Tooltip/tooltip.scss +0 -5
- package/src/examples/ExampleAccordions.vue +0 -69
- package/src/examples/ExampleAlerts.vue +0 -78
- package/src/examples/ExampleAvatars.vue +0 -44
- package/src/examples/ExampleBadges.vue +0 -48
- package/src/examples/ExampleBreadcrumbs.vue +0 -46
- package/src/examples/ExampleButtons.vue +0 -148
- package/src/examples/ExampleCalendars.vue +0 -40
- package/src/examples/ExampleCards.vue +0 -94
- package/src/examples/ExampleCheckboxes.vue +0 -123
- package/src/examples/ExampleCopyClipboard.vue +0 -47
- package/src/examples/ExampleDividers.vue +0 -39
- package/src/examples/ExampleDrawers.vue +0 -67
- package/src/examples/ExampleDropdowns.vue +0 -114
- package/src/examples/ExampleFlexGrid.vue +0 -124
- package/src/examples/ExampleInputs.vue +0 -236
- package/src/examples/ExampleKBD.vue +0 -65
- package/src/examples/ExampleModals.vue +0 -143
- package/src/examples/ExamplePalette.vue +0 -165
- package/src/examples/ExamplePopouts.vue +0 -41
- package/src/examples/ExampleSheets.vue +0 -77
- package/src/examples/ExampleSidebars.vue +0 -276
- package/src/examples/ExampleSkeletons.vue +0 -26
- package/src/examples/ExampleSpinners.vue +0 -80
- package/src/examples/ExampleTables.vue +0 -359
- package/src/examples/ExampleTabs.vue +0 -142
- package/src/examples/ExampleToasts.vue +0 -96
- package/src/examples/ExampleTooltips.vue +0 -70
- package/src/examples/shared/ExampleColor.vue +0 -28
- package/src/index.ts +0 -116
- package/src/internal/Backdrop/Backdrop.vue +0 -22
- package/src/internal/Backdrop/backdrop.scss +0 -34
- package/src/main.ts +0 -5
- package/src/shared/helpers.ts +0 -124
- package/src/shared/slots.ts +0 -61
- package/src/shared/theme.ts +0 -22
- package/src/shared/types.ts +0 -29
- package/src/style/animation.scss +0 -50
- package/src/style/core.scss +0 -133
- package/src/style/fonts.scss +0 -73
- package/src/style/layout.scss +0 -179
- package/src/style/media-query.scss +0 -29
- package/src/style/reset.scss +0 -135
- package/src/style/text.scss +0 -137
- package/src/style/theme.scss +0 -195
- package/src/style/tooltip.scss +0 -146
- package/src/style/typography.scss +0 -435
- package/src/style/utils.scss +0 -36
- package/src/style.scss +0 -1
- package/src/vite-env.d.ts +0 -1
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { Icon } from '@iconify/vue'
|
|
3
|
-
|
|
4
|
-
export interface TabProps {
|
|
5
|
-
disabled?: boolean
|
|
6
|
-
value: string
|
|
7
|
-
icon?: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const props = defineProps<TabProps>()
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<template>
|
|
14
|
-
<button
|
|
15
|
-
class="vui-tab"
|
|
16
|
-
:class="{ disabled: props.disabled }"
|
|
17
|
-
role="tab"
|
|
18
|
-
:name="value"
|
|
19
|
-
>
|
|
20
|
-
<slot>
|
|
21
|
-
<Icon v-if="props.icon" :icon="props.icon" />
|
|
22
|
-
{{ props.value }}
|
|
23
|
-
</slot>
|
|
24
|
-
</button>
|
|
25
|
-
</template>
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { TabProps } from './Tab.vue'
|
|
3
|
-
import { useResizeObserver } from '@vueuse/core'
|
|
4
|
-
import { onMounted, useTemplateRef, watch } from 'vue'
|
|
5
|
-
import { enforceSlotType, useFlattenedSlot } from '../../shared/slots'
|
|
6
|
-
import './tabs.scss'
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
variant?: 'default' | 'filled'
|
|
10
|
-
expand?: boolean
|
|
11
|
-
disabled?: boolean
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const {
|
|
15
|
-
expand,
|
|
16
|
-
disabled,
|
|
17
|
-
variant = 'default',
|
|
18
|
-
} = defineProps<Props>()
|
|
19
|
-
|
|
20
|
-
const slots = defineSlots()
|
|
21
|
-
|
|
22
|
-
const active = defineModel()
|
|
23
|
-
|
|
24
|
-
// Underline calculation
|
|
25
|
-
const underlineRef = useTemplateRef('underline')
|
|
26
|
-
const tabsRef = useTemplateRef('tabs')
|
|
27
|
-
|
|
28
|
-
function computeUnderlinePosition() {
|
|
29
|
-
if (!window)
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
if (tabsRef.value && underlineRef.value) {
|
|
33
|
-
const activeBounds = tabsRef.value.querySelector('.vui-tab.active')?.getBoundingClientRect()
|
|
34
|
-
const parentBounds = tabsRef.value.getBoundingClientRect()
|
|
35
|
-
if (!activeBounds || !parentBounds)
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
underlineRef.value.style.width = `${activeBounds.width}px`
|
|
39
|
-
underlineRef.value.style.left = `${activeBounds.left - parentBounds.left}px`
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
onMounted(() => {
|
|
44
|
-
useResizeObserver(tabsRef, computeUnderlinePosition)
|
|
45
|
-
|
|
46
|
-
watch(
|
|
47
|
-
[active, () => expand],
|
|
48
|
-
computeUnderlinePosition,
|
|
49
|
-
{
|
|
50
|
-
immediate: true,
|
|
51
|
-
flush: 'post',
|
|
52
|
-
},
|
|
53
|
-
)
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
const flattened = useFlattenedSlot<TabProps>(slots.default)
|
|
57
|
-
|
|
58
|
-
enforceSlotType(flattened, 'Tab')
|
|
59
|
-
</script>
|
|
60
|
-
|
|
61
|
-
<template>
|
|
62
|
-
<div
|
|
63
|
-
ref="tabs"
|
|
64
|
-
class="vui-tabs"
|
|
65
|
-
role="tablist"
|
|
66
|
-
:class="[
|
|
67
|
-
{ expand, disabled },
|
|
68
|
-
variant === 'default'
|
|
69
|
-
? ''
|
|
70
|
-
: `vui-tabs-variant-${variant}`,
|
|
71
|
-
]"
|
|
72
|
-
>
|
|
73
|
-
<slot name="start" />
|
|
74
|
-
<template v-for="vnode of flattened" :key="vnode.props.value">
|
|
75
|
-
<Component
|
|
76
|
-
:is="vnode"
|
|
77
|
-
:class="{ active: vnode.props.value === active }"
|
|
78
|
-
@click="active = vnode.props.value"
|
|
79
|
-
/>
|
|
80
|
-
</template>
|
|
81
|
-
<template v-if="$slots.end">
|
|
82
|
-
<div v-if="!!!expand" class="flex-1" />
|
|
83
|
-
<slot name="end" />
|
|
84
|
-
</template>
|
|
85
|
-
|
|
86
|
-
<Transition name="fade" appear>
|
|
87
|
-
<div v-if="active" ref="underline" class="vui-tab-underline" />
|
|
88
|
-
</Transition>
|
|
89
|
-
</div>
|
|
90
|
-
</template>
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
.vui-tabs {
|
|
2
|
-
display: flex;
|
|
3
|
-
width: 100%;
|
|
4
|
-
gap: 4px;
|
|
5
|
-
align-items: center;
|
|
6
|
-
border-bottom: 1px solid var(--color-border);
|
|
7
|
-
position: relative;
|
|
8
|
-
|
|
9
|
-
&.vui-tabs-variant-filled {
|
|
10
|
-
background-color: var(--color-bg-raised);
|
|
11
|
-
border-bottom: none;
|
|
12
|
-
z-index: var(--z-default);
|
|
13
|
-
border-radius: var(--border-radius-m);
|
|
14
|
-
padding-inline: 4px;
|
|
15
|
-
|
|
16
|
-
.vui-tab-underline {
|
|
17
|
-
border-bottom: none;
|
|
18
|
-
background-color: var(--color-bg-lowered);
|
|
19
|
-
top: 3px;
|
|
20
|
-
bottom: 3px;
|
|
21
|
-
z-index: var(--z-behind);
|
|
22
|
-
border-radius: var(--border-radius-m);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&.disabled .vui-tab,
|
|
27
|
-
.vui-tab.disabled {
|
|
28
|
-
pointer-events: none;
|
|
29
|
-
color: var(--color-text-lighter);
|
|
30
|
-
|
|
31
|
-
&.active {
|
|
32
|
-
color: var(--color-text-lighter) !important;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&.disabled {
|
|
37
|
-
.vui-tab-underline {
|
|
38
|
-
border-color: var(--color-text-lighter);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&.expand .vui-tab {
|
|
43
|
-
flex: 1;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.vui-tab {
|
|
47
|
-
display: flex;
|
|
48
|
-
height: 40px;
|
|
49
|
-
// place-content: center;
|
|
50
|
-
align-items: center;
|
|
51
|
-
justify-content: center;
|
|
52
|
-
padding: 0 10px;
|
|
53
|
-
font-size: var(--font-size-m);
|
|
54
|
-
position: relative;
|
|
55
|
-
color: var(--color-text-lighter);
|
|
56
|
-
font-weight: var(--font-weight-medium);
|
|
57
|
-
transition: var(--transition);
|
|
58
|
-
cursor: default;
|
|
59
|
-
gap: var(--space-xs);
|
|
60
|
-
border-radius: var(--border-radius-m);
|
|
61
|
-
|
|
62
|
-
svg {
|
|
63
|
-
width: 20px;
|
|
64
|
-
height: 20px;
|
|
65
|
-
color: var(--color-text-light);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&:hover,
|
|
69
|
-
&.active {
|
|
70
|
-
color: var(--color-text);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.vui-tab-underline {
|
|
75
|
-
transition: var(--transition);
|
|
76
|
-
display: block;
|
|
77
|
-
border-bottom: 2px solid var(--color-text);
|
|
78
|
-
position: absolute;
|
|
79
|
-
bottom: 0;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
:root.light {
|
|
84
|
-
.vui-tabs.vui-tabs-variant-filled {
|
|
85
|
-
background-color: var(--color-bg-medium);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import Button from '../Button/Button.vue'
|
|
3
|
-
import { toasts } from './toast'
|
|
4
|
-
import './toast.scss'
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<template>
|
|
8
|
-
<Teleport to="body">
|
|
9
|
-
<div class="vui-toast-wrapper">
|
|
10
|
-
<TransitionGroup name="toast" tag="ul" class="vui-toast-list">
|
|
11
|
-
<li v-for="[toastId, toast] in toasts" :key="toastId" class="vui-toast-item">
|
|
12
|
-
<div class="vui-toast-item-content">
|
|
13
|
-
<strong>{{ toast.title }}</strong>
|
|
14
|
-
<p v-if="toast.description">
|
|
15
|
-
{{ toast.description }}
|
|
16
|
-
</p>
|
|
17
|
-
<Component
|
|
18
|
-
:is="toast.body"
|
|
19
|
-
v-if="toast.body"
|
|
20
|
-
v-bind="{ data: toast.bodyProps, toastId }"
|
|
21
|
-
/>
|
|
22
|
-
</div>
|
|
23
|
-
<Button v-if="toast.action" @click="toast.action.handler(toast.id)">
|
|
24
|
-
{{ toast.action.label }}
|
|
25
|
-
</Button>
|
|
26
|
-
</li>
|
|
27
|
-
</TransitionGroup>
|
|
28
|
-
</div>
|
|
29
|
-
</Teleport>
|
|
30
|
-
</template>
|
|
31
|
-
|
|
32
|
-
<style scoped>
|
|
33
|
-
.toast-move,
|
|
34
|
-
.toast-enter-active,
|
|
35
|
-
.toast-leave-active {
|
|
36
|
-
transition: var(--transition);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.toast-enter-from {
|
|
40
|
-
opacity: 0;
|
|
41
|
-
transform: translateY(24px) scale(0.95);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.toast-leave-to {
|
|
45
|
-
opacity: 0;
|
|
46
|
-
transform: translateY(-24px) scale(0.95);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.toast-leave-active {
|
|
50
|
-
position: absolute;
|
|
51
|
-
}
|
|
52
|
-
</style>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
.vui-toast-wrapper {
|
|
2
|
-
position: fixed;
|
|
3
|
-
bottom: 32px;
|
|
4
|
-
right: 32px;
|
|
5
|
-
width: 100%;
|
|
6
|
-
max-width: 392px;
|
|
7
|
-
|
|
8
|
-
.vui-toast-list {
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
gap: var(--space-xs);
|
|
12
|
-
|
|
13
|
-
.vui-toast-item {
|
|
14
|
-
display: flex;
|
|
15
|
-
border: 1px solid var(--color-border);
|
|
16
|
-
border-radius: var(--border-radius-m);
|
|
17
|
-
padding: var(--space-m);
|
|
18
|
-
background-color: var(--color-bg-lowered);
|
|
19
|
-
width: 100%;
|
|
20
|
-
align-items: center;
|
|
21
|
-
gap: var(--space-m);
|
|
22
|
-
box-shadow: var(--box-shadow);
|
|
23
|
-
|
|
24
|
-
.vui-toast-item-content {
|
|
25
|
-
flex: 1;
|
|
26
|
-
|
|
27
|
-
strong {
|
|
28
|
-
color: var(--color-text);
|
|
29
|
-
margin-bottom: var(--space-xs);
|
|
30
|
-
display: block;
|
|
31
|
-
font-size: var(--font-size-m);
|
|
32
|
-
|
|
33
|
-
&:only-child {
|
|
34
|
-
margin: 0;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
p {
|
|
39
|
-
color: var(--color-text-lighter);
|
|
40
|
-
font-size: var(--font-size-s);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { Component } from 'vue'
|
|
2
|
-
import { ref } from 'vue'
|
|
3
|
-
|
|
4
|
-
interface ToastAction {
|
|
5
|
-
label: string
|
|
6
|
-
handler: (toastId: number) => void
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface ToastOptions {
|
|
10
|
-
persist?: boolean
|
|
11
|
-
timeout?: number
|
|
12
|
-
action?: ToastAction
|
|
13
|
-
description?: string
|
|
14
|
-
body?: Component
|
|
15
|
-
bodyProps?: object
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface Toast {
|
|
19
|
-
id: number
|
|
20
|
-
// type: ToastType
|
|
21
|
-
title: string
|
|
22
|
-
action?: ToastAction
|
|
23
|
-
createdAt: number
|
|
24
|
-
expiresAt: number
|
|
25
|
-
description?: string
|
|
26
|
-
body?: Component
|
|
27
|
-
bodyProps?: object
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Store in a ref so the toast component can import it
|
|
31
|
-
export const toasts = ref(new Map<number, Toast>())
|
|
32
|
-
|
|
33
|
-
// Simple incremental id system
|
|
34
|
-
let id = 0
|
|
35
|
-
|
|
36
|
-
// function toast(type: ToastType, title: string, options?: ToastOptions): Toast {
|
|
37
|
-
export function pushToast(title: string, options?: ToastOptions): Toast {
|
|
38
|
-
const parsedOptions = Object.assign({
|
|
39
|
-
persist: false,
|
|
40
|
-
timeout: 7000,
|
|
41
|
-
}, options)
|
|
42
|
-
|
|
43
|
-
const newToast = {
|
|
44
|
-
id,
|
|
45
|
-
// type,
|
|
46
|
-
title,
|
|
47
|
-
persist: parsedOptions.persist,
|
|
48
|
-
description: parsedOptions.description,
|
|
49
|
-
action: parsedOptions.action,
|
|
50
|
-
createdAt: Date.now(),
|
|
51
|
-
expiresAt: Date.now() + parsedOptions.timeout,
|
|
52
|
-
body: parsedOptions.body,
|
|
53
|
-
bodyProps: parsedOptions.bodyProps ?? {},
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
toasts.value.set(id, newToast)
|
|
57
|
-
|
|
58
|
-
// If options include timeout (by default) remove the toast after timeout
|
|
59
|
-
// passes
|
|
60
|
-
if (!parsedOptions.persist) {
|
|
61
|
-
setTimeout((_id: number) => {
|
|
62
|
-
toasts.value.delete(_id)
|
|
63
|
-
// Pass Id as an optional argument, becasue by the time it is executed the
|
|
64
|
-
// Id will have been increased
|
|
65
|
-
}, parsedOptions.timeout, id)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
id++
|
|
69
|
-
|
|
70
|
-
return newToast
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function removeToast(id: number): void {
|
|
74
|
-
toasts.value.delete(id)
|
|
75
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
<script setup lang='ts'>
|
|
2
|
-
import type { Placement } from '../../shared/types'
|
|
3
|
-
import { computed, ref, useId, useTemplateRef, watch } from 'vue'
|
|
4
|
-
import Popout from '../Popout/Popout.vue'
|
|
5
|
-
import './tooltip.scss'
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
/**
|
|
9
|
-
* Tooltip placement related to the anchor
|
|
10
|
-
*/
|
|
11
|
-
placement?: Placement
|
|
12
|
-
/**
|
|
13
|
-
* Amount of time user should hover the anchor until the tooltip shows up
|
|
14
|
-
*/
|
|
15
|
-
delay?: number
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const {
|
|
19
|
-
placement,
|
|
20
|
-
delay = 0,
|
|
21
|
-
} = defineProps<Props>()
|
|
22
|
-
|
|
23
|
-
const popoutAnchorRef = useTemplateRef('popoutAnchor')
|
|
24
|
-
// Track if user is hovering the anchor
|
|
25
|
-
const hoverAnchor = ref(false)
|
|
26
|
-
|
|
27
|
-
// Display tooltip
|
|
28
|
-
const showTooltip = ref(false)
|
|
29
|
-
|
|
30
|
-
let timeoutId: NodeJS.Timeout
|
|
31
|
-
watch(hoverAnchor, (isHovering) => {
|
|
32
|
-
if (isHovering) {
|
|
33
|
-
if (!delay || delay <= 0) {
|
|
34
|
-
showTooltip.value = true
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
clearTimeout(timeoutId)
|
|
39
|
-
|
|
40
|
-
timeoutId = setTimeout(() => {
|
|
41
|
-
// Need to reference the ref itself as this will execute without the
|
|
42
|
-
// outside scope (as far as I know tbh)
|
|
43
|
-
if (hoverAnchor.value) {
|
|
44
|
-
showTooltip.value = true
|
|
45
|
-
}
|
|
46
|
-
}, delay)
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
clearTimeout(timeoutId)
|
|
50
|
-
showTooltip.value = false
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
const id = useId()
|
|
55
|
-
const anchor = computed(() => popoutAnchorRef.value?.children[0] as HTMLElement | null)
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
<template>
|
|
59
|
-
<div
|
|
60
|
-
ref="popoutAnchor"
|
|
61
|
-
class="popout-anchor"
|
|
62
|
-
:aria-describedby="id"
|
|
63
|
-
@mouseenter="hoverAnchor = true"
|
|
64
|
-
@mouseleave="hoverAnchor = false"
|
|
65
|
-
>
|
|
66
|
-
<slot />
|
|
67
|
-
</div>
|
|
68
|
-
<Popout :id :visible="showTooltip" :anchor class="vui-tooltip" :placement>
|
|
69
|
-
<slot name="tooltip" />
|
|
70
|
-
</Popout>
|
|
71
|
-
</template>
|
|
72
|
-
|
|
73
|
-
<style scoped lang="scss">
|
|
74
|
-
.popout-anchor {
|
|
75
|
-
display: contents;
|
|
76
|
-
width: fit-content;
|
|
77
|
-
}
|
|
78
|
-
</style>
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
<script setup lang='ts'>
|
|
2
|
-
import { ref } from 'vue'
|
|
3
|
-
import Accordion from '../components/Accordion/Accordion.vue'
|
|
4
|
-
import AccordionGroup from '../components/Accordion/AccordionGroup.vue'
|
|
5
|
-
import Grid from '../components/Grid/Grid.vue'
|
|
6
|
-
|
|
7
|
-
const dynamicAccordions = ref([
|
|
8
|
-
'First',
|
|
9
|
-
'Second',
|
|
10
|
-
'Third',
|
|
11
|
-
])
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<template>
|
|
15
|
-
<div class="mb-xxl">
|
|
16
|
-
<h3 class="mb-l">
|
|
17
|
-
Accordion
|
|
18
|
-
</h3>
|
|
19
|
-
|
|
20
|
-
<Grid :columns="2" gap="xl">
|
|
21
|
-
<div>
|
|
22
|
-
<strong class="block mb-s text-semibold">Base</strong>
|
|
23
|
-
<Accordion label="Open details" class="mb-xl">
|
|
24
|
-
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Excepturi nostrum aspernatur nam earum vitae deleniti, odio atque esse sequi, in harum! Sint dolorum quis excepturi odio eum aspernatur aliquid harum.</p>
|
|
25
|
-
</Accordion>
|
|
26
|
-
<Accordion label="Open Two" class="mb-xl">
|
|
27
|
-
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Excepturi nostrum aspernatur nam earum vitae deleniti, odio atque esse sequi, in harum! Sint dolorum quis excepturi odio eum aspernatur aliquid harum.</p>
|
|
28
|
-
</Accordion>
|
|
29
|
-
|
|
30
|
-
<div class="mb-xl" />
|
|
31
|
-
|
|
32
|
-
<strong class="block mb-s text-semibold">Group</strong>
|
|
33
|
-
<AccordionGroup>
|
|
34
|
-
<Accordion v-for="item in dynamicAccordions" :key="item" :label="item">
|
|
35
|
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Nostrum aliquam ad dicta nesciunt exercitationem? Quas vitae suscipit aliquam numquam incidunt corporis ullam, nihil dolores perferendis ipsa velit tempora accusantium cupiditate.
|
|
36
|
-
</Accordion>
|
|
37
|
-
</AccordionGroup>
|
|
38
|
-
</div>
|
|
39
|
-
<div>
|
|
40
|
-
<strong class="block mb-s text-semibold">Card</strong>
|
|
41
|
-
<Accordion label="Open details" card>
|
|
42
|
-
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Excepturi nostrum aspernatur nam earum vitae deleniti, odio atque esse sequi, in harum! Sint dolorum quis excepturi odio eum aspernatur aliquid harum.</p>
|
|
43
|
-
</Accordion>
|
|
44
|
-
|
|
45
|
-
<div class="mb-xl" />
|
|
46
|
-
|
|
47
|
-
<strong class="block mb-s text-semibold">Card group</strong>
|
|
48
|
-
<AccordionGroup single>
|
|
49
|
-
<Accordion v-for="item in dynamicAccordions" :key="item" :label="item" card class="mb-xs">
|
|
50
|
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Nostrum aliquam ad dicta nesciunt exercitationem? Quas vitae suscipit aliquam numquam incidunt corporis ullam, nihil dolores perferendis ipsa velit tempora accusantium cupiditate.
|
|
51
|
-
</Accordion>
|
|
52
|
-
</AccordionGroup>
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
<div>
|
|
56
|
-
<strong class="block mb-s text-semibold">Unstyled</strong>
|
|
57
|
-
<p class="mb-m">
|
|
58
|
-
In some cases, we need a fully custom animated component which hides content.
|
|
59
|
-
</p>
|
|
60
|
-
<Accordion class="mb-xl" unstyled>
|
|
61
|
-
<template #header>
|
|
62
|
-
<p>Open details</p>
|
|
63
|
-
</template>
|
|
64
|
-
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Excepturi nostrum aspernatur nam earum vitae deleniti, odio atque esse sequi, in harum! Sint dolorum quis excepturi odio eum aspernatur aliquid harum.</p>
|
|
65
|
-
</Accordion>
|
|
66
|
-
</div>
|
|
67
|
-
</Grid>
|
|
68
|
-
</div>
|
|
69
|
-
</template>
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
<script setup lang='ts'>
|
|
2
|
-
import { Icon } from '@iconify/vue'
|
|
3
|
-
import Alert from '../components/Alert/Alert.vue'
|
|
4
|
-
import Button from '../components/Button/Button.vue'
|
|
5
|
-
import Flex from '../components/Flex/Flex.vue'
|
|
6
|
-
|
|
7
|
-
const variants = ['neutral', 'danger', 'warning', 'success', 'info'] as const
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<div class="mb-xxl">
|
|
12
|
-
<h3 class="mb-l">
|
|
13
|
-
Alerts
|
|
14
|
-
</h3>
|
|
15
|
-
<table>
|
|
16
|
-
<tbody>
|
|
17
|
-
<tr>
|
|
18
|
-
<th>Base</th>
|
|
19
|
-
<td>
|
|
20
|
-
<Flex column>
|
|
21
|
-
<Alert v-for="variant in variants" :key="variant" :variant>
|
|
22
|
-
We'd like to get in touch about your car's extended warranty.
|
|
23
|
-
</Alert>
|
|
24
|
-
</Flex>
|
|
25
|
-
</td>
|
|
26
|
-
</tr>
|
|
27
|
-
<tr>
|
|
28
|
-
<th>Filled</th>
|
|
29
|
-
<td>
|
|
30
|
-
<Flex column>
|
|
31
|
-
<Alert v-for="variant in variants" :key="variant" :variant filled>
|
|
32
|
-
We'd like to get in touch about your car's extended warranty.
|
|
33
|
-
</Alert>
|
|
34
|
-
</Flex>
|
|
35
|
-
</td>
|
|
36
|
-
</tr>
|
|
37
|
-
<tr>
|
|
38
|
-
<th>Title + description</th>
|
|
39
|
-
<td>
|
|
40
|
-
<Flex column>
|
|
41
|
-
<Alert
|
|
42
|
-
v-for="variant in variants"
|
|
43
|
-
:key="variant"
|
|
44
|
-
:variant
|
|
45
|
-
title="Warranty discounts 2025"
|
|
46
|
-
description="We'd like to get in touch about your car's extended warranty."
|
|
47
|
-
/>
|
|
48
|
-
</Flex>
|
|
49
|
-
</td>
|
|
50
|
-
</tr>
|
|
51
|
-
<tr>
|
|
52
|
-
<th>Title + description + filled</th>
|
|
53
|
-
<td>
|
|
54
|
-
<Flex column>
|
|
55
|
-
<Alert v-for="variant in variants" :key="variant" :variant title="Warranty discounts 2025" filled description="We'd like to get in touch about your car's extended warranty." />
|
|
56
|
-
</Flex>
|
|
57
|
-
</td>
|
|
58
|
-
</tr>
|
|
59
|
-
<tr>
|
|
60
|
-
<th>Custom</th>
|
|
61
|
-
<td>
|
|
62
|
-
<Alert variant="warning">
|
|
63
|
-
<Flex y-center x-between>
|
|
64
|
-
<p>Unfortunately we can't help you.</p>
|
|
65
|
-
<Button>
|
|
66
|
-
<template #start>
|
|
67
|
-
<Icon icon="ph:x" />
|
|
68
|
-
</template>
|
|
69
|
-
Ignore
|
|
70
|
-
</Button>
|
|
71
|
-
</Flex>
|
|
72
|
-
</Alert>
|
|
73
|
-
</td>
|
|
74
|
-
</tr>
|
|
75
|
-
</tbody>
|
|
76
|
-
</table>
|
|
77
|
-
</div>
|
|
78
|
-
</template>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<script setup lang='ts'>
|
|
2
|
-
import Avatar from '../components/Avatar/Avatar.vue'
|
|
3
|
-
import Flex from '../components/Flex/Flex.vue'
|
|
4
|
-
|
|
5
|
-
const variants = ['s', 'm', 'l', 96] as const
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<template>
|
|
9
|
-
<div class="mb-xxl">
|
|
10
|
-
<h3 class="mb-l">
|
|
11
|
-
Avatars
|
|
12
|
-
</h3>
|
|
13
|
-
<table>
|
|
14
|
-
<tbody>
|
|
15
|
-
<tr>
|
|
16
|
-
<th>Base S, M, L <br> + custom size</th>
|
|
17
|
-
<td>
|
|
18
|
-
<Flex>
|
|
19
|
-
<Avatar v-for="size in variants" :key="size" :size />
|
|
20
|
-
</Flex>
|
|
21
|
-
</td>
|
|
22
|
-
</tr>
|
|
23
|
-
<tr>
|
|
24
|
-
<th>Photo</th>
|
|
25
|
-
<td>
|
|
26
|
-
<Flex>
|
|
27
|
-
<Avatar v-for="size in variants" :key="size" :size url="https://i.imgur.com/bHWgZfD.jpeg" />
|
|
28
|
-
</Flex>
|
|
29
|
-
</td>
|
|
30
|
-
</tr>
|
|
31
|
-
<tr>
|
|
32
|
-
<th>Abbreviation</th>
|
|
33
|
-
<td>
|
|
34
|
-
<Flex>
|
|
35
|
-
<Avatar v-for="size in variants" :key="size" :size>
|
|
36
|
-
AB
|
|
37
|
-
</Avatar>
|
|
38
|
-
</Flex>
|
|
39
|
-
</td>
|
|
40
|
-
</tr>
|
|
41
|
-
</tbody>
|
|
42
|
-
</table>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|