@antify/ui 2.5.4 → 2.5.6
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/inputs/AntColorInput/AntColorInput.stories.js +5 -0
- package/dist/components/inputs/AntColorInput/AntColorInput.stories.mjs +5 -0
- package/dist/components/inputs/AntColorInput/AntColorInput.vue +3 -0
- package/dist/components/inputs/AntColorInput/ColorSelection.vue +4 -0
- package/dist/components/inputs/AntSwitch.vue +1 -0
- package/dist/components/inputs/AntTagInput.vue +6 -3
- package/dist/components/inputs/Elements/AntSelectMenu.vue +23 -21
- package/dist/components/inputs/__stories/AntSelect.stories.js +24 -0
- package/dist/components/inputs/__stories/AntSelect.stories.mjs +32 -0
- package/dist/components/inputs/__stories/AntSwitch.stories.js +6 -2
- package/dist/components/inputs/__stories/AntSwitch.stories.mjs +6 -2
- package/package.json +1 -1
|
@@ -35,11 +35,13 @@ const props = withDefaults(defineProps<{
|
|
|
35
35
|
size?: Size;
|
|
36
36
|
messages?: string[];
|
|
37
37
|
nullable?: boolean;
|
|
38
|
+
colorsPerRow?: number;
|
|
38
39
|
}>(), {
|
|
39
40
|
state: InputState.base,
|
|
40
41
|
size: Size.md,
|
|
41
42
|
messages: () => [],
|
|
42
43
|
nullable: false,
|
|
44
|
+
colorsPerRow: 4,
|
|
43
45
|
});
|
|
44
46
|
const _value = computed({
|
|
45
47
|
get() {
|
|
@@ -223,6 +225,7 @@ onMounted(() => {
|
|
|
223
225
|
<ColorSelection
|
|
224
226
|
:value="modelValue"
|
|
225
227
|
:colors="props.options"
|
|
228
|
+
:colors-per-row="colorsPerRow"
|
|
226
229
|
@select="onColorSelect"
|
|
227
230
|
/>
|
|
228
231
|
</template>
|
|
@@ -19,6 +19,7 @@ withDefaults(defineProps<{
|
|
|
19
19
|
value: string | null;
|
|
20
20
|
colors: string[];
|
|
21
21
|
size?: Size;
|
|
22
|
+
colorsPerRow: number;
|
|
22
23
|
}>(), {
|
|
23
24
|
size: Size.md,
|
|
24
25
|
});
|
|
@@ -46,6 +47,9 @@ onMounted(() => {
|
|
|
46
47
|
'p-2': size === Size.md,
|
|
47
48
|
'p-2.5': size === Size.lg,
|
|
48
49
|
}"
|
|
50
|
+
:style="{
|
|
51
|
+
gridTemplateColumns: `repeat(${colorsPerRow}, minmax(0, 1fr))`
|
|
52
|
+
}"
|
|
49
53
|
>
|
|
50
54
|
<Color
|
|
51
55
|
v-for="(color, index) in colors"
|
|
@@ -47,6 +47,7 @@ const buttonClasses = computed(() => {
|
|
|
47
47
|
'relative inline-flex shrink-0': true,
|
|
48
48
|
'focus:outline-hidden': true,
|
|
49
49
|
'rounded-full ease-in-out duration-200': true,
|
|
50
|
+
'cursor-pointer': !hasInputState.value,
|
|
50
51
|
'focus-within:ring-4': !hasInputState.value && (props.size === Size.lg || props.size === Size.md),
|
|
51
52
|
'focus-within:ring-2': !hasInputState.value && (props.size === Size.sm || props.size === Size.xs || props.size === Size.xs2),
|
|
52
53
|
'h-5 w-9': props.size === Size.lg || props.size === Size.md || props.size === Size.sm,
|
|
@@ -193,7 +193,10 @@ function addTag(tagValue: string | number): void {
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
if (Array.isArray(_modelValue.value)) {
|
|
196
|
-
_modelValue.value
|
|
196
|
+
_modelValue.value = [
|
|
197
|
+
..._modelValue.value,
|
|
198
|
+
tagValue,
|
|
199
|
+
];
|
|
197
200
|
} else {
|
|
198
201
|
_modelValue.value = [
|
|
199
202
|
tagValue,
|
|
@@ -205,13 +208,13 @@ function addTag(tagValue: string | number): void {
|
|
|
205
208
|
|
|
206
209
|
function removeLastTag() {
|
|
207
210
|
if (tagInput.value === '' && Array.isArray(_modelValue.value) && _modelValue.value.length > 0) {
|
|
208
|
-
_modelValue.value.
|
|
211
|
+
_modelValue.value = _modelValue.value.filter((element) => element !== _modelValue.value?.pop());
|
|
209
212
|
}
|
|
210
213
|
}
|
|
211
214
|
|
|
212
215
|
function removeTag(tag: string | number) {
|
|
213
216
|
if (_modelValue.value && !props.disabled && !props.skeleton && !props.readonly) {
|
|
214
|
-
_modelValue.value
|
|
217
|
+
_modelValue.value = _modelValue.value.filter((element) => element !== tag);
|
|
215
218
|
}
|
|
216
219
|
}
|
|
217
220
|
|
|
@@ -97,7 +97,7 @@ const dropdownClasses = computed(() => {
|
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
return {
|
|
100
|
-
'w-fit border
|
|
100
|
+
'w-fit border outline-none -mt-px overflow-y-auto shadow-md z-[90] max-h-[250px]': true,
|
|
101
101
|
'rounded-md': true,
|
|
102
102
|
[variants[props.state]]: true,
|
|
103
103
|
};
|
|
@@ -298,26 +298,28 @@ watch(_modelValue, (val) => {
|
|
|
298
298
|
data-e2e="select-menu"
|
|
299
299
|
:style="{minWidth: `${elementSize.width.value}px!important`, ...floatingStyles}"
|
|
300
300
|
>
|
|
301
|
-
<div
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
301
|
+
<div class="flex flex-col gap-px">
|
|
302
|
+
<div
|
|
303
|
+
v-for="(option, index) in options"
|
|
304
|
+
:key="`option-${index}`"
|
|
305
|
+
:class="{
|
|
306
|
+
...dropDownItemClasses,
|
|
307
|
+
...getActiveDropDownItemClasses(option),
|
|
308
|
+
'font-bold': option.isGroupLabel,
|
|
309
|
+
}"
|
|
310
|
+
@mousedown="(e) => onClickDropDownItem(e, option)"
|
|
311
|
+
@mouseover="() => focusedDropDownItem = !option.isGroupLabel && option.value !== undefined ? option.value : null"
|
|
312
|
+
>
|
|
313
|
+
<slot
|
|
314
|
+
name="contentLeft"
|
|
315
|
+
v-bind="option"
|
|
316
|
+
/>
|
|
317
|
+
{{ option.label }}
|
|
318
|
+
<slot
|
|
319
|
+
name="contentRight"
|
|
320
|
+
v-bind="option"
|
|
321
|
+
/>
|
|
322
|
+
</div>
|
|
321
323
|
</div>
|
|
322
324
|
|
|
323
325
|
<div
|
|
@@ -78,6 +78,30 @@ const options = [{
|
|
|
78
78
|
}, {
|
|
79
79
|
label: "Option 4",
|
|
80
80
|
value: "4"
|
|
81
|
+
}, {
|
|
82
|
+
label: "Option 5",
|
|
83
|
+
value: "5"
|
|
84
|
+
}, {
|
|
85
|
+
label: "Option 6",
|
|
86
|
+
value: "6"
|
|
87
|
+
}, {
|
|
88
|
+
label: "Option 7",
|
|
89
|
+
value: "7"
|
|
90
|
+
}, {
|
|
91
|
+
label: "Option 8",
|
|
92
|
+
value: "8"
|
|
93
|
+
}, {
|
|
94
|
+
label: "Option 9",
|
|
95
|
+
value: "9"
|
|
96
|
+
}, {
|
|
97
|
+
label: "Option 10",
|
|
98
|
+
value: "10"
|
|
99
|
+
}, {
|
|
100
|
+
label: "Option 11",
|
|
101
|
+
value: "11"
|
|
102
|
+
}, {
|
|
103
|
+
label: "Option 12",
|
|
104
|
+
value: "12"
|
|
81
105
|
}];
|
|
82
106
|
const manySelectOptions = [...Array(24).keys()].map(key => ({
|
|
83
107
|
label: `Option ${Number(key) + 1}`,
|
|
@@ -85,6 +85,38 @@ const options = [
|
|
|
85
85
|
{
|
|
86
86
|
label: "Option 4",
|
|
87
87
|
value: "4"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
label: "Option 5",
|
|
91
|
+
value: "5"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: "Option 6",
|
|
95
|
+
value: "6"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
label: "Option 7",
|
|
99
|
+
value: "7"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
label: "Option 8",
|
|
103
|
+
value: "8"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: "Option 9",
|
|
107
|
+
value: "9"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
label: "Option 10",
|
|
111
|
+
value: "10"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
label: "Option 11",
|
|
115
|
+
value: "11"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
label: "Option 12",
|
|
119
|
+
value: "12"
|
|
88
120
|
}
|
|
89
121
|
];
|
|
90
122
|
const manySelectOptions = [
|
|
@@ -36,12 +36,16 @@ const Docs = exports.Docs = {
|
|
|
36
36
|
AntSwitch: _AntSwitch.default
|
|
37
37
|
},
|
|
38
38
|
setup() {
|
|
39
|
+
const value = (0, _vue.ref)(false);
|
|
39
40
|
return {
|
|
40
|
-
args
|
|
41
|
+
args,
|
|
42
|
+
value
|
|
41
43
|
};
|
|
42
44
|
},
|
|
43
45
|
template: `
|
|
44
|
-
<AntSwitch v-bind="args"
|
|
46
|
+
<AntSwitch v-bind="args" v-model="value">
|
|
47
|
+
Value
|
|
48
|
+
</AntSwitch>
|
|
45
49
|
`
|
|
46
50
|
}),
|
|
47
51
|
args: {
|
|
@@ -35,12 +35,16 @@ export const Docs = {
|
|
|
35
35
|
AntSwitch
|
|
36
36
|
},
|
|
37
37
|
setup() {
|
|
38
|
+
const value = ref(false);
|
|
38
39
|
return {
|
|
39
|
-
args
|
|
40
|
+
args,
|
|
41
|
+
value
|
|
40
42
|
};
|
|
41
43
|
},
|
|
42
44
|
template: `
|
|
43
|
-
<AntSwitch v-bind="args"
|
|
45
|
+
<AntSwitch v-bind="args" v-model="value">
|
|
46
|
+
Value
|
|
47
|
+
</AntSwitch>
|
|
44
48
|
`
|
|
45
49
|
}),
|
|
46
50
|
args: {
|