@antify/ui 3.1.25 → 3.1.26
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/AntButton.vue +36 -16
- package/dist/components/AntTooltip.vue +2 -1
- package/dist/components/__stories/AntButton.stories.js +2 -2
- package/dist/components/__stories/AntButton.stories.mjs +4 -4
- package/dist/components/__types/AntButton.types.d.ts +8 -0
- package/dist/components/__types/AntButton.types.js +11 -2
- package/dist/components/__types/AntButton.types.mjs +9 -0
- package/package.json +1 -1
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
} from 'vue-router';
|
|
11
11
|
import AntSkeleton from './AntSkeleton.vue';
|
|
12
12
|
import AntSpinner from './AntSpinner.vue';
|
|
13
|
+
import {
|
|
14
|
+
AntSpinnerSize,
|
|
15
|
+
} from './__types';
|
|
13
16
|
import {
|
|
14
17
|
Grouped,
|
|
15
18
|
} from '../enums/Grouped.enum';
|
|
16
|
-
import {
|
|
17
|
-
Size,
|
|
18
|
-
} from '../enums/Size.enum';
|
|
19
19
|
import {
|
|
20
20
|
handleEnumValidation,
|
|
21
21
|
} from '../handler';
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
} from '../enums';
|
|
25
25
|
import {
|
|
26
26
|
ButtonType,
|
|
27
|
+
ButtonSize,
|
|
27
28
|
} from './__types';
|
|
28
29
|
import AntIcon from './AntIcon.vue';
|
|
29
30
|
import AntTooltip from './AntTooltip.vue';
|
|
@@ -42,7 +43,7 @@ defineEmits([
|
|
|
42
43
|
|
|
43
44
|
const props = withDefaults(defineProps<{
|
|
44
45
|
filled?: boolean;
|
|
45
|
-
size?:
|
|
46
|
+
size?: ButtonSize;
|
|
46
47
|
state?: State;
|
|
47
48
|
iconLeft?: IconDefinition;
|
|
48
49
|
iconRight?: IconDefinition;
|
|
@@ -66,7 +67,7 @@ const props = withDefaults(defineProps<{
|
|
|
66
67
|
filled: false,
|
|
67
68
|
skeleton: false,
|
|
68
69
|
spinner: false,
|
|
69
|
-
size:
|
|
70
|
+
size: ButtonSize.md,
|
|
70
71
|
grouped: Grouped.none,
|
|
71
72
|
readonly: false,
|
|
72
73
|
expanded: false,
|
|
@@ -134,17 +135,18 @@ const classes = computed(() => {
|
|
|
134
135
|
};
|
|
135
136
|
|
|
136
137
|
return {
|
|
137
|
-
'transition-all inline-flex items-center justify-center font-medium cursor-pointer select-none': true,
|
|
138
|
+
'transition-all inline-flex items-center justify-center font-medium cursor-pointer select-none h-fit': true,
|
|
138
139
|
'active:shadow-[inset_0_4px_4px_rgba(0,0,0,0.25)]': !hasInputState.value,
|
|
139
|
-
'p-1 text-
|
|
140
|
-
'p-1
|
|
141
|
-
'p-1.5 text-
|
|
142
|
-
'p-
|
|
143
|
-
'p-2
|
|
140
|
+
'p-1 text-2xs gap-1': props.size === ButtonSize.xs3,
|
|
141
|
+
'p-1 text-xs gap-1': props.size === ButtonSize.xs2,
|
|
142
|
+
'p-1.5 text-xs gap-1.5': props.size === ButtonSize.xs,
|
|
143
|
+
'p-1.5 text-sm gap-1.5': props.size === ButtonSize.sm,
|
|
144
|
+
'p-2 text-sm gap-2': props.size === ButtonSize.md,
|
|
145
|
+
'p-2.5 text-sm gap-2.5': props.size === ButtonSize.lg,
|
|
144
146
|
'disabled:opacity-50 disabled:cursor-not-allowed': true,
|
|
145
147
|
'cursor-default': props.readonly,
|
|
146
|
-
'focus:ring-2': !props.readonly && props.size ===
|
|
147
|
-
'focus:ring-4': !props.readonly && props.size ===
|
|
148
|
+
'focus:ring-2': !props.readonly && props.size === ButtonSize.sm || props.size === ButtonSize.xs || props.size === ButtonSize.xs2 || props.size === ButtonSize.xs3,
|
|
149
|
+
'focus:ring-4': !props.readonly && props.size === ButtonSize.md || props.size === ButtonSize.lg,
|
|
148
150
|
'w-full': props.expanded,
|
|
149
151
|
'outline outline-1 outline-offset-[-1px]': props.outlined,
|
|
150
152
|
...groupedClassList.value,
|
|
@@ -192,15 +194,33 @@ const is = computed(() => {
|
|
|
192
194
|
return props.to !== undefined ? 'router-link' : 'button';
|
|
193
195
|
});
|
|
194
196
|
const getIconSize = computed(() => {
|
|
195
|
-
if (props.size ===
|
|
197
|
+
if (props.size === ButtonSize.xs || props.size === ButtonSize.xs2) {
|
|
196
198
|
return IconSize.xs;
|
|
199
|
+
} else if (props.size === ButtonSize.xs3) {
|
|
200
|
+
return IconSize.xs2;
|
|
197
201
|
} else {
|
|
198
202
|
return IconSize.sm;
|
|
199
203
|
}
|
|
200
204
|
});
|
|
205
|
+
const spinnerSize = computed(() => {
|
|
206
|
+
switch (props.size) {
|
|
207
|
+
case ButtonSize.lg:
|
|
208
|
+
return AntSpinnerSize.sm;
|
|
209
|
+
case ButtonSize.md:
|
|
210
|
+
return AntSpinnerSize.sm;
|
|
211
|
+
case ButtonSize.sm:
|
|
212
|
+
return AntSpinnerSize.sm;
|
|
213
|
+
case ButtonSize.xs:
|
|
214
|
+
return AntSpinnerSize.xs;
|
|
215
|
+
case ButtonSize.xs2:
|
|
216
|
+
return AntSpinnerSize.xs2;
|
|
217
|
+
default:
|
|
218
|
+
return AntSpinnerSize.xs2;
|
|
219
|
+
}
|
|
220
|
+
});
|
|
201
221
|
|
|
202
222
|
onMounted(() => {
|
|
203
|
-
handleEnumValidation(props.size,
|
|
223
|
+
handleEnumValidation(props.size, ButtonSize, 'size');
|
|
204
224
|
handleEnumValidation(props.state, State, 'state');
|
|
205
225
|
handleEnumValidation(props.grouped, Grouped, 'grouped');
|
|
206
226
|
});
|
|
@@ -236,7 +256,7 @@ onMounted(() => {
|
|
|
236
256
|
>
|
|
237
257
|
<AntSpinner
|
|
238
258
|
v-if="spinner"
|
|
239
|
-
:size="
|
|
259
|
+
:size="spinnerSize"
|
|
240
260
|
:state="state"
|
|
241
261
|
:inverted="!filled"
|
|
242
262
|
/>
|
|
@@ -170,11 +170,12 @@ function onClick() {
|
|
|
170
170
|
|
|
171
171
|
<template>
|
|
172
172
|
<div
|
|
173
|
-
class="relative"
|
|
173
|
+
class="relative h-fit"
|
|
174
174
|
data-e2e="tooltip"
|
|
175
175
|
>
|
|
176
176
|
<div
|
|
177
177
|
ref="reference"
|
|
178
|
+
class="flex"
|
|
178
179
|
@mouseenter="() => onMouseOver()"
|
|
179
180
|
@mouseleave="() => onMouseLeave()"
|
|
180
181
|
@click="() => onClick()"
|
|
@@ -8,10 +8,10 @@ var _AntButton = _interopRequireDefault(require("../AntButton.vue"));
|
|
|
8
8
|
var _AntFormGroupLabel = _interopRequireDefault(require("../forms/AntFormGroupLabel.vue"));
|
|
9
9
|
var _AntFormGroup = _interopRequireDefault(require("../forms/AntFormGroup.vue"));
|
|
10
10
|
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
11
|
-
var _Size = require("../../enums/Size.enum");
|
|
12
11
|
var _Grouped2 = require("../../enums/Grouped.enum");
|
|
13
12
|
var _enums = require("../../enums");
|
|
14
13
|
var _test = require("@storybook/test");
|
|
14
|
+
var _AntButton2 = require("../__types/AntButton.types");
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
const meta = {
|
|
17
17
|
component: _AntButton.default,
|
|
@@ -39,7 +39,7 @@ const meta = {
|
|
|
39
39
|
control: {
|
|
40
40
|
type: "select"
|
|
41
41
|
},
|
|
42
|
-
options: Object.values(
|
|
42
|
+
options: Object.values(_AntButton2.ButtonSize),
|
|
43
43
|
description: "Defines the size of the button"
|
|
44
44
|
},
|
|
45
45
|
iconLeft: {
|
|
@@ -5,9 +5,6 @@ import {
|
|
|
5
5
|
faCaretRight,
|
|
6
6
|
faCaretLeft
|
|
7
7
|
} from "@fortawesome/free-solid-svg-icons";
|
|
8
|
-
import {
|
|
9
|
-
Size
|
|
10
|
-
} from "../../enums/Size.enum.mjs";
|
|
11
8
|
import {
|
|
12
9
|
Grouped as _Grouped
|
|
13
10
|
} from "../../enums/Grouped.enum.mjs";
|
|
@@ -19,6 +16,9 @@ import {
|
|
|
19
16
|
import {
|
|
20
17
|
within
|
|
21
18
|
} from "@storybook/test";
|
|
19
|
+
import {
|
|
20
|
+
ButtonSize
|
|
21
|
+
} from "../__types/AntButton.types.mjs";
|
|
22
22
|
const meta = {
|
|
23
23
|
component: AntButton,
|
|
24
24
|
title: "Components/Button",
|
|
@@ -45,7 +45,7 @@ const meta = {
|
|
|
45
45
|
control: {
|
|
46
46
|
type: "select"
|
|
47
47
|
},
|
|
48
|
-
options: Object.values(
|
|
48
|
+
options: Object.values(ButtonSize),
|
|
49
49
|
description: "Defines the size of the button"
|
|
50
50
|
},
|
|
51
51
|
iconLeft: {
|
|
@@ -3,9 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ButtonType = void 0;
|
|
6
|
+
exports.ButtonType = exports.ButtonSize = void 0;
|
|
7
7
|
var ButtonType = exports.ButtonType = /* @__PURE__ */(ButtonType2 => {
|
|
8
8
|
ButtonType2["button"] = "button";
|
|
9
9
|
ButtonType2["submit"] = "submit";
|
|
10
10
|
return ButtonType2;
|
|
11
|
-
})(ButtonType || {});
|
|
11
|
+
})(ButtonType || {});
|
|
12
|
+
var ButtonSize = exports.ButtonSize = /* @__PURE__ */(ButtonSize2 => {
|
|
13
|
+
ButtonSize2["lg"] = "lg";
|
|
14
|
+
ButtonSize2["md"] = "md";
|
|
15
|
+
ButtonSize2["sm"] = "sm";
|
|
16
|
+
ButtonSize2["xs"] = "xs";
|
|
17
|
+
ButtonSize2["xs2"] = "2xs";
|
|
18
|
+
ButtonSize2["xs3"] = "3xs";
|
|
19
|
+
return ButtonSize2;
|
|
20
|
+
})(ButtonSize || {});
|
|
@@ -3,3 +3,12 @@ export var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
|
3
3
|
ButtonType2["submit"] = "submit";
|
|
4
4
|
return ButtonType2;
|
|
5
5
|
})(ButtonType || {});
|
|
6
|
+
export var ButtonSize = /* @__PURE__ */ ((ButtonSize2) => {
|
|
7
|
+
ButtonSize2["lg"] = "lg";
|
|
8
|
+
ButtonSize2["md"] = "md";
|
|
9
|
+
ButtonSize2["sm"] = "sm";
|
|
10
|
+
ButtonSize2["xs"] = "xs";
|
|
11
|
+
ButtonSize2["xs2"] = "2xs";
|
|
12
|
+
ButtonSize2["xs3"] = "3xs";
|
|
13
|
+
return ButtonSize2;
|
|
14
|
+
})(ButtonSize || {});
|