@antify/ui-module 1.3.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 (83) 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 +69 -63
  9. package/dist/runtime/components/__stories/AntTooltip.stories.d.ts +5 -0
  10. package/dist/runtime/components/__stories/AntTooltip.stories.mjs +33 -11
  11. package/dist/runtime/components/buttons/AntActionButton.vue +40 -13
  12. package/dist/runtime/components/buttons/AntButton.vue +126 -126
  13. package/dist/runtime/components/buttons/AntCreateButton.vue +21 -8
  14. package/dist/runtime/components/buttons/AntDeleteButton.vue +30 -8
  15. package/dist/runtime/components/buttons/AntDuplicateButton.vue +42 -0
  16. package/dist/runtime/components/buttons/AntSaveAndNewButton.vue +21 -8
  17. package/dist/runtime/components/buttons/AntSaveButton.vue +20 -8
  18. package/dist/runtime/components/buttons/__stories/AntActionButton.stories.d.ts +1 -0
  19. package/dist/runtime/components/buttons/__stories/AntActionButton.stories.mjs +25 -1
  20. package/dist/runtime/components/buttons/__stories/AntButton.stories.mjs +130 -130
  21. package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.d.ts +1 -0
  22. package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.mjs +11 -1
  23. package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.d.ts +2 -0
  24. package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.mjs +18 -1
  25. package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.d.ts +11 -0
  26. package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.mjs +67 -0
  27. package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.d.ts +1 -0
  28. package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +11 -1
  29. package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.d.ts +1 -0
  30. package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.mjs +11 -1
  31. package/dist/runtime/components/crud/AntCrud.vue +13 -10
  32. package/dist/runtime/components/crud/AntCrudDetail.vue +1 -1
  33. package/dist/runtime/components/crud/AntCrudDetailActions.vue +10 -3
  34. package/dist/runtime/components/crud/AntCrudDetailNav.vue +21 -15
  35. package/dist/runtime/components/crud/AntCrudTableFilter.vue +36 -34
  36. package/dist/runtime/components/crud/AntCrudTableNav.vue +15 -4
  37. package/dist/runtime/components/dialogs/AntDialog.vue +7 -7
  38. package/dist/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +1 -2
  39. package/dist/runtime/components/form/AntSelect.vue +57 -53
  40. package/dist/runtime/components/form/AntSwitch.vue +13 -10
  41. package/dist/runtime/components/form/AntSwitcher.vue +4 -4
  42. package/dist/runtime/components/form/AntTextarea.vue +6 -3
  43. package/dist/runtime/components/form/Elements/AntBaseInput.vue +45 -41
  44. package/dist/runtime/components/form/Elements/AntDropDown.vue +1 -1
  45. package/dist/runtime/components/layouts/AntNavLeftLayout.vue +4 -4
  46. package/dist/runtime/components/table/AntTable.vue +95 -73
  47. package/dist/runtime/components/table/AntTableSortButton.vue +16 -4
  48. package/dist/runtime/components/tabs/AntTabItem.vue +7 -4
  49. package/dist/runtime/tailwind.config.mjs +1 -1
  50. package/dist/runtime/utils.d.ts +6 -0
  51. package/dist/runtime/utils.mjs +21 -0
  52. package/package.json +1 -1
  53. package/src/runtime/components/AntAccordionItem.vue +17 -14
  54. package/src/runtime/components/AntDropdown.vue +6 -6
  55. package/src/runtime/components/AntListGroupItem.vue +16 -10
  56. package/src/runtime/components/AntModal.vue +10 -9
  57. package/src/runtime/components/AntPopover.vue +10 -8
  58. package/src/runtime/components/AntTooltip.vue +69 -63
  59. package/src/runtime/components/buttons/AntActionButton.vue +40 -13
  60. package/src/runtime/components/buttons/AntButton.vue +126 -126
  61. package/src/runtime/components/buttons/AntCreateButton.vue +21 -8
  62. package/src/runtime/components/buttons/AntDeleteButton.vue +30 -8
  63. package/src/runtime/components/buttons/AntDuplicateButton.vue +42 -0
  64. package/src/runtime/components/buttons/AntSaveAndNewButton.vue +21 -8
  65. package/src/runtime/components/buttons/AntSaveButton.vue +20 -8
  66. package/src/runtime/components/crud/AntCrud.vue +13 -10
  67. package/src/runtime/components/crud/AntCrudDetail.vue +1 -1
  68. package/src/runtime/components/crud/AntCrudDetailActions.vue +10 -3
  69. package/src/runtime/components/crud/AntCrudDetailNav.vue +21 -15
  70. package/src/runtime/components/crud/AntCrudTableFilter.vue +36 -34
  71. package/src/runtime/components/crud/AntCrudTableNav.vue +15 -4
  72. package/src/runtime/components/dialogs/AntDialog.vue +7 -7
  73. package/src/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +1 -2
  74. package/src/runtime/components/form/AntSelect.vue +57 -53
  75. package/src/runtime/components/form/AntSwitch.vue +13 -10
  76. package/src/runtime/components/form/AntSwitcher.vue +4 -4
  77. package/src/runtime/components/form/AntTextarea.vue +6 -3
  78. package/src/runtime/components/form/Elements/AntBaseInput.vue +45 -41
  79. package/src/runtime/components/form/Elements/AntDropDown.vue +1 -1
  80. package/src/runtime/components/layouts/AntNavLeftLayout.vue +4 -4
  81. package/src/runtime/components/table/AntTable.vue +95 -73
  82. package/src/runtime/components/table/AntTableSortButton.vue +16 -4
  83. package/src/runtime/components/tabs/AntTabItem.vue +7 -4
@@ -58,7 +58,7 @@ const icons = {
58
58
 
59
59
  const inputClasses = computed(() => {
60
60
  const variants: Record<InputColorType, string> = {
61
- [InputColorType.base]: 'outline-neutral-300 focus:outline-primary-500 focus:ring-primary/25 bg-neutral-50 placeholder:text-neutral-500',
61
+ [InputColorType.base]: 'outline-neutral-300 focus:outline-primary-500 focus:ring-primary/25 bg-white placeholder:text-neutral-500',
62
62
  [InputColorType.danger]: 'outline-danger-500 focus:outline-danger-500 focus:ring-danger/25 bg-danger-100 placeholder:text-danger-700',
63
63
  [InputColorType.info]: 'outline-info-500 focus:outline-info-500 focus:ring-info/25 bg-info-100 placeholder:text-info-700',
64
64
  [InputColorType.success]: 'outline-success-500 focus:outline-success-500 focus:ring-success/25 bg-success-100 placeholder:text-success-700',
@@ -66,7 +66,7 @@ const inputClasses = computed(() => {
66
66
  };
67
67
 
68
68
  return {
69
- 'transition-colors relative border-none outline w-full focus:z-10': true,
69
+ 'transition-colors relative border-none outline w-full focus:z-10 text-black': true,
70
70
  'outline-offset-[-1px] outline-1 focus:outline-offset-[-1px] focus:outline-1': true,
71
71
  'disabled:opacity-50 disabled:cursor-not-allowed': props.disabled,
72
72
  'text-right': props.type === BaseInputType.number,
@@ -90,21 +90,17 @@ const inputClasses = computed(() => {
90
90
  });
91
91
  const iconClasses = computed(() => ({
92
92
  'transition-[height]': true,
93
- 'h-4': props.size === Size.sm,
94
- 'h-5': props.size === Size.md,
95
93
  }));
96
- const iconColorClasses = computed(() => {
94
+ const iconColorClass = computed(() => {
97
95
  const variants: Record<InputColorType, string> = {
98
- [InputColorType.base]: 'text-neutral-500',
96
+ [InputColorType.base]: 'text-for-white-bg-font',
99
97
  [InputColorType.danger]: 'text-danger-500',
100
98
  [InputColorType.info]: 'text-info-500',
101
99
  [InputColorType.success]: 'text-success-500',
102
100
  [InputColorType.warning]: 'text-warning-500',
103
101
  };
104
102
 
105
- return {
106
- [variants[_colorType.value]]: true,
107
- };
103
+ return variants[_colorType.value];
108
104
  });
109
105
  const _wrapperClass = computed(() => classesToObjectSyntax(props.wrapperClass));
110
106
  const icon = computed(() => icons[_colorType.value]);
@@ -156,57 +152,65 @@ function onBlur(e: FocusEvent) {
156
152
  </script>
157
153
 
158
154
  <template>
159
- <div class="block relative w-full" :class="{...{'-mr-px': grouped !== Grouped.none}, ..._wrapperClass}">
155
+ <div
156
+ class="block relative w-full"
157
+ :class="{...{'-mr-px': grouped !== Grouped.none}, ..._wrapperClass}"
158
+ >
160
159
  <div
161
- v-if="iconLeft"
162
- class="absolute h-full flex items-center justify-center z-20"
163
- :class="{'w-7': size === Size.sm, 'w-10': size === Size.md}"
160
+ v-if="iconLeft"
161
+ class="absolute h-full flex items-center justify-center z-20"
162
+ :class="{'w-7': size === Size.sm, 'w-10': size === Size.md}"
164
163
  >
165
164
  <AntIcon
166
- :icon="iconLeft"
167
- :size="size as unknown as IconSize"
168
- color="text-neutral-50-font"
165
+ :icon="iconLeft"
166
+ :size="size as unknown as IconSize"
167
+ color="text-for-white-bg-font"
169
168
  />
170
169
  </div>
171
170
 
172
171
  <input
173
- v-model="_value"
174
- :class="inputClasses"
175
- :type="type"
176
- :placeholder="placeholder"
177
- :disabled="disabled || skeleton"
178
- @blur="onBlur"
179
- v-bind="$attrs"
172
+ v-model="_value"
173
+ :class="inputClasses"
174
+ :type="type"
175
+ :placeholder="placeholder"
176
+ :disabled="disabled || skeleton"
177
+ v-bind="$attrs"
178
+ @blur="onBlur"
180
179
  >
181
180
 
182
181
  <div
183
- v-if="nullable && _value !== null && _value !== ''"
184
- class="absolute flex w-fit right-0 top-0 h-full transition-all z-20"
185
- :class="{'p-1.5': size === Size.sm, 'p-2.5': size === Size.md}"
182
+ v-if="nullable && _value !== null && _value !== ''"
183
+ class="absolute flex w-fit right-0 top-0 h-full transition-all z-20"
184
+ :class="{'p-1.5': size === Size.sm, 'p-2.5': size === Size.md}"
186
185
  >
187
- <!-- TODO:: Replace with AntIcon -->
188
- <fa-icon
189
- :icon="faXmark"
190
- :class="iconClasses"
191
- class="text-neutral-500-font cursor-pointer"
192
- @click="() => _value = null"
186
+ <AntIcon
187
+ :icon="faXmark"
188
+ :class="iconClasses"
189
+ class="cursor-pointer"
190
+ :color="iconColorClass"
191
+ :size="size as unknown as IconSize"
192
+ @click="() => _value = null"
193
193
  />
194
194
  </div>
195
195
 
196
196
  <div
197
- v-else-if="showIcon && icon"
198
- class="absolute flex w-fit right-0 top-0 h-full transition-all z-20"
199
- :class="{'p-1.5': size === Size.sm, 'p-2.5': size === Size.md}"
197
+ v-else-if="showIcon && icon"
198
+ class="absolute flex w-fit right-0 top-0 h-full transition-all z-20"
199
+ :class="{'p-1.5': size === Size.sm, 'p-2.5': size === Size.md}"
200
200
  >
201
- <!-- TODO:: Replace with AntIcon -->
202
- <fa-icon :icon="icon" :class="{...iconClasses, ...iconColorClasses}"/>
201
+ <AntIcon
202
+ :icon="icon"
203
+ :color="iconColorClass"
204
+ :class="iconClasses"
205
+ :size="size as unknown as IconSize"
206
+ />
203
207
  </div>
204
208
 
205
209
  <AntSkeleton
206
- v-if="skeleton"
207
- absolute
208
- :grouped="grouped"
209
- rounded
210
+ v-if="skeleton"
211
+ absolute
212
+ :grouped="grouped"
213
+ rounded
210
214
  />
211
215
  </div>
212
216
  </template>
@@ -56,7 +56,7 @@ const dropdownClasses = computed(() => {
56
56
  });
57
57
  const dropDownItemClasses = computed(() => {
58
58
  const variants: Record<InputColorType, string> = {
59
- [InputColorType.base]: 'bg-neutral-50 text-neutral-50-font',
59
+ [InputColorType.base]: 'bg-white text-for-white-bg-font',
60
60
  [InputColorType.success]: 'bg-success-100 border-success-100-font',
61
61
  [InputColorType.info]: 'bg-info-100 border-info-100-font',
62
62
  [InputColorType.warning]: 'bg-warning-100 border-warning-100-font',
@@ -16,12 +16,12 @@ const hasLogoImageSlot = computed(() => useSlots()['logo-image'] || false);
16
16
  <div class="flex gap-px bg-neutral-300 h-screen overflow-hidden">
17
17
  <div class="flex flex-col gap-px bg-neutral-300 w-52 shrink-0">
18
18
  <component
19
- v-if="hasLogoImageSlot"
20
19
  :is="logoRoute ? 'RouterLink' : 'div'"
20
+ v-if="hasLogoImageSlot"
21
21
  :to="logoRoute"
22
- class="bg-neutral-50 min-h-[60px] flex justify-center items-center p-2.5"
22
+ class="bg-white min-h-[60px] flex justify-center items-center p-2.5"
23
23
  >
24
- <slot name="logo-image"/>
24
+ <slot name="logo-image" />
25
25
  </component>
26
26
 
27
27
  <AntNavbar
@@ -30,7 +30,7 @@ const hasLogoImageSlot = computed(() => useSlots()['logo-image'] || false);
30
30
  </div>
31
31
 
32
32
  <div class="flex-grow">
33
- <slot/>
33
+ <slot />
34
34
  </div>
35
35
  </div>
36
36
  </template>
@@ -95,81 +95,98 @@ function rowClick(elem: Record<string, unknown>): void {
95
95
  :class="{'h-full': data.length === 0 && !_loading}"
96
96
  >
97
97
  <thead class="bg-neutral-100 sticky top-0 z-10">
98
- <tr>
99
- <slot name="headerFirstCell"/>
100
-
101
- <template v-for="(header, index) in _headers">
102
- <AntTh
103
- v-if="!_showLightVersion || (_showLightVersion && header.lightVersion)"
104
- :key="`table-header-${header.identifier}-${index}`"
105
- :header="header"
106
- @sort="sortTable"
107
- >
108
- <template #headerContent>
109
- <slot name="headerContent" v-bind="header"/>
110
- </template>
111
- </AntTh>
112
- </template>
113
-
114
- <slot name="headerLastCell"></slot>
115
- </tr>
98
+ <tr>
99
+ <slot name="headerFirstCell" />
100
+
101
+ <template v-for="(header, index) in _headers">
102
+ <AntTh
103
+ v-if="!_showLightVersion || (_showLightVersion && header.lightVersion)"
104
+ :key="`table-header-${header.identifier}-${index}`"
105
+ :header="header"
106
+ @sort="sortTable"
107
+ >
108
+ <template #headerContent>
109
+ <slot
110
+ name="headerContent"
111
+ v-bind="header"
112
+ />
113
+ </template>
114
+ </AntTh>
115
+ </template>
116
+
117
+ <slot name="headerLastCell"></slot>
118
+ </tr>
116
119
  </thead>
117
120
 
118
121
  <tbody class="bg-white relative">
119
- <!-- TODO:: Add some kind of virtual list for very large tree data (or required pagination??) -->
120
- <tr
121
- v-for="(elem, index) in data"
122
- :key="`table-row-${elem[rowKey]}-${index}`"
123
- :id="elem[rowKey] as string"
124
- class="transition-all"
125
- :class="{
126
- 'bg-primary-300 text-primary-300-font': elem === selected,
127
- 'bg-neutral-50 text-neutral-50-font': elem !== selected && index % 2 === 0,
128
- 'bg-neutral-100 text-neutral-100-font': elem !== selected && index % 2 !== 0,
129
- 'cursor-pointer': selectableRows
130
- }"
131
- >
132
- <slot name="rowFirstCell" v-bind="{ elem }"/>
133
-
134
- <template v-for="(header, index) in _headers">
135
- <AntTd
136
- v-if="!_showLightVersion || (_showLightVersion && header.lightVersion)"
137
- :header="header"
138
- :element="elem"
139
- :align="header.align"
140
- :key="`table-cell-${header.identifier}-${index}`"
141
- @click="rowClick(elem)"
142
- >
143
- <template #beforeCellContent="props">
144
- <slot name="beforeCellContent" v-bind="props"/>
145
- </template>
146
-
147
- <template #cellContent="props">
148
- <slot name="cellContent" v-bind="props"/>
149
- </template>
150
-
151
- <template #afterCellContent="props">
152
- <slot name="afterCellContent" v-bind="props"/>
153
- </template>
154
- </AntTd>
155
- </template>
156
-
157
- <slot name="rowLastCell" v-bind="{ elem }"/>
158
- </tr>
159
-
160
- <tr v-if="data.length <= 0 && !_loading">
161
- <td
162
- colspan="100"
163
- class="w-full h-full py-2 text-center text-neutral-50-font text-lg"
122
+ <!-- TODO:: Add some kind of virtual list for very large tree data (or required pagination??) -->
123
+ <tr
124
+ v-for="(elem, index) in data"
125
+ :id="elem[rowKey] as string"
126
+ :key="`table-row-${elem[rowKey]}-${index}`"
127
+ class="transition-all"
128
+ :class="{
129
+ 'bg-primary-300 text-primary-300-font': elem === selected,
130
+ 'bg-white text-for-white-bg-font': elem !== selected && index % 2 === 0,
131
+ 'bg-neutral-100 text-neutral-100-font': elem !== selected && index % 2 !== 0,
132
+ 'cursor-pointer': selectableRows
133
+ }"
164
134
  >
165
- <slot name="emptyState">
166
- <div class="flex items-center flex-col">
167
- <span class="font-semibold">We couldn't find any entry</span>
168
- </div>
169
- </slot>
170
- </td>
171
- </tr>
172
-
135
+ <slot
136
+ name="rowFirstCell"
137
+ v-bind="{ elem }"
138
+ />
139
+
140
+ <template v-for="(header, index) in _headers">
141
+ <AntTd
142
+ v-if="!_showLightVersion || (_showLightVersion && header.lightVersion)"
143
+ :key="`table-cell-${header.identifier}-${index}`"
144
+ :header="header"
145
+ :element="elem"
146
+ :align="header.align"
147
+ @click="rowClick(elem)"
148
+ >
149
+ <template #beforeCellContent="props">
150
+ <slot
151
+ name="beforeCellContent"
152
+ v-bind="props"
153
+ />
154
+ </template>
155
+
156
+ <template #cellContent="props">
157
+ <slot
158
+ name="cellContent"
159
+ v-bind="props"
160
+ />
161
+ </template>
162
+
163
+ <template #afterCellContent="props">
164
+ <slot
165
+ name="afterCellContent"
166
+ v-bind="props"
167
+ />
168
+ </template>
169
+ </AntTd>
170
+ </template>
171
+
172
+ <slot
173
+ name="rowLastCell"
174
+ v-bind="{ elem }"
175
+ />
176
+ </tr>
177
+
178
+ <tr v-if="data.length <= 0 && !_loading">
179
+ <td
180
+ colspan="100"
181
+ class="w-full h-full py-2 text-center text-for-white-bg-font text-lg"
182
+ >
183
+ <slot name="emptyState">
184
+ <div class="flex items-center flex-col">
185
+ <span class="font-semibold">We couldn't find any entry</span>
186
+ </div>
187
+ </slot>
188
+ </td>
189
+ </tr>
173
190
  </tbody>
174
191
  </table>
175
192
  </div>
@@ -178,7 +195,10 @@ function rowClick(elem: Record<string, unknown>): void {
178
195
  v-if="data.length > 0 && _loading"
179
196
  class="absolute bg-opacity-50 w-full top-0 bottom-0 bg-neutral-300 flex items-center justify-center"
180
197
  >
181
- <AntSpinner class="!w-24 !h-24" :color-type="ColorType.primary"/>
198
+ <AntSpinner
199
+ class="!w-24 !h-24"
200
+ :color-type="ColorType.primary"
201
+ />
182
202
  </div>
183
203
 
184
204
  <div
@@ -186,7 +206,9 @@ function rowClick(elem: Record<string, unknown>): void {
186
206
  class="absolute bg-opacity-50 w-full top-[40px] bottom-0 bg-neutral-300 flex items-center justify-center"
187
207
  >
188
208
  <AntSkeleton
189
- v-model="_loading" absolute/>
209
+ v-model="_loading"
210
+ absolute
211
+ />
190
212
  </div>
191
213
  </div>
192
214
  </template>
@@ -16,11 +16,23 @@ withDefaults(
16
16
 
17
17
  <template>
18
18
  <button
19
- class="bg-neutral-50 text-neutral-50-font rounded h-[26px] w-[26px] flex items-center justify-center"
19
+ class="bg-white text-for-white-bg-font rounded h-[26px] w-[26px] flex items-center justify-center"
20
20
  @click="$emit('sortClick')"
21
21
  >
22
- <AntIcon v-if="sortDirection === AntTableSortDirection.asc" :icon="faAngleDown" :size="IconSize.sm"/>
23
- <AntIcon v-if="sortDirection === AntTableSortDirection.desc" :icon="faAngleUp" :size="IconSize.sm"/>
24
- <AntIcon v-if="sortDirection === AntTableSortDirection.neutral" :icon="faMinus" :size="IconSize.sm"/>
22
+ <AntIcon
23
+ v-if="sortDirection === AntTableSortDirection.asc"
24
+ :icon="faAngleDown"
25
+ :size="IconSize.sm"
26
+ />
27
+ <AntIcon
28
+ v-if="sortDirection === AntTableSortDirection.desc"
29
+ :icon="faAngleUp"
30
+ :size="IconSize.sm"
31
+ />
32
+ <AntIcon
33
+ v-if="sortDirection === AntTableSortDirection.neutral"
34
+ :icon="faMinus"
35
+ :size="IconSize.sm"
36
+ />
25
37
  </button>
26
38
  </template>
@@ -52,13 +52,13 @@ const containerClasses = computed(() => {
52
52
  [ColorType.danger]: 'text-danger-500 border-danger-500',
53
53
  };
54
54
  const notActiveVariants: Record<ColorType, string> = {
55
- [ColorType.base]: 'text-neutral-50-font border-neutral-50',
55
+ [ColorType.base]: 'text-for-white-bg-font border-white',
56
56
  [ColorType.warning]: 'text-warning-500',
57
57
  [ColorType.danger]: 'text-danger-500',
58
58
  };
59
59
 
60
60
  return {
61
- 'p-2.5 hover:cursor-pointer text-center flex items-center justify-center gap-2.5 bg-neutral-50 transition-[background-color] relative': true,
61
+ 'p-2.5 hover:cursor-pointer text-center flex items-center justify-center gap-2.5 bg-white transition-[background-color] relative': true,
62
62
  'grow': props.expanded,
63
63
  [variants[props.colorType]]: true,
64
64
  [activeVariants[props.colorType]]: _active.value,
@@ -98,7 +98,7 @@ const iconColor = computed(() => {
98
98
  <AntIcon
99
99
  v-if="icon"
100
100
  :icon="icon"
101
- :color="_active ? 'text-primary-500' : 'text-neutral-50-font'"
101
+ :color="_active ? 'text-primary-500' : 'text-for-white-bg-font'"
102
102
  />
103
103
  </slot>
104
104
 
@@ -110,6 +110,9 @@ const iconColor = computed(() => {
110
110
  :color="iconColor"
111
111
  />
112
112
 
113
- <div v-if="_active" :class="borderBoxClasses" />
113
+ <div
114
+ v-if="_active"
115
+ :class="borderBoxClasses"
116
+ />
114
117
  </component>
115
118
  </template>
@@ -82,7 +82,7 @@ const colors = {
82
82
  "danger-950": defaultColors.red["950"]
83
83
  };
84
84
  const fontColors = {
85
- "for-white-bg-font": colors["neutral-900"],
85
+ "for-white-bg-font": colors["neutral-600"],
86
86
  "for-black-bg-font": colors["neutral-100"],
87
87
  "neutral-50-font": colors["neutral-600"],
88
88
  "neutral-100-font": colors["neutral-600"],
@@ -1,3 +1,4 @@
1
+ import type { Slot } from 'vue';
1
2
  /**
2
3
  * Convert html class syntax given as undefined, string ("text-base bg-primary-500") or
3
4
  * object syntax ({"text-base bg-primary-500": true}) always to object syntax ({"text-base bg-primary-500": true}).
@@ -12,3 +13,8 @@ export declare function classesToObjectSyntax(classes: string | undefined | Reco
12
13
  * @param className
13
14
  */
14
15
  export declare function enumToPlainText(value: object, className: string): string;
16
+ /**
17
+ * Detect if the given vue template slot exists and has content.
18
+ * To get a slot in your component, call $slots['slotName'] or useSlots()['slotName'].
19
+ */
20
+ export declare function hasSlotContent(slot: Slot<any> | undefined): boolean;
@@ -1,3 +1,4 @@
1
+ import { Fragment } from "vue";
1
2
  export function classesToObjectSyntax(classes) {
2
3
  if (typeof classes === "object") {
3
4
  return classes;
@@ -18,3 +19,23 @@ export function enumToPlainText(value, className) {
18
19
  });
19
20
  return text + "}";
20
21
  }
22
+ export function hasSlotContent(slot) {
23
+ if (!slot) {
24
+ return false;
25
+ }
26
+ const isVnodeEmpty = (vnodes) => {
27
+ return vnodes.every((node) => {
28
+ if (node.type === Comment) {
29
+ return true;
30
+ }
31
+ if (node.type === Text && typeof node.children === "string" && !node.children.trim()) {
32
+ return true;
33
+ }
34
+ if (node.type === Fragment && isVnodeEmpty(node.children)) {
35
+ return true;
36
+ }
37
+ return false;
38
+ });
39
+ };
40
+ return !isVnodeEmpty(slot());
41
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antify/ui-module",
3
3
  "private": false,
4
- "version": "1.3.0",
4
+ "version": "1.5.0",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "exports": {
@@ -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>