@privyid/persona 0.21.0 → 0.22.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/dist/components/accordion/Accordion.vue +1 -1
- package/dist/components/accordion/AccordionItem.vue +6 -6
- package/dist/components/badge/Badge.vue +21 -3
- package/dist/components/banner/Banner.vue +5 -0
- package/dist/components/banner/Banner.vue.d.ts +9 -0
- package/dist/components/button/Button.vue +18 -18
- package/dist/components/calendar/adapter/adapter.d.ts +1 -8
- package/dist/components/calendar/adapter/adapter.mjs +0 -10
- package/dist/components/calendar/adapter/date.mjs +2 -2
- package/dist/components/calendar/adapter/month.mjs +2 -2
- package/dist/components/card/CardSection.vue +1 -0
- package/dist/components/carousel/Carousel.vue.d.ts +6 -6
- package/dist/components/chart/ChartSet.vue.d.ts +2 -2
- package/dist/components/chart/ChartVal.vue.d.ts +4 -4
- package/dist/components/checkbox/Checkbox.vue +98 -112
- package/dist/components/checkbox/icon/IconCheckbox.vue +13 -0
- package/dist/components/checkbox/icon/IconInderteminate.vue +12 -0
- package/dist/components/contextual-bar/ContextualBar.vue +67 -19
- package/dist/components/contextual-bar/ContextualBar.vue.d.ts +3 -3
- package/dist/components/contextual-bar/index.d.ts +1 -1
- package/dist/components/cropper/Cropper.vue.d.ts +8 -8
- package/dist/components/datepicker/Datepicker.vue +2 -0
- package/dist/components/datepicker/Datepicker.vue.d.ts +1 -1
- package/dist/components/dialog/Dialog.vue +2 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/divider/Divider.vue +1 -1
- package/dist/components/dropdown/Dropdown.vue +303 -222
- package/dist/components/dropzone/Dropzone.vue.d.ts +3 -3
- package/dist/components/filterbar/pinned/PinnedDate.vue +2 -0
- package/dist/components/filterbar/pinned/PinnedDate.vue.d.ts +1 -1
- package/dist/components/filterbar/pinned/PinnedMultiselect.vue +10 -6
- package/dist/components/filterbar/pinned/PinnedSelect.vue +11 -7
- package/dist/components/filterbar/pinned/PinnedSelect.vue.d.ts +3 -3
- package/dist/components/filterbar/pinned/PinnedToggle.vue.d.ts +7 -7
- package/dist/components/global/store.d.ts +2 -1
- package/dist/components/heading/Heading.vue.d.ts +1 -1
- package/dist/components/input/Input.vue +16 -5
- package/dist/components/input/Input.vue.d.ts +4 -3
- package/dist/components/input/index.d.ts +1 -1
- package/dist/components/input-file/InputFile.vue.d.ts +3 -3
- package/dist/components/input-pin/InputPin.vue.d.ts +2 -2
- package/dist/components/input-range/InputRange.vue.d.ts +6 -6
- package/dist/components/label/Label.vue +9 -8
- package/dist/components/label/Label.vue.d.ts +1 -1
- package/dist/components/main/Main.vue +4 -2
- package/dist/components/markdown/index.d.ts +6 -1
- package/dist/components/markdown/index.mjs +8 -2
- package/dist/components/meta.json +135 -0
- package/dist/components/modal/Modal.vue +215 -12
- package/dist/components/modal/Modal.vue.d.ts +55 -1
- package/dist/components/modal/index.d.ts +1 -1
- package/dist/components/nav/Nav.vue +5 -1
- package/dist/components/nav/NavItemDropdown.vue.d.ts +1 -1
- package/dist/components/nav/NavSubItem.vue +6 -6
- package/dist/components/navbar/Navbar.vue.d.ts +1 -1
- package/dist/components/navbar/NavbarBrand.vue +1 -1
- package/dist/components/pdf-helipad/PdfHelipad.vue +101 -85
- package/dist/components/pdf-helipad/utils/use-drag.d.ts +2 -7
- package/dist/components/pdf-helipad/utils/use-drag.mjs +1 -1
- package/dist/components/pdf-object/utils/use-drag.d.ts +1 -0
- package/dist/components/pdf-object/utils/use-drag.mjs +1 -1
- package/dist/components/pdf-viewer/PdfViewer.vue.d.ts +4 -4
- package/dist/components/progress-indicator/ProgressIndicator.vue.d.ts +2 -2
- package/dist/components/progressbar/Progressbar.vue.d.ts +7 -7
- package/dist/components/radio/Radio.vue.d.ts +4 -4
- package/dist/components/ringbar/Ringbar.vue.d.ts +6 -6
- package/dist/components/select/Select.vue +396 -214
- package/dist/components/select/SelectInput.vue +102 -0
- package/dist/components/select/SelectTags.vue +57 -0
- package/dist/components/select/adapter/adapter.d.ts +1 -0
- package/dist/components/select/adapter/async-adapter.d.ts +13 -1
- package/dist/components/select/adapter/async-adapter.mjs +8 -15
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.mjs +4 -1
- package/dist/components/sheet/Sheet.vue +2 -3
- package/dist/components/sidebar/Sidebar.vue +101 -116
- package/dist/components/sidebar/SidebarBrand.vue +1 -1
- package/dist/components/sidebar/SidebarContent.vue +27 -0
- package/dist/components/sidebar/SidebarNav.vue +60 -84
- package/dist/components/sidebar-menu/SidebarMenu.vue +57 -204
- package/dist/components/sidebar-menu/SidebarMenuItem.vue +70 -0
- package/dist/components/signature-text/SignatureText.vue.d.ts +4 -4
- package/dist/components/steps/StepSlider.vue +2 -2
- package/dist/components/strengthbar/Strengthbar.vue.d.ts +8 -8
- package/dist/components/table-flex/TableFlex.vue +3 -5
- package/dist/components/table-static/TableStatic.vue +118 -111
- package/dist/components/table-static/TableStaticRoot.vue +42 -0
- package/dist/components/tabs/Tab.vue +13 -15
- package/dist/components/tabs/TabContent.vue +64 -23
- package/dist/components/tabs/Tabs.vue +93 -75
- package/dist/components/text/Text.vue +15 -7
- package/dist/components/text/Text.vue.d.ts +11 -2
- package/dist/components/text/index.d.ts +1 -0
- package/dist/components/textarea/Textarea.vue.d.ts +5 -5
- package/dist/components/toggle/Toggle.vue +12 -1
- package/dist/components/toggle/Toggle.vue.d.ts +16 -7
- package/dist/components/tooltip/index.mjs +1 -1
- package/dist/components/tooltip/utils/create-handler.mjs +1 -1
- package/dist/components/tour/TourDialog.vue +6 -0
- package/dist/components/truncate/Truncate.vue +1 -1
- package/dist/components/truncate/Truncate.vue.d.ts +2 -2
- package/dist/components/utils/date.d.ts +21 -0
- package/dist/components/utils/date.mjs +15 -0
- package/dist/components/utils/vnode.mjs +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.mjs +4 -0
- package/dist/module.json +1 -1
- package/package.json +17 -17
- package/dist/components/checkbox/Checkbox.vue.d.ts +0 -84
- package/dist/components/dropdown/Dropdown.vue.d.ts +0 -147
- package/dist/components/pdf-helipad/PdfHelipad.vue.d.ts +0 -45
- package/dist/components/select/Select.vue.d.ts +0 -157
- package/dist/components/sidebar/Sidebar.vue.d.ts +0 -80
- package/dist/components/sidebar/SidebarNav.vue.d.ts +0 -66
- package/dist/components/sidebar-menu/SidebarMenu.vue.d.ts +0 -91
- package/dist/components/tabs/Tab.vue.d.ts +0 -23
- package/dist/components/tabs/TabContent.vue.d.ts +0 -14
- package/dist/components/tabs/Tabs.vue.d.ts +0 -80
|
@@ -1,112 +1,109 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<TableStaticRoot
|
|
3
3
|
data-testid="table-static"
|
|
4
|
-
|
|
5
|
-
:class="classNames"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
:disabled="!draggable">
|
|
49
|
-
<template #item="{ element, index }">
|
|
50
|
-
<tr
|
|
51
|
-
class="table-static__row"
|
|
52
|
-
:class="trClass"
|
|
53
|
-
data-role="row">
|
|
54
|
-
<slot
|
|
55
|
-
name="row"
|
|
56
|
-
:item="element"
|
|
57
|
-
:index="index">
|
|
58
|
-
<td
|
|
59
|
-
v-if="draggable"
|
|
60
|
-
class="table-static__cell table-static__drag"
|
|
61
|
-
data-testid="table-static-drag-handle">
|
|
62
|
-
<IconDrag />
|
|
63
|
-
</td>
|
|
64
|
-
<td
|
|
65
|
-
v-if="selectable"
|
|
66
|
-
class="table-static__cell table-static__checkbox">
|
|
67
|
-
<Checkbox
|
|
68
|
-
v-model="model"
|
|
69
|
-
data-testid="table-static-select"
|
|
70
|
-
:value="withoutKey(element)"
|
|
71
|
-
:disabled="element._selectable === false" />
|
|
72
|
-
</td>
|
|
73
|
-
<td
|
|
74
|
-
v-for="field in fields"
|
|
75
|
-
:key="field.key"
|
|
76
|
-
class="table-static__cell"
|
|
77
|
-
data-testid="table-static-cell"
|
|
78
|
-
:class="field.tdClass"
|
|
79
|
-
:data-cell="field.key">
|
|
80
|
-
<slot
|
|
81
|
-
:name="`cell(${field.key})`"
|
|
82
|
-
:index="index"
|
|
83
|
-
:item="element">
|
|
84
|
-
{{ field.formatter(element[field.key], element) }}
|
|
85
|
-
</slot>
|
|
86
|
-
</td>
|
|
87
|
-
</slot>
|
|
88
|
-
</tr>
|
|
89
|
-
</template>
|
|
90
|
-
</Draggable>
|
|
91
|
-
<tbody
|
|
92
|
-
v-else
|
|
93
|
-
class="table-static__body">
|
|
4
|
+
:scrollable="scrollable"
|
|
5
|
+
:class="classNames"
|
|
6
|
+
:table-class="tableClass">
|
|
7
|
+
<thead
|
|
8
|
+
v-if="!noLabel"
|
|
9
|
+
class="table-static__headers">
|
|
10
|
+
<tr :class="trClass">
|
|
11
|
+
<th
|
|
12
|
+
v-if="draggable"
|
|
13
|
+
class="table-static__header table-static__drag" />
|
|
14
|
+
<th
|
|
15
|
+
v-if="selectable"
|
|
16
|
+
class="table-static__header table-static__checkbox">
|
|
17
|
+
<Checkbox
|
|
18
|
+
v-model="selectAll"
|
|
19
|
+
data-testid="table-static-select-all"
|
|
20
|
+
:indeterminate="indeterminate" />
|
|
21
|
+
</th>
|
|
22
|
+
<th
|
|
23
|
+
v-for="field in fields"
|
|
24
|
+
:key="field.key"
|
|
25
|
+
class="table-static__header"
|
|
26
|
+
data-testid="table-static-header"
|
|
27
|
+
:style="field.width ? { width: withUnit(field.width) } : {}"
|
|
28
|
+
:class="field.thClass"
|
|
29
|
+
:data-header="field.key">
|
|
30
|
+
<slot
|
|
31
|
+
:name="`head(${field.key})`"
|
|
32
|
+
:label="field.label"
|
|
33
|
+
:field="field">
|
|
34
|
+
{{ field.label }}
|
|
35
|
+
</slot>
|
|
36
|
+
</th>
|
|
37
|
+
</tr>
|
|
38
|
+
</thead>
|
|
39
|
+
<Draggable
|
|
40
|
+
v-if="items.length > 0"
|
|
41
|
+
v-model="rows"
|
|
42
|
+
class="table-static__body"
|
|
43
|
+
handle=".table-static__drag"
|
|
44
|
+
item-key="_key"
|
|
45
|
+
tag="tbody"
|
|
46
|
+
:disabled="!draggable">
|
|
47
|
+
<template #item="{ element, index }">
|
|
94
48
|
<tr
|
|
95
|
-
class="table-static__row"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
49
|
+
class="table-static__row"
|
|
50
|
+
:class="trClass"
|
|
51
|
+
data-role="row">
|
|
52
|
+
<slot
|
|
53
|
+
name="row"
|
|
54
|
+
:item="element"
|
|
55
|
+
:index="index">
|
|
56
|
+
<td
|
|
57
|
+
v-if="draggable"
|
|
58
|
+
class="table-static__cell table-static__drag"
|
|
59
|
+
data-testid="table-static-drag-handle">
|
|
60
|
+
<IconDrag />
|
|
61
|
+
</td>
|
|
62
|
+
<td
|
|
63
|
+
v-if="selectable"
|
|
64
|
+
class="table-static__cell table-static__checkbox">
|
|
65
|
+
<Checkbox
|
|
66
|
+
v-model="model"
|
|
67
|
+
data-testid="table-static-select"
|
|
68
|
+
:value="withoutKey(element)"
|
|
69
|
+
:disabled="element._selectable === false" />
|
|
70
|
+
</td>
|
|
71
|
+
<td
|
|
72
|
+
v-for="field in fields"
|
|
73
|
+
:key="field.key"
|
|
74
|
+
class="table-static__cell"
|
|
75
|
+
data-testid="table-static-cell"
|
|
76
|
+
:class="field.tdClass"
|
|
77
|
+
:data-cell="field.key">
|
|
78
|
+
<slot
|
|
79
|
+
:name="`cell(${field.key})`"
|
|
80
|
+
:index="index"
|
|
81
|
+
:item="element">
|
|
82
|
+
{{ field.formatter(element[field.key], element) }}
|
|
83
|
+
</slot>
|
|
84
|
+
</td>
|
|
85
|
+
</slot>
|
|
106
86
|
</tr>
|
|
107
|
-
</
|
|
108
|
-
</
|
|
109
|
-
|
|
87
|
+
</template>
|
|
88
|
+
</Draggable>
|
|
89
|
+
<tbody
|
|
90
|
+
v-else
|
|
91
|
+
class="table-static__body">
|
|
92
|
+
<tr
|
|
93
|
+
class="table-static__row">
|
|
94
|
+
<td
|
|
95
|
+
:colspan="fields.length"
|
|
96
|
+
data-testid="table-static-empty"
|
|
97
|
+
class="table-static__cell table-static__cell--empty datatable__state-empty">
|
|
98
|
+
<slot name="empty">
|
|
99
|
+
<span class="flex items-center justify-center text-subtle dark:text-dark-subtle">
|
|
100
|
+
{{ emptyLabel }}
|
|
101
|
+
</span>
|
|
102
|
+
</slot>
|
|
103
|
+
</td>
|
|
104
|
+
</tr>
|
|
105
|
+
</tbody>
|
|
106
|
+
</TableStaticRoot>
|
|
110
107
|
</template>
|
|
111
108
|
|
|
112
109
|
<script lang="ts" setup generic="T extends Record<string, unknown>">
|
|
@@ -124,6 +121,7 @@ import {
|
|
|
124
121
|
withUnit,
|
|
125
122
|
} from '../table'
|
|
126
123
|
import Checkbox from '../checkbox/Checkbox.vue'
|
|
124
|
+
import TableStaticRoot from './TableStaticRoot.vue'
|
|
127
125
|
import { useVModel } from '../input'
|
|
128
126
|
import IconDrag from '@privyid/persona-icon/vue/draggable/20.vue'
|
|
129
127
|
import Draggable from 'vuedraggable'
|
|
@@ -177,14 +175,16 @@ const props = defineProps({
|
|
|
177
175
|
] as PropType<HTMLAttributes['class']>,
|
|
178
176
|
default: undefined,
|
|
179
177
|
},
|
|
178
|
+
scrollable: {
|
|
179
|
+
type : Boolean,
|
|
180
|
+
default: true,
|
|
181
|
+
},
|
|
180
182
|
})
|
|
181
183
|
|
|
182
184
|
const model = useVModel(props)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
(event: 'update:modelValue', items: T[]): void,
|
|
187
|
-
(event: 'update:items', items: T[]): void,
|
|
185
|
+
const emit = defineEmits<{
|
|
186
|
+
'update:modelValue': [T[]],
|
|
187
|
+
'update:items': [T[]],
|
|
188
188
|
}>()
|
|
189
189
|
|
|
190
190
|
const rows = computed<T[]>({
|
|
@@ -213,6 +213,9 @@ const classNames = computed(() => {
|
|
|
213
213
|
if (props.noLabel)
|
|
214
214
|
result.push('table-static--no-label')
|
|
215
215
|
|
|
216
|
+
if (props.scrollable)
|
|
217
|
+
result.push('table-static--scrollable')
|
|
218
|
+
|
|
216
219
|
return result
|
|
217
220
|
})
|
|
218
221
|
|
|
@@ -255,7 +258,7 @@ defineSlots<{
|
|
|
255
258
|
--p-table-border: theme(borderColor.default.DEFAULT);
|
|
256
259
|
--p-table-border-dark: theme(borderColor.dark.default.DEFAULT);
|
|
257
260
|
|
|
258
|
-
@apply w-full
|
|
261
|
+
@apply w-full;
|
|
259
262
|
|
|
260
263
|
&__table {
|
|
261
264
|
@apply min-w-full table;
|
|
@@ -329,5 +332,9 @@ defineSlots<{
|
|
|
329
332
|
}
|
|
330
333
|
}
|
|
331
334
|
}
|
|
335
|
+
|
|
336
|
+
&--scrollable {
|
|
337
|
+
@apply overflow-auto overscroll-contain;
|
|
338
|
+
}
|
|
332
339
|
}
|
|
333
340
|
</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template v-if="scrollable">
|
|
3
|
+
<div
|
|
4
|
+
class="table-static"
|
|
5
|
+
v-bind="$attrs">
|
|
6
|
+
<table
|
|
7
|
+
class="table-static__table"
|
|
8
|
+
:class="tableClass">
|
|
9
|
+
<slot />
|
|
10
|
+
</table>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
<template v-else>
|
|
14
|
+
<table
|
|
15
|
+
class="table-static__table"
|
|
16
|
+
:class="tableClass"
|
|
17
|
+
v-bind="$attrs">
|
|
18
|
+
<slot />
|
|
19
|
+
</table>
|
|
20
|
+
</template>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script lang="ts" setup>
|
|
24
|
+
import { HTMLAttributes, PropType } from 'vue-demi'
|
|
25
|
+
|
|
26
|
+
defineOptions({ inheritAttrs: false })
|
|
27
|
+
|
|
28
|
+
defineProps({
|
|
29
|
+
scrollable: {
|
|
30
|
+
type : Boolean,
|
|
31
|
+
default: true,
|
|
32
|
+
},
|
|
33
|
+
tableClass: {
|
|
34
|
+
type: [
|
|
35
|
+
String,
|
|
36
|
+
Array,
|
|
37
|
+
Object,
|
|
38
|
+
] as PropType<HTMLAttributes['class']>,
|
|
39
|
+
default: undefined,
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
</script>
|
|
@@ -10,19 +10,17 @@
|
|
|
10
10
|
</section>
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
|
-
<script>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
});
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
defineProps({
|
|
15
|
+
title: {
|
|
16
|
+
type : String,
|
|
17
|
+
default: '',
|
|
18
|
+
},
|
|
19
|
+
disabled: {
|
|
20
|
+
type : Boolean,
|
|
21
|
+
default: false,
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
defineOptions({ name: 'Tab' })
|
|
28
26
|
</script>
|
|
@@ -1,27 +1,68 @@
|
|
|
1
|
-
<
|
|
1
|
+
<template>
|
|
2
|
+
<render />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script lang="ts" setup>
|
|
2
6
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
VNode,
|
|
8
|
+
Transition,
|
|
9
|
+
h,
|
|
10
|
+
ref,
|
|
11
|
+
watch,
|
|
12
|
+
resolveComponent,
|
|
13
|
+
} from 'vue-demi'
|
|
14
|
+
import { findAllChildren, toBoolean } from '../utils/vnode'
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
active: {
|
|
18
|
+
type : Number,
|
|
19
|
+
required: true,
|
|
13
20
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
keepAlive: {
|
|
22
|
+
type : Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
vertical: {
|
|
26
|
+
type : Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const transition = ref(props.vertical ? 'slide-top' : 'slide-left')
|
|
32
|
+
|
|
33
|
+
watch(() => props.active, (value, last) => {
|
|
34
|
+
transition.value = value < last
|
|
35
|
+
? (props.vertical ? 'slide-bottom' : 'slide-right')
|
|
36
|
+
: (props.vertical ? 'slide-top' : 'slide-left')
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const slots = defineSlots<{
|
|
40
|
+
default:() => VNode[],
|
|
41
|
+
}>()
|
|
42
|
+
|
|
43
|
+
const render = () => {
|
|
44
|
+
const tab = findAllChildren(slots.default(), 'Tab')
|
|
45
|
+
.map((vnode, index) => {
|
|
46
|
+
const isDisabled = toBoolean(vnode.props?.disabled)
|
|
47
|
+
const isActive = index === props.active && !isDisabled
|
|
48
|
+
|
|
49
|
+
return h(vnode, {
|
|
50
|
+
key : index,
|
|
51
|
+
dataTabid: index,
|
|
52
|
+
style : { display: isActive ? 'block' : 'none' },
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
.at(props.active)
|
|
56
|
+
|
|
57
|
+
const body = () => {
|
|
58
|
+
return props.keepAlive
|
|
59
|
+
? h(resolveComponent('keep-alive'), () => tab)
|
|
60
|
+
: tab
|
|
25
61
|
}
|
|
26
|
-
|
|
62
|
+
|
|
63
|
+
return h(Transition, {
|
|
64
|
+
name: transition.value,
|
|
65
|
+
mode: 'out-in',
|
|
66
|
+
}, body)
|
|
67
|
+
}
|
|
27
68
|
</script>
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
data-testid="tab"
|
|
22
22
|
:disabled="tab.disabled"
|
|
23
23
|
:active="i === active"
|
|
24
|
-
:class="{
|
|
24
|
+
:class="{
|
|
25
|
+
'nav__item--no-icon' : (!tab.slots.icon),
|
|
26
|
+
'nav__item--no-label': (!tab.title && !tab.slots.title)
|
|
27
|
+
}"
|
|
25
28
|
@click="selectTab(i, tab)">
|
|
26
29
|
<template #icon>
|
|
27
30
|
<template v-if="tab.slots.icon">
|
|
@@ -39,90 +42,105 @@
|
|
|
39
42
|
</nav>
|
|
40
43
|
|
|
41
44
|
<div class="tabs__content">
|
|
42
|
-
<tab-content
|
|
45
|
+
<tab-content
|
|
46
|
+
:active="active"
|
|
47
|
+
:vertical="vertical"
|
|
48
|
+
:keep-alive="keepAlive">
|
|
43
49
|
<slot />
|
|
44
50
|
</tab-content>
|
|
45
51
|
</div>
|
|
46
52
|
</div>
|
|
47
53
|
</template>
|
|
48
54
|
|
|
49
|
-
<script>
|
|
55
|
+
<script lang="ts" setup>
|
|
56
|
+
import {
|
|
57
|
+
VNode,
|
|
58
|
+
PropType,
|
|
59
|
+
computed,
|
|
60
|
+
Slots,
|
|
61
|
+
} from 'vue-demi'
|
|
62
|
+
import Nav from '../nav/Nav.vue'
|
|
50
63
|
import {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} from
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import
|
|
57
|
-
import {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
StyleVariant as TabsStyleVariant,
|
|
65
|
+
AlignVariant as TabsAlignVariant,
|
|
66
|
+
} from '../nav'
|
|
67
|
+
import NavItem from '../nav/NavItem.vue'
|
|
68
|
+
import TabContent from './TabContent.vue'
|
|
69
|
+
import { useVModel } from '../input'
|
|
70
|
+
import { findAllChildren, toBoolean } from '../utils/vnode'
|
|
71
|
+
|
|
72
|
+
interface TabContext {
|
|
73
|
+
title: string,
|
|
74
|
+
disabled: boolean,
|
|
75
|
+
slots: Slots,
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const props = defineProps({
|
|
79
|
+
variant: {
|
|
80
|
+
type : String as PropType<TabsStyleVariant>,
|
|
81
|
+
default: 'tabs',
|
|
64
82
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
default: "tabs"
|
|
69
|
-
},
|
|
70
|
-
align: {
|
|
71
|
-
type: String,
|
|
72
|
-
default: "left"
|
|
73
|
-
},
|
|
74
|
-
vertical: {
|
|
75
|
-
type: Boolean,
|
|
76
|
-
default: false
|
|
77
|
-
},
|
|
78
|
-
fill: {
|
|
79
|
-
type: Boolean,
|
|
80
|
-
default: false
|
|
81
|
-
},
|
|
82
|
-
justified: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: false
|
|
85
|
-
},
|
|
86
|
-
navWrapperClass: {
|
|
87
|
-
type: String,
|
|
88
|
-
default: void 0
|
|
89
|
-
},
|
|
90
|
-
modelValue: {
|
|
91
|
-
type: Number,
|
|
92
|
-
default: 0
|
|
93
|
-
}
|
|
83
|
+
align: {
|
|
84
|
+
type : String as PropType<TabsAlignVariant>,
|
|
85
|
+
default: 'left',
|
|
94
86
|
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
87
|
+
vertical: {
|
|
88
|
+
type : Boolean,
|
|
89
|
+
default: false,
|
|
90
|
+
},
|
|
91
|
+
fill: {
|
|
92
|
+
type : Boolean,
|
|
93
|
+
default: false,
|
|
94
|
+
},
|
|
95
|
+
justified: {
|
|
96
|
+
type : Boolean,
|
|
97
|
+
default: false,
|
|
98
|
+
},
|
|
99
|
+
navWrapperClass: {
|
|
100
|
+
type : String,
|
|
101
|
+
default: undefined,
|
|
102
|
+
},
|
|
103
|
+
modelValue: {
|
|
104
|
+
type : Number,
|
|
105
|
+
default: 0,
|
|
106
|
+
},
|
|
107
|
+
keepAlive: {
|
|
108
|
+
type : Boolean,
|
|
109
|
+
default: false,
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
const classNames = computed(() => {
|
|
114
|
+
const result: string[] = []
|
|
115
|
+
|
|
116
|
+
if (props.vertical && props.align)
|
|
117
|
+
result.push(`tabs--vertical-align-${props.align}`)
|
|
118
|
+
|
|
119
|
+
return result
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
const slots = defineSlots<{
|
|
123
|
+
default:() => VNode[],
|
|
124
|
+
}>()
|
|
125
|
+
|
|
126
|
+
const active = useVModel(props)
|
|
127
|
+
const tabs = computed<TabContext[]>(() => {
|
|
128
|
+
const vnodes = slots.default ? slots.default() : []
|
|
129
|
+
const tabs = findAllChildren(vnodes, 'Tab')
|
|
130
|
+
|
|
131
|
+
return tabs.map((vnode) => {
|
|
118
132
|
return {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
133
|
+
title : vnode.props?.title,
|
|
134
|
+
disabled: toBoolean(vnode.props?.disabled),
|
|
135
|
+
slots : vnode.children as Slots,
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
function selectTab (index: number, tab: TabContext) {
|
|
141
|
+
if (!tab.disabled)
|
|
142
|
+
active.value = index
|
|
143
|
+
}
|
|
126
144
|
</script>
|
|
127
145
|
|
|
128
146
|
<style lang="postcss">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component
|
|
3
|
-
:is="
|
|
3
|
+
:is="elementNames"
|
|
4
4
|
data-testid="freetext"
|
|
5
5
|
class="freetext"
|
|
6
6
|
:class="classNames"
|
|
@@ -31,11 +31,15 @@ export default defineComponent({
|
|
|
31
31
|
transform: {
|
|
32
32
|
type: String,
|
|
33
33
|
default: "normalcase"
|
|
34
|
+
},
|
|
35
|
+
element: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "span"
|
|
34
38
|
}
|
|
35
39
|
},
|
|
36
40
|
setup(props) {
|
|
37
|
-
const
|
|
38
|
-
return props.href ? "a" :
|
|
41
|
+
const elementNames = computed(() => {
|
|
42
|
+
return props.href ? "a" : props.element;
|
|
39
43
|
});
|
|
40
44
|
const classNames = computed(() => {
|
|
41
45
|
const result = [""];
|
|
@@ -52,8 +56,8 @@ export default defineComponent({
|
|
|
52
56
|
return result;
|
|
53
57
|
});
|
|
54
58
|
return {
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
classNames,
|
|
60
|
+
elementNames
|
|
57
61
|
};
|
|
58
62
|
}
|
|
59
63
|
});
|
|
@@ -125,8 +129,12 @@ export default defineComponent({
|
|
|
125
129
|
* Hyperlink style
|
|
126
130
|
*/
|
|
127
131
|
&--hyperlink {
|
|
128
|
-
@apply underline decoration-solid
|
|
129
|
-
|
|
132
|
+
@apply underline decoration-solid;
|
|
133
|
+
|
|
134
|
+
&:not([class^='text-'], [class*='text-']) {
|
|
135
|
+
@apply text-link;
|
|
136
|
+
@apply dark:text-dark-link;
|
|
137
|
+
}
|
|
130
138
|
}
|
|
131
139
|
|
|
132
140
|
/**
|