@easyvision/easyvision-ui 1.10.0 → 1.12.0

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/README.md CHANGED
@@ -675,6 +675,38 @@ Override per field with `toCondition: (value) => unknown` (return either a primi
675
675
 
676
676
  > `transform` is the deprecated old name for `toCondition` and is still accepted as an alias.
677
677
 
678
+ ### Saved filters ("Guardados")
679
+
680
+ `savedFilters={{ storageKey }}` adds a **Guardados** button next to Limpiar. It keeps named queries per person:
681
+
682
+ - **Guardar** names what is *applied* (the last Buscar), not what is staged; with nothing applied the form is disabled. A repeated name replaces the old one in place.
683
+ - **Click a name** to replace the filters with it and search at once.
684
+ - **★** makes it the default: a multifilter that opens clean (nothing persisted) opens with it and performs it, so a bound table loads already filtered. One default at most; ★ again removes it.
685
+ - **🗑** deletes it (and the default, if it was).
686
+
687
+ Storage is `localStorage[storageKey]`, so it is personal and per browser. Make the key unique per table **and** per account if people may share a browser. The shape is the one nml-vision v3's data-table writes, so a host that keeps v3's key (`nml.table.view:<viewKey>.saved.<userId>`) and field ids reads what people already saved there:
688
+
689
+ ```json
690
+ { "items": [{ "name": "Fallidas", "filters": { "status": ["FAILED"], "score": { "min": 3 } }, "search": [] }],
691
+ "defaultName": "Fallidas" }
692
+ ```
693
+
694
+ `filters` is keyed by field id; dates are stored as local `YYYY-MM-DD` days and come back as `Date`s; a single string where a multiselect expects a list is read as a one-item list. Nested `multifilter` fields are not saved. Field ids the config no longer has are ignored.
695
+
696
+ ```tsx
697
+ <EasyVisionTable
698
+ id="evaluations"
699
+ ingot={ingot}
700
+ multifilter={{
701
+ id: 'filters',
702
+ performButton: true,
703
+ config: { fields },
704
+ savedFilters: { storageKey: `nml.table.view:${view.key}.saved.${user.id}` },
705
+ }}
706
+ columns={columns}
707
+ />
708
+ ```
709
+
678
710
  ### Multifilter props
679
711
 
680
712
  | prop | type | default | notes |
@@ -695,6 +727,7 @@ Override per field with `toCondition: (value) => unknown` (return either a primi
695
727
  | `onStateChange` | `(snap) => void` | — | Same as `onChange`; provided for API symmetry. |
696
728
  | `showClearAll` | `boolean` | `editable` | Resets values & active fields to their initial state (`defaultValue`s and `pinned`/`initiallyActive` fields). |
697
729
  | `labels` | `Partial<MultifilterLabels>` | Spanish defaults | |
730
+ | `savedFilters` | `{ storageKey: string }` | — | Shows the **Guardados** menu. See [Saved filters](#saved-filters-guardados). |
698
731
  | `className`, `persist`, `clearWhen` | as in Input/Selector | | |
699
732
 
700
733
  ---
@@ -1732,6 +1765,18 @@ Things that bit us during development and are easy to miss at integration time.
1732
1765
 
1733
1766
  - **All colours come from shadcn semantic tokens.** Components rely on `--background`, `--foreground`, `--border`, `--muted`, `--card`, `--primary`, `--destructive`, etc. If your project doesn't define these (i.e. it isn't shadcn-themed), components will render with no styling.
1734
1767
  - **`.dark` mode is automatic** if your project applies the `.dark` class on a parent. EasyVision uses no hardcoded colors.
1768
+ - **shadcn v4 / Tailwind 4 hosts** define those tokens as complete colours (`--primary: oklch(…)`), which is invalid inside the `hsl(var(--primary))` EasyVision paints with: the colours come out blank. Define the `--ev-*` twin of each token instead (same names with an `ev-` prefix, any CSS colour). An `--ev-*` variable, when present, always wins over its shadcn token, so it is also how a host gives EasyVision a palette different from its own:
1769
+
1770
+ ```css
1771
+ :root {
1772
+ --ev-primary: #5b87da;
1773
+ --ev-border: hsl(162 8% 85%);
1774
+ --ev-muted-foreground: var(--muted-foreground); /* follow the host's own token */
1775
+ }
1776
+ .dark { --ev-primary: #71adff; }
1777
+ ```
1778
+
1779
+ Tokens: `background`, `foreground`, `card[-foreground]`, `popover[-foreground]`, `primary[-foreground]`, `secondary[-foreground]`, `muted[-foreground]`, `accent[-foreground]`, `destructive[-foreground]`, `border`, `input`, `ring`.
1735
1780
 
1736
1781
  ---
1737
1782
 
@@ -11,8 +11,8 @@
11
11
  /* ---------- Outer card ---------- */
12
12
  .ev-table-card {
13
13
  border-radius: 0.375rem;
14
- border: 1px solid hsl(var(--border, 220 13% 91%));
15
- background: hsl(var(--card, 0 0% 100%));
14
+ border: 1px solid var(--ev-border, hsl(var(--border, 220 13% 91%)));
15
+ background: var(--ev-card, hsl(var(--card, 0 0% 100%)));
16
16
  overflow: hidden;
17
17
  }
18
18
 
@@ -27,7 +27,7 @@
27
27
  justify-content: space-between;
28
28
  gap: 0.5rem;
29
29
  padding: 0.5rem 1rem;
30
- border-bottom: 1px solid hsl(var(--border, 220 13% 91%));
30
+ border-bottom: 1px solid var(--ev-border, hsl(var(--border, 220 13% 91%)));
31
31
  }
32
32
 
33
33
  .ev-table-toolbar-section {
@@ -41,8 +41,8 @@
41
41
  display: flex;
42
42
  align-items: center;
43
43
  gap: 0.5rem;
44
- border: 1px solid hsl(var(--primary, 222 47% 11%) / 0.3);
45
- background: hsl(var(--primary, 222 47% 11%) / 0.05);
44
+ border: 1px solid color-mix(in srgb, var(--ev-primary, hsl(var(--primary, 222 47% 11%))) 30%, transparent);
45
+ background: color-mix(in srgb, var(--ev-primary, hsl(var(--primary, 222 47% 11%))) 5%, transparent);
46
46
  border-radius: 0.125rem;
47
47
  padding: 0.25rem 0.75rem;
48
48
  font-size: 0.75rem;
@@ -52,12 +52,12 @@
52
52
  .ev-table-sel-banner-spinner {
53
53
  width: 0.75rem;
54
54
  height: 0.75rem;
55
- color: hsl(var(--primary, 222 47% 11%));
55
+ color: var(--ev-primary, hsl(var(--primary, 222 47% 11%)));
56
56
  animation: ev-spin 1s linear infinite;
57
57
  }
58
58
 
59
59
  .ev-table-sel-banner-text {
60
- color: hsl(var(--primary, 222 47% 11%));
60
+ color: var(--ev-primary, hsl(var(--primary, 222 47% 11%)));
61
61
  font-weight: 500;
62
62
  }
63
63
 
@@ -151,26 +151,26 @@
151
151
  position: sticky;
152
152
  top: 0;
153
153
  z-index: 10;
154
- background: hsl(var(--card, 0 0% 100%));
155
- box-shadow: inset 0 -1px 0 0 hsl(var(--border, 220 13% 91%));
154
+ background: var(--ev-card, hsl(var(--card, 0 0% 100%)));
155
+ box-shadow: inset 0 -1px 0 0 var(--ev-border, hsl(var(--border, 220 13% 91%)));
156
156
  }
157
157
 
158
158
  /* Row borders / hover / selection / highlight */
159
159
  .ev-table tr {
160
- border-bottom: 1px solid hsl(var(--border, 220 13% 91%));
160
+ border-bottom: 1px solid var(--ev-border, hsl(var(--border, 220 13% 91%)));
161
161
  transition: background-color 0.15s;
162
162
  }
163
163
  .ev-table tbody tr:last-child {
164
164
  border-bottom-width: 0;
165
165
  }
166
166
  .ev-table tbody tr:hover {
167
- background: hsl(var(--muted, 210 40% 96%) / 0.5);
167
+ background: color-mix(in srgb, var(--ev-muted, hsl(var(--muted, 210 40% 96%))) 50%, transparent);
168
168
  }
169
169
  .ev-table tr[data-state="selected"] {
170
- background: hsl(var(--muted, 210 40% 96%));
170
+ background: var(--ev-muted, hsl(var(--muted, 210 40% 96%)));
171
171
  }
172
172
  .ev-table tr[data-highlighted="true"] {
173
- background: hsl(var(--muted, 210 40% 96%) / 0.5);
173
+ background: color-mix(in srgb, var(--ev-muted, hsl(var(--muted, 210 40% 96%))) 50%, transparent);
174
174
  }
175
175
  .ev-table-row-clickable {
176
176
  cursor: pointer;
@@ -183,7 +183,7 @@
183
183
  text-align: left;
184
184
  vertical-align: middle;
185
185
  font-weight: 500;
186
- color: hsl(var(--muted-foreground, 215 16% 47%));
186
+ color: var(--ev-muted-foreground, hsl(var(--muted-foreground, 215 16% 47%)));
187
187
  position: relative;
188
188
  }
189
189
  .ev-table th:has([role=checkbox]) {
@@ -231,7 +231,7 @@
231
231
  height: 0.75rem;
232
232
  }
233
233
  .ev-table-sort-icon-inactive {
234
- color: hsl(var(--muted-foreground, 215 16% 47%));
234
+ color: var(--ev-muted-foreground, hsl(var(--muted-foreground, 215 16% 47%)));
235
235
  opacity: 0.5;
236
236
  }
237
237
 
@@ -255,7 +255,7 @@
255
255
  transform: translateY(-50%);
256
256
  height: 50%;
257
257
  width: 1px;
258
- background: hsl(var(--border, 220 13% 91%));
258
+ background: var(--ev-border, hsl(var(--border, 220 13% 91%)));
259
259
  transition: all 0.15s;
260
260
  }
261
261
  .ev-resize-handle:hover::after {
@@ -263,14 +263,14 @@
263
263
  height: 100%;
264
264
  top: 0;
265
265
  transform: translateY(0);
266
- background: hsl(var(--primary, 222 47% 11%) / 0.3);
266
+ background: color-mix(in srgb, var(--ev-primary, hsl(var(--primary, 222 47% 11%))) 30%, transparent);
267
267
  }
268
268
  .ev-resize-handle.is-resizing::after {
269
269
  width: 0.375rem;
270
270
  height: 100%;
271
271
  top: 0;
272
272
  transform: translateY(0);
273
- background: hsl(var(--primary, 222 47% 11%) / 0.6);
273
+ background: color-mix(in srgb, var(--ev-primary, hsl(var(--primary, 222 47% 11%))) 60%, transparent);
274
274
  }
275
275
 
276
276
  /* ---------- Truncate cell ---------- */
@@ -296,7 +296,7 @@
296
296
  .ev-table-loading-spinner {
297
297
  width: 1.5rem;
298
298
  height: 1.5rem;
299
- color: hsl(var(--muted-foreground, 215 16% 47%));
299
+ color: var(--ev-muted-foreground, hsl(var(--muted-foreground, 215 16% 47%)));
300
300
  animation: ev-spin 1s linear infinite;
301
301
  }
302
302
  .ev-table-empty-state {
@@ -306,7 +306,7 @@
306
306
  gap: 0.75rem;
307
307
  }
308
308
  .ev-table-empty-text {
309
- color: hsl(var(--muted-foreground, 215 16% 47%));
309
+ color: var(--ev-muted-foreground, hsl(var(--muted-foreground, 215 16% 47%)));
310
310
  }
311
311
 
312
312
  @keyframes ev-spin {
@@ -319,10 +319,10 @@
319
319
  align-items: center;
320
320
  justify-content: space-between;
321
321
  padding: 1rem;
322
- border-top: 1px solid hsl(var(--border, 220 13% 91%));
322
+ border-top: 1px solid var(--ev-border, hsl(var(--border, 220 13% 91%)));
323
323
  font-size: 0.875rem;
324
324
  line-height: 1.25rem;
325
- color: hsl(var(--muted-foreground, 215 16% 47%));
325
+ color: var(--ev-muted-foreground, hsl(var(--muted-foreground, 215 16% 47%)));
326
326
  }
327
327
  .ev-table-footer-section {
328
328
  display: flex;
@@ -332,12 +332,12 @@
332
332
  .ev-table-footer-ipp {
333
333
  height: 2.25rem;
334
334
  width: 70px;
335
- border: 1px solid hsl(var(--border, 220 13% 91%));
335
+ border: 1px solid var(--ev-border, hsl(var(--border, 220 13% 91%)));
336
336
  }
337
337
  .ev-table-footer-pg {
338
338
  height: 2.25rem;
339
339
  width: 4rem;
340
- border: 1px solid hsl(var(--border, 220 13% 91%));
340
+ border: 1px solid var(--ev-border, hsl(var(--border, 220 13% 91%)));
341
341
  }
342
342
  .ev-table-footer-nav {
343
343
  display: flex;
@@ -367,12 +367,12 @@
367
367
  height: 1.25rem;
368
368
  width: 1.25rem;
369
369
  border-radius: 0.25rem;
370
- border: 1px solid hsl(var(--border, 220 13% 91%));
371
- background: hsl(var(--background, 0 0% 100%));
370
+ border: 1px solid var(--ev-border, hsl(var(--border, 220 13% 91%)));
371
+ background: var(--ev-background, hsl(var(--background, 0 0% 100%)));
372
372
  cursor: pointer;
373
373
  }
374
374
  .ev-sa-toggle:hover {
375
- background: hsl(var(--muted, 210 40% 96%));
375
+ background: var(--ev-muted, hsl(var(--muted, 210 40% 96%)));
376
376
  }
377
377
  .ev-sa-toggle-icon {
378
378
  width: 0.875rem;