@antify/ui 4.1.34 → 4.1.35

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,7 +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
200
  :style="showWeekNumbers && index === 0 ? weekNumberStyles : {}"
204
201
  >
205
202
  <AntSkeleton
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antify/ui",
3
- "version": "4.1.34",
3
+ "version": "4.1.35",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {