@antify/ui 2.2.0 → 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 (150) 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 +61 -36
  82. package/dist/components/inputs/AntCheckboxGroup.vue +40 -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 +36 -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 +227 -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 +132 -14
  135. package/dist/components/table/__stories/AntTable.stories.mjs +253 -31
  136. package/dist/components/table/__types/index.d.ts +0 -1
  137. package/dist/components/table/__types/index.js +0 -11
  138. package/dist/components/table/__types/index.mjs +0 -1
  139. package/dist/components/tabs/AntTabItem.vue +20 -8
  140. package/dist/components/tabs/AntTabs.vue +35 -21
  141. package/dist/components/tabs/__stories/AntTabItem.stories.mjs +23 -7
  142. package/dist/components/tabs/__stories/AntTabs.stories.mjs +45 -13
  143. package/dist/components/transitions/AntTransitionCollapseHeight.vue +1 -1
  144. package/dist/composables/useToaster.mjs +25 -7
  145. package/dist/index.css +1 -0
  146. package/dist/utils.mjs +3 -1
  147. package/package.json +23 -16
  148. package/dist/tailwind.config.d.ts +0 -3
  149. package/dist/tailwind.config.js +0 -198
  150. package/dist/tailwind.config.mjs +0 -189
@@ -1,17 +1,35 @@
1
1
  <script lang="ts" setup>
2
- import {onMounted} from 'vue';
2
+ import {
3
+ onMounted,
4
+ } from 'vue';
3
5
  import AntButton from '../buttons/AntButton.vue';
4
6
  import AntField from '../forms/AntField.vue';
5
7
  import AntBaseInput from './Elements/AntBaseInput.vue';
6
- import {Size} from '../../enums/Size.enum';
7
- import {type IconDefinition} from '@fortawesome/free-solid-svg-icons';
8
- import {useVModel} from '@vueuse/core';
9
- import {State, InputState} from '../../enums';
10
- import {Grouped} from '../../enums/Grouped.enum';
11
- import {BaseInputType} from './Elements/__types';
12
- import {handleEnumValidation} from '../../handler';
8
+ import {
9
+ Size,
10
+ } from '../../enums/Size.enum';
11
+ import {
12
+ type IconDefinition,
13
+ } from '@fortawesome/free-solid-svg-icons';
14
+ import {
15
+ useVModel,
16
+ } from '@vueuse/core';
17
+ import {
18
+ State, InputState,
19
+ } from '../../enums';
20
+ import {
21
+ Grouped,
22
+ } from '../../enums/Grouped.enum';
23
+ import {
24
+ BaseInputType,
25
+ } from './Elements/__types';
26
+ import {
27
+ handleEnumValidation,
28
+ } from '../../handler';
13
29
 
14
- defineOptions({inheritAttrs: false});
30
+ defineOptions({
31
+ inheritAttrs: false,
32
+ });
15
33
 
16
34
  const props = withDefaults(defineProps<{
17
35
  modelValue: number | null;
@@ -36,9 +54,12 @@ const props = withDefaults(defineProps<{
36
54
  skeleton: false,
37
55
  size: Size.md,
38
56
  limiter: false,
39
- messages: () => []
57
+ messages: () => [],
40
58
  });
41
- const emit = defineEmits(['update:modelValue', 'validate']);
59
+ const emit = defineEmits([
60
+ 'update:modelValue',
61
+ 'validate',
62
+ ]);
42
63
  const _modelValue = useVModel(props, 'modelValue', emit);
43
64
 
44
65
  onMounted(() => {
@@ -65,7 +86,7 @@ onMounted(() => {
65
86
  v-model="_modelValue"
66
87
  :type="BaseInputType.number"
67
88
  :grouped="Grouped.left"
68
- wrapper-class="flex-grow"
89
+ wrapper-class="grow"
69
90
  :state="state"
70
91
  :size="size"
71
92
  :min="min"
@@ -1,26 +1,49 @@
1
1
  <script lang="ts" setup>
2
- import {computed, onMounted, watch, useSlots} from 'vue';
3
- import {Size} from '../../../enums/Size.enum';
2
+ import {
3
+ computed, onMounted, watch, useSlots,
4
+ } from 'vue';
5
+ import {
6
+ Size,
7
+ } from '../../../enums/Size.enum';
4
8
  import AntSkeleton from '../../AntSkeleton.vue';
5
9
  import AntIcon from '../../AntIcon.vue';
6
- import {BaseInputType} from './__types/AntBaseInput.types';
7
- import {Grouped} from '../../../enums/Grouped.enum';
10
+ import {
11
+ BaseInputType,
12
+ } from './__types/AntBaseInput.types';
13
+ import {
14
+ Grouped,
15
+ } from '../../../enums/Grouped.enum';
8
16
  import {
9
17
  faCircleCheck,
10
18
  faCircleInfo,
11
19
  faExclamationCircle,
12
20
  faExclamationTriangle,
13
21
  faXmark,
14
- type IconDefinition
22
+ type IconDefinition,
15
23
  } from '@fortawesome/free-solid-svg-icons';
16
- import {handleEnumValidation} from '../../../handler';
17
- import {classesToObjectSyntax, hasSlotContent} from '../../../utils';
18
- import {InputState} from '../../../enums';
19
- import {IconSize} from '../../__types';
24
+ import {
25
+ handleEnumValidation,
26
+ } from '../../../handler';
27
+ import {
28
+ classesToObjectSyntax, hasSlotContent,
29
+ } from '../../../utils';
30
+ import {
31
+ InputState,
32
+ } from '../../../enums';
33
+ import {
34
+ IconSize,
35
+ } from '../../__types';
20
36
 
21
- defineOptions({inheritAttrs: false});
37
+ defineOptions({
38
+ inheritAttrs: false,
39
+ });
22
40
 
23
- const emit = defineEmits(['update:modelValue', 'blur', 'validate', 'update:inputRef']);
41
+ const emit = defineEmits([
42
+ 'update:modelValue',
43
+ 'blur',
44
+ 'validate',
45
+ 'update:inputRef',
46
+ ]);
24
47
  const props = withDefaults(defineProps<{
25
48
  modelValue: string | number | null;
26
49
  size?: Size;
@@ -47,7 +70,7 @@ const props = withDefaults(defineProps<{
47
70
  showIcon: true,
48
71
  default: false,
49
72
  nullable: false,
50
- inputRef: null
73
+ inputRef: null,
51
74
  });
52
75
  const slot = useSlots();
53
76
  const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
@@ -108,12 +131,12 @@ const inputClasses = computed(() => {
108
131
  'rounded-none': props.grouped === Grouped.center,
109
132
  'rounded-tl-none rounded-bl-none rounded-tr-md rounded-br-md': props.grouped === Grouped.right,
110
133
  'rounded-md': props.grouped === Grouped.none,
111
- 'invisible': props.skeleton,
134
+ invisible: props.skeleton,
112
135
  };
113
136
  });
114
137
  const iconClasses = computed(() => ({
115
138
  'transition-[height]': true,
116
- 'opacity-50': props.disabled
139
+ 'opacity-50': props.disabled,
117
140
  }));
118
141
  const iconColorClass = computed(() => {
119
142
  const variants: Record<InputState, string> = {
@@ -129,7 +152,7 @@ const iconColorClass = computed(() => {
129
152
  const _wrapperClass = computed(() => ({
130
153
  '-mr-px': props.grouped !== Grouped.none,
131
154
  'cursor-not-allowed': props.disabled,
132
- ...classesToObjectSyntax(props.wrapperClass)
155
+ ...classesToObjectSyntax(props.wrapperClass),
133
156
  }));
134
157
  const icon = computed(() => icons[props.state]);
135
158
  const _modelValue = computed<string | number | null>({
@@ -155,14 +178,20 @@ const _inputRef = computed({
155
178
  },
156
179
  set(val) {
157
180
  emit('update:inputRef', val);
158
- }
181
+ },
159
182
  });
160
183
 
161
184
  watch(_modelValue, (val) => {
162
- if ([InputState.danger, InputState.warning, InputState.info].includes(props.state)) {
185
+ if ([
186
+ InputState.danger,
187
+ InputState.warning,
188
+ InputState.info,
189
+ ].includes(props.state)) {
163
190
  emit('validate', val);
164
191
  }
165
- }, {deep: true});
192
+ }, {
193
+ deep: true,
194
+ });
166
195
  watch(() => props.skeleton, (val) => {
167
196
  if (!val && props.modelValue !== null) {
168
197
  emit('validate', props.modelValue);
@@ -1,18 +1,26 @@
1
1
  <script lang="ts" setup>
2
- import {computed, onMounted} from 'vue';
3
- import {Size} from '../../../enums/Size.enum';
2
+ import {
3
+ computed, onMounted,
4
+ } from 'vue';
5
+ import {
6
+ Size,
7
+ } from '../../../enums/Size.enum';
4
8
  import AntSkeleton from '../../AntSkeleton.vue';
5
- import {handleEnumValidation} from '../../../handler';
6
- import {InputState} from '../../../enums';
9
+ import {
10
+ handleEnumValidation,
11
+ } from '../../../handler';
12
+ import {
13
+ InputState,
14
+ } from '../../../enums';
7
15
 
8
16
  const props = withDefaults(defineProps<{
9
- state?: InputState,
17
+ state?: InputState;
10
18
  size?: Size;
11
19
  skeleton?: boolean;
12
20
  }>(), {
13
21
  skeleton: false,
14
22
  size: Size.md,
15
- state: InputState.base
23
+ state: InputState.base,
16
24
  });
17
25
 
18
26
  const classes = computed(() => {
@@ -31,7 +39,7 @@ const classes = computed(() => {
31
39
  'text-sm': props.size === Size.sm,
32
40
  'text-md': props.size === Size.md,
33
41
  'text-lg': props.size === Size.lg,
34
- [variants[props.state]]: true
42
+ [variants[props.state]]: true,
35
43
  };
36
44
  });
37
45
 
@@ -46,7 +54,7 @@ onMounted(() => {
46
54
  :class="classes"
47
55
  >
48
56
  <span :class="{'invisible': skeleton}">
49
- <slot/>
57
+ <slot />
50
58
  </span>
51
59
 
52
60
  <AntSkeleton
@@ -1,10 +1,18 @@
1
1
  <script lang="ts" setup>
2
- import {computed, onMounted} from 'vue';
3
- import {Size} from '../../../enums/Size.enum';
2
+ import {
3
+ computed, onMounted,
4
+ } from 'vue';
5
+ import {
6
+ Size,
7
+ } from '../../../enums/Size.enum';
4
8
  import AntSkeleton from '../../AntSkeleton.vue';
5
- import {handleEnumValidation} from '../../../handler';
9
+ import {
10
+ handleEnumValidation,
11
+ } from '../../../handler';
6
12
 
7
- defineEmits(['clickContent']);
13
+ defineEmits([
14
+ 'clickContent',
15
+ ]);
8
16
 
9
17
  const props = withDefaults(defineProps<{
10
18
  label?: string;
@@ -57,6 +65,6 @@ onMounted(() => {
57
65
  />
58
66
  </span>
59
67
 
60
- <slot/>
68
+ <slot />
61
69
  </label>
62
70
  </template>
@@ -1,9 +1,17 @@
1
1
  <script lang="ts" setup>
2
- import {computed, onMounted} from 'vue';
3
- import {Size} from '../../../enums/Size.enum';
2
+ import {
3
+ computed, onMounted,
4
+ } from 'vue';
5
+ import {
6
+ Size,
7
+ } from '../../../enums/Size.enum';
4
8
  import AntSkeleton from '../../AntSkeleton.vue';
5
- import {handleEnumValidation} from '../../../handler';
6
- import {InputState} from '../../../enums';
9
+ import {
10
+ handleEnumValidation,
11
+ } from '../../../handler';
12
+ import {
13
+ InputState,
14
+ } from '../../../enums';
7
15
 
8
16
  const props = withDefaults(defineProps<{
9
17
  value: number;
@@ -14,7 +22,7 @@ const props = withDefaults(defineProps<{
14
22
  }>(), {
15
23
  skeleton: false,
16
24
  size: Size.md,
17
- state: InputState.base
25
+ state: InputState.base,
18
26
  });
19
27
 
20
28
  const classes = computed(() => {
@@ -6,14 +6,31 @@
6
6
  * Fix overflow bug (See Ellipsis Text story)
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
- import {computed, nextTick, onMounted, onUnmounted, ref, watch} from 'vue';
10
- import {InputState, Size} from '../../../enums';
11
- import type {SelectOption} from '../__types';
12
- import {useElementSize, useVModel, onClickOutside} from '@vueuse/core';
13
- import type {Validator} from '@antify/validate';
14
- import {autoUpdate, flip, offset, useFloating} from "@floating-ui/vue";
15
-
16
- const emit = defineEmits(['update:open', 'update:modelValue', 'update:focused', 'selectElement']);
9
+ import {
10
+ computed, nextTick, onMounted, onUnmounted, ref, watch,
11
+ } from 'vue';
12
+ import {
13
+ InputState, Size,
14
+ } from '../../../enums';
15
+ import type {
16
+ SelectOption,
17
+ } from '../__types';
18
+ import {
19
+ useElementSize, useVModel, onClickOutside,
20
+ } from '@vueuse/core';
21
+ import type {
22
+ Validator,
23
+ } from '@antify/validate';
24
+ import {
25
+ autoUpdate, flip, offset, useFloating,
26
+ } from '@floating-ui/vue';
27
+
28
+ const emit = defineEmits([
29
+ 'update:open',
30
+ 'update:modelValue',
31
+ 'update:focused',
32
+ 'selectElement',
33
+ ]);
17
34
  const props = withDefaults(defineProps<{
18
35
  modelValue: string | string[] | number | number[] | null;
19
36
  focused: string | number | null;
@@ -33,18 +50,22 @@ const props = withDefaults(defineProps<{
33
50
  autoSelectFirstOnOpen: true,
34
51
  closeOnSelectItem: true,
35
52
  });
36
- const reference = ref<HTMLElement | null | undefined>(props.inputRef)
53
+ const reference = ref<HTMLElement | null | undefined>(props.inputRef);
37
54
  const elementSize = useElementSize(reference);
38
- const floating = ref<HTMLElement | null>(null)
39
- const {floatingStyles, middlewareData, placement} = useFloating(reference, floating, {
55
+ const floating = ref<HTMLElement | null>(null);
56
+ const {
57
+ floatingStyles, middlewareData, placement,
58
+ } = useFloating(reference, floating, {
40
59
  placement: 'bottom',
41
60
  whileElementsMounted: autoUpdate,
42
61
  middleware: [
43
62
  offset(8),
44
63
  flip({
45
- fallbackPlacements: ['top'],
64
+ fallbackPlacements: [
65
+ 'top',
66
+ ],
46
67
  }),
47
- ]
68
+ ],
48
69
  });
49
70
 
50
71
  onClickOutside(floating, () => {
@@ -68,7 +89,7 @@ const dropdownClasses = computed(() => {
68
89
  };
69
90
 
70
91
  return {
71
- 'w-full border flex flex-col gap-px outline-none -mt-px overflow-y-auto shadow-md z-[90] max-h-[250px]': true,
92
+ 'w-full border flex flex-col gap-px outline-hidden -mt-px overflow-y-auto shadow-md z-[90] max-h-[250px]': true,
72
93
  'rounded-md': true,
73
94
  [variants[props.state]]: true,
74
95
  };
@@ -124,7 +145,7 @@ function onKeyDownDropDown(e: KeyboardEvent) {
124
145
  }
125
146
 
126
147
  if (!isOpen.value) {
127
- isOpen.value = true
148
+ isOpen.value = true;
128
149
  }
129
150
 
130
151
  emit('selectElement', focusedDropDownItem.value);
@@ -135,7 +156,7 @@ function onKeyDownDropDown(e: KeyboardEvent) {
135
156
  }
136
157
 
137
158
  if (e.key === 'ArrowDown' || e.key === 'ArrowRight') {
138
- e.preventDefault()
159
+ e.preventDefault();
139
160
  isOpen.value = true;
140
161
 
141
162
  const index = props.options.findIndex(option => option.value === focusedDropDownItem.value);
@@ -149,7 +170,7 @@ function onKeyDownDropDown(e: KeyboardEvent) {
149
170
  }
150
171
 
151
172
  if (e.key === 'ArrowUp' || e.key === 'ArrowLeft') {
152
- e.preventDefault()
173
+ e.preventDefault();
153
174
  isOpen.value = true;
154
175
 
155
176
  const index = props.options.findIndex(option => option.value === focusedDropDownItem.value);
@@ -174,7 +195,10 @@ function getActiveDropDownItemClasses(option: SelectOption) {
174
195
  [InputState.danger]: 'bg-danger-200',
175
196
  };
176
197
 
177
- return option.value === focusedDropDownItem.value ? {'bg-white': false, [variants[props.state]]: true} : {};
198
+ return option.value === focusedDropDownItem.value ? {
199
+ 'bg-white': false,
200
+ [variants[props.state]]: true,
201
+ } : {};
178
202
  }
179
203
 
180
204
  function onClickDropDownItem(e: MouseEvent, value: string | number | null) {
@@ -199,34 +223,34 @@ watch(_modelValue, (val) => {
199
223
  ref="reference"
200
224
  class="relative"
201
225
  >
202
- <slot/>
226
+ <slot />
203
227
 
204
228
  <teleport to="body">
229
+ <div
230
+ v-if="isOpen"
231
+ ref="floating"
232
+ :class="dropdownClasses"
233
+ :style="{width: `${elementSize.width.value}px!important`, ...floatingStyles}"
234
+ >
235
+ <div
236
+ v-for="(option, index) in options"
237
+ :key="`option-${index}`"
238
+ :class="{...dropDownItemClasses, ...getActiveDropDownItemClasses(option)}"
239
+ @mousedown="(e) => onClickDropDownItem(e, option.value)"
240
+ @mouseover="() => focusedDropDownItem = option.value"
241
+ >
242
+ {{ option.label }}
243
+ </div>
244
+
205
245
  <div
206
- v-if="isOpen"
207
- :class="dropdownClasses"
208
- ref="floating"
209
- :style="{width: `${elementSize.width.value}px!important`, ...floatingStyles}"
246
+ v-if="options.length === 0"
247
+ :class="{...dropDownItemClasses}"
210
248
  >
211
- <div
212
- v-for="(option, index) in options"
213
- :key="`option-${index}`"
214
- :class="{...dropDownItemClasses, ...getActiveDropDownItemClasses(option)}"
215
- @mousedown="(e) => onClickDropDownItem(e, option.value)"
216
- @mouseover="() => focusedDropDownItem = option.value"
217
- >
218
- {{ option.label }}
219
- </div>
220
-
221
- <div
222
- v-if="options.length === 0"
223
- :class="{...dropDownItemClasses}"
224
- >
225
- <slot name="empty">
226
- No options available
227
- </slot>
228
- </div>
249
+ <slot name="empty">
250
+ No options available
251
+ </slot>
229
252
  </div>
253
+ </div>
230
254
  </teleport>
231
255
  </div>
232
256
  </template>
@@ -1,64 +1,119 @@
1
- import { Size } from "../../../../enums/Size.enum.mjs";
2
- import { BaseInputType } from "../__types/AntBaseInput.types.mjs";
1
+ import {
2
+ Size
3
+ } from "../../../../enums/Size.enum.mjs";
4
+ import {
5
+ BaseInputType
6
+ } from "../__types/AntBaseInput.types.mjs";
3
7
  import AntBaseInput from "../AntBaseInput.vue";
4
8
  import AntButton from "../../../buttons/AntButton.vue";
5
9
  import AntIcon from "../../../AntIcon.vue";
6
- import { Grouped as _Grouped } from "../../../../enums/Grouped.enum.mjs";
7
- import { faSearch, faEye } from "@fortawesome/free-solid-svg-icons";
8
- import { InputState } from "../../../../enums/index.mjs";
10
+ import {
11
+ Grouped as _Grouped
12
+ } from "../../../../enums/Grouped.enum.mjs";
13
+ import {
14
+ faSearch,
15
+ faEye
16
+ } from "@fortawesome/free-solid-svg-icons";
17
+ import {
18
+ InputState
19
+ } from "../../../../enums/index.mjs";
9
20
  import AntFormGroup from "../../../forms/AntFormGroup.vue";
10
21
  import AntFormGroupLabel from "../../../forms/AntFormGroupLabel.vue";
11
- import { Direction } from "../../../../enums/Direction.enum.mjs";
22
+ import {
23
+ Direction
24
+ } from "../../../../enums/Direction.enum.mjs";
12
25
  const meta = {
13
26
  computed: {
14
27
  Direction() {
15
28
  return Direction;
16
29
  }
17
30
  },
18
- components: { AntFormGroup },
31
+ components: {
32
+ AntFormGroup
33
+ },
19
34
  title: "Inputs/Elements/Base Input",
20
35
  component: AntBaseInput,
21
- parameters: { controls: { sort: "requiredFirst" } },
36
+ parameters: {
37
+ controls: {
38
+ sort: "requiredFirst"
39
+ }
40
+ },
22
41
  argTypes: {
23
42
  modelValue: {
24
- control: { type: "text" },
25
- table: { type: { summary: "string|number|null" } }
43
+ control: {
44
+ type: "text"
45
+ },
46
+ table: {
47
+ type: {
48
+ summary: "string|number|null"
49
+ }
50
+ }
26
51
  },
27
52
  type: {
28
- control: { type: "select" },
53
+ control: {
54
+ type: "select"
55
+ },
29
56
  options: Object.values(BaseInputType),
30
- table: { defaultValue: { summary: BaseInputType.text } }
57
+ table: {
58
+ defaultValue: {
59
+ summary: BaseInputType.text
60
+ }
61
+ }
31
62
  },
32
63
  state: {
33
- control: { type: "select" },
64
+ control: {
65
+ type: "select"
66
+ },
34
67
  options: Object.values(InputState)
35
68
  },
36
69
  size: {
37
- control: { type: "select" },
70
+ control: {
71
+ type: "select"
72
+ },
38
73
  options: Object.values(Size),
39
- table: { defaultValue: { summary: Size.md } }
74
+ table: {
75
+ defaultValue: {
76
+ summary: Size.md
77
+ }
78
+ }
40
79
  },
41
80
  placeholder: {
42
81
  control: "text",
43
- table: { defaultValue: { summary: "this.label" } }
82
+ table: {
83
+ defaultValue: {
84
+ summary: "this.label"
85
+ }
86
+ }
44
87
  },
45
88
  grouped: {
46
- control: { type: "select" },
89
+ control: {
90
+ type: "select"
91
+ },
47
92
  options: Object.values(_Grouped),
48
93
  description: "Where is this fields position in a group",
49
- table: { defaultValue: { summary: _Grouped.none } }
94
+ table: {
95
+ defaultValue: {
96
+ summary: _Grouped.none
97
+ }
98
+ }
50
99
  },
51
100
  wrapperClass: {
52
101
  control: "text",
53
102
  description: 'Class for the first element because the attribute "class" would affect the input element.',
54
- table: { type: { summary: "string|object" } }
103
+ table: {
104
+ type: {
105
+ summary: "string|object"
106
+ }
107
+ }
55
108
  },
56
109
  showIcon: {
57
110
  control: "boolean",
58
111
  description: "Some InputStates can have an icon. Control with this property if it gets shown or not."
59
112
  },
60
113
  iconLeft: {
61
- control: { type: "none" },
114
+ control: {
115
+ type: "none"
116
+ },
62
117
  description: "Will be displayed left to the input text.<br>Use Font-awesome Icons."
63
118
  }
64
119
  }
@@ -66,9 +121,13 @@ const meta = {
66
121
  export default meta;
67
122
  export const Docs = {
68
123
  render: (args) => ({
69
- components: { AntBaseInput },
124
+ components: {
125
+ AntBaseInput
126
+ },
70
127
  setup: () => {
71
- return { args };
128
+ return {
129
+ args
130
+ };
72
131
  },
73
132
  template: `
74
133
  <AntBaseInput
@@ -97,9 +156,15 @@ export const IconLeft = {
97
156
  };
98
157
  export const IconRight = {
99
158
  render: (args) => ({
100
- components: { AntBaseInput, AntIcon },
159
+ components: {
160
+ AntBaseInput,
161
+ AntIcon
162
+ },
101
163
  setup: () => {
102
- return { args, faEye };
164
+ return {
165
+ args,
166
+ faEye
167
+ };
103
168
  },
104
169
  template: `
105
170
  <AntBaseInput
@@ -117,12 +182,24 @@ export const IconRight = {
117
182
  };
118
183
  export const Summary = {
119
184
  parameters: {
120
- chromatic: { disableSnapshot: false }
185
+ chromatic: {
186
+ disableSnapshot: false
187
+ }
121
188
  },
122
189
  render: (args) => ({
123
- components: { AntBaseInput, AntButton, AntFormGroup, AntFormGroupLabel },
190
+ components: {
191
+ AntBaseInput,
192
+ AntButton,
193
+ AntFormGroup,
194
+ AntFormGroupLabel
195
+ },
124
196
  setup: () => {
125
- return { args, faSearch, Direction, Size };
197
+ return {
198
+ args,
199
+ faSearch,
200
+ Direction,
201
+ Size
202
+ };
126
203
  },
127
204
  template: `
128
205
  <AntFormGroup>