@easyvision/easyvision-ui 1.9.3 → 1.11.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
@@ -1449,7 +1449,7 @@ const filter: LoopbackFilter = {
1449
1449
 
1450
1450
  The library makes no assumptions about how the HTTP requests are issued — `fetchPage` and `fetchCount` are plain async functions. Bring your own auth, base URL, error handling, etc.
1451
1451
 
1452
- For non-LoopBack backends, inline a custom `fetchData` — see [Adapting an arbitrary API response](#adapting-an-arbitrary-api-response) below — or contribute a sibling adapter (e.g. `adapters/westack.ts`) following the same pattern.
1452
+ For non-LoopBack backends, inline a custom `fetchData` — see [Adapting an arbitrary API response](#adapting-an-arbitrary-api-response) below — or contribute a sibling adapter following the same pattern (see `adapters/ingot.ts` below).
1453
1453
 
1454
1454
  #### Local mode filtering with the same DSL — `matchLoopbackWhere`
1455
1455
 
@@ -1529,6 +1529,38 @@ Behavior on edge cases:
1529
1529
  - Unknown `$operator` → `false` (fail-closed; surfaces typos early).
1530
1530
  - Plain-object equality (`{ a: { b: 1 } }`) is not supported — use dotted paths (`'a.b'`) or `$and`.
1531
1531
 
1532
+ ### API adapters: ingot (NML v3)
1533
+
1534
+ ingot keeps LoopBack's `?filter=` shape (`where`, `include`, `order`, `fields`, `limit`, `skip`) but only accepts operator names without `$`. The `ingot` prop (or `createIngotTableFetcher`) takes the same mongo-style `where` the multifilter builds and translates it on the way out, so multifilters, local mode and `externalFilter` stay unchanged:
1535
+
1536
+ | Multifilter emits | Sent to ingot |
1537
+ |---|---|
1538
+ | `$in` / `$nin` | `inq` / `nin` |
1539
+ | `$eq`, `$ne`/`$neq`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` | `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `exists` |
1540
+ | `$and` / `$or` | `and` / `or` |
1541
+ | text search (`$regex: '.*…*'`, `$options: 'i'`) | `ilike: '…'` (ingot's `like`/`ilike` are literal substring matches) |
1542
+
1543
+ Anything ingot cannot express — `$not`, a real regex pattern (ingot disables `regexp`), an unknown `$` operator — throws instead of being dropped, so a filter never silently widens. Operators already in ingot form pass through.
1544
+
1545
+ ingot returns the total in the `X-Total-Count` header of the page response, so there is no `fetchCount`: `fetchPage` returns `{ rows, totalCount }`.
1546
+
1547
+ ```tsx
1548
+ <EasyVisionTable
1549
+ id="documents"
1550
+ ingot={{
1551
+ fetchPage: async (filter) => {
1552
+ const res = await api.get('/documents', { params: { filter: JSON.stringify(filter) } });
1553
+ return { rows: res.data, totalCount: Number(res.headers['x-total-count']) };
1554
+ },
1555
+ include: [{ relation: 'subject' }],
1556
+ defaultOrder: ['updatedAt DESC'],
1557
+ }}
1558
+ columns={columns}
1559
+ />
1560
+ ```
1561
+
1562
+ `toIngotWhere(where)` is exported for requests the table does not make (e.g. a `/count` or `/export` call with the same multifilter `where`).
1563
+
1532
1564
  ### Adapting an arbitrary API response
1533
1565
 
1534
1566
  `fetchData` must return `{ rows: T[]; totalCount: number }`. Wrap whatever shape your backend gives you:
@@ -1700,6 +1732,18 @@ Things that bit us during development and are easy to miss at integration time.
1700
1732
 
1701
1733
  - **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.
1702
1734
  - **`.dark` mode is automatic** if your project applies the `.dark` class on a parent. EasyVision uses no hardcoded colors.
1735
+ - **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:
1736
+
1737
+ ```css
1738
+ :root {
1739
+ --ev-primary: #5b87da;
1740
+ --ev-border: hsl(162 8% 85%);
1741
+ --ev-muted-foreground: var(--muted-foreground); /* follow the host's own token */
1742
+ }
1743
+ .dark { --ev-primary: #71adff; }
1744
+ ```
1745
+
1746
+ Tokens: `background`, `foreground`, `card[-foreground]`, `popover[-foreground]`, `primary[-foreground]`, `secondary[-foreground]`, `muted[-foreground]`, `accent[-foreground]`, `destructive[-foreground]`, `border`, `input`, `ring`.
1703
1747
 
1704
1748
  ---
1705
1749
 
@@ -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;