@newjersey/njwds 2.6.1 → 2.7.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/README.md CHANGED
@@ -39,11 +39,11 @@ The NJWDS package also includes pre-compiled files in the `src/` directory. Spec
39
39
 
40
40
  ## Build the design system assets
41
41
 
42
- - Run `npm run build-uswds` to build the assets into the `dist/` directory
42
+ - Run `npm run build-njwds` to build the assets into the `dist/` directory
43
43
 
44
44
  ### Build the component library
45
45
 
46
- - Run `npm run build-docs` to build the [Fractal](https://fractal.build/) component gallery for reviewing the component documentation
46
+ - Run `npm run build-docs` to build the [Fractal](https://fractal.build/) component gallery for reviewing the component documentation. (This command also copies the `dist` directory to `/public` to be served as static assets for the Fractal site.)
47
47
 
48
48
  ### View component library locally or development
49
49
 
@@ -53,9 +53,9 @@ The NJWDS package also includes pre-compiled files in the `src/` directory. Spec
53
53
 
54
54
  - Run `npm run deploy`
55
55
 
56
- This builds USWDS styles, builds the Fractal docs, and then deploys them to the `gh-pages` branch. The deployed docs can be found [here](https://newjersey.github.io/njwds).
56
+ This builds NJWDS styles, builds the Fractal docs, and then deploys them to the `gh-pages` branch. The deployed docs can be found [here](https://newjersey.github.io/njwds).
57
57
 
58
- Note: Do not push directly to the `gh-pages` branch. This is done automatically through the ["Deploy to GitHub Pages" GitHub Action](https://github.com/newjersey/njwds/actions/workflows/deploy-to-gh-pages.yml) when a new release is published.
58
+ Note: **Do not run `npm run deploy` locally** or push directly to the `gh-pages` branch. This is done automatically through the ["Deploy to GitHub Pages" GitHub Action](https://github.com/newjersey/njwds/actions/workflows/deploy-to-gh-pages.yml) when a new release is published.
59
59
 
60
60
  ## Releasing a new version to NPM
61
61
 
package/gulpfile.js CHANGED
@@ -49,6 +49,10 @@ const JS_DEST = "./dist/js";
49
49
  // Compiled CSS destination
50
50
  const CSS_DEST = "./dist/css";
51
51
 
52
+ const DIST_DIR = "./dist"
53
+
54
+ const FRACTAL_STATIC_ASSETS_DIR = "./public"
55
+
52
56
  // Site CSS destination
53
57
  // Like the _site/assets/css directory in Jekyll, if necessary.
54
58
  // If using, uncomment line 106
@@ -78,7 +82,6 @@ gulp.task("copy-src-images", () => {
78
82
  return gulp.src(`${PROJECT_SASS_SRC}/../img/**/**`).pipe(gulp.dest(`${IMG_DEST}`));
79
83
  });
80
84
 
81
-
82
85
  gulp.task("copy-uswds-js", () => {
83
86
  return gulp.src(`${uswds}/dist/js/**/**`).pipe(gulp.dest(`${JS_DEST}`));
84
87
  });
@@ -127,7 +130,7 @@ gulp.task(
127
130
  );
128
131
 
129
132
  gulp.task(
130
- "build",
133
+ "build-njwds",
131
134
  gulp.series(
132
135
  "copy-uswds-fonts",
133
136
  "copy-uswds-images",
@@ -137,11 +140,18 @@ gulp.task(
137
140
  )
138
141
  );
139
142
 
143
+ gulp.task("copy-dist-to-fractal-assets", () => {
144
+ return gulp.src(`${DIST_DIR}/**/**`).pipe(gulp.dest(`${FRACTAL_STATIC_ASSETS_DIR}/dist`));
145
+ });
140
146
 
141
147
  gulp.task("watch-sass", function() {
142
- gulp.watch(`${PROJECT_SASS_SRC}/**/*.scss`, gulp.series("copy-src-images", "build-sass"));
148
+ gulp.watch(`${PROJECT_SASS_SRC}/**/*.scss`, gulp.series("copy-src-images", "build-sass", "copy-dist-to-fractal-assets",));
143
149
  });
144
150
 
145
- gulp.task("watch", gulp.series("copy-src-images", "build-sass", "watch-sass"));
146
151
 
147
- gulp.task("default", gulp.series("watch"));
152
+ gulp.task("watch-fractal", gulp.series(
153
+ "copy-src-images",
154
+ "build-sass",
155
+ "copy-dist-to-fractal-assets",
156
+ "watch-sass",
157
+ ));
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@newjersey/njwds",
3
- "version": "2.6.1",
3
+ "version": "2.7.0",
4
4
  "description": "NJ Web Design Standards",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "prepare": "npm run build-uswds",
8
- "build-uswds": "gulp build",
7
+ "prepare": "npm run build-njwds",
8
+ "build-njwds": "gulp build-njwds",
9
9
  "import-components": "cp -nr node_modules/uswds/src/components ./src/",
10
- "build-docs": "fractal build",
11
- "start": "fractal start --sync & gulp watch",
12
- "deploy": "npm install && npm run build-docs && gh-pages -d build"
10
+ "build-docs": "gulp copy-dist-to-fractal-assets && fractal build",
11
+ "start": "fractal start --sync & gulp watch-fractal",
12
+ "deploy": "npm ci && npm run build-docs && gh-pages -d build"
13
13
  },
14
14
  "repository": {
15
15
  "type": "git",
@@ -18,12 +18,6 @@ variants:
18
18
  datePicker:
19
19
  defaultValue: "2020-05-22"
20
20
 
21
- - name: disabled
22
- label: Disabled
23
- context:
24
- datePicker:
25
- disabled: true
26
-
27
21
  - name: restricted-date
28
22
  label: Restricted Date
29
23
  context:
@@ -15,7 +15,6 @@
15
15
  name="appointment-date"
16
16
  type="text"
17
17
  aria-describedby="appointment-date-label appointment-date-hint"
18
- {% if datePicker.disabled %} disabled{% endif %}
19
18
  >
20
19
  </div>
21
20
  </div>
@@ -0,0 +1,23 @@
1
+ <script
2
+ src="{{ mockFetchScriptSrc }}"
3
+ ></script>
4
+ <script>
5
+ const feedbackApiUrl = "{{ feedbackApiUrl }}"
6
+ const mockErrorResponse = {
7
+ status: 500,
8
+ body: { message: "example server error" }
9
+ };
10
+ initMockFetch({
11
+ [`${feedbackApiUrl}/rating`]: mockErrorResponse,
12
+ [`${feedbackApiUrl}/comment`]: mockErrorResponse
13
+ }, {{ mockResponseDelayInMs }})
14
+ </script>
15
+
16
+ <script
17
+ src="https://unpkg.com/@newjersey/feedback-widget@{{ widgetVersion }}/feedback-widget.min.js"
18
+ defer
19
+ ></script>
20
+ <feedback-widget
21
+ skip-email-step="true"
22
+ contact-link="https://www.example.com/contact"
23
+ ></feedback-widget>
@@ -0,0 +1,20 @@
1
+ <script
2
+ src="{{ mockFetchScriptSrc }}"
3
+ ></script>
4
+ <script>
5
+ const feedbackApiUrl = "{{ feedbackApiUrl }}"
6
+ const mockSuccessResponse = {{ mockSuccessResponse | dump | safe }}
7
+ initMockFetch({
8
+ [`${feedbackApiUrl}/rating`]: mockSuccessResponse,
9
+ [`${feedbackApiUrl}/comment`]: mockSuccessResponse,
10
+ [`${feedbackApiUrl}/email`]: mockSuccessResponse
11
+ }, {{ mockResponseDelayInMs }})
12
+ </script>
13
+
14
+ <script
15
+ src="https://unpkg.com/@newjersey/feedback-widget@{{ widgetVersion }}/feedback-widget.min.js"
16
+ defer
17
+ ></script>
18
+ <feedback-widget
19
+ show-comment-disclaimer="false"
20
+ ></feedback-widget>
@@ -0,0 +1,20 @@
1
+ <script
2
+ src="{{ mockFetchScriptSrc }}"
3
+ ></script>
4
+ <script>
5
+ const feedbackApiUrl = "{{ feedbackApiUrl }}"
6
+ const mockSuccessResponse = {{ mockSuccessResponse | dump | safe }}
7
+ initMockFetch({
8
+ [`${feedbackApiUrl}/rating`]: mockSuccessResponse,
9
+ [`${feedbackApiUrl}/comment`]: mockSuccessResponse
10
+ }, {{ mockResponseDelayInMs }})
11
+ </script>
12
+
13
+ <script
14
+ src="https://unpkg.com/@newjersey/feedback-widget@{{ widgetVersion }}/feedback-widget.min.js"
15
+ defer
16
+ ></script>
17
+ <feedback-widget
18
+ skip-email-step="true"
19
+ contact-link="https://www.example.com/contact"
20
+ ></feedback-widget>
@@ -0,0 +1,15 @@
1
+ label: Feedback widget
2
+ default: success
3
+
4
+ context:
5
+ mockFetchScriptSrc: "/public/js/mockFetch.js"
6
+ widgetVersion: "latest"
7
+ feedbackApiUrl: "https://innovation.nj.gov/app/feedback/dev"
8
+ mockSuccessResponse: { status: 200, body: { message: "Success", feedbackId: 1 } }
9
+ mockResponseDelayInMs: 1000
10
+
11
+ variants:
12
+ - name: success
13
+ label: Success
14
+ - name: 500-server-error
15
+ label: API Error (500 status)
@@ -0,0 +1,20 @@
1
+ <script
2
+ src="{{ mockFetchScriptSrc }}"
3
+ ></script>
4
+ <script>
5
+ const feedbackApiUrl = "{{ feedbackApiUrl }}"
6
+ const mockSuccessResponse = {{ mockSuccessResponse | dump | safe }}
7
+ initMockFetch({
8
+ [`${feedbackApiUrl}/rating`]: mockSuccessResponse,
9
+ [`${feedbackApiUrl}/comment`]: mockSuccessResponse,
10
+ [`${feedbackApiUrl}/email`]: mockSuccessResponse
11
+ }, {{ mockResponseDelayInMs }})
12
+ </script>
13
+
14
+ <script
15
+ src="https://unpkg.com/@newjersey/feedback-widget@{{ widgetVersion }}/feedback-widget.min.js"
16
+ defer
17
+ ></script>
18
+ <feedback-widget
19
+ contact-link="https://www.example.com/contact"
20
+ ></feedback-widget>