@antify/ui-module 1.4.0 → 1.5.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 (71) 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 +2 -2
  9. package/dist/runtime/components/buttons/AntActionButton.vue +5 -0
  10. package/dist/runtime/components/buttons/AntButton.vue +126 -126
  11. package/dist/runtime/components/buttons/AntCreateButton.vue +1 -0
  12. package/dist/runtime/components/buttons/AntDeleteButton.vue +11 -1
  13. package/dist/runtime/components/buttons/AntDuplicateButton.vue +42 -0
  14. package/dist/runtime/components/buttons/__stories/AntActionButton.stories.mjs +6 -4
  15. package/dist/runtime/components/buttons/__stories/AntButton.stories.mjs +130 -130
  16. package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.mjs +4 -3
  17. package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.d.ts +1 -0
  18. package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.mjs +11 -3
  19. package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.d.ts +11 -0
  20. package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.mjs +67 -0
  21. package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +4 -3
  22. package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.mjs +4 -3
  23. package/dist/runtime/components/crud/AntCrud.vue +13 -10
  24. package/dist/runtime/components/crud/AntCrudDetail.vue +1 -1
  25. package/dist/runtime/components/crud/AntCrudDetailActions.vue +1 -1
  26. package/dist/runtime/components/crud/AntCrudDetailNav.vue +1 -1
  27. package/dist/runtime/components/crud/AntCrudTableFilter.vue +1 -1
  28. package/dist/runtime/components/crud/AntCrudTableNav.vue +15 -4
  29. package/dist/runtime/components/dialogs/AntDialog.vue +7 -7
  30. package/dist/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +1 -2
  31. package/dist/runtime/components/form/AntSelect.vue +57 -53
  32. package/dist/runtime/components/form/AntSwitch.vue +13 -10
  33. package/dist/runtime/components/form/AntSwitcher.vue +4 -4
  34. package/dist/runtime/components/form/AntTextarea.vue +6 -3
  35. package/dist/runtime/components/form/Elements/AntBaseInput.vue +45 -41
  36. package/dist/runtime/components/form/Elements/AntDropDown.vue +1 -1
  37. package/dist/runtime/components/layouts/AntNavLeftLayout.vue +4 -4
  38. package/dist/runtime/components/table/AntTable.vue +95 -73
  39. package/dist/runtime/components/table/AntTableSortButton.vue +16 -4
  40. package/dist/runtime/components/tabs/AntTabItem.vue +7 -4
  41. package/dist/runtime/tailwind.config.mjs +1 -1
  42. package/package.json +1 -1
  43. package/src/runtime/components/AntAccordionItem.vue +17 -14
  44. package/src/runtime/components/AntDropdown.vue +6 -6
  45. package/src/runtime/components/AntListGroupItem.vue +16 -10
  46. package/src/runtime/components/AntModal.vue +10 -9
  47. package/src/runtime/components/AntPopover.vue +10 -8
  48. package/src/runtime/components/AntTooltip.vue +2 -2
  49. package/src/runtime/components/buttons/AntActionButton.vue +5 -0
  50. package/src/runtime/components/buttons/AntButton.vue +126 -126
  51. package/src/runtime/components/buttons/AntCreateButton.vue +1 -0
  52. package/src/runtime/components/buttons/AntDeleteButton.vue +11 -1
  53. package/src/runtime/components/buttons/AntDuplicateButton.vue +42 -0
  54. package/src/runtime/components/crud/AntCrud.vue +13 -10
  55. package/src/runtime/components/crud/AntCrudDetail.vue +1 -1
  56. package/src/runtime/components/crud/AntCrudDetailActions.vue +1 -1
  57. package/src/runtime/components/crud/AntCrudDetailNav.vue +1 -1
  58. package/src/runtime/components/crud/AntCrudTableFilter.vue +1 -1
  59. package/src/runtime/components/crud/AntCrudTableNav.vue +15 -4
  60. package/src/runtime/components/dialogs/AntDialog.vue +7 -7
  61. package/src/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +1 -2
  62. package/src/runtime/components/form/AntSelect.vue +57 -53
  63. package/src/runtime/components/form/AntSwitch.vue +13 -10
  64. package/src/runtime/components/form/AntSwitcher.vue +4 -4
  65. package/src/runtime/components/form/AntTextarea.vue +6 -3
  66. package/src/runtime/components/form/Elements/AntBaseInput.vue +45 -41
  67. package/src/runtime/components/form/Elements/AntDropDown.vue +1 -1
  68. package/src/runtime/components/layouts/AntNavLeftLayout.vue +4 -4
  69. package/src/runtime/components/table/AntTable.vue +95 -73
  70. package/src/runtime/components/table/AntTableSortButton.vue +16 -4
  71. package/src/runtime/components/tabs/AntTabItem.vue +7 -4
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "ui-module",
3
3
  "configKey": "uiModule",
4
- "version": "1.4.0"
4
+ "version": "1.5.0"
5
5
  }
package/dist/module.mjs CHANGED
@@ -84,7 +84,7 @@ const colors = {
84
84
  "danger-950": defaultColors.red["950"]
85
85
  };
86
86
  const fontColors = {
87
- "for-white-bg-font": colors["neutral-900"],
87
+ "for-white-bg-font": colors["neutral-600"],
88
88
  "for-black-bg-font": colors["neutral-100"],
89
89
  "neutral-50-font": colors["neutral-600"],
90
90
  "neutral-100-font": colors["neutral-600"],
@@ -329,6 +329,7 @@ const module = defineNuxtModule({
329
329
  const { resolve } = createResolver(import.meta.url);
330
330
  const runtimeDir = resolve("./runtime");
331
331
  nuxt.options.build.transpile.push(runtimeDir);
332
+ nuxt.options.alias["#ui-module"] = resolve(runtimeDir, "types");
332
333
  addPlugin(resolve(runtimeDir, "plugins/ui-module"));
333
334
  addImportsDir(resolve(runtimeDir, "composables"));
334
335
  await addComponentsDir({
@@ -24,21 +24,24 @@ function onClick() {
24
24
 
25
25
  <template>
26
26
  <div
27
- class="p-2.5 select-none cursor-pointer transition-colors"
28
- :class="{'bg-primary-500 text-primary-500-font': isOpen, 'bg-neutral-50 text-neutral-50-font': !isOpen}"
29
- @click="onClick"
27
+ class="p-2.5 select-none cursor-pointer transition-colors"
28
+ :class="{'bg-primary-500 text-primary-500-font': isOpen, 'bg-white text-for-white-bg-font': !isOpen}"
29
+ @click="onClick"
30
30
  >
31
- <slot name="label" v-bind="{ isOpen: isOpen }">
31
+ <slot
32
+ name="label"
33
+ v-bind="{ isOpen: isOpen }"
34
+ >
32
35
  <div
33
- class="hover:text-gray-800 flex justify-between items-center"
36
+ class="hover:text-gray-800 flex justify-between items-center"
34
37
  >
35
38
  <span class="text-sm font-semibold">
36
39
  {{ label }}
37
40
  </span>
38
41
 
39
42
  <AntIcon
40
- :icon="isOpen ? faAngleUp : faAngleDown"
41
- :color="isOpen ? 'text-primary-500-font' : undefined"
43
+ :icon="isOpen ? faAngleUp : faAngleDown"
44
+ :color="isOpen ? 'text-primary-500-font' : undefined"
42
45
  />
43
46
  </div>
44
47
  </slot>
@@ -46,17 +49,17 @@ function onClick() {
46
49
 
47
50
  <AntTransitionCollapseHeight>
48
51
  <div
49
- v-show="isOpen"
50
- class="bg-white overflow-hidden -mt-px"
52
+ v-show="isOpen"
53
+ class="bg-white overflow-hidden -mt-px"
51
54
  >
52
- <transition name="bounce">
55
+ <Transition name="bounce">
53
56
  <div
54
- v-show="isOpen"
55
- class="p-2.5 bg-neutral-50"
57
+ v-show="isOpen"
58
+ class="p-2.5 bg-white"
56
59
  >
57
- <slot/>
60
+ <slot />
58
61
  </div>
59
- </transition>
62
+ </Transition>
60
63
  </div>
61
64
  </AntTransitionCollapseHeight>
62
65
  </template>
@@ -52,25 +52,25 @@ function onClickOutside() {
52
52
 
53
53
  <template>
54
54
  <div
55
+ v-on-click-outside="onClickOutside"
55
56
  class="relative inline-flex justify-center items-end z-40"
56
57
  data-e2e="dropdown"
57
- v-on-click-outside="onClickOutside"
58
58
  >
59
- <slot/>
59
+ <slot />
60
60
 
61
- <transition name="bounce">
61
+ <Transition name="bounce">
62
62
  <div
63
63
  v-if="showDropdown"
64
64
  :class="_dropdownClasses"
65
65
  >
66
66
  <div
67
- class="shadow-lg border border-neutral-300 rounded-md text-sm relative inline-flex flex-col relative bg-neutral-50 text-neutral-50-font w-full"
67
+ class="shadow-lg border border-neutral-300 rounded-md text-sm relative inline-flex flex-col relative bg-white text-for-white-bg-font w-full"
68
68
  :class="{'p-2.5': contentPadding}"
69
69
  >
70
- <slot name="content"/>
70
+ <slot name="content" />
71
71
  </div>
72
72
  </div>
73
- </transition>
73
+ </Transition>
74
74
  </div>
75
75
  </template>
76
76
 
@@ -21,7 +21,7 @@ const classes = computed(() => {
21
21
  [ListGroupItemColorType.info]: 'bg-info-500 text-info-500-font',
22
22
  [ListGroupItemColorType.neutral700]: 'bg-neutral-700 text-neutral-700-font',
23
23
  [ListGroupItemColorType.neutral300]: 'bg-neutral-300 text-neutral-300-font',
24
- [ListGroupItemColorType.neutral50]: 'bg-neutral-50 text-neutral-50-font',
24
+ [ListGroupItemColorType.neutral50]: 'bg-white text-for-white-bg-font',
25
25
  [ListGroupItemColorType.primary]: 'bg-primary-500 text-primary-500-font',
26
26
  [ListGroupItemColorType.secondary]: 'bg-secondary-500 text-secondary-500-font',
27
27
  [ListGroupItemColorType.success]: 'bg-success-500 text-success-500-font',
@@ -39,7 +39,7 @@ const contentWrapperClasses = computed(() => {
39
39
  [ListGroupItemColorType.info]: 'text-info-500-font',
40
40
  [ListGroupItemColorType.neutral700]: 'text-neutral-700-font',
41
41
  [ListGroupItemColorType.neutral300]: 'text-neutral-300-font',
42
- [ListGroupItemColorType.neutral50]: 'text-neutral-50-font',
42
+ [ListGroupItemColorType.neutral50]: 'text-for-white-bg-font',
43
43
  [ListGroupItemColorType.primary]: 'text-primary-500-font',
44
44
  [ListGroupItemColorType.secondary]: 'text-secondary-500-font',
45
45
  [ListGroupItemColorType.success]: 'text-success-500-font',
@@ -60,21 +60,27 @@ onMounted(() => {
60
60
 
61
61
  <template>
62
62
  <component
63
- :is="to !== undefined ? 'router-link' : 'div'"
64
- :to="to"
65
- :class="classes"
63
+ :is="to !== undefined ? 'router-link' : 'div'"
64
+ :to="to"
65
+ :class="classes"
66
66
  >
67
67
  <div :class="contentWrapperClasses">
68
68
  <div class="flex items-center gap-2.5">
69
- <slot v-if="iconLeft" name="icon-left">
70
- <AntIcon :icon="iconLeft"/>
69
+ <slot
70
+ v-if="iconLeft"
71
+ name="icon-left"
72
+ >
73
+ <AntIcon :icon="iconLeft" />
71
74
  </slot>
72
75
 
73
- <slot/>
76
+ <slot />
74
77
  </div>
75
78
 
76
- <slot v-if="iconRight" name="icon-right">
77
- <AntIcon :icon="iconRight"/>
79
+ <slot
80
+ v-if="iconRight"
81
+ name="icon-right"
82
+ >
83
+ <AntIcon :icon="iconRight" />
78
84
  </slot>
79
85
  </div>
80
86
  </component>
@@ -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
 
@@ -42,7 +42,7 @@ const itemContainerClasses = computed(() => ({
42
42
  }));
43
43
  const contentClasses = computed(() => {
44
44
  const variants: Record<InputColorType, string> = {
45
- [InputColorType.base]: 'text-neutral-50-font bg-neutral-50 border-neutral-300',
45
+ [InputColorType.base]: 'text-for-white-bg-font bg-white border-neutral-300',
46
46
  [InputColorType.danger]: 'text-danger-500-font bg-danger-500 border-danger-500',
47
47
  [InputColorType.info]: 'text-info-500-font bg-info-500 border-info-500',
48
48
  [InputColorType.success]: 'text-success-500-font bg-success-500 border-success-500',
@@ -53,7 +53,7 @@ const contentClasses = computed(() => {
53
53
  });
54
54
  const svgPathClasses = computed(() => {
55
55
  const variants: Record<InputColorType, string> = {
56
- [InputColorType.base]: 'fill-neutral-50 stroke-neutral-50',
56
+ [InputColorType.base]: 'fill-white stroke-white',
57
57
  [InputColorType.danger]: 'fill-danger-500 stroke-danger-500',
58
58
  [InputColorType.info]: 'fill-info-500 stroke-info-500',
59
59
  [InputColorType.success]: 'fill-success-500 stroke-success-500',
@@ -9,10 +9,13 @@ import {ColorType, InputColorType} from '../../enums/ColorType.enum';
9
9
  import {Position} from '../../enums/Position.enum';
10
10
  import AntButton from './AntButton.vue';
11
11
  import AntTooltip from '../AntTooltip.vue';
12
+ import type {IconDefinition} from '@fortawesome/free-solid-svg-icons';
12
13
 
13
14
  defineEmits(['click', 'blur']);
14
15
  withDefaults(
15
16
  defineProps<{
17
+ iconLeft?: IconDefinition;
18
+ iconRight?: IconDefinition;
16
19
  size?: Size;
17
20
  disabled?: boolean;
18
21
  grouped?: Grouped;
@@ -38,6 +41,8 @@ withDefaults(
38
41
  >
39
42
  <slot name="button">
40
43
  <AntButton
44
+ :icon-left="iconLeft"
45
+ :icon-right="iconRight"
41
46
  :size="size"
42
47
  :disabled="disabled || !hasPermission"
43
48
  :grouped="grouped"
@@ -15,152 +15,152 @@ import {IconSize} from '../__types/AntIcon.types';
15
15
  defineEmits(['click', 'blur']);
16
16
 
17
17
  const props = withDefaults(defineProps<{
18
- filled?: boolean;
19
- size?: Size;
20
- colorType?: ColorType;
21
- iconLeft?: IconDefinition;
22
- iconRight?: IconDefinition;
23
- to?: RouteLocationRaw;
24
- disabled?: boolean;
25
- grouped?: Grouped;
26
- skeleton?: boolean;
27
- spinner?: boolean;
28
- readonly?: boolean;
29
- expanded?: boolean;
30
- submit?: boolean;
31
- outlined?: boolean;
32
- noFocus?: boolean;
18
+ filled?: boolean;
19
+ size?: Size;
20
+ colorType?: ColorType;
21
+ iconLeft?: IconDefinition;
22
+ iconRight?: IconDefinition;
23
+ to?: RouteLocationRaw;
24
+ disabled?: boolean;
25
+ grouped?: Grouped;
26
+ skeleton?: boolean;
27
+ spinner?: boolean;
28
+ readonly?: boolean;
29
+ expanded?: boolean;
30
+ submit?: boolean;
31
+ outlined?: boolean;
32
+ noFocus?: boolean;
33
33
  }>(), {
34
- colorType: ColorType.base,
35
- disabled: false,
36
- filled: false,
37
- skeleton: false,
38
- spinner: false,
39
- size: Size.md,
40
- grouped: Grouped.none,
41
- readonly: false,
42
- expanded: false,
43
- submit: false,
44
- outlined: true,
45
- noFocus: false,
34
+ colorType: ColorType.base,
35
+ disabled: false,
36
+ filled: false,
37
+ skeleton: false,
38
+ spinner: false,
39
+ size: Size.md,
40
+ grouped: Grouped.none,
41
+ readonly: false,
42
+ expanded: false,
43
+ submit: false,
44
+ outlined: true,
45
+ noFocus: false,
46
46
  });
47
47
 
48
48
  const hasAction = computed(() => (props.skeleton || props.readonly || props.disabled))
49
49
  const groupedClassList = computed(() => ({
50
- 'rounded-tl-md rounded-bl-md rounded-tr-none rounded-br-none -mr-px': props.grouped === Grouped.left,
51
- 'rounded-none -mx-px': props.grouped === Grouped.center,
52
- 'rounded-tl-none rounded-bl-none rounded-tr-md rounded-br-md -ml-px': props.grouped === Grouped.right,
53
- 'rounded-md': props.grouped === Grouped.none,
50
+ 'rounded-tl-md rounded-bl-md rounded-tr-none rounded-br-none -mr-px': props.grouped === Grouped.left,
51
+ 'rounded-none -mx-px': props.grouped === Grouped.center,
52
+ 'rounded-tl-none rounded-bl-none rounded-tr-md rounded-br-md -ml-px': props.grouped === Grouped.right,
53
+ 'rounded-md': props.grouped === Grouped.none,
54
54
  }));
55
55
  const classes = computed(() => {
56
- const variants = {
57
- [ColorType.base]: 'ring-primary-200 outline-neutral-300',
58
- [ColorType.danger]: 'ring-danger-200 outline-danger-500',
59
- [ColorType.info]: 'ring-info-200 outline-info-500',
60
- [ColorType.primary]: 'ring-primary-200 outline-primary-500',
61
- [ColorType.secondary]: 'ring-secondary-200 outline-secondary-500',
62
- [ColorType.success]: 'ring-success-200 outline-success-500',
63
- [ColorType.warning]: 'ring-warning-200 outline-warning-500',
64
- };
65
- const notFilledVariants = {
66
- [ColorType.base]: 'bg-white text-neutral-50-font',
67
- [ColorType.danger]: 'bg-white text-danger-500',
68
- [ColorType.info]: 'bg-white text-info-500',
69
- [ColorType.primary]: 'bg-white text-primary-500',
70
- [ColorType.secondary]: 'bg-white text-secondary-500',
71
- [ColorType.success]: 'bg-white text-success-500',
72
- [ColorType.warning]: 'bg-white text-warning-500',
73
- };
74
- const notFilledHoverVariants = {
75
- [ColorType.base]: 'hover:bg-neutral-100',
76
- [ColorType.danger]: 'hover:bg-danger-100',
77
- [ColorType.info]: 'hover:bg-info-100',
78
- [ColorType.primary]: 'hover:bg-primary-100',
79
- [ColorType.secondary]: 'hover:bg-secondary-100',
80
- [ColorType.success]: 'hover:bg-success-100',
81
- [ColorType.warning]: 'hover:bg-warning-100',
82
- };
83
- const filledVariants = {
84
- [ColorType.base]: 'bg-neutral-50 text-neutral-50-font',
85
- [ColorType.danger]: 'bg-danger-500 text-danger-500-font',
86
- [ColorType.info]: 'bg-info-500 text-info-500-font',
87
- [ColorType.primary]: 'bg-primary-500 text-primary-500-font',
88
- [ColorType.secondary]: 'bg-secondary-500 text-secondary-500-font',
89
- [ColorType.success]: 'bg-success-500 text-success-500-font',
90
- [ColorType.warning]: 'bg-warning-500 text-warning-500-font',
91
- };
92
- const filledHoverVariants = {
93
- [ColorType.base]: 'hover:bg-neutral-200',
94
- [ColorType.danger]: 'hover:bg-danger-600',
95
- [ColorType.info]: 'hover:bg-info-600',
96
- [ColorType.primary]: 'hover:bg-primary-600',
97
- [ColorType.secondary]: 'hover:bg-secondary-600',
98
- [ColorType.success]: 'hover:bg-success-600',
99
- [ColorType.warning]: 'hover:bg-warning-600',
100
- };
56
+ const variants = {
57
+ [ColorType.base]: 'ring-primary-200 outline-neutral-300',
58
+ [ColorType.danger]: 'ring-danger-200 outline-danger-500',
59
+ [ColorType.info]: 'ring-info-200 outline-info-500',
60
+ [ColorType.primary]: 'ring-primary-200 outline-primary-500',
61
+ [ColorType.secondary]: 'ring-secondary-200 outline-secondary-500',
62
+ [ColorType.success]: 'ring-success-200 outline-success-500',
63
+ [ColorType.warning]: 'ring-warning-200 outline-warning-500',
64
+ };
65
+ const notFilledVariants = {
66
+ [ColorType.base]: 'bg-white text-for-white-bg-font',
67
+ [ColorType.danger]: 'bg-white text-danger-500',
68
+ [ColorType.info]: 'bg-white text-info-500',
69
+ [ColorType.primary]: 'bg-white text-primary-500',
70
+ [ColorType.secondary]: 'bg-white text-secondary-500',
71
+ [ColorType.success]: 'bg-white text-success-500',
72
+ [ColorType.warning]: 'bg-white text-warning-500',
73
+ };
74
+ const notFilledHoverVariants = {
75
+ [ColorType.base]: 'hover:bg-neutral-100',
76
+ [ColorType.danger]: 'hover:bg-danger-100',
77
+ [ColorType.info]: 'hover:bg-info-100',
78
+ [ColorType.primary]: 'hover:bg-primary-100',
79
+ [ColorType.secondary]: 'hover:bg-secondary-100',
80
+ [ColorType.success]: 'hover:bg-success-100',
81
+ [ColorType.warning]: 'hover:bg-warning-100',
82
+ };
83
+ const filledVariants = {
84
+ [ColorType.base]: 'bg-neutral-50 text-neutral-50-font',
85
+ [ColorType.danger]: 'bg-danger-500 text-danger-500-font',
86
+ [ColorType.info]: 'bg-info-500 text-info-500-font',
87
+ [ColorType.primary]: 'bg-primary-500 text-primary-500-font',
88
+ [ColorType.secondary]: 'bg-secondary-500 text-secondary-500-font',
89
+ [ColorType.success]: 'bg-success-500 text-success-500-font',
90
+ [ColorType.warning]: 'bg-warning-500 text-warning-500-font',
91
+ };
92
+ const filledHoverVariants = {
93
+ [ColorType.base]: 'hover:bg-neutral-200',
94
+ [ColorType.danger]: 'hover:bg-danger-600',
95
+ [ColorType.info]: 'hover:bg-info-600',
96
+ [ColorType.primary]: 'hover:bg-primary-600',
97
+ [ColorType.secondary]: 'hover:bg-secondary-600',
98
+ [ColorType.success]: 'hover:bg-success-600',
99
+ [ColorType.warning]: 'hover:bg-warning-600',
100
+ };
101
101
 
102
- return {
103
- 'transition-all inline-flex items-center justify-center relative font-medium': true,
104
- 'focus:z-10': true,
105
- 'active:shadow-[inset_0_4px_4px_rgba(0,0,0,0.25)]': !hasAction.value,
106
- 'py-1.5 px-2.5 text-xs gap-1': props.size === Size.sm,
107
- 'py-2.5 px-3.5 text-sm gap-2.5': props.size === Size.md,
108
- 'disabled:opacity-50 disabled:cursor-not-allowed': true,
109
- 'cursor-default': props.readonly,
110
- 'focus:ring-2': !props.readonly && props.size === Size.sm,
111
- 'focus:ring-4': !props.readonly && props.size === Size.md,
112
- 'w-full': props.expanded,
113
- 'invisible': props.skeleton,
114
- 'outline outline-1 outline-offset-[-1px]': props.outlined,
115
- ...groupedClassList.value,
116
- [variants[props.colorType]]: true,
117
- [notFilledVariants[props.colorType]]: !props.filled,
118
- [notFilledHoverVariants[props.colorType]]: !props.filled && !hasAction.value,
119
- [filledVariants[props.colorType]]: props.filled,
120
- [filledHoverVariants[props.colorType]]: props.filled && !hasAction.value,
121
- };
102
+ return {
103
+ 'transition-all inline-flex items-center justify-center relative font-medium': true,
104
+ 'focus:z-10': true,
105
+ 'active:shadow-[inset_0_4px_4px_rgba(0,0,0,0.25)]': !hasAction.value,
106
+ 'py-1.5 px-2.5 text-xs gap-1': props.size === Size.sm,
107
+ 'py-2.5 px-3.5 text-sm gap-2.5': props.size === Size.md,
108
+ 'disabled:opacity-50 disabled:cursor-not-allowed': true,
109
+ 'cursor-default': props.readonly,
110
+ 'focus:ring-2': !props.readonly && props.size === Size.sm,
111
+ 'focus:ring-4': !props.readonly && props.size === Size.md,
112
+ 'w-full': props.expanded,
113
+ 'invisible': props.skeleton,
114
+ 'outline outline-1 outline-offset-[-1px]': props.outlined,
115
+ ...groupedClassList.value,
116
+ [variants[props.colorType]]: true,
117
+ [notFilledVariants[props.colorType]]: !props.filled,
118
+ [notFilledHoverVariants[props.colorType]]: !props.filled && !hasAction.value,
119
+ [filledVariants[props.colorType]]: props.filled,
120
+ [filledHoverVariants[props.colorType]]: props.filled && !hasAction.value,
121
+ };
122
122
  });
123
123
  const iconColor = computed(() => {
124
- const notFilledVariants = {
125
- [ColorType.base]: 'text-neutral-50-font',
126
- [ColorType.danger]: 'text-danger-500',
127
- [ColorType.info]: 'text-info-500',
128
- [ColorType.primary]: 'text-primary-500',
129
- [ColorType.secondary]: 'text-secondary-500',
130
- [ColorType.success]: 'text-success-500',
131
- [ColorType.warning]: 'text-warning-500',
132
- };
133
- const filledVariants = {
134
- [ColorType.base]: 'text-neutral-50-font',
135
- [ColorType.danger]: 'text-danger-500-font',
136
- [ColorType.info]: 'text-info-500-font',
137
- [ColorType.primary]: 'text-primary-500-font',
138
- [ColorType.secondary]: 'text-secondary-500-font',
139
- [ColorType.success]: 'text-success-500-font',
140
- [ColorType.warning]: 'text-warning-500-font',
141
- };
124
+ const notFilledVariants = {
125
+ [ColorType.base]: 'text-for-white-bg-font',
126
+ [ColorType.danger]: 'text-danger-500',
127
+ [ColorType.info]: 'text-info-500',
128
+ [ColorType.primary]: 'text-primary-500',
129
+ [ColorType.secondary]: 'text-secondary-500',
130
+ [ColorType.success]: 'text-success-500',
131
+ [ColorType.warning]: 'text-warning-500',
132
+ };
133
+ const filledVariants = {
134
+ [ColorType.base]: 'text-for-white-bg-font',
135
+ [ColorType.danger]: 'text-danger-500-font',
136
+ [ColorType.info]: 'text-info-500-font',
137
+ [ColorType.primary]: 'text-primary-500-font',
138
+ [ColorType.secondary]: 'text-secondary-500-font',
139
+ [ColorType.success]: 'text-success-500-font',
140
+ [ColorType.warning]: 'text-warning-500-font',
141
+ };
142
142
 
143
- return props.filled ? filledVariants[props.colorType] : notFilledVariants[props.colorType];
143
+ return props.filled ? filledVariants[props.colorType] : notFilledVariants[props.colorType];
144
144
  });
145
145
  const type = computed(() => {
146
- if (props.to !== undefined) {
147
- return undefined;
148
- }
146
+ if (props.to !== undefined) {
147
+ return undefined;
148
+ }
149
149
 
150
- return props.submit ? ButtonType.submit : ButtonType.button;
150
+ return props.submit ? ButtonType.submit : ButtonType.button;
151
151
  });
152
152
  const is = computed(() => {
153
- if (props.readonly) {
154
- return 'div';
155
- }
153
+ if (props.readonly) {
154
+ return 'div';
155
+ }
156
156
 
157
- return props.to !== undefined ? 'router-link' : 'button'
157
+ return props.to !== undefined ? 'router-link' : 'button'
158
158
  })
159
159
 
160
160
  onMounted(() => {
161
- handleEnumValidation(props.size, Size, 'size');
162
- handleEnumValidation(props.colorType, ColorType, 'colorType');
163
- handleEnumValidation(props.grouped, Grouped, 'grouped');
161
+ handleEnumValidation(props.size, Size, 'size');
162
+ handleEnumValidation(props.colorType, ColorType, 'colorType');
163
+ handleEnumValidation(props.grouped, Grouped, 'grouped');
164
164
  });
165
165
  </script>
166
166
 
@@ -20,6 +20,7 @@ withDefaults(defineProps<{
20
20
 
21
21
  <template>
22
22
  <AntActionButton
23
+ :filled="false"
23
24
  :size="size"
24
25
  :disabled="disabled"
25
26
  :grouped="grouped"
@@ -4,9 +4,11 @@ import {Size} from '../../enums/Size.enum';
4
4
  import {ColorType} from '../../enums/ColorType.enum';
5
5
  import AntActionButton from './AntActionButton.vue';
6
6
  import {Position} from '../../enums';
7
+ import {faTrash} from '@fortawesome/free-solid-svg-icons';
7
8
 
8
9
  defineEmits(['click', 'blur']);
9
10
  withDefaults(defineProps<{
11
+ iconVariant?: boolean;
10
12
  size?: Size;
11
13
  disabled?: boolean;
12
14
  grouped?: Grouped;
@@ -15,12 +17,15 @@ withDefaults(defineProps<{
15
17
  canDelete?: boolean;
16
18
  invalidPermissionTooltipPosition?: Position;
17
19
  }>(), {
20
+ iconVariant: false,
18
21
  canDelete: true
19
22
  })
20
23
  </script>
21
24
 
22
25
  <template>
23
26
  <AntActionButton
27
+ :icon-left="iconVariant ? faTrash : undefined"
28
+ :filled="false"
24
29
  :size="size"
25
30
  :disabled="disabled"
26
31
  :grouped="grouped"
@@ -33,7 +38,12 @@ withDefaults(defineProps<{
33
38
  @click="$emit('click')"
34
39
  @blur="$emit('blur')"
35
40
  >
36
- <template #default>Delete</template>
41
+ <template
42
+ v-if="!iconVariant"
43
+ #default
44
+ >
45
+ Delete
46
+ </template>
37
47
 
38
48
  <template #invalidPermissionTooltipContent>
39
49
  You have no permission to delete this entry.<br>