@antify/ui 4.1.34 → 4.1.36

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.
@@ -36,15 +36,20 @@ const props = withDefaults(defineProps<{
36
36
  color: string;
37
37
  }[];
38
38
  /**
39
- * Color token used for the week number column (e.g., 'base-200', 'primary-500').
39
+ * Color token used for weekNumberTextColor of week number column (e.g., 'base-200-font', 'primary-500-font').
40
40
  */
41
- weekNumberColor?: string;
41
+ weekNumberTextColor?: string;
42
+ /**
43
+ * Color token used for weekNumberBackgroundColor of week number column (e.g., 'base-200', 'primary-500').
44
+ */
45
+ weekNumberBackgroundColor?: string;
42
46
  }>(), {
43
47
  showWeekend: false,
44
48
  showWeekNumbers: false,
45
49
  skeleton: false,
46
50
  specialDays: () => [],
47
- weekNumberColor: 'base-200',
51
+ weekNumberTextColor: 'base-300-font',
52
+ weekNumberBackgroundColor: 'base-300',
48
53
  });
49
54
  const emit = defineEmits([
50
55
  'select',
@@ -139,16 +144,9 @@ const getColorNumber = (color: string) => {
139
144
  return match ? parseInt(match[0], 10) : null;
140
145
  };
141
146
 
142
- const getContrastTextColor = (colorToken: string) => {
143
- const match = colorToken.match(/(\d+)/);
144
- const weight = match ? parseInt(match[0], 10) : 0;
145
-
146
- return weight < 500 ? 'var(--color-for-white-bg-font)' : '#fff';
147
- };
148
-
149
147
  const weekNumberStyles = computed(() => ({
150
- backgroundColor: `var(--color-${props.weekNumberColor})`,
151
- color: getContrastTextColor(props.weekNumberColor),
148
+ backgroundColor: `var(--color-${props.weekNumberBackgroundColor})`,
149
+ color: `var(--color-${props.weekNumberTextColor})`,
152
150
  }));
153
151
 
154
152
  watch(() => props.modelValue, (val) => {
@@ -199,8 +197,6 @@ onMounted(() => {
199
197
  v-for="(day, index) in weekDays"
200
198
  :key="`${day}-${index}`"
201
199
  class="text-center flex items-center justify-center rounded-md"
202
- :class="[!(showWeekNumbers && index === 0) ? 'text-for-white-bg-font' : '']"
203
- :style="showWeekNumbers && index === 0 ? weekNumberStyles : {}"
204
200
  >
205
201
  <AntSkeleton
206
202
  :visible="skeleton"
@@ -31,15 +31,27 @@ const meta = {
31
31
  }
32
32
  }
33
33
  },
34
- weekNumberColor: {
34
+ weekNumberTextColor: {
35
35
  control: "text",
36
- description: "Color token e.g. 'base-200', 'primary-500'. Automatically calculates contrast text color.",
36
+ description: "Color token e.g. 'base-300-font', 'primary-500-font'. Automatically calculates contrast text color.",
37
37
  table: {
38
38
  type: {
39
39
  summary: "string"
40
40
  },
41
41
  defaultValue: {
42
- summary: "base-200"
42
+ summary: "base-300-font"
43
+ }
44
+ }
45
+ },
46
+ weekNumberBackgroundColor: {
47
+ control: "text",
48
+ description: "Color token e.g. 'base-300', 'primary-500'. Automatically calculates contrast text color.",
49
+ table: {
50
+ type: {
51
+ summary: "string"
52
+ },
53
+ defaultValue: {
54
+ summary: "base-300"
43
55
  }
44
56
  }
45
57
  },
@@ -113,7 +125,8 @@ const WeekNumberStyling = exports.WeekNumberStyling = {
113
125
  <AntCalendar
114
126
  v-model="value"
115
127
  :show-week-numbers="true"
116
- week-number-color="primary-900"
128
+ week-number-text-color="primary-900-font"
129
+ week-number-background-color="primary-900"
117
130
  />
118
131
  </div>
119
132
 
@@ -122,7 +135,8 @@ const WeekNumberStyling = exports.WeekNumberStyling = {
122
135
  <AntCalendar
123
136
  v-model="value"
124
137
  :show-week-numbers="true"
125
- week-number-color="info-100"
138
+ week-number-text-color="info-100-font"
139
+ week-number-background-color="info-100"
126
140
  />
127
141
  </div>
128
142
 
@@ -131,7 +145,8 @@ const WeekNumberStyling = exports.WeekNumberStyling = {
131
145
  <AntCalendar
132
146
  v-model="value"
133
147
  :show-week-numbers="true"
134
- week-number-color="success-500"
148
+ week-number-text-color="success-500-font"
149
+ week-number-background-color="success-500"
135
150
  />
136
151
  </div>
137
152
 
@@ -29,15 +29,27 @@ const meta = {
29
29
  }
30
30
  }
31
31
  },
32
- weekNumberColor: {
32
+ weekNumberTextColor: {
33
33
  control: "text",
34
- description: "Color token e.g. 'base-200', 'primary-500'. Automatically calculates contrast text color.",
34
+ description: "Color token e.g. 'base-300-font', 'primary-500-font'. Automatically calculates contrast text color.",
35
35
  table: {
36
36
  type: {
37
37
  summary: "string"
38
38
  },
39
39
  defaultValue: {
40
- summary: "base-200"
40
+ summary: "base-300-font"
41
+ }
42
+ }
43
+ },
44
+ weekNumberBackgroundColor: {
45
+ control: "text",
46
+ description: "Color token e.g. 'base-300', 'primary-500'. Automatically calculates contrast text color.",
47
+ table: {
48
+ type: {
49
+ summary: "string"
50
+ },
51
+ defaultValue: {
52
+ summary: "base-300"
41
53
  }
42
54
  }
43
55
  },
@@ -113,7 +125,8 @@ export const WeekNumberStyling = {
113
125
  <AntCalendar
114
126
  v-model="value"
115
127
  :show-week-numbers="true"
116
- week-number-color="primary-900"
128
+ week-number-text-color="primary-900-font"
129
+ week-number-background-color="primary-900"
117
130
  />
118
131
  </div>
119
132
 
@@ -122,7 +135,8 @@ export const WeekNumberStyling = {
122
135
  <AntCalendar
123
136
  v-model="value"
124
137
  :show-week-numbers="true"
125
- week-number-color="info-100"
138
+ week-number-text-color="info-100-font"
139
+ week-number-background-color="info-100"
126
140
  />
127
141
  </div>
128
142
 
@@ -131,7 +145,8 @@ export const WeekNumberStyling = {
131
145
  <AntCalendar
132
146
  v-model="value"
133
147
  :show-week-numbers="true"
134
- week-number-color="success-500"
148
+ week-number-text-color="success-500-font"
149
+ week-number-background-color="success-500"
135
150
  />
136
151
  </div>
137
152
 
@@ -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"
@@ -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.34",
3
+ "version": "4.1.36",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {