@cooperco/cooper-component-library 0.1.94 → 0.1.96

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 (38) hide show
  1. package/dist/cms/0082-add-body-copy-alignment-to-content-module.cjs +36 -0
  2. package/dist/cms/0083-create-placeholder-module.cjs +44 -0
  3. package/dist/cms/README.md +101 -31
  4. package/dist/cms/contentModule.query.ts +1 -0
  5. package/dist/cms/contentful/migrations/scripts/0082-add-body-copy-alignment-to-content-module.cjs +36 -0
  6. package/dist/cms/contentful/migrations/scripts/0083-create-placeholder-module.cjs +44 -0
  7. package/dist/cms/contentful/queries/contentModule.query.js +1 -0
  8. package/dist/cms/contentful/queries/contentModule.query.ts +1 -0
  9. package/dist/cms/contentful/queries/helloBanner.query.d.ts +3 -0
  10. package/dist/cms/contentful/queries/helloBanner.query.js +30 -0
  11. package/dist/cms/contentful/queries/helloBanner.query.ts +33 -0
  12. package/dist/cms/contentful/queries/index.d.ts +2 -0
  13. package/dist/cms/contentful/queries/index.js +2 -0
  14. package/dist/cms/contentful/queries/index.ts +2 -0
  15. package/dist/cms/contentful/queries/placeholderModule.query.d.ts +3 -0
  16. package/dist/cms/contentful/queries/placeholderModule.query.js +19 -0
  17. package/dist/cms/contentful/queries/placeholderModule.query.ts +22 -0
  18. package/dist/cms/helloBanner.query.ts +33 -0
  19. package/dist/cms/index.ts +2 -0
  20. package/dist/cms/migrations/scripts/0082-add-body-copy-alignment-to-content-module.cjs +36 -0
  21. package/dist/cms/migrations/scripts/0083-create-placeholder-module.cjs +44 -0
  22. package/dist/cms/placeholderModule.query.ts +22 -0
  23. package/dist/cms/queries/contentModule.query.ts +1 -0
  24. package/dist/cms/queries/helloBanner.query.ts +33 -0
  25. package/dist/cms/queries/index.ts +2 -0
  26. package/dist/cms/queries/placeholderModule.query.ts +22 -0
  27. package/dist/cms/scripts/0082-add-body-copy-alignment-to-content-module.cjs +36 -0
  28. package/dist/cms/scripts/0083-create-placeholder-module.cjs +44 -0
  29. package/dist/lib/component-lib.js +495 -489
  30. package/dist/lib/component-lib.umd.cjs +10 -10
  31. package/dist/types/cms/contentful/queries/helloBanner.query.d.ts +3 -0
  32. package/dist/types/cms/contentful/queries/index.d.ts +2 -0
  33. package/dist/types/cms/contentful/queries/placeholderModule.query.d.ts +3 -0
  34. package/dist/types/src/components/ContentModule/ContentModule.d.ts +1 -0
  35. package/dist/types/src/components/PlaceholderModule/PlaceholderModule.d.ts +12 -0
  36. package/dist/types/src/components/types.d.ts +3 -0
  37. package/dist/types/src/types.d.ts +1 -0
  38. package/package.json +1 -1
@@ -0,0 +1,22 @@
1
+ import { gql } from 'graphql-tag'
2
+ import type { DocumentNode } from 'graphql'
3
+
4
+ export const getPlaceholderModule: DocumentNode = gql`
5
+ query placeholderModuleQuery($id: String!, $preview: Boolean = false) {
6
+ placeholderModule(id: $id, preview: $preview) {
7
+ __typename
8
+ entryName
9
+ moduleName
10
+ customModuleName
11
+ }
12
+ }
13
+ `
14
+
15
+ export const placeholderModuleFragment = gql`
16
+ fragment placeholderModuleFragment on PlaceholderModule {
17
+ __typename
18
+ entryName
19
+ moduleName
20
+ customModuleName
21
+ }
22
+ `
@@ -0,0 +1,36 @@
1
+ module.exports = {
2
+ // @ts-check
3
+ /** @type { import('contentful-migration').MigrationFunction } */
4
+ up: function (migration) {
5
+ const contentModule = migration.editContentType('contentModule')
6
+
7
+ contentModule.createField('bodyCopyAlignment', {
8
+ name: 'Body Copy Alignment',
9
+ type: 'Symbol',
10
+ validations: [
11
+ {
12
+ in: ['Left', 'Center', 'Right'],
13
+ },
14
+ ],
15
+ })
16
+
17
+ contentModule.changeFieldControl(
18
+ 'bodyCopyAlignment',
19
+ 'builtin',
20
+ 'dropdown',
21
+ {
22
+ helpText:
23
+ 'Override the body copy text alignment independently from the general alignment. If not set, body copy will follow the general alignment.',
24
+ }
25
+ )
26
+
27
+ contentModule.moveField('bodyCopyAlignment').afterField('bodyCopy')
28
+ },
29
+
30
+ // @ts-check
31
+ /** @type { import('contentful-migration').MigrationFunction } */
32
+ down: function (migration) {
33
+ const contentModule = migration.editContentType('contentModule')
34
+ contentModule.deleteField('bodyCopyAlignment')
35
+ },
36
+ }
@@ -0,0 +1,44 @@
1
+ const addEntryNameField = require('../helpers/addEntryNameField.cjs')
2
+
3
+ module.exports = {
4
+ // @ts-check
5
+ /** @type { import('contentful-migration').MigrationFunction } */
6
+ up: async function (migration) {
7
+ const placeholderModule = migration.createContentType('placeholderModule', {
8
+ name: 'Placeholder Module',
9
+ displayField: 'entryName',
10
+ description: 'Manage the placeholder module component',
11
+ })
12
+
13
+ // Add required entryName field
14
+ addEntryNameField(placeholderModule)
15
+
16
+ // Module Name dropdown field
17
+ placeholderModule
18
+ .createField('moduleName')
19
+ .name('Module Name')
20
+ .type('Symbol')
21
+ .required(false)
22
+ .validations([
23
+ {
24
+ in: ['Contact Us', 'Contact Us Form'],
25
+ },
26
+ ])
27
+ placeholderModule.changeFieldControl('moduleName', 'builtin', 'dropdown', {
28
+ helpText: 'Select the placeholder module to render.',
29
+ })
30
+
31
+ // Custom Module Name field
32
+ placeholderModule
33
+ .createField('customModuleName')
34
+ .name('Custom Module Name')
35
+ .type('Symbol')
36
+ .required(false)
37
+ placeholderModule.changeFieldControl('customModuleName', 'builtin', 'singleLine', {
38
+ helpText: 'This will overwrite the dropdown selection if used. Confirm with the team before using this field.',
39
+ })
40
+ },
41
+ down: async function (migration) {
42
+ await migration.deleteContentType('placeholderModule')
43
+ },
44
+ }