@financial-times/cp-content-pipeline-ui 7.0.2 → 7.1.0

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 (54) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/lib/client.d.ts +1 -0
  3. package/lib/client.js +3 -1
  4. package/lib/client.js.map +1 -1
  5. package/lib/components/Body/index.test.js +12 -11
  6. package/lib/components/Body/index.test.js.map +1 -1
  7. package/lib/components/CustomCodeComponent/client/index.d.ts +15 -0
  8. package/lib/components/CustomCodeComponent/client/index.js +95 -0
  9. package/lib/components/CustomCodeComponent/client/index.js.map +1 -0
  10. package/lib/components/CustomCodeComponent/index.d.ts +19 -0
  11. package/lib/components/CustomCodeComponent/index.js +17 -0
  12. package/lib/components/CustomCodeComponent/index.js.map +1 -0
  13. package/lib/components/Flourish/index.js +2 -5
  14. package/lib/components/Flourish/index.js.map +1 -1
  15. package/lib/components/Layout/index.d.ts +1 -1
  16. package/lib/components/Message/index.d.ts +9 -0
  17. package/lib/components/Message/index.js +18 -0
  18. package/lib/components/Message/index.js.map +1 -0
  19. package/lib/components/Message/test/snapshot.spec.d.ts +1 -0
  20. package/lib/components/Message/test/snapshot.spec.js +23 -0
  21. package/lib/components/Message/test/snapshot.spec.js.map +1 -0
  22. package/lib/components/PartnerContentHeader/index.js +2 -3
  23. package/lib/components/PartnerContentHeader/index.js.map +1 -1
  24. package/lib/components/RichText/BasicComponents.d.ts +1 -0
  25. package/lib/components/RichText/BasicComponents.js +3 -1
  26. package/lib/components/RichText/BasicComponents.js.map +1 -1
  27. package/lib/components/RichText/index.js +3 -0
  28. package/lib/components/RichText/index.js.map +1 -1
  29. package/lib/components/Workarounds.d.ts +5 -1
  30. package/lib/index.d.ts +2 -1
  31. package/lib/index.js +4 -1
  32. package/lib/index.js.map +1 -1
  33. package/lib/stories/Message.stories.d.ts +11 -0
  34. package/lib/stories/Message.stories.js +30 -0
  35. package/lib/stories/Message.stories.js.map +1 -0
  36. package/package.json +3 -2
  37. package/src/client.ts +1 -0
  38. package/src/components/Body/index.test.tsx +23 -24
  39. package/src/components/CustomCodeComponent/client/index.ts +121 -0
  40. package/src/components/CustomCodeComponent/index.tsx +54 -0
  41. package/src/components/Flourish/index.tsx +5 -26
  42. package/src/components/Flourish/test/__snapshots__/snapshot.spec.tsx.snap +12 -12
  43. package/src/components/Layout/index.tsx +1 -1
  44. package/src/components/Message/index.tsx +35 -0
  45. package/src/components/Message/test/__snapshots__/snapshot.spec.tsx.snap +45 -0
  46. package/src/components/Message/test/snapshot.spec.tsx +31 -0
  47. package/src/components/PartnerContentHeader/index.tsx +6 -8
  48. package/src/components/RichText/BasicComponents.tsx +4 -0
  49. package/src/components/RichText/index.tsx +4 -0
  50. package/src/components/Workarounds.ts +12 -0
  51. package/src/index.ts +2 -0
  52. package/src/stories/Message.stories.scss +5 -0
  53. package/src/stories/Message.stories.tsx +29 -0
  54. package/tsconfig.tsbuildinfo +1 -1
@@ -17,6 +17,7 @@ import Video from '../Video'
17
17
  import Table from '../Table'
18
18
  import Clip from '../Clip'
19
19
  import Paragraph from '../Paragraph'
20
+ import CustomCodeComponent from '../CustomCodeComponent'
20
21
 
21
22
  import {
22
23
  List,
@@ -32,6 +33,7 @@ import {
32
33
  TableCaption,
33
34
  TableFooter,
34
35
  TableRow,
36
+ CccFallbackText,
35
37
  } from './BasicComponents'
36
38
 
37
39
  import type {
@@ -104,8 +106,10 @@ const componentMap: RichTextComponentMapRecord = {
104
106
  cite: Cite,
105
107
  blockquote: Blockquote,
106
108
  break: LineBreak,
109
+ 'ccc-fallback-text': CccFallbackText,
107
110
  'clip-set': Clip,
108
111
  clip: Clip,
112
+ 'custom-code-component': CustomCodeComponent,
109
113
  emphasis: Emphasis,
110
114
  flourish: Flourish,
111
115
  heading: Heading,
@@ -2,6 +2,7 @@ import type { ContentTree } from '@financial-times/content-tree'
2
2
  import {
3
3
  ConceptFragment,
4
4
  TranscriptFragment,
5
+ CustomCodeComponentRichTextFragment,
5
6
  } from '@financial-times/cp-content-pipeline-client'
6
7
  import type { ContentTreeWorkarounds } from '@financial-times/cp-content-pipeline-schema'
7
8
  import type {
@@ -188,3 +189,14 @@ export type Author = PartialToMaybe<
188
189
  concept?: ConceptFragment
189
190
  }
190
191
  >
192
+
193
+ type CustomCodeComponentUI = Pick<
194
+ ContentTree.CustomCodeComponent,
195
+ 'path' | 'versionRange' | 'id' | 'layoutWidth' | 'attributes' | 'type'
196
+ >
197
+
198
+ export type CustomCodeComponent = PartialToMaybeDeep<
199
+ CustomCodeComponentUI & {
200
+ body?: CustomCodeComponentRichTextFragment
201
+ }
202
+ >
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ export { default as Byline } from './components/Byline'
6
6
  export { default as Flourish } from './components/Flourish'
7
7
  export { default as Heading } from './components/Heading'
8
8
  export { default as ImageSet } from './components/ImageSet'
9
+ export { default as CustomCodeComponent } from './components/CustomCodeComponent'
9
10
  export { default as Clip } from './components/Clip/template/component'
10
11
  export { Layout, LayoutContainer, LayoutSlot } from './components/Layout'
11
12
  export { default as LiveBlogBody } from './components/LiveBlogBody'
@@ -33,6 +34,7 @@ export {
33
34
  Strong,
34
35
  Strikethrough,
35
36
  Cite,
37
+ CccFallbackText,
36
38
  } from './components/RichText/BasicComponents'
37
39
  export {
38
40
  PresentationFlagsContext,
@@ -0,0 +1,5 @@
1
+ $system-code: "cp-pipeline-ui-message-demo";
2
+ @import "@financial-times/o-message/main";
3
+ @import "./article-page.scss";
4
+
5
+ @include oMessage();
@@ -0,0 +1,29 @@
1
+ import Message from '../components/Message'
2
+ import type { MessageProps } from '../components/Message'
3
+ import React from 'react'
4
+ import './Message.stories.scss'
5
+
6
+ export default {
7
+ title: 'Message',
8
+ component: Message,
9
+ content: {},
10
+ }
11
+
12
+ const noticeInformArgs: MessageProps = {
13
+ id: '',
14
+ type: 'notice',
15
+ state: 'inform',
16
+ }
17
+
18
+ export const noticeInformDefault = () => <Message {...noticeInformArgs} />
19
+
20
+ const noticeInformCustomTextArgs: MessageProps = {
21
+ id: '',
22
+ type: 'notice',
23
+ state: 'inform',
24
+ text: 'This is a custom message',
25
+ }
26
+
27
+ export const noticeInformCustomText = () => (
28
+ <Message {...noticeInformCustomTextArgs} />
29
+ )