@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
@@ -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,
package/dist/types.d.mts CHANGED
@@ -5,4 +5,4 @@ import type { } from './module.js'
5
5
 
6
6
 
7
7
 
8
- export type { AntCheckboxSize, AntCheckboxType, AntDateInputTypes, AntKeycapSize, AntRadioSize, AntRadioTypes, AntSpinnerSize, AntTableAlign, AntTableRowTypes, AntTableSize, AntTableSortDirection, AntTagInputSize, AntTagSize, BaseInputType, ButtonType, CollapseStrategy, CornerPosition, Direction, Grouped, IconSize, InputState, ListGroupItemState, NavbarItemTypes, Position, SelectOption, Size, State, SwitcherOption, TabItem, TabItemState, TableHeader, TagState, TextInputType, Toast, default } from './module.js'
8
+ export type { AntCheckboxType, AntDateInputTypes, AntKeycapSize, AntRadioTypes, AntSpinnerSize, AntTableAlign, AntTableRowTypes, AntTableSize, AntTableSortDirection, AntTagInputSize, AntTagSize, BaseInputType, ButtonType, CollapseStrategy, CornerPosition, Direction, Grouped, IconSize, InputState, ListGroupItemState, NavbarItemTypes, Position, SelectOption, Size, State, SwitcherOption, TabItem, TabItemState, TableHeader, TagState, TextInputType, Toast, default } from './module.js'
package/dist/types.d.ts CHANGED
@@ -5,4 +5,4 @@ import type { } from './module'
5
5
 
6
6
 
7
7
 
8
- export type { AntCheckboxSize, AntCheckboxType, AntDateInputTypes, AntKeycapSize, AntRadioSize, AntRadioTypes, AntSpinnerSize, AntTableAlign, AntTableRowTypes, AntTableSize, AntTableSortDirection, AntTagInputSize, AntTagSize, BaseInputType, ButtonType, CollapseStrategy, CornerPosition, Direction, Grouped, IconSize, InputState, ListGroupItemState, NavbarItemTypes, Position, SelectOption, Size, State, SwitcherOption, TabItem, TabItemState, TableHeader, TagState, TextInputType, Toast, default } from './module'
8
+ export type { AntCheckboxType, AntDateInputTypes, AntKeycapSize, AntRadioTypes, AntSpinnerSize, AntTableAlign, AntTableRowTypes, AntTableSize, AntTableSortDirection, AntTagInputSize, AntTagSize, BaseInputType, ButtonType, CollapseStrategy, CornerPosition, Direction, Grouped, IconSize, InputState, ListGroupItemState, NavbarItemTypes, Position, SelectOption, Size, State, SwitcherOption, TabItem, TabItemState, TableHeader, TagState, TextInputType, Toast, default } from './module'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antify/ui-module",
3
3
  "private": false,
4
- "version": "1.7.2",
4
+ "version": "1.7.3",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "exports": {
@@ -28,7 +28,7 @@ const dialogOpen = ref(false);
28
28
 
29
29
  <template>
30
30
  <div
31
- class="flex justify-between items-stretch gap-2 bg-white"
31
+ class="flex justify-between items-stretch gap-2 bg-white h-[52px]"
32
32
  data-e2e="crud-detail-nav"
33
33
  >
34
34
  <slot name="tabs">
@@ -101,7 +101,7 @@ function confirmDialog() {
101
101
  </slot>
102
102
  </div>
103
103
 
104
- <div class="bg-white p-2 grow flex items-center gap-2 text-sm text-for-white-bg-font">
104
+ <div class="bg-white p-2 grow flex items-start gap-2 text-sm text-for-white-bg-font">
105
105
  <slot name="icon">
106
106
  <AntIcon
107
107
  v-if="icons[state]"
@@ -45,13 +45,13 @@ const fieldClasses = computed(() => ({
45
45
  'w-full': props.expanded,
46
46
  'gap-2.5': props.size === Size.lg,
47
47
  'gap-2': props.size === Size.md,
48
- 'gap-1.5': props.size === Size.sm || props.size === Size.xs,
48
+ 'gap-1.5': (props.size === Size.sm || props.size === Size.xs),
49
49
  'gap-1': props.size === Size.xs2,
50
50
  }));
51
51
  const descriptionClasses = computed(() => ({
52
52
  'gap-2.5': props.size === Size.lg,
53
53
  'gap-2': props.size === Size.md,
54
- 'gap-1.5': props.size === Size.sm || props.size === Size.xs,
54
+ 'gap-1.5': (props.size === Size.sm || props.size === Size.xs),
55
55
  'gap-1': props.size === Size.xs2,
56
56
  }));
57
57
  </script>
@@ -63,7 +63,7 @@ const descriptionClasses = computed(() => ({
63
63
  >
64
64
  <AntInputLabel
65
65
  :label="label"
66
- :size="fontSize"
66
+ :size="size"
67
67
  :skeleton="skeleton"
68
68
  :for="labelFor"
69
69
  @click-content="$emit('clickLabel')"
@@ -8,7 +8,6 @@ import {handleEnumValidation} from '../../handler';
8
8
  import {faCheck} from '@fortawesome/free-solid-svg-icons';
9
9
  import AntIcon from '../AntIcon.vue';
10
10
  import {IconSize} from '../__types';
11
- import {AntCheckboxSize} from './__types/AntCheckbox.types';
12
11
 
13
12
  const emit = defineEmits(['update:modelValue', 'update:skeleton', 'validate', 'blur']);
14
13
  const props =
@@ -18,14 +17,14 @@ const props =
18
17
  label?: string;
19
18
  description?: string;
20
19
  state?: InputState;
21
- size?: AntCheckboxSize,
20
+ size?: Size,
22
21
  skeleton?: boolean;
23
22
  disabled?: boolean;
24
23
  readonly?: boolean;
25
24
  messages?: string[];
26
25
  }>(), {
27
26
  state: InputState.base,
28
- size: AntCheckboxSize.md,
27
+ size: Size.md,
29
28
  skeleton: false,
30
29
  disabled: false,
31
30
  readonly: false,
@@ -63,12 +62,12 @@ const inputClasses = computed(() => {
63
62
  'focus:ring-offset-0': true,
64
63
  'invisible': props.skeleton,
65
64
  'cursor-pointer': !hasInputState.value,
66
- 'focus:ring-2': props.size === AntCheckboxSize.sm && !hasInputState.value,
67
- 'focus:ring-4': props.size === AntCheckboxSize.md && !hasInputState.value,
68
- 'h-5 w-5': props.size === AntCheckboxSize.md,
69
- 'h-4 w-4': props.size === AntCheckboxSize.sm,
65
+ 'focus:ring-2': !hasInputState.value && (props.size === Size.sm || props.size === Size.xs || props.size === Size.xs2),
66
+ 'focus:ring-4': !hasInputState.value && (props.size === Size.lg || props.size === Size.md),
67
+ 'h-5 w-5': props.size === Size.lg || props.size === Size.md || props.size === Size.sm,
68
+ 'h-4 w-4': props.size === Size.xs || props.size === Size.xs2,
70
69
  'cursor-not-allowed opacity-50': props.disabled,
71
- [focusColorVariant[props.state]]: hasInputState.value,
70
+ [focusColorVariant[props.state]]: !hasInputState.value,
72
71
  [activeColorVariant[props.state]]: delayedValue.value,
73
72
  [inactiveColorVariant[props.state]]: !_modelValue.value,
74
73
  };
@@ -77,15 +76,15 @@ const contentClasses = computed(() => ({
77
76
  'text-for-white-bg-font': true,
78
77
  'cursor-pointer': !hasInputState.value,
79
78
  'cursor-not-allowed opacity-50': props.disabled,
80
- 'text-sm': props.size === AntCheckboxSize.md,
81
- 'text-xs': props.size === AntCheckboxSize.sm
79
+ 'text-sm': props.size === Size.lg || props.size === Size.md || props.size === Size.sm,
80
+ 'text-xs': props.size === Size.xs || props.size === Size.xs2,
82
81
  }));
83
- const fieldSize = computed(() => {
84
- if (props.size === AntCheckboxSize.md) {
85
- return Size.sm;
82
+ const itemSize = computed(() => {
83
+ if (props.size === Size.xs ||props.size === Size.xs2) {
84
+ return IconSize.xs;
85
+ } else {
86
+ return IconSize.sm;
86
87
  }
87
-
88
- return Size.xs;
89
88
  });
90
89
 
91
90
  /**
@@ -116,7 +115,7 @@ function onBlur(e: FocusEvent) {
116
115
  }
117
116
 
118
117
  onMounted(() => {
119
- handleEnumValidation(props.size, AntCheckboxSize, 'size');
118
+ handleEnumValidation(props.size, Size, 'size');
120
119
  handleEnumValidation(props.state, InputState, 'state');
121
120
 
122
121
  if (!props.skeleton && props.modelValue !== null) {
@@ -131,7 +130,7 @@ onMounted(() => {
131
130
  :description="description"
132
131
  :skeleton="skeleton"
133
132
  :state="state"
134
- :size="fieldSize"
133
+ :size="size"
135
134
  :expanded="false"
136
135
  :messages="messages"
137
136
  >
@@ -150,7 +149,7 @@ onMounted(() => {
150
149
  v-if="_modelValue"
151
150
  :icon="faCheck"
152
151
  class="absolute !text-white pointer-events-none"
153
- :size="size === AntCheckboxSize.md ? IconSize.sm : IconSize.xs"
152
+ :size="itemSize"
154
153
  />
155
154
 
156
155
  <AntSkeleton
@@ -162,7 +161,7 @@ onMounted(() => {
162
161
 
163
162
  <div
164
163
  class="relative flex items-center"
165
- :class="props.size === AntCheckboxSize.md ? 'h-5' : 'h-4'"
164
+ :class="props.size === Size.md ? 'h-5' : 'h-4'"
166
165
  >
167
166
  <span :class="contentClasses">
168
167
  <slot />
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import {type AntCheckboxType, AntCheckboxSize} from './__types/AntCheckbox.types';
2
+ import {type AntCheckboxType} from './__types/AntCheckbox.types';
3
3
  import {AntField} from './Elements';
4
4
  import {useVModel} from '@vueuse/core';
5
5
  import AntCheckbox from './AntCheckbox.vue';
@@ -16,7 +16,7 @@ const props = withDefaults(
16
16
  description?: string;
17
17
  direction?: Direction;
18
18
  state?: InputState;
19
- size?: AntCheckboxSize,
19
+ size?: Size,
20
20
  skeleton?: boolean;
21
21
  readonly?: boolean;
22
22
  disabled?: boolean;
@@ -25,7 +25,7 @@ const props = withDefaults(
25
25
  {
26
26
  direction: Direction.column,
27
27
  state: InputState.base,
28
- size: AntCheckboxSize.md,
28
+ size: Size.md,
29
29
  skeleton: false,
30
30
  readonly: false,
31
31
  disabled: false,
@@ -90,7 +90,7 @@ onMounted(() => {
90
90
  :description="description"
91
91
  :skeleton="skeleton"
92
92
  :state="state"
93
- :size="size as unknown as Size"
93
+ :size="size"
94
94
  :messages="messages"
95
95
  label-for="noop"
96
96
  >
@@ -22,12 +22,14 @@ const props = withDefaults(defineProps<{
22
22
  type?: AntDateInputTypes;
23
23
  state?: InputState;
24
24
  disabled?: boolean;
25
+ readonly?: boolean;
25
26
  skeleton?: boolean;
26
27
  messages?: string[];
27
28
  }>(), {
28
29
  state: InputState.base,
29
30
  type: AntDateInputTypes.date,
30
31
  disabled: false,
32
+ readonly: false,
31
33
  skeleton: false,
32
34
  size: Size.md,
33
35
  messages: () => []
@@ -58,7 +60,11 @@ onMounted(() => {
58
60
  });
59
61
 
60
62
  function onClickCalendar() {
61
- inputRef.value?.showPicker();
63
+ if (!props.disabled && !props.readonly) {
64
+ inputRef.value?.showPicker();
65
+ } else {
66
+ return;
67
+ }
62
68
  }
63
69
  </script>
64
70
 
@@ -79,6 +85,7 @@ function onClickCalendar() {
79
85
  :size="size"
80
86
  :skeleton="skeleton"
81
87
  :disabled="disabled"
88
+ :readonly="readonly"
82
89
  :show-icon="false"
83
90
  v-bind="$attrs"
84
91
  @validate="val => $emit('validate', val)"
@@ -21,6 +21,7 @@ const props = withDefaults(defineProps<{
21
21
  size?: Size;
22
22
  state?: InputState;
23
23
  disabled?: boolean;
24
+ readonly?: boolean;
24
25
  skeleton?: boolean;
25
26
  steps?: number;
26
27
  min?: number;
@@ -31,6 +32,7 @@ const props = withDefaults(defineProps<{
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
  steps: 1,
@@ -115,6 +117,7 @@ function onButtonBlur() {
115
117
  :size="size"
116
118
  :skeleton="skeleton"
117
119
  :disabled="isPrevButtonDisabled"
120
+ :readonly="readonly"
118
121
  @click="subtract"
119
122
  @blur="onButtonBlur"
120
123
  />
@@ -130,6 +133,7 @@ function onButtonBlur() {
130
133
  :min="min"
131
134
  :max="max"
132
135
  :disabled="disabled"
136
+ :readonly="readonly"
133
137
  :placeholder="placeholder || label"
134
138
  :show-icon="false"
135
139
  v-bind="$attrs"
@@ -144,6 +148,7 @@ function onButtonBlur() {
144
148
  :size="size"
145
149
  :skeleton="skeleton"
146
150
  :disabled="isNextButtonDisabled"
151
+ :readonly="readonly"
147
152
  @click="add"
148
153
  @blur="onButtonBlur"
149
154
  />
@@ -3,7 +3,7 @@ import {AntField} from './Elements';
3
3
  import {InputState, Size} from '../../enums';
4
4
  import AntSkeleton from '../AntSkeleton.vue';
5
5
  import {computed, onMounted, watch} from 'vue';
6
- import {AntRadioSize, type AntRadioTypes} from './__types/AntRadio.types';
6
+ import {type AntRadioTypes} from './__types/AntRadio.types';
7
7
  import {handleEnumValidation} from '../../handler';
8
8
 
9
9
  defineOptions({inheritAttrs: false});
@@ -16,13 +16,13 @@ const props = withDefaults(
16
16
  description?: string;
17
17
  skeleton?: boolean;
18
18
  state?: InputState;
19
- size?: AntRadioSize
19
+ size?: Size;
20
20
  readonly?: boolean;
21
21
  disabled?: boolean;
22
22
  messages?: string[];
23
23
  }>(), {
24
24
  state: InputState.base,
25
- size: AntRadioSize.md,
25
+ size: Size.md,
26
26
  readonly: false,
27
27
  disabled: false,
28
28
  messages: () => []
@@ -45,16 +45,16 @@ const inputClasses = computed(() => {
45
45
  'flex items-center justify-center rounded-full appearance-none': true,
46
46
  'cursor-pointer': !hasInputState.value,
47
47
  'rounded-full transition-colors ease-in-out duration-200 disabled:opacity-50': true,
48
- 'focus:ring-2': props.size === AntRadioSize.sm && !hasInputState.value,
49
- 'focus:ring-4': props.size === AntRadioSize.md && !hasInputState.value,
48
+ 'focus:ring-2': !hasInputState.value && (props.size === Size.sm || props.size === Size.xs || props.size === Size.xs2),
49
+ 'focus:ring-4': !hasInputState.value && (props.size === Size.lg || props.size === Size.md),
50
50
  'outline-neutral-300': props.state === InputState.base,
51
51
  'outline-primary-500': props.state === InputState.base && isActive.value,
52
52
  'outline-info-500': props.state === InputState.info,
53
53
  'outline-success-500': props.state === InputState.success,
54
54
  'outline-warning-500': props.state === InputState.warning,
55
55
  'outline-danger-500': props.state === InputState.danger,
56
- 'h-4 w-4 small': props.size === AntRadioSize.sm,
57
- 'h-5 w-5': props.size === AntRadioSize.md,
56
+ 'h-4 w-4 small': props.size === Size.xs || props.size === Size.xs2,
57
+ 'h-5 w-5': props.size === Size.lg || props.size === Size.md || props.size === Size.sm,
58
58
  };
59
59
 
60
60
  const focusColorVariant = {
@@ -73,30 +73,41 @@ const valueClass = computed(() => ({
73
73
  'relative w-fit full-height text-for-white-bg-font': true,
74
74
  'cursor-pointer': !hasInputState.value,
75
75
  'cursor-not-allowed opacity-50': props.disabled,
76
- 'text-sm': props.size === AntRadioSize.md,
77
- 'text-xs': props.size === AntRadioSize.sm
76
+ 'text-sm': props.size === Size.lg || props.size === Size.md || props.size === Size.sm,
77
+ 'text-xs': props.size === Size.xs || props.size === Size.xs2,
78
78
  }));
79
- const fieldSize = computed(() => {
80
- if (props.size === AntRadioSize.md) {
81
- return Size.sm;
82
- } else {
83
- return Size.xs;
79
+ const gapSize = computed(() => {
80
+ switch (props.size) {
81
+ case Size.lg:
82
+ return 'gap-2.5';
83
+ case Size.md:
84
+ return 'gap-2';
85
+ case Size.sm:
86
+ return 'gap-1.5';
87
+ case Size.xs:
88
+ return 'gap-1.5';
89
+ default:
90
+ return 'gap-1';
84
91
  }
85
92
  });
86
- const innerRadioColor = computed(() => {
87
- switch (props.state) {
88
- case InputState.info:
89
- return 'bg-info-500';
90
- case InputState.success:
91
- return 'bg-success-500';
92
- case InputState.warning:
93
- return 'bg-warning-500';
94
- case InputState.danger:
95
- return 'bg-danger-500';
96
- default:
97
- return 'bg-primary-500';
93
+ const valueSize = computed(() => {
94
+ if (props.size === Size.xs || props.size === Size.xs2) {
95
+ return 'h-4';
96
+ } else {
97
+ return 'h-5';
98
98
  }
99
99
  });
100
+ const innerRadioClass = computed(() => (
101
+ {
102
+ 'bg-primary-500': props.state === InputState.base,
103
+ 'bg-info-500': props.state === InputState.info,
104
+ 'bg-success-500': props.state === InputState.success,
105
+ 'bg-warning-500': props.state === InputState.warning,
106
+ 'bg-danger-500': props.state === InputState.danger,
107
+ 'h-3 w-3': props.size === Size.lg || props.size === Size.md || props.size === Size.sm,
108
+ 'h-2 w-2': props.size === Size.xs || props.size === Size.xs2,
109
+ }
110
+ ));
100
111
 
101
112
  /**
102
113
  * Validate default value if given after delayed data fetching.
@@ -136,18 +147,21 @@ onMounted(() => {
136
147
  :state="state"
137
148
  class="cursor-pointer"
138
149
  :skeleton="skeleton"
139
- :size="fieldSize"
150
+ :size="size"
140
151
  :expanded="false"
141
152
  :messages="messages"
142
153
  >
143
- <div class="flex items-center gap-1.5">
154
+ <div
155
+ class="flex items-center"
156
+ :class="gapSize"
157
+ >
144
158
  <div class="relative full-height flex items-center">
145
159
  <div class="absolute flex items-center justify-center w-full h-full">
146
160
  <Transition name="fade-radio">
147
161
  <div
148
162
  v-if="isActive"
149
- class="w-3 h-3 rounded-full transition-all"
150
- :class="innerRadioColor"
163
+ class="rounded-full transition-all"
164
+ :class="innerRadioClass"
151
165
  />
152
166
  </Transition>
153
167
  </div>
@@ -171,7 +185,7 @@ onMounted(() => {
171
185
 
172
186
  <div
173
187
  class="relative flex items-center"
174
- :class="props.size === AntRadioSize.md ? 'h-5' : 'h-4'"
188
+ :class="valueSize"
175
189
  >
176
190
  <span :class="valueClass">
177
191
  {{ value.label }}
@@ -2,7 +2,7 @@
2
2
  import AntRadio from './AntRadio.vue';
3
3
  import {useVModel} from '@vueuse/core';
4
4
  import {AntField} from './Elements';
5
- import {type AntRadioTypes, AntRadioSize} from './__types/AntRadio.types';
5
+ import {type AntRadioTypes} from './__types/AntRadio.types';
6
6
  import {InputState, Size} from '../../enums';
7
7
  import {computed, onMounted, ref, watch} from 'vue';
8
8
  import {Direction} from '../../enums/Direction.enum';
@@ -19,7 +19,7 @@ const props = withDefaults(
19
19
  description?: string;
20
20
  direction?: Direction;
21
21
  state?: InputState;
22
- size?: AntRadioSize;
22
+ size?: Size;
23
23
  skeleton?: boolean;
24
24
  disabled?: boolean;
25
25
  readonly?: boolean;
@@ -27,7 +27,7 @@ const props = withDefaults(
27
27
  }>(), {
28
28
  direction: Direction.column,
29
29
  state: InputState.base,
30
- size: AntRadioSize.md,
30
+ size: Size.md,
31
31
  skeleton: false,
32
32
  disabled: false,
33
33
  readonly: false,
@@ -35,17 +35,28 @@ const props = withDefaults(
35
35
  });
36
36
  const _modelValue = useVModel(props, 'modelValue', emit);
37
37
  const containerClasses = computed(() => ({
38
- 'flex gap-2.5 justify-start': true,
38
+ 'flex justify-start': true,
39
39
  'flex-row': props.direction === Direction.row,
40
40
  'flex-col': props.direction === Direction.column,
41
+ 'gap-2.5': props.size === Size.lg,
42
+ 'gap-2': props.size === Size.md,
43
+ 'gap-1.5': props.size === Size.sm || props.size === Size.xs,
44
+ 'gap-1': props.size === Size.xs2,
41
45
  }));
42
46
  const containerRef = ref<null | HTMLElement>(null);
43
47
  const fieldSize = computed(() => {
44
- if (props.size === AntRadioSize.md) {
45
- return Size.sm;
48
+ switch (props.size) {
49
+ case Size.lg:
50
+ return Size.lg;
51
+ case Size.md:
52
+ return Size.md;
53
+ case Size.sm:
54
+ return Size.sm;
55
+ case Size.xs:
56
+ return Size.xs;
57
+ default:
58
+ return Size.xs2;
46
59
  }
47
-
48
- return Size.xs;
49
60
  });
50
61
 
51
62
  watch(_modelValue, (val) => {
@@ -15,12 +15,14 @@ const props = withDefaults(defineProps<{
15
15
  description?: string;
16
16
  size?: Size;
17
17
  disabled?: boolean;
18
+ readonly?: boolean;
18
19
  skeleton?: boolean;
19
20
  inputTimeout?: number;
20
21
  query?: string;
21
22
  }>(), {
22
23
  disabled: false,
23
24
  skeleton: false,
25
+ readonly: false,
24
26
  size: Size.md,
25
27
  inputTimeout: 300,
26
28
  placeholder: 'Search'
@@ -63,6 +65,7 @@ onMounted(() => handleEnumValidation(props.size, Size, 'size'));
63
65
  :size="size"
64
66
  :skeleton="skeleton"
65
67
  :disabled="disabled"
68
+ :readonly="readonly"
66
69
  :placeholder="placeholder"
67
70
  :icon-left="faSearch"
68
71
  nullable
@@ -39,6 +39,7 @@ const props = withDefaults(
39
39
  size?: Size;
40
40
  state?: InputState;
41
41
  disabled?: boolean;
42
+ readonly?: boolean;
42
43
  skeleton?: boolean;
43
44
  nullable?: boolean;
44
45
  grouped?: Grouped;
@@ -51,6 +52,7 @@ const props = withDefaults(
51
52
  grouped: Grouped.none,
52
53
  size: Size.md,
53
54
  disabled: false,
55
+ readonly: false,
54
56
  skeleton: false,
55
57
  nullable: false,
56
58
  expanded: true,
@@ -65,6 +67,7 @@ const _modelValue = computed({
65
67
  emit('update:modelValue', val);
66
68
  },
67
69
  });
70
+ const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
68
71
  const valueLabel = computed(() => props.options.find(option => option.value === _modelValue.value)?.label || null);
69
72
  const inputClasses = computed(() => {
70
73
  const variants: Record<InputState, string> = {
@@ -84,8 +87,13 @@ const inputClasses = computed(() => {
84
87
  // Disabled
85
88
  'disabled:opacity-50 disabled:cursor-not-allowed': true,
86
89
  // Size
87
- 'focus:ring-2 p-1.5 gap-1.5 text-sm': props.size === Size.sm,
88
- 'focus:ring-4 p-2 gap-2 text-sm': props.size === Size.md,
90
+ 'p-1 text-xs': props.size === Size.xs2,
91
+ 'p-1.5 text-xs': props.size === Size.xs,
92
+ 'p-1.5 text-sm': props.size === Size.sm,
93
+ 'p-2 text-sm': props.size === Size.md,
94
+ 'p-2.5 text-sm': props.size === Size.lg,
95
+ 'focus:ring-2': !hasInputState.value && (props.size === Size.sm || props.size === Size.xs || props.size === Size.xs2),
96
+ 'focus:ring-4': !hasInputState.value && (props.size === Size.lg || props.size === Size.md),
89
97
  // Grouped
90
98
  'rounded-tl-md rounded-bl-md rounded-tr-none rounded-br-none': props.grouped === Grouped.left,
91
99
  'rounded-tl-none rounded-bl-none rounded-tr-md rounded-br-md': props.grouped === Grouped.right,
@@ -184,7 +192,7 @@ function onClickOutside() {
184
192
  function onClickSelectInput(e: MouseEvent) {
185
193
  e.preventDefault();
186
194
 
187
- if (props.disabled) {
195
+ if (props.disabled || props.readonly) {
188
196
  return;
189
197
  }
190
198
 
@@ -221,7 +229,7 @@ function onClickRemoveButton() {
221
229
  <div
222
230
  v-on-click-outside="onClickOutside"
223
231
  class="relative w-full"
224
- :class="{'cursor-pointer': !skeleton}"
232
+ :class="{'cursor-pointer': !skeleton && !readonly}"
225
233
  >
226
234
  <AntSkeleton
227
235
  v-if="skeleton"
@@ -240,7 +248,7 @@ function onClickRemoveButton() {
240
248
  <div
241
249
  ref="inputRef"
242
250
  :class="inputClasses"
243
- :tabindex="disabled ? undefined : 0"
251
+ :tabindex="disabled || readonly ? -1 : 0"
244
252
  v-bind="$attrs"
245
253
  @mousedown="onClickSelectInput"
246
254
  @click="inputRef?.focus()"
@@ -136,7 +136,7 @@ function onBlur(e: FocusEvent) {
136
136
  <template>
137
137
  <AntField
138
138
  :label="label"
139
- :size="fieldSize"
139
+ :size="size"
140
140
  :description="description"
141
141
  :skeleton="skeleton"
142
142
  :state="state"