@cooperco/cooper-component-library 0.1.128 → 0.1.129

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.
Files changed (45) hide show
  1. package/dist/cms/0095-create-table-module.cjs +174 -0
  2. package/dist/cms/0096-update-container-collection-filtered-table.cjs +57 -0
  3. package/dist/cms/containerCollectionModule.query.ts +6 -0
  4. package/dist/cms/contentful/migrations/scripts/0095-create-table-module.cjs +174 -0
  5. package/dist/cms/contentful/migrations/scripts/0096-update-container-collection-filtered-table.cjs +57 -0
  6. package/dist/cms/contentful/queries/containerCollectionModule.query.js +6 -0
  7. package/dist/cms/contentful/queries/containerCollectionModule.query.ts +6 -0
  8. package/dist/cms/contentful/queries/index.d.ts +1 -0
  9. package/dist/cms/contentful/queries/index.js +1 -0
  10. package/dist/cms/contentful/queries/index.ts +2 -0
  11. package/dist/cms/contentful/queries/tableModule.query.d.ts +2 -0
  12. package/dist/cms/contentful/queries/tableModule.query.js +60 -0
  13. package/dist/cms/contentful/queries/tableModule.query.ts +62 -0
  14. package/dist/cms/index.ts +2 -0
  15. package/dist/cms/migrations/scripts/0095-create-table-module.cjs +174 -0
  16. package/dist/cms/migrations/scripts/0096-update-container-collection-filtered-table.cjs +57 -0
  17. package/dist/cms/queries/containerCollectionModule.query.ts +6 -0
  18. package/dist/cms/queries/index.ts +2 -0
  19. package/dist/cms/queries/tableModule.query.ts +62 -0
  20. package/dist/cms/scripts/0095-create-table-module.cjs +174 -0
  21. package/dist/cms/scripts/0096-update-container-collection-filtered-table.cjs +57 -0
  22. package/dist/cms/tableModule.query.ts +62 -0
  23. package/dist/lib/component-lib.js +3634 -3253
  24. package/dist/lib/component-lib.umd.cjs +23 -23
  25. package/dist/lib/css/main.css +48 -18
  26. package/dist/lib/style.css +1 -1
  27. package/dist/types/cms/contentful/queries/index.d.ts +1 -0
  28. package/dist/types/cms/contentful/queries/tableModule.query.d.ts +2 -0
  29. package/dist/types/src/components/ContainerCollectionModule/ContainerCollectionModule.d.ts +4 -1
  30. package/dist/types/src/components/TableModule/TableModule.d.ts +51 -0
  31. package/dist/types/src/components/TableModule/TableModule.vue.d.ts +3 -0
  32. package/dist/types/src/components/components.d.ts +1 -0
  33. package/dist/types/src/components/types.d.ts +1 -0
  34. package/dist/types/src/config/defaultPassthrough/index.d.ts +1 -0
  35. package/dist/types/src/config/defaultPassthrough/types.d.ts +3 -1
  36. package/dist/types/src/types.d.ts +1 -0
  37. package/package.json +1 -1
  38. /package/dist/cms/{0095-tabmodule-inline-body-copy.cjs → 0097-tabmodule-inline-body-copy.cjs} +0 -0
  39. /package/dist/cms/{0096-delete-body-copy-content-type.cjs → 0098-delete-body-copy-content-type.cjs} +0 -0
  40. /package/dist/cms/contentful/migrations/scripts/{0095-tabmodule-inline-body-copy.cjs → 0097-tabmodule-inline-body-copy.cjs} +0 -0
  41. /package/dist/cms/contentful/migrations/scripts/{0096-delete-body-copy-content-type.cjs → 0098-delete-body-copy-content-type.cjs} +0 -0
  42. /package/dist/cms/migrations/scripts/{0095-tabmodule-inline-body-copy.cjs → 0097-tabmodule-inline-body-copy.cjs} +0 -0
  43. /package/dist/cms/migrations/scripts/{0096-delete-body-copy-content-type.cjs → 0098-delete-body-copy-content-type.cjs} +0 -0
  44. /package/dist/cms/scripts/{0095-tabmodule-inline-body-copy.cjs → 0097-tabmodule-inline-body-copy.cjs} +0 -0
  45. /package/dist/cms/scripts/{0096-delete-body-copy-content-type.cjs → 0098-delete-body-copy-content-type.cjs} +0 -0
@@ -0,0 +1,174 @@
1
+ const addEntryNameField = require('../helpers/addEntryNameField.cjs')
2
+
3
+ module.exports = {
4
+ // @ts-check
5
+ /** @type { import('contentful-migration').MigrationFunction } */
6
+ up: function (migration) {
7
+ const tableModule = migration.createContentType('tableModule', {
8
+ name: 'Table Module',
9
+ displayField: 'entryName',
10
+ })
11
+
12
+ // Add mandatory entryName field
13
+ addEntryNameField(tableModule)
14
+
15
+ // Title
16
+ tableModule.createField('title', {
17
+ name: 'Title',
18
+ type: 'Symbol',
19
+ required: false,
20
+ })
21
+
22
+ // Description (RichText)
23
+ tableModule.createField('description', {
24
+ name: 'Description',
25
+ type: 'RichText',
26
+ required: false,
27
+ validations: [
28
+ {
29
+ enabledMarks: ['bold', 'italic', 'underline'],
30
+ message: 'Only bold, italic, and underline marks are allowed',
31
+ },
32
+ {
33
+ enabledNodeTypes: [
34
+ 'ordered-list',
35
+ 'unordered-list',
36
+ 'hr',
37
+ 'hyperlink',
38
+ 'embedded-entry-inline',
39
+ ],
40
+ },
41
+ {
42
+ nodes: {
43
+ 'embedded-entry-inline': [
44
+ {
45
+ linkContentType: ['highlightedText'],
46
+ message: 'You can only embed Highlighted Text.',
47
+ },
48
+ ],
49
+ },
50
+ },
51
+ ],
52
+ })
53
+
54
+ // Body Copy Alignment
55
+ tableModule.createField('bodyCopyAlignment', {
56
+ name: 'Body Copy Alignment',
57
+ type: 'Symbol',
58
+ required: false,
59
+ validations: [
60
+ {
61
+ in: ['Left', 'Center', 'Right'],
62
+ },
63
+ ],
64
+ })
65
+ tableModule.changeFieldControl('bodyCopyAlignment', 'builtin', 'dropdown', {
66
+ helpText: 'Override the description copy text alignment independently. If not set, it will follow the default alignment.',
67
+ })
68
+
69
+ // Table Highlight
70
+ tableModule.createField('tableHighlight', {
71
+ name: 'Table Highlight',
72
+ type: 'Symbol',
73
+ required: false,
74
+ validations: [
75
+ {
76
+ in: ['Row', 'Column'],
77
+ },
78
+ ],
79
+ })
80
+ tableModule.changeFieldControl('tableHighlight', 'builtin', 'dropdown', {
81
+ helpText: 'Highlight a specific row or column in the table.',
82
+ })
83
+
84
+ // Table (RichText with table node enabled)
85
+ tableModule.createField('table', {
86
+ name: 'Table',
87
+ type: 'RichText',
88
+ required: true,
89
+ validations: [
90
+ {
91
+ enabledMarks: ['bold', 'italic', 'underline'],
92
+ message: 'Only bold, italic, and underline marks are allowed',
93
+ },
94
+ {
95
+ enabledNodeTypes: [
96
+ 'table',
97
+ 'hyperlink',
98
+ 'embedded-entry-inline',
99
+ 'unordered-list',
100
+ 'ordered-list',
101
+ ],
102
+ },
103
+ {
104
+ nodes: {
105
+ 'embedded-entry-inline': [
106
+ {
107
+ linkContentType: ['highlightedText'],
108
+ message: 'You can only embed Highlighted Text.',
109
+ },
110
+ ],
111
+ },
112
+ },
113
+ ],
114
+ })
115
+
116
+ // Filter columns (Symbol list)
117
+ tableModule.createField('filterColumns', {
118
+ name: 'Filter Columns',
119
+ type: 'Array',
120
+ required: false,
121
+ items: {
122
+ type: 'Symbol',
123
+ validations: [],
124
+ },
125
+ })
126
+ tableModule.changeFieldControl('filterColumns', 'builtin', 'tagEditor', {
127
+ helpText: 'Enter the exact column heading(s) to make filterable. Max 4 suggested.',
128
+ })
129
+
130
+ // Footer (RichText)
131
+ tableModule.createField('footer', {
132
+ name: 'Footer',
133
+ type: 'RichText',
134
+ required: false,
135
+ validations: [
136
+ {
137
+ enabledMarks: ['bold', 'italic', 'underline'],
138
+ message: 'Only bold, italic, and underline marks are allowed',
139
+ },
140
+ {
141
+ enabledNodeTypes: ['hyperlink', 'embedded-entry-inline'],
142
+ },
143
+ {
144
+ nodes: {
145
+ 'embedded-entry-inline': [
146
+ {
147
+ linkContentType: ['highlightedText'],
148
+ message: 'You can only embed Highlighted Text.',
149
+ },
150
+ ],
151
+ },
152
+ },
153
+ ],
154
+ })
155
+
156
+ // Background Color
157
+ tableModule.createField('backgroundColor', {
158
+ name: 'Background Color',
159
+ type: 'Symbol',
160
+ required: false,
161
+ })
162
+
163
+ // Change field control for Color Picker App
164
+ tableModule.changeFieldControl(
165
+ 'backgroundColor',
166
+ 'app',
167
+ process.env.COLOR_PICKER_APP_ID
168
+ )
169
+ },
170
+
171
+ down: async function (migration) {
172
+ await migration.deleteContentType('tableModule')
173
+ },
174
+ }
@@ -0,0 +1,57 @@
1
+ module.exports = {
2
+ // @ts-check
3
+ /** @type { import('contentful-migration').MigrationFunction } */
4
+ up: function (migration) {
5
+ const collection = migration.editContentType('containerCollectionModule')
6
+
7
+ // Delete the variant field from Contentful
8
+ collection.deleteField('variant')
9
+
10
+ // Subheadline field
11
+ collection.createField('subheadline', {
12
+ name: 'Subheadline',
13
+ type: 'Symbol',
14
+ required: false,
15
+ })
16
+
17
+ // Order the fields
18
+ collection.moveField('subheadline').afterField('headline')
19
+
20
+ // Update link validations for modules collection to accept splitModule and tableModule
21
+ collection.editField('modules').items({
22
+ type: 'Link',
23
+ linkType: 'Entry',
24
+ validations: [
25
+ {
26
+ linkContentType: ['splitModule', 'tableModule'],
27
+ },
28
+ ],
29
+ })
30
+
31
+ // Add helper text to modules field
32
+ collection.changeFieldControl('modules', 'builtin', 'entryCardsEditor', {
33
+ helpText:
34
+ 'Add Table Modules to render filtered tables with tabs, or Split Modules for standard collections.',
35
+ })
36
+ },
37
+
38
+ // @ts-check
39
+ /** @type { import('contentful-migration').MigrationFunction } */
40
+ down: function (migration) {
41
+ const collection = migration.editContentType('containerCollectionModule')
42
+
43
+ // Delete subheadline field
44
+ collection.deleteField('subheadline')
45
+
46
+ // Revert validations on modules collection to splitModule only
47
+ collection.editField('modules').items({
48
+ type: 'Link',
49
+ linkType: 'Entry',
50
+ validations: [
51
+ {
52
+ linkContentType: ['splitModule'],
53
+ },
54
+ ],
55
+ })
56
+ },
57
+ }
@@ -12,6 +12,7 @@ export const getContainerCollectionModule: DocumentNode = gql`
12
12
  }
13
13
 
14
14
  headline
15
+ subheadline
15
16
 
16
17
  modulesCollection {
17
18
  items {
@@ -22,6 +23,11 @@ export const getContainerCollectionModule: DocumentNode = gql`
22
23
  id
23
24
  }
24
25
  }
26
+ ... on TableModule {
27
+ sys {
28
+ id
29
+ }
30
+ }
25
31
  }
26
32
  }
27
33
 
@@ -0,0 +1,174 @@
1
+ const addEntryNameField = require('../helpers/addEntryNameField.cjs')
2
+
3
+ module.exports = {
4
+ // @ts-check
5
+ /** @type { import('contentful-migration').MigrationFunction } */
6
+ up: function (migration) {
7
+ const tableModule = migration.createContentType('tableModule', {
8
+ name: 'Table Module',
9
+ displayField: 'entryName',
10
+ })
11
+
12
+ // Add mandatory entryName field
13
+ addEntryNameField(tableModule)
14
+
15
+ // Title
16
+ tableModule.createField('title', {
17
+ name: 'Title',
18
+ type: 'Symbol',
19
+ required: false,
20
+ })
21
+
22
+ // Description (RichText)
23
+ tableModule.createField('description', {
24
+ name: 'Description',
25
+ type: 'RichText',
26
+ required: false,
27
+ validations: [
28
+ {
29
+ enabledMarks: ['bold', 'italic', 'underline'],
30
+ message: 'Only bold, italic, and underline marks are allowed',
31
+ },
32
+ {
33
+ enabledNodeTypes: [
34
+ 'ordered-list',
35
+ 'unordered-list',
36
+ 'hr',
37
+ 'hyperlink',
38
+ 'embedded-entry-inline',
39
+ ],
40
+ },
41
+ {
42
+ nodes: {
43
+ 'embedded-entry-inline': [
44
+ {
45
+ linkContentType: ['highlightedText'],
46
+ message: 'You can only embed Highlighted Text.',
47
+ },
48
+ ],
49
+ },
50
+ },
51
+ ],
52
+ })
53
+
54
+ // Body Copy Alignment
55
+ tableModule.createField('bodyCopyAlignment', {
56
+ name: 'Body Copy Alignment',
57
+ type: 'Symbol',
58
+ required: false,
59
+ validations: [
60
+ {
61
+ in: ['Left', 'Center', 'Right'],
62
+ },
63
+ ],
64
+ })
65
+ tableModule.changeFieldControl('bodyCopyAlignment', 'builtin', 'dropdown', {
66
+ helpText: 'Override the description copy text alignment independently. If not set, it will follow the default alignment.',
67
+ })
68
+
69
+ // Table Highlight
70
+ tableModule.createField('tableHighlight', {
71
+ name: 'Table Highlight',
72
+ type: 'Symbol',
73
+ required: false,
74
+ validations: [
75
+ {
76
+ in: ['Row', 'Column'],
77
+ },
78
+ ],
79
+ })
80
+ tableModule.changeFieldControl('tableHighlight', 'builtin', 'dropdown', {
81
+ helpText: 'Highlight a specific row or column in the table.',
82
+ })
83
+
84
+ // Table (RichText with table node enabled)
85
+ tableModule.createField('table', {
86
+ name: 'Table',
87
+ type: 'RichText',
88
+ required: true,
89
+ validations: [
90
+ {
91
+ enabledMarks: ['bold', 'italic', 'underline'],
92
+ message: 'Only bold, italic, and underline marks are allowed',
93
+ },
94
+ {
95
+ enabledNodeTypes: [
96
+ 'table',
97
+ 'hyperlink',
98
+ 'embedded-entry-inline',
99
+ 'unordered-list',
100
+ 'ordered-list',
101
+ ],
102
+ },
103
+ {
104
+ nodes: {
105
+ 'embedded-entry-inline': [
106
+ {
107
+ linkContentType: ['highlightedText'],
108
+ message: 'You can only embed Highlighted Text.',
109
+ },
110
+ ],
111
+ },
112
+ },
113
+ ],
114
+ })
115
+
116
+ // Filter columns (Symbol list)
117
+ tableModule.createField('filterColumns', {
118
+ name: 'Filter Columns',
119
+ type: 'Array',
120
+ required: false,
121
+ items: {
122
+ type: 'Symbol',
123
+ validations: [],
124
+ },
125
+ })
126
+ tableModule.changeFieldControl('filterColumns', 'builtin', 'tagEditor', {
127
+ helpText: 'Enter the exact column heading(s) to make filterable. Max 4 suggested.',
128
+ })
129
+
130
+ // Footer (RichText)
131
+ tableModule.createField('footer', {
132
+ name: 'Footer',
133
+ type: 'RichText',
134
+ required: false,
135
+ validations: [
136
+ {
137
+ enabledMarks: ['bold', 'italic', 'underline'],
138
+ message: 'Only bold, italic, and underline marks are allowed',
139
+ },
140
+ {
141
+ enabledNodeTypes: ['hyperlink', 'embedded-entry-inline'],
142
+ },
143
+ {
144
+ nodes: {
145
+ 'embedded-entry-inline': [
146
+ {
147
+ linkContentType: ['highlightedText'],
148
+ message: 'You can only embed Highlighted Text.',
149
+ },
150
+ ],
151
+ },
152
+ },
153
+ ],
154
+ })
155
+
156
+ // Background Color
157
+ tableModule.createField('backgroundColor', {
158
+ name: 'Background Color',
159
+ type: 'Symbol',
160
+ required: false,
161
+ })
162
+
163
+ // Change field control for Color Picker App
164
+ tableModule.changeFieldControl(
165
+ 'backgroundColor',
166
+ 'app',
167
+ process.env.COLOR_PICKER_APP_ID
168
+ )
169
+ },
170
+
171
+ down: async function (migration) {
172
+ await migration.deleteContentType('tableModule')
173
+ },
174
+ }
@@ -0,0 +1,57 @@
1
+ module.exports = {
2
+ // @ts-check
3
+ /** @type { import('contentful-migration').MigrationFunction } */
4
+ up: function (migration) {
5
+ const collection = migration.editContentType('containerCollectionModule')
6
+
7
+ // Delete the variant field from Contentful
8
+ collection.deleteField('variant')
9
+
10
+ // Subheadline field
11
+ collection.createField('subheadline', {
12
+ name: 'Subheadline',
13
+ type: 'Symbol',
14
+ required: false,
15
+ })
16
+
17
+ // Order the fields
18
+ collection.moveField('subheadline').afterField('headline')
19
+
20
+ // Update link validations for modules collection to accept splitModule and tableModule
21
+ collection.editField('modules').items({
22
+ type: 'Link',
23
+ linkType: 'Entry',
24
+ validations: [
25
+ {
26
+ linkContentType: ['splitModule', 'tableModule'],
27
+ },
28
+ ],
29
+ })
30
+
31
+ // Add helper text to modules field
32
+ collection.changeFieldControl('modules', 'builtin', 'entryCardsEditor', {
33
+ helpText:
34
+ 'Add Table Modules to render filtered tables with tabs, or Split Modules for standard collections.',
35
+ })
36
+ },
37
+
38
+ // @ts-check
39
+ /** @type { import('contentful-migration').MigrationFunction } */
40
+ down: function (migration) {
41
+ const collection = migration.editContentType('containerCollectionModule')
42
+
43
+ // Delete subheadline field
44
+ collection.deleteField('subheadline')
45
+
46
+ // Revert validations on modules collection to splitModule only
47
+ collection.editField('modules').items({
48
+ type: 'Link',
49
+ linkType: 'Entry',
50
+ validations: [
51
+ {
52
+ linkContentType: ['splitModule'],
53
+ },
54
+ ],
55
+ })
56
+ },
57
+ }
@@ -10,6 +10,7 @@ export const getContainerCollectionModule = gql `
10
10
  }
11
11
 
12
12
  headline
13
+ subheadline
13
14
 
14
15
  modulesCollection {
15
16
  items {
@@ -20,6 +21,11 @@ export const getContainerCollectionModule = gql `
20
21
  id
21
22
  }
22
23
  }
24
+ ... on TableModule {
25
+ sys {
26
+ id
27
+ }
28
+ }
23
29
  }
24
30
  }
25
31
 
@@ -12,6 +12,7 @@ export const getContainerCollectionModule: DocumentNode = gql`
12
12
  }
13
13
 
14
14
  headline
15
+ subheadline
15
16
 
16
17
  modulesCollection {
17
18
  items {
@@ -22,6 +23,11 @@ export const getContainerCollectionModule: DocumentNode = gql`
22
23
  id
23
24
  }
24
25
  }
26
+ ... on TableModule {
27
+ sys {
28
+ id
29
+ }
30
+ }
25
31
  }
26
32
  }
27
33
 
@@ -21,3 +21,4 @@ export * from './helloBanner.query.js';
21
21
  export * from './placeholderModule.query.js';
22
22
  export * from './splitModule.query.js';
23
23
  export * from './containerCollectionModule.query.js';
24
+ export * from './tableModule.query.js';
@@ -21,3 +21,4 @@ export * from './helloBanner.query.js';
21
21
  export * from './placeholderModule.query.js';
22
22
  export * from './splitModule.query.js';
23
23
  export * from './containerCollectionModule.query.js';
24
+ export * from './tableModule.query.js';
@@ -21,3 +21,5 @@ export * from './helloBanner.query.js'
21
21
  export * from './placeholderModule.query.js'
22
22
  export * from './splitModule.query.js'
23
23
  export * from './containerCollectionModule.query.js'
24
+ export * from './tableModule.query.js'
25
+
@@ -0,0 +1,2 @@
1
+ import type { DocumentNode } from 'graphql';
2
+ export declare const getTableModule: DocumentNode;
@@ -0,0 +1,60 @@
1
+ import { gql } from 'graphql-tag';
2
+ export const getTableModule = gql `
3
+ query tableModuleQuery($id: String!, $preview: Boolean = false) {
4
+ tableModule(id: $id, preview: $preview) {
5
+ sys {
6
+ id
7
+ }
8
+ title
9
+ description {
10
+ json
11
+ links {
12
+ entries {
13
+ inline {
14
+ sys {
15
+ id
16
+ }
17
+ ... on HighlightedText {
18
+ text
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+ table {
25
+ json
26
+ links {
27
+ entries {
28
+ inline {
29
+ sys {
30
+ id
31
+ }
32
+ ... on HighlightedText {
33
+ text
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ filterColumns
40
+ footer {
41
+ json
42
+ links {
43
+ entries {
44
+ inline {
45
+ sys {
46
+ id
47
+ }
48
+ ... on HighlightedText {
49
+ text
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ backgroundColor
56
+ bodyCopyAlignment
57
+ tableHighlight
58
+ }
59
+ }
60
+ `;
@@ -0,0 +1,62 @@
1
+ import { gql } from 'graphql-tag'
2
+ import type { DocumentNode } from 'graphql'
3
+
4
+ export const getTableModule: DocumentNode = gql`
5
+ query tableModuleQuery($id: String!, $preview: Boolean = false) {
6
+ tableModule(id: $id, preview: $preview) {
7
+ sys {
8
+ id
9
+ }
10
+ title
11
+ description {
12
+ json
13
+ links {
14
+ entries {
15
+ inline {
16
+ sys {
17
+ id
18
+ }
19
+ ... on HighlightedText {
20
+ text
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ table {
27
+ json
28
+ links {
29
+ entries {
30
+ inline {
31
+ sys {
32
+ id
33
+ }
34
+ ... on HighlightedText {
35
+ text
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
41
+ filterColumns
42
+ footer {
43
+ json
44
+ links {
45
+ entries {
46
+ inline {
47
+ sys {
48
+ id
49
+ }
50
+ ... on HighlightedText {
51
+ text
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ backgroundColor
58
+ bodyCopyAlignment
59
+ tableHighlight
60
+ }
61
+ }
62
+ `
package/dist/cms/index.ts CHANGED
@@ -21,3 +21,5 @@ export * from './helloBanner.query.js'
21
21
  export * from './placeholderModule.query.js'
22
22
  export * from './splitModule.query.js'
23
23
  export * from './containerCollectionModule.query.js'
24
+ export * from './tableModule.query.js'
25
+