@dataloop-ai/components 0.20.271 → 0.20.272

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.271",
3
+ "version": "0.20.272",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -87,7 +87,14 @@
87
87
  --dell-red-700: #730000;
88
88
  --dell-overlay: rgba(0, 0, 0, 0.6);
89
89
  --dell-shadow: rgba(0, 0, 0, 0.14);
90
+ --dell-teal-100: #EBF5F7;
91
+ --dell-teal-200: #D9ECF0;
90
92
  --dell-teal-500: #00819e;
93
+ --dell-violet-100: #F5EBF9;
94
+ --dell-violet-200: #EBD9F4;
95
+ --dell-violet-500: #7C01B7;
96
+ --dell-berry-100: #F7EBF2;
97
+ --dell-berry-200: #F1D9E7;
91
98
  --dell-berry-500: #A10061;
92
99
  --dell-color-discovery: #7F3EE0;
93
100
  --dell-color-discovery-bg: #F6F2FD;
@@ -450,4 +450,75 @@ html {
450
450
  opacity: 1 !important;
451
451
  }
452
452
 
453
+ /* Typography utility classes – mirror tokens in constants.css */
454
+ .dell-h1 {
455
+ font-family: var(--dl-typography-header-h1-font-family);
456
+ font-size: var(--dl-typography-header-h1-font-size);
457
+ line-height: var(--dl-typography-header-h1-line-height);
458
+ font-weight: var(--dl-typography-header-h1-font-weight);
459
+ }
460
+
461
+ .dell-h4 {
462
+ font-family: var(--dl-typography-header-h4-font-family);
463
+ font-size: var(--dl-typography-header-h4-font-size);
464
+ line-height: var(--dl-typography-header-h4-line-height);
465
+ font-weight: var(--dl-typography-header-h4-font-weight);
466
+ }
467
+
468
+ .dell-h5 {
469
+ font-family: var(--dl-typography-header-h5-font-family);
470
+ font-size: var(--dl-typography-header-h5-font-size);
471
+ line-height: var(--dl-typography-header-h5-line-height);
472
+ font-weight: var(--dl-typography-header-h5-font-weight);
473
+ }
474
+
475
+ .dell-h6 {
476
+ font-family: var(--dl-typography-header-h6-font-family);
477
+ font-size: var(--dl-typography-header-h6-font-size);
478
+ line-height: var(--dl-typography-header-h6-line-height);
479
+ font-weight: var(--dl-typography-header-h6-font-weight);
480
+ }
481
+
482
+ .dell-h6-medium {
483
+ font-family: var(--dl-typography-header-h6-font-family);
484
+ font-size: var(--dl-typography-header-h6-font-size);
485
+ line-height: var(--dl-typography-header-h6-line-height);
486
+ font-weight: var(--dl-typography-header-h6-medium-font-weight);
487
+ }
488
+
489
+ .dell-body1 {
490
+ font-family: var(--dl-typography-body-body1-font-family);
491
+ font-size: var(--dl-typography-body-body1-font-size);
492
+ line-height: var(--dl-typography-body-body1-line-height);
493
+ font-weight: var(--dl-typography-body-body1-font-weight);
494
+ }
495
+
496
+ .dell-body1-medium {
497
+ font-family: var(--dl-typography-body-body1-font-family);
498
+ font-size: var(--dl-typography-body-body1-font-size);
499
+ line-height: var(--dl-typography-body-body1-line-height);
500
+ font-weight: var(--dl-typography-body-body1-medium-font-weight);
501
+ }
502
+
503
+ .dell-body2 {
504
+ font-family: var(--dl-typography-body-body2-font-family);
505
+ font-size: var(--dl-typography-body-body2-font-size);
506
+ line-height: var(--dl-typography-body-body2-line-height);
507
+ font-weight: var(--dl-typography-body-body2-font-weight);
508
+ }
509
+
510
+ .dell-body2-medium {
511
+ font-family: var(--dl-typography-body-body2-font-family);
512
+ font-size: var(--dl-typography-body-body2-font-size);
513
+ line-height: var(--dl-typography-body-body2-line-height);
514
+ font-weight: var(--dl-typography-body-body2-medium-font-weight);
515
+ }
516
+
517
+ .dell-body3 {
518
+ font-family: var(--dl-typography-body-body3-font-family);
519
+ font-size: var(--dl-typography-body-body3-font-size);
520
+ line-height: var(--dl-typography-body-body3-line-height);
521
+ font-weight: var(--dl-typography-body-body3-font-weight);
522
+ }
523
+
453
524
  @import 'grid';
@@ -1,8 +1,9 @@
1
1
  <template>
2
- <div :id="uuid" class="dl-pagination">
2
+ <div :id="uuid" ref="rootRef" class="dl-pagination dell-body3">
3
3
  <div class="dl-pagination--container">
4
4
  <rows-selector
5
5
  v-if="withRowsPerPage && rowsPerPageState"
6
+ ref="leftSideRef"
6
7
  v-model="rowsPerPageState"
7
8
  class="dl-pagination--sides dl-pagination--sides--left"
8
9
  :options="rowsPerPageOptions"
@@ -11,6 +12,7 @@
11
12
  />
12
13
  <div
13
14
  v-else-if="withLegend"
15
+ ref="leftSideRef"
14
16
  class="dl-pagination--sides dl-pagination--sides--left"
15
17
  />
16
18
 
@@ -23,23 +25,27 @@
23
25
  : 'dl-pagination--navigation--maximized'
24
26
  "
25
27
  >
26
- <page-navigation
27
- :model-value="value"
28
- :min="min"
29
- :max="max"
30
- :max-display-range="maxDisplayRange"
31
- :disabled="disabled"
32
- :boundary-numbers="boundaryNumbers"
33
- :boundary-links="boundaryLinks"
34
- :direction-links="directionLinks"
35
- :color="color"
36
- :active-color="activeColor"
37
- :text-color="textColor"
38
- :active-text-color="activeTextColor"
39
- @update:model-value="setValue"
40
- />
28
+ <div class="dl-pagination--page-navigation-wrapper">
29
+ <page-navigation
30
+ :model-value="value"
31
+ :min="min"
32
+ :max="max"
33
+ :max-display-range="effectiveMaxDisplayRange"
34
+ :disabled="disabled"
35
+ :boundary-numbers="boundaryNumbers"
36
+ :boundary-links="boundaryLinks"
37
+ :direction-links="directionLinks"
38
+ :color="color"
39
+ :active-color="activeColor"
40
+ :text-color="textColor"
41
+ :active-text-color="activeTextColor"
42
+ @update:model-value="setValue"
43
+ />
44
+ </div>
41
45
  <quick-navigation
42
46
  v-if="withQuickNavigation"
47
+ ref="quickNavRef"
48
+ class="dl-pagination--quick-navigation"
43
49
  :model-value="value"
44
50
  :max="max"
45
51
  :min="min"
@@ -49,6 +55,7 @@
49
55
  </div>
50
56
  <pagination-legend
51
57
  v-if="withLegend"
58
+ ref="rightSideRef"
52
59
  :from="rowFrom"
53
60
  :to="rowTo"
54
61
  :total="totalItems"
@@ -57,6 +64,7 @@
57
64
  />
58
65
  <div
59
66
  v-else-if="withRowsPerPage && rowsPerPageState"
67
+ ref="rightSideRef"
60
68
  class="dl-pagination--sides dl-pagination--sides--right"
61
69
  />
62
70
  </div>
@@ -71,6 +79,10 @@ import QuickNavigation from './components/QuickNavigation.vue'
71
79
  import PaginationLegend from './components/PaginationLegend.vue'
72
80
  import { v4 } from 'uuid'
73
81
 
82
+ const PAGE_BUTTON_AVG_WIDTH_PX = 16
83
+ const NAV_HORIZONTAL_PADDING_PX = 52
84
+ const REDUCED_DISPLAY_RANGE = 5
85
+
74
86
  export default defineComponent({
75
87
  name: 'DlPagination',
76
88
  components: {
@@ -142,10 +154,37 @@ export default defineComponent({
142
154
  return {
143
155
  uuid: `dl-pagination-${v4()}`,
144
156
  value: this.modelValue,
145
- rowsPerPageState: this.rowsPerPage
157
+ rowsPerPageState: this.rowsPerPage,
158
+ rootWidth: 0,
159
+ leftSideWidth: 0,
160
+ rightSideWidth: 0,
161
+ quickNavWidth: 0,
162
+ resizeObserver: null as ResizeObserver | null
146
163
  }
147
164
  },
148
165
  computed: {
166
+ navNaturalWidth(): number {
167
+ let buttonCount = this.maxDisplayRange + 1
168
+ if (this.boundaryNumbers) buttonCount += 2
169
+ if (this.directionLinks) buttonCount += 2
170
+ if (this.boundaryLinks) buttonCount += 2
171
+ return (
172
+ buttonCount * PAGE_BUTTON_AVG_WIDTH_PX +
173
+ NAV_HORIZONTAL_PADDING_PX
174
+ )
175
+ },
176
+ effectiveMaxDisplayRange(): number {
177
+ if (this.rootWidth === 0) return this.maxDisplayRange
178
+ const available =
179
+ this.rootWidth -
180
+ this.leftSideWidth -
181
+ this.rightSideWidth -
182
+ this.quickNavWidth
183
+ if (available < this.navNaturalWidth) {
184
+ return Math.min(this.maxDisplayRange, REDUCED_DISPLAY_RANGE)
185
+ }
186
+ return this.maxDisplayRange
187
+ },
149
188
  rowFrom(): number {
150
189
  return 1 + this.rowsPerPageState * (this.value - 1)
151
190
  },
@@ -177,10 +216,61 @@ export default defineComponent({
177
216
  }
178
217
  },
179
218
 
219
+ mounted() {
220
+ this.setupResizeObserver()
221
+ },
222
+ beforeUnmount() {
223
+ this.teardownResizeObserver()
224
+ },
180
225
  methods: {
181
226
  setValue(value: number) {
182
227
  this.value = value
183
228
  this.$emit('update:model-value', value)
229
+ },
230
+ setupResizeObserver() {
231
+ const resolveEl = (ref: unknown): Element | null => {
232
+ const el = (ref as { $el?: unknown })?.$el ?? ref
233
+ return el instanceof Element ? el : null
234
+ }
235
+
236
+ const targets: {
237
+ element: Element | null
238
+ setWidth: (width: number) => void
239
+ }[] = [
240
+ {
241
+ element: resolveEl(this.$refs.rootRef),
242
+ setWidth: (w) => (this.rootWidth = w)
243
+ },
244
+ {
245
+ element: resolveEl(this.$refs.leftSideRef),
246
+ setWidth: (w) => (this.leftSideWidth = w)
247
+ },
248
+ {
249
+ element: resolveEl(this.$refs.rightSideRef),
250
+ setWidth: (w) => (this.rightSideWidth = w)
251
+ },
252
+ {
253
+ element: resolveEl(this.$refs.quickNavRef),
254
+ setWidth: (w) => (this.quickNavWidth = w)
255
+ }
256
+ ]
257
+
258
+ this.resizeObserver = new ResizeObserver((entries) => {
259
+ for (const entry of entries) {
260
+ const target = targets.find(
261
+ (t) => t.element === entry.target
262
+ )
263
+ target?.setWidth(entry.contentRect.width)
264
+ }
265
+ })
266
+
267
+ for (const { element } of targets) {
268
+ if (element) this.resizeObserver.observe(element)
269
+ }
270
+ },
271
+ teardownResizeObserver() {
272
+ this.resizeObserver?.disconnect()
273
+ this.resizeObserver = null
184
274
  }
185
275
  }
186
276
  })
@@ -190,10 +280,6 @@ export default defineComponent({
190
280
  .dl-pagination {
191
281
  width: 100%;
192
282
  height: 40px;
193
- font-family: var(--dl-typography-body-body3-font-family);
194
- font-size: var(--dl-typography-body-body3-font-size);
195
- line-height: var(--dl-typography-body-body3-line-height);
196
- font-weight: var(--dl-typography-body-body3-font-weight);
197
283
 
198
284
  &--container {
199
285
  height: 100%;
@@ -205,16 +291,30 @@ export default defineComponent({
205
291
 
206
292
  &--navigation {
207
293
  display: flex;
208
- flex-grow: 1;
209
- width: 60%;
294
+ flex: 1 1 auto;
295
+ min-width: 0;
210
296
  justify-content: center;
297
+ align-items: center;
211
298
  &--maximized {
212
299
  width: 100%;
213
300
  }
214
301
  }
215
302
 
303
+ &--page-navigation-wrapper {
304
+ flex: 0 1 auto;
305
+ min-width: 0;
306
+ display: flex;
307
+ justify-content: center;
308
+ overflow: hidden;
309
+ }
310
+
216
311
  &--sides {
217
- width: 20%;
312
+ flex: 1 1 0;
313
+ min-width: max-content;
314
+ }
315
+
316
+ &--quick-navigation {
317
+ flex: 0 0 auto;
218
318
  }
219
319
  }
220
320
  </style>
@@ -206,6 +206,9 @@ export default defineComponent({
206
206
  max() {
207
207
  this.updateState()
208
208
  },
209
+ maxDisplayRange() {
210
+ this.updateState()
211
+ },
209
212
  modelValue() {
210
213
  this.value = this.modelValue
211
214
  }