@antify/ui-module 1.4.0 → 1.5.1

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 (88) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +2 -1
  3. package/dist/runtime/components/AntAccordionItem.vue +17 -14
  4. package/dist/runtime/components/AntDropdown.vue +6 -6
  5. package/dist/runtime/components/AntListGroupItem.vue +16 -10
  6. package/dist/runtime/components/AntModal.vue +10 -9
  7. package/dist/runtime/components/AntPopover.vue +10 -8
  8. package/dist/runtime/components/AntTooltip.vue +32 -20
  9. package/dist/runtime/components/__stories/AntTooltip.stories.d.ts +1 -1
  10. package/dist/runtime/components/__stories/AntTooltip.stories.mjs +164 -12
  11. package/dist/runtime/components/buttons/AntActionButton.vue +40 -32
  12. package/dist/runtime/components/buttons/AntButton.vue +188 -168
  13. package/dist/runtime/components/buttons/AntCreateButton.vue +19 -6
  14. package/dist/runtime/components/buttons/AntDeleteButton.vue +21 -10
  15. package/dist/runtime/components/buttons/AntDuplicateButton.vue +54 -0
  16. package/dist/runtime/components/buttons/AntEditButton.vue +54 -0
  17. package/dist/runtime/components/buttons/AntSaveAndNewButton.vue +21 -8
  18. package/dist/runtime/components/buttons/AntSaveButton.vue +21 -10
  19. package/dist/runtime/components/buttons/__stories/AntActionButton.stories.d.ts +1 -1
  20. package/dist/runtime/components/buttons/__stories/AntActionButton.stories.mjs +22 -19
  21. package/dist/runtime/components/buttons/__stories/AntButton.stories.d.ts +1 -0
  22. package/dist/runtime/components/buttons/__stories/AntButton.stories.mjs +166 -131
  23. package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.d.ts +1 -0
  24. package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.mjs +16 -6
  25. package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.d.ts +1 -0
  26. package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.mjs +16 -6
  27. package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.d.ts +12 -0
  28. package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.mjs +76 -0
  29. package/dist/runtime/components/buttons/__stories/AntEditButton.stories.d.ts +12 -0
  30. package/dist/runtime/components/buttons/__stories/AntEditButton.stories.mjs +76 -0
  31. package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.d.ts +1 -0
  32. package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +16 -6
  33. package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.d.ts +1 -0
  34. package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.mjs +16 -6
  35. package/dist/runtime/components/crud/AntCrud.vue +13 -10
  36. package/dist/runtime/components/crud/AntCrudDetail.vue +1 -1
  37. package/dist/runtime/components/crud/AntCrudDetailActions.vue +1 -1
  38. package/dist/runtime/components/crud/AntCrudDetailNav.vue +1 -1
  39. package/dist/runtime/components/crud/AntCrudTableFilter.vue +1 -1
  40. package/dist/runtime/components/crud/AntCrudTableNav.vue +15 -4
  41. package/dist/runtime/components/dialogs/AntDialog.vue +7 -7
  42. package/dist/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +1 -2
  43. package/dist/runtime/components/form/AntFormGroup.vue +22 -7
  44. package/dist/runtime/components/form/AntSelect.vue +57 -53
  45. package/dist/runtime/components/form/AntSwitch.vue +13 -10
  46. package/dist/runtime/components/form/AntSwitcher.vue +4 -4
  47. package/dist/runtime/components/form/AntTextarea.vue +6 -3
  48. package/dist/runtime/components/form/Elements/AntBaseInput.vue +45 -41
  49. package/dist/runtime/components/form/Elements/AntDropDown.vue +1 -1
  50. package/dist/runtime/components/layouts/AntNavLeftLayout.vue +4 -4
  51. package/dist/runtime/components/table/AntTable.vue +95 -73
  52. package/dist/runtime/components/table/AntTableSortButton.vue +16 -4
  53. package/dist/runtime/components/tabs/AntTabItem.vue +7 -4
  54. package/dist/runtime/tailwind.config.mjs +1 -1
  55. package/package.json +11 -11
  56. package/src/runtime/components/AntAccordionItem.vue +17 -14
  57. package/src/runtime/components/AntDropdown.vue +6 -6
  58. package/src/runtime/components/AntListGroupItem.vue +16 -10
  59. package/src/runtime/components/AntModal.vue +10 -9
  60. package/src/runtime/components/AntPopover.vue +10 -8
  61. package/src/runtime/components/AntTooltip.vue +32 -20
  62. package/src/runtime/components/buttons/AntActionButton.vue +40 -32
  63. package/src/runtime/components/buttons/AntButton.vue +188 -168
  64. package/src/runtime/components/buttons/AntCreateButton.vue +19 -6
  65. package/src/runtime/components/buttons/AntDeleteButton.vue +21 -10
  66. package/src/runtime/components/buttons/AntDuplicateButton.vue +54 -0
  67. package/src/runtime/components/buttons/AntEditButton.vue +54 -0
  68. package/src/runtime/components/buttons/AntSaveAndNewButton.vue +21 -8
  69. package/src/runtime/components/buttons/AntSaveButton.vue +21 -10
  70. package/src/runtime/components/crud/AntCrud.vue +13 -10
  71. package/src/runtime/components/crud/AntCrudDetail.vue +1 -1
  72. package/src/runtime/components/crud/AntCrudDetailActions.vue +1 -1
  73. package/src/runtime/components/crud/AntCrudDetailNav.vue +1 -1
  74. package/src/runtime/components/crud/AntCrudTableFilter.vue +1 -1
  75. package/src/runtime/components/crud/AntCrudTableNav.vue +15 -4
  76. package/src/runtime/components/dialogs/AntDialog.vue +7 -7
  77. package/src/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +1 -2
  78. package/src/runtime/components/form/AntFormGroup.vue +22 -7
  79. package/src/runtime/components/form/AntSelect.vue +57 -53
  80. package/src/runtime/components/form/AntSwitch.vue +13 -10
  81. package/src/runtime/components/form/AntSwitcher.vue +4 -4
  82. package/src/runtime/components/form/AntTextarea.vue +6 -3
  83. package/src/runtime/components/form/Elements/AntBaseInput.vue +45 -41
  84. package/src/runtime/components/form/Elements/AntDropDown.vue +1 -1
  85. package/src/runtime/components/layouts/AntNavLeftLayout.vue +4 -4
  86. package/src/runtime/components/table/AntTable.vue +95 -73
  87. package/src/runtime/components/table/AntTableSortButton.vue +16 -4
  88. package/src/runtime/components/tabs/AntTabItem.vue +7 -4
@@ -39,21 +39,22 @@ function closeModal() {
39
39
  </script>
40
40
 
41
41
  <template>
42
- <transition name="fade">
42
+ <Transition name="fade">
43
43
  <div
44
44
  v-if="openBackground"
45
45
  class="absolute inset-0 flex items-center justify-center z-50 cursor-pointer overflow-hidden"
46
46
  :class="{'bg-black/50 backdrop-blur-sm': !fullscreen}"
47
47
  @click.self="closeModal"
48
48
  >
49
- <transition :name="!fullscreen ? 'bounce' : 'bounce-slow'">
49
+ <Transition :name="!fullscreen ? 'bounce' : 'bounce-slow'">
50
50
  <div
51
51
  v-if="openModal"
52
52
  class="flex flex-col gap-px bg-neutral-300 overflow-hidden cursor-auto"
53
53
  :class="{'w-full h-full': fullscreen, 'border border-neutral-300 rounded-md shadow-md': !fullscreen}"
54
54
  >
55
55
  <div
56
- class="bg-neutral-50 p-2.5 flex items-center justify-between text-neutral-50-font text-lg font-medium">
56
+ class="bg-white p-2.5 flex items-center justify-between text-for-white-bg-font text-lg font-medium"
57
+ >
57
58
  <slot name="title">
58
59
  {{ title }}
59
60
  </slot>
@@ -66,20 +67,20 @@ function closeModal() {
66
67
  />
67
68
  </div>
68
69
 
69
- <div class="bg-neutral-50 p-2.5 grow overflow-y-auto">
70
- <slot/>
70
+ <div class="bg-white p-2.5 grow overflow-y-auto">
71
+ <slot />
71
72
  </div>
72
73
 
73
74
  <div
74
75
  v-if="useSlots()['footer'] || false"
75
- class="bg-neutral-50 p-2.5 text-neutral-50-font"
76
+ class="bg-white p-2.5 text-for-white-bg-font"
76
77
  >
77
- <slot name="footer"/>
78
+ <slot name="footer" />
78
79
  </div>
79
80
  </div>
80
- </transition>
81
+ </Transition>
81
82
  </div>
82
- </transition>
83
+ </Transition>
83
84
  </template>
84
85
 
85
86
  <style scoped>
@@ -44,9 +44,9 @@ onMounted(() => {
44
44
 
45
45
  <template>
46
46
  <div class="relative inline-flex justify-center items-end">
47
- <slot/>
47
+ <slot />
48
48
 
49
- <transition name="bounce">
49
+ <Transition name="bounce">
50
50
  <template v-if="showPopover">
51
51
  <div :class="_popoverClasses">
52
52
  <div class="shadow-lg border-neutral-300 rounded-md text-sm relative inline-flex flex-col relative">
@@ -66,12 +66,12 @@ onMounted(() => {
66
66
  >
67
67
  <path
68
68
  d="M20.3284 1.82843L23.1569 4.65685C24.6571 6.15715 26.692 7 28.8137 7L6.18629 7C8.30802 7 10.3429 6.15715 11.8431 4.65686L14.6716 1.82843C16.2337 0.266331 18.7663 0.266328 20.3284 1.82843Z"
69
- :class="{'fill-neutral-100': position === Position.bottom, 'fill-neutral-50': position === Position.top || position === Position.right || position === Position.left}"
69
+ :class="{'fill-neutral-100': position === Position.bottom, 'fill-white': position === Position.top || position === Position.right || position === Position.left}"
70
70
  />
71
71
 
72
72
  <path
73
73
  d="M34.5 7L28.8137 7C26.692 7 24.6571 6.15715 23.1569 4.65685L20.3284 1.82843C18.7663 0.266328 16.2337 0.266331 14.6716 1.82843L11.8431 4.65686C10.3429 6.15715 8.30802 7 6.18629 7L0.5 7L34.5 7Z"
74
- :class="{'stroke-neutral-100': position === Position.bottom, 'stroke-neutral-50': position === Position.top || position === Position.right || position === Position.left}"
74
+ :class="{'stroke-neutral-100': position === Position.bottom, 'stroke-white': position === Position.top || position === Position.right || position === Position.left}"
75
75
  />
76
76
  </svg>
77
77
 
@@ -92,18 +92,20 @@ onMounted(() => {
92
92
  </div>
93
93
 
94
94
  <div
95
- class="border-neutral-300 border-b p-2.5 bg-neutral-100 rounded-t-md border-t border-l border-r text-neutral-100-font font-semibold">
95
+ class="border-neutral-300 border-b p-2.5 bg-neutral-100 rounded-t-md border-t border-l border-r text-neutral-100-font font-semibold"
96
+ >
96
97
  {{ title }}
97
98
  </div>
98
99
 
99
100
  <div
100
- class="p-2.5 rounded-b-md text-neutral-50-font border-neutral-300 border-l border-b border-r bg-neutral-50">
101
- <slot name="content"/>
101
+ class="p-2.5 rounded-b-md text-for-white-bg-font border-neutral-300 border-l border-b border-r bg-white"
102
+ >
103
+ <slot name="content" />
102
104
  </div>
103
105
  </div>
104
106
  </div>
105
107
  </template>
106
- </transition>
108
+ </Transition>
107
109
  </div>
108
110
  </template>
109
111
 
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import {computed, onMounted, ref} from 'vue';
2
+ import {computed, onMounted, ref, getCurrentInstance} from 'vue';
3
3
  import {handleEnumValidation} from '../handler';
4
4
  import {InputColorType, Position} from '../enums';
5
5
  import {classesToObjectSyntax} from '../utils';
@@ -10,11 +10,13 @@ const props = withDefaults(defineProps<{
10
10
  tooltipClasses?: string | Record<string, boolean>
11
11
  colorType?: InputColorType
12
12
  expanded?: boolean
13
+ delay?: number
13
14
  }>(), {
14
15
  position: Position.left,
15
16
  tooltipClasses: '',
16
17
  colorType: InputColorType.base,
17
- expanded: false
18
+ expanded: false,
19
+ delay: 800
18
20
  });
19
21
  const visible = ref(false);
20
22
  const _tooltipClasses = computed(() => ({
@@ -42,7 +44,7 @@ const itemContainerClasses = computed(() => ({
42
44
  }));
43
45
  const contentClasses = computed(() => {
44
46
  const variants: Record<InputColorType, string> = {
45
- [InputColorType.base]: 'text-neutral-50-font bg-neutral-50 border-neutral-300',
47
+ [InputColorType.base]: 'text-for-white-bg-font bg-white border-neutral-300',
46
48
  [InputColorType.danger]: 'text-danger-500-font bg-danger-500 border-danger-500',
47
49
  [InputColorType.info]: 'text-info-500-font bg-info-500 border-info-500',
48
50
  [InputColorType.success]: 'text-success-500-font bg-success-500 border-success-500',
@@ -53,7 +55,7 @@ const contentClasses = computed(() => {
53
55
  });
54
56
  const svgPathClasses = computed(() => {
55
57
  const variants: Record<InputColorType, string> = {
56
- [InputColorType.base]: 'fill-neutral-50 stroke-neutral-50',
58
+ [InputColorType.base]: 'fill-white stroke-white',
57
59
  [InputColorType.danger]: 'fill-danger-500 stroke-danger-500',
58
60
  [InputColorType.info]: 'fill-info-500 stroke-info-500',
59
61
  [InputColorType.success]: 'fill-success-500 stroke-success-500',
@@ -73,43 +75,53 @@ const arrowSvgPathClasses = computed(() => {
73
75
 
74
76
  return {[variants[props.colorType]]: true};
75
77
  });
78
+ const timeout = ref<number | undefined>();
79
+ const clickLock = ref(false);
80
+ const uuid = ref(getCurrentInstance()?.uid)
76
81
 
77
82
  onMounted(() => {
78
83
  handleEnumValidation(props.position, Position, 'Position')
79
84
  handleEnumValidation(props.colorType, InputColorType, 'colorType')
80
85
  });
81
86
 
82
- /**
83
- * To prevent a fliggering ux, add a delay on hover and leaving the hover target,
84
- * before showing the tooltip content.
85
- */
86
- const delayVisible = ref(visible.value);
87
-
88
87
  function onMouseOver() {
89
- delayVisible.value = true;
88
+ if (visible.value || clickLock.value) {
89
+ return;
90
+ }
90
91
 
91
- setTimeout(() => {
92
- if (delayVisible.value) {
93
- visible.value = true
94
- }
95
- }, 300)
92
+ timeout.value = setTimeout(() => visible.value = true, props.delay) as unknown as number
96
93
  }
97
94
 
98
95
  function onMouseLeave() {
99
- delayVisible.value = false
96
+ clearTimeout(timeout.value)
97
+
100
98
  visible.value = false
99
+ clickLock.value = false
100
+ }
101
+
102
+ function onClick() {
103
+ clearTimeout(timeout.value)
104
+
105
+ visible.value = false
106
+ clickLock.value = true
101
107
  }
102
108
  </script>
103
109
 
104
110
  <template>
105
111
  <div
112
+ :key="uuid"
106
113
  class="relative justify-center items-center"
107
114
  :class="{'flex w-full': props.expanded, 'inline-flex': !props.expanded}"
108
115
  data-e2e="tooltip"
109
- @mouseover="onMouseOver"
110
- @mouseleave="onMouseLeave"
116
+ @mouseover="() => onMouseOver()"
117
+ @mouseleave="() => onMouseLeave()"
111
118
  >
112
- <slot />
119
+ <div
120
+ class="w-full"
121
+ @click="() => onClick()"
122
+ >
123
+ <slot />
124
+ </div>
113
125
 
114
126
  <div
115
127
  v-if="visible && hasSlotContent($slots.content)"
@@ -3,16 +3,17 @@
3
3
  * This button is used for everything what is the primary
4
4
  * action like save, confirm, create, etc.
5
5
  */
6
- import {Grouped} from '../../enums/Grouped.enum';
7
- import {Size} from '../../enums/Size.enum';
8
- import {ColorType, InputColorType} from '../../enums/ColorType.enum';
9
- import {Position} from '../../enums/Position.enum';
6
+ import {Position, ColorType, InputColorType, Size, Grouped} from '../../enums';
10
7
  import AntButton from './AntButton.vue';
11
- import AntTooltip from '../AntTooltip.vue';
8
+ import type {IconDefinition} from '@fortawesome/free-solid-svg-icons';
9
+ import {computed, useSlots} from 'vue';
10
+ import {hasSlotContent} from '../../utils';
12
11
 
13
12
  defineEmits(['click', 'blur']);
14
- withDefaults(
13
+ const props = withDefaults(
15
14
  defineProps<{
15
+ iconLeft?: IconDefinition;
16
+ iconRight?: IconDefinition;
16
17
  size?: Size;
17
18
  disabled?: boolean;
18
19
  grouped?: Grouped;
@@ -21,43 +22,50 @@ withDefaults(
21
22
  expanded?: boolean;
22
23
  filled?: boolean;
23
24
  hasPermission?: boolean;
24
- invalidPermissionTooltipPosition?: Position;
25
+ tooltipPosition?: Position;
26
+ tooltipColorType?: InputColorType;
27
+ tooltipDelay?: number;
25
28
  }>(), {
26
29
  colorType: ColorType.primary,
27
30
  hasPermission: true,
28
31
  filled: true
29
32
  }
30
33
  )
34
+ const slots = useSlots();
35
+ const hasTooltip = computed(() => !props.skeleton && !props.disabled && props.hasPermission && hasSlotContent(slots['tooltipContent']));
36
+ const hasPermissionTooltip = computed(() => !props.skeleton && !props.disabled && !props.hasPermission && hasSlotContent(slots['invalidPermissionTooltipContent']));
31
37
  </script>
32
38
 
33
39
  <template>
34
- <AntTooltip
40
+ <AntButton
41
+ :icon-left="iconLeft"
42
+ :icon-right="iconRight"
43
+ :size="size"
44
+ :disabled="disabled || !hasPermission"
45
+ :grouped="grouped"
46
+ :skeleton="skeleton"
35
47
  :expanded="expanded"
36
- :position="invalidPermissionTooltipPosition"
37
- :color-type="InputColorType.info"
48
+ :color-type="colorType"
49
+ :filled="filled"
50
+ :tooltip-position="tooltipPosition"
51
+ :tooltip-color-type="hasPermissionTooltip ? InputColorType.info : tooltipColorType"
52
+ :tooltip-delay="hasPermissionTooltip ? 300 : tooltipDelay"
53
+ data-e2e="action-button"
54
+ @click="$emit('click')"
55
+ @blur="$emit('blur')"
38
56
  >
39
- <slot name="button">
40
- <AntButton
41
- :size="size"
42
- :disabled="disabled || !hasPermission"
43
- :grouped="grouped"
44
- :skeleton="skeleton"
45
- :expanded="expanded"
46
- :color-type="colorType"
47
- :filled="filled"
48
- data-e2e="action-button"
49
- @click="$emit('click')"
50
- @blur="$emit('blur')"
51
- >
52
- <slot />
53
- </AntButton>
54
- </slot>
57
+ <slot />
55
58
 
56
- <template
57
- v-if="!hasPermission && !skeleton"
58
- #content
59
- >
60
- <slot name="invalidPermissionTooltipContent" />
59
+ <template #tooltip-content>
60
+ <slot
61
+ v-if="hasTooltip"
62
+ name="tooltipContent"
63
+ />
64
+
65
+ <slot
66
+ v-if="hasPermissionTooltip"
67
+ name="invalidPermissionTooltipContent"
68
+ />
61
69
  </template>
62
- </AntTooltip>
70
+ </AntButton>
63
71
  </template>