@antify/ui 1.2.0 → 2.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/dist/components/AntAccordion.vue +1 -1
- package/dist/components/AntAlert.vue +2 -2
- package/dist/components/AntCard.vue +1 -1
- package/dist/components/AntDropdown.vue +1 -1
- package/dist/components/AntKeycap.vue +1 -1
- package/dist/components/AntListGroup.vue +1 -1
- package/dist/components/AntListGroupItem.vue +1 -1
- package/dist/components/AntModal.vue +2 -2
- package/dist/components/AntPopover.vue +6 -6
- package/dist/components/AntSpinner.vue +4 -4
- package/dist/components/AntTag.vue +2 -2
- package/dist/components/AntToast.vue +2 -2
- package/dist/components/AntTooltip.vue +29 -8
- package/dist/components/__stories/AntContent.stories.js +1 -1
- package/dist/components/__stories/AntContent.stories.mjs +1 -1
- package/dist/components/__stories/AntListGroup.stories.js +1 -1
- package/dist/components/__stories/AntListGroup.stories.mjs +1 -1
- package/dist/components/__stories/AntListGroupItem.stories.js +1 -1
- package/dist/components/__stories/AntListGroupItem.stories.mjs +1 -1
- package/dist/components/__stories/AntTooltip.stories.js +3 -1
- package/dist/components/__stories/AntTooltip.stories.mjs +1 -1
- package/dist/components/buttons/AntButton.vue +6 -6
- package/dist/components/crud/AntCrud.vue +2 -2
- package/dist/components/crud/AntCrudDetail.vue +1 -1
- package/dist/components/crud/AntCrudDetailNav.vue +1 -0
- package/dist/components/crud/__stories/AntCrudDetailActions.stories.js +1 -1
- package/dist/components/crud/__stories/AntCrudDetailActions.stories.mjs +1 -1
- package/dist/components/crud/__stories/AntCrudTableFilter.stories.js +1 -1
- package/dist/components/crud/__stories/AntCrudTableFilter.stories.mjs +1 -1
- package/dist/components/dialogs/AntDialog.vue +4 -4
- package/dist/components/dialogs/__stories/AntDialog.stories.js +1 -1
- package/dist/components/dialogs/__stories/AntDialog.stories.mjs +1 -1
- package/dist/components/inputs/AntCheckbox.vue +2 -2
- package/dist/components/inputs/AntDateInput.vue +1 -1
- package/dist/components/inputs/AntPasswordInput.vue +1 -1
- package/dist/components/inputs/AntRadio.vue +1 -1
- package/dist/components/inputs/AntRangeSlider.vue +2 -2
- package/dist/components/inputs/AntSelect.vue +2 -2
- package/dist/components/inputs/AntSwitch.vue +2 -2
- package/dist/components/inputs/AntSwitcher.vue +1 -1
- package/dist/components/inputs/AntTagInput.vue +2 -2
- package/dist/components/inputs/AntTextarea.vue +10 -2
- package/dist/components/inputs/Elements/AntBaseInput.vue +1 -1
- package/dist/components/inputs/Elements/AntSelectMenu.vue +2 -3
- package/dist/components/inputs/__stories/AntTextInput.stories.js +1 -0
- package/dist/components/inputs/__stories/AntTextInput.stories.mjs +1 -0
- package/dist/components/layouts/AntNavLeftLayout.vue +2 -2
- package/dist/components/layouts/__stories/AntNavLeftLayout.stories.js +1 -1
- package/dist/components/layouts/__stories/AntNavLeftLayout.stories.mjs +1 -1
- package/dist/components/navbar/AntNavbarItem.vue +1 -1
- package/dist/components/table/AntTable.vue +5 -5
- package/dist/components/table/AntTh.vue +1 -1
- package/dist/components/table/__stories/AntTable.stories.js +1 -1
- package/dist/components/table/__stories/AntTable.stories.mjs +1 -1
- package/dist/components/tabs/AntTabItem.vue +11 -4
- package/dist/components/tabs/AntTabs.vue +6 -2
- package/dist/components/tabs/__stories/AntTabs.stories.d.ts +1 -0
- package/dist/components/tabs/__stories/AntTabs.stories.js +112 -6
- package/dist/components/tabs/__stories/AntTabs.stories.mjs +120 -5
- package/dist/components/tabs/__types/AntTabItem.types.d.ts +1 -0
- package/dist/components/tabs/__types/AntTabItem.types.js +1 -0
- package/dist/components/tabs/__types/AntTabItem.types.mjs +1 -0
- package/dist/tailwind.config.js +92 -92
- package/dist/tailwind.config.mjs +92 -92
- package/package.json +1 -1
|
@@ -71,7 +71,7 @@ const hasInputState = computed(() => props.skeleton || props.readonly || props.d
|
|
|
71
71
|
const valueLabel = computed(() => props.options.find(option => option.value === _modelValue.value)?.label || null);
|
|
72
72
|
const inputClasses = computed(() => {
|
|
73
73
|
const variants: Record<InputState, string> = {
|
|
74
|
-
[InputState.base]: 'outline-
|
|
74
|
+
[InputState.base]: 'outline-base-300 bg-white focus:ring-primary-200',
|
|
75
75
|
[InputState.success]: 'outline-success-500 bg-success-100 focus:ring-success-200',
|
|
76
76
|
[InputState.info]: 'outline-info-500 bg-info-100 focus:ring-info-200',
|
|
77
77
|
[InputState.warning]: 'outline-warning-500 bg-warning-100 focus:ring-warning-200',
|
|
@@ -106,7 +106,7 @@ const inputClasses = computed(() => {
|
|
|
106
106
|
});
|
|
107
107
|
const placeholderClasses = computed(() => {
|
|
108
108
|
const variants: Record<InputState, string> = {
|
|
109
|
-
[InputState.base]: 'text-
|
|
109
|
+
[InputState.base]: 'text-base-500',
|
|
110
110
|
[InputState.success]: 'text-success-700',
|
|
111
111
|
[InputState.info]: 'text-info-700',
|
|
112
112
|
[InputState.warning]: 'text-warning-700',
|
|
@@ -38,7 +38,7 @@ const buttonClasses = computed(() => {
|
|
|
38
38
|
'focus-within:ring-2': !hasInputState.value && (props.size === Size.sm || props.size === Size.xs || props.size === Size.xs2),
|
|
39
39
|
'h-5 w-9': props.size === Size.lg || props.size === Size.md || props.size === Size.sm,
|
|
40
40
|
'h-4 w-[30px]': props.size === Size.xs || props.size === Size.xs2,
|
|
41
|
-
'bg-
|
|
41
|
+
'bg-base-300': !_value.value,
|
|
42
42
|
'invisible': props.skeleton,
|
|
43
43
|
// Disabled
|
|
44
44
|
'opacity-50 cursor-not-allowed': props.disabled,
|
|
@@ -65,7 +65,7 @@ const buttonClasses = computed(() => {
|
|
|
65
65
|
return classes;
|
|
66
66
|
});
|
|
67
67
|
const ballClasses = computed(() => ({
|
|
68
|
-
'pointer-events-none inline-block rounded-full bg-
|
|
68
|
+
'pointer-events-none inline-block rounded-full bg-base-100 shadow transform ring-0 transition ease-in-out duration-200': true,
|
|
69
69
|
'h-4 w-4 translate-y-0.5': props.size === Size.lg || props.size === Size.md || props.size === Size.sm,
|
|
70
70
|
'translate-x-[1.125rem]': _value.value && (props.size === Size.lg || props.size === Size.md || props.size === Size.sm),
|
|
71
71
|
'translate-x-0.5': !_value.value && (props.size === Size.lg || props.size === Size.md || props.size === Size.sm),
|
|
@@ -72,7 +72,7 @@ const itemClasses = computed(() => {
|
|
|
72
72
|
|
|
73
73
|
const colorVariant = {
|
|
74
74
|
[InputState.danger]: 'outline-danger-500 bg-danger-100',
|
|
75
|
-
[InputState.base]: 'outline-
|
|
75
|
+
[InputState.base]: 'outline-base-300 bg-white',
|
|
76
76
|
[InputState.info]: 'outline-info-500 bg-info-100',
|
|
77
77
|
[InputState.success]: 'outline-success-500 bg-success-100',
|
|
78
78
|
[InputState.warning]: 'outline-warning-500 bg-warning-100',
|
|
@@ -64,7 +64,7 @@ const tagInput = ref('');
|
|
|
64
64
|
const inputRef: Ref<HTMLElement | null> = ref(null);
|
|
65
65
|
const inputContainerClasses = computed(() => {
|
|
66
66
|
const variants: Record<InputState, string> = {
|
|
67
|
-
[InputState.base]: 'outline-
|
|
67
|
+
[InputState.base]: 'outline-base-300 focus-within:outline-base-300 focus-within:ring-primary-200 bg-white',
|
|
68
68
|
[InputState.danger]: 'outline-danger-500 focus-within:outline-danger-500 focus-within:ring-danger-200 bg-danger-100',
|
|
69
69
|
[InputState.info]: 'outline-info-500 focus-within:outline-info-500 focus-within:ring-info-200 bg-info-100',
|
|
70
70
|
[InputState.success]: 'outline-success-500 focus-within:outline-success-500 focus-within:ring-success-200 bg-success-100',
|
|
@@ -93,7 +93,7 @@ const inputContainerClasses = computed(() => {
|
|
|
93
93
|
});
|
|
94
94
|
const inputClasses = computed(() => {
|
|
95
95
|
const variants: Record<InputState, string> = {
|
|
96
|
-
[InputState.base]: 'placeholder:text-
|
|
96
|
+
[InputState.base]: 'placeholder:text-base-500',
|
|
97
97
|
[InputState.danger]: 'placeholder:text-danger-700',
|
|
98
98
|
[InputState.info]: 'placeholder:text-info-700',
|
|
99
99
|
[InputState.success]: 'placeholder:text-success-700',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import {computed, onMounted, watch} from 'vue';
|
|
2
|
+
import {computed, onMounted, ref, watch} from 'vue';
|
|
3
3
|
import {Size} from '../../enums/Size.enum';
|
|
4
4
|
import AntSkeleton from '../AntSkeleton.vue';
|
|
5
5
|
import AntIcon from '../AntIcon.vue';
|
|
@@ -49,6 +49,7 @@ const props = withDefaults(defineProps<{
|
|
|
49
49
|
resize: true,
|
|
50
50
|
messages: () => []
|
|
51
51
|
});
|
|
52
|
+
|
|
52
53
|
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
53
54
|
const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
|
|
54
55
|
const icons = {
|
|
@@ -61,7 +62,7 @@ const icons = {
|
|
|
61
62
|
/*TODO #59:: If the scrollbar is showing than the pr is moving and the gap between icon and text is bigger and the icon is stuck in the scrollbar*/
|
|
62
63
|
const inputClasses = computed(() => {
|
|
63
64
|
const variants: Record<InputState, string> = {
|
|
64
|
-
[InputState.base]: 'outline-
|
|
65
|
+
[InputState.base]: 'outline-base-300 focus:ring-primary-200 bg-white placeholder:text-base-500',
|
|
65
66
|
[InputState.danger]: 'outline-danger-500 focus:ring-danger-200 bg-danger-100 placeholder:text-danger-700',
|
|
66
67
|
[InputState.info]: 'outline-info-500 focus:ring-info-200 bg-info-100 placeholder:text-info-700',
|
|
67
68
|
[InputState.success]: 'outline-success-500 focus:ring-success-200 bg-success-100 placeholder:text-success-700',
|
|
@@ -111,6 +112,7 @@ const iconColor = computed(() => {
|
|
|
111
112
|
});
|
|
112
113
|
const _wrapperClass = computed(() => classesToObjectSyntax(props.wrapperClass));
|
|
113
114
|
const icon = computed(() => icons[props.state]);
|
|
115
|
+
const textAreaRef = ref();
|
|
114
116
|
const getIconSize = computed(() => {
|
|
115
117
|
if (props.size === Size.xs || props.size === Size.xs2) {
|
|
116
118
|
return IconSize.xs;
|
|
@@ -144,6 +146,11 @@ function onBlur(e: FocusEvent) {
|
|
|
144
146
|
emit('validate', props.modelValue);
|
|
145
147
|
emit('blur', e);
|
|
146
148
|
}
|
|
149
|
+
|
|
150
|
+
defineExpose({
|
|
151
|
+
getTextAreaRef: () => textAreaRef.value
|
|
152
|
+
});
|
|
153
|
+
|
|
147
154
|
</script>
|
|
148
155
|
|
|
149
156
|
<template>
|
|
@@ -168,6 +175,7 @@ function onBlur(e: FocusEvent) {
|
|
|
168
175
|
:placeholder="placeholder !== undefined ? placeholder : label"
|
|
169
176
|
:disabled="disabled || skeleton"
|
|
170
177
|
:readonly="readonly"
|
|
178
|
+
ref="textAreaRef"
|
|
171
179
|
v-bind="$attrs"
|
|
172
180
|
@blur="onBlur"
|
|
173
181
|
/>
|
|
@@ -60,7 +60,7 @@ const icons = {
|
|
|
60
60
|
};
|
|
61
61
|
const inputClasses = computed(() => {
|
|
62
62
|
const variants: Record<InputState, string> = {
|
|
63
|
-
[InputState.base]: 'outline-
|
|
63
|
+
[InputState.base]: 'outline-base-300 focus:ring-primary-200 bg-white placeholder:text-base-500',
|
|
64
64
|
[InputState.danger]: 'outline-danger-500 focus:ring-danger-200 bg-danger-100 placeholder:text-danger-700',
|
|
65
65
|
[InputState.info]: 'outline-info-500 focus:ring-info-200 bg-info-100 placeholder:text-info-700',
|
|
66
66
|
[InputState.success]: 'outline-success-500 focus:ring-success-200 bg-success-100 placeholder:text-success-700',
|
|
@@ -49,7 +49,6 @@ const {floatingStyles, middlewareData, placement} = useFloating(reference, float
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
onClickOutside(floating, () => {
|
|
52
|
-
console.log(props.open);
|
|
53
52
|
if (!props.open) {
|
|
54
53
|
return;
|
|
55
54
|
}
|
|
@@ -62,7 +61,7 @@ const isOpen = useVModel(props, 'open', emit);
|
|
|
62
61
|
const focusedDropDownItem = useVModel(props, 'focused', emit);
|
|
63
62
|
const dropdownClasses = computed(() => {
|
|
64
63
|
const variants: Record<InputState, string> = {
|
|
65
|
-
[InputState.base]: 'bg-
|
|
64
|
+
[InputState.base]: 'bg-base-300 border-base-300',
|
|
66
65
|
[InputState.success]: 'bg-success-500 border-success-500',
|
|
67
66
|
[InputState.info]: 'bg-info-500 border-info-500',
|
|
68
67
|
[InputState.warning]: 'bg-warning-500 border-warning-500',
|
|
@@ -169,7 +168,7 @@ function onKeyDownDropDown(e: KeyboardEvent) {
|
|
|
169
168
|
|
|
170
169
|
function getActiveDropDownItemClasses(option: SelectOption) {
|
|
171
170
|
const variants: Record<InputState, string> = {
|
|
172
|
-
[InputState.base]: '!bg-
|
|
171
|
+
[InputState.base]: '!bg-base-100',
|
|
173
172
|
[InputState.success]: 'bg-success-200',
|
|
174
173
|
[InputState.info]: 'bg-info-200',
|
|
175
174
|
[InputState.warning]: 'bg-warning-200',
|
|
@@ -13,8 +13,8 @@ const hasLogoImageSlot = computed(() => useSlots()['logo-image'] || false);
|
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<template>
|
|
16
|
-
<div class="flex gap-px bg-
|
|
17
|
-
<div class="flex flex-col gap-px bg-
|
|
16
|
+
<div class="flex gap-px bg-base-300 h-screen min-w-full overflow-y-hidden">
|
|
17
|
+
<div class="flex flex-col gap-px bg-base-300 w-52 shrink-0">
|
|
18
18
|
<component
|
|
19
19
|
:is="logoRoute ? 'RouterLink' : 'div'"
|
|
20
20
|
v-if="hasLogoImageSlot"
|
|
@@ -4,7 +4,7 @@ const meta = {
|
|
|
4
4
|
title: "Layouts/NavLeftLayout",
|
|
5
5
|
component: AntNavLeftLayout,
|
|
6
6
|
parameters: { controls: { sort: "requiredFirst" } },
|
|
7
|
-
decorators: [() => ({ template: '<div class="border border-dashed border-
|
|
7
|
+
decorators: [() => ({ template: '<div class="border border-dashed border-base-300"><story/></div>' })],
|
|
8
8
|
argTypes: {}
|
|
9
9
|
};
|
|
10
10
|
export default meta;
|
|
@@ -11,7 +11,7 @@ const props = defineProps<{
|
|
|
11
11
|
|
|
12
12
|
const itemClasses = computed(() => ({
|
|
13
13
|
'w-full text-sm p-1.5 rounded-md cursor-pointer flex items-center flex-nowrap gap-1': true,
|
|
14
|
-
'transition-colors hover:bg-
|
|
14
|
+
'transition-colors hover:bg-base-100': true,
|
|
15
15
|
'text-primary-500': props.navbarItem.active
|
|
16
16
|
}));
|
|
17
17
|
|
|
@@ -35,7 +35,7 @@ const props = withDefaults(
|
|
|
35
35
|
selectableRows: false,
|
|
36
36
|
showLightVersion: false,
|
|
37
37
|
size: AntTableSize.md,
|
|
38
|
-
headerColor: 'bg-
|
|
38
|
+
headerColor: 'bg-base-200'
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
const selected: Ref<Record<string, unknown> | undefined> = useVModel(props, 'selectedRow', emits);
|
|
@@ -132,9 +132,9 @@ function rowClick(elem: Record<string, unknown>): void {
|
|
|
132
132
|
:class="{
|
|
133
133
|
'bg-primary-200 text-primary-200-font transition-colors': elem === selected,
|
|
134
134
|
'bg-white text-for-white-bg-font': elem !== selected && rowIndex % 2 === 0,
|
|
135
|
-
'bg-
|
|
135
|
+
'bg-base-100 text-base-100-font': elem !== selected && rowIndex % 2 !== 0,
|
|
136
136
|
'cursor-pointer': selectableRows,
|
|
137
|
-
'hover:bg-
|
|
137
|
+
'hover:bg-base-200': selectableRows && elem !== selected,
|
|
138
138
|
}"
|
|
139
139
|
>
|
|
140
140
|
<slot
|
|
@@ -199,7 +199,7 @@ function rowClick(elem: Record<string, unknown>): void {
|
|
|
199
199
|
|
|
200
200
|
<div
|
|
201
201
|
v-if="data.length > 0 && _loading"
|
|
202
|
-
class="absolute bg-opacity-50 w-full top-0 bottom-0 bg-
|
|
202
|
+
class="absolute bg-opacity-50 w-full top-0 bottom-0 bg-base-300 flex items-center justify-center"
|
|
203
203
|
>
|
|
204
204
|
<AntSpinner
|
|
205
205
|
class="!w-24 !h-24"
|
|
@@ -209,7 +209,7 @@ function rowClick(elem: Record<string, unknown>): void {
|
|
|
209
209
|
|
|
210
210
|
<div
|
|
211
211
|
v-if="!data || data.length <= 0 && _loading"
|
|
212
|
-
class="absolute bg-opacity-50 w-full top-[40px] bottom-0 bg-
|
|
212
|
+
class="absolute bg-opacity-50 w-full top-[40px] bottom-0 bg-base-300 flex items-center justify-center"
|
|
213
213
|
>
|
|
214
214
|
<AntSkeleton
|
|
215
215
|
v-model="_loading"
|
|
@@ -16,7 +16,7 @@ const props = withDefaults(
|
|
|
16
16
|
|
|
17
17
|
const headerClasses = computed(() => ({
|
|
18
18
|
[props.header.headerClassList || '']: true,
|
|
19
|
-
'text-sm text-
|
|
19
|
+
'text-sm text-base-200-font uppercase font-semi-bold': true,
|
|
20
20
|
'text-left': !props.header.align || props.header.align === AntTableAlign.left,
|
|
21
21
|
'text-center': props.header.align === AntTableAlign.center,
|
|
22
22
|
'text-right': props.header.align === AntTableAlign.right,
|
|
@@ -166,7 +166,7 @@ const Docs = exports.Docs = {
|
|
|
166
166
|
};
|
|
167
167
|
},
|
|
168
168
|
template: `
|
|
169
|
-
<div class="h-96 border border-dashed border-
|
|
169
|
+
<div class="h-96 border border-dashed border-base-300">
|
|
170
170
|
<AntTable v-bind="args" v-model="selected" :selected-row="selected" @row-click="(val) => selected = val">
|
|
171
171
|
<template #cellContent="{element: entry, header}">
|
|
172
172
|
<div v-if="header.identifier === 'employeed'">
|
|
@@ -110,7 +110,7 @@ export const Docs = {
|
|
|
110
110
|
return { args, selected };
|
|
111
111
|
},
|
|
112
112
|
template: `
|
|
113
|
-
<div class="h-96 border border-dashed border-
|
|
113
|
+
<div class="h-96 border border-dashed border-base-300">
|
|
114
114
|
<AntTable v-bind="args" v-model="selected" :selected-row="selected" @row-click="(val) => selected = val">
|
|
115
115
|
<template #cellContent="{element: entry, header}">
|
|
116
116
|
<div v-if="header.identifier === 'employeed'">
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import AntIcon from '../AntIcon.vue';
|
|
3
3
|
import {
|
|
4
|
+
faCircleInfo,
|
|
4
5
|
faExclamationCircle,
|
|
5
6
|
faExclamationTriangle,
|
|
6
7
|
type IconDefinition
|
|
@@ -30,6 +31,7 @@ const route = useRoute();
|
|
|
30
31
|
|
|
31
32
|
const icons = {
|
|
32
33
|
[TabItemState.base]: null,
|
|
34
|
+
[TabItemState.info]: faCircleInfo,
|
|
33
35
|
[TabItemState.danger]: faExclamationCircle,
|
|
34
36
|
[TabItemState.warning]: faExclamationTriangle,
|
|
35
37
|
};
|
|
@@ -47,23 +49,26 @@ const _active = computed<boolean>(() => {
|
|
|
47
49
|
});
|
|
48
50
|
const containerClasses = computed(() => {
|
|
49
51
|
const variants: Record<TabItemState, string> = {
|
|
50
|
-
[TabItemState.base]: 'hover:bg-
|
|
52
|
+
[TabItemState.base]: 'hover:bg-base-100',
|
|
53
|
+
[TabItemState.info]: 'hover:bg-base-100',
|
|
51
54
|
[TabItemState.warning]: 'hover:bg-warning-100',
|
|
52
55
|
[TabItemState.danger]: 'hover:bg-danger-100',
|
|
53
56
|
};
|
|
54
57
|
const activeVariants: Record<TabItemState, string> = {
|
|
55
58
|
[TabItemState.base]: 'text-primary-500 border-primary-500',
|
|
59
|
+
[TabItemState.info]: 'text-info-500 border-info-500',
|
|
56
60
|
[TabItemState.warning]: 'text-warning-500 border-warning-500',
|
|
57
61
|
[TabItemState.danger]: 'text-danger-500 border-danger-500',
|
|
58
62
|
};
|
|
59
63
|
const notActiveVariants: Record<TabItemState, string> = {
|
|
60
|
-
[TabItemState.base]: 'text-for-white-bg-font
|
|
64
|
+
[TabItemState.base]: 'text-for-white-bg-font',
|
|
65
|
+
[TabItemState.info]: 'text-info-500',
|
|
61
66
|
[TabItemState.warning]: 'text-warning-500',
|
|
62
67
|
[TabItemState.danger]: 'text-danger-500',
|
|
63
68
|
};
|
|
64
69
|
|
|
65
70
|
return {
|
|
66
|
-
'p-2 text-center flex items-center justify-center gap-2 bg-white transition-[background-color] relative text-sm': true,
|
|
71
|
+
'p-2 text-center flex items-center justify-center gap-2 bg-white transition-[background-color] relative text-sm text-nowrap': true,
|
|
67
72
|
'grow': props.expanded,
|
|
68
73
|
[variants[props.state]]: !props.disabled,
|
|
69
74
|
[activeVariants[props.state]]: _active.value,
|
|
@@ -75,6 +80,7 @@ const containerClasses = computed(() => {
|
|
|
75
80
|
const borderBoxClasses = computed(() => {
|
|
76
81
|
const variants: Record<TabItemState, string> = {
|
|
77
82
|
[TabItemState.base]: 'bg-primary-500',
|
|
83
|
+
[TabItemState.info]: 'bg-info-500',
|
|
78
84
|
[TabItemState.warning]: 'bg-warning-500',
|
|
79
85
|
[TabItemState.danger]: 'bg-danger-500',
|
|
80
86
|
};
|
|
@@ -86,7 +92,8 @@ const borderBoxClasses = computed(() => {
|
|
|
86
92
|
});
|
|
87
93
|
const iconColor = computed(() => {
|
|
88
94
|
const variants = {
|
|
89
|
-
[TabItemState.base]: 'text-
|
|
95
|
+
[TabItemState.base]: 'text-base-100-font',
|
|
96
|
+
[TabItemState.info]: 'text-info-500',
|
|
90
97
|
[TabItemState.warning]: 'text-warning-500',
|
|
91
98
|
[TabItemState.danger]: 'text-danger-500',
|
|
92
99
|
};
|
|
@@ -17,8 +17,10 @@ const props = withDefaults(defineProps<{
|
|
|
17
17
|
|
|
18
18
|
const currentActive = useVModel(props, 'modelValue', emits);
|
|
19
19
|
const containerClasses = computed(() => ({
|
|
20
|
-
'flex
|
|
21
|
-
|
|
20
|
+
'flex transition-all h-full': true,
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
const scrollContainerClasses = computed(() => ({
|
|
22
24
|
'w-full': props.expanded,
|
|
23
25
|
}));
|
|
24
26
|
|
|
@@ -37,6 +39,7 @@ function clickTab(tabItem: TabItem) {
|
|
|
37
39
|
|
|
38
40
|
<template>
|
|
39
41
|
<div :class="containerClasses">
|
|
42
|
+
<div class="flex gap-px bg-base-300 border-l border-r border-base-300 overflow-x-auto" :class="scrollContainerClasses">
|
|
40
43
|
<slot>
|
|
41
44
|
<AntTabItem
|
|
42
45
|
v-for="(tabItem, index) in tabItems"
|
|
@@ -51,5 +54,6 @@ function clickTab(tabItem: TabItem) {
|
|
|
51
54
|
<slot name="content" v-bind="{item: tabItem, isActive: currentActive === tabItem.id}"></slot>
|
|
52
55
|
</AntTabItem>
|
|
53
56
|
</slot>
|
|
57
|
+
</div>
|
|
54
58
|
</div>
|
|
55
59
|
</template>
|
|
@@ -5,5 +5,6 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof AntTabs>;
|
|
6
6
|
export declare const Docs: Story;
|
|
7
7
|
export declare const FixedHeight: Story;
|
|
8
|
+
export declare const HorizontalScrolling: Story;
|
|
8
9
|
export declare const DifferentStates: Story;
|
|
9
10
|
export declare const Summary: Story;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
module.exports = exports.Summary = exports.FixedHeight = exports.Docs = exports.DifferentStates = void 0;
|
|
6
|
+
module.exports = exports.Summary = exports.HorizontalScrolling = exports.FixedHeight = exports.Docs = exports.DifferentStates = void 0;
|
|
7
7
|
var _AntTabs = _interopRequireDefault(require("../AntTabs.vue"));
|
|
8
8
|
var _AntFormGroupLabel = _interopRequireDefault(require("../../forms/AntFormGroupLabel.vue"));
|
|
9
9
|
var _AntFormGroup = _interopRequireDefault(require("../../forms/AntFormGroup.vue"));
|
|
@@ -83,6 +83,68 @@ const FixedHeight = exports.FixedHeight = {
|
|
|
83
83
|
}),
|
|
84
84
|
args: Docs.args
|
|
85
85
|
};
|
|
86
|
+
const HorizontalScrolling = exports.HorizontalScrolling = {
|
|
87
|
+
render: args => ({
|
|
88
|
+
components: {
|
|
89
|
+
AntTabs: _AntTabs.default,
|
|
90
|
+
AntFormGroupLabel: _AntFormGroupLabel.default,
|
|
91
|
+
AntFormGroup: _AntFormGroup.default
|
|
92
|
+
},
|
|
93
|
+
setup() {
|
|
94
|
+
return {
|
|
95
|
+
args
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
template: `
|
|
99
|
+
<AntFormGroup>
|
|
100
|
+
|
|
101
|
+
<AntFormGroupLabel>Default Small</AntFormGroupLabel>
|
|
102
|
+
<AntFormGroup class="dashed max-w-[320px] overflow-hidden">
|
|
103
|
+
<AntTabs v-bind="args" v-model="args.modelValue" />
|
|
104
|
+
</AntFormGroup>
|
|
105
|
+
|
|
106
|
+
<AntFormGroupLabel>Expanded Small</AntFormGroupLabel>
|
|
107
|
+
<AntFormGroup class="dashed max-w-[320px] overflow-hidden">
|
|
108
|
+
<AntTabs v-bind="args" v-model="args.modelValue" expanded />
|
|
109
|
+
</AntFormGroup>
|
|
110
|
+
|
|
111
|
+
<AntFormGroupLabel>Default Large</AntFormGroupLabel>
|
|
112
|
+
<AntFormGroup class="dashed">
|
|
113
|
+
<AntTabs v-bind="args" v-model="args.modelValue" />
|
|
114
|
+
</AntFormGroup>
|
|
115
|
+
|
|
116
|
+
<AntFormGroupLabel>Expanded Large</AntFormGroupLabel>
|
|
117
|
+
<AntFormGroup class="dashed">
|
|
118
|
+
<AntTabs v-bind="args" v-model="args.modelValue" expanded />
|
|
119
|
+
</AntFormGroup>
|
|
120
|
+
|
|
121
|
+
</AntFormGroup>
|
|
122
|
+
`
|
|
123
|
+
}),
|
|
124
|
+
args: {
|
|
125
|
+
tabItems: [{
|
|
126
|
+
id: "1",
|
|
127
|
+
label: "First tab"
|
|
128
|
+
}, {
|
|
129
|
+
id: "2",
|
|
130
|
+
label: "Second tab"
|
|
131
|
+
}, {
|
|
132
|
+
id: "3",
|
|
133
|
+
label: "Third tab",
|
|
134
|
+
state: _AntTabItem.TabItemState.warning
|
|
135
|
+
}, {
|
|
136
|
+
id: "4",
|
|
137
|
+
label: "Fourth tab",
|
|
138
|
+
state: _AntTabItem.TabItemState.danger
|
|
139
|
+
}, {
|
|
140
|
+
id: "5",
|
|
141
|
+
label: "Fifth tab"
|
|
142
|
+
}, {
|
|
143
|
+
id: "6",
|
|
144
|
+
label: "Sixth tab"
|
|
145
|
+
}]
|
|
146
|
+
}
|
|
147
|
+
};
|
|
86
148
|
const DifferentStates = exports.DifferentStates = {
|
|
87
149
|
render: Docs.render,
|
|
88
150
|
args: {
|
|
@@ -100,6 +162,10 @@ const DifferentStates = exports.DifferentStates = {
|
|
|
100
162
|
id: "4",
|
|
101
163
|
label: "Fourth tab",
|
|
102
164
|
state: _AntTabItem.TabItemState.danger
|
|
165
|
+
}, {
|
|
166
|
+
id: "5",
|
|
167
|
+
label: "Fifth tab",
|
|
168
|
+
state: _AntTabItem.TabItemState.info
|
|
103
169
|
}]
|
|
104
170
|
}
|
|
105
171
|
};
|
|
@@ -114,6 +180,7 @@ const Summary = exports.Summary = {
|
|
|
114
180
|
const value_1 = (0, _vue.ref)();
|
|
115
181
|
const value_2 = (0, _vue.ref)();
|
|
116
182
|
const value_3 = (0, _vue.ref)("2");
|
|
183
|
+
const value_4 = (0, _vue.ref)();
|
|
117
184
|
const tabItems_1 = [{
|
|
118
185
|
id: "1",
|
|
119
186
|
label: "My account"
|
|
@@ -146,14 +213,38 @@ const Summary = exports.Summary = {
|
|
|
146
213
|
label: "Messages",
|
|
147
214
|
to: "/#"
|
|
148
215
|
}];
|
|
216
|
+
const tabItems_4 = [{
|
|
217
|
+
id: "1",
|
|
218
|
+
label: "First tab"
|
|
219
|
+
}, {
|
|
220
|
+
id: "2",
|
|
221
|
+
label: "Second tab"
|
|
222
|
+
}, {
|
|
223
|
+
id: "3",
|
|
224
|
+
label: "Third tab",
|
|
225
|
+
state: _AntTabItem.TabItemState.warning
|
|
226
|
+
}, {
|
|
227
|
+
id: "4",
|
|
228
|
+
label: "Fourth tab",
|
|
229
|
+
state: _AntTabItem.TabItemState.danger
|
|
230
|
+
}, {
|
|
231
|
+
id: "5",
|
|
232
|
+
label: "Fifth tab",
|
|
233
|
+
state: _AntTabItem.TabItemState.info
|
|
234
|
+
}, {
|
|
235
|
+
id: "6",
|
|
236
|
+
label: "Sixth tab"
|
|
237
|
+
}];
|
|
149
238
|
return {
|
|
150
239
|
args,
|
|
151
240
|
value_1,
|
|
152
241
|
value_2,
|
|
153
242
|
value_3,
|
|
243
|
+
value_4,
|
|
154
244
|
tabItems_1,
|
|
155
245
|
tabItems_2,
|
|
156
|
-
tabItems_3
|
|
246
|
+
tabItems_3,
|
|
247
|
+
tabItems_4
|
|
157
248
|
};
|
|
158
249
|
},
|
|
159
250
|
template: `
|
|
@@ -167,15 +258,30 @@ const Summary = exports.Summary = {
|
|
|
167
258
|
|
|
168
259
|
<AntFormGroupLabel>Expanded</AntFormGroupLabel>
|
|
169
260
|
<AntFormGroup>
|
|
170
|
-
<div class="dashed"><AntTabs v-model="value_1" :tab-items="tabItems_1" expanded
|
|
171
|
-
<div class="dashed"><AntTabs v-model="value_2" :tab-items="tabItems_2" expanded
|
|
172
|
-
<div class="dashed"><AntTabs v-model="value_3" :tab-items="tabItems_3" expanded
|
|
261
|
+
<div class="dashed"><AntTabs v-model="value_1" :tab-items="tabItems_1" expanded/></div>
|
|
262
|
+
<div class="dashed"><AntTabs v-model="value_2" :tab-items="tabItems_2" expanded/></div>
|
|
263
|
+
<div class="dashed"><AntTabs v-model="value_3" :tab-items="tabItems_3" expanded/></div>
|
|
173
264
|
</AntFormGroup>
|
|
174
265
|
|
|
175
266
|
<AntFormGroupLabel>Larger container</AntFormGroupLabel>
|
|
176
267
|
<div class="h-16 dashed">
|
|
177
|
-
<AntTabs v-model="value_3" :tab-items="tabItems_3" expanded
|
|
268
|
+
<AntTabs v-model="value_3" :tab-items="tabItems_3" expanded/>
|
|
269
|
+
</div>
|
|
270
|
+
|
|
271
|
+
<AntFormGroupLabel>Different States</AntFormGroupLabel>
|
|
272
|
+
<div class="dashed">
|
|
273
|
+
<AntTabs v-model="value_4" :tab-items="tabItems_4" />
|
|
178
274
|
</div>
|
|
275
|
+
|
|
276
|
+
<AntFormGroupLabel>Default Small Parent Container</AntFormGroupLabel>
|
|
277
|
+
<AntFormGroup class="dashed max-w-[320px] overflow-hidden">
|
|
278
|
+
<AntTabs v-model="value_4" :tab-items="tabItems_4" />
|
|
279
|
+
</AntFormGroup>
|
|
280
|
+
|
|
281
|
+
<AntFormGroupLabel>Expanded Small Parent Container</AntFormGroupLabel>
|
|
282
|
+
<AntFormGroup class="dashed max-w-[320px] overflow-hidden">
|
|
283
|
+
<AntTabs v-model="value_4" :tab-items="tabItems_4" expanded />
|
|
284
|
+
</AntFormGroup>
|
|
179
285
|
</AntFormGroup>
|
|
180
286
|
`
|
|
181
287
|
}),
|