@antify/ui-module 1.7.2 → 1.7.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 (60) hide show
  1. package/dist/module.d.mts +1 -9
  2. package/dist/module.d.ts +1 -9
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +1 -13
  5. package/dist/runtime/components/crud/AntCrudDetailNav.vue +1 -1
  6. package/dist/runtime/components/dialogs/AntDialog.vue +1 -1
  7. package/dist/runtime/components/forms/AntField.vue +3 -3
  8. package/dist/runtime/components/inputs/AntCheckbox.vue +18 -19
  9. package/dist/runtime/components/inputs/AntCheckboxGroup.vue +4 -4
  10. package/dist/runtime/components/inputs/AntDateInput.vue +8 -1
  11. package/dist/runtime/components/inputs/AntNumberInput.vue +5 -0
  12. package/dist/runtime/components/inputs/AntRadio.vue +45 -31
  13. package/dist/runtime/components/inputs/AntRadioGroup.vue +19 -8
  14. package/dist/runtime/components/inputs/AntSearch.vue +3 -0
  15. package/dist/runtime/components/inputs/AntSelect.vue +13 -5
  16. package/dist/runtime/components/inputs/AntSwitch.vue +1 -1
  17. package/dist/runtime/components/inputs/AntTagInput.vue +18 -10
  18. package/dist/runtime/components/inputs/AntTextInput.vue +3 -0
  19. package/dist/runtime/components/inputs/AntTextarea.vue +11 -5
  20. package/dist/runtime/components/inputs/AntUnitInput.vue +3 -0
  21. package/dist/runtime/components/inputs/Elements/AntBaseInput.vue +22 -7
  22. package/dist/runtime/components/inputs/Elements/AntInputLabel.vue +2 -5
  23. package/dist/runtime/components/inputs/__stories/AntCheckbox.stories.mjs +49 -8
  24. package/dist/runtime/components/inputs/__stories/AntCheckboxGroup.stories.mjs +2 -3
  25. package/dist/runtime/components/inputs/__stories/AntNumberInput.stories.d.ts +1 -0
  26. package/dist/runtime/components/inputs/__stories/AntNumberInput.stories.mjs +141 -1
  27. package/dist/runtime/components/inputs/__stories/AntRadioGroup.stories.mjs +14 -6
  28. package/dist/runtime/components/inputs/__types/AntCheckbox.types.d.ts +0 -4
  29. package/dist/runtime/components/inputs/__types/AntCheckbox.types.mjs +0 -5
  30. package/dist/runtime/components/inputs/__types/AntRadio.types.d.ts +0 -4
  31. package/dist/runtime/components/inputs/__types/AntRadio.types.mjs +0 -5
  32. package/dist/runtime/components/table/AntTable.vue +3 -3
  33. package/dist/runtime/components/table/AntTableSortButton.vue +1 -1
  34. package/dist/runtime/components/table/AntTd.vue +1 -1
  35. package/dist/runtime/components/table/AntTh.vue +9 -5
  36. package/dist/types.d.mts +1 -1
  37. package/dist/types.d.ts +1 -1
  38. package/package.json +1 -1
  39. package/src/runtime/components/crud/AntCrudDetailNav.vue +1 -1
  40. package/src/runtime/components/dialogs/AntDialog.vue +1 -1
  41. package/src/runtime/components/forms/AntField.vue +3 -3
  42. package/src/runtime/components/inputs/AntCheckbox.vue +18 -19
  43. package/src/runtime/components/inputs/AntCheckboxGroup.vue +4 -4
  44. package/src/runtime/components/inputs/AntDateInput.vue +8 -1
  45. package/src/runtime/components/inputs/AntNumberInput.vue +5 -0
  46. package/src/runtime/components/inputs/AntRadio.vue +45 -31
  47. package/src/runtime/components/inputs/AntRadioGroup.vue +19 -8
  48. package/src/runtime/components/inputs/AntSearch.vue +3 -0
  49. package/src/runtime/components/inputs/AntSelect.vue +13 -5
  50. package/src/runtime/components/inputs/AntSwitch.vue +1 -1
  51. package/src/runtime/components/inputs/AntTagInput.vue +18 -10
  52. package/src/runtime/components/inputs/AntTextInput.vue +3 -0
  53. package/src/runtime/components/inputs/AntTextarea.vue +11 -5
  54. package/src/runtime/components/inputs/AntUnitInput.vue +3 -0
  55. package/src/runtime/components/inputs/Elements/AntBaseInput.vue +22 -7
  56. package/src/runtime/components/inputs/Elements/AntInputLabel.vue +2 -5
  57. package/src/runtime/components/table/AntTable.vue +3 -3
  58. package/src/runtime/components/table/AntTableSortButton.vue +1 -1
  59. package/src/runtime/components/table/AntTd.vue +1 -1
  60. package/src/runtime/components/table/AntTh.vue +9 -5
@@ -25,6 +25,7 @@ const props = withDefaults(
25
25
  size?: AntTagInputSize;
26
26
  state?: InputState;
27
27
  disabled?: boolean;
28
+ readonly?: boolean;
28
29
  skeleton?: boolean;
29
30
  name?: string;
30
31
  expanded?: boolean;
@@ -46,6 +47,9 @@ const props = withDefaults(
46
47
  allowCreate: false,
47
48
  allowDuplicates: false,
48
49
  openOnFocus: true,
50
+ readonly: false,
51
+ disabled: false,
52
+ skeleton: false,
49
53
  autoCloseAfterSelection: false,
50
54
  placeholder: 'Add new tag'
51
55
  }
@@ -54,13 +58,14 @@ const props = withDefaults(
54
58
  const _modelValue: Ref<(string | number)[] | null> = useVModel(props, 'modelValue', emit);
55
59
  const _skeleton = useVModel(props, 'skeleton', emit);
56
60
  const dropDownOpen = ref(false);
61
+ const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
57
62
  const focusedDropDownItem: Ref<string | number | null> = ref(null);
58
63
  const tagInput = ref('');
59
64
  const filteredOptions = ref(props.options);
60
65
  const inputRef: Ref<HTMLElement | null> = ref(null);
61
66
  const inputContainerClasses = computed(() => {
62
67
  const variants: Record<InputState, string> = {
63
- [InputState.base]: 'outline-neutral-300 focus-within:outline-primary-500 focus-within:ring-primary-200 bg-white',
68
+ [InputState.base]: 'outline-neutral-300 focus-within:outline-neutral-300 focus-within:ring-primary-200 bg-white',
64
69
  [InputState.danger]: 'outline-danger-500 focus-within:outline-danger-500 focus-within:ring-danger-200 bg-danger-100',
65
70
  [InputState.info]: 'outline-info-500 focus-within:outline-info-500 focus-within:ring-info-200 bg-info-100',
66
71
  [InputState.success]: 'outline-success-500 focus-within:outline-success-500 focus-within:ring-success-200 bg-success-100',
@@ -73,16 +78,18 @@ const inputContainerClasses = computed(() => {
73
78
  'outline-offset-[-1px] outline-1 focus-within:outline-offset-[-1px] focus-within:outline-1': true,
74
79
  'opacity-50 cursor-not-allowed': props.disabled,
75
80
  [variants[props.state]]: true,
76
- // Size
77
- 'focus-within:ring-2 p-1.5 text-sm': props.size === AntTagInputSize.sm,
78
- 'focus-within:ring-4 p-2 text-sm': props.size === AntTagInputSize.md,
79
- 'focus-within:ring-4 p-2.5 text-sm': props.size === AntTagInputSize.lg,
81
+ // AntTagInputSize
82
+ 'p-1.5 text-sm': props.size === AntTagInputSize.sm,
83
+ 'p-2 text-sm': props.size === AntTagInputSize.md,
84
+ 'p-2.5 text-sm': props.size === AntTagInputSize.lg,
85
+ 'focus-within:ring-2': !hasInputState.value && props.size === AntTagInputSize.sm,
86
+ 'focus-within:ring-4': !hasInputState.value && (props.size === AntTagInputSize.lg || props.size === AntTagInputSize.md),
80
87
  // Grouping
81
88
  'rounded-tl-md rounded-bl-md rounded-tr-none rounded-br-none': props.grouped === Grouped.left,
82
89
  'rounded-none': props.grouped === Grouped.center,
83
90
  'rounded-tl-none rounded-bl-none rounded-tr-md rounded-br-md': props.grouped === Grouped.right,
84
91
  'rounded-md': props.grouped === Grouped.none,
85
- 'rounded-bl-none rounded-br-none': dropDownOpen.value && (!props.options || props.options.length > 0),
92
+ 'rounded-bl-none rounded-br-none': dropDownOpen.value && (!props.options || props.options.length > 0) && !props.readonly,
86
93
  'invisible': props.skeleton,
87
94
  };
88
95
  });
@@ -178,7 +185,7 @@ function removeLastTag() {
178
185
  }
179
186
 
180
187
  function removeTag(tag: string | number) {
181
- if (_modelValue.value && !props.disabled && !props.skeleton) {
188
+ if (_modelValue.value && !props.disabled && !props.skeleton && !props.readonly) {
182
189
  _modelValue.value.splice(_modelValue.value.findIndex((_value) => _value === tag), 1);
183
190
 
184
191
  filterDropDown();
@@ -246,7 +253,7 @@ onMounted(() => {
246
253
  <template>
247
254
  <AntField
248
255
  :label="label"
249
- :size="Size.sm"
256
+ :size="size as unknown as Size"
250
257
  :skeleton="_skeleton"
251
258
  :description="description"
252
259
  :state="state"
@@ -276,7 +283,7 @@ onMounted(() => {
276
283
  :key="`tag-input-tag-${index}`"
277
284
  :size="AntTagSize.xs3"
278
285
  :state="state as unknown as TagState"
279
- :dismiss="true"
286
+ :dismiss="!readonly"
280
287
  @close="removeTag(tag)"
281
288
  >
282
289
  {{ options.find((option: SelectOption) => option.value === tag)?.label }}
@@ -297,6 +304,7 @@ onMounted(() => {
297
304
  :placeholder="placeholder"
298
305
  :class="inputClasses"
299
306
  :disabled="disabled"
307
+ :readonly="readonly"
300
308
  @focus="changeFocus"
301
309
  @input="filterDropDown"
302
310
  @keydown.delete="removeLastTag"
@@ -307,7 +315,7 @@ onMounted(() => {
307
315
  </div>
308
316
 
309
317
  <AntDropDown
310
- v-if="filteredOptions && !disabled"
318
+ v-if="filteredOptions && !disabled && !readonly"
311
319
  ref="dropDownRef"
312
320
  v-model:focused="focusedDropDownItem"
313
321
  v-model:open="dropDownOpen"
@@ -20,6 +20,7 @@ const props = withDefaults(defineProps<{
20
20
  size?: Size;
21
21
  state?: InputState;
22
22
  disabled?: boolean;
23
+ readonly?: boolean;
23
24
  skeleton?: boolean;
24
25
  type?: TextInputType;
25
26
  limiter?: boolean;
@@ -28,6 +29,7 @@ const props = withDefaults(defineProps<{
28
29
  }>(), {
29
30
  state: InputState.base,
30
31
  disabled: false,
32
+ readonly: false,
31
33
  skeleton: false,
32
34
  size: Size.md,
33
35
  type: TextInputType.text,
@@ -63,6 +65,7 @@ onMounted(() => {
63
65
  :size="size"
64
66
  :skeleton="skeleton"
65
67
  :disabled="disabled"
68
+ :readonly="readonly"
66
69
  :placeholder="placeholder !== undefined ? placeholder : label"
67
70
  :show-icon="true"
68
71
  v-bind="$attrs"
@@ -25,6 +25,7 @@ const props = withDefaults(defineProps<{
25
25
  size?: Size;
26
26
  state?: InputState;
27
27
  disabled?: boolean;
28
+ readonly?: boolean;
28
29
  skeleton?: boolean;
29
30
  grouped?: Grouped;
30
31
  wrapperClass?: string | Record<string, boolean>;
@@ -38,6 +39,7 @@ const props = withDefaults(defineProps<{
38
39
  }>(), {
39
40
  state: InputState.base,
40
41
  disabled: false,
42
+ readonly: false,
41
43
  size: Size.md,
42
44
  skeleton: false,
43
45
  grouped: Grouped.none,
@@ -46,6 +48,7 @@ const props = withDefaults(defineProps<{
46
48
  messages: () => []
47
49
  });
48
50
  const _modelValue = useVModel(props, 'modelValue', emit);
51
+ const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
49
52
  const icons = {
50
53
  [InputState.info]: faCircleInfo,
51
54
  [InputState.warning]: faExclamationTriangle,
@@ -69,11 +72,13 @@ const inputClasses = computed(() => {
69
72
  'disabled:opacity-50 disabled:cursor-not-allowed': props.disabled,
70
73
  [variants[props.state]]: true,
71
74
  // Size
72
- 'focus:ring-2 p-1 text-xs': props.size === Size.xs2,
73
- 'focus:ring-2 p-1.5 text-xs': props.size === Size.xs,
74
- 'focus:ring-2 p-1.5 text-sm': props.size === Size.sm,
75
- 'focus:ring-4 p-2 text-sm': props.size === Size.md,
76
- 'focus:ring-4 p-2.5 text-sm': props.size === Size.lg,
75
+ 'p-1 text-xs': props.size === Size.xs2,
76
+ 'p-1.5 text-xs': props.size === Size.xs,
77
+ 'p-1.5 text-sm': props.size === Size.sm,
78
+ 'p-2 text-sm': props.size === Size.md,
79
+ 'p-2.5 text-sm': props.size === Size.lg,
80
+ 'focus:ring-2': !hasInputState.value && (props.size === Size.sm || props.size === Size.xs || props.size === Size.xs2),
81
+ 'focus:ring-4': !hasInputState.value && (props.size === Size.lg || props.size === Size.md),
77
82
  // Icon right
78
83
  'pr-6': props.size === Size.xs2 && props.showIcon && icon.value,
79
84
  'pr-7': props.size === Size.xs && props.showIcon && icon.value,
@@ -158,6 +163,7 @@ function onBlur(e: FocusEvent) {
158
163
  :class="inputClasses"
159
164
  :placeholder="placeholder !== undefined ? placeholder : label"
160
165
  :disabled="disabled || skeleton"
166
+ :readonly="readonly"
161
167
  v-bind="$attrs"
162
168
  @blur="onBlur"
163
169
  />
@@ -25,12 +25,14 @@ const props = withDefaults(defineProps<{
25
25
  size?: Size;
26
26
  state?: InputState;
27
27
  disabled?: boolean;
28
+ readonly?: boolean;
28
29
  skeleton?: boolean;
29
30
  wrapperClass?: string | Record<string, boolean>;
30
31
  messages?: string[];
31
32
  }>(), {
32
33
  state: InputState.base,
33
34
  disabled: false,
35
+ readonly: false,
34
36
  skeleton: false,
35
37
  size: Size.md,
36
38
  limiter: false,
@@ -70,6 +72,7 @@ onMounted(() => {
70
72
  :max="max"
71
73
  :skeleton="skeleton"
72
74
  :disabled="disabled"
75
+ :readonly="readonly"
73
76
  :placeholder="placeholder || label"
74
77
  :show-icon="false"
75
78
  v-bind="$attrs"
@@ -26,6 +26,7 @@ const props = withDefaults(defineProps<{
26
26
  size?: Size;
27
27
  state?: InputState;
28
28
  disabled?: boolean;
29
+ readonly?: boolean;
29
30
  placeholder?: string;
30
31
  skeleton?: boolean;
31
32
  type?: BaseInputType;
@@ -38,6 +39,7 @@ const props = withDefaults(defineProps<{
38
39
  }>(), {
39
40
  state: InputState.base,
40
41
  disabled: false,
42
+ readonly: false,
41
43
  size: Size.md,
42
44
  skeleton: false,
43
45
  type: BaseInputType.text,
@@ -48,6 +50,7 @@ const props = withDefaults(defineProps<{
48
50
  inputRef: null
49
51
  });
50
52
  const slot = useSlots();
53
+ const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
51
54
  const icons = {
52
55
  [InputState.info]: faCircleInfo,
53
56
  [InputState.warning]: faExclamationTriangle,
@@ -71,11 +74,14 @@ const inputClasses = computed(() => {
71
74
  'text-right': props.type === BaseInputType.number,
72
75
  [variants[props.state]]: true,
73
76
  // Size
74
- 'focus:ring-2 p-1 text-xs': props.size === Size.xs2,
75
- 'focus:ring-2 p-1.5 text-xs': props.size === Size.xs,
76
- 'focus:ring-2 p-1.5 text-sm': props.size === Size.sm,
77
- 'focus:ring-4 p-2 text-sm': props.size === Size.md,
78
- 'focus:ring-4 p-2.5 text-sm': props.size === Size.lg,
77
+ 'p-1 text-xs': props.size === Size.xs2,
78
+ 'p-1.5 text-xs': props.size === Size.xs,
79
+ 'p-1.5 text-sm': props.size === Size.sm,
80
+ 'p-2 text-sm': props.size === Size.md,
81
+ 'p-2.5 text-sm': props.size === Size.lg,
82
+ 'focus:ring-2': !hasInputState.value && (props.size === Size.sm || props.size === Size.xs || props.size === Size.xs2),
83
+ 'focus:ring-4': !hasInputState.value && (props.size === Size.lg || props.size === Size.md),
84
+
79
85
  // Icon left
80
86
  'pl-6': props.size === Size.xs2 && props.iconLeft,
81
87
  'pl-7': props.size === Size.sm && props.iconLeft || props.size === Size.xs && props.iconLeft,
@@ -197,7 +203,14 @@ function onClickClearIcon() {
197
203
  <div
198
204
  v-if="iconLeft"
199
205
  class="absolute h-full flex items-center justify-center z-20"
200
- :class="{'w-6': size === Size.xs2, 'w-7': size === Size.xs || size === Size.sm, 'w-8': size === Size.md, 'w-9': size === Size.lg}"
206
+ :class="{
207
+ 'w-6': size === Size.xs2,
208
+ 'w-7': size === Size.sm,
209
+ 'w-8': size === Size.xs,
210
+ 'w-9': size === Size.md,
211
+ 'w-10': size === Size.lg,
212
+ 'opacity-50': disabled,
213
+ }"
201
214
  >
202
215
  <AntIcon
203
216
  :icon="iconLeft"
@@ -213,6 +226,8 @@ function onClickClearIcon() {
213
226
  :type="type"
214
227
  :placeholder="placeholder"
215
228
  :disabled="disabled || skeleton"
229
+ :readonly="readonly"
230
+ :tabindex="hasInputState ? -1 : 0"
216
231
  v-bind="$attrs"
217
232
  @blur="onBlur"
218
233
  >
@@ -220,7 +235,7 @@ function onClickClearIcon() {
220
235
  <div
221
236
  v-if="(nullable && _modelValue !== null && _modelValue !== '') || (showIcon && icon) || hasSlotContent(slot['icon-right'])"
222
237
  class="absolute h-full flex items-center justify-center right-0 top-0 transition-all z-20"
223
- :class="{'w-6': size === Size.xs2, 'w-7': size === Size.xs || size === Size.sm, 'w-8': size === Size.md, 'w-9': size === Size.lg}"
238
+ :class="{'w-6': size === Size.xs2, 'w-7': size === Size.xs2, 'w-8': size === Size.sm, 'w-9': size === Size.md, 'w-10': size === Size.lg}"
224
239
  >
225
240
  <slot name="icon-right">
226
241
  <AntIcon
@@ -17,11 +17,8 @@ const props = withDefaults(defineProps<{
17
17
 
18
18
  const fontClasses = computed(() => ({
19
19
  'relative font-medium w-fit text-for-white-bg-font': true,
20
- 'text-2xs': props.size === Size.xs2,
21
- 'text-xs': props.size === Size.xs,
22
- 'text-sm': props.size === Size.sm,
23
- 'text-md': props.size === Size.md,
24
- 'text-lg': props.size === Size.lg
20
+ 'text-xs': props.size === Size.xs || props.size === Size.xs2,
21
+ 'text-sm': props.size === Size.lg || props.size === Size.md || props.size === Size.sm,
25
22
  }));
26
23
  const gapSize = computed(() => ({
27
24
  'gap-2.5': props.size === Size.lg,
@@ -27,7 +27,7 @@ const props = withDefaults(
27
27
  loading?: boolean;
28
28
  selectableRows?: boolean;
29
29
  showLightVersion?: boolean;
30
- size: AntTableSize
30
+ size?: AntTableSize
31
31
  }>(), {
32
32
  rowKey: 'id',
33
33
  loading: false,
@@ -96,7 +96,7 @@ function rowClick(elem: Record<string, unknown>): void {
96
96
  class="min-w-full max-h-full relative"
97
97
  :class="{'h-full': data.length === 0 && !_loading}"
98
98
  >
99
- <thead class="bg-neutral-100 sticky top-0 z-10">
99
+ <thead class="bg-neutral-200 sticky top-0 z-10">
100
100
  <tr>
101
101
  <slot name="headerFirstCell" />
102
102
 
@@ -129,7 +129,7 @@ function rowClick(elem: Record<string, unknown>): void {
129
129
  :key="`table-row-${elem[rowKey]}-${index}`"
130
130
  class="transition-all"
131
131
  :class="{
132
- 'bg-primary-300 text-primary-300-font': elem === selected,
132
+ 'bg-primary-200 text-primary-200-font': elem === selected,
133
133
  'bg-white text-for-white-bg-font': elem !== selected && index % 2 === 0,
134
134
  'bg-neutral-100 text-neutral-100-font': elem !== selected && index % 2 !== 0,
135
135
  'cursor-pointer': selectableRows
@@ -10,7 +10,7 @@ defineEmits(['sortClick']);
10
10
  const props = withDefaults(
11
11
  defineProps<{
12
12
  sortDirection?: AntTableSortDirection
13
- size: AntTableSize
13
+ size?: AntTableSize
14
14
  }>(), {
15
15
  sortDirection: AntTableSortDirection.neutral,
16
16
  size: AntTableSize.md
@@ -10,7 +10,7 @@ const props =
10
10
  element: Record<string, unknown>;
11
11
  header: TableHeader;
12
12
  align?: AntTableAlign
13
- size: AntTableSize
13
+ size?: AntTableSize
14
14
  }>(), {
15
15
  align: AntTableAlign.left,
16
16
  size: AntTableSize.md
@@ -5,14 +5,18 @@ import {computed, ref, type Ref} from 'vue';
5
5
  import AntTableSortButton from './AntTableSortButton.vue';
6
6
 
7
7
  defineEmits([ 'sort' ]);
8
- const props = defineProps<{
9
- header: TableHeader
10
- size: AntTableSize
11
- }>();
8
+ const props = withDefaults(
9
+ defineProps<{
10
+ header: TableHeader
11
+ size?: AntTableSize
12
+ }>(), {
13
+ size: AntTableSize.md
14
+ }
15
+ );
12
16
 
13
17
  const headerClasses = computed(() => ({
14
18
  [props.header.headerClassList || '']: true,
15
- 'text-sm text-neutral-100-font uppercase font-semi-bold': true,
19
+ 'text-sm text-neutral-200-font uppercase font-semi-bold': true,
16
20
  'text-left': !props.header.align || props.header.align === AntTableAlign.left,
17
21
  'text-center': props.header.align === AntTableAlign.center,
18
22
  'text-right': props.header.align === AntTableAlign.right,