@dataloop-ai/components 0.20.217 → 0.20.219

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.20.217",
3
+ "version": "0.20.219",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -134,19 +134,13 @@ export default defineComponent({
134
134
 
135
135
  const emptyString = '---'
136
136
 
137
- const isSingleWord = (text: string) => text?.split(' ').length === 1
138
-
139
137
  const cssVars = computed<Record<string, string>>(() => {
140
138
  const vars: Record<string, string> = {
141
139
  '--dl-kpi-border': props.bordered
142
140
  ? '1px solid var(--dl-color-separator)'
143
141
  : '',
144
- '--dl-kpi-title-max-width': isSingleWord(props.title)
145
- ? '100%'
146
- : '90%', // todo: caused a bug with single words
147
- '--dl-kpi-sub-title-max-width': isSingleWord(props.subtitle)
148
- ? '100%'
149
- : '90%'
142
+ '--dl-kpi-title-max-width': '100%',
143
+ '--dl-kpi-sub-title-max-width': '100%'
150
144
  }
151
145
 
152
146
  if (props.dense) {
@@ -1,8 +1,5 @@
1
1
  <template>
2
- <div
3
- class="dl-calendar"
4
- :class="{ 'dl-calendar-disabled': disabled }"
5
- >
2
+ <div class="dl-calendar" :class="{ 'dl-calendar-disabled': disabled }">
6
3
  <div
7
4
  class="dl-calendar--title"
8
5
  :class="{ 'dl-calendar--title-disabled': disabled }"
@@ -343,6 +340,12 @@ export default defineComponent({
343
340
  justify-content: center;
344
341
  align-items: center;
345
342
  margin: 0 auto;
343
+ cursor: pointer;
344
+
345
+ &:hover {
346
+ background-color: var(--dell-blue-100);
347
+ border-radius: 11px;
348
+ }
346
349
  }
347
350
 
348
351
  &--header_item,
@@ -354,5 +357,13 @@ export default defineComponent({
354
357
 
355
358
  .dl-calendar-disabled {
356
359
  cursor: not-allowed !important;
360
+
361
+ .dl-calendar--inner_day {
362
+ cursor: not-allowed;
363
+
364
+ &:hover {
365
+ background-color: transparent;
366
+ }
367
+ }
357
368
  }
358
369
  </style>
@@ -30,7 +30,13 @@
30
30
  v-for="month in months"
31
31
  :key="month.name"
32
32
  class="dl-month-calendar--month"
33
- :class="{ 'dl-month-calendar--month-disabled': disabled }"
33
+ :class="{
34
+ 'dl-month-calendar--month-disabled':
35
+ disabled || isMonthOutOfRange(month.value),
36
+ 'dl-month-calendar--month-selected': isMonthSelected(
37
+ month.value
38
+ )
39
+ }"
34
40
  :style="getMonthStyle(month.value)"
35
41
  @click="handleClick(month.value)"
36
42
  @mouseenter="handleMouseenter(month.value)"
@@ -98,9 +104,40 @@ export default defineComponent({
98
104
  }
99
105
  },
100
106
  methods: {
107
+ isMonthOutOfRange(value: number): boolean {
108
+ const d = new CalendarDate().year(parseInt(this.title)).month(value)
109
+ return !isInRange(this.availableRange, d)
110
+ },
111
+ isMonthSelected(value: number): boolean {
112
+ if (
113
+ this.modelValue === null ||
114
+ !this.modelValue.from ||
115
+ !this.modelValue.to
116
+ )
117
+ return false
118
+ const d = new CalendarDate().year(parseInt(this.title)).month(value)
119
+ const from = new CalendarDate(this.modelValue.from)
120
+ const to = new CalendarDate(this.modelValue.to)
121
+ return d.isSame(from, 'month') || d.isSame(to, 'month')
122
+ },
101
123
  handleClick(value: number) {
102
- const d = new CalendarDate()
103
- d.year(parseInt(this.title)).month(value)
124
+ const d = new CalendarDate().year(parseInt(this.title)).month(value)
125
+
126
+ // Check if this month is already selected
127
+ if (
128
+ this.modelValue !== null &&
129
+ this.modelValue.from &&
130
+ this.modelValue.to
131
+ ) {
132
+ const selectedFrom = new CalendarDate(this.modelValue.from)
133
+ const selectedTo = new CalendarDate(this.modelValue.to)
134
+ if (
135
+ d.isSame(selectedFrom, 'month') ||
136
+ d.isSame(selectedTo, 'month')
137
+ ) {
138
+ return
139
+ }
140
+ }
104
141
 
105
142
  const from = new CalendarDate(d)
106
143
  const to = new CalendarDate(d)
@@ -147,8 +184,9 @@ export default defineComponent({
147
184
  let style: Record<string, any> = {}
148
185
 
149
186
  const selectedStyle = {
150
- color: 'var(--dl-color-text-buttons)',
151
- background: 'var(--dl-color-secondary)'
187
+ color: 'var(--dell-white)',
188
+ background: 'var(--dell-blue-500)',
189
+ border: 'none'
152
190
  }
153
191
 
154
192
  const initialD = new CalendarDate()
@@ -158,8 +196,9 @@ export default defineComponent({
158
196
 
159
197
  if (!isInRange(this.availableRange, d)) {
160
198
  style = {
161
- 'border-color': 'var(--dl-color-disabled)',
162
- color: 'var(--dl-color-disabled)',
199
+ 'background-color': 'var(--dell-gray-100)',
200
+ 'border-color': 'var(--dell-gray-500)',
201
+ color: 'var(--dell-gray-500)',
163
202
  cursor: 'not-allowed'
164
203
  }
165
204
  } else if (this.modelValue !== null) {
@@ -267,7 +306,7 @@ export default defineComponent({
267
306
  &--month {
268
307
  color: var(--dl-color-darker);
269
308
  border: 1px solid var(--dl-color-separator);
270
- border-radius: 2px;
309
+ border-radius: 0;
271
310
  margin-left: 15px;
272
311
  margin-bottom: 10px;
273
312
  cursor: pointer;
@@ -275,10 +314,33 @@ export default defineComponent({
275
314
  text-transform: capitalize;
276
315
  padding: 4px 21px;
277
316
 
317
+ &:hover:not(.dl-month-calendar--month-disabled) {
318
+ background-color: var(--dell-blue-100);
319
+ border-color: var(--dell-blue-500);
320
+ }
321
+
322
+ &:active:not(.dl-month-calendar--month-disabled) {
323
+ background-color: var(--dell-blue-200) !important;
324
+ color: var(--dell-blue-600) !important;
325
+ border: 1px solid var(--dell-blue-500) !important;
326
+ }
327
+
328
+ &-selected {
329
+ cursor: default;
330
+ pointer-events: none;
331
+ }
332
+
278
333
  &-disabled {
279
334
  cursor: not-allowed;
280
- color: var(--dl-color-disabled);
281
- border: 1px solid var(--dl-color-disabled);
335
+ background-color: var(--dell-gray-100);
336
+ color: var(--dell-gray-500);
337
+ border: 1px solid var(--dell-gray-500);
338
+
339
+ &:hover {
340
+ background-color: var(--dell-gray-100);
341
+ color: var(--dell-gray-500);
342
+ border-color: var(--dell-gray-500);
343
+ }
282
344
  }
283
345
  }
284
346
  }
@@ -21,7 +21,7 @@
21
21
  readonly
22
22
  @focus="focused = true"
23
23
  @blur="focused = false"
24
- >
24
+ />
25
25
  </div>
26
26
  <slot />
27
27
  </div>
@@ -68,7 +68,7 @@ export default defineComponent({
68
68
  background-color: var(--dl-color-bg);
69
69
  border: 1px solid var(--dl-color-separator);
70
70
  color: var(--dl-color-darker);
71
- border-radius: 2px;
71
+ border-radius: 0;
72
72
  padding: 5px 10px;
73
73
  display: flex;
74
74
  width: var(--dl-date-input-width);