@dolanske/vui 0.1.0 → 0.1.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/README.md +7 -0
- package/dist/components/Accordion/Accordion.vue.d.ts +45 -0
- package/dist/components/Accordion/AccordionGroup.vue.d.ts +32 -0
- package/dist/components/Alert/Alert.vue.d.ts +29 -0
- package/dist/components/Avatar/Avatar.vue.d.ts +9 -0
- package/dist/components/Badge/Badge.vue.d.ts +21 -0
- package/dist/components/Breadcrumbs/BreadcrumbItem.vue.d.ts +21 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.vue.d.ts +27 -0
- package/dist/components/Button/Button.vue.d.ts +41 -0
- package/dist/components/ButtonGroup/ButtonGroup.vue.d.ts +19 -0
- package/dist/components/Calendar/Calendar.vue.d.ts +27 -0
- package/dist/components/Card/Card.vue.d.ts +25 -0
- package/dist/components/Checkbox/Checkbox.vue.d.ts +31 -0
- package/dist/components/CopyClipboard/CopyClipboard.vue.d.ts +40 -0
- package/dist/components/Divider/Divider.vue.d.ts +24 -0
- package/dist/components/Drawer/Drawer.vue.d.ts +52 -0
- package/dist/components/Dropdown/DropdownItem.vue.d.ts +21 -0
- package/dist/components/Dropdown/DropdownTitle.vue.d.ts +17 -0
- package/dist/components/Flex/Flex.vue.d.ts +38 -0
- package/dist/components/Grid/Grid.vue.d.ts +27 -0
- package/dist/components/Input/Counter.vue.d.ts +19 -0
- package/dist/components/Input/Dropzone.vue.d.ts +107 -0
- package/dist/components/Input/File.vue.d.ts +7 -0
- package/dist/components/Input/Input.vue.d.ts +54 -0
- package/dist/components/Input/Password.vue.d.ts +6 -0
- package/dist/components/Input/Textarea.vue.d.ts +30 -0
- package/dist/components/Kbd/Kbd.vue.d.ts +23 -0
- package/dist/components/Kbd/KbdGroup.vue.d.ts +31 -0
- package/dist/components/Modal/Confirm.vue.d.ts +45 -0
- package/dist/components/Modal/Modal.vue.d.ts +55 -0
- package/dist/components/Pagination/Pagination.vue.d.ts +42 -0
- package/dist/components/Pagination/pagination.d.ts +12 -0
- package/dist/components/Popout/Popout.vue.d.ts +34 -0
- package/dist/components/Progress/Progress.vue.d.ts +31 -0
- package/dist/components/Radio/Radio.vue.d.ts +27 -0
- package/dist/components/Radio/RadioGroup.vue.d.ts +40 -0
- package/dist/components/Select/Select.vue.d.ts +37 -0
- package/dist/components/Sheet/Sheet.vue.d.ts +35 -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 +26 -0
- package/dist/components/Table/Cell.vue.d.ts +19 -0
- package/dist/components/Table/Header.vue.d.ts +29 -0
- package/dist/components/Table/Row.vue.d.ts +16 -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/Table.vue.d.ts +40 -0
- package/dist/components/Table/table.d.ts +68 -0
- package/dist/components/Tabs/Tab.vue.d.ts +8 -0
- package/dist/components/Tabs/Tabs.vue.d.ts +43 -0
- package/dist/components/Toast/Toasts.vue.d.ts +2 -0
- package/dist/components/Toast/toast.d.ts +42 -0
- package/dist/components/Tooltip/Tooltip.vue.d.ts +32 -0
- package/dist/index.d.ts +54 -1
- package/dist/internal/Backdrop/Backdrop.vue.d.ts +20 -0
- package/dist/shared/composables.d.ts +3 -0
- package/dist/shared/helpers.d.ts +16 -0
- package/dist/shared/types.d.ts +10 -0
- package/dist/style.css +1 -1
- package/dist/vui.js +199 -214
- package/package.json +11 -9
- package/src/App.vue +162 -0
- package/src/components/Accordion/Accordion.vue +75 -0
- package/src/components/Accordion/AccordionGroup.vue +43 -0
- package/src/components/Accordion/accordion.scss +44 -0
- package/src/components/Alert/Alert.vue +53 -0
- package/src/components/Alert/alert.scss +80 -0
- package/src/components/Avatar/Avatar.vue +36 -0
- package/src/components/Avatar/avatar.scss +46 -0
- package/src/components/Badge/Badge.vue +21 -0
- package/src/components/Badge/badge.scss +89 -0
- package/src/components/Breadcrumbs/BreadcrumbItem.vue +26 -0
- package/src/components/Breadcrumbs/Breadcrumbs.vue +33 -0
- package/src/components/Breadcrumbs/breadcrumbs.scss +30 -0
- package/src/components/Button/Button.vue +90 -0
- package/src/components/Button/button.scss +176 -0
- package/src/components/ButtonGroup/ButtonGroup.vue +25 -0
- package/src/components/ButtonGroup/button-group.scss +51 -0
- package/src/components/Calendar/Calendar.vue +58 -0
- package/src/components/Calendar/calendar.scss +56 -0
- package/src/components/Card/Card.vue +48 -0
- package/src/components/Card/card.scss +53 -0
- package/src/components/Checkbox/Checkbox.vue +49 -0
- package/src/components/Checkbox/checkbox.scss +60 -0
- package/src/components/CopyClipboard/CopyClipboard.vue +82 -0
- package/src/components/CopyClipboard/copy-clipboard.scss +17 -0
- package/src/components/Divider/Divider.vue +34 -0
- package/src/components/Divider/divider.scss +35 -0
- package/src/components/Drawer/Drawer.vue +93 -0
- package/src/components/Drawer/drawer.scss +49 -0
- package/src/components/Dropdown/Dropdown.vue +100 -0
- package/src/components/Dropdown/DropdownItem.vue +29 -0
- package/src/components/Dropdown/DropdownTitle.vue +8 -0
- package/src/components/Dropdown/dropdown.scss +112 -0
- package/src/components/Flex/Flex.vue +109 -0
- package/src/components/Grid/Grid.vue +59 -0
- package/src/components/Input/Counter.vue +70 -0
- package/src/components/Input/Dropzone.vue +63 -0
- package/src/components/Input/File.vue +15 -0
- package/src/components/Input/Input.vue +118 -0
- package/src/components/Input/Password.vue +47 -0
- package/src/components/Input/Textarea.vue +73 -0
- package/src/components/Input/input.scss +199 -0
- package/src/components/Kbd/Kbd.vue +48 -0
- package/src/components/Kbd/KbdGroup.vue +31 -0
- package/src/components/Kbd/kbd.scss +18 -0
- package/src/components/Modal/Confirm.vue +56 -0
- package/src/components/Modal/Modal.vue +91 -0
- package/src/components/Modal/modal.scss +49 -0
- package/src/components/Pagination/Pagination.vue +74 -0
- package/src/components/Pagination/pagination.ts +78 -0
- package/src/components/Popout/Popout.vue +39 -0
- package/src/components/Popout/popout.scss +7 -0
- package/src/components/Progress/Progress.vue +84 -0
- package/src/components/Progress/progress.scss +41 -0
- package/src/components/Radio/Radio.vue +36 -0
- package/src/components/Radio/RadioGroup.vue +35 -0
- package/src/components/Radio/radio.scss +59 -0
- package/src/components/Select/Select.vue +180 -0
- package/src/components/Select/select.scss +43 -0
- package/src/components/Sheet/Sheet.vue +91 -0
- package/src/components/Sheet/sheet.scss +56 -0
- package/src/components/Skeleton/Skeleton.vue +46 -0
- package/src/components/Skeleton/skeleton.scss +14 -0
- package/src/components/Spinner/Spinner.vue +44 -0
- package/src/components/Spinner/spinner.scss +46 -0
- package/src/components/Switch/Switch.vue +30 -0
- package/src/components/Switch/switch.scss +52 -0
- package/src/components/Table/Cell.vue +23 -0
- package/src/components/Table/Header.vue +59 -0
- package/src/components/Table/Row.vue +9 -0
- package/src/components/Table/SelectAll.vue +23 -0
- package/src/components/Table/SelectRow.vue +29 -0
- package/src/components/Table/Table.vue +66 -0
- package/src/components/Table/table.scss +134 -0
- package/src/components/Table/table.ts +243 -0
- package/src/components/Tabs/Tab.vue +21 -0
- package/src/components/Tabs/Tabs.vue +76 -0
- package/src/components/Tabs/tabs.scss +78 -0
- package/src/components/Toast/Toasts.vue +47 -0
- package/src/components/Toast/toast.scss +41 -0
- package/src/components/Toast/toast.ts +92 -0
- package/src/components/Tooltip/Tooltip.vue +80 -0
- package/src/components/Tooltip/tooltip.scss +4 -0
- package/src/index.scss +1 -0
- package/src/index.ts +111 -0
- package/src/internal/Backdrop/Backdrop.vue +22 -0
- package/src/internal/Backdrop/backdrop.scss +28 -0
- package/src/main.ts +5 -0
- package/src/shared/composables.ts +18 -0
- package/src/shared/helpers.ts +53 -0
- package/src/shared/types.ts +11 -0
- package/src/style/animation.scss +21 -0
- package/src/style/core.scss +128 -0
- package/src/style/fonts.scss +0 -0
- package/src/style/layout.scss +9 -0
- package/src/style/media-query.scss +29 -0
- package/src/style/reset.scss +135 -0
- package/src/style/tooltip.scss +128 -0
- package/src/style/typography.scss +339 -0
- package/src/style/utils.scss +22 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Sizes } from '../../shared/types'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import { Size } from '../../shared/types'
|
|
5
|
+
import './spinner.scss'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
size?: Sizes
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
size = 's',
|
|
13
|
+
} = defineProps<Props>()
|
|
14
|
+
|
|
15
|
+
const actualSize = computed(() => {
|
|
16
|
+
switch (size) {
|
|
17
|
+
case Size.s: return '16px'
|
|
18
|
+
case Size.l: return '38px'
|
|
19
|
+
case Size.m:
|
|
20
|
+
default: return '26px'
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const actualBorderWidth = computed(() => {
|
|
25
|
+
switch (size) {
|
|
26
|
+
case Size.s: return '3px'
|
|
27
|
+
case Size.l: return '5px'
|
|
28
|
+
case Size.m:
|
|
29
|
+
default: return '4px'
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<div :class="{ size }" class="vui-spinner" />
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<style lang="scss">
|
|
39
|
+
.vui-spinner {
|
|
40
|
+
width: v-bind(actualSize);
|
|
41
|
+
height: v-bind(actualSize);
|
|
42
|
+
border-width: v-bind(actualBorderWidth);
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.vui-spinner {
|
|
2
|
+
--spinner-color: var(--color-text);
|
|
3
|
+
aspect-ratio: 1;
|
|
4
|
+
border-radius: 50%;
|
|
5
|
+
border: 3px solid var(--spinner-color);
|
|
6
|
+
animation:
|
|
7
|
+
l20-1 0.8s infinite linear alternate,
|
|
8
|
+
l20-2 1.6s infinite linear;
|
|
9
|
+
}
|
|
10
|
+
@keyframes l20-1 {
|
|
11
|
+
0% {
|
|
12
|
+
clip-path: polygon(50% 50%, 0 0, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%);
|
|
13
|
+
}
|
|
14
|
+
12.5% {
|
|
15
|
+
clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 0%);
|
|
16
|
+
}
|
|
17
|
+
25% {
|
|
18
|
+
clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 100%, 100% 100%, 100% 100%);
|
|
19
|
+
}
|
|
20
|
+
50% {
|
|
21
|
+
clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 100%, 50% 100%, 0% 100%);
|
|
22
|
+
}
|
|
23
|
+
62.5% {
|
|
24
|
+
clip-path: polygon(50% 50%, 100% 0, 100% 0%, 100% 0%, 100% 100%, 50% 100%, 0% 100%);
|
|
25
|
+
}
|
|
26
|
+
75% {
|
|
27
|
+
clip-path: polygon(50% 50%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 50% 100%, 0% 100%);
|
|
28
|
+
}
|
|
29
|
+
100% {
|
|
30
|
+
clip-path: polygon(50% 50%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 0% 100%);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
@keyframes l20-2 {
|
|
34
|
+
0% {
|
|
35
|
+
transform: scaleY(1) rotate(0deg);
|
|
36
|
+
}
|
|
37
|
+
49.99% {
|
|
38
|
+
transform: scaleY(1) rotate(135deg);
|
|
39
|
+
}
|
|
40
|
+
50% {
|
|
41
|
+
transform: scaleY(-1) rotate(0deg);
|
|
42
|
+
}
|
|
43
|
+
100% {
|
|
44
|
+
transform: scaleY(-1) rotate(-135deg);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useId } from 'vue'
|
|
3
|
+
import './switch.scss'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
label?: string
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { label, disabled } = defineProps<Props>()
|
|
11
|
+
const slots = defineSlots()
|
|
12
|
+
const checked = defineModel<boolean>()
|
|
13
|
+
const id = useId()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div class="vui-switch" :class="{ disabled, checked }">
|
|
18
|
+
<input :id v-model="checked" type="checkbox">
|
|
19
|
+
<label :for="id">
|
|
20
|
+
<div class="vui-switch-icon">
|
|
21
|
+
<span class="vui-switch-indicator" />
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<p v-if="!slots.default" class="vui-switch-content">{{ label }}</p>
|
|
25
|
+
<div v-else class="vui-switch-content">
|
|
26
|
+
<slot />
|
|
27
|
+
</div>
|
|
28
|
+
</label>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.vui-switch {
|
|
2
|
+
--switch-size: 24px;
|
|
3
|
+
|
|
4
|
+
&.checked .vui-switch-icon .vui-switch-indicator {
|
|
5
|
+
left: calc(100% - 24px);
|
|
6
|
+
background-color: var(--color-text);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.vui-switch-icon {
|
|
10
|
+
width: 44px;
|
|
11
|
+
height: var(--switch-size);
|
|
12
|
+
border-radius: 22px;
|
|
13
|
+
background-color: var(--color-bg-raised);
|
|
14
|
+
position: relative;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
|
|
17
|
+
.vui-switch-indicator {
|
|
18
|
+
display: block;
|
|
19
|
+
position: absolute;
|
|
20
|
+
left: 2px;
|
|
21
|
+
top: 2px;
|
|
22
|
+
width: 20px;
|
|
23
|
+
height: 20px;
|
|
24
|
+
border-radius: 100%;
|
|
25
|
+
background-color: var(--color-bg);
|
|
26
|
+
transition: var(--transition);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
input {
|
|
31
|
+
display: none;
|
|
32
|
+
|
|
33
|
+
& + label {
|
|
34
|
+
display: grid;
|
|
35
|
+
grid-template-columns: 44px 1fr;
|
|
36
|
+
gap: 10px;
|
|
37
|
+
font-size: var(--font-size-m);
|
|
38
|
+
color: var(--color-text);
|
|
39
|
+
user-select: none;
|
|
40
|
+
|
|
41
|
+
.vui-switch-content {
|
|
42
|
+
display: block;
|
|
43
|
+
|
|
44
|
+
&:is(p) {
|
|
45
|
+
height: var(--switch-size);
|
|
46
|
+
line-height: var(--switch-size);
|
|
47
|
+
font-size: var(--font-size-ms);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, useSlots, useTemplateRef } from 'vue'
|
|
3
|
+
|
|
4
|
+
const slots = useSlots()
|
|
5
|
+
const contextRef = useTemplateRef<HTMLTableCellElement>('context')
|
|
6
|
+
const computedStyle = computed(() => {
|
|
7
|
+
if (!slots.context)
|
|
8
|
+
return {}
|
|
9
|
+
const width = contextRef.value?.getBoundingClientRect().width ?? 0
|
|
10
|
+
return {
|
|
11
|
+
paddingRight: `${width}px`,
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<td :style="computedStyle">
|
|
18
|
+
<slot />
|
|
19
|
+
<div v-if="$slots.context" ref="context" class="vui-cell-context">
|
|
20
|
+
<slot name="context" />
|
|
21
|
+
</div>
|
|
22
|
+
</td>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Header } from './table'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import Button from '../Button/Button.vue'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
/**
|
|
8
|
+
* Main header data. This can be empty in case we are just adding an empty
|
|
9
|
+
* padder. It is recommended to just use <th> instead, but this shouldn't fail
|
|
10
|
+
* anyway
|
|
11
|
+
*/
|
|
12
|
+
header?: Header
|
|
13
|
+
/**
|
|
14
|
+
* Enable sorting on this column
|
|
15
|
+
*/
|
|
16
|
+
sort?: boolean
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const props = defineProps<Props>()
|
|
20
|
+
|
|
21
|
+
const sortStateBind = computed(() => {
|
|
22
|
+
if (!props.header)
|
|
23
|
+
return
|
|
24
|
+
switch (props.header.sortKey) {
|
|
25
|
+
case 'asc': return {
|
|
26
|
+
'icon': 'ph:sort-ascending',
|
|
27
|
+
'data-title-top': 'Ascending',
|
|
28
|
+
}
|
|
29
|
+
case 'desc': return {
|
|
30
|
+
'icon': 'ph:sort-descending',
|
|
31
|
+
'data-title-top': 'Descending',
|
|
32
|
+
}
|
|
33
|
+
default: return {
|
|
34
|
+
'icon': 'ph:arrows-down-up',
|
|
35
|
+
'data-title-top': 'Sort column',
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<th>
|
|
43
|
+
<div v-if="props.header" class="vui-table-th-content">
|
|
44
|
+
<slot>
|
|
45
|
+
{{ props.header.label }}
|
|
46
|
+
</slot>
|
|
47
|
+
<Button
|
|
48
|
+
v-if="props.sort"
|
|
49
|
+
class="vui-table-sort-button"
|
|
50
|
+
v-bind="sortStateBind"
|
|
51
|
+
:class="{ active: !!props.header.sortKey }"
|
|
52
|
+
size="s"
|
|
53
|
+
plain
|
|
54
|
+
square
|
|
55
|
+
@click="props.header.sortToggle"
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
</th>
|
|
59
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
import type { TableSelectionProvide } from './table'
|
|
3
|
+
import { inject } from 'vue'
|
|
4
|
+
import Button from '../Button/Button.vue'
|
|
5
|
+
import { TableSelectionProvideSymbol } from './table'
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
isSelectedAll,
|
|
9
|
+
enabled,
|
|
10
|
+
selectAllRows,
|
|
11
|
+
} = inject(TableSelectionProvideSymbol) as TableSelectionProvide
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<th v-if="enabled" class="vui-table-interactive-cell" :class="{ selected: isSelectedAll }">
|
|
16
|
+
<Button
|
|
17
|
+
square
|
|
18
|
+
plain
|
|
19
|
+
:icon="isSelectedAll ? 'ph:check-square-fill' : 'ph:square'"
|
|
20
|
+
@click="selectAllRows()"
|
|
21
|
+
/>
|
|
22
|
+
</th>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
import type { BaseRow, TableSelectionProvide } from './table'
|
|
3
|
+
import { computed, inject } from 'vue'
|
|
4
|
+
import Button from '../Button/Button.vue'
|
|
5
|
+
import { TableSelectionProvideSymbol } from './table'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
row: BaseRow
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = defineProps<Props>()
|
|
12
|
+
const {
|
|
13
|
+
enabled,
|
|
14
|
+
selectRow,
|
|
15
|
+
selectedRows,
|
|
16
|
+
} = inject(TableSelectionProvideSymbol) as TableSelectionProvide
|
|
17
|
+
const isSelected = computed(() => selectedRows.value.has(props.row))
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<td v-if="enabled" class="vui-table-interactive-cell" :class="{ selected: isSelected }">
|
|
22
|
+
<Button
|
|
23
|
+
square
|
|
24
|
+
plain
|
|
25
|
+
:icon="isSelected ? 'ph:check-square-fill' : 'ph:square'"
|
|
26
|
+
@click="selectRow(props.row)"
|
|
27
|
+
/>
|
|
28
|
+
</td>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
import type { TableSelectionProvide } from './table'
|
|
3
|
+
import { inject } from 'vue'
|
|
4
|
+
import { TableSelectionProvideSymbol } from './table'
|
|
5
|
+
import './table.scss'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
/**
|
|
9
|
+
* Sets the `table-layout` property
|
|
10
|
+
*/
|
|
11
|
+
fixed?: boolean
|
|
12
|
+
/**
|
|
13
|
+
* Table cells with content overflowing on new line will be cropped
|
|
14
|
+
*/
|
|
15
|
+
nowrap?: boolean
|
|
16
|
+
/**
|
|
17
|
+
* Add a visual separator between each row
|
|
18
|
+
*/
|
|
19
|
+
separateRows?: boolean
|
|
20
|
+
/**
|
|
21
|
+
* Add a visual separator between each cell
|
|
22
|
+
*/
|
|
23
|
+
separateCells?: boolean
|
|
24
|
+
/**
|
|
25
|
+
* Wrap table with a border
|
|
26
|
+
*/
|
|
27
|
+
outerBorder?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
fixed,
|
|
32
|
+
nowrap,
|
|
33
|
+
separateRows = true,
|
|
34
|
+
separateCells = false,
|
|
35
|
+
outerBorder = true,
|
|
36
|
+
} = defineProps<Props>()
|
|
37
|
+
const selecting = inject(TableSelectionProvideSymbol) as TableSelectionProvide
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div
|
|
42
|
+
class="vui-table-container"
|
|
43
|
+
:class="{
|
|
44
|
+
fixed,
|
|
45
|
+
nowrap,
|
|
46
|
+
'selecting': selecting.enabled,
|
|
47
|
+
'separated-rows': separateRows,
|
|
48
|
+
'separated-cells': separateCells,
|
|
49
|
+
'outer-border': outerBorder,
|
|
50
|
+
}"
|
|
51
|
+
>
|
|
52
|
+
<table>
|
|
53
|
+
<thead>
|
|
54
|
+
<tr>
|
|
55
|
+
<slot name="header" />
|
|
56
|
+
</tr>
|
|
57
|
+
</thead>
|
|
58
|
+
<tbody>
|
|
59
|
+
<slot name="body" />
|
|
60
|
+
</tbody>
|
|
61
|
+
</table>
|
|
62
|
+
<div class="vui-table-pagination-wrap">
|
|
63
|
+
<slot name="pagination" />
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
.vui-table-container {
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
border-radius: var(--border-radius-m);
|
|
5
|
+
|
|
6
|
+
&.fixed table {
|
|
7
|
+
table-layout: fixed;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&.outer-border {
|
|
11
|
+
border: 1px solid var(--color-border);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&.nowrap table tr {
|
|
15
|
+
td {
|
|
16
|
+
white-space: nowrap;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
text-overflow: ellipsis;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.separated-rows table {
|
|
23
|
+
th,
|
|
24
|
+
td {
|
|
25
|
+
border-bottom: 1px solid var(--color-border);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.separated-cells table {
|
|
30
|
+
th,
|
|
31
|
+
td {
|
|
32
|
+
border-right: 1px solid var(--color-border);
|
|
33
|
+
|
|
34
|
+
&:last-of-type {
|
|
35
|
+
border-right: none;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
table {
|
|
41
|
+
width: 100%;
|
|
42
|
+
border-collapse: collapse;
|
|
43
|
+
text-indent: 0;
|
|
44
|
+
border: none;
|
|
45
|
+
overflow: unset;
|
|
46
|
+
|
|
47
|
+
tr {
|
|
48
|
+
border: none;
|
|
49
|
+
|
|
50
|
+
&:has(.vui-table-interactive-cell.selected) {
|
|
51
|
+
td {
|
|
52
|
+
background-color: var(--color-bg-raised);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
th,
|
|
58
|
+
td {
|
|
59
|
+
font-size: var(--font-size-ms);
|
|
60
|
+
border: none;
|
|
61
|
+
border-left: none !important;
|
|
62
|
+
transition: var(--transition-quick);
|
|
63
|
+
position: relative;
|
|
64
|
+
z-index: 1;
|
|
65
|
+
|
|
66
|
+
// Fixed width, only houses a checkbox component
|
|
67
|
+
&.vui-table-interactive-cell {
|
|
68
|
+
--checkbox-cell-width: calc(calc(var(--space-xs) * 2) + 32px);
|
|
69
|
+
width: var(--checkbox-cell-width);
|
|
70
|
+
min-width: var(--checkbox-cell-width);
|
|
71
|
+
max-width: var(--checkbox-cell-width);
|
|
72
|
+
height: auto;
|
|
73
|
+
padding-inline: var(--space-xs);
|
|
74
|
+
padding-block: 0;
|
|
75
|
+
|
|
76
|
+
&.selected .vui-button.icon .vui-button-slot svg path {
|
|
77
|
+
color: var(--color-text) !important;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.vui-button {
|
|
81
|
+
vertical-align: middle;
|
|
82
|
+
display: inline-flex;
|
|
83
|
+
|
|
84
|
+
&.icon .vui-button-slot svg {
|
|
85
|
+
width: 22px !important;
|
|
86
|
+
height: 22px !important;
|
|
87
|
+
|
|
88
|
+
path {
|
|
89
|
+
color: var(--color-text-light);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.vui-cell-context {
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
z-index: 2;
|
|
100
|
+
position: absolute;
|
|
101
|
+
inset: 0;
|
|
102
|
+
padding: var(--space-xs);
|
|
103
|
+
background-color: var(--color-bg);
|
|
104
|
+
left: unset;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
th {
|
|
109
|
+
.vui-table-th-content {
|
|
110
|
+
color: var(--color-text-light);
|
|
111
|
+
font-size: var(--font-size-xs);
|
|
112
|
+
text-transform: uppercase;
|
|
113
|
+
font-weight: 500;
|
|
114
|
+
display: flex;
|
|
115
|
+
justify-content: flex-start;
|
|
116
|
+
align-items: center;
|
|
117
|
+
gap: var(--space-xs);
|
|
118
|
+
|
|
119
|
+
.vui-table-sort-button:not(.active) svg path {
|
|
120
|
+
color: var(--color-text-lighter);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.vui-table-pagination-wrap {
|
|
127
|
+
padding: var(--space-s) var(--space-m);
|
|
128
|
+
|
|
129
|
+
p {
|
|
130
|
+
font-size: var(--font-size-s);
|
|
131
|
+
color: var(--color-text-lighter);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|