northants-design-system 0.4.11 → 1.0.0-alpha.1

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/README.md CHANGED
@@ -6,17 +6,19 @@
6
6
 
7
7
  The design system for North Northamptonshire & West Northamptonshire, two brand new unitary councils encompassing Wellingborough, Corby, Daventry, East Northants, Kettering, Northampton, Northamptonshire County and South Northants.
8
8
 
9
+ ## Requirements
10
+
11
+ Requires node v18 for Storybook v7. If you have nvm installed then you can run `nvm use` and it will autodetect the correct version of node to use.
9
12
 
10
13
  ## Installation
11
14
 
12
- ### Installation and development of the Design System
15
+ ### Installation and development of the Design System
13
16
 
14
17
  You need `node` and `npm` installed.
15
18
 
16
19
  1. Clone the repo and `npm i`
17
20
  2. `npm run dev` will start up the Storybook playground and start `rollup` watching for changes.
18
21
 
19
-
20
22
  ### Installation using docker
21
23
 
22
24
  This option is recommended if your using a windows machine
@@ -38,10 +40,8 @@ docker ps
38
40
  docker-compose stop
39
41
  ```
40
42
 
41
-
42
43
  ## Documentation
43
44
 
44
-
45
45
  This design system is made up from a combination of these libraries:
46
46
 
47
47
  - [Rollup](https://github.com/rollup/rollup)
@@ -49,22 +49,14 @@ This design system is made up from a combination of these libraries:
49
49
  - [TypeScript](https://www.typescriptlang.org/)
50
50
  - [Jest](https://jestjs.io/) and [React Testing Library](https://github.com/testing-library/react-testing-library) enabling testing of the components
51
51
 
52
-
53
-
54
-
55
52
  ## Examples
56
53
 
57
-
58
54
  👉 **[You can view the design system here](https://northants-design-system.netlify.app)**
59
55
 
60
56
  This is a living documentation powered by [Storybook](https://storybook.js.org/), where you can see all the available components, their variations and documentation.
61
57
 
62
-
63
-
64
58
  ### Using the design system in your project
65
59
 
66
-
67
-
68
60
  You can find the design system [here on NPM](https://www.npmjs.com/package/northants-design-system).
69
61
 
70
62
  ```
@@ -74,7 +66,7 @@ npm install northants-design-system
74
66
  npm install react react-dom styled-components @reach/router
75
67
  ```
76
68
 
77
- This design system uses theming - **it will not work without a theme wrapped around the components** - to use a theme you will need to include a `ThemeProvider` from styled components, [you can find out more about how this works here](https://styled-components.com/docs/advanced#theming). Then you will need to import one of the three themes from the design system, or create your own. The three avaliable are `GDS_theme` (a basic style based on the [GDS design system](https://design-system.service.gov.uk/)), `west_theme` and `north_theme` (themes for North and West Northamptonshire styled components).
69
+ This design system uses theming - **it will not work without a theme wrapped around the components** - to use a theme you will need to include a `ThemeProvider` from styled components, [you can find out more about how this works here](https://styled-components.com/docs/advanced#theming). Then you will need to import one of the three themes from the design system, or create your own. The three avaliable are `GDS_theme` (a basic style based on the [GDS design system](https://design-system.service.gov.uk/)), `west_theme` and `north_theme` (themes for North and West Northamptonshire styled components).
78
70
 
79
71
  This `ThemeProvider` can be wrapped around the entire app, or around a single component
80
72
 
@@ -112,10 +104,8 @@ const MyComponent = () =>
112
104
  </ThemeProvider>
113
105
  ```
114
106
 
115
-
116
107
  ## Documentation
117
108
 
118
-
119
109
  ### Creating and generating new components
120
110
 
121
111
  There is a util file under `util` called `create-component.js`. Instead of copy pasting components to create a new component, you can just run this command to generate all the files you need to start building out a new component. To use it:
@@ -140,34 +130,28 @@ The default templates for each file can be modified under `util/templates`.
140
130
 
141
131
  Don't forget to add the component to your `index.ts` exports if you want the library to export the component.
142
132
 
143
-
144
-
145
-
146
133
  ### How to publish a new version to NPM
134
+
147
135
  First, make sure you have an NPM account and are [logged into NPM using the `npm login` command.](https://docs.npmjs.com/creating-a-new-npm-user-account)
148
136
 
149
137
  1. **information about testing needed here**
150
138
  2. If tests pass...
151
- 2. Increment the next version number in the `package.json` file.
152
- 3. `npm publish`. This will:
153
- - Run the tests
154
- - Bundle and transpile the code
155
- - Create and publish a tarball to NPM
156
- 4. If you are wanting to utilise the updated design system you will then need to update the version number of the design system in the `package.json` file within that repo.
157
-
158
-
159
-
139
+ 3. Increment the next version number in the `package.json` file.
140
+ 4. `npm publish`. This will:
141
+ - Run the tests
142
+ - Bundle and transpile the code
143
+ - Create and publish a tarball to NPM
144
+ 5. If you are wanting to utilise the updated design system you will then need to update the version number of the design system in the `package.json` file within that repo.
160
145
 
161
146
  ### Installing component library locally for IE11 (or other uses) but this is easier and less buggy
162
147
 
163
148
  https://www.viget.com/articles/how-to-use-local-unpublished-node-packages-as-project-dependencies/
164
149
 
165
-
166
150
  Good article on this can be found [here](https://www.viget.com/articles/how-to-use-local-unpublished-node-packages-as-project-dependencies/)
167
151
 
168
- Install yalc **globally**
152
+ Install yalc **globally**
169
153
  Using NPM: `npm i yalc -g`
170
- Using Yarn: `yarn global add yalc`
154
+ Using Yarn: `yarn global add yalc`
171
155
 
172
156
  In the **northants-design-system**
173
157
  You will need node v14.17.3 > to build on windows
@@ -179,11 +163,9 @@ run `yalc add northants-design-system` then run `npm install` or `yarn`
179
163
 
180
164
  Then run `npm run start` to run the application.
181
165
 
182
-
183
-
184
166
  You will need node v14.17.3 > to build on windows
185
167
 
186
- Install yalc
168
+ Install yalc
187
169
  Using NPM:
188
170
 
189
171
  `npm i yalc -g`
@@ -192,23 +174,18 @@ Using Yarn:
192
174
 
193
175
  `yarn global add yalc`
194
176
 
195
-
196
177
  run `yalc publish` in the design system folder
197
178
 
198
179
  run `yalc add northants-design-system` in ie11-test-folder
199
180
 
200
-
201
181
  `npm install`
202
182
 
203
- to make changes and update them
183
+ to make changes and update them
204
184
 
205
185
  in design system `yalc push` (this automatically updates all dependencies on all yalc files)
206
186
 
207
187
  or `yalc publish` in design system and `yalc update` in your projects repo
208
188
 
209
-
210
-
211
-
212
189
  ### Installing Component Library Locally
213
190
 
214
191
  Let's say you have another project (`test-app`) on your machine that you want to try installing the component library into without having to first publish the component library. In the `test-app` directory, you can run:
@@ -5,7 +5,6 @@ import require$$2 from 'path';
5
5
  import require$$1$1 from 'url';
6
6
  import require$$1 from 'fs';
7
7
  import require$$1$2 from 'react-dom';
8
- import axios from 'axios';
9
8
  import { Wrapper as Wrapper$5 } from '@googlemaps/react-wrapper';
10
9
 
11
10
  /******************************************************************************
@@ -12455,11 +12454,11 @@ function getAtomFeed(feedRoot) {
12455
12454
  if (href) {
12456
12455
  entry.link = href;
12457
12456
  }
12458
- var description = fetch("summary", children) || fetch("content", children);
12457
+ var description = fetch$1("summary", children) || fetch$1("content", children);
12459
12458
  if (description) {
12460
12459
  entry.description = description;
12461
12460
  }
12462
- var pubDate = fetch("updated", children);
12461
+ var pubDate = fetch$1("updated", children);
12463
12462
  if (pubDate) {
12464
12463
  entry.pubDate = new Date(pubDate);
12465
12464
  }
@@ -12473,7 +12472,7 @@ function getAtomFeed(feedRoot) {
12473
12472
  feed.link = href;
12474
12473
  }
12475
12474
  addConditionally(feed, "description", "subtitle", childs);
12476
- var updated = fetch("updated", childs);
12475
+ var updated = fetch$1("updated", childs);
12477
12476
  if (updated) {
12478
12477
  feed.updated = new Date(updated);
12479
12478
  }
@@ -12499,7 +12498,7 @@ function getRssFeed(feedRoot) {
12499
12498
  addConditionally(entry, "title", "title", children);
12500
12499
  addConditionally(entry, "link", "link", children);
12501
12500
  addConditionally(entry, "description", "description", children);
12502
- var pubDate = fetch("pubDate", children);
12501
+ var pubDate = fetch$1("pubDate", children);
12503
12502
  if (pubDate)
12504
12503
  entry.pubDate = new Date(pubDate);
12505
12504
  return entry;
@@ -12508,7 +12507,7 @@ function getRssFeed(feedRoot) {
12508
12507
  addConditionally(feed, "title", "title", childs);
12509
12508
  addConditionally(feed, "link", "link", childs);
12510
12509
  addConditionally(feed, "description", "description", childs);
12511
- var updated = fetch("lastBuildDate", childs);
12510
+ var updated = fetch$1("lastBuildDate", childs);
12512
12511
  if (updated) {
12513
12512
  feed.updated = new Date(updated);
12514
12513
  }
@@ -12575,7 +12574,7 @@ function getOneElement(tagName, node) {
12575
12574
  * @param recurse Whether to recurse into child nodes.
12576
12575
  * @returns The text content of the element.
12577
12576
  */
12578
- function fetch(tagName, where, recurse) {
12577
+ function fetch$1(tagName, where, recurse) {
12579
12578
  if (recurse === void 0) { recurse = false; }
12580
12579
  return (0, stringify_js_1.textContent)((0, legacy_js_1.getElementsByTagName)(tagName, where, recurse, 1)).trim();
12581
12580
  }
@@ -12590,7 +12589,7 @@ function fetch(tagName, where, recurse) {
12590
12589
  */
12591
12590
  function addConditionally(obj, prop, tagName, where, recurse) {
12592
12591
  if (recurse === void 0) { recurse = false; }
12593
- var val = fetch(tagName, where, recurse);
12592
+ var val = fetch$1(tagName, where, recurse);
12594
12593
  if (val)
12595
12594
  obj[prop] = val;
12596
12595
  }
@@ -27667,15 +27666,13 @@ var PostCodeSearch = function (_a) {
27667
27666
  };
27668
27667
  var checkPostcode = function (postcode) { return __awaiter(void 0, void 0, void 0, function () {
27669
27668
  return __generator(this, function (_a) {
27670
- axios({
27671
- method: 'GET',
27672
- url: "".concat(PostcodeSearchApiUrl).concat(postcode.replace(/ /g, '').substring(0, 10)),
27673
- })
27674
- .then(function (response) {
27669
+ fetch("".concat(PostcodeSearchApiUrl).concat(postcode.replace(/ /g, '').substring(0, 10)))
27670
+ .then(function (response) { return response.json(); })
27671
+ .then(function (responseJson) {
27675
27672
  var _a;
27676
27673
  setIsLoading(false);
27677
- if (((_a = response.data.unitaries) === null || _a === void 0 ? void 0 : _a.length) > 0) {
27678
- setResponseData(response.data);
27674
+ if (((_a = responseJson.unitaries) === null || _a === void 0 ? void 0 : _a.length) > 0) {
27675
+ setResponseData(responseJson);
27679
27676
  }
27680
27677
  else {
27681
27678
  handleError(true);