@datagouv/components-next 1.4.1-dev.1354.gd30ac2d8 → 1.4.1-dev.1355.g54710cb7
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 +1 -1
- package/src/main.ts +14 -7
- package/src/types/pages.ts +70 -37
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { License } from './types/licenses'
|
|
|
13
13
|
import type { Member, MemberRole, NewOrganization, Organization, OrganizationOrSuggest, OrganizationReference, OrganizationSuggest } from './types/organizations'
|
|
14
14
|
import type { Owned, OwnedWithFullObject, OwnedWithId } from './types/owned'
|
|
15
15
|
import type { Comment, Thread } from './types/discussions'
|
|
16
|
-
import type { PageBloc,
|
|
16
|
+
import type { PageBloc, SectionBloc, SectionContentBloc, BlocWidth, LeafBloc, ObjectBloc, TitleBloc, DatasetBloc, DataserviceBloc, ReuseBloc, ExploreBloc, LinkInBloc, LinksListBloc, MarkdownBloc, AccordionContentBloc, AccordionItemBloc, AccordionListBloc, ButtonBloc, SectionColor } from './types/pages'
|
|
17
17
|
import type { Post, PostAncestor } from './types/posts'
|
|
18
18
|
import type { ReuseReference, NewReuse, Reuse, ReuseV2, ReuseTopic, ReuseType } from './types/reuses'
|
|
19
19
|
import type { RegisteredSchema, Schema, SchemaDetails, SchemaField, SchemaPath, SchemaPublicationMode, SchemaResponseData, SchemaVersion, ValidataError } from './types/schemas'
|
|
@@ -216,17 +216,24 @@ export type {
|
|
|
216
216
|
OwnedWithFullObject,
|
|
217
217
|
OwnedWithId,
|
|
218
218
|
PageBloc,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
SectionBloc,
|
|
220
|
+
SectionContentBloc,
|
|
221
|
+
BlocWidth,
|
|
222
|
+
LeafBloc,
|
|
223
|
+
ObjectBloc,
|
|
224
|
+
TitleBloc,
|
|
225
|
+
DatasetBloc,
|
|
226
|
+
DataserviceBloc,
|
|
227
|
+
ReuseBloc,
|
|
228
|
+
ExploreBloc,
|
|
224
229
|
LinkInBloc,
|
|
225
230
|
LinksListBloc,
|
|
226
231
|
MarkdownBloc,
|
|
232
|
+
AccordionContentBloc,
|
|
227
233
|
AccordionItemBloc,
|
|
228
234
|
AccordionListBloc,
|
|
229
|
-
|
|
235
|
+
ButtonBloc,
|
|
236
|
+
SectionColor,
|
|
230
237
|
PaginatedArray,
|
|
231
238
|
Post,
|
|
232
239
|
PostAncestor,
|
package/src/types/pages.ts
CHANGED
|
@@ -2,23 +2,24 @@ import type { DatasetV2 } from './datasets'
|
|
|
2
2
|
import type { Dataservice } from './dataservices'
|
|
3
3
|
import type { Reuse } from './reuses'
|
|
4
4
|
|
|
5
|
-
export type
|
|
5
|
+
export type BlocWidth = '1/4' | '1/3' | '1/2' | '2/3' | '3/4'
|
|
6
|
+
|
|
7
|
+
// Blocs inside a section or an accordion item sit side by side, wrapping to a new row when
|
|
8
|
+
// the row is full. `null`: the whole row.
|
|
9
|
+
type Sized = { width: BlocWidth | null }
|
|
10
|
+
|
|
11
|
+
export type TitleBloc = Sized & {
|
|
12
|
+
class: 'TitleBloc'
|
|
13
|
+
id: string
|
|
6
14
|
title: string
|
|
7
15
|
subtitle: string | null
|
|
8
16
|
}
|
|
9
17
|
|
|
10
|
-
export type
|
|
11
|
-
class: '
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class: 'DataservicesListBloc'
|
|
16
|
-
dataservices: Array<Dataservice>
|
|
17
|
-
} & BlocWithTitle & { id: string }
|
|
18
|
-
export type ReusesListBloc = {
|
|
19
|
-
class: 'ReusesListBloc'
|
|
20
|
-
reuses: Array<Reuse>
|
|
21
|
-
} & BlocWithTitle & { id: string }
|
|
18
|
+
export type MarkdownBloc = Sized & {
|
|
19
|
+
class: 'MarkdownBloc'
|
|
20
|
+
id: string
|
|
21
|
+
content: string
|
|
22
|
+
}
|
|
22
23
|
|
|
23
24
|
export type LinkInBloc = {
|
|
24
25
|
title: string
|
|
@@ -26,40 +27,72 @@ export type LinkInBloc = {
|
|
|
26
27
|
color: string | null
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export type LinksListBloc = {
|
|
30
|
+
export type LinksListBloc = Sized & {
|
|
30
31
|
class: 'LinksListBloc'
|
|
31
|
-
|
|
32
|
-
main_link_title: string | null
|
|
33
|
-
main_link_url: string | null
|
|
32
|
+
id: string
|
|
34
33
|
links: Array<LinkInBloc>
|
|
35
|
-
}
|
|
34
|
+
}
|
|
36
35
|
|
|
37
|
-
export type
|
|
38
|
-
class: '
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
export type ButtonBloc = Sized & {
|
|
37
|
+
class: 'ButtonBloc'
|
|
38
|
+
id: string
|
|
39
|
+
title: string
|
|
40
|
+
url: string
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type ExploreBloc = Sized & {
|
|
44
|
+
class: 'ExploreBloc'
|
|
45
|
+
id: string
|
|
46
|
+
resource_id: string
|
|
47
|
+
}
|
|
41
48
|
|
|
42
|
-
export type
|
|
49
|
+
export type DatasetBloc = Sized & {
|
|
50
|
+
class: 'DatasetBloc'
|
|
51
|
+
id: string
|
|
52
|
+
dataset: DatasetV2
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type DataserviceBloc = Sized & {
|
|
56
|
+
class: 'DataserviceBloc'
|
|
57
|
+
id: string
|
|
58
|
+
dataservice: Dataservice
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type ReuseBloc = Sized & {
|
|
62
|
+
class: 'ReuseBloc'
|
|
63
|
+
id: string
|
|
64
|
+
reuse: Reuse
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type ObjectBloc = DatasetBloc | DataserviceBloc | ReuseBloc
|
|
68
|
+
|
|
69
|
+
export type LeafBloc = TitleBloc | MarkdownBloc | LinksListBloc | ButtonBloc | ExploreBloc | ObjectBloc
|
|
70
|
+
|
|
71
|
+
export type AccordionContentBloc = Exclude<LeafBloc, ExploreBloc>
|
|
43
72
|
|
|
44
73
|
export type AccordionItemBloc = {
|
|
74
|
+
id: string
|
|
45
75
|
title: string
|
|
46
|
-
content: Array<
|
|
76
|
+
content: Array<AccordionContentBloc>
|
|
47
77
|
}
|
|
48
78
|
|
|
49
|
-
export type AccordionListBloc = {
|
|
79
|
+
export type AccordionListBloc = Sized & {
|
|
50
80
|
class: 'AccordionListBloc'
|
|
51
|
-
|
|
52
|
-
description: string | null
|
|
81
|
+
id: string
|
|
53
82
|
items: Array<AccordionItemBloc>
|
|
54
|
-
}
|
|
83
|
+
}
|
|
55
84
|
|
|
56
|
-
export type
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
85
|
+
export type SectionContentBloc = AccordionListBloc | LeafBloc
|
|
86
|
+
|
|
87
|
+
export type SectionColor = 'primary' | 'green' | 'purple'
|
|
88
|
+
|
|
89
|
+
export type SectionBloc = {
|
|
90
|
+
class: 'SectionBloc'
|
|
91
|
+
id: string
|
|
92
|
+
// `null`: the sections of the page alternate their neutral backgrounds.
|
|
93
|
+
color: SectionColor | null
|
|
94
|
+
blocs: Array<SectionContentBloc>
|
|
95
|
+
}
|
|
64
96
|
|
|
65
|
-
|
|
97
|
+
// The blocs of a page, from the top.
|
|
98
|
+
export type PageBloc = SectionBloc
|