@antify/ui 1.0.4 → 1.2.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/AntAccordion.vue +32 -7
- package/dist/components/AntAccordionItem.vue +48 -15
- package/dist/components/AntAlert.vue +8 -6
- package/dist/components/AntDropdown.vue +50 -36
- package/dist/components/AntIcon.vue +8 -6
- package/dist/components/AntKeycap.vue +22 -17
- package/dist/components/AntListGroup.vue +5 -3
- package/dist/components/AntModal.vue +17 -7
- package/dist/components/AntPopover.vue +118 -42
- package/dist/components/AntSkeleton.vue +1 -1
- package/dist/components/AntTooltip.vue +102 -76
- package/dist/components/__stories/AntAccordion.stories.d.ts +1 -0
- package/dist/components/__stories/AntAccordion.stories.js +73 -1
- package/dist/components/__stories/AntAccordion.stories.mjs +68 -0
- package/dist/components/__stories/AntDropdown.stories.js +27 -23
- package/dist/components/__stories/AntDropdown.stories.mjs +26 -22
- package/dist/components/__stories/AntKeycap.stories.js +13 -15
- package/dist/components/__stories/AntKeycap.stories.mjs +13 -13
- package/dist/components/__stories/AntListGroup.stories.js +1 -1
- package/dist/components/__stories/AntListGroup.stories.mjs +1 -1
- package/dist/components/__stories/AntModal.stories.js +2 -1
- package/dist/components/__stories/AntModal.stories.mjs +2 -1
- package/dist/components/__stories/AntPopover.stories.js +22 -21
- package/dist/components/__stories/AntPopover.stories.mjs +22 -20
- package/dist/components/__stories/AntTooltip.stories.d.ts +0 -10
- package/dist/components/__stories/AntTooltip.stories.js +32 -212
- package/dist/components/__stories/AntTooltip.stories.mjs +29 -193
- package/dist/components/__types/AntKeycap.types.d.ts +1 -0
- package/dist/components/__types/AntKeycap.types.js +1 -0
- package/dist/components/__types/AntKeycap.types.mjs +1 -0
- package/dist/components/buttons/AntButton.vue +41 -44
- package/dist/components/crud/AntCrud.vue +1 -1
- package/dist/components/crud/AntCrudDetailActions.vue +1 -0
- package/dist/components/crud/AntCrudTableFilter.vue +20 -18
- package/dist/components/forms/AntField.vue +7 -2
- package/dist/components/forms/__stories/AntField.stories.js +0 -16
- package/dist/components/forms/__stories/AntField.stories.mjs +2 -16
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +7 -7
- package/dist/components/index.mjs +2 -2
- package/dist/components/inputs/AntCheckbox.vue +25 -6
- package/dist/components/inputs/AntDateInput.vue +1 -1
- package/dist/components/inputs/AntRadio.vue +2 -1
- package/dist/components/inputs/AntSelect.vue +25 -22
- package/dist/components/inputs/AntSwitch.vue +2 -7
- package/dist/components/inputs/AntTagInput.vue +91 -114
- package/dist/components/inputs/AntTextarea.vue +7 -3
- package/dist/components/inputs/Elements/AntBaseInput.vue +2 -2
- package/dist/components/inputs/Elements/{AntDropDown.vue → AntSelectMenu.vue} +85 -40
- package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.d.ts +0 -1
- package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.js +1 -29
- package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.mjs +0 -22
- package/dist/components/inputs/Elements/index.d.ts +2 -1
- package/dist/components/inputs/Elements/index.js +7 -0
- package/dist/components/inputs/Elements/index.mjs +3 -1
- package/dist/components/inputs/__stories/AntCheckbox.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntCheckbox.stories.js +1 -43
- package/dist/components/inputs/__stories/AntCheckbox.stories.mjs +0 -35
- package/dist/components/inputs/__stories/AntCheckboxGroup.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntCheckboxGroup.stories.js +1 -31
- package/dist/components/inputs/__stories/AntCheckboxGroup.stories.mjs +0 -28
- package/dist/components/inputs/__stories/AntDateInput.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntDateInput.stories.js +1 -32
- package/dist/components/inputs/__stories/AntDateInput.stories.mjs +0 -28
- package/dist/components/inputs/__stories/AntNumberInput.stories.d.ts +0 -2
- package/dist/components/inputs/__stories/AntNumberInput.stories.js +1 -65
- package/dist/components/inputs/__stories/AntNumberInput.stories.mjs +1 -54
- package/dist/components/inputs/__stories/AntPasswordInput.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntPasswordInput.stories.js +1 -35
- package/dist/components/inputs/__stories/AntPasswordInput.stories.mjs +0 -25
- package/dist/components/inputs/__stories/AntRadioGroup.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntRadioGroup.stories.js +1 -47
- package/dist/components/inputs/__stories/AntRadioGroup.stories.mjs +0 -46
- package/dist/components/inputs/__stories/AntRangeSlider.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntRangeSlider.stories.js +1 -33
- package/dist/components/inputs/__stories/AntRangeSlider.stories.mjs +1 -28
- package/dist/components/inputs/__stories/AntSelect.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntSelect.stories.js +18 -46
- package/dist/components/inputs/__stories/AntSelect.stories.mjs +16 -47
- package/dist/components/inputs/__stories/AntSwitch.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntSwitch.stories.js +1 -42
- package/dist/components/inputs/__stories/AntSwitch.stories.mjs +1 -37
- package/dist/components/inputs/__stories/AntSwitcher.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntSwitcher.stories.js +1 -51
- package/dist/components/inputs/__stories/AntSwitcher.stories.mjs +1 -51
- package/dist/components/inputs/__stories/AntTagInput.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntTagInput.stories.js +1 -35
- package/dist/components/inputs/__stories/AntTagInput.stories.mjs +0 -33
- package/dist/components/inputs/__stories/AntTextInput.stories.d.ts +0 -2
- package/dist/components/inputs/__stories/AntTextInput.stories.js +1 -107
- package/dist/components/inputs/__stories/AntTextInput.stories.mjs +0 -104
- package/dist/components/inputs/__stories/AntTextarea.stories.d.ts +0 -2
- package/dist/components/inputs/__stories/AntTextarea.stories.js +7 -66
- package/dist/components/inputs/__stories/AntTextarea.stories.mjs +6 -55
- package/dist/components/inputs/__stories/AntUnitInput.stories.d.ts +0 -2
- package/dist/components/inputs/__stories/AntUnitInput.stories.js +1 -61
- package/dist/components/inputs/__stories/AntUnitInput.stories.mjs +0 -53
- package/dist/components/table/AntTable.vue +17 -15
- package/dist/components/table/AntTd.vue +1 -2
- package/dist/components/table/__stories/AntTable.stories.js +7 -14
- package/dist/components/table/__stories/AntTable.stories.mjs +7 -15
- package/dist/components/tabs/AntTabItem.vue +16 -6
- package/dist/components/tabs/AntTabs.vue +8 -0
- package/dist/components/tabs/__types/AntTabItem.types.d.ts +1 -0
- package/package.json +2 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import AntAccordionItem from './AntAccordionItem.vue';
|
|
3
3
|
import {onMounted, ref} from 'vue';
|
|
4
4
|
import {CollapseStrategy} from './__types/AntAccordion.types';
|
|
5
|
+
import AntSkeleton from "./AntSkeleton.vue";
|
|
5
6
|
|
|
6
7
|
const props = withDefaults(defineProps<{
|
|
7
8
|
items: {
|
|
@@ -9,10 +10,17 @@ const props = withDefaults(defineProps<{
|
|
|
9
10
|
content?: string;
|
|
10
11
|
isOpen?: boolean;
|
|
11
12
|
iconLeft?: boolean;
|
|
13
|
+
contentPadding?: boolean;
|
|
14
|
+
activeLabelClasses?: string;
|
|
15
|
+
activeIconClasses?: string;
|
|
16
|
+
inactiveLabelClasses?: string;
|
|
17
|
+
inactiveIconClasses?: string;
|
|
12
18
|
}[];
|
|
13
19
|
collapseStrategy?: CollapseStrategy;
|
|
20
|
+
skeleton?: boolean;
|
|
14
21
|
}>(), {
|
|
15
|
-
collapseStrategy: CollapseStrategy.single
|
|
22
|
+
collapseStrategy: CollapseStrategy.single,
|
|
23
|
+
skeleton: false
|
|
16
24
|
});
|
|
17
25
|
|
|
18
26
|
const openItems = ref<number[]>([]);
|
|
@@ -49,15 +57,32 @@ function onClose(index: number) {
|
|
|
49
57
|
:label="item.label"
|
|
50
58
|
:is-open="openItems.includes(index)"
|
|
51
59
|
:icon-left="item.iconLeft"
|
|
60
|
+
:content-padding="item.contentPadding"
|
|
61
|
+
:activeLabelClasses="item.activeLabelClasses"
|
|
62
|
+
:activeIconClasses="item.activeIconClasses"
|
|
63
|
+
:inactiveLabelClasses="item.inactiveLabelClasses"
|
|
64
|
+
:inactiveIconClasses="item.inactiveIconClasses"
|
|
65
|
+
:skeleton="skeleton"
|
|
52
66
|
@open="() => onOpen(index)"
|
|
53
67
|
@close="() => onClose(index)"
|
|
54
68
|
>
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</
|
|
69
|
+
<template #icon-left="{isOpen}">
|
|
70
|
+
<slot
|
|
71
|
+
name="icon-left"
|
|
72
|
+
v-bind="{item, index, isOpen}"
|
|
73
|
+
/>
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<div class="relative">
|
|
77
|
+
<slot
|
|
78
|
+
name="item-content"
|
|
79
|
+
v-bind="{item, index}"
|
|
80
|
+
>
|
|
81
|
+
<div v-html="item.content"/>
|
|
82
|
+
|
|
83
|
+
<AntSkeleton v-if="skeleton" absolute rounded/>
|
|
84
|
+
</slot>
|
|
85
|
+
</div>
|
|
61
86
|
</AntAccordionItem>
|
|
62
87
|
</slot>
|
|
63
88
|
</div>
|
|
@@ -3,32 +3,56 @@ import {faAngleDown, faAngleUp, faQuestionCircle} from '@fortawesome/free-solid-
|
|
|
3
3
|
import AntIcon from './AntIcon.vue';
|
|
4
4
|
import AntTransitionCollapseHeight from './transitions/AntTransitionCollapseHeight.vue';
|
|
5
5
|
import {IconSize} from './__types/AntIcon.types';
|
|
6
|
+
import {computed} from 'vue';
|
|
7
|
+
import AntSkeleton from "../components/AntSkeleton.vue";
|
|
6
8
|
|
|
7
9
|
const props = withDefaults(defineProps<{
|
|
8
10
|
isOpen: boolean;
|
|
9
11
|
label?: string;
|
|
10
12
|
collapseTransition?: string;
|
|
11
|
-
iconLeft
|
|
13
|
+
iconLeft?: boolean;
|
|
14
|
+
contentPadding?: boolean;
|
|
15
|
+
activeLabelClasses?: string;
|
|
16
|
+
activeIconClasses?: string;
|
|
17
|
+
inactiveLabelClasses?: string;
|
|
18
|
+
inactiveIconClasses?: string;
|
|
19
|
+
skeleton?: boolean;
|
|
12
20
|
}>(), {
|
|
13
21
|
collapseTransition: 'slide',
|
|
14
22
|
iconLeft: false,
|
|
23
|
+
contentPadding: true,
|
|
24
|
+
skeleton: false,
|
|
25
|
+
activeLabelClasses: 'bg-primary-500 text-primary-500-font',
|
|
26
|
+
activeIconClasses: 'text-primary-500-font',
|
|
27
|
+
inactiveLabelClasses: 'bg-white text-for-white-bg-font',
|
|
28
|
+
inactiveIconClasses: 'text-for-white-bg-font'
|
|
15
29
|
});
|
|
16
30
|
const emit = defineEmits(['close', 'open']);
|
|
17
31
|
|
|
18
32
|
// TODO:: Stehengeblieben: delays machen
|
|
19
33
|
function onClick() {
|
|
34
|
+
if (props.skeleton) {
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
|
|
20
38
|
if (props.isOpen) {
|
|
21
39
|
emit('close');
|
|
22
40
|
} else {
|
|
23
41
|
emit('open');
|
|
24
42
|
}
|
|
25
43
|
}
|
|
44
|
+
|
|
45
|
+
const labelClasses = computed(() => ({
|
|
46
|
+
[props.activeLabelClasses]: props.isOpen,
|
|
47
|
+
[props.inactiveLabelClasses]: !props.isOpen,
|
|
48
|
+
'cursor-pointer': !props.skeleton
|
|
49
|
+
}))
|
|
26
50
|
</script>
|
|
27
51
|
|
|
28
52
|
<template>
|
|
29
53
|
<div
|
|
30
|
-
class="p-2 select-none
|
|
31
|
-
:class="
|
|
54
|
+
class="p-2 select-none transition-colors"
|
|
55
|
+
:class="labelClasses"
|
|
32
56
|
@click="onClick"
|
|
33
57
|
>
|
|
34
58
|
<slot
|
|
@@ -36,24 +60,32 @@ function onClick() {
|
|
|
36
60
|
v-bind="{ isOpen: isOpen }"
|
|
37
61
|
>
|
|
38
62
|
<div
|
|
39
|
-
class="
|
|
63
|
+
class="flex justify-between items-center"
|
|
40
64
|
>
|
|
41
65
|
<div class="flex items-center gap-2">
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
66
|
+
<slot name="icon-left" v-bind="{isOpen}">
|
|
67
|
+
<AntIcon
|
|
68
|
+
v-if="iconLeft"
|
|
69
|
+
:size="IconSize.sm"
|
|
70
|
+
:icon="faQuestionCircle"
|
|
71
|
+
:color="isOpen ? activeIconClasses : inactiveIconClasses"
|
|
72
|
+
:skeleton="skeleton"
|
|
73
|
+
/>
|
|
74
|
+
</slot>
|
|
75
|
+
|
|
48
76
|
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
77
|
+
<div class="relative">
|
|
78
|
+
<div class="text-sm font-semibold">
|
|
79
|
+
{{ label }}
|
|
80
|
+
</div>
|
|
81
|
+
<AntSkeleton v-if="skeleton" absolute rounded/>
|
|
82
|
+
</div>
|
|
52
83
|
</div>
|
|
53
84
|
|
|
54
85
|
<AntIcon
|
|
55
86
|
:icon="isOpen ? faAngleUp : faAngleDown"
|
|
56
|
-
:color="isOpen ?
|
|
87
|
+
:color="isOpen ? activeIconClasses : inactiveIconClasses"
|
|
88
|
+
:skeleton="skeleton"
|
|
57
89
|
/>
|
|
58
90
|
</div>
|
|
59
91
|
</slot>
|
|
@@ -67,7 +99,8 @@ function onClick() {
|
|
|
67
99
|
<Transition name="bounce">
|
|
68
100
|
<div
|
|
69
101
|
v-show="isOpen"
|
|
70
|
-
class="
|
|
102
|
+
class="text-sm bg-white text-for-white-bg-font"
|
|
103
|
+
:class="{'p-2': contentPadding}"
|
|
71
104
|
>
|
|
72
105
|
<slot/>
|
|
73
106
|
</div>
|
|
@@ -114,12 +114,14 @@ onMounted(() => {
|
|
|
114
114
|
<div class="flex gap-2">
|
|
115
115
|
<div v-if="hasQuestionMark">
|
|
116
116
|
<slot name="questionMarkText">
|
|
117
|
-
<AntTooltip
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
<AntTooltip >
|
|
118
|
+
<template #reference>
|
|
119
|
+
<AntIcon
|
|
120
|
+
:icon="faCircleQuestion"
|
|
121
|
+
:color="iconColor"
|
|
122
|
+
:size="IconSize.sm"
|
|
123
|
+
/>
|
|
124
|
+
</template>
|
|
123
125
|
|
|
124
126
|
<template #content>
|
|
125
127
|
{{ questionMarkText }}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
|
|
3
|
-
* TODO:: Emit if there's enough space for the dropdown content. If not, reposition it automatically like the
|
|
4
|
-
* browsers select dropdown content does.
|
|
5
|
-
* TODO:: Known issue: open dropdown, click between button and dropdown. Dropdown will not click.
|
|
6
|
-
* The v-on-click-outside does not trigger, because it think it's the dropdown itself.
|
|
7
|
-
* Solution is using margin only (calc(50% + 0.625rem)) and not padding.
|
|
8
|
-
*/
|
|
9
|
-
import {computed, onMounted} from 'vue';
|
|
10
|
-
import {handleEnumValidation} from '../handler';
|
|
11
|
-
import {Position} from '../enums';
|
|
2
|
+
import {computed, ref} from 'vue';
|
|
12
3
|
import {classesToObjectSyntax} from '../utils';
|
|
13
4
|
import {vOnClickOutside} from '@vueuse/components';
|
|
14
5
|
import {onKeyStroke} from '@vueuse/core';
|
|
6
|
+
import {autoUpdate, flip, offset, useFloating, shift} from "@floating-ui/vue";
|
|
15
7
|
|
|
16
8
|
const props = withDefaults(defineProps<{
|
|
17
9
|
showDropdown: boolean,
|
|
18
|
-
position?: Position,
|
|
19
10
|
dropdownClasses?: string | Record<string, boolean>,
|
|
20
|
-
contentPadding?: boolean
|
|
11
|
+
contentPadding?: boolean,
|
|
12
|
+
isClickable?: boolean,
|
|
21
13
|
}>(), {
|
|
22
|
-
showDropdown: false,
|
|
23
14
|
contentPadding: true,
|
|
24
|
-
position: Position.bottom,
|
|
25
15
|
dropdownClasses: '',
|
|
16
|
+
isClickable: true,
|
|
26
17
|
});
|
|
27
18
|
const emit = defineEmits(['update:showDropdown']);
|
|
28
19
|
|
|
20
|
+
const reference = ref<HTMLElement | null>(null)
|
|
21
|
+
const floating = ref<HTMLElement | null>(null)
|
|
22
|
+
|
|
23
|
+
const {floatingStyles} = useFloating(reference, floating, {
|
|
24
|
+
transform: false,
|
|
25
|
+
placement: 'bottom-start',
|
|
26
|
+
whileElementsMounted: autoUpdate,
|
|
27
|
+
middleware: [
|
|
28
|
+
offset(8),
|
|
29
|
+
shift(),
|
|
30
|
+
flip({
|
|
31
|
+
fallbackPlacements: ['top-start'],
|
|
32
|
+
}),
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
|
|
29
36
|
const _dropdownClasses = computed(() => ({
|
|
30
|
-
'
|
|
31
|
-
'bottom-0 left-0 mb-[50%] pb-2.5': props.position === Position.top,
|
|
32
|
-
'top-0 left-0 mt-[50%] pt-2.5': props.position === Position.bottom,
|
|
33
|
-
'right-0 top-0 mr-[100%] pr-2.5': props.position === Position.left,
|
|
34
|
-
'left-0 top-0 ml-[100%] pl-2.5': props.position === Position.right,
|
|
37
|
+
'min-w-[10rem] z-[90]': true,
|
|
35
38
|
...classesToObjectSyntax(props.dropdownClasses)
|
|
36
39
|
}));
|
|
37
40
|
|
|
38
|
-
onMounted(() => {
|
|
39
|
-
handleEnumValidation(props.position, Position, 'Position');
|
|
40
|
-
});
|
|
41
41
|
onKeyStroke('Escape', (e: KeyboardEvent) => {
|
|
42
42
|
if (props.showDropdown) {
|
|
43
43
|
e.preventDefault();
|
|
@@ -45,31 +45,45 @@ onKeyStroke('Escape', (e: KeyboardEvent) => {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
const onClickOutside = [
|
|
49
|
+
(ev) => {
|
|
50
|
+
emit('update:showDropdown', false);
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
ignore: [floating]
|
|
54
|
+
}
|
|
55
|
+
]
|
|
51
56
|
</script>
|
|
52
57
|
|
|
53
58
|
<template>
|
|
54
59
|
<div
|
|
55
|
-
|
|
56
|
-
class="relative inline-flex justify-center items-end z-40"
|
|
60
|
+
class="relative flex"
|
|
57
61
|
data-e2e="dropdown"
|
|
58
62
|
>
|
|
59
|
-
<
|
|
63
|
+
<div
|
|
64
|
+
ref="reference"
|
|
65
|
+
class="h-full w-full"
|
|
66
|
+
v-on-click-outside="onClickOutside"
|
|
67
|
+
>
|
|
68
|
+
<slot/>
|
|
69
|
+
</div>
|
|
60
70
|
|
|
61
71
|
<Transition name="bounce">
|
|
62
|
-
<
|
|
63
|
-
v-if="showDropdown"
|
|
64
|
-
:class="_dropdownClasses"
|
|
65
|
-
>
|
|
72
|
+
<teleport to="body">
|
|
66
73
|
<div
|
|
67
|
-
|
|
68
|
-
:class="
|
|
74
|
+
v-if="showDropdown"
|
|
75
|
+
:class="_dropdownClasses"
|
|
76
|
+
ref="floating"
|
|
77
|
+
:style="floatingStyles"
|
|
69
78
|
>
|
|
70
|
-
<
|
|
79
|
+
<div
|
|
80
|
+
class="shadow-lg border border-neutral-300 rounded-md text-sm relative inline-flex flex-col bg-white text-for-white-bg-font w-full overflow-hidden"
|
|
81
|
+
:class="{'p-2': contentPadding}"
|
|
82
|
+
>
|
|
83
|
+
<slot name="content"/>
|
|
84
|
+
</div>
|
|
71
85
|
</div>
|
|
72
|
-
</
|
|
86
|
+
</teleport>
|
|
73
87
|
</Transition>
|
|
74
88
|
</div>
|
|
75
89
|
</template>
|
|
@@ -3,10 +3,12 @@ import {computed, onMounted} from 'vue';
|
|
|
3
3
|
import {handleEnumValidation} from '../handler';
|
|
4
4
|
import {type IconDefinition} from '@fortawesome/free-solid-svg-icons';
|
|
5
5
|
import {IconSize} from './__types/AntIcon.types';
|
|
6
|
+
import AntSkeleton from "./AntSkeleton.vue";
|
|
6
7
|
|
|
7
8
|
const props = withDefaults(defineProps<{
|
|
8
9
|
icon: IconDefinition;
|
|
9
10
|
size?: IconSize;
|
|
11
|
+
skeleton?: boolean;
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* A css text-* class
|
|
@@ -14,11 +16,12 @@ const props = withDefaults(defineProps<{
|
|
|
14
16
|
color?: string;
|
|
15
17
|
}>(), {
|
|
16
18
|
size: IconSize.sm,
|
|
17
|
-
color: 'text-for-white-bg-font'
|
|
19
|
+
color: 'text-for-white-bg-font',
|
|
20
|
+
skeleton: false,
|
|
18
21
|
});
|
|
19
22
|
|
|
20
23
|
const containerClasses = computed(() => ({
|
|
21
|
-
'inline-flex items-center justify-center': true,
|
|
24
|
+
'inline-flex items-center justify-center relative': true,
|
|
22
25
|
'w-3 h-3': props.size === IconSize.xs2,
|
|
23
26
|
'w-4 h-4': props.size === IconSize.xs,
|
|
24
27
|
'w-5 h-5': props.size === IconSize.sm,
|
|
@@ -44,13 +47,12 @@ onMounted(() => {
|
|
|
44
47
|
</script>
|
|
45
48
|
|
|
46
49
|
<template>
|
|
47
|
-
<span
|
|
48
|
-
v-if="icon"
|
|
49
|
-
:class="containerClasses"
|
|
50
|
-
>
|
|
50
|
+
<span :class="containerClasses">
|
|
51
51
|
<FaIcon
|
|
52
|
+
v-if="icon"
|
|
52
53
|
:icon="icon"
|
|
53
54
|
:class="iconClasses"
|
|
54
55
|
/>
|
|
56
|
+
<AntSkeleton v-if="skeleton" absolute rounded/>
|
|
55
57
|
</span>
|
|
56
58
|
</template>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
// TODO:: Fix typo KeyCap with upperchar C
|
|
3
3
|
import AntIcon from './AntIcon.vue';
|
|
4
|
+
import AntSkeleton from "./AntSkeleton.vue";
|
|
4
5
|
import {type IconDefinition} from '@fortawesome/free-solid-svg-icons';
|
|
5
6
|
import {IconSize} from './__types';
|
|
6
7
|
import {AntKeycapSize} from './__types/AntKeycap.types';
|
|
@@ -8,38 +9,42 @@ import {computed} from 'vue';
|
|
|
8
9
|
|
|
9
10
|
const props = withDefaults(defineProps<{
|
|
10
11
|
icon?: IconDefinition
|
|
11
|
-
size
|
|
12
|
-
|
|
12
|
+
size?: AntKeycapSize
|
|
13
|
+
skeleton?: boolean
|
|
13
14
|
}>(), {
|
|
14
|
-
size: AntKeycapSize.sm
|
|
15
|
+
size: AntKeycapSize.sm,
|
|
16
|
+
skeleton: false
|
|
15
17
|
});
|
|
16
18
|
|
|
17
19
|
const classes = computed(() => {
|
|
18
20
|
return {
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
+
'px-1': true,
|
|
22
|
+
'test-sm min-w-6 h-6 ': props.size === AntKeycapSize.md,
|
|
23
|
+
'test-xs min-w-5 h-5': props.size === AntKeycapSize.sm,
|
|
24
|
+
'text-2xs min-w-4 h-4': props.size === AntKeycapSize.xs,
|
|
21
25
|
};
|
|
22
26
|
});
|
|
23
27
|
const iconClasses = computed(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
switch (props.size) {
|
|
29
|
+
case AntKeycapSize.md:
|
|
30
|
+
return IconSize.md
|
|
31
|
+
case AntKeycapSize.sm:
|
|
32
|
+
return IconSize.sm
|
|
33
|
+
default:
|
|
34
|
+
return IconSize.xs;
|
|
28
35
|
}
|
|
29
36
|
});
|
|
30
37
|
</script>
|
|
31
38
|
|
|
32
39
|
<template>
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
:class="classes"
|
|
36
|
-
>
|
|
37
|
-
<AntIcon
|
|
40
|
+
<div class="inline-flex relative justify-center items-center bg-neutral-300 rounded-md text-center text-neutral-300-font font-medium" :class="classes">
|
|
41
|
+
<AntIcon
|
|
38
42
|
v-if="icon"
|
|
39
43
|
:icon="icon"
|
|
40
44
|
:size="iconClasses"
|
|
41
|
-
|
|
45
|
+
/>
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
<slot v-else/>
|
|
48
|
+
<AntSkeleton v-if="skeleton" absolute rounded/>
|
|
49
|
+
</div>
|
|
45
50
|
</template>
|
|
@@ -3,9 +3,11 @@ import AntSkeleton from './AntSkeleton.vue';
|
|
|
3
3
|
|
|
4
4
|
withDefaults(
|
|
5
5
|
defineProps<{
|
|
6
|
-
skeleton?: boolean
|
|
6
|
+
skeleton?: boolean,
|
|
7
|
+
shadow?: boolean
|
|
7
8
|
}>(), {
|
|
8
|
-
skeleton: false
|
|
9
|
+
skeleton: false,
|
|
10
|
+
shadow: false,
|
|
9
11
|
}
|
|
10
12
|
)
|
|
11
13
|
</script>
|
|
@@ -16,7 +18,7 @@ withDefaults(
|
|
|
16
18
|
|
|
17
19
|
<div
|
|
18
20
|
class="flex flex-col rounded-md bg-neutral-300 gap-px relative border border-neutral-300 overflow-hidden"
|
|
19
|
-
:class="{'invisible': skeleton}"
|
|
21
|
+
:class="{'invisible': skeleton, 'shadow-md': shadow}"
|
|
20
22
|
>
|
|
21
23
|
<slot/>
|
|
22
24
|
</div>
|
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
import {ref, useSlots, watch} from 'vue';
|
|
3
3
|
import {faXmark} from '@fortawesome/free-solid-svg-icons';
|
|
4
4
|
import AntButton from './buttons/AntButton.vue';
|
|
5
|
+
import AntSkeleton from "./AntSkeleton.vue";
|
|
5
6
|
|
|
6
7
|
const emit = defineEmits(['update:open', 'close']);
|
|
7
8
|
const props = withDefaults(defineProps<{
|
|
8
9
|
title: string,
|
|
9
10
|
open: boolean,
|
|
10
|
-
fullscreen?: boolean
|
|
11
|
+
fullscreen?: boolean,
|
|
12
|
+
padding?: boolean
|
|
13
|
+
skeleton?: boolean
|
|
11
14
|
}>(), {
|
|
12
|
-
fullscreen: false
|
|
15
|
+
fullscreen: false,
|
|
16
|
+
padding: false,
|
|
17
|
+
skeleton: false
|
|
13
18
|
});
|
|
14
19
|
const openModal = ref(props.open);
|
|
15
20
|
const openBackground = ref(props.open);
|
|
@@ -53,21 +58,26 @@ function closeModal() {
|
|
|
53
58
|
:class="{'w-full h-full': fullscreen, 'border border-neutral-300 rounded-md shadow-md': !fullscreen}"
|
|
54
59
|
>
|
|
55
60
|
<div
|
|
56
|
-
class="bg-white p-2 flex items-center justify-between
|
|
61
|
+
class="bg-white p-2 flex items-center justify-between"
|
|
57
62
|
>
|
|
58
63
|
<slot name="title">
|
|
59
|
-
|
|
64
|
+
<div class="relative text-for-white-bg-font text-lg font-medium">
|
|
65
|
+
{{ title }}
|
|
66
|
+
<AntSkeleton v-if="skeleton" absolute rounded/>
|
|
67
|
+
</div>
|
|
60
68
|
</slot>
|
|
61
69
|
|
|
62
70
|
<AntButton
|
|
71
|
+
:skeleton="skeleton"
|
|
63
72
|
:icon-left="faXmark"
|
|
64
|
-
:outlined="false"
|
|
65
|
-
filled
|
|
66
73
|
@click="closeModal"
|
|
67
74
|
/>
|
|
68
75
|
</div>
|
|
69
76
|
|
|
70
|
-
<div
|
|
77
|
+
<div
|
|
78
|
+
class="bg-white text-for-white-bg-font grow overflow-y-auto"
|
|
79
|
+
:class="{'p-2': padding}"
|
|
80
|
+
>
|
|
71
81
|
<slot/>
|
|
72
82
|
</div>
|
|
73
83
|
|