@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datagouv/components-next",
3
- "version": "1.4.1-dev.1354.gd30ac2d8",
3
+ "version": "1.4.1-dev.1355.g54710cb7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
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, ContentBloc, BlocWithTitle, DatasetsListBloc, DataservicesListBloc, ReusesListBloc, LinkInBloc, LinksListBloc, MarkdownBloc, AccordionItemBloc, AccordionListBloc, HeroBloc } from './types/pages'
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
- ContentBloc,
220
- BlocWithTitle,
221
- DatasetsListBloc,
222
- DataservicesListBloc,
223
- ReusesListBloc,
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
- HeroBloc,
235
+ ButtonBloc,
236
+ SectionColor,
230
237
  PaginatedArray,
231
238
  Post,
232
239
  PostAncestor,
@@ -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 BlocWithTitle = {
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 DatasetsListBloc = {
11
- class: 'DatasetsListBloc'
12
- datasets: Array<DatasetV2>
13
- } & BlocWithTitle & { id: string }
14
- export type DataservicesListBloc = {
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
- paragraph: string | null
32
- main_link_title: string | null
33
- main_link_url: string | null
32
+ id: string
34
33
  links: Array<LinkInBloc>
35
- } & BlocWithTitle & { id: string }
34
+ }
36
35
 
37
- export type MarkdownBloc = {
38
- class: 'MarkdownBloc'
39
- content: string
40
- } & BlocWithTitle & { id: string }
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 ContentBloc = DatasetsListBloc | DataservicesListBloc | ReusesListBloc | LinksListBloc | MarkdownBloc
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<ContentBloc>
76
+ content: Array<AccordionContentBloc>
47
77
  }
48
78
 
49
- export type AccordionListBloc = {
79
+ export type AccordionListBloc = Sized & {
50
80
  class: 'AccordionListBloc'
51
- title: string | null
52
- description: string | null
81
+ id: string
53
82
  items: Array<AccordionItemBloc>
54
- } & { id: string }
83
+ }
55
84
 
56
- export type HeroBloc = {
57
- class: 'HeroBloc'
58
- title: string
59
- description: string | null
60
- color: 'primary' | 'green' | 'purple'
61
- main_link_title: string | null
62
- main_link_url: string | null
63
- } & { id: string }
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
- export type PageBloc = ContentBloc | AccordionListBloc | HeroBloc
97
+ // The blocs of a page, from the top.
98
+ export type PageBloc = SectionBloc