@antify/ui-module 1.1.5 → 1.2.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.
Files changed (44) hide show
  1. package/dist/module.d.mts +2 -0
  2. package/dist/module.d.ts +2 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +3 -0
  5. package/dist/runtime/components/AntAccordionItem.vue +1 -1
  6. package/dist/runtime/components/AntTag.vue +3 -3
  7. package/dist/runtime/components/AntToast.vue +1 -0
  8. package/dist/runtime/components/{Main.stories.mdx → Main.mdx} +3 -2
  9. package/dist/runtime/components/Main.stories.d.ts +7 -0
  10. package/dist/runtime/components/Main.stories.mjs +8 -0
  11. package/dist/runtime/components/__stories/AntAccordion.stories.mjs +13 -10
  12. package/dist/runtime/components/__stories/AntKeycap.stories.d.ts +1 -1
  13. package/dist/runtime/components/__stories/AntKeycap.stories.mjs +15 -12
  14. package/dist/runtime/components/__types/AntIcon.types.d.ts +1 -0
  15. package/dist/runtime/components/__types/AntIcon.types.mjs +1 -0
  16. package/dist/runtime/components/buttons/__stories/AntButton.stories.mjs +3 -0
  17. package/dist/runtime/components/form/AntCheckboxWidget/__stories/AntCheckbox.stories.mjs +3 -0
  18. package/dist/runtime/components/form/AntSelect.vue +4 -51
  19. package/dist/runtime/components/form/AntTagInput.vue +306 -0
  20. package/dist/runtime/components/form/Elements/AntDropDown.vue +53 -23
  21. package/dist/runtime/components/form/Elements/AntField.vue +2 -2
  22. package/dist/runtime/components/form/Elements/__stories/AntBaseInput.stories.mjs +3 -0
  23. package/dist/runtime/components/form/Elements/__types/AntBaseInput.type.d.ts +1 -0
  24. package/dist/runtime/components/form/Elements/__types/AntBaseInput.type.mjs +1 -0
  25. package/dist/runtime/components/form/__stories/AntSelect.stories.mjs +3 -0
  26. package/dist/runtime/components/form/__stories/AntSwitch.stories.mjs +3 -0
  27. package/dist/runtime/components/form/__stories/AntSwitcher.stories.mjs +3 -0
  28. package/dist/runtime/components/form/__stories/AntTagInput.stories.d.ts +9 -0
  29. package/dist/runtime/components/form/__stories/AntTagInput.stories.mjs +106 -0
  30. package/dist/runtime/components/form/__stories/AntTextarea.stories.mjs +3 -0
  31. package/dist/runtime/components/form/index.d.ts +2 -1
  32. package/dist/runtime/components/form/index.mjs +2 -0
  33. package/dist/runtime/tailwind.config.d.ts +1 -0
  34. package/dist/runtime/tailwind.config.mjs +1 -0
  35. package/dist/runtime/types/AntTag.type.d.ts +1 -2
  36. package/dist/runtime/types/AntTag.type.mjs +1 -2
  37. package/package.json +20 -21
  38. package/src/runtime/components/AntAccordionItem.vue +2 -2
  39. package/src/runtime/components/AntTag.vue +3 -3
  40. package/src/runtime/components/AntToast.vue +1 -0
  41. package/src/runtime/components/form/AntSelect.vue +4 -51
  42. package/src/runtime/components/form/AntTagInput.vue +306 -0
  43. package/src/runtime/components/form/Elements/AntDropDown.vue +53 -23
  44. package/src/runtime/components/form/Elements/AntField.vue +2 -2
@@ -7,30 +7,34 @@
7
7
  * TODO:: if the dropdown is open and the user types something, the element with a matching value should be focused.
8
8
  */
9
9
 
10
- import { computed, nextTick, ref, watch } from 'vue';
10
+ import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
11
11
  import { InputColorType, Size } from '../../../enums';
12
12
  import type { SelectOption } from '../__types';
13
13
  import { useVModel } from '@vueuse/core';
14
14
  import type { Validator } from '@antify/validate';
15
15
 
16
- const emit = defineEmits(['update:open', 'update:modelValue']);
16
+ const emit = defineEmits([ 'update:open', 'update:modelValue', 'update:focused', 'selectElement' ]);
17
17
  const props = withDefaults(defineProps<{
18
- modelValue: string | number | null;
18
+ modelValue: string | string[] | number | number[] | null;
19
+ focused: string | number | null;
19
20
  open: boolean;
20
21
  options: SelectOption[];
21
22
  colorType?: InputColorType;
22
23
  validator?: Validator;
23
24
  size?: Size;
24
- inputRef?: HTMLElement | null
25
+ inputRef?: HTMLElement | null;
26
+ closeOnEnter?: boolean;
27
+ autoSelectFirstOnOpen?: boolean;
25
28
  }>(), {
26
29
  colorType: InputColorType.base,
30
+ focusOnOpen: true,
31
+ closeOnEnter: false,
32
+ autoSelectFirstOnOpen: true
27
33
  });
28
34
 
29
35
  const _modelValue = useVModel(props, 'modelValue', emit);
30
36
  const isOpen = useVModel(props, 'open', emit);
31
-
32
- const focusedDropDownItem = ref<string | number | null>(null);
33
- const dropDownRef = ref<HTMLElement | null>(null);
37
+ const focusedDropDownItem = useVModel(props, 'focused', emit);
34
38
 
35
39
  const dropdownClasses = computed(() => {
36
40
  const variants: Record<InputColorType, string> = {
@@ -68,28 +72,45 @@ const dropDownItemClasses = computed(() => {
68
72
  };
69
73
  });
70
74
 
71
- watch(isOpen, (val) => {
75
+ watch(isOpen, () => {
72
76
  nextTick(() => {
73
- if (val) {
74
- dropDownRef.value?.focus();
75
- focusedDropDownItem.value = _modelValue.value || props.options[0].value;
77
+ if (props.autoSelectFirstOnOpen) {
78
+ focusedDropDownItem.value =
79
+ typeof _modelValue.value === 'string' || typeof _modelValue.value === 'number' ? _modelValue.value :
80
+ Array.isArray(_modelValue.value) ? _modelValue.value[0] :
81
+ props.options[0].value;
82
+ } else {
83
+ focusedDropDownItem.value = null;
76
84
  }
77
85
  });
78
86
  });
79
87
 
88
+ onMounted(() => {
89
+ nextTick(() => {
90
+ props.inputRef?.addEventListener('keydown', onKeyDownDropDown);
91
+ });
92
+ });
93
+
94
+ onUnmounted(() => {
95
+ props.inputRef?.removeEventListener('keydown', onKeyDownDropDown);
96
+ });
97
+
80
98
  function onKeyDownDropDown(e: KeyboardEvent) {
81
99
  if (e.key === 'Enter') {
82
- isOpen.value = false;
83
- _modelValue.value = focusedDropDownItem.value;
84
- props.inputRef?.focus();
100
+ if (props.closeOnEnter) {
101
+ isOpen.value = false;
102
+ }
103
+
104
+ emit('selectElement', focusedDropDownItem.value);
85
105
  }
86
106
 
87
107
  if (e.key === 'Escape') {
88
108
  isOpen.value = false;
89
- props.inputRef?.focus();
90
109
  }
91
110
 
92
111
  if (e.key === 'ArrowDown' || e.key === 'ArrowRight') {
112
+ isOpen.value = true;
113
+
93
114
  const index = props.options.findIndex(option => option.value === focusedDropDownItem.value);
94
115
  const option = props.options[index + 1];
95
116
 
@@ -101,6 +122,8 @@ function onKeyDownDropDown(e: KeyboardEvent) {
101
122
  }
102
123
 
103
124
  if (e.key === 'ArrowUp' || e.key === 'ArrowLeft') {
125
+ isOpen.value = true;
126
+
104
127
  const index = props.options.findIndex(option => option.value === focusedDropDownItem.value);
105
128
  const option = props.options[index - 1];
106
129
 
@@ -123,7 +146,7 @@ function getActiveDropDownItemClasses(option: SelectOption) {
123
146
  [InputColorType.danger]: 'bg-danger-100/25',
124
147
  };
125
148
 
126
- return option.value === focusedDropDownItem.value ? {[variants[props.colorType]]: true} : {};
149
+ return option.value === focusedDropDownItem.value ? { [variants[props.colorType]]: true } : {};
127
150
  }
128
151
 
129
152
  function onClickDropDownItem(e: MouseEvent, value: string | number | null) {
@@ -131,17 +154,19 @@ function onClickDropDownItem(e: MouseEvent, value: string | number | null) {
131
154
  props.inputRef?.focus();
132
155
 
133
156
  isOpen.value = false;
157
+ emit('selectElement', value);
134
158
  _modelValue.value = value;
135
159
  }
160
+
161
+ watch(_modelValue, (val) => {
162
+ focusedDropDownItem.value = Array.isArray(val) ? val[0] : val;
163
+ });
136
164
  </script>
137
165
 
138
166
  <template>
139
167
  <div
140
168
  v-if="isOpen"
141
169
  :class="dropdownClasses"
142
- @keydown="onKeyDownDropDown"
143
- ref="dropDownRef"
144
- tabindex="0"
145
170
  >
146
171
  <div
147
172
  v-for="(option, index) in options"
@@ -152,9 +177,14 @@ function onClickDropDownItem(e: MouseEvent, value: string | number | null) {
152
177
  >
153
178
  {{ option.label }}
154
179
  </div>
180
+
181
+ <div
182
+ v-if="options.length === 0"
183
+ :class="{...dropDownItemClasses}"
184
+ >
185
+ <slot name="empty">
186
+ No options available
187
+ </slot>
188
+ </div>
155
189
  </div>
156
190
  </template>
157
-
158
- <style scoped>
159
-
160
- </style>
@@ -7,7 +7,7 @@ import {handleEnumValidation} from '../../../handler';
7
7
  import AntInputLimiter from './AntInputLimiter.vue';
8
8
  import {InputColorType} from '../../../enums';
9
9
 
10
- const emits = defineEmits(['clickLabel', 'validate']);
10
+ defineEmits(['clickLabel', 'validate']);
11
11
  const props = withDefaults(defineProps<{
12
12
  label?: string;
13
13
  description?: string;
@@ -25,7 +25,7 @@ const props = withDefaults(defineProps<{
25
25
  skeleton: false,
26
26
  size: Size.md,
27
27
  showMessageOnError: true,
28
- errors: [],
28
+ errors: () => [],
29
29
  expanded: true
30
30
  });
31
31
 
@@ -109,6 +109,9 @@ export const IconLeft = {
109
109
  }
110
110
  };
111
111
  export const Summary = {
112
+ parameters: {
113
+ chromatic: { disableSnapshot: false }
114
+ },
112
115
  render: (args) => ({
113
116
  components: { AntBaseInput, AntButton },
114
117
  setup: () => {
@@ -1,6 +1,7 @@
1
1
  export declare enum BaseInputType {
2
2
  date = "date",
3
3
  datetime = "datetime",
4
+ datetimeLocal = "datetime-local",
4
5
  email = "email",
5
6
  hidden = "hidden",
6
7
  month = "month",
@@ -1,6 +1,7 @@
1
1
  export var BaseInputType = /* @__PURE__ */ ((BaseInputType2) => {
2
2
  BaseInputType2["date"] = "date";
3
3
  BaseInputType2["datetime"] = "datetime";
4
+ BaseInputType2["datetimeLocal"] = "datetime-local";
4
5
  BaseInputType2["email"] = "email";
5
6
  BaseInputType2["hidden"] = "hidden";
6
7
  BaseInputType2["month"] = "month";
@@ -144,6 +144,9 @@ export const ellipsisText = {
144
144
  }
145
145
  };
146
146
  export const summary = {
147
+ parameters: {
148
+ chromatic: { disableSnapshot: false }
149
+ },
147
150
  render: (args) => ({
148
151
  components: { AntSelect },
149
152
  setup() {
@@ -46,6 +46,9 @@ export const withValidator = {
46
46
  }
47
47
  };
48
48
  export const Summary = {
49
+ parameters: {
50
+ chromatic: { disableSnapshot: false }
51
+ },
49
52
  render: (args) => ({
50
53
  components: { AntSwitch },
51
54
  setup() {
@@ -85,6 +85,9 @@ export const withValidator = {
85
85
  }
86
86
  };
87
87
  export const Summary = {
88
+ parameters: {
89
+ chromatic: { disableSnapshot: false }
90
+ },
88
91
  render: (args) => ({
89
92
  components: { AntSwitcher },
90
93
  setup() {
@@ -0,0 +1,9 @@
1
+ import { AntTagInput } from '../index';
2
+ import type { Meta, StoryObj } from '@storybook/vue3';
3
+ declare const meta: Meta<typeof AntTagInput>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof AntTagInput>;
6
+ export declare const Docs: Story;
7
+ export declare const AllowCreate: Story;
8
+ export declare const Disabled: Story;
9
+ export declare const Skeleton: Story;
@@ -0,0 +1,106 @@
1
+ import { AntTagInput } from "../index.mjs";
2
+ import { ref } from "vue";
3
+ import { InputColorType, Size } from "../../../enums/index.mjs";
4
+ const meta = {
5
+ title: "Components/Forms/Tag input",
6
+ component: AntTagInput,
7
+ argTypes: {
8
+ modelValue: {
9
+ control: "text",
10
+ table: { type: { summary: "string|null" } }
11
+ },
12
+ colorType: {
13
+ control: { type: "select" },
14
+ options: Object.values(InputColorType)
15
+ },
16
+ size: {
17
+ control: { type: "radio" },
18
+ options: Object.values(Size),
19
+ table: { defaultValue: { summary: Size.md } }
20
+ },
21
+ placeholder: {
22
+ table: { defaultValue: { summary: "this.label" } }
23
+ },
24
+ createCallback: {
25
+ control: "none",
26
+ description: "If allowCreate is true the createCallback needs to be specified. It will be called when the user creates a new tag. It should return a promise that resolves to a SelectOption.",
27
+ table: {
28
+ type: {
29
+ summary: "(item: string) => Promise<SelectOption>",
30
+ detail: `
31
+ Params:
32
+ item: string - the label of the new tag
33
+
34
+ Returns:
35
+ Promise<SelectOption> - the new tag as a SelectOption
36
+ `
37
+ }
38
+ }
39
+ }
40
+ }
41
+ };
42
+ export default meta;
43
+ const options = [
44
+ {
45
+ label: "Tag",
46
+ value: "1"
47
+ },
48
+ {
49
+ label: "Cat",
50
+ value: "2"
51
+ },
52
+ {
53
+ label: "Dog",
54
+ value: "3"
55
+ },
56
+ {
57
+ label: "Chicken",
58
+ value: "4"
59
+ }
60
+ ];
61
+ export const Docs = {
62
+ render: (args) => ({
63
+ components: { AntTagInput },
64
+ setup() {
65
+ const value = ref([]);
66
+ return {
67
+ args,
68
+ value
69
+ };
70
+ },
71
+ template: `
72
+ <div style="width: 360px">
73
+ <AntTagInput v-model="value" v-bind="args"/>
74
+ </div>
75
+ `
76
+ }),
77
+ args: {
78
+ options
79
+ }
80
+ };
81
+ export const AllowCreate = {
82
+ render: Docs.render,
83
+ args: {
84
+ options,
85
+ allowCreate: true,
86
+ createCallback(item) {
87
+ return new Promise((resolve) => {
88
+ resolve({ label: item, value: `${Math.random()}-${item}` });
89
+ });
90
+ }
91
+ }
92
+ };
93
+ export const Disabled = {
94
+ render: Docs.render,
95
+ args: {
96
+ options,
97
+ disabled: true
98
+ }
99
+ };
100
+ export const Skeleton = {
101
+ render: Docs.render,
102
+ args: {
103
+ options,
104
+ skeleton: true
105
+ }
106
+ };
@@ -86,6 +86,9 @@ export const limited = {
86
86
  }
87
87
  };
88
88
  export const summary = {
89
+ parameters: {
90
+ chromatic: { disableSnapshot: false }
91
+ },
89
92
  render: (args, ctx) => ({
90
93
  // @ts-ignore
91
94
  components: Docs.render(args, ctx).components,
@@ -5,7 +5,8 @@ import AntSwitcher from './AntSwitcher.vue';
5
5
  import AntSearch from './AntSearch.vue';
6
6
  import AntSelect from './AntSelect.vue';
7
7
  import AntSwitch from './AntSwitch.vue';
8
+ import AntTagInput from './AntTagInput.vue';
8
9
  import AntTextarea from './AntTextarea.vue';
9
10
  import AntTextInput from './AntTextInput.vue';
10
11
  import AntUnitInput from './AntUnitInput.vue';
11
- export { AntButton, AntNumberInput, AntRangeSlider, AntSwitcher, AntSearch, AntSelect, AntSwitch, AntTextarea, AntTextInput, AntUnitInput, };
12
+ export { AntButton, AntNumberInput, AntRangeSlider, AntSwitcher, AntSearch, AntSelect, AntSwitch, AntTagInput, AntTextarea, AntTextInput, AntUnitInput, };
@@ -5,6 +5,7 @@ import AntSwitcher from "./AntSwitcher.vue";
5
5
  import AntSearch from "./AntSearch.vue";
6
6
  import AntSelect from "./AntSelect.vue";
7
7
  import AntSwitch from "./AntSwitch.vue";
8
+ import AntTagInput from "./AntTagInput.vue";
8
9
  import AntTextarea from "./AntTextarea.vue";
9
10
  import AntTextInput from "./AntTextInput.vue";
10
11
  import AntUnitInput from "./AntUnitInput.vue";
@@ -16,6 +17,7 @@ export {
16
17
  AntSearch,
17
18
  AntSelect,
18
19
  AntSwitch,
20
+ AntTagInput,
19
21
  AntTextarea,
20
22
  AntTextInput,
21
23
  AntUnitInput
@@ -82,6 +82,7 @@ declare const _default: {
82
82
  'danger-800-font': any;
83
83
  'danger-900-font': any;
84
84
  'danger-950-font': any;
85
+ transparent: any;
85
86
  white: any;
86
87
  black: any;
87
88
  'neutral-50': any;
@@ -1,5 +1,6 @@
1
1
  import defaultColors from "tailwindcss/colors.js";
2
2
  const colors = {
3
+ "transparent": defaultColors.transparent,
3
4
  "white": defaultColors.white,
4
5
  "black": defaultColors.black,
5
6
  "neutral-50": defaultColors.slate["50"],
@@ -1,8 +1,7 @@
1
1
  export declare enum TagColorType {
2
2
  danger = "danger",
3
3
  info = "info",
4
- neutral300 = "neutral-300",
5
- neutral50 = "neutral-50",
4
+ base = "base",
6
5
  success = "success",
7
6
  warning = "warning"
8
7
  }
@@ -1,8 +1,7 @@
1
1
  export var TagColorType = /* @__PURE__ */ ((TagColorType2) => {
2
2
  TagColorType2["danger"] = "danger";
3
3
  TagColorType2["info"] = "info";
4
- TagColorType2["neutral300"] = "neutral-300";
5
- TagColorType2["neutral50"] = "neutral-50";
4
+ TagColorType2["base"] = "base";
6
5
  TagColorType2["success"] = "success";
7
6
  TagColorType2["warning"] = "warning";
8
7
  return TagColorType2;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antify/ui-module",
3
3
  "private": false,
4
- "version": "1.1.5",
4
+ "version": "1.2.0",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "exports": {
@@ -41,31 +41,29 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@faker-js/faker": "^8.3.1",
44
- "@nuxt/eslint-config": "^0.2.0",
45
- "@nuxt/module-builder": "^0.5.5",
46
- "@storybook/addon-docs": "^7.6.10",
47
- "@storybook/addon-essentials": "^7.6.10",
48
- "@storybook/addon-interactions": "^7.6.10",
49
- "@storybook/addon-links": "^7.6.10",
50
- "@storybook/blocks": "^7.6.10",
51
- "@storybook/test": "^7.6.10",
52
- "@storybook/vue3": "^7.6.10",
53
- "@storybook/vue3-vite": "^7.6.10",
54
- "@typescript-eslint/eslint-plugin": "^6.19.1",
55
- "@typescript-eslint/parser": "^6.19.1",
44
+ "@nuxt/eslint-config": "latest",
45
+ "@nuxt/module-builder": "latest",
46
+ "@storybook/addon-docs": "^8.0.0-beta.5",
47
+ "@storybook/addon-essentials": "^8.0.0-beta.5",
48
+ "@storybook/addon-interactions": "^8.0.0-beta.5",
49
+ "@storybook/addon-links": "^8.0.0-beta.5",
50
+ "@storybook/addon-mdx-gfm": "^8.0.0-beta.5",
51
+ "@storybook/blocks": "^8.0.0-beta.5",
52
+ "@storybook/test": "^8.0.0-beta.5",
53
+ "@storybook/vue3": "^8.0.0-beta.5",
54
+ "@storybook/vue3-vite": "^8.0.0-beta.5",
55
+ "@vitejs/plugin-vue": "^5.0.4",
56
56
  "autoprefixer": "^10.4.16",
57
- "eslint": "^8.56.0",
58
- "eslint-config-prettier": "^9.1.0",
59
- "eslint-plugin-storybook": "^0.6.15",
60
- "eslint-plugin-vue": "^9.20.1",
57
+ "chromatic": "^11.0.0",
58
+ "eslint": "latest",
59
+ "eslint-plugin-storybook": "latest",
61
60
  "nuxt": "^3.9.3",
62
61
  "ofetch": "^1.3.3",
63
- "react": "^18.2.0",
64
- "react-dom": "^18.2.0",
65
62
  "standard-version": "latest",
66
- "storybook": "7.5.3",
63
+ "storybook": "^8.0.0-beta.5",
67
64
  "typescript": "^5.3.3",
68
65
  "unbuild": "^2.0.0",
66
+ "vite": "^5.1.4",
69
67
  "vue-cli-plugin-tailwind": "3.0.0"
70
68
  },
71
69
  "scripts": {
@@ -76,6 +74,7 @@
76
74
  "storybook": "storybook dev -p 6006 --no-open",
77
75
  "build-storybook": "storybook build",
78
76
  "release": "standard-version && git push --follow-tags && pnpm publish --access public",
79
- "release-minor": "standard-version -- --release-as minor && git push --follow-tags && pnpm publish"
77
+ "release-minor": "standard-version -- --release-as minor && git push --follow-tags && pnpm publish",
78
+ "chromatic": "npx chromatic --project-token=chpt_2abc12269958fdc"
80
79
  }
81
80
  }
@@ -93,12 +93,12 @@ function onClick() {
93
93
  animation: slide 1s reverse;
94
94
  }
95
95
 
96
- @keyframes slide {
96
+ /*@keyframes slide {
97
97
  0% {
98
98
  //transform: translateY(-100%); max-height: 0; opacity: 0;
99
99
  }
100
100
  100% {
101
101
  //transform: translateY(0%); max-height: 100%; opacity: 1;
102
102
  }
103
- }
103
+ }*/
104
104
  </style>
@@ -6,6 +6,7 @@ import {handleEnumValidation} from '../handler';
6
6
  import {type IconDefinition} from '@fortawesome/free-solid-svg-icons';
7
7
  import {faCircleXmark} from '@fortawesome/free-solid-svg-icons';
8
8
 
9
+ defineEmits(['close']);
9
10
  const props = withDefaults(defineProps<{
10
11
  colorType?: TagColorType,
11
12
  size?: Size;
@@ -13,7 +14,7 @@ const props = withDefaults(defineProps<{
13
14
  dismiss?: boolean
14
15
  }>(), {
15
16
  size: Size.md,
16
- colorType: TagColorType.neutral300,
17
+ colorType: TagColorType.base,
17
18
  dismiss: false
18
19
  });
19
20
 
@@ -21,8 +22,7 @@ const classes = computed(() => {
21
22
  const variants: Record<TagColorType, string> = {
22
23
  [TagColorType.danger]: 'bg-danger-500 text-danger-500-font',
23
24
  [TagColorType.info]: 'bg-info-500 text-info-500-font',
24
- [TagColorType.neutral300]: 'bg-neutral-300 text-neutral-300-font',
25
- [TagColorType.neutral50]: 'bg-neutral-50 text-neutral-50-font',
25
+ [TagColorType.base]: 'bg-neutral-300 text-neutral-300-font',
26
26
  [TagColorType.success]: 'bg-success-500 text-success-500-font',
27
27
  [TagColorType.warning]: 'bg-warning-500 text-warning-500-font',
28
28
  };
@@ -68,6 +68,7 @@ onMounted(() => {
68
68
  <div
69
69
  :class="classes"
70
70
  data-e2e="toast"
71
+ :data-e2e-color-type="props.colorType"
71
72
  >
72
73
  <div class="inline-flex items-center justify-between w-content gap-2.5">
73
74
  <div class="inline-flex items-center gap-2.5">
@@ -14,7 +14,7 @@
14
14
  */
15
15
  import AntField from './Elements/AntField.vue';
16
16
  import {type SelectOption} from './__types/AntSelect.type';
17
- import {computed, onMounted, ref, watch, nextTick} from 'vue';
17
+ import {computed, onMounted, ref} from 'vue';
18
18
  import {Size} from '../../enums/Size.enum';
19
19
  import {FieldValidator} from '@antify/validate';
20
20
  import {handleEnumValidation} from '../../handler';
@@ -164,13 +164,6 @@ onMounted(() => {
164
164
 
165
165
  focusedDropDownItem.value = _modelValue.value;
166
166
  });
167
- watch(isOpen, (val) => {
168
- nextTick(() => {
169
- if (val) {
170
- dropDownRef.value?.focus();
171
- }
172
- });
173
- });
174
167
 
175
168
  function onClickOutside() {
176
169
  if (!isOpen.value) {
@@ -181,47 +174,6 @@ function onClickOutside() {
181
174
  inputRef.value?.focus();
182
175
  }
183
176
 
184
- function onKeyDownInput(e: KeyboardEvent) {
185
- if (e.key === 'Enter') {
186
- isOpen.value = true;
187
- inputRef.value?.blur();
188
- }
189
-
190
- if (e.key === 'Escape') {
191
- isOpen.value = false;
192
- inputRef.value?.focus();
193
- }
194
-
195
- if (e.key === 'ArrowDown' || e.key === 'ArrowRight') {
196
- const index = props.options.findIndex(option => option.value === _modelValue.value);
197
- const option = props.options[index + 1];
198
-
199
- if (index === -1) {
200
- _modelValue.value = props.options[0].value;
201
- } else if (option !== undefined) {
202
- _modelValue.value = option.value;
203
- }
204
- }
205
-
206
- if (e.key === 'ArrowUp' || e.key === 'ArrowLeft') {
207
- const index = props.options.findIndex(option => option.value === _modelValue.value);
208
- const option = props.options[index - 1];
209
-
210
- if (option !== undefined) {
211
- _modelValue.value = option.value;
212
- }
213
- }
214
- }
215
-
216
- function onFocusInInput() {
217
- inputRef.value?.addEventListener('keydown', onKeyDownInput);
218
- }
219
-
220
- function onFocusOutInput(e: FocusEvent) {
221
- e.preventDefault();
222
- inputRef.value?.removeEventListener('keydown', onKeyDownInput);
223
- }
224
-
225
177
  function onClickSelectInput(e: MouseEvent) {
226
178
  e.preventDefault();
227
179
 
@@ -280,9 +232,8 @@ function onClickRemoveButton() {
280
232
  ref="inputRef"
281
233
  :tabindex="disabled ? undefined : 0"
282
234
  @mousedown="onClickSelectInput"
283
- @focusin="onFocusInInput"
284
- @focusout="onFocusOutInput"
285
235
  v-bind="$attrs"
236
+ @click="inputRef?.focus()"
286
237
  >
287
238
  <div
288
239
  v-if="_modelValue === null && placeholder !== undefined"
@@ -329,6 +280,8 @@ function onClickRemoveButton() {
329
280
  :input-ref="inputRef"
330
281
  :size="size"
331
282
  :color-type="_colorType"
283
+ @select-element="(e) => _modelValue = e"
284
+ close-on-enter
332
285
  />
333
286
  </div>
334
287