@antify/ui 2.2.1 → 2.2.3

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 (147) hide show
  1. package/dist/components/AntAccordion.vue +25 -12
  2. package/dist/components/AntAccordionItem.vue +28 -13
  3. package/dist/components/AntAlert.vue +25 -15
  4. package/dist/components/AntCard.vue +26 -14
  5. package/dist/components/AntContent.vue +4 -4
  6. package/dist/components/AntDropdown.vue +41 -23
  7. package/dist/components/AntIcon.vue +18 -6
  8. package/dist/components/AntKeycap.vue +31 -16
  9. package/dist/components/AntListGroup.vue +13 -11
  10. package/dist/components/AntListGroupItem.vue +19 -9
  11. package/dist/components/AntModal.vue +26 -15
  12. package/dist/components/AntPagination.vue +28 -15
  13. package/dist/components/AntPopover.vue +74 -51
  14. package/dist/components/AntSkeleton.vue +8 -4
  15. package/dist/components/AntSpinner.vue +14 -6
  16. package/dist/components/AntTag.vue +25 -13
  17. package/dist/components/AntToast.vue +19 -11
  18. package/dist/components/AntToaster.vue +13 -5
  19. package/dist/components/AntTooltip.vue +78 -54
  20. package/dist/components/__stories/AntAccordion.stories.js +4 -4
  21. package/dist/components/__stories/AntAccordion.stories.mjs +50 -17
  22. package/dist/components/__stories/AntAlert.stories.mjs +18 -5
  23. package/dist/components/__stories/AntCard.stories.mjs +36 -10
  24. package/dist/components/__stories/AntContent.stories.mjs +14 -4
  25. package/dist/components/__stories/AntDropdown.stories.mjs +20 -4
  26. package/dist/components/__stories/AntIcon.stories.mjs +38 -12
  27. package/dist/components/__stories/AntKeycap.stories.mjs +35 -10
  28. package/dist/components/__stories/AntListGroup.stories.d.ts +1 -1
  29. package/dist/components/__stories/AntListGroup.stories.mjs +22 -4
  30. package/dist/components/__stories/AntListGroupItem.stories.mjs +27 -8
  31. package/dist/components/__stories/AntModal.stories.mjs +17 -4
  32. package/dist/components/__stories/AntPagination.stories.mjs +21 -6
  33. package/dist/components/__stories/AntPopover.stories.mjs +20 -4
  34. package/dist/components/__stories/AntSkeleton.stories.mjs +17 -5
  35. package/dist/components/__stories/AntSpinner.stories.mjs +33 -9
  36. package/dist/components/__stories/AntTag.stories.mjs +28 -8
  37. package/dist/components/__stories/AntToast.stories.mjs +19 -5
  38. package/dist/components/__stories/AntToaster.stories.d.ts +1 -1
  39. package/dist/components/__stories/AntToaster.stories.mjs +35 -9
  40. package/dist/components/__stories/AntTooltip.stories.js +1 -1
  41. package/dist/components/__stories/AntTooltip.stories.mjs +44 -13
  42. package/dist/components/buttons/AntActionButton.vue +38 -29
  43. package/dist/components/buttons/AntButton.vue +34 -13
  44. package/dist/components/buttons/AntCreateButton.vue +11 -4
  45. package/dist/components/buttons/AntDeleteButton.vue +11 -4
  46. package/dist/components/buttons/AntDuplicateButton.vue +11 -4
  47. package/dist/components/buttons/AntEditButton.vue +11 -4
  48. package/dist/components/buttons/AntSaveAndNewButton.vue +11 -4
  49. package/dist/components/buttons/AntSaveButton.vue +11 -4
  50. package/dist/components/buttons/__stories/AntActionButton.stories.mjs +35 -10
  51. package/dist/components/buttons/__stories/AntButton.stories.mjs +77 -23
  52. package/dist/components/buttons/__stories/AntCreateButton.stories.mjs +25 -7
  53. package/dist/components/buttons/__stories/AntDeleteButton.stories.mjs +25 -7
  54. package/dist/components/buttons/__stories/AntDuplicateButton.stories.mjs +25 -7
  55. package/dist/components/buttons/__stories/AntEditButton.stories.mjs +25 -7
  56. package/dist/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +25 -7
  57. package/dist/components/buttons/__stories/AntSaveButton.stories.mjs +25 -7
  58. package/dist/components/crud/AntCrud.vue +6 -6
  59. package/dist/components/crud/AntCrudDetail.vue +8 -5
  60. package/dist/components/crud/AntCrudDetailActions.vue +14 -8
  61. package/dist/components/crud/AntCrudDetailNav.vue +21 -13
  62. package/dist/components/crud/AntCrudTableFilter.vue +29 -17
  63. package/dist/components/crud/AntCrudTableNav.vue +36 -22
  64. package/dist/components/crud/__stories/AntCrud.stories.mjs +17 -5
  65. package/dist/components/crud/__stories/AntCrudDetail.stories.mjs +11 -3
  66. package/dist/components/crud/__stories/AntCrudDetailActions.stories.mjs +10 -2
  67. package/dist/components/crud/__stories/AntCrudDetailNav.stories.mjs +11 -3
  68. package/dist/components/crud/__stories/AntCrudTableFilter.stories.mjs +17 -5
  69. package/dist/components/crud/__stories/AntCrudTableNav.stories.mjs +23 -7
  70. package/dist/components/dialogs/AntDeleteDialog.vue +13 -5
  71. package/dist/components/dialogs/AntDialog.vue +23 -13
  72. package/dist/components/dialogs/__stories/AndDeleteDialog.stories.mjs +12 -3
  73. package/dist/components/dialogs/__stories/AntDialog.stories.mjs +28 -7
  74. package/dist/components/forms/AntField.vue +18 -7
  75. package/dist/components/forms/AntFormGroup.vue +9 -5
  76. package/dist/components/forms/AntFormGroupLabel.vue +1 -1
  77. package/dist/components/forms/__stories/AntField.stories.mjs +37 -9
  78. package/dist/components/forms/__stories/AntFormGroup.stories.mjs +20 -5
  79. package/dist/components/forms/__stories/AntFormGroupLabel.stories.mjs +11 -3
  80. package/dist/components/index.d.ts +1 -1
  81. package/dist/components/inputs/AntCheckbox.vue +60 -36
  82. package/dist/components/inputs/AntCheckboxGroup.vue +39 -15
  83. package/dist/components/inputs/AntDateInput.vue +35 -12
  84. package/dist/components/inputs/AntNumberInput.vue +33 -12
  85. package/dist/components/inputs/AntPasswordInput.vue +32 -11
  86. package/dist/components/inputs/AntRadio.vue +57 -34
  87. package/dist/components/inputs/AntRadioGroup.vue +60 -35
  88. package/dist/components/inputs/AntRangeSlider.vue +31 -12
  89. package/dist/components/inputs/AntSearch.vue +19 -7
  90. package/dist/components/inputs/AntSelect.vue +107 -83
  91. package/dist/components/inputs/AntSwitch.vue +35 -18
  92. package/dist/components/inputs/AntSwitcher.vue +30 -15
  93. package/dist/components/inputs/AntTagInput.vue +91 -61
  94. package/dist/components/inputs/AntTextInput.vue +31 -11
  95. package/dist/components/inputs/AntTextarea.vue +53 -25
  96. package/dist/components/inputs/AntUnitInput.vue +33 -12
  97. package/dist/components/inputs/Elements/AntBaseInput.vue +47 -18
  98. package/dist/components/inputs/Elements/AntInputDescription.vue +16 -8
  99. package/dist/components/inputs/Elements/AntInputLabel.vue +13 -5
  100. package/dist/components/inputs/Elements/AntInputLimiter.vue +13 -5
  101. package/dist/components/inputs/Elements/AntSelectMenu.vue +65 -41
  102. package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.mjs +104 -27
  103. package/dist/components/inputs/Elements/__stories/AntInputDescription.stories.mjs +33 -9
  104. package/dist/components/inputs/Elements/__stories/AntInputLabel.stories.mjs +34 -9
  105. package/dist/components/inputs/Elements/__stories/AntInputLimiter.stories.mjs +33 -9
  106. package/dist/components/inputs/Elements/index.d.ts +1 -1
  107. package/dist/components/inputs/__stories/AntCheckbox.stories.mjs +34 -9
  108. package/dist/components/inputs/__stories/AntCheckboxGroup.stories.mjs +45 -21
  109. package/dist/components/inputs/__stories/AntDateInput.stories.mjs +52 -14
  110. package/dist/components/inputs/__stories/AntNumberInput.stories.mjs +66 -17
  111. package/dist/components/inputs/__stories/AntPasswordInput.stories.mjs +51 -13
  112. package/dist/components/inputs/__stories/AntRadioGroup.stories.mjs +45 -12
  113. package/dist/components/inputs/__stories/AntRangeSlider.stories.mjs +16 -5
  114. package/dist/components/inputs/__stories/AntSearch.stories.mjs +41 -10
  115. package/dist/components/inputs/__stories/AntSelect.stories.mjs +59 -15
  116. package/dist/components/inputs/__stories/AntSwitch.stories.js +126 -102
  117. package/dist/components/inputs/__stories/AntSwitch.stories.mjs +162 -112
  118. package/dist/components/inputs/__stories/AntSwitcher.stories.mjs +38 -10
  119. package/dist/components/inputs/__stories/AntTagInput.stories.mjs +46 -12
  120. package/dist/components/inputs/__stories/AntTextInput.stories.mjs +59 -16
  121. package/dist/components/inputs/__stories/AntTextarea.stories.mjs +47 -13
  122. package/dist/components/inputs/__stories/AntUnitInput.stories.mjs +46 -12
  123. package/dist/components/layouts/AntNavLeftLayout.vue +12 -6
  124. package/dist/components/layouts/__stories/AntNavLeftLayout.stories.mjs +10 -2
  125. package/dist/components/navbar/AntNavbar.vue +7 -3
  126. package/dist/components/navbar/AntNavbarItem.vue +12 -6
  127. package/dist/components/navbar/__stories/AntNavbar.stories.mjs +59 -37
  128. package/dist/components/table/AntCollapsibleTableRowContent.vue +7 -5
  129. package/dist/components/table/AntTable.vue +210 -165
  130. package/dist/components/table/AntTableSkeleton.vue +126 -0
  131. package/dist/components/table/AntTableSortButton.vue +22 -13
  132. package/dist/components/table/AntTd.vue +21 -17
  133. package/dist/components/table/AntTh.vue +19 -12
  134. package/dist/components/table/__stories/AntTable.stories.js +1 -1
  135. package/dist/components/table/__stories/AntTable.stories.mjs +190 -62
  136. package/dist/components/tabs/AntTabItem.vue +20 -8
  137. package/dist/components/tabs/AntTabs.vue +35 -21
  138. package/dist/components/tabs/__stories/AntTabItem.stories.mjs +23 -7
  139. package/dist/components/tabs/__stories/AntTabs.stories.mjs +45 -13
  140. package/dist/components/transitions/AntTransitionCollapseHeight.vue +1 -1
  141. package/dist/composables/useToaster.mjs +25 -7
  142. package/dist/index.css +1 -0
  143. package/dist/utils.mjs +3 -1
  144. package/package.json +23 -16
  145. package/dist/tailwind.config.d.ts +0 -3
  146. package/dist/tailwind.config.js +0 -198
  147. package/dist/tailwind.config.mjs +0 -189
@@ -1,46 +1,63 @@
1
1
  <script lang="ts" setup>
2
- import {AntField} from './Elements';
3
- import {InputState, Size} from '../../enums';
2
+ import {
3
+ AntField,
4
+ } from './Elements';
5
+ import {
6
+ InputState, Size,
7
+ } from '../../enums';
4
8
  import AntSkeleton from '../AntSkeleton.vue';
5
- import {computed, onMounted, watch} from 'vue';
6
- import {type AntRadioTypes} from './__types/AntRadio.types';
7
- import {handleEnumValidation} from '../../handler';
8
-
9
- defineOptions({inheritAttrs: false});
10
-
11
- const emit = defineEmits(['update:modelValue', 'update:skeleton', 'validate', 'blur']);
12
- const props = withDefaults(
13
- defineProps<{
14
- modelValue: string | null;
15
- value: AntRadioTypes;
16
- description?: string;
17
- skeleton?: boolean;
18
- state?: InputState;
19
- size?: Size;
20
- readonly?: boolean;
21
- disabled?: boolean;
22
- messages?: string[];
23
- }>(), {
24
- state: InputState.base,
25
- size: Size.md,
26
- readonly: false,
27
- disabled: false,
28
- messages: () => []
29
- }
30
- );
9
+ import {
10
+ computed, onMounted, watch,
11
+ } from 'vue';
12
+ import {
13
+ type AntRadioTypes,
14
+ } from './__types/AntRadio.types';
15
+ import {
16
+ handleEnumValidation,
17
+ } from '../../handler';
18
+
19
+ defineOptions({
20
+ inheritAttrs: false,
21
+ });
22
+
23
+ const emit = defineEmits([
24
+ 'update:modelValue',
25
+ 'update:skeleton',
26
+ 'validate',
27
+ 'blur',
28
+ ]);
29
+ const props = withDefaults(defineProps<{
30
+ modelValue: string | null;
31
+ value: AntRadioTypes;
32
+ description?: string;
33
+ skeleton?: boolean;
34
+ state?: InputState;
35
+ size?: Size;
36
+ readonly?: boolean;
37
+ disabled?: boolean;
38
+ messages?: string[];
39
+ }>(), {
40
+ state: InputState.base,
41
+ size: Size.md,
42
+ readonly: false,
43
+ disabled: false,
44
+ messages: () => [],
45
+ });
31
46
  const _modelValue = computed({
32
47
  get(): string | null | AntRadioTypes {
33
48
  return props.modelValue;
34
49
  },
35
50
  set(val: string | null | AntRadioTypes) {
36
51
  emit('update:modelValue', val ? typeof val === 'string' ? val : val.value : null);
37
- }
52
+ },
38
53
  });
39
54
  const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
40
55
  const isActive = computed(() => _modelValue.value === props.value.value);
41
56
  const inputClasses = computed(() => {
42
- const classes: { [key: string]: boolean } = {
43
- 'relative inline-flex flex-shrink-0': true,
57
+ const classes: {
58
+ [key: string]: boolean;
59
+ } = {
60
+ 'relative inline-flex shrink-0': true,
44
61
  'focus:ring-offset-0 outline outline-offset-[-1px] outline-1 focus:outline-offset-[-1px] focus:outline-1 rounded-full': true,
45
62
  'flex items-center justify-center rounded-full appearance-none': true,
46
63
  'cursor-pointer': !hasInputState.value,
@@ -114,10 +131,16 @@ const innerRadioClass = computed(() => (
114
131
  * Validate default value if given after delayed data fetching.
115
132
  */
116
133
  watch(_modelValue, (val) => {
117
- if ([InputState.danger, InputState.warning, InputState.info].includes(props.state)) {
134
+ if ([
135
+ InputState.danger,
136
+ InputState.warning,
137
+ InputState.info,
138
+ ].includes(props.state)) {
118
139
  emit('validate', val);
119
140
  }
120
- }, {deep: true});
141
+ }, {
142
+ deep: true,
143
+ });
121
144
  watch(() => props.skeleton, (val) => {
122
145
  if (!val && props.modelValue !== null) {
123
146
  emit('validate', props.modelValue);
@@ -175,7 +198,7 @@ onMounted(() => {
175
198
  :aria-checked="isActive"
176
199
  :disabled="disabled || readonly"
177
200
  @blur="onBlur"
178
- />
201
+ >
179
202
 
180
203
  <AntSkeleton
181
204
  v-if="skeleton"
@@ -1,38 +1,53 @@
1
1
  <script lang="ts" setup>
2
2
  import AntRadio from './AntRadio.vue';
3
- import {useVModel} from '@vueuse/core';
4
- import {AntField} from './Elements';
5
- import {type AntRadioTypes} from './__types/AntRadio.types';
6
- import {InputState, Size} from '../../enums';
7
- import {computed, onMounted, ref, watch} from 'vue';
8
- import {Direction} from '../../enums/Direction.enum';
9
- import {handleEnumValidation} from '../../handler';
3
+ import {
4
+ useVModel,
5
+ } from '@vueuse/core';
6
+ import {
7
+ AntField,
8
+ } from './Elements';
9
+ import {
10
+ type AntRadioTypes,
11
+ } from './__types/AntRadio.types';
12
+ import {
13
+ InputState, Size,
14
+ } from '../../enums';
15
+ import {
16
+ computed, onMounted, ref, watch,
17
+ } from 'vue';
18
+ import {
19
+ Direction,
20
+ } from '../../enums/Direction.enum';
21
+ import {
22
+ handleEnumValidation,
23
+ } from '../../handler';
10
24
 
11
- defineOptions({inheritAttrs: false});
12
-
13
- const emit = defineEmits(['update:modelValue', 'update:skeleton', 'validate']);
14
- const props = withDefaults(
15
- defineProps<{
16
- modelValue: string | null;
17
- radioButtons: AntRadioTypes[];
18
- label?: string;
19
- description?: string;
20
- direction?: Direction;
21
- state?: InputState;
22
- size?: Size;
23
- skeleton?: boolean;
24
- disabled?: boolean;
25
- readonly?: boolean;
26
- messages?: string[];
27
- }>(), {
28
- direction: Direction.column,
29
- state: InputState.base,
30
- size: Size.md,
31
- skeleton: false,
32
- disabled: false,
33
- readonly: false,
34
- messages: () => []
35
- });
25
+ const emit = defineEmits([
26
+ 'update:modelValue',
27
+ 'update:skeleton',
28
+ 'validate',
29
+ ]);
30
+ const props = withDefaults(defineProps<{
31
+ modelValue: string | null;
32
+ radioButtons: AntRadioTypes[];
33
+ label?: string;
34
+ description?: string;
35
+ direction?: Direction;
36
+ state?: InputState;
37
+ size?: Size;
38
+ skeleton?: boolean;
39
+ disabled?: boolean;
40
+ readonly?: boolean;
41
+ messages?: string[];
42
+ }>(), {
43
+ direction: Direction.column,
44
+ state: InputState.base,
45
+ size: Size.md,
46
+ skeleton: false,
47
+ disabled: false,
48
+ readonly: false,
49
+ messages: () => [],
50
+ });
36
51
  const _modelValue = useVModel(props, 'modelValue', emit);
37
52
  const containerClasses = computed(() => ({
38
53
  'flex justify-start': true,
@@ -60,12 +75,22 @@ const fieldSize = computed(() => {
60
75
  });
61
76
 
62
77
  watch(_modelValue, (val) => {
63
- if ([InputState.danger, InputState.warning, InputState.info].includes(props.state)) {
78
+ if ([
79
+ InputState.danger,
80
+ InputState.warning,
81
+ InputState.info,
82
+ ].includes(props.state)) {
64
83
  emit('validate', val);
65
84
  }
66
- }, {deep: true});
85
+ }, {
86
+ deep: true,
87
+ });
67
88
  watch(_modelValue, (val) => {
68
- if ([InputState.danger, InputState.warning, InputState.info].includes(props.state)) {
89
+ if ([
90
+ InputState.danger,
91
+ InputState.warning,
92
+ InputState.info,
93
+ ].includes(props.state)) {
69
94
  emit('validate', val);
70
95
  }
71
96
  });
@@ -1,19 +1,34 @@
1
1
  <script setup lang="ts">
2
2
  import AntField from '../forms/AntField.vue';
3
- import {useVModel} from '@vueuse/core';
4
- import {computed, onMounted, watch} from 'vue';
5
- import {InputState, Size} from '../../enums';
6
- import {handleEnumValidation} from '../../handler';
3
+ import {
4
+ useVModel,
5
+ } from '@vueuse/core';
6
+ import {
7
+ computed, onMounted, watch,
8
+ } from 'vue';
9
+ import {
10
+ InputState, Size,
11
+ } from '../../enums';
12
+ import {
13
+ handleEnumValidation,
14
+ } from '../../handler';
7
15
 
8
- defineOptions({inheritAttrs: false});
16
+ defineOptions({
17
+ inheritAttrs: false,
18
+ });
9
19
 
10
- const emit = defineEmits(['update:modelValue', 'update:skeleton', 'validate', 'blur']);
20
+ const emit = defineEmits([
21
+ 'update:modelValue',
22
+ 'update:skeleton',
23
+ 'validate',
24
+ 'blur',
25
+ ]);
11
26
  const props = withDefaults(defineProps<{
12
27
  modelValue: number | number[] | null;
13
28
  label?: string;
14
29
  description?: string;
15
30
  state?: InputState;
16
- size?: Size,
31
+ size?: Size;
17
32
  disabled?: boolean;
18
33
  skeleton?: boolean;
19
34
  min?: number;
@@ -25,7 +40,7 @@ const props = withDefaults(defineProps<{
25
40
  disabled: false,
26
41
  skeleton: false,
27
42
  limiter: false,
28
- messages: () => []
43
+ messages: () => [],
29
44
  });
30
45
  const _modelValue = useVModel(props, 'modelValue', emit);
31
46
  const inputClasses = computed(() => {
@@ -38,10 +53,10 @@ const inputClasses = computed(() => {
38
53
  };
39
54
 
40
55
  return {
41
- 'ant-range-slider transition-colors relative border-none w-full h-2 bg-base-300 rounded-md outline-none': true,
56
+ 'ant-range-slider transition-colors relative border-none w-full h-2 bg-base-300 rounded-md outline-hidden': true,
42
57
  'disabled:opacity-50 disabled:cursor-not-allowed': props.disabled,
43
- 'invisible': props.skeleton,
44
- [variants[props.state]]: true
58
+ invisible: props.skeleton,
59
+ [variants[props.state]]: true,
45
60
  };
46
61
  });
47
62
 
@@ -54,7 +69,11 @@ watch(() => props.skeleton, (val) => {
54
69
  }
55
70
  });
56
71
  watch(_modelValue, (val) => {
57
- if ([InputState.danger, InputState.warning, InputState.info].includes(props.state)) {
72
+ if ([
73
+ InputState.danger,
74
+ InputState.warning,
75
+ InputState.info,
76
+ ].includes(props.state)) {
58
77
  emit('validate', val);
59
78
  }
60
79
  });
@@ -1,13 +1,25 @@
1
1
  <script lang="ts" setup>
2
- import {computed, onMounted, ref} from 'vue';
2
+ import {
3
+ computed, onMounted, ref,
4
+ } from 'vue';
3
5
  import AntBaseInput from './Elements/AntBaseInput.vue';
4
- import {Size} from '../../enums/Size.enum';
5
- import {handleEnumValidation} from '../../handler';
6
- import {faSearch} from '@fortawesome/free-solid-svg-icons';
7
- import {BaseInputType} from './Elements/__types';
6
+ import {
7
+ Size,
8
+ } from '../../enums/Size.enum';
9
+ import {
10
+ handleEnumValidation,
11
+ } from '../../handler';
12
+ import {
13
+ faSearch,
14
+ } from '@fortawesome/free-solid-svg-icons';
15
+ import {
16
+ BaseInputType,
17
+ } from './Elements/__types';
8
18
  import AntField from '../forms/AntField.vue';
9
19
 
10
- const emits = defineEmits(['update:modelValue']);
20
+ const emits = defineEmits([
21
+ 'update:modelValue',
22
+ ]);
11
23
  const props = withDefaults(defineProps<{
12
24
  modelValue: string | null;
13
25
  label?: string;
@@ -25,7 +37,7 @@ const props = withDefaults(defineProps<{
25
37
  readonly: false,
26
38
  size: Size.md,
27
39
  inputTimeout: 300,
28
- placeholder: 'Search'
40
+ placeholder: 'Search',
29
41
  });
30
42
 
31
43
  const timeout = ref<ReturnType<typeof setTimeout> | null>(null);
@@ -13,53 +13,75 @@
13
13
  * TODO:: if the dropdown is open and the user types something, the element with a matching value should be focused.
14
14
  */
15
15
  import AntField from '../forms/AntField.vue';
16
- import {type SelectOption} from './__types/AntSelect.types';
17
- import {computed, onMounted, ref, watch} from 'vue';
18
- import {Size} from '../../enums/Size.enum';
19
- import {handleEnumValidation} from '../../handler';
20
- import {Grouped} from '../../enums/Grouped.enum';
16
+ import {
17
+ type SelectOption,
18
+ } from './__types/AntSelect.types';
19
+ import {
20
+ computed, onMounted, ref, watch,
21
+ } from 'vue';
22
+ import {
23
+ Size,
24
+ } from '../../enums/Size.enum';
25
+ import {
26
+ handleEnumValidation,
27
+ } from '../../handler';
28
+ import {
29
+ Grouped,
30
+ } from '../../enums/Grouped.enum';
21
31
  import AntIcon from '../AntIcon.vue';
22
- import {faChevronDown, faChevronUp, faMultiply} from '@fortawesome/free-solid-svg-icons';
32
+ import {
33
+ faChevronDown, faChevronUp, faMultiply,
34
+ } from '@fortawesome/free-solid-svg-icons';
23
35
  import AntSkeleton from '../AntSkeleton.vue';
24
- import {vOnClickOutside} from '@vueuse/components';
36
+ import {
37
+ vOnClickOutside,
38
+ } from '@vueuse/components';
25
39
  import AntButton from '../buttons/AntButton.vue';
26
- import {State, InputState} from '../../enums';
27
- import {IconSize} from '../__types';
40
+ import {
41
+ State, InputState,
42
+ } from '../../enums';
43
+ import {
44
+ IconSize,
45
+ } from '../__types';
28
46
  import AntSelectMenu from './Elements/AntSelectMenu.vue';
29
47
 
30
- defineOptions({inheritAttrs: false});
48
+ defineOptions({
49
+ inheritAttrs: false,
50
+ });
31
51
 
32
- const props = withDefaults(
33
- defineProps<{
34
- modelValue: string | number | null;
35
- options: SelectOption[];
36
- label?: string;
37
- description?: string;
38
- placeholder?: string;
39
- size?: Size;
40
- state?: InputState;
41
- disabled?: boolean;
42
- readonly?: boolean;
43
- skeleton?: boolean;
44
- nullable?: boolean;
45
- grouped?: Grouped;
46
- name?: string;
47
- wrapperClass?: string | Record<string, boolean>;
48
- expanded?: boolean;
49
- messages?: string[]
50
- }>(), {
51
- state: InputState.base,
52
- grouped: Grouped.none,
53
- size: Size.md,
54
- disabled: false,
55
- readonly: false,
56
- skeleton: false,
57
- nullable: false,
58
- expanded: true,
59
- messages: () => []
60
- }
61
- );
62
- const emit = defineEmits(['update:modelValue', 'blur', 'validate']);
52
+ const props = withDefaults(defineProps<{
53
+ modelValue: string | number | null;
54
+ options: SelectOption[];
55
+ label?: string;
56
+ description?: string;
57
+ placeholder?: string;
58
+ size?: Size;
59
+ state?: InputState;
60
+ disabled?: boolean;
61
+ readonly?: boolean;
62
+ skeleton?: boolean;
63
+ nullable?: boolean;
64
+ grouped?: Grouped;
65
+ name?: string;
66
+ wrapperClass?: string | Record<string, boolean>;
67
+ expanded?: boolean;
68
+ messages?: string[];
69
+ }>(), {
70
+ state: InputState.base,
71
+ grouped: Grouped.none,
72
+ size: Size.md,
73
+ disabled: false,
74
+ readonly: false,
75
+ skeleton: false,
76
+ nullable: false,
77
+ expanded: true,
78
+ messages: () => [],
79
+ });
80
+ const emit = defineEmits([
81
+ 'update:modelValue',
82
+ 'blur',
83
+ 'validate',
84
+ ]);
63
85
  const isOpen = ref(false);
64
86
  const _modelValue = computed({
65
87
  get: () => props.modelValue,
@@ -83,7 +105,7 @@ const inputClasses = computed(() => {
83
105
  'outline-offset-[-1px] outline-1 focus:outline-offset-[-1px] focus:outline-1': true,
84
106
  [variants[props.state]]: true,
85
107
  // Skeleton
86
- 'invisible': props.skeleton,
108
+ invisible: props.skeleton,
87
109
  // Disabled
88
110
  'disabled:opacity-50 disabled:cursor-not-allowed': true,
89
111
  // Size
@@ -127,7 +149,9 @@ const arrowClasses = computed(() => {
127
149
  [InputState.danger]: 'text-danger-100-font',
128
150
  };
129
151
 
130
- return {[variants[props.state]]: true};
152
+ return {
153
+ [variants[props.state]]: true,
154
+ };
131
155
  });
132
156
  const skeletonGrouped = computed(() => {
133
157
  if (!props.nullable || (props.nullable && _modelValue.value === null)) {
@@ -146,7 +170,7 @@ const iconSize = computed(() => {
146
170
  }
147
171
 
148
172
  return IconSize.xs;
149
- })
173
+ });
150
174
  const inputRef = ref<HTMLElement | null>(null);
151
175
  const dropDownRef = ref<HTMLElement | null>(null);
152
176
  const focusedDropDownItem = ref<string | number | null>(null);
@@ -260,51 +284,51 @@ function onClickRemoveButton() {
260
284
  :close-on-enter="true"
261
285
  @select-element="(e) => _modelValue = e"
262
286
  >
263
- <!-- Input -->
264
- <div
265
- :class="inputClasses"
266
- ref="inputRef"
267
- :tabindex="disabled || readonly ? -1 : 0"
268
- v-bind="$attrs"
269
- @mousedown="onClickSelectInput"
270
- @click="() => inputRef?.focus()"
271
- @blur="onBlur"
272
- >
287
+ <!-- Input -->
273
288
  <div
274
- v-if="_modelValue === null && placeholder !== undefined"
275
- :class="placeholderClasses"
289
+ ref="inputRef"
290
+ :class="inputClasses"
291
+ :tabindex="disabled || readonly ? -1 : 0"
292
+ v-bind="$attrs"
293
+ @mousedown="onClickSelectInput"
294
+ @click="() => inputRef?.focus()"
295
+ @blur="onBlur"
276
296
  >
277
- {{ placeholder }}
278
- </div>
297
+ <div
298
+ v-if="_modelValue === null && placeholder !== undefined"
299
+ :class="placeholderClasses"
300
+ >
301
+ {{ placeholder }}
302
+ </div>
279
303
 
280
- <div
281
- v-else-if="_modelValue === null && label !== undefined"
282
- :class="placeholderClasses"
283
- >
284
- {{ label }}
285
- </div>
304
+ <div
305
+ v-else-if="_modelValue === null && label !== undefined"
306
+ :class="placeholderClasses"
307
+ >
308
+ {{ label }}
309
+ </div>
286
310
 
287
- <div
288
- v-else
289
- class="select-none text-ellipsis overflow-hidden whitespace-nowrap w-full text-black"
290
- >
291
- {{ valueLabel }}
292
- </div>
311
+ <div
312
+ v-else
313
+ class="select-none text-ellipsis overflow-hidden whitespace-nowrap w-full text-black"
314
+ >
315
+ {{ valueLabel }}
316
+ </div>
293
317
 
294
- <AntIcon
295
- v-if="isOpen"
296
- :icon="faChevronUp"
297
- :size="iconSize"
298
- :class="arrowClasses"
299
- />
318
+ <AntIcon
319
+ v-if="isOpen"
320
+ :icon="faChevronUp"
321
+ :size="iconSize"
322
+ :class="arrowClasses"
323
+ />
300
324
 
301
- <AntIcon
302
- v-else
303
- :icon="faChevronDown"
304
- :size="iconSize"
305
- :class="arrowClasses"
306
- />
307
- </div>
325
+ <AntIcon
326
+ v-else
327
+ :icon="faChevronDown"
328
+ :size="iconSize"
329
+ :class="arrowClasses"
330
+ />
331
+ </div>
308
332
  </AntSelectMenu>
309
333
  </div>
310
334