@antify/ui 2.4.5 → 2.4.11
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/buttons/AntButton.vue +1 -1
- package/dist/components/inputs/AntColorInput/AntColorInput.stories.js +26 -20
- package/dist/components/inputs/AntColorInput/AntColorInput.stories.mjs +35 -20
- package/dist/components/inputs/AntColorInput/AntColorInput.vue +52 -30
- package/dist/components/inputs/AntColorInput/Color.vue +44 -12
- package/dist/components/inputs/AntColorInput/ColorSelection.vue +18 -1
- package/dist/components/inputs/AntImageInput.vue +91 -22
- package/dist/components/inputs/AntPasswordInput.vue +5 -0
- package/dist/components/inputs/AntSelect.vue +4 -3
- package/dist/components/inputs/AntTagInput.vue +6 -2
- package/dist/components/inputs/AntTextInput.vue +5 -0
- package/dist/components/inputs/Elements/AntSelectMenu.vue +15 -7
- package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.d.ts +1 -0
- package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.js +35 -1
- package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.mjs +36 -0
- package/dist/components/inputs/__stories/AntPasswordInput.stories.d.ts +2 -1
- package/dist/components/inputs/__stories/AntPasswordInput.stories.js +36 -1
- package/dist/components/inputs/__stories/AntPasswordInput.stories.mjs +37 -0
- package/dist/components/inputs/__stories/AntSelect.stories.d.ts +1 -0
- package/dist/components/inputs/__stories/AntSelect.stories.js +47 -3
- package/dist/components/inputs/__stories/AntSelect.stories.mjs +48 -2
- package/dist/components/inputs/__stories/AntTextInput.stories.d.ts +2 -1
- package/dist/components/inputs/__stories/AntTextInput.stories.js +37 -1
- package/dist/components/inputs/__stories/AntTextInput.stories.mjs +38 -0
- package/package.json +1 -1
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import {
|
|
3
|
-
computed,
|
|
4
|
-
onMounted,
|
|
5
|
-
ref,
|
|
3
|
+
computed, onBeforeUnmount, onMounted, ref,
|
|
6
4
|
} from 'vue';
|
|
7
5
|
import AntField from '../forms/AntField.vue';
|
|
8
6
|
import {
|
|
@@ -11,9 +9,6 @@ import {
|
|
|
11
9
|
import {
|
|
12
10
|
InputState, State,
|
|
13
11
|
} from '../../enums';
|
|
14
|
-
import {
|
|
15
|
-
useVModel,
|
|
16
|
-
} from '@vueuse/core';
|
|
17
12
|
import {
|
|
18
13
|
handleEnumValidation,
|
|
19
14
|
} from '../../handler';
|
|
@@ -73,6 +68,44 @@ const openFileDialog = () => {
|
|
|
73
68
|
fileInput.value?.click();
|
|
74
69
|
};
|
|
75
70
|
|
|
71
|
+
const isDragging = ref<boolean>(false);
|
|
72
|
+
const isDraggingOverDropZone = ref<boolean>(false);
|
|
73
|
+
|
|
74
|
+
const dropZoneClasses = computed(() => {
|
|
75
|
+
return {
|
|
76
|
+
'h-full w-full border-2 border-transparent rounded overflow-y-auto p-2 -top-2 -left-2': true,
|
|
77
|
+
'border-primary-500!': isDraggingOverDropZone.value,
|
|
78
|
+
'border-dashed border-base-300!': isDragging.value,
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const handleDragOver = () => {
|
|
83
|
+
isDraggingOverDropZone.value = true;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const handleDragEnter = () => {
|
|
87
|
+
isDraggingOverDropZone.value = true;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const handleDragLeave = () => {
|
|
91
|
+
isDraggingOverDropZone.value = false;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const handleDrop = (event: DragEvent) => {
|
|
95
|
+
isDraggingOverDropZone.value = false;
|
|
96
|
+
isDragging.value = false;
|
|
97
|
+
|
|
98
|
+
if(!event.dataTransfer) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const file = event.dataTransfer.files?.[0];
|
|
103
|
+
|
|
104
|
+
if(file) {
|
|
105
|
+
emit('upload', file as File);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
76
109
|
const handleFileChange = (event: Event) => {
|
|
77
110
|
const target = event.target as HTMLInputElement;
|
|
78
111
|
const file = target.files?.[0];
|
|
@@ -82,9 +115,34 @@ const handleFileChange = (event: Event) => {
|
|
|
82
115
|
}
|
|
83
116
|
};
|
|
84
117
|
|
|
118
|
+
const handleDragOverBody = (e: DragEvent) => {
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
isDragging.value = true;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const handleDragLeaveBody = (e: DragEvent) => {
|
|
124
|
+
e.preventDefault();
|
|
125
|
+
isDragging.value = false;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const handleDropBody = (e: DragEvent) => {
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
isDragging.value = false;
|
|
131
|
+
};
|
|
132
|
+
|
|
85
133
|
onMounted(() => {
|
|
86
134
|
handleEnumValidation(props.state, InputState, 'state');
|
|
87
135
|
handleEnumValidation(props.size, Size, 'size');
|
|
136
|
+
|
|
137
|
+
document.body.addEventListener('dragover', handleDragOverBody);
|
|
138
|
+
document.body.addEventListener('dragleave', handleDragLeaveBody);
|
|
139
|
+
document.body.addEventListener('drop', handleDropBody);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
onBeforeUnmount(() => {
|
|
143
|
+
document.body.removeEventListener('dragover', handleDragOverBody);
|
|
144
|
+
document.body.removeEventListener('dragleave', handleDragLeaveBody);
|
|
145
|
+
document.body.removeEventListener('drop', handleDropBody);
|
|
88
146
|
});
|
|
89
147
|
</script>
|
|
90
148
|
|
|
@@ -135,25 +193,36 @@ onMounted(() => {
|
|
|
135
193
|
</div>
|
|
136
194
|
|
|
137
195
|
<div class="flex flex-col gap-2.5 w-full">
|
|
138
|
-
<div class="flex items-center relative w-full justify-between">
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
196
|
+
<div class="flex items-center relative w-full justify-between gap-2">
|
|
197
|
+
<div class="relative w-full h-full flex items-center">
|
|
198
|
+
<input
|
|
199
|
+
v-if="!disabled && !skeleton"
|
|
200
|
+
ref="fileInput"
|
|
201
|
+
type="file"
|
|
202
|
+
accept="image/*"
|
|
203
|
+
class="hidden"
|
|
204
|
+
@change="handleFileChange"
|
|
205
|
+
>
|
|
206
|
+
|
|
207
|
+
<span class="text-sm text-for-white-bg-font relative">
|
|
208
|
+
Upload Image
|
|
147
209
|
|
|
148
|
-
|
|
149
|
-
|
|
210
|
+
<AntSkeleton
|
|
211
|
+
v-if="skeleton"
|
|
212
|
+
absolute
|
|
213
|
+
rounded
|
|
214
|
+
/>
|
|
215
|
+
</span>
|
|
150
216
|
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
217
|
+
<div
|
|
218
|
+
class="absolute top-0 left-0 w-full h-full border bg-transparent"
|
|
219
|
+
:class="dropZoneClasses"
|
|
220
|
+
@drop.prevent="handleDrop"
|
|
221
|
+
@dragenter.prevent="handleDragEnter"
|
|
222
|
+
@dragover.prevent="handleDragOver"
|
|
223
|
+
@dragleave.prevent="handleDragLeave"
|
|
155
224
|
/>
|
|
156
|
-
</
|
|
225
|
+
</div>
|
|
157
226
|
|
|
158
227
|
<AntButton
|
|
159
228
|
v-if="src"
|
|
@@ -36,6 +36,7 @@ const props = withDefaults(defineProps<{
|
|
|
36
36
|
label?: string;
|
|
37
37
|
placeholder?: string;
|
|
38
38
|
description?: string;
|
|
39
|
+
inputRef?: null | HTMLInputElement;
|
|
39
40
|
size?: Size;
|
|
40
41
|
state?: InputState;
|
|
41
42
|
disabled?: boolean;
|
|
@@ -43,6 +44,7 @@ const props = withDefaults(defineProps<{
|
|
|
43
44
|
messages?: string[];
|
|
44
45
|
}>(), {
|
|
45
46
|
state: InputState.base,
|
|
47
|
+
inputRef: null,
|
|
46
48
|
disabled: false,
|
|
47
49
|
skeleton: false,
|
|
48
50
|
size: Size.md,
|
|
@@ -50,9 +52,11 @@ const props = withDefaults(defineProps<{
|
|
|
50
52
|
});
|
|
51
53
|
const emit = defineEmits([
|
|
52
54
|
'update:modelValue',
|
|
55
|
+
'update:inputRef',
|
|
53
56
|
'validate',
|
|
54
57
|
]);
|
|
55
58
|
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
59
|
+
const _inputRef = useVModel(props, 'inputRef', emit);
|
|
56
60
|
const isVisible = ref(false);
|
|
57
61
|
const iconSize = computed(() => {
|
|
58
62
|
if (props.size === Size.xs2 || props.size === Size.xs) {
|
|
@@ -94,6 +98,7 @@ onMounted(() => {
|
|
|
94
98
|
<div class="flex relative">
|
|
95
99
|
<AntBaseInput
|
|
96
100
|
v-model="_modelValue"
|
|
101
|
+
v-model:input-ref="_inputRef"
|
|
97
102
|
:type="isVisible ? BaseInputType.text : BaseInputType.password"
|
|
98
103
|
:state="state"
|
|
99
104
|
:size="size"
|
|
@@ -283,7 +283,6 @@ function onClickRemoveButton() {
|
|
|
283
283
|
:size="size"
|
|
284
284
|
:state="state"
|
|
285
285
|
:close-on-enter="true"
|
|
286
|
-
@select-element="(e) => _modelValue = e"
|
|
287
286
|
>
|
|
288
287
|
<template #contentLeft="props">
|
|
289
288
|
<slot
|
|
@@ -324,7 +323,7 @@ function onClickRemoveButton() {
|
|
|
324
323
|
|
|
325
324
|
<div
|
|
326
325
|
v-else
|
|
327
|
-
class="flex items-center select-none
|
|
326
|
+
class="flex items-center select-none overflow-hidden w-full"
|
|
328
327
|
:class="{
|
|
329
328
|
'gap-1': size === Size.xs2,
|
|
330
329
|
'gap1.5': size === Size.xs,
|
|
@@ -338,7 +337,9 @@ function onClickRemoveButton() {
|
|
|
338
337
|
name="contentLeft"
|
|
339
338
|
v-bind="selectedOption"
|
|
340
339
|
/>
|
|
341
|
-
|
|
340
|
+
<div class="text-ellipsis overflow-hidden whitespace-nowrap w-full text-black">
|
|
341
|
+
{{ valueLabel }}
|
|
342
|
+
</div>
|
|
342
343
|
<slot
|
|
343
344
|
v-if="selectedOption !== null"
|
|
344
345
|
name="contentRight"
|
|
@@ -154,7 +154,6 @@ function onClickOutside() {
|
|
|
154
154
|
if (!dropDownOpen.value) {
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
console.log('click outside');
|
|
158
157
|
// dropDownOpen.value = false;
|
|
159
158
|
}
|
|
160
159
|
|
|
@@ -183,7 +182,6 @@ function addTagFromOptions(item: string | number) {
|
|
|
183
182
|
addTag(item);
|
|
184
183
|
|
|
185
184
|
if (props.autoCloseAfterSelection) {
|
|
186
|
-
console.log('HIER');
|
|
187
185
|
dropDownOpen.value = false;
|
|
188
186
|
}
|
|
189
187
|
}
|
|
@@ -221,6 +219,10 @@ function changeFocus() {
|
|
|
221
219
|
dropDownOpen.value = true;
|
|
222
220
|
}
|
|
223
221
|
|
|
222
|
+
function closeDropdown() {
|
|
223
|
+
dropDownOpen.value = false;
|
|
224
|
+
}
|
|
225
|
+
|
|
224
226
|
function onBlur(e: FocusEvent) {
|
|
225
227
|
emit('validate', props.modelValue);
|
|
226
228
|
emit('blur', e);
|
|
@@ -312,9 +314,11 @@ onMounted(() => {
|
|
|
312
314
|
:class="inputClasses"
|
|
313
315
|
:disabled="disabled"
|
|
314
316
|
:readonly="readonly"
|
|
317
|
+
@click="changeFocus"
|
|
315
318
|
@focus="changeFocus"
|
|
316
319
|
@keydown.delete="removeLastTag"
|
|
317
320
|
@keydown.enter.prevent="checkCreateTag(tagInput)"
|
|
321
|
+
@keydown.esc.prevent="closeDropdown"
|
|
318
322
|
@blur="onBlur"
|
|
319
323
|
>
|
|
320
324
|
</div>
|
|
@@ -30,6 +30,7 @@ defineOptions({
|
|
|
30
30
|
const emit = defineEmits([
|
|
31
31
|
'update:modelValue',
|
|
32
32
|
'update:skeleton',
|
|
33
|
+
'update:inputRef',
|
|
33
34
|
'validate',
|
|
34
35
|
]);
|
|
35
36
|
const props = withDefaults(defineProps<{
|
|
@@ -43,11 +44,13 @@ const props = withDefaults(defineProps<{
|
|
|
43
44
|
readonly?: boolean;
|
|
44
45
|
skeleton?: boolean;
|
|
45
46
|
type?: TextInputType;
|
|
47
|
+
inputRef?: null | HTMLInputElement;
|
|
46
48
|
limiter?: boolean;
|
|
47
49
|
max?: number;
|
|
48
50
|
messages?: string[];
|
|
49
51
|
}>(), {
|
|
50
52
|
state: InputState.base,
|
|
53
|
+
inputRef: null,
|
|
51
54
|
disabled: false,
|
|
52
55
|
readonly: false,
|
|
53
56
|
skeleton: false,
|
|
@@ -58,6 +61,7 @@ const props = withDefaults(defineProps<{
|
|
|
58
61
|
});
|
|
59
62
|
|
|
60
63
|
const _value = useVModel(props, 'modelValue', emit);
|
|
64
|
+
const _inputRef = useVModel(props, 'inputRef', emit);
|
|
61
65
|
|
|
62
66
|
onMounted(() => {
|
|
63
67
|
handleEnumValidation(props.size, Size, 'size');
|
|
@@ -79,6 +83,7 @@ onMounted(() => {
|
|
|
79
83
|
>
|
|
80
84
|
<AntBaseInput
|
|
81
85
|
v-model="_value"
|
|
86
|
+
v-model:input-ref="_inputRef"
|
|
82
87
|
:type="type as unknown as BaseInputType"
|
|
83
88
|
wrapper-class="grow"
|
|
84
89
|
:state="state"
|
|
@@ -16,13 +16,13 @@ import type {
|
|
|
16
16
|
SelectOption,
|
|
17
17
|
} from '../__types';
|
|
18
18
|
import {
|
|
19
|
-
useElementSize, useVModel,
|
|
19
|
+
onClickOutside, useElementSize, useVModel,
|
|
20
20
|
} from '@vueuse/core';
|
|
21
21
|
import type {
|
|
22
22
|
Validator,
|
|
23
23
|
} from '@antify/validate';
|
|
24
24
|
import {
|
|
25
|
-
autoUpdate, flip, offset, useFloating,
|
|
25
|
+
autoPlacement, autoUpdate, flip, offset, useFloating,
|
|
26
26
|
} from '@floating-ui/vue';
|
|
27
27
|
|
|
28
28
|
const emit = defineEmits([
|
|
@@ -56,13 +56,21 @@ const floating = ref<HTMLElement | null>(null);
|
|
|
56
56
|
const {
|
|
57
57
|
floatingStyles,
|
|
58
58
|
} = useFloating(reference, floating, {
|
|
59
|
-
placement: 'bottom',
|
|
59
|
+
placement: 'bottom-start',
|
|
60
60
|
whileElementsMounted: autoUpdate,
|
|
61
61
|
middleware: [
|
|
62
62
|
offset(8),
|
|
63
|
+
autoPlacement({
|
|
64
|
+
allowedPlacements: [
|
|
65
|
+
'top-start',
|
|
66
|
+
'top-end',
|
|
67
|
+
'bottom-start',
|
|
68
|
+
'bottom-end',
|
|
69
|
+
],
|
|
70
|
+
}),
|
|
63
71
|
flip({
|
|
64
72
|
fallbackPlacements: [
|
|
65
|
-
'top',
|
|
73
|
+
'top-start',
|
|
66
74
|
],
|
|
67
75
|
}),
|
|
68
76
|
],
|
|
@@ -89,7 +97,7 @@ const dropdownClasses = computed(() => {
|
|
|
89
97
|
};
|
|
90
98
|
|
|
91
99
|
return {
|
|
92
|
-
'w-
|
|
100
|
+
'w-fit border flex flex-col gap-px outline-none -mt-px overflow-y-auto shadow-md z-[90] max-h-[250px]': true,
|
|
93
101
|
'rounded-md': true,
|
|
94
102
|
[variants[props.state]]: true,
|
|
95
103
|
};
|
|
@@ -121,7 +129,7 @@ watch(isOpen, () => {
|
|
|
121
129
|
focusedDropDownItem.value =
|
|
122
130
|
typeof _modelValue.value === 'string' || typeof _modelValue.value === 'number' ? _modelValue.value :
|
|
123
131
|
Array.isArray(_modelValue.value) ? _modelValue.value[0] :
|
|
124
|
-
(props.options[0]
|
|
132
|
+
(props.options[0]?.value || null);
|
|
125
133
|
} else {
|
|
126
134
|
focusedDropDownItem.value = null;
|
|
127
135
|
}
|
|
@@ -288,7 +296,7 @@ watch(_modelValue, (val) => {
|
|
|
288
296
|
ref="floating"
|
|
289
297
|
:class="dropdownClasses"
|
|
290
298
|
data-e2e="select-menu"
|
|
291
|
-
:style="{
|
|
299
|
+
:style="{minWidth: `${elementSize.width.value}px!important`, ...floatingStyles}"
|
|
292
300
|
>
|
|
293
301
|
<div
|
|
294
302
|
v-for="(option, index) in options"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
module.exports = exports.Summary = exports.Nullable = exports.IconRight = exports.IconLeft = exports.Docs = void 0;
|
|
6
|
+
module.exports = exports.Summary = exports.Nullable = exports.IconRight = exports.IconLeft = exports.Docs = exports.Autofocus = void 0;
|
|
7
7
|
var _Size = require("../../../../enums/Size.enum");
|
|
8
8
|
var _AntBaseInput = require("../__types/AntBaseInput.types");
|
|
9
9
|
var _AntBaseInput2 = _interopRequireDefault(require("../AntBaseInput.vue"));
|
|
@@ -15,6 +15,7 @@ var _enums = require("../../../../enums");
|
|
|
15
15
|
var _AntFormGroup = _interopRequireDefault(require("../../../forms/AntFormGroup.vue"));
|
|
16
16
|
var _AntFormGroupLabel = _interopRequireDefault(require("../../../forms/AntFormGroupLabel.vue"));
|
|
17
17
|
var _Direction = require("../../../../enums/Direction.enum");
|
|
18
|
+
var _vue = require("vue");
|
|
18
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
20
|
const meta = {
|
|
20
21
|
computed: {
|
|
@@ -174,6 +175,39 @@ const IconRight = exports.IconRight = {
|
|
|
174
175
|
...Docs.args
|
|
175
176
|
}
|
|
176
177
|
};
|
|
178
|
+
const Autofocus = exports.Autofocus = {
|
|
179
|
+
render: args => ({
|
|
180
|
+
components: {
|
|
181
|
+
AntBaseInput: _AntBaseInput2.default,
|
|
182
|
+
AntFormGroup: _AntFormGroup.default,
|
|
183
|
+
AntButton: _AntButton.default
|
|
184
|
+
},
|
|
185
|
+
setup: () => {
|
|
186
|
+
const inputRef = (0, _vue.ref)(null);
|
|
187
|
+
return {
|
|
188
|
+
inputRef,
|
|
189
|
+
clickAutofocus: () => {
|
|
190
|
+
inputRef.value?.focus();
|
|
191
|
+
},
|
|
192
|
+
args
|
|
193
|
+
};
|
|
194
|
+
},
|
|
195
|
+
template: `
|
|
196
|
+
<AntFormGroup>
|
|
197
|
+
<AntButton @click="clickAutofocus">Focus element</AntButton>
|
|
198
|
+
|
|
199
|
+
<AntBaseInput
|
|
200
|
+
v-model="args.modelValue"
|
|
201
|
+
v-bind="args"
|
|
202
|
+
v-model:input-ref="inputRef"
|
|
203
|
+
/>
|
|
204
|
+
</AntFormGroup>
|
|
205
|
+
`
|
|
206
|
+
}),
|
|
207
|
+
args: {
|
|
208
|
+
...Docs.args
|
|
209
|
+
}
|
|
210
|
+
};
|
|
177
211
|
const Summary = exports.Summary = {
|
|
178
212
|
parameters: {
|
|
179
213
|
chromatic: {
|
|
@@ -22,6 +22,9 @@ import AntFormGroupLabel from "../../../forms/AntFormGroupLabel.vue";
|
|
|
22
22
|
import {
|
|
23
23
|
Direction
|
|
24
24
|
} from "../../../../enums/Direction.enum.mjs";
|
|
25
|
+
import {
|
|
26
|
+
ref
|
|
27
|
+
} from "vue";
|
|
25
28
|
const meta = {
|
|
26
29
|
computed: {
|
|
27
30
|
Direction() {
|
|
@@ -180,6 +183,39 @@ export const IconRight = {
|
|
|
180
183
|
...Docs.args
|
|
181
184
|
}
|
|
182
185
|
};
|
|
186
|
+
export const Autofocus = {
|
|
187
|
+
render: (args) => ({
|
|
188
|
+
components: {
|
|
189
|
+
AntBaseInput,
|
|
190
|
+
AntFormGroup,
|
|
191
|
+
AntButton
|
|
192
|
+
},
|
|
193
|
+
setup: () => {
|
|
194
|
+
const inputRef = ref(null);
|
|
195
|
+
return {
|
|
196
|
+
inputRef,
|
|
197
|
+
clickAutofocus: () => {
|
|
198
|
+
inputRef.value?.focus();
|
|
199
|
+
},
|
|
200
|
+
args
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
|
+
template: `
|
|
204
|
+
<AntFormGroup>
|
|
205
|
+
<AntButton @click="clickAutofocus">Focus element</AntButton>
|
|
206
|
+
|
|
207
|
+
<AntBaseInput
|
|
208
|
+
v-model="args.modelValue"
|
|
209
|
+
v-bind="args"
|
|
210
|
+
v-model:input-ref="inputRef"
|
|
211
|
+
/>
|
|
212
|
+
</AntFormGroup>
|
|
213
|
+
`
|
|
214
|
+
}),
|
|
215
|
+
args: {
|
|
216
|
+
...Docs.args
|
|
217
|
+
}
|
|
218
|
+
};
|
|
183
219
|
export const Summary = {
|
|
184
220
|
parameters: {
|
|
185
221
|
chromatic: {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
2
|
import AntPasswordInput from '../AntPasswordInput.vue';
|
|
3
3
|
declare const meta: Meta<typeof AntPasswordInput>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof AntPasswordInput>;
|
|
6
6
|
export declare const Docs: Story;
|
|
7
|
+
export declare const Autofocus: Story;
|
|
7
8
|
export declare const Summary: Story;
|
|
@@ -3,12 +3,14 @@
|
|
|
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.Summary = exports.Docs = exports.Autofocus = void 0;
|
|
7
7
|
var _Size = require("../../../enums/Size.enum");
|
|
8
8
|
var _enums = require("../../../enums");
|
|
9
9
|
var _AntPasswordInput = _interopRequireDefault(require("../AntPasswordInput.vue"));
|
|
10
10
|
var _AntFormGroup = _interopRequireDefault(require("../../forms/AntFormGroup.vue"));
|
|
11
11
|
var _AntFormGroupLabel = _interopRequireDefault(require("../../forms/AntFormGroupLabel.vue"));
|
|
12
|
+
var _AntButton = _interopRequireDefault(require("../../buttons/AntButton.vue"));
|
|
13
|
+
var _vue = require("vue");
|
|
12
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
15
|
const meta = {
|
|
14
16
|
title: "Inputs/Password Input",
|
|
@@ -76,6 +78,39 @@ const Docs = exports.Docs = {
|
|
|
76
78
|
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
77
79
|
}
|
|
78
80
|
};
|
|
81
|
+
const Autofocus = exports.Autofocus = {
|
|
82
|
+
render: args => ({
|
|
83
|
+
components: {
|
|
84
|
+
AntPasswordInput: _AntPasswordInput.default,
|
|
85
|
+
AntFormGroup: _AntFormGroup.default,
|
|
86
|
+
AntButton: _AntButton.default
|
|
87
|
+
},
|
|
88
|
+
setup: () => {
|
|
89
|
+
const inputRef = (0, _vue.ref)(null);
|
|
90
|
+
return {
|
|
91
|
+
inputRef,
|
|
92
|
+
clickAutofocus: () => {
|
|
93
|
+
inputRef.value?.focus();
|
|
94
|
+
},
|
|
95
|
+
args
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
template: `
|
|
99
|
+
<AntFormGroup>
|
|
100
|
+
<AntButton @click="clickAutofocus">Focus element</AntButton>
|
|
101
|
+
|
|
102
|
+
<AntPasswordInput
|
|
103
|
+
v-model="args.modelValue"
|
|
104
|
+
v-bind="args"
|
|
105
|
+
v-model:input-ref="inputRef"
|
|
106
|
+
/>
|
|
107
|
+
</AntFormGroup>
|
|
108
|
+
`
|
|
109
|
+
}),
|
|
110
|
+
args: {
|
|
111
|
+
...Docs.args
|
|
112
|
+
}
|
|
113
|
+
};
|
|
79
114
|
const Summary = exports.Summary = {
|
|
80
115
|
parameters: {
|
|
81
116
|
chromatic: {
|
|
@@ -7,6 +7,10 @@ import {
|
|
|
7
7
|
import AntPasswordInput from "../AntPasswordInput.vue";
|
|
8
8
|
import AntFormGroup from "../../forms/AntFormGroup.vue";
|
|
9
9
|
import AntFormGroupLabel from "../../forms/AntFormGroupLabel.vue";
|
|
10
|
+
import AntButton from "../../buttons/AntButton.vue";
|
|
11
|
+
import {
|
|
12
|
+
ref
|
|
13
|
+
} from "vue";
|
|
10
14
|
const meta = {
|
|
11
15
|
title: "Inputs/Password Input",
|
|
12
16
|
component: AntPasswordInput,
|
|
@@ -73,6 +77,39 @@ export const Docs = {
|
|
|
73
77
|
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
74
78
|
}
|
|
75
79
|
};
|
|
80
|
+
export const Autofocus = {
|
|
81
|
+
render: (args) => ({
|
|
82
|
+
components: {
|
|
83
|
+
AntPasswordInput,
|
|
84
|
+
AntFormGroup,
|
|
85
|
+
AntButton
|
|
86
|
+
},
|
|
87
|
+
setup: () => {
|
|
88
|
+
const inputRef = ref(null);
|
|
89
|
+
return {
|
|
90
|
+
inputRef,
|
|
91
|
+
clickAutofocus: () => {
|
|
92
|
+
inputRef.value?.focus();
|
|
93
|
+
},
|
|
94
|
+
args
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
template: `
|
|
98
|
+
<AntFormGroup>
|
|
99
|
+
<AntButton @click="clickAutofocus">Focus element</AntButton>
|
|
100
|
+
|
|
101
|
+
<AntPasswordInput
|
|
102
|
+
v-model="args.modelValue"
|
|
103
|
+
v-bind="args"
|
|
104
|
+
v-model:input-ref="inputRef"
|
|
105
|
+
/>
|
|
106
|
+
</AntFormGroup>
|
|
107
|
+
`
|
|
108
|
+
}),
|
|
109
|
+
args: {
|
|
110
|
+
...Docs.args
|
|
111
|
+
}
|
|
112
|
+
};
|
|
76
113
|
export const Summary = {
|
|
77
114
|
parameters: {
|
|
78
115
|
chromatic: {
|
|
@@ -6,6 +6,7 @@ type Story = StoryObj<typeof AntSelect>;
|
|
|
6
6
|
export declare const Docs: Story;
|
|
7
7
|
export declare const WithSlots: Story;
|
|
8
8
|
export declare const manyOptions: Story;
|
|
9
|
+
export declare const longOptions: Story;
|
|
9
10
|
export declare const nullable: Story;
|
|
10
11
|
export declare const skeleton: Story;
|
|
11
12
|
export declare const disabled: Story;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.withPlaceholder = exports.summary = exports.skeleton = exports.nullable = exports.manyOptions = exports.grouped = exports.ellipsisText = exports.disabled = exports.default = exports.WithSlots = exports.Docs = void 0;
|
|
6
|
+
exports.withPlaceholder = exports.summary = exports.skeleton = exports.nullable = exports.manyOptions = exports.longOptions = exports.grouped = exports.ellipsisText = exports.disabled = exports.default = exports.WithSlots = exports.Docs = void 0;
|
|
7
7
|
var _Size = require("../../../enums/Size.enum");
|
|
8
8
|
var _AntSelect = _interopRequireDefault(require("../AntSelect.vue"));
|
|
9
9
|
var _AntIcon = _interopRequireDefault(require("../../AntIcon.vue"));
|
|
@@ -11,6 +11,8 @@ var _AntSelectMenu = _interopRequireDefault(require("../Elements/AntSelectMenu.v
|
|
|
11
11
|
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
12
12
|
var _vue = require("vue");
|
|
13
13
|
var _enums = require("../../../enums");
|
|
14
|
+
var _AntFormGroup = _interopRequireDefault(require("../../forms/AntFormGroup.vue"));
|
|
15
|
+
var _AntFormGroupLabel = _interopRequireDefault(require("../../forms/AntFormGroupLabel.vue"));
|
|
14
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
17
|
const meta = {
|
|
16
18
|
title: "Inputs/Select",
|
|
@@ -81,6 +83,10 @@ const manySelectOptions = [...Array(24).keys()].map(key => ({
|
|
|
81
83
|
label: `Option ${Number(key) + 1}`,
|
|
82
84
|
value: Number(key) + 1
|
|
83
85
|
}));
|
|
86
|
+
const longSelectOptions = [...Array(4).keys()].map(key => ({
|
|
87
|
+
label: `Very Long Select Option Possibly Larger Than Container ${Number(key) + 1}`,
|
|
88
|
+
value: Number(key) + 1
|
|
89
|
+
}));
|
|
84
90
|
const Docs = exports.Docs = {
|
|
85
91
|
render: args => ({
|
|
86
92
|
components: {
|
|
@@ -193,6 +199,25 @@ const manyOptions = exports.manyOptions = {
|
|
|
193
199
|
options: manySelectOptions
|
|
194
200
|
}
|
|
195
201
|
};
|
|
202
|
+
const longOptions = exports.longOptions = {
|
|
203
|
+
render: (args, ctx) => ({
|
|
204
|
+
// @ts-ignore
|
|
205
|
+
components: Docs.render(args, ctx).components,
|
|
206
|
+
// @ts-ignore
|
|
207
|
+
setup: Docs.render(args, ctx).setup,
|
|
208
|
+
template: `
|
|
209
|
+
<div class="flex justify-center overflow-y-auto h-[100vh] p-2.5 dashed">
|
|
210
|
+
<div class="flex flex-col gap-4 justify-center h-[250vh] max-w-[150px]">
|
|
211
|
+
<AntSelect v-bind="args" v-model="modelValue"/>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
`
|
|
215
|
+
}),
|
|
216
|
+
args: {
|
|
217
|
+
...Docs.args,
|
|
218
|
+
options: longSelectOptions
|
|
219
|
+
}
|
|
220
|
+
};
|
|
196
221
|
const nullable = exports.nullable = {
|
|
197
222
|
render: Docs.render,
|
|
198
223
|
args: {
|
|
@@ -312,9 +337,18 @@ const summary = exports.summary = {
|
|
|
312
337
|
},
|
|
313
338
|
render: (args, ctx) => ({
|
|
314
339
|
// @ts-ignore
|
|
315
|
-
components:
|
|
340
|
+
components: {
|
|
341
|
+
AntSelect: _AntSelect.default,
|
|
342
|
+
AntFormGroup: _AntFormGroup.default,
|
|
343
|
+
AntFormGroupLabel: _AntFormGroupLabel.default
|
|
344
|
+
},
|
|
316
345
|
// @ts-ignore
|
|
317
|
-
setup
|
|
346
|
+
setup() {
|
|
347
|
+
return {
|
|
348
|
+
...Docs.render(args, ctx).setup(),
|
|
349
|
+
longSelectOptions
|
|
350
|
+
};
|
|
351
|
+
},
|
|
318
352
|
template: `
|
|
319
353
|
<div class="p-4 flex flex-col gap-2.5">
|
|
320
354
|
<div class="flex w-2/5 gap-2.5">
|
|
@@ -385,6 +419,16 @@ const summary = exports.summary = {
|
|
|
385
419
|
<AntSelect v-bind="args" v-model="modelValue" size="sm" nullable state="warning"/>
|
|
386
420
|
<AntSelect v-bind="args" v-model="modelValue" size="sm" nullable state="danger"/>
|
|
387
421
|
</div>
|
|
422
|
+
<AntFormGroup>
|
|
423
|
+
<AntFormGroupLabel>Long Select Options</AntFormGroupLabel>
|
|
424
|
+
<div class="grid grid-cols-5 gap-2.5">
|
|
425
|
+
<AntSelect v-bind="args" v-model="modelValue" :options="longSelectOptions"/>
|
|
426
|
+
<AntSelect v-bind="args" v-model="modelValue" :options="longSelectOptions"/>
|
|
427
|
+
<AntSelect v-bind="args" v-model="modelValue" :options="longSelectOptions"/>
|
|
428
|
+
<AntSelect v-bind="args" v-model="modelValue" :options="longSelectOptions"/>
|
|
429
|
+
<AntSelect v-bind="args" v-model="modelValue" :options="longSelectOptions"/>
|
|
430
|
+
</div>
|
|
431
|
+
</AntFormGroup>
|
|
388
432
|
</div>
|
|
389
433
|
`
|
|
390
434
|
}),
|