@dolanske/vui 0.4.0 → 1.0.0
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/README.md +6 -13
- package/dist/components/Alert/Alert.vue.d.ts +7 -1
- package/dist/components/Avatar/Avatar.vue.d.ts +15 -1
- package/dist/components/Badge/Badge.vue.d.ts +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbItem.vue.d.ts +1 -1
- package/dist/components/Button/Button.vue.d.ts +5 -15
- package/dist/components/ButtonGroup/ButtonGroup.vue.d.ts +2 -0
- package/dist/components/Calendar/Calendar.vue.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.vue.d.ts +1 -0
- package/dist/components/Dropdown/Dropdown.vue.d.ts +19 -4
- package/dist/components/Dropdown/DropdownTitle.vue.d.ts +5 -1
- package/dist/components/Flex/Flex.vue.d.ts +3 -1
- package/dist/components/Grid/Grid.vue.d.ts +7 -2
- package/dist/components/Input/Dropzone.vue.d.ts +1 -1
- package/dist/components/Input/Input.vue.d.ts +2 -2
- package/dist/components/Kbd/KbdGroup.vue.d.ts +3 -11
- package/dist/components/Modal/Confirm.vue.d.ts +1 -1
- package/dist/components/Modal/Modal.vue.d.ts +1 -1
- package/dist/components/Pagination/Pagination.vue.d.ts +3 -0
- package/dist/components/Popout/Popout.vue.d.ts +8 -1
- package/dist/components/Progress/Progress.vue.d.ts +2 -0
- package/dist/components/Radio/Radio.vue.d.ts +1 -0
- package/dist/components/Select/Select.vue.d.ts +2 -0
- package/dist/components/Sheet/Sheet.vue.d.ts +3 -0
- package/dist/components/Switch/Switch.vue.d.ts +1 -0
- package/dist/components/Table/index.d.ts +6 -0
- package/dist/components/Table/table.d.ts +1 -1
- package/dist/components/Tabs/Tab.vue.d.ts +16 -3
- package/dist/components/Tabs/Tabs.vue.d.ts +4 -0
- package/dist/components/Toast/toast.d.ts +245 -0
- package/dist/index.d.ts +2 -7
- package/dist/shared/helpers.d.ts +9 -0
- package/dist/shared/theme.d.ts +3 -0
- package/dist/style.css +1 -1
- package/dist/vui.js +6423 -6046
- package/package.json +8 -4
- package/src/App.vue +89 -192
- package/src/components/Accordion/accordion.scss +2 -0
- package/src/components/Alert/Alert.vue +11 -5
- package/src/components/Alert/alert.scss +104 -23
- package/src/components/Avatar/Avatar.vue +4 -1
- package/src/components/Avatar/avatar.scss +1 -1
- package/src/components/Badge/Badge.vue +1 -1
- package/src/components/Badge/badge.scss +134 -17
- package/src/components/Breadcrumbs/BreadcrumbItem.vue +2 -2
- package/src/components/Breadcrumbs/Breadcrumbs.vue +1 -2
- package/src/components/Breadcrumbs/breadcrumbs.scss +2 -1
- package/src/components/Button/Button.vue +16 -21
- package/src/components/Button/button.scss +159 -56
- package/src/components/ButtonGroup/ButtonGroup.vue +4 -1
- package/src/components/ButtonGroup/button-group.scss +2 -2
- package/src/components/Calendar/Calendar.vue +9 -3
- package/src/components/Calendar/calendar.scss +29 -2
- package/src/components/Card/Card.vue +2 -2
- package/src/components/Card/card.scss +4 -4
- package/src/components/Checkbox/Checkbox.vue +7 -5
- package/src/components/Checkbox/checkbox.scss +27 -13
- package/src/components/CopyClipboard/CopyClipboard.vue +15 -6
- package/src/components/CopyClipboard/copy-clipboard.scss +10 -2
- package/src/components/Drawer/Drawer.vue +4 -4
- package/src/components/Drawer/drawer.scss +1 -0
- package/src/components/Dropdown/Dropdown.vue +44 -20
- package/src/components/Dropdown/DropdownItem.vue +5 -4
- package/src/components/Dropdown/DropdownTitle.vue +7 -1
- package/src/components/Dropdown/dropdown-item.scss +84 -0
- package/src/components/Dropdown/dropdown.scss +21 -86
- package/src/components/Flex/Flex.vue +4 -1
- package/src/components/Grid/Grid.vue +25 -2
- package/src/components/Input/Color.vue +26 -0
- package/src/components/Input/Counter.vue +12 -16
- package/src/components/Input/Dropzone.vue +1 -1
- package/src/components/Input/File.vue +1 -1
- package/src/components/Input/Input.vue +8 -6
- package/src/components/Input/Password.vue +1 -13
- package/src/components/Input/Textarea.vue +4 -2
- package/src/components/Input/input.scss +113 -19
- package/src/components/Kbd/KbdGroup.vue +2 -6
- package/src/components/Kbd/kbd.scss +7 -6
- package/src/components/Modal/Confirm.vue +1 -1
- package/src/components/Modal/Modal.vue +23 -15
- package/src/components/Modal/modal.scss +11 -6
- package/src/components/OTP/otp.scss +8 -7
- package/src/components/Pagination/Pagination.vue +6 -3
- package/src/components/Popout/Popout.vue +15 -5
- package/src/components/Popout/popout.scss +8 -1
- package/src/components/Progress/Progress.vue +18 -5
- package/src/components/Progress/progress.scss +7 -1
- package/src/components/Radio/Radio.vue +4 -2
- package/src/components/Radio/radio.scss +28 -9
- package/src/components/Select/Select.vue +49 -18
- package/src/components/Select/select.scss +35 -2
- package/src/components/Sheet/Sheet.vue +8 -2
- package/src/components/Sheet/sheet.scss +9 -0
- package/src/components/Sidebar/Sidebar.vue +46 -16
- package/src/components/Sidebar/sidebar.scss +6 -5
- package/src/components/Spinner/spinner.scss +2 -1
- package/src/components/Switch/Switch.vue +4 -3
- package/src/components/Switch/switch.scss +48 -7
- package/src/components/Table/{Header.vue → Head.vue} +5 -5
- package/src/components/Table/{Table.vue → Root.vue} +2 -2
- package/src/components/Table/SelectRow.vue +2 -1
- package/src/components/Table/index.ts +7 -0
- package/src/components/Table/table.scss +25 -5
- package/src/components/Table/table.ts +7 -3
- package/src/components/Tabs/Tab.vue +7 -9
- package/src/components/Tabs/Tabs.vue +9 -2
- package/src/components/Tabs/tabs.scss +11 -3
- package/src/components/Toast/Toasts.vue +5 -0
- package/src/components/Toast/toast.scss +6 -2
- package/src/components/Toast/toast.ts +7 -0
- package/src/components/Tooltip/Tooltip.vue +9 -9
- package/src/components/Tooltip/tooltip.scss +4 -0
- package/src/examples/ExampleAccordions.vue +58 -0
- package/src/examples/ExampleAlerts.vue +78 -0
- package/src/examples/ExampleAvatars.vue +44 -0
- package/src/examples/ExampleBadges.vue +48 -0
- package/src/examples/ExampleBreadcrumbs.vue +46 -0
- package/src/examples/ExampleButtons.vue +140 -0
- package/src/examples/ExampleCalendars.vue +40 -0
- package/src/examples/ExampleCards.vue +94 -0
- package/src/examples/ExampleCheckboxes.vue +123 -0
- package/src/examples/ExampleCopyClipboard.vue +47 -0
- package/src/examples/ExampleDividers.vue +39 -0
- package/src/examples/ExampleDrawers.vue +67 -0
- package/src/examples/ExampleDropdowns.vue +114 -0
- package/src/examples/ExampleFlexGrid.vue +122 -0
- package/src/examples/ExampleInputs.vue +234 -0
- package/src/examples/ExampleKBD.vue +65 -0
- package/src/examples/ExampleModals.vue +143 -0
- package/src/examples/ExamplePalette.vue +159 -0
- package/src/examples/ExamplePopouts.vue +41 -0
- package/src/examples/ExampleSheets.vue +77 -0
- package/src/examples/ExampleSidebars.vue +270 -0
- package/src/examples/ExampleSkeletons.vue +26 -0
- package/src/examples/ExampleSpinners.vue +78 -0
- package/src/examples/ExampleTables.vue +195 -0
- package/src/examples/ExampleTabs.vue +119 -0
- package/src/examples/ExampleToasts.vue +96 -0
- package/src/examples/ExampleTooltips.vue +70 -0
- package/src/examples/shared/ExampleColor.vue +28 -0
- package/src/index.ts +4 -11
- package/src/internal/Backdrop/backdrop.scss +7 -1
- package/src/shared/helpers.ts +43 -0
- package/src/shared/theme.ts +22 -0
- package/src/style/animation.scss +1 -0
- package/src/style/core.scss +34 -57
- package/src/style/layout.scss +102 -5
- package/src/style/{fonts.scss → text.scss} +39 -0
- package/src/style/theme.scss +195 -0
- package/src/style/tooltip.scss +22 -4
- package/src/style/typography.scss +95 -18
- package/dist/components/Table/Row.vue.d.ts +0 -16
- package/src/components/Table/Row.vue +0 -9
- /package/dist/components/Table/{Header.vue.d.ts → Head.vue.d.ts} +0 -0
- /package/dist/components/Table/{Table.vue.d.ts → Root.vue.d.ts} +0 -0
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import type { VueDatePickerProps } from '@vuepic/vue-datepicker'
|
|
3
3
|
import { Icon } from '@iconify/vue'
|
|
4
4
|
import VueDatePicker from '@vuepic/vue-datepicker'
|
|
5
|
+
import { useAttrs } from 'vue'
|
|
6
|
+
import { theme } from '../../shared/theme'
|
|
5
7
|
import '@vuepic/vue-datepicker/dist/main.css'
|
|
6
8
|
import './calendar.scss'
|
|
7
9
|
|
|
@@ -10,21 +12,25 @@ const props = withDefaults(defineProps<VueDatePickerProps & {
|
|
|
10
12
|
}>(), {
|
|
11
13
|
autoApply: true,
|
|
12
14
|
autoPosition: true,
|
|
13
|
-
dark: true,
|
|
14
15
|
format: 'dd/MM/yyyy HH:mm',
|
|
16
|
+
monthNameFormat: 'long',
|
|
15
17
|
expand: false,
|
|
16
18
|
})
|
|
17
19
|
|
|
18
20
|
const ICON_SIZE = 18
|
|
21
|
+
const attrs = useAttrs()
|
|
19
22
|
</script>
|
|
20
23
|
|
|
21
24
|
<template>
|
|
22
25
|
<VueDatePicker
|
|
23
|
-
v-bind="props"
|
|
24
|
-
|
|
26
|
+
v-bind="{ ...props, ...attrs }"
|
|
27
|
+
class="vui-calendar"
|
|
28
|
+
:class="{ 'vui-calendar-inline': props.inline }"
|
|
29
|
+
:style="props.expand ?? !$slots.trigger
|
|
25
30
|
? undefined
|
|
26
31
|
: { display: 'inline-block', width: 'auto' }
|
|
27
32
|
"
|
|
33
|
+
:dark="theme === 'dark'"
|
|
28
34
|
>
|
|
29
35
|
<!-- Icon slots -->
|
|
30
36
|
<template #input-icon>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
.dp__theme_light,
|
|
1
2
|
.dp__theme_dark {
|
|
2
3
|
--dp-background-color: var(--color-bg);
|
|
3
4
|
--dp-text-color: var(--color-text);
|
|
@@ -28,19 +29,41 @@
|
|
|
28
29
|
--dp-range-between-border-color: var(--dp-hover-color, #fff);
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
// TODO: dp theme light
|
|
33
|
+
|
|
34
|
+
.dp__theme_light {
|
|
35
|
+
--dp-primary-text-color: var(--color-text);
|
|
36
|
+
}
|
|
37
|
+
|
|
31
38
|
:root {
|
|
32
39
|
--dp-font-family: var(--global-font);
|
|
33
40
|
--dp-border-radius: var(--border-radius-s);
|
|
34
41
|
--dp-cell-border-radius: var(--border-radius-s);
|
|
35
42
|
--dp-common-transition: var(--transition);
|
|
36
43
|
|
|
37
|
-
--dp-font-size: var(--font-size-
|
|
44
|
+
--dp-font-size: var(--font-size-m);
|
|
38
45
|
--dp-preview-font-size: var(--font-size-s);
|
|
39
46
|
--dp-time-font-size: var(--font-size-s);
|
|
40
47
|
}
|
|
41
48
|
|
|
49
|
+
.vui-calendar-inline {
|
|
50
|
+
.dp__outer_menu_wrap {
|
|
51
|
+
box-shadow: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.dp__menu {
|
|
55
|
+
border: none;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.dp__overlay_cell_pad {
|
|
60
|
+
font-size: var(--font-size-m);
|
|
61
|
+
text-transform: capitalize;
|
|
62
|
+
font-weight: var(--font-weight-medium);
|
|
63
|
+
}
|
|
64
|
+
|
|
42
65
|
.dp__main {
|
|
43
|
-
font-size: var(--
|
|
66
|
+
font-size: var(--font-size-m);
|
|
44
67
|
}
|
|
45
68
|
|
|
46
69
|
.dp__outer_menu_wrap {
|
|
@@ -54,3 +77,7 @@
|
|
|
54
77
|
.dp--clear-btn {
|
|
55
78
|
inset-inline-end: 8px;
|
|
56
79
|
}
|
|
80
|
+
|
|
81
|
+
.dp__input {
|
|
82
|
+
height: var(--interactive-el-height);
|
|
83
|
+
}
|
|
@@ -33,13 +33,13 @@ const {
|
|
|
33
33
|
<slot name="header-end" />
|
|
34
34
|
</div>
|
|
35
35
|
|
|
36
|
-
<Divider v-if="(separators || headerSeparator) && ($slots.header || $slots['header-end'])" :
|
|
36
|
+
<Divider v-if="(separators || headerSeparator) && ($slots.header || $slots['header-end'])" :size="1" />
|
|
37
37
|
|
|
38
38
|
<div v-if="$slots.default" class="vui-card-content">
|
|
39
39
|
<slot />
|
|
40
40
|
</div>
|
|
41
41
|
|
|
42
|
-
<Divider v-if="(separators || footerSeparator) && $slots.footer" :
|
|
42
|
+
<Divider v-if="(separators || footerSeparator) && $slots.footer" :size="1" />
|
|
43
43
|
|
|
44
44
|
<div v-if="$slots.footer" class="vui-card-footer">
|
|
45
45
|
<slot name="footer" />
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
&:not(.separators) {
|
|
15
|
-
.vui-card-content:
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
// &:not(.header-separator) .vui-card-content:first-child {
|
|
16
|
+
// padding-bottom: var(--space-xs);
|
|
17
|
+
// }
|
|
18
18
|
|
|
19
19
|
&.header-separator {
|
|
20
20
|
.vui-card-content:not(:first-child) {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
.vui-card-header {
|
|
34
34
|
display: flex;
|
|
35
|
-
align-items:
|
|
35
|
+
align-items: center;
|
|
36
36
|
justify-content: space-between;
|
|
37
37
|
padding: var(--space-s) var(--space-m);
|
|
38
38
|
background-color: var(--color-bg);
|
|
@@ -9,14 +9,17 @@ interface Props {
|
|
|
9
9
|
iconOff?: string
|
|
10
10
|
disabled?: boolean
|
|
11
11
|
checked?: boolean
|
|
12
|
+
accent?: boolean
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
const {
|
|
15
16
|
label,
|
|
17
|
+
// iconOn = theme.value === 'light' ? 'ph:check-square-fill' : 'ph:check-square',
|
|
16
18
|
iconOn = 'ph:check-square-fill',
|
|
17
19
|
iconOff = 'ph:square',
|
|
18
20
|
disabled,
|
|
19
21
|
checked: checkedProp,
|
|
22
|
+
accent,
|
|
20
23
|
} = defineProps<Props>()
|
|
21
24
|
const emit = defineEmits<{
|
|
22
25
|
change: [checked: boolean]
|
|
@@ -27,7 +30,7 @@ const id = useId()
|
|
|
27
30
|
</script>
|
|
28
31
|
|
|
29
32
|
<template>
|
|
30
|
-
<div class="vui-checkbox" :class="{ disabled: !!disabled, checked }">
|
|
33
|
+
<div class="vui-checkbox" :class="{ disabled: !!disabled, checked, accent }">
|
|
31
34
|
<input
|
|
32
35
|
:id
|
|
33
36
|
v-model="checked"
|
|
@@ -43,10 +46,9 @@ const id = useId()
|
|
|
43
46
|
<span class="vui-checkbox-icon">
|
|
44
47
|
<Icon :icon="checked ? iconOn : iconOff" />
|
|
45
48
|
</span>
|
|
46
|
-
<p v-if="label" class="vui-checkbox-content">
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</div>
|
|
49
|
+
<p v-if="label || slots.default" class="vui-checkbox-content">
|
|
50
|
+
<slot>{{ label }}</slot>
|
|
51
|
+
</p>
|
|
50
52
|
</label>
|
|
51
53
|
</div>
|
|
52
54
|
</template>
|
|
@@ -5,24 +5,21 @@
|
|
|
5
5
|
.vui-checkbox-icon svg {
|
|
6
6
|
color: var(--color-text);
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
&.accent .vui-checkbox-icon svg {
|
|
10
|
+
color: var(--color-accent);
|
|
11
|
+
}
|
|
8
12
|
}
|
|
9
13
|
|
|
10
14
|
&.disabled {
|
|
11
|
-
cursor: not-allowed;
|
|
12
|
-
|
|
13
15
|
.vui-checkbox-icon {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
color: var(--color-text-lighter);
|
|
17
|
-
}
|
|
16
|
+
opacity: 0.25;
|
|
17
|
+
cursor: not-allowed;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
input + label {
|
|
20
|
+
input + label .vui-checkbox-content {
|
|
21
|
+
opacity: 0.4;
|
|
21
22
|
cursor: not-allowed;
|
|
22
|
-
|
|
23
|
-
p {
|
|
24
|
-
color: var(--color-text-lighter);
|
|
25
|
-
}
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
25
|
|
|
@@ -38,7 +35,18 @@
|
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
input {
|
|
41
|
-
|
|
38
|
+
width: 1px;
|
|
39
|
+
height: 1px;
|
|
40
|
+
position: absolute;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
outline: none !important;
|
|
43
|
+
opacity: 0;
|
|
44
|
+
|
|
45
|
+
&:focus-visible + label .vui-checkbox-icon {
|
|
46
|
+
outline: 2px solid var(--color-text);
|
|
47
|
+
border-radius: var(--border-radius-s);
|
|
48
|
+
cursor: default;
|
|
49
|
+
}
|
|
42
50
|
|
|
43
51
|
& + label {
|
|
44
52
|
display: grid;
|
|
@@ -56,7 +64,7 @@
|
|
|
56
64
|
display: flex;
|
|
57
65
|
align-items: center;
|
|
58
66
|
min-height: var(--checkbox-size);
|
|
59
|
-
font-size: var(--font-size-
|
|
67
|
+
font-size: var(--font-size-m);
|
|
60
68
|
align-self: flex-start;
|
|
61
69
|
// line-height: var(--checkbox-size);
|
|
62
70
|
}
|
|
@@ -64,3 +72,9 @@
|
|
|
64
72
|
}
|
|
65
73
|
}
|
|
66
74
|
}
|
|
75
|
+
|
|
76
|
+
:root.light {
|
|
77
|
+
.vui-checkbox.checked.accent .vui-checkbox-icon svg {
|
|
78
|
+
color: var(--color-accent);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { autoUpdate, flip, offset, shift, useFloating } from '@floating-ui/vue'
|
|
3
3
|
import { Icon } from '@iconify/vue'
|
|
4
4
|
import { useClipboard } from '@vueuse/core'
|
|
5
|
-
import { onMounted, useSlots, useTemplateRef } from 'vue'
|
|
5
|
+
import { computed, onMounted, useSlots, useTemplateRef } from 'vue'
|
|
6
|
+
import { isNil } from '../../shared/helpers'
|
|
6
7
|
import Flex from '../Flex/Flex.vue'
|
|
7
8
|
import './copy-clipboard.scss'
|
|
8
9
|
|
|
@@ -36,13 +37,21 @@ const {
|
|
|
36
37
|
})
|
|
37
38
|
const slots = useSlots()
|
|
38
39
|
|
|
40
|
+
const parsedConfirm = computed(() => {
|
|
41
|
+
if (isNil(confirm))
|
|
42
|
+
return false
|
|
43
|
+
if (confirm === '')
|
|
44
|
+
return true
|
|
45
|
+
else return confirm
|
|
46
|
+
})
|
|
47
|
+
|
|
39
48
|
onMounted(() => {
|
|
40
49
|
if (!isSupported.value) {
|
|
41
50
|
console.error('Clipboard API is not supported. This component will not work')
|
|
42
51
|
}
|
|
43
52
|
|
|
44
|
-
if (
|
|
45
|
-
console.warn('You are using the \'confirm\' prop and slot. The slot will take precedence.')
|
|
53
|
+
if (typeof parsedConfirm.value === 'string' && slots.confirm) {
|
|
54
|
+
console.warn('[ClipBoard] You are using the \'confirm\' prop and slot. The slot will take precedence.')
|
|
46
55
|
}
|
|
47
56
|
})
|
|
48
57
|
|
|
@@ -67,10 +76,10 @@ const { floatingStyles } = useFloating(anchorRef, tooltipRef, {
|
|
|
67
76
|
</div>
|
|
68
77
|
|
|
69
78
|
<Transition name="fade-up" mode="in-out">
|
|
70
|
-
<div v-if="copied && (
|
|
79
|
+
<div v-if="copied && (!!parsedConfirm || $slots.confirm)" ref="tooltip" class="vui-clipboard-tooltip" :style="floatingStyles">
|
|
71
80
|
<slot name="confirm">
|
|
72
|
-
<template v-if="
|
|
73
|
-
{{
|
|
81
|
+
<template v-if="typeof parsedConfirm === 'string'">
|
|
82
|
+
{{ parsedConfirm }}
|
|
74
83
|
</template>
|
|
75
84
|
<Flex v-else align-center justify-center>
|
|
76
85
|
<Icon width="16" height="16" icon="ph:check-bold" />
|
|
@@ -7,11 +7,19 @@
|
|
|
7
7
|
padding: 6px 8px;
|
|
8
8
|
border-radius: var(--border-radius-s);
|
|
9
9
|
background-color: var(--color-bg-raised);
|
|
10
|
-
font-size: var(--font-size-
|
|
11
|
-
color: var(--color-text
|
|
10
|
+
font-size: var(--font-size-m);
|
|
11
|
+
color: var(--color-text);
|
|
12
12
|
box-shadow: var(--box-shadow);
|
|
13
|
+
z-index: 1000;
|
|
13
14
|
|
|
14
15
|
svg path {
|
|
15
16
|
color: var(--color-text);
|
|
16
17
|
}
|
|
17
18
|
}
|
|
19
|
+
|
|
20
|
+
:root.light {
|
|
21
|
+
.vui-clipboard-tooltip {
|
|
22
|
+
background-color: var(--color-bg);
|
|
23
|
+
box-shadow: var(--box-shadow-strong);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -45,7 +45,7 @@ const open = defineModel<boolean>()
|
|
|
45
45
|
|
|
46
46
|
const mW = computed(() => {
|
|
47
47
|
if (typeof containerSize === 'string') {
|
|
48
|
-
if (
|
|
48
|
+
if (containerSize === 'full') {
|
|
49
49
|
return '100%'
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
@@ -61,7 +61,7 @@ const mW = computed(() => {
|
|
|
61
61
|
const id = useId()
|
|
62
62
|
|
|
63
63
|
onMounted(() => {
|
|
64
|
-
if (!document.querySelector('vaul-drawer-wrapper')) {
|
|
64
|
+
if (!document.querySelector('[vaul-drawer-wrapper]')) {
|
|
65
65
|
console.error('Your root component is missing \'vaul-drawer-wrapper\' attribute. \n Without it the <Drawer /> component will not be functional.')
|
|
66
66
|
}
|
|
67
67
|
})
|
|
@@ -70,14 +70,14 @@ onMounted(() => {
|
|
|
70
70
|
<template>
|
|
71
71
|
<DrawerRoot
|
|
72
72
|
:open
|
|
73
|
-
should-scale-background
|
|
74
73
|
v-bind="rootProps"
|
|
74
|
+
:aria-describedby="id"
|
|
75
75
|
@close="open = false"
|
|
76
76
|
@update:open="(state) => open = state"
|
|
77
77
|
>
|
|
78
78
|
<DrawerPortal v-bind="portalProps">
|
|
79
79
|
<DrawerOverlay class="vui-drawer-overlay" />
|
|
80
|
-
<DrawerContent class="vui-drawer-content" :class="{ 'hide-handle': handle === false }"
|
|
80
|
+
<DrawerContent class="vui-drawer-content" :class="{ 'hide-handle': handle === false }">
|
|
81
81
|
<div :key="mW" class="vui-drawer-container container" :class="containerClass" :style="{ 'max-width': mW }">
|
|
82
82
|
<DrawerTitle class="visually-hidden" :name="id">
|
|
83
83
|
{{ title }}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang='ts'>
|
|
2
2
|
import type { MaybeElement } from '@vueuse/core'
|
|
3
3
|
import type { Placement } from '../../shared/types'
|
|
4
|
-
import { onClickOutside } from '@vueuse/core'
|
|
5
|
-
import { computed, ref, useTemplateRef } from 'vue'
|
|
4
|
+
import { onClickOutside, useMagicKeys, whenever } from '@vueuse/core'
|
|
5
|
+
import { computed, onMounted, ref, useTemplateRef, watch } from 'vue'
|
|
6
6
|
import { formatUnitValue } from '../../shared/helpers'
|
|
7
7
|
import Popout from '../Popout/Popout.vue'
|
|
8
8
|
import './dropdown.scss'
|
|
@@ -20,14 +20,24 @@ export interface Props {
|
|
|
20
20
|
* Sets the width of the dropdown to the width of its anchor
|
|
21
21
|
*/
|
|
22
22
|
expand?: boolean
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Set he max height of the dropdown element before it starts scrolling
|
|
26
|
+
*/
|
|
27
|
+
maxHeight?: number | string
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
const {
|
|
26
31
|
placement = 'bottom-start',
|
|
32
|
+
maxHeight = 356,
|
|
27
33
|
expand,
|
|
28
34
|
minWidth = 156,
|
|
29
35
|
} = defineProps<Props>()
|
|
30
36
|
|
|
37
|
+
const emit = defineEmits<{
|
|
38
|
+
close: []
|
|
39
|
+
}>()
|
|
40
|
+
|
|
31
41
|
const anchorRef = useTemplateRef<HTMLDivElement>('anchor')
|
|
32
42
|
const dropdownRef = useTemplateRef<MaybeElement>('dropdown')
|
|
33
43
|
|
|
@@ -67,6 +77,19 @@ defineExpose({
|
|
|
67
77
|
|
|
68
78
|
const mW = computed(() => formatUnitValue(minWidth))
|
|
69
79
|
const w = computed(() => expand ? `${anchorWidth.value}px` : 'initial')
|
|
80
|
+
|
|
81
|
+
const { escape } = useMagicKeys()
|
|
82
|
+
whenever(escape, close)
|
|
83
|
+
|
|
84
|
+
watch(showMenu, (v) => {
|
|
85
|
+
if (!v)
|
|
86
|
+
emit('close')
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
onMounted(() => {
|
|
90
|
+
if (expand && minWidth !== 156)
|
|
91
|
+
console.warn('[Dropdown] Dropdown: minWidth prop is ignored when expand is set to true')
|
|
92
|
+
})
|
|
70
93
|
</script>
|
|
71
94
|
|
|
72
95
|
<template>
|
|
@@ -81,31 +104,32 @@ const w = computed(() => expand ? `${anchorWidth.value}px` : 'initial')
|
|
|
81
104
|
<slot name="trigger" :open :is-open="showMenu" :close :toggle />
|
|
82
105
|
</div>
|
|
83
106
|
|
|
84
|
-
<Transition
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
</
|
|
107
|
+
<!-- <Transition name="dropdown" mode="out-in"> -->
|
|
108
|
+
<Popout
|
|
109
|
+
v-if="showMenu"
|
|
110
|
+
ref="dropdown"
|
|
111
|
+
:anchor="anchorRef"
|
|
112
|
+
class="vui-dropdown"
|
|
113
|
+
:placement
|
|
114
|
+
:style="{
|
|
115
|
+
minWidth: expand ? w : mW,
|
|
116
|
+
width: w,
|
|
117
|
+
maxHeight: formatUnitValue(maxHeight),
|
|
118
|
+
}"
|
|
119
|
+
>
|
|
120
|
+
<slot :open :close :toggle :is-open="showMenu" />
|
|
121
|
+
</Popout>
|
|
122
|
+
<!-- </Transition> -->
|
|
99
123
|
</template>
|
|
100
124
|
|
|
101
|
-
<style scoped lang="scss">
|
|
125
|
+
<!-- <style scoped lang="scss">
|
|
102
126
|
.dropdown-enter-active,
|
|
103
127
|
.dropdown-leave-active {
|
|
104
|
-
transition:
|
|
128
|
+
transition: var(--transition-fast);
|
|
105
129
|
}
|
|
106
130
|
|
|
107
131
|
.dropdown-enter-from,
|
|
108
132
|
.dropdown-leave-to {
|
|
109
133
|
opacity: 0;
|
|
110
134
|
}
|
|
111
|
-
</style>
|
|
135
|
+
</style> -->
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang='ts'>
|
|
2
2
|
import { Icon } from '@iconify/vue'
|
|
3
|
+
import './dropdown-item.scss'
|
|
3
4
|
|
|
4
5
|
interface Props {
|
|
5
6
|
disabled?: boolean
|
|
@@ -11,17 +12,17 @@ const props = defineProps<Props>()
|
|
|
11
12
|
</script>
|
|
12
13
|
|
|
13
14
|
<template>
|
|
14
|
-
<button class="vui-dropdown-item" :class="{ disabled }">
|
|
15
|
+
<button class="vui-dropdown-item" :class="{ disabled }" :disabled>
|
|
15
16
|
<!-- This should always be here to offset items which dont have icons -->
|
|
16
|
-
<div class="vui-dropdown-item-icon">
|
|
17
|
-
<Icon
|
|
17
|
+
<div v-if="props.icon" class="vui-dropdown-item-icon">
|
|
18
|
+
<Icon :icon="props.icon" />
|
|
18
19
|
</div>
|
|
19
20
|
|
|
20
21
|
<div class="vui-dropdown-item-slot">
|
|
21
22
|
<slot />
|
|
22
23
|
</div>
|
|
23
24
|
|
|
24
|
-
<div class="vui-dropdown-item-hint">
|
|
25
|
+
<div v-if="$slots.hint" class="vui-dropdown-item-hint">
|
|
25
26
|
<slot name="hint" />
|
|
26
27
|
</div>
|
|
27
28
|
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
const { sticky } = defineProps<{
|
|
3
|
+
sticky?: boolean
|
|
4
|
+
}>()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
1
7
|
<template>
|
|
2
|
-
<div class="vui-dropdown-title">
|
|
8
|
+
<div class="vui-dropdown-title" :class="{ sticky }">
|
|
3
9
|
<slot />
|
|
4
10
|
<div v-if="$slots.end" class="vui-dropdown-title-end">
|
|
5
11
|
<slot name="end" />
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
.vui-dropdown-item {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: flex-start;
|
|
5
|
+
width: fit-content;
|
|
6
|
+
gap: var(--space-xs);
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: var(--interactive-el-height);
|
|
9
|
+
border-radius: var(--border-radius-m);
|
|
10
|
+
font-size: var(--font-size-m);
|
|
11
|
+
cursor: default;
|
|
12
|
+
transition: var(--transition-fast);
|
|
13
|
+
padding-inline: var(--space-s);
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
margin-bottom: 4px;
|
|
16
|
+
|
|
17
|
+
&:last-child {
|
|
18
|
+
margin-bottom: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.disabled {
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
|
|
24
|
+
&:hover {
|
|
25
|
+
background-color: transparent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.vui-dropdown-item-slot,
|
|
29
|
+
.vui-dropdown-item-icon svg path {
|
|
30
|
+
color: var(--color-text-lighter);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.vui-dropdown-item-hint {
|
|
34
|
+
visibility: hidden;
|
|
35
|
+
opacity: 0;
|
|
36
|
+
z-index: -1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.vui-dropdown-item-icon {
|
|
41
|
+
width: 16px;
|
|
42
|
+
height: 16px;
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
|
|
47
|
+
svg {
|
|
48
|
+
width: 16px;
|
|
49
|
+
height: 16px;
|
|
50
|
+
|
|
51
|
+
path {
|
|
52
|
+
color: var(--color-text-light);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.vui-dropdown-item-hint {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: 2px;
|
|
61
|
+
margin-left: 8px;
|
|
62
|
+
font-size: 0.9rem;
|
|
63
|
+
// white-space: nowrap;
|
|
64
|
+
color: var(--color-text-lighter);
|
|
65
|
+
|
|
66
|
+
svg {
|
|
67
|
+
color: var(--color-text-lighter);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.vui-dropdown-item-slot {
|
|
72
|
+
flex: 1;
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: flex-start;
|
|
76
|
+
color: var(--color-text);
|
|
77
|
+
flex-wrap: nowrap;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&.selected,
|
|
81
|
+
&:hover {
|
|
82
|
+
background-color: var(--color-button-gray-hover);
|
|
83
|
+
}
|
|
84
|
+
}
|