@antify/ui 4.1.35 → 4.1.37

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.
@@ -197,7 +197,6 @@ onMounted(() => {
197
197
  v-for="(day, index) in weekDays"
198
198
  :key="`${day}-${index}`"
199
199
  class="text-center flex items-center justify-center rounded-md"
200
- :style="showWeekNumbers && index === 0 ? weekNumberStyles : {}"
201
200
  >
202
201
  <AntSkeleton
203
202
  :visible="skeleton"
@@ -188,49 +188,49 @@ onMounted(() => {
188
188
  :expanded="false"
189
189
  :messages="messages"
190
190
  >
191
- <div class="flex items-center gap-1.5">
192
- <div class="relative full-height flex items-center">
193
- <input
194
- v-model="_modelValue"
195
- :class="inputClasses"
196
- type="checkbox"
197
- :aria-checked="_modelValue"
198
- :disabled="disabled || readonly"
199
- @blur="onBlur"
200
- >
201
-
202
- <div
203
- class="absolute flex items-center justify-center !text-white pointer-events-none"
204
- :class="size === Size.lg || size === Size.md || size === Size.sm ? 'h-5 w-5' : 'h-4 w-4'"
205
- >
206
- <AntIcon
207
- v-if="_modelValue"
208
- :icon="faCheck"
209
- :size="itemSize"
210
- :color="iconColor"
211
- />
212
- </div>
213
-
191
+ <div class="flex gap-1.5">
192
+ <div
193
+ class="relative flex"
194
+ :class="{
195
+ 'h-5 w-5': size === Size.lg || size === Size.md || size === Size.sm,
196
+ 'h-4 w-4': size === Size.xs || size === Size.xs2,
197
+ }"
198
+ >
214
199
  <AntSkeleton
215
200
  :visible="skeleton"
216
- absolute
217
201
  rounded
218
- />
219
- </div>
202
+ >
203
+ <input
204
+ v-model="_modelValue"
205
+ :class="inputClasses"
206
+ type="checkbox"
207
+ :aria-checked="_modelValue"
208
+ :disabled="disabled || readonly"
209
+ @blur="onBlur"
210
+ >
220
211
 
221
- <div
222
- class="flex items-center"
223
- :class="props.size === Size.md ? 'h-5' : 'h-4'"
224
- >
225
- <span :class="contentClasses">
226
- <AntSkeleton
227
- :visible="skeleton"
228
- rounded
212
+ <div
213
+ class="absolute flex items-center justify-center !text-white pointer-events-none"
214
+ :class="size === Size.lg || size === Size.md || size === Size.sm ? 'h-5 w-5' : 'h-4 w-4'"
229
215
  >
230
- <slot />
231
- </AntSkeleton>
232
- </span>
216
+ <AntIcon
217
+ v-if="_modelValue"
218
+ :icon="faCheck"
219
+ :size="itemSize"
220
+ :color="iconColor"
221
+ />
222
+ </div>
223
+ </AntSkeleton>
233
224
  </div>
225
+
226
+ <span :class="contentClasses">
227
+ <AntSkeleton
228
+ :visible="skeleton"
229
+ rounded
230
+ >
231
+ <slot />
232
+ </AntSkeleton>
233
+ </span>
234
234
  </div>
235
235
  </AntField>
236
236
  </template>
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import {
3
- computed, onMounted, nextTick, ref, useId,
3
+ computed, onMounted, ref, useId,
4
4
  } from 'vue';
5
5
  import AntButton from '../AntButton.vue';
6
6
  import AntField from '../forms/AntField.vue';
@@ -59,6 +59,7 @@ const props = withDefaults(defineProps<{
59
59
  indicators?: boolean;
60
60
  inputRef?: HTMLInputElement | null;
61
61
  selectAllOnFocus?: boolean;
62
+ autocomplete?: 'on' | 'off' | string;
62
63
  }>(), {
63
64
  state: InputState.base,
64
65
  disabled: false,
@@ -71,6 +72,7 @@ const props = withDefaults(defineProps<{
71
72
  indicators: false,
72
73
  inputRef: null,
73
74
  selectAllOnFocus: false,
75
+ autocomplete: 'off',
74
76
  });
75
77
  const emit = defineEmits([
76
78
  'update:modelValue',
@@ -203,6 +205,7 @@ function onButtonBlur(e: FocusEvent) {
203
205
  if (props.max !== undefined && finalValue > props.max) {
204
206
  finalValue = props.max;
205
207
  }
208
+
206
209
  if (props.min !== undefined && finalValue < props.min) {
207
210
  finalValue = props.min;
208
211
  }
@@ -226,6 +229,19 @@ function onKeyDown(e: KeyboardEvent) {
226
229
  return;
227
230
  }
228
231
 
232
+ if (e.key === 'ArrowUp') {
233
+ e.preventDefault();
234
+ add();
235
+
236
+ return;
237
+ }
238
+ if (e.key === 'ArrowDown') {
239
+ e.preventDefault();
240
+ subtract();
241
+
242
+ return;
243
+ }
244
+
229
245
  const allowedKeys = [
230
246
  'Backspace',
231
247
  'Delete',
@@ -293,6 +309,7 @@ onMounted(() => {
293
309
  v-model:input-ref="_inputRef"
294
310
  :type="BaseInputType.number"
295
311
  :grouped="indicators ? Grouped.center : Grouped.none"
312
+ :autocomplete="autocomplete"
296
313
  wrapper-class="grow"
297
314
  :state="state"
298
315
  :size="size"
@@ -74,7 +74,6 @@ const props = withDefaults(defineProps<{
74
74
  default: false,
75
75
  nullable: false,
76
76
  inputRef: null,
77
- step: 1,
78
77
  });
79
78
  const slot = useSlots();
80
79
  const hasInputState = computed(() => props.skeleton || props.disabled);
@@ -163,26 +162,13 @@ const icon = computed(() => icons[props.state]);
163
162
  const _modelValue = computed<string | number | null>({
164
163
  get: () => props.modelValue,
165
164
  set: (val: string | number | null) => {
166
- if (props.type === BaseInputType.number) {
167
- if (val === '' || val === null || val === undefined) {
168
- emit('update:modelValue', null);
169
-
170
- return;
171
- }
172
-
173
- const num = Number(val);
174
-
175
- if (!isNaN(num)) {
176
- emit('update:modelValue', num);
177
- }
178
-
179
- return;
165
+ if (props.type === BaseInputType.number && typeof val !== 'number') {
166
+ return emit('update:modelValue', null);
180
167
  }
181
168
 
182
169
  emit('update:modelValue', val);
183
170
  },
184
171
  });
185
-
186
172
  const inputIconSize = computed(() => {
187
173
  if (props.size === Size.xs || props.size === Size.xs2) {
188
174
  return IconSize.xs;
@@ -285,7 +271,6 @@ function onClickClearIcon() {
285
271
  :min="min"
286
272
  :max="max"
287
273
  title=""
288
- :step="step"
289
274
  v-bind="$attrs"
290
275
  :data-e2e-state="state"
291
276
  @blur="onBlur"
@@ -55,7 +55,7 @@ const Docs = exports.Docs = {
55
55
  },
56
56
  template: `
57
57
  <div class="m-2">
58
- <AntCheckbox v-bind="args" v-model="value"/>
58
+ <AntCheckbox v-bind="args" v-model="value">Value</AntCheckbox>
59
59
  <span class="text-sm text-gray-500">Reactive value: {{ value }}</span>
60
60
  </div>
61
61
  `
@@ -54,7 +54,7 @@ export const Docs = {
54
54
  },
55
55
  template: `
56
56
  <div class="m-2">
57
- <AntCheckbox v-bind="args" v-model="value"/>
57
+ <AntCheckbox v-bind="args" v-model="value">Value</AntCheckbox>
58
58
  <span class="text-sm text-gray-500">Reactive value: {{ value }}</span>
59
59
  </div>
60
60
  `
@@ -4,3 +4,4 @@ declare const meta: Meta<typeof AntCheckboxGroup>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof AntCheckboxGroup>;
6
6
  export declare const Docs: Story;
7
+ export declare const WithLongContent: Story;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- module.exports = exports.Docs = void 0;
6
+ module.exports = exports.WithLongContent = exports.Docs = void 0;
7
7
  var _AntCheckboxGroup = _interopRequireDefault(require("../AntCheckboxGroup.vue"));
8
8
  var _enums = require("../../../enums");
9
9
  var _Direction = require("../../../enums/Direction.enum");
@@ -55,7 +55,7 @@ const Docs = exports.Docs = {
55
55
  };
56
56
  },
57
57
  template: `
58
- <AntCheckboxGroup v-bind="args" v-model="args.modelValue"/>
58
+ <AntCheckboxGroup v-bind="args" v-model="args.modelValue"/>
59
59
  `
60
60
  }),
61
61
  args: {
@@ -74,4 +74,37 @@ const Docs = exports.Docs = {
74
74
  value: "checkbox-4"
75
75
  }]
76
76
  }
77
+ };
78
+ const WithLongContent = exports.WithLongContent = {
79
+ render: args => ({
80
+ components: {
81
+ AntCheckboxGroup: _AntCheckboxGroup.default
82
+ },
83
+ setup() {
84
+ return {
85
+ args
86
+ };
87
+ },
88
+ template: `
89
+ <div class="w-[150px]">
90
+ <AntCheckboxGroup v-bind="args" v-model="args.modelValue"/>
91
+ </div>
92
+ `
93
+ }),
94
+ args: {
95
+ modelValue: [],
96
+ checkboxes: [{
97
+ label: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam",
98
+ value: "checkbox-1"
99
+ }, {
100
+ label: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam",
101
+ value: "checkbox-2"
102
+ }, {
103
+ label: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam",
104
+ value: "checkbox-3"
105
+ }, {
106
+ label: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam",
107
+ value: "checkbox-4"
108
+ }]
109
+ }
77
110
  };
@@ -53,7 +53,7 @@ export const Docs = {
53
53
  };
54
54
  },
55
55
  template: `
56
- <AntCheckboxGroup v-bind="args" v-model="args.modelValue"/>
56
+ <AntCheckboxGroup v-bind="args" v-model="args.modelValue"/>
57
57
  `
58
58
  }),
59
59
  args: {
@@ -78,3 +78,41 @@ export const Docs = {
78
78
  ]
79
79
  }
80
80
  };
81
+ export const WithLongContent = {
82
+ render: (args) => ({
83
+ components: {
84
+ AntCheckboxGroup
85
+ },
86
+ setup() {
87
+ return {
88
+ args
89
+ };
90
+ },
91
+ template: `
92
+ <div class="w-[150px]">
93
+ <AntCheckboxGroup v-bind="args" v-model="args.modelValue"/>
94
+ </div>
95
+ `
96
+ }),
97
+ args: {
98
+ modelValue: [],
99
+ checkboxes: [
100
+ {
101
+ label: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam",
102
+ value: "checkbox-1"
103
+ },
104
+ {
105
+ label: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam",
106
+ value: "checkbox-2"
107
+ },
108
+ {
109
+ label: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam",
110
+ value: "checkbox-3"
111
+ },
112
+ {
113
+ label: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam",
114
+ value: "checkbox-4"
115
+ }
116
+ ]
117
+ }
118
+ };
@@ -62,6 +62,18 @@ const meta = {
62
62
  control: {
63
63
  type: "number"
64
64
  }
65
+ },
66
+ autocomplete: {
67
+ control: {
68
+ type: "inline-radio"
69
+ },
70
+ options: ["on", "off"],
71
+ description: "Enables or disables browser suggestions and autocomplete.",
72
+ table: {
73
+ defaultValue: {
74
+ summary: "off"
75
+ }
76
+ }
65
77
  }
66
78
  }
67
79
  };
@@ -83,7 +95,8 @@ const Docs = exports.Docs = {
83
95
  steps: 1,
84
96
  label: "Standard Number Input",
85
97
  description: "Basic usage with manual entry or indicators",
86
- onValidate: (0, _test.fn)()
98
+ onValidate: (0, _test.fn)(),
99
+ autocomplete: "off"
87
100
  }
88
101
  };
89
102
  const SelectAllOnFocus = exports.SelectAllOnFocus = {
@@ -63,6 +63,21 @@ const meta = {
63
63
  control: {
64
64
  type: "number"
65
65
  }
66
+ },
67
+ autocomplete: {
68
+ control: {
69
+ type: "inline-radio"
70
+ },
71
+ options: [
72
+ "on",
73
+ "off"
74
+ ],
75
+ description: "Enables or disables browser suggestions and autocomplete.",
76
+ table: {
77
+ defaultValue: {
78
+ summary: "off"
79
+ }
80
+ }
66
81
  }
67
82
  }
68
83
  };
@@ -84,7 +99,8 @@ export const Docs = {
84
99
  steps: 1,
85
100
  label: "Standard Number Input",
86
101
  description: "Basic usage with manual entry or indicators",
87
- onValidate: fn()
102
+ onValidate: fn(),
103
+ autocomplete: "off"
88
104
  }
89
105
  };
90
106
  export const SelectAllOnFocus = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antify/ui",
3
- "version": "4.1.35",
3
+ "version": "4.1.37",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {