@newjersey/njwds 2.6.0 → 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/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.0",
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>
@@ -2,4 +2,17 @@ label: Banner
2
2
 
3
3
  context:
4
4
  banner:
5
- text: "Official Site of the State of New Jersey"
5
+ # IMPORTANT: when updating banner text, please also update the min-width of
6
+ # the media query for the '.nj-banner__header li' selector in the custom
7
+ # styles SCSS.
8
+ #
9
+ # This media query controls the breakpoint for hiding the gov and lt. gov's
10
+ # names. The intended behavior here is to hide the names before the
11
+ # stateOfNjText wraps to 3 lines.
12
+ #
13
+ # Since the media query's min-width is set based on text length, it has to
14
+ # be updated when the banner text changes in order to keep the same
15
+ # wrapping behavior.
16
+ stateOfNjText: "Official Site of the State of New Jersey"
17
+ governorName: "Governor Phil Murphy"
18
+ ltGovernorName: "Lt. Governor Tahesha Way"
@@ -1,24 +1,34 @@
1
1
  <section class="nj-banner" aria-label="Official government website">
2
- <header class="nj-banner__header">
2
+ <div class="nj-banner__header">
3
3
  <div class="grid-container">
4
4
  <div class="nj-banner__inner">
5
5
  <div class="grid-col-auto">
6
- <img class="nj-banner__header-seal" src="{{ uswds.path }}/img/nj_state_seal.png" alt="NJ flag">
6
+ <img class="nj-banner__header-seal" src="{{ uswds.path }}/img/nj_state_seal.png" alt="NJ flag" />
7
7
  </div>
8
- <div class="grid-col-fill"><a href="https://nj.gov">{{ banner.text }}</a></div>
9
- <div class="grid-col-auto">
10
- <div class="text-white">
11
- <ul>
12
- <li>Governor Phil Murphy &bull; Lt. Governor Tahesha Way</li><li><a
13
- href="https://nj.gov/subscribe/" target="_blank"><svg
14
- class="usa-icon bottom-neg-2px margin-right-05"
15
- aria-hidden="true" focusable="false" role="img">
16
- <use xlink:href="{{ uswds.path }}/img/sprite.svg#mail"></use>
17
- </svg>Get Updates</a></li>
18
- </ul>
19
- </div>
8
+ <div class="grid-col-fill">
9
+ <a href="https://nj.gov">{{ banner.stateOfNjText }}</a>
20
10
  </div>
11
+ <ul class="grid-col-auto display-flex flex-align-center">
12
+ <li>{{ banner.governorName }} &bull; {{ banner.ltGovernorName }}</li>
13
+ <li class="grid-col-auto">
14
+ <a
15
+ class="display-flex flex-align-center"
16
+ href="https://nj.gov/subscribe/"
17
+ target="_blank"
18
+ >
19
+ <svg
20
+ class="usa-icon usa-icon--size-3 nj-banner__mail-icon margin-right-05"
21
+ role="img"
22
+ aria-hidden="true"
23
+ focusable="false"
24
+ >
25
+ <use xlink:href="{{ uswds.path }}/img/sprite.svg#mail" />
26
+ </svg>
27
+ Get Updates
28
+ </a>
29
+ </li>
30
+ </ul>
21
31
  </div>
22
32
  </div>
23
- </header>
33
+ </div>
24
34
  </section>
@@ -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>
@@ -43,7 +43,10 @@ i.e.
43
43
  }
44
44
  .nj-banner__header li {
45
45
  display: none;
46
- @include at-media("tablet") {
46
+
47
+ // Set min-width so the names are hidden before the stateOfNjText wraps to
48
+ // 3 lines
49
+ @media (min-width: 43rem) {
47
50
  display: inline;
48
51
  }
49
52
  @include u-margin-right(1);