@financial-times/n-myft-ui 26.0.0 → 27.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/.circleci/config.yml +42 -16
  2. package/.nvmrc +1 -1
  3. package/Makefile +0 -1
  4. package/README.md +2 -48
  5. package/build-state/npm-shrinkwrap.json +10147 -20187
  6. package/components/collections/collections.html +85 -0
  7. package/components/concept-list/concept-list.html +31 -0
  8. package/components/csrf-token/input.html +5 -0
  9. package/components/follow-button/follow-button.html +79 -0
  10. package/components/instant-alert/instant-alert.html +47 -0
  11. package/components/pin-button/pin-button.html +20 -0
  12. package/components/save-for-later/save-for-later.html +68 -0
  13. package/components/unread-articles-indicator/date-fns.js +6 -6
  14. package/demos/app.js +3 -26
  15. package/demos/templates/demo.html +11 -10
  16. package/myft/main.scss +145 -0
  17. package/myft/ui/lists.js +22 -0
  18. package/myft/ui/save-article-to-list-variant.js +376 -0
  19. package/package.json +16 -30
  20. package/components/collections/collections.jsx +0 -68
  21. package/components/collections/collections.test.js +0 -83
  22. package/components/concept-list/concept-list.jsx +0 -69
  23. package/components/concept-list/concept-list.test.js +0 -116
  24. package/components/csrf-token/input.jsx +0 -20
  25. package/components/csrf-token/input.test.js +0 -23
  26. package/components/follow-button/follow-button.jsx +0 -176
  27. package/components/follow-button/follow-button.test.js +0 -40
  28. package/components/index.js +0 -17
  29. package/components/instant-alert/instant-alert.jsx +0 -73
  30. package/components/instant-alert/instant-alert.test.js +0 -86
  31. package/components/pin-button/pin-button.jsx +0 -40
  32. package/components/pin-button/pin-button.test.js +0 -57
  33. package/components/save-for-later/save-for-later.jsx +0 -101
  34. package/components/save-for-later/save-for-later.test.js +0 -59
  35. package/demos/templates/demo-layout.html +0 -25
  36. package/demos/templates/demo.jsx +0 -125
  37. package/dist/bundles/bundle.js +0 -3232
  38. package/jest.config.js +0 -8
  39. package/jsx-migration.md +0 -16
  40. package/webpack.config.js +0 -34
@@ -5,7 +5,11 @@ references:
5
5
  container_config_node: &container_config_node
6
6
  working_directory: ~/project/build
7
7
  docker:
8
- - image: circleci/node:12-browsers
8
+ - image: cimg/node:<< parameters.node-version >>-browsers
9
+ parameters:
10
+ node-version:
11
+ default: "16.14"
12
+ type: string
9
13
 
10
14
  workspace_root: &workspace_root ~/project
11
15
 
@@ -63,25 +67,21 @@ jobs:
63
67
  steps:
64
68
  - checkout
65
69
  - node/install-npm:
66
- version: "7"
70
+ version: "7"
67
71
  - run:
68
72
  name: Checkout next-ci-shared-helpers
69
- command: git clone --depth 1 git@github.com:Financial-Times/next-ci-shared-helpers.git .circleci/shared-helpers
73
+ command: git clone --depth 1
74
+ git@github.com:Financial-Times/next-ci-shared-helpers.git
75
+ .circleci/shared-helpers
70
76
  - *restore_npm_cache
71
77
  - run:
72
78
  name: Install project dependencies
73
79
  command: make install
74
- - run:
75
- name: shared-helper / npm-update
76
- command: .circleci/shared-helpers/helper-npm-update
77
80
  - run:
78
81
  name: shared-helper / generate-build-state-artifacts
79
82
  command: .circleci/shared-helpers/helper-generate-build-state-artifacts
80
83
  when: always
81
84
  - *cache_npm_cache
82
- - run:
83
- name: Compile JSX templates
84
- command: npm run build-package
85
85
  - store_artifacts:
86
86
  path: build-state
87
87
  destination: build-state
@@ -114,7 +114,8 @@ jobs:
114
114
  - run:
115
115
  name: shared-helper / npm-store-auth-token
116
116
  command: .circleci/shared-helpers/helper-npm-store-auth-token
117
- - run: npx snyk monitor --org=customer-products --project-name=Financial-Times/n-myft-ui
117
+ - run: npx snyk monitor --org=customer-products
118
+ --project-name=Financial-Times/n-myft-ui
118
119
  - run:
119
120
  name: shared-helper / npm-version-and-publish-public
120
121
  command: .circleci/shared-helpers/helper-npm-version-and-publish-public
@@ -138,32 +139,49 @@ workflows:
138
139
  filters:
139
140
  <<: *filters_ignore_tags
140
141
  <<: *filters_ignore_gh_pages
142
+ name: build-v<< matrix.node-version >>
143
+ matrix:
144
+ parameters:
145
+ node-version: ["16.14", "14.19"]
141
146
  - test:
142
147
  filters:
143
148
  <<: *filters_ignore_tags
144
- <<: *filters_ignore_gh_pages
145
149
  requires:
146
- - build
150
+ - build-v<< matrix.node-version >>
151
+ name: test-v<< matrix.node-version >>
152
+ matrix:
153
+ parameters:
154
+ node-version: ["16.14", "14.19"]
147
155
  - deploy:
148
156
  filters:
149
157
  <<: *filters_only_main
150
158
  requires:
151
- - build
159
+ - build-v16.14
152
160
  build-test-publish:
153
161
  jobs:
154
162
  - build:
155
163
  filters:
156
164
  <<: *filters_version_tag
165
+ <<: *filters_ignore_gh_pages
166
+ name: build-v<< matrix.node-version >>
167
+ matrix:
168
+ parameters:
169
+ node-version: ["16.14", "14.19"]
157
170
  - test:
158
171
  filters:
159
172
  <<: *filters_version_tag
160
173
  requires:
161
- - build
174
+ - build-v<< matrix.node-version >>
175
+ name: test-v<< matrix.node-version >>
176
+ matrix:
177
+ parameters:
178
+ node-version: ["16.14", "14.19"]
162
179
  - publish:
180
+ context: npm-publish-token
163
181
  filters:
164
182
  <<: *filters_version_tag
165
183
  requires:
166
- - test
184
+ - test-v16.14
167
185
 
168
186
  nightly:
169
187
  triggers:
@@ -174,10 +192,18 @@ workflows:
174
192
  jobs:
175
193
  - build:
176
194
  context: next-nightly-build
195
+ name: build-v<< matrix.node-version >>
196
+ matrix:
197
+ parameters:
198
+ node-version: ["16.14", "14.19"]
177
199
  - test:
178
200
  requires:
179
- - build
201
+ - build-v<< matrix.node-version >>
180
202
  context: next-nightly-build
203
+ name: test-v<< matrix.node-version >>
204
+ matrix:
205
+ parameters:
206
+ node-version: ["16.14", "14.19"]
181
207
 
182
208
  notify:
183
209
  webhooks:
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 12
1
+ 16
package/Makefile CHANGED
@@ -46,4 +46,3 @@ test:
46
46
  make test-unit
47
47
  make test-build
48
48
  make a11y
49
- jest
package/README.md CHANGED
@@ -39,52 +39,6 @@ make demo
39
39
 
40
40
  View the demo on `localhost:5005`
41
41
 
42
+ ## Unstable versions
42
43
 
43
- ## Migration Guide
44
-
45
- ### Upgrading from v25
46
-
47
- V25 introduces some major changes to n-myft-ui components. Some of the components have been moved from handlebars to jsx.
48
-
49
- These components include:
50
- - csrf-token
51
- - follow-button
52
- - save-for-later
53
- - pin-button
54
- - concept-list
55
- - collections
56
- - InstantAlert
57
-
58
- A consumer of any of these components needs to render them directly as `jsx` components in a parent `jsx` component or use the `renderReactComponent` helper function provided by `@financial-times/dotcom-server-handlebars` in a consuming handlebars template/partial.
59
-
60
- #### Example rendering in a jsx component
61
- ```jsx
62
- import { SaveForLater } from '@financial-times/n-myft-ui';
63
-
64
- export default function Consumer() {
65
- return (
66
- <SaveForLater contentId={contentId} saveButtonWithIcon={true} flags={{myFtApiWrite:myFtApiWrite}}/>
67
- )
68
- }
69
- ```
70
-
71
- More examples of rendering these components can be found [here](https://github.com/Financial-Times/n-myft-ui/blob/main/demos/templates/demo.jsx) with component props passed in [here](https://github.com/Financial-Times/n-myft-ui/blob/dfbf06d10f78756871cfe8d2aeb863ce4bcca1e1/demos/app.js#L54).
72
-
73
-
74
- #### Example rendering in a handlebars partial
75
- To render a jsx component in a handlebars partial, consumers need to add the `helpers` provided by `@financial-times/dotcom-server-handlebars` to the PageKitHandlebars config in `express app engine` [see example](https://github.com/Financial-Times/n-myft-ui/blob/dfbf06d10f78756871cfe8d2aeb863ce4bcca1e1/demos/app.js#L41).
76
-
77
- ```hbs
78
- <div>
79
- <h2 class="demo-section__title">
80
- Follow button
81
- </h2>
82
-
83
- {{#followButton}}
84
- {{{renderReactComponent localPath="node_modules/@financial-times/n-myft-ui/components/follow-button/follow-button" flags=flags variant="standard" conceptId="0000-0000-0000-0000" name="Follow Item" directType="http://www.ft.com/ontology/product/Brand"}}}
85
- {{/followButton}}
86
- </div>
87
- ```
88
-
89
- More examples of rendering jsx in handlebars partials can be found [here](https://github.com/Financial-Times/n-myft-ui/blob/main/demos/templates/demo.html)
90
-
44
+ v24, v25, v26 has JSX migration code. They are not stable therefore v27 is released. It is to remove JSX and rollback to handlebars. Please use ^v27.