@financial-times/n-myft-ui 26.1.0 → 27.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.
- package/.circleci/config.yml +46 -34
- package/.nvmrc +1 -1
- package/Makefile +0 -1
- package/README.md +2 -48
- package/build-state/npm-shrinkwrap.json +10147 -20187
- package/components/collections/collections.html +85 -0
- package/components/concept-list/concept-list.html +31 -0
- package/components/csrf-token/input.html +5 -0
- package/components/follow-button/follow-button.html +79 -0
- package/components/instant-alert/instant-alert.html +47 -0
- package/components/pin-button/pin-button.html +20 -0
- package/components/save-for-later/save-for-later.html +67 -0
- package/components/unread-articles-indicator/date-fns.js +6 -6
- package/demos/app.js +3 -26
- package/demos/templates/demo.html +11 -10
- package/package.json +16 -30
- package/components/collections/collections.jsx +0 -68
- package/components/collections/collections.test.js +0 -83
- package/components/concept-list/concept-list.jsx +0 -69
- package/components/concept-list/concept-list.test.js +0 -116
- package/components/csrf-token/input.jsx +0 -20
- package/components/csrf-token/input.test.js +0 -23
- package/components/follow-button/follow-button.jsx +0 -176
- package/components/follow-button/follow-button.test.js +0 -40
- package/components/index.js +0 -17
- package/components/instant-alert/instant-alert.jsx +0 -73
- package/components/instant-alert/instant-alert.test.js +0 -86
- package/components/pin-button/pin-button.jsx +0 -40
- package/components/pin-button/pin-button.test.js +0 -57
- package/components/save-for-later/save-for-later.jsx +0 -101
- package/components/save-for-later/save-for-later.test.js +0 -59
- package/demos/templates/demo-layout.html +0 -25
- package/demos/templates/demo.jsx +0 -125
- package/dist/bundles/bundle.js +0 -3232
- package/jest.config.js +0 -8
- package/jsx-migration.md +0 -16
- package/webpack.config.js +0 -34
package/.circleci/config.yml
CHANGED
|
@@ -2,60 +2,54 @@
|
|
|
2
2
|
# template: component
|
|
3
3
|
|
|
4
4
|
references:
|
|
5
|
-
container_config_node:
|
|
6
|
-
&container_config_node
|
|
5
|
+
container_config_node: &container_config_node
|
|
7
6
|
working_directory: ~/project/build
|
|
8
7
|
docker:
|
|
9
|
-
- image:
|
|
8
|
+
- image: cimg/node:<< parameters.node-version >>-browsers
|
|
9
|
+
parameters:
|
|
10
|
+
node-version:
|
|
11
|
+
default: "16.14"
|
|
12
|
+
type: string
|
|
10
13
|
|
|
11
14
|
workspace_root: &workspace_root ~/project
|
|
12
15
|
|
|
13
|
-
attach_workspace:
|
|
14
|
-
&attach_workspace
|
|
16
|
+
attach_workspace: &attach_workspace
|
|
15
17
|
attach_workspace:
|
|
16
18
|
at: *workspace_root
|
|
17
19
|
|
|
18
|
-
npm_cache_keys:
|
|
19
|
-
&npm_cache_keys
|
|
20
|
+
npm_cache_keys: &npm_cache_keys
|
|
20
21
|
keys:
|
|
21
22
|
- v8-dependency-npm-{{ checksum "package-lock.json" }}-
|
|
22
23
|
- v8-dependency-npm-{{ checksum "package-lock.json" }}
|
|
23
24
|
- v8-dependency-npm-
|
|
24
25
|
|
|
25
|
-
cache_npm_cache:
|
|
26
|
-
&cache_npm_cache
|
|
26
|
+
cache_npm_cache: &cache_npm_cache
|
|
27
27
|
save_cache:
|
|
28
28
|
key: v8-dependency-npm-{{ checksum "package-lock.json" }}-{{ epoch }}
|
|
29
29
|
paths:
|
|
30
30
|
- ./node_modules/
|
|
31
31
|
|
|
32
|
-
restore_npm_cache:
|
|
33
|
-
&restore_npm_cache
|
|
32
|
+
restore_npm_cache: &restore_npm_cache
|
|
34
33
|
restore_cache:
|
|
35
34
|
<<: *npm_cache_keys
|
|
36
35
|
|
|
37
|
-
filters_ignore_gh_pages:
|
|
38
|
-
&filters_ignore_gh_pages
|
|
36
|
+
filters_ignore_gh_pages: &filters_ignore_gh_pages
|
|
39
37
|
branches:
|
|
40
38
|
ignore: gh_pages
|
|
41
39
|
|
|
42
|
-
filters_only_main:
|
|
43
|
-
&filters_only_main
|
|
40
|
+
filters_only_main: &filters_only_main
|
|
44
41
|
branches:
|
|
45
42
|
only: main
|
|
46
43
|
|
|
47
|
-
filters_ignore_main:
|
|
48
|
-
&filters_ignore_main
|
|
44
|
+
filters_ignore_main: &filters_ignore_main
|
|
49
45
|
branches:
|
|
50
46
|
ignore: main
|
|
51
47
|
|
|
52
|
-
filters_ignore_tags:
|
|
53
|
-
&filters_ignore_tags
|
|
48
|
+
filters_ignore_tags: &filters_ignore_tags
|
|
54
49
|
tags:
|
|
55
50
|
ignore: /.*/
|
|
56
51
|
|
|
57
|
-
filters_version_tag:
|
|
58
|
-
&filters_version_tag
|
|
52
|
+
filters_version_tag: &filters_version_tag
|
|
59
53
|
tags:
|
|
60
54
|
only:
|
|
61
55
|
- /^v?\d+\.\d+\.\d+(?:-beta\.\d+)?$/
|
|
@@ -73,7 +67,7 @@ jobs:
|
|
|
73
67
|
steps:
|
|
74
68
|
- checkout
|
|
75
69
|
- node/install-npm:
|
|
76
|
-
|
|
70
|
+
version: "7"
|
|
77
71
|
- run:
|
|
78
72
|
name: Checkout next-ci-shared-helpers
|
|
79
73
|
command: git clone --depth 1
|
|
@@ -83,17 +77,11 @@ jobs:
|
|
|
83
77
|
- run:
|
|
84
78
|
name: Install project dependencies
|
|
85
79
|
command: make install
|
|
86
|
-
- run:
|
|
87
|
-
name: shared-helper / npm-update
|
|
88
|
-
command: .circleci/shared-helpers/helper-npm-update
|
|
89
80
|
- run:
|
|
90
81
|
name: shared-helper / generate-build-state-artifacts
|
|
91
82
|
command: .circleci/shared-helpers/helper-generate-build-state-artifacts
|
|
92
83
|
when: always
|
|
93
84
|
- *cache_npm_cache
|
|
94
|
-
- run:
|
|
95
|
-
name: Compile JSX templates
|
|
96
|
-
command: npm run build-package
|
|
97
85
|
- store_artifacts:
|
|
98
86
|
path: build-state
|
|
99
87
|
destination: build-state
|
|
@@ -151,33 +139,49 @@ workflows:
|
|
|
151
139
|
filters:
|
|
152
140
|
<<: *filters_ignore_tags
|
|
153
141
|
<<: *filters_ignore_gh_pages
|
|
142
|
+
name: build-v<< matrix.node-version >>
|
|
143
|
+
matrix:
|
|
144
|
+
parameters:
|
|
145
|
+
node-version: ["16.14", "14.19"]
|
|
154
146
|
- test:
|
|
155
147
|
filters:
|
|
156
148
|
<<: *filters_ignore_tags
|
|
157
|
-
<<: *filters_ignore_gh_pages
|
|
158
149
|
requires:
|
|
159
|
-
- 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"]
|
|
160
155
|
- deploy:
|
|
161
156
|
filters:
|
|
162
157
|
<<: *filters_only_main
|
|
163
158
|
requires:
|
|
164
|
-
- build
|
|
159
|
+
- build-v16.14
|
|
165
160
|
build-test-publish:
|
|
166
161
|
jobs:
|
|
167
162
|
- build:
|
|
168
163
|
filters:
|
|
169
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"]
|
|
170
170
|
- test:
|
|
171
171
|
filters:
|
|
172
172
|
<<: *filters_version_tag
|
|
173
173
|
requires:
|
|
174
|
-
- 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"]
|
|
175
179
|
- publish:
|
|
176
180
|
context: npm-publish-token
|
|
177
181
|
filters:
|
|
178
182
|
<<: *filters_version_tag
|
|
179
183
|
requires:
|
|
180
|
-
- test
|
|
184
|
+
- test-v16.14
|
|
181
185
|
|
|
182
186
|
nightly:
|
|
183
187
|
triggers:
|
|
@@ -188,10 +192,18 @@ workflows:
|
|
|
188
192
|
jobs:
|
|
189
193
|
- build:
|
|
190
194
|
context: next-nightly-build
|
|
195
|
+
name: build-v<< matrix.node-version >>
|
|
196
|
+
matrix:
|
|
197
|
+
parameters:
|
|
198
|
+
node-version: ["16.14", "14.19"]
|
|
191
199
|
- test:
|
|
192
200
|
requires:
|
|
193
|
-
- build
|
|
201
|
+
- build-v<< matrix.node-version >>
|
|
194
202
|
context: next-nightly-build
|
|
203
|
+
name: test-v<< matrix.node-version >>
|
|
204
|
+
matrix:
|
|
205
|
+
parameters:
|
|
206
|
+
node-version: ["16.14", "14.19"]
|
|
195
207
|
|
|
196
208
|
notify:
|
|
197
209
|
webhooks:
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
16
|
package/Makefile
CHANGED
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
|
-
|
|
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.
|