UNPKG

2.11 kBMarkdownView Raw
1# Migrating from v3.x to v4.x
2
3Version 4 of Rendition includes some breaking changes. This document aims to
4list these changes and provide a migration path for users wanting to upgrade.
5
6## Dependency updates
7
8The following dependencies have been updated to their latest versions:
9- `react`
10- `react-dom`
11- `@types/react`
12- `@types/react-dom`
13- `grid-styled`
14- `resin-semver`
15- `styled-components`
16
17## Tooltips
18
19The tooltip component has been removed in v4. To add a tooltip to your
20component, simply add the `tooltip` property to it.
21The `tooltip` property can be either a string containing the tooltip text or an
22options object.
23
24| Option | Type | Description |
25--- | --- | ---
26text | string | The text displayed in the tooltip
27trigger | 'hover' | 'click' | The event used to display the tooltip, defaults to 'hover'
28placement | 'top' | 'right' | 'bottom' | 'left' | The position that the tooltip should be displayed
29
30## Image
31
32The `Image` component has been renamed to `Img` to prevent conflicts with the
33`Image()` web API - https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image
34
35## Text
36
37The `Text` component has been renamed to `Txt` to prevent conflicts with the
38`Text()` web API - https://developer.mozilla.org/en-US/docs/Web/API/Text
39
40## Filters
41The `Semver` and `Semver Range` types have been removed
42`SchemaSieve` is no longer a factory function, and its methods can be accessed
43without instantiation.
44
45```
46import { SchemaSieve } from 'rendition';
47const sieve = SchemaSieve();
48// ...
49sieve.filter(items, rules)
50```
51
52now becomes:
53
54```
55import { SchemaSieve } from 'rendition';
56SchemaSieve.filter(filters, items)
57```
58
59Filters now use JSON schema (draft 6) for both schemas and rules.
60Any views, schemas or filters created using v3 can be migrated using the
61functions `migrateLegacyFilter()`, `migrateLegacyViews()` and
62`migrateLegacySchema()` functions in the `SchemaSieve` object
63
64The filters components now only requires a schema property to bootstrap. You can
65be notified of filter and view changes using the `onFiltersUpdate` and
66`onViewsUpdate` properties.