@antify/ui 3.1.25 → 3.1.27
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/dist/components/inputs/AntCheckbox.vue +18 -3
- package/dist/components/inputs/AntCheckboxGroup.vue +18 -0
- package/dist/components/inputs/__stories/AntCheckbox.stories.d.ts +1 -0
- package/dist/components/inputs/__stories/AntCheckbox.stories.js +33 -1
- package/dist/components/inputs/__stories/AntCheckbox.stories.mjs +32 -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 || {});
|
|
@@ -40,6 +40,18 @@ const props =
|
|
|
40
40
|
disabled?: boolean;
|
|
41
41
|
readonly?: boolean;
|
|
42
42
|
messages?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* Tailwind ring class with focus prefix e.g. focus:ring-primary-200
|
|
45
|
+
*/
|
|
46
|
+
focusColorClass?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Tailwind outline class e.g. outline-primary-300
|
|
49
|
+
*/
|
|
50
|
+
inactiveColorClass?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Tailwind text class e.g. text-primary-500
|
|
53
|
+
*/
|
|
54
|
+
activeColorClass?: string;
|
|
43
55
|
}>(), {
|
|
44
56
|
state: InputState.base,
|
|
45
57
|
size: Size.md,
|
|
@@ -47,27 +59,30 @@ const props =
|
|
|
47
59
|
disabled: false,
|
|
48
60
|
readonly: false,
|
|
49
61
|
messages: () => [],
|
|
62
|
+
focusColorClass: 'focus:ring-primary-200',
|
|
63
|
+
inactiveColorClass: 'outline-base-300',
|
|
64
|
+
activeColorClass: 'text-primary-500',
|
|
50
65
|
});
|
|
51
66
|
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
52
67
|
const delayedValue = ref(_modelValue.value);
|
|
53
68
|
const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
|
|
54
69
|
const inputClasses = computed(() => {
|
|
55
70
|
const focusColorVariant: Record<InputState, string> = {
|
|
56
|
-
[InputState.base]:
|
|
71
|
+
[InputState.base]: props.focusColorClass,
|
|
57
72
|
[InputState.danger]: 'focus:ring-danger-200',
|
|
58
73
|
[InputState.info]: 'focus:ring-info-200',
|
|
59
74
|
[InputState.success]: 'focus:ring-success-200',
|
|
60
75
|
[InputState.warning]: 'focus:ring-warning-200',
|
|
61
76
|
};
|
|
62
77
|
const activeColorVariant: Record<InputState, string> = {
|
|
63
|
-
[InputState.base]:
|
|
78
|
+
[InputState.base]: props.activeColorClass,
|
|
64
79
|
[InputState.danger]: 'text-danger-500',
|
|
65
80
|
[InputState.info]: 'text-info-500',
|
|
66
81
|
[InputState.success]: 'text-success-500',
|
|
67
82
|
[InputState.warning]: 'text-warning-500',
|
|
68
83
|
};
|
|
69
84
|
const inactiveColorVariant: Record<InputState, string> = {
|
|
70
|
-
[InputState.base]:
|
|
85
|
+
[InputState.base]: props.inactiveColorClass,
|
|
71
86
|
[InputState.danger]: 'outline-danger-500',
|
|
72
87
|
[InputState.info]: 'outline-info-500',
|
|
73
88
|
[InputState.success]: 'outline-success-500',
|
|
@@ -34,6 +34,18 @@ const props = withDefaults(
|
|
|
34
34
|
readonly?: boolean;
|
|
35
35
|
disabled?: boolean;
|
|
36
36
|
messages?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Tailwind ring class with focus prefix e.g. focus:ring-primary-200
|
|
39
|
+
*/
|
|
40
|
+
focusColorClass?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Tailwind outline class e.g. outline-primary-300
|
|
43
|
+
*/
|
|
44
|
+
inactiveColorClass?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Tailwind text class e.g. text-primary-500
|
|
47
|
+
*/
|
|
48
|
+
activeColorClass?: string;
|
|
37
49
|
}>(),
|
|
38
50
|
{
|
|
39
51
|
direction: Direction.column,
|
|
@@ -43,6 +55,9 @@ const props = withDefaults(
|
|
|
43
55
|
readonly: false,
|
|
44
56
|
disabled: false,
|
|
45
57
|
messages: () => [],
|
|
58
|
+
focusColorClass: 'focus:ring-primary-200',
|
|
59
|
+
inactiveColorClass: 'outline-base-300',
|
|
60
|
+
activeColorClass: 'text-primary-500',
|
|
46
61
|
},
|
|
47
62
|
);
|
|
48
63
|
const containerClasses = computed(() => ({
|
|
@@ -131,6 +146,9 @@ onMounted(() => {
|
|
|
131
146
|
:skeleton="skeleton"
|
|
132
147
|
:disabled="disabled || checkbox.disabled"
|
|
133
148
|
:readonly="readonly || checkbox.readonly"
|
|
149
|
+
:active-color-class="activeColorClass"
|
|
150
|
+
:inactive-color-class="inactiveColorClass"
|
|
151
|
+
:focus-color-class="focusColorClass"
|
|
134
152
|
@update:model-value="updateValue(checkbox.value)"
|
|
135
153
|
@blur="() => onBlurCheckbox()"
|
|
136
154
|
>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
module.exports = exports.Summary = exports.Docs = void 0;
|
|
6
|
+
module.exports = exports.customColors = exports.Summary = exports.Docs = void 0;
|
|
7
7
|
var _AntCheckbox = _interopRequireDefault(require("../AntCheckbox.vue"));
|
|
8
8
|
var _vue = require("vue");
|
|
9
9
|
var _enums = require("../../../enums");
|
|
@@ -61,6 +61,38 @@ const Docs = exports.Docs = {
|
|
|
61
61
|
`
|
|
62
62
|
})
|
|
63
63
|
};
|
|
64
|
+
const customColors = exports.customColors = {
|
|
65
|
+
render: args => ({
|
|
66
|
+
components: {
|
|
67
|
+
AntCheckbox: _AntCheckbox.default
|
|
68
|
+
},
|
|
69
|
+
setup() {
|
|
70
|
+
const value = (0, _vue.computed)({
|
|
71
|
+
get() {
|
|
72
|
+
return args.modelValue;
|
|
73
|
+
},
|
|
74
|
+
set(val) {
|
|
75
|
+
args.modelValue = val;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
args,
|
|
80
|
+
value
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
template: `
|
|
84
|
+
<div class="m-2">
|
|
85
|
+
<AntCheckbox v-bind="args" v-model="value"/>
|
|
86
|
+
<span class="text-sm text-gray-500">Reactive value: {{ value }}</span>
|
|
87
|
+
</div>
|
|
88
|
+
`
|
|
89
|
+
}),
|
|
90
|
+
args: {
|
|
91
|
+
focusColorClass: "focus:ring-teal-200",
|
|
92
|
+
inactiveColorClass: "outline-teal-300",
|
|
93
|
+
activeColorClass: "text-teal-300"
|
|
94
|
+
}
|
|
95
|
+
};
|
|
64
96
|
const Summary = exports.Summary = {
|
|
65
97
|
parameters: {
|
|
66
98
|
chromatic: {
|
|
@@ -60,6 +60,38 @@ export const Docs = {
|
|
|
60
60
|
`
|
|
61
61
|
})
|
|
62
62
|
};
|
|
63
|
+
export const customColors = {
|
|
64
|
+
render: (args) => ({
|
|
65
|
+
components: {
|
|
66
|
+
AntCheckbox
|
|
67
|
+
},
|
|
68
|
+
setup() {
|
|
69
|
+
const value = computed({
|
|
70
|
+
get() {
|
|
71
|
+
return args.modelValue;
|
|
72
|
+
},
|
|
73
|
+
set(val) {
|
|
74
|
+
args.modelValue = val;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
args,
|
|
79
|
+
value
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
template: `
|
|
83
|
+
<div class="m-2">
|
|
84
|
+
<AntCheckbox v-bind="args" v-model="value"/>
|
|
85
|
+
<span class="text-sm text-gray-500">Reactive value: {{ value }}</span>
|
|
86
|
+
</div>
|
|
87
|
+
`
|
|
88
|
+
}),
|
|
89
|
+
args: {
|
|
90
|
+
focusColorClass: "focus:ring-teal-200",
|
|
91
|
+
inactiveColorClass: "outline-teal-300",
|
|
92
|
+
activeColorClass: "text-teal-300"
|
|
93
|
+
}
|
|
94
|
+
};
|
|
63
95
|
export const Summary = {
|
|
64
96
|
parameters: {
|
|
65
97
|
chromatic: {
|