From 59c29e47f55d96fcbad7711a385d316ff5c35542 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Mon, 8 Apr 2019 10:10:15 +1000 Subject: [PATCH 01/22] Renamed and moved src/js react files to src/react --- packages/accordion/package.json | 6 +++--- packages/accordion/src/{js => react}/react.js | 0 packages/body/package.json | 2 +- packages/breadcrumbs/package.json | 6 +++--- packages/breadcrumbs/src/{js => react}/react.js | 0 packages/buttons/package.json | 6 +++--- packages/buttons/src/{js => react}/react.js | 0 packages/callout/package.json | 6 +++--- packages/callout/src/{js => react}/react.js | 0 packages/control-input/package.json | 6 +++--- packages/control-input/src/{js => react}/react.js | 0 packages/core/package.json | 2 +- packages/cta-link/package.json | 6 +++--- packages/cta-link/src/{js => react}/react.js | 0 packages/direction-links/package.json | 6 +++--- packages/direction-links/src/{js => react}/react.js | 0 packages/footer/package.json | 6 +++--- packages/footer/src/{js => react}/react.js | 0 packages/form/package.json | 6 +++--- packages/form/src/{js => react}/react.js | 0 packages/grid-12/package.json | 2 +- packages/header/package.json | 6 +++--- packages/header/src/{js => react}/react.js | 0 packages/headings/package.json | 6 +++--- packages/headings/src/{js => react}/react.js | 0 packages/inpage-nav/package.json | 6 +++--- packages/inpage-nav/src/{js => react}/react.js | 0 packages/keyword-list/package.json | 6 +++--- packages/keyword-list/src/{js => react}/react.js | 0 packages/link-list/package.json | 6 +++--- packages/link-list/src/{js => react}/react.js | 0 packages/main-nav/package.json | 6 +++--- packages/main-nav/src/{js => react}/react.js | 0 packages/page-alerts/package.json | 6 +++--- packages/page-alerts/src/{js => react}/react.js | 0 packages/progress-indicator/package.json | 6 +++--- packages/progress-indicator/src/{js => react}/react.js | 0 packages/responsive-media/package.json | 2 +- packages/select/package.json | 6 +++--- packages/select/src/{js => react}/react.js | 0 packages/side-nav/package.json | 6 +++--- packages/side-nav/src/{js => react}/react.js | 0 packages/skip-link/package.json | 6 +++--- packages/skip-link/src/{js => react}/react.js | 0 packages/tags/package.json | 6 +++--- packages/tags/src/{js => react}/react.js | 0 packages/text-inputs/package.json | 6 +++--- packages/text-inputs/src/{js => react}/react.js | 0 48 files changed, 70 insertions(+), 70 deletions(-) rename packages/accordion/src/{js => react}/react.js (100%) rename packages/breadcrumbs/src/{js => react}/react.js (100%) rename packages/buttons/src/{js => react}/react.js (100%) rename packages/callout/src/{js => react}/react.js (100%) rename packages/control-input/src/{js => react}/react.js (100%) rename packages/cta-link/src/{js => react}/react.js (100%) rename packages/direction-links/src/{js => react}/react.js (100%) rename packages/footer/src/{js => react}/react.js (100%) rename packages/form/src/{js => react}/react.js (100%) rename packages/header/src/{js => react}/react.js (100%) rename packages/headings/src/{js => react}/react.js (100%) rename packages/inpage-nav/src/{js => react}/react.js (100%) rename packages/keyword-list/src/{js => react}/react.js (100%) rename packages/link-list/src/{js => react}/react.js (100%) rename packages/main-nav/src/{js => react}/react.js (100%) rename packages/page-alerts/src/{js => react}/react.js (100%) rename packages/progress-indicator/src/{js => react}/react.js (100%) rename packages/select/src/{js => react}/react.js (100%) rename packages/side-nav/src/{js => react}/react.js (100%) rename packages/skip-link/src/{js => react}/react.js (100%) rename packages/tags/src/{js => react}/react.js (100%) rename packages/text-inputs/src/{js => react}/react.js (100%) diff --git a/packages/accordion/package.json b/packages/accordion/package.json index cfa11d0a5..2b2bf2a7a 100644 --- a/packages/accordion/package.json +++ b/packages/accordion/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -52,11 +52,11 @@ "path": "lib/js/module.js" }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-js": "~1", diff --git a/packages/accordion/src/js/react.js b/packages/accordion/src/react/react.js similarity index 100% rename from packages/accordion/src/js/react.js rename to packages/accordion/src/react/react.js diff --git a/packages/body/package.json b/packages/body/package.json index 846d90ab2..8d6a34f4a 100644 --- a/packages/body/package.json +++ b/packages/body/package.json @@ -33,7 +33,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/breadcrumbs/package.json b/packages/breadcrumbs/package.json index 162cf6dd5..cfe9c8c28 100644 --- a/packages/breadcrumbs/package.json +++ b/packages/breadcrumbs/package.json @@ -33,7 +33,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -50,11 +50,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/breadcrumbs/src/js/react.js b/packages/breadcrumbs/src/react/react.js similarity index 100% rename from packages/breadcrumbs/src/js/react.js rename to packages/breadcrumbs/src/react/react.js diff --git a/packages/buttons/package.json b/packages/buttons/package.json index 71f710c84..aa70628c0 100644 --- a/packages/buttons/package.json +++ b/packages/buttons/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -48,11 +48,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/buttons/src/js/react.js b/packages/buttons/src/react/react.js similarity index 100% rename from packages/buttons/src/js/react.js rename to packages/buttons/src/react/react.js diff --git a/packages/callout/package.json b/packages/callout/package.json index 1d422f208..f0e99c322 100644 --- a/packages/callout/package.json +++ b/packages/callout/package.json @@ -35,7 +35,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -52,11 +52,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/callout/src/js/react.js b/packages/callout/src/react/react.js similarity index 100% rename from packages/callout/src/js/react.js rename to packages/callout/src/react/react.js diff --git a/packages/control-input/package.json b/packages/control-input/package.json index c168a31ea..51dd8a39b 100644 --- a/packages/control-input/package.json +++ b/packages/control-input/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -48,11 +48,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/control-input/src/js/react.js b/packages/control-input/src/react/react.js similarity index 100% rename from packages/control-input/src/js/react.js rename to packages/control-input/src/react/react.js diff --git a/packages/core/package.json b/packages/core/package.json index db8815f39..78f1accbd 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/cta-link/package.json b/packages/cta-link/package.json index f239a02dc..c44719199 100644 --- a/packages/cta-link/package.json +++ b/packages/cta-link/package.json @@ -34,7 +34,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -51,11 +51,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/cta-link/src/js/react.js b/packages/cta-link/src/react/react.js similarity index 100% rename from packages/cta-link/src/js/react.js rename to packages/cta-link/src/react/react.js diff --git a/packages/direction-links/package.json b/packages/direction-links/package.json index 29d76df3b..c8dbfb77d 100644 --- a/packages/direction-links/package.json +++ b/packages/direction-links/package.json @@ -37,7 +37,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -54,11 +54,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/direction-links/src/js/react.js b/packages/direction-links/src/react/react.js similarity index 100% rename from packages/direction-links/src/js/react.js rename to packages/direction-links/src/react/react.js diff --git a/packages/footer/package.json b/packages/footer/package.json index 48b79c7af..5c2067c10 100644 --- a/packages/footer/package.json +++ b/packages/footer/package.json @@ -34,7 +34,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -51,11 +51,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/footer/src/js/react.js b/packages/footer/src/react/react.js similarity index 100% rename from packages/footer/src/js/react.js rename to packages/footer/src/react/react.js diff --git a/packages/form/package.json b/packages/form/package.json index ef891bbdf..619a2c02d 100644 --- a/packages/form/package.json +++ b/packages/form/package.json @@ -26,7 +26,7 @@ "build": "npm run build:js && npm run build:react", "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -43,11 +43,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/form/src/js/react.js b/packages/form/src/react/react.js similarity index 100% rename from packages/form/src/js/react.js rename to packages/form/src/react/react.js diff --git a/packages/grid-12/package.json b/packages/grid-12/package.json index 23b6a67b4..64f5b7783 100644 --- a/packages/grid-12/package.json +++ b/packages/grid-12/package.json @@ -33,7 +33,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/header/package.json b/packages/header/package.json index 0521d3e51..55f9a41b9 100644 --- a/packages/header/package.json +++ b/packages/header/package.json @@ -33,7 +33,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -50,11 +50,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/header/src/js/react.js b/packages/header/src/react/react.js similarity index 100% rename from packages/header/src/js/react.js rename to packages/header/src/react/react.js diff --git a/packages/headings/package.json b/packages/headings/package.json index 19ffa9950..9ea407fb9 100644 --- a/packages/headings/package.json +++ b/packages/headings/package.json @@ -35,7 +35,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -52,11 +52,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/headings/src/js/react.js b/packages/headings/src/react/react.js similarity index 100% rename from packages/headings/src/js/react.js rename to packages/headings/src/react/react.js diff --git a/packages/inpage-nav/package.json b/packages/inpage-nav/package.json index fbd311c1c..3e6c7ef97 100644 --- a/packages/inpage-nav/package.json +++ b/packages/inpage-nav/package.json @@ -35,7 +35,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -52,11 +52,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/inpage-nav/src/js/react.js b/packages/inpage-nav/src/react/react.js similarity index 100% rename from packages/inpage-nav/src/js/react.js rename to packages/inpage-nav/src/react/react.js diff --git a/packages/keyword-list/package.json b/packages/keyword-list/package.json index 6426bb147..e12efa941 100644 --- a/packages/keyword-list/package.json +++ b/packages/keyword-list/package.json @@ -35,7 +35,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -52,11 +52,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/keyword-list/src/js/react.js b/packages/keyword-list/src/react/react.js similarity index 100% rename from packages/keyword-list/src/js/react.js rename to packages/keyword-list/src/react/react.js diff --git a/packages/link-list/package.json b/packages/link-list/package.json index 6d691ba2b..9fb4da99d 100644 --- a/packages/link-list/package.json +++ b/packages/link-list/package.json @@ -34,7 +34,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -51,11 +51,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/link-list/src/js/react.js b/packages/link-list/src/react/react.js similarity index 100% rename from packages/link-list/src/js/react.js rename to packages/link-list/src/react/react.js diff --git a/packages/main-nav/package.json b/packages/main-nav/package.json index c2356719b..425b62928 100644 --- a/packages/main-nav/package.json +++ b/packages/main-nav/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -52,11 +52,11 @@ "path": "lib/js/module.js" }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-js": "~1", diff --git a/packages/main-nav/src/js/react.js b/packages/main-nav/src/react/react.js similarity index 100% rename from packages/main-nav/src/js/react.js rename to packages/main-nav/src/react/react.js diff --git a/packages/page-alerts/package.json b/packages/page-alerts/package.json index 742f8a0fb..92892117c 100644 --- a/packages/page-alerts/package.json +++ b/packages/page-alerts/package.json @@ -38,7 +38,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -55,11 +55,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/page-alerts/src/js/react.js b/packages/page-alerts/src/react/react.js similarity index 100% rename from packages/page-alerts/src/js/react.js rename to packages/page-alerts/src/react/react.js diff --git a/packages/progress-indicator/package.json b/packages/progress-indicator/package.json index fb60e9a76..e2c5904d1 100644 --- a/packages/progress-indicator/package.json +++ b/packages/progress-indicator/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -48,11 +48,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/progress-indicator/src/js/react.js b/packages/progress-indicator/src/react/react.js similarity index 100% rename from packages/progress-indicator/src/js/react.js rename to packages/progress-indicator/src/react/react.js diff --git a/packages/responsive-media/package.json b/packages/responsive-media/package.json index 228fe4eee..dcc9d617e 100644 --- a/packages/responsive-media/package.json +++ b/packages/responsive-media/package.json @@ -37,7 +37,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/select/package.json b/packages/select/package.json index c89c0952d..d6e6e2fc1 100644 --- a/packages/select/package.json +++ b/packages/select/package.json @@ -33,7 +33,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -50,11 +50,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/select/src/js/react.js b/packages/select/src/react/react.js similarity index 100% rename from packages/select/src/js/react.js rename to packages/select/src/react/react.js diff --git a/packages/side-nav/package.json b/packages/side-nav/package.json index fce03221d..b603c454f 100644 --- a/packages/side-nav/package.json +++ b/packages/side-nav/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files 'tests/**/*.html, tests/**/*.css, tests/**/*.js'", "watch:js": "onchange 'src/js/*.js' -- npm run build:js", - "watch:jsx": "onchange 'src/js/react.js' 'tests/react/index.js' -- npm run build", + "watch:jsx": "onchange 'src/react/react.js' 'tests/react/index.js' -- npm run build", "watch:sass": "onchange 'src/sass/*.scss' 'tests/site/test.scss' -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -52,11 +52,11 @@ "path": "lib/js/module.js" }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-js": "~1", diff --git a/packages/side-nav/src/js/react.js b/packages/side-nav/src/react/react.js similarity index 100% rename from packages/side-nav/src/js/react.js rename to packages/side-nav/src/react/react.js diff --git a/packages/skip-link/package.json b/packages/skip-link/package.json index aed9a227d..b7297bd29 100644 --- a/packages/skip-link/package.json +++ b/packages/skip-link/package.json @@ -35,7 +35,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -52,11 +52,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/skip-link/src/js/react.js b/packages/skip-link/src/react/react.js similarity index 100% rename from packages/skip-link/src/js/react.js rename to packages/skip-link/src/react/react.js diff --git a/packages/tags/package.json b/packages/tags/package.json index 5c3669664..44cfe8541 100644 --- a/packages/tags/package.json +++ b/packages/tags/package.json @@ -33,7 +33,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -50,11 +50,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/tags/src/js/react.js b/packages/tags/src/react/react.js similarity index 100% rename from packages/tags/src/js/react.js rename to packages/tags/src/react/react.js diff --git a/packages/text-inputs/package.json b/packages/text-inputs/package.json index a2190382d..500ab1a19 100644 --- a/packages/text-inputs/package.json +++ b/packages/text-inputs/package.json @@ -39,7 +39,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -56,11 +56,11 @@ "sass-versioning": true }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-sass": "~2", diff --git a/packages/text-inputs/src/js/react.js b/packages/text-inputs/src/react/react.js similarity index 100% rename from packages/text-inputs/src/js/react.js rename to packages/text-inputs/src/react/react.js From 8ab32dadbb07c3951c45f7a32084e2ef29637900 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Mon, 8 Apr 2019 10:34:34 +1000 Subject: [PATCH 02/22] Moved jquery components into seperate folders --- packages/accordion/src/{js => jquery}/jquery.js | 0 packages/main-nav/src/{js => jquery}/jquery.js | 0 packages/side-nav/src/{js => jquery}/jquery.js | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename packages/accordion/src/{js => jquery}/jquery.js (100%) rename packages/main-nav/src/{js => jquery}/jquery.js (100%) rename packages/side-nav/src/{js => jquery}/jquery.js (100%) diff --git a/packages/accordion/src/js/jquery.js b/packages/accordion/src/jquery/jquery.js similarity index 100% rename from packages/accordion/src/js/jquery.js rename to packages/accordion/src/jquery/jquery.js diff --git a/packages/main-nav/src/js/jquery.js b/packages/main-nav/src/jquery/jquery.js similarity index 100% rename from packages/main-nav/src/js/jquery.js rename to packages/main-nav/src/jquery/jquery.js diff --git a/packages/side-nav/src/js/jquery.js b/packages/side-nav/src/jquery/jquery.js similarity index 100% rename from packages/side-nav/src/js/jquery.js rename to packages/side-nav/src/jquery/jquery.js From ae6adfffdfeef6dd7d6108d983865d07e9585d0f Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Mon, 8 Apr 2019 10:44:57 +1000 Subject: [PATCH 03/22] Corrected import for form tests --- packages/form/tests/react/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/form/tests/react/index.js b/packages/form/tests/react/index.js index d682e813e..976423e3b 100644 --- a/packages/form/tests/react/index.js +++ b/packages/form/tests/react/index.js @@ -1,11 +1,11 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { AUlabel, AUhintText, AUerrorText, AUformGroup, AUfieldset, AUForm, AUlegend } from './form.js'; -import AUtextInput from '../../../text-inputs/src/js/react'; -import AUheading from '../../../headings/src/js/react'; -import AUselect from '../../../select/src/js/react'; -import { AUcheckbox } from '../../../control-input/src/js/react'; +import { AUlabel, AUhintText, AUerrorText, AUformGroup, AUfieldset, AUlegend } from './form.js'; +import AUtextInput from '../../../text-inputs'; +import AUheading from '../../../headings'; +import AUselect from '../../../select'; +import { AUcheckbox } from '../../../control-input'; class App extends React.Component { From 180258e29d3adb1ae0f0fab0901abb34db2dc8b4 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Mon, 8 Apr 2019 10:45:27 +1000 Subject: [PATCH 04/22] Updating template package.json --- .templates/new-module/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.templates/new-module/package.json b/.templates/new-module/package.json index c5c87997c..e453c81fe 100644 --- a/.templates/new-module/package.json +++ b/.templates/new-module/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, @@ -52,11 +52,11 @@ "path": "lib/js/module.js" }, "react": { - "path": "lib/js/react.js" + "path": "lib/react/react.js" } } }, - "main": "lib/js/react.es5.js", + "main": "lib/react/react.es5.js", "dependencies": { "@gov.au/pancake": "~1", "@gov.au/pancake-js": "~1", From 629911a4e39450ed34cc47c5c611d8c1eb27d572 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Mon, 8 Apr 2019 10:45:45 +1000 Subject: [PATCH 05/22] Updated compile/precompile directory structures --- scripts/helper.js | 51 ++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/scripts/helper.js b/scripts/helper.js index d265935e1..e356711b9 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -336,26 +336,27 @@ HELPER.precompile = (() => { js: () => { const _hasJS = Fs.existsSync( `${ process.cwd() }/src/js/module.js` ); - const _hasJquery = Fs.existsSync( `${ process.cwd() }/src/js/jquery.js` ); - const _hasReact = Fs.existsSync( `${ process.cwd() }/src/js/react.js` ); - - // 1. create path - if( _hasJS || _hasJquery || _hasReact ) { - CreateDir(`./lib/js/`); - } - + const _hasJquery = Fs.existsSync( `${ process.cwd() }/src/jquery/jquery.js` ); + const _hasReact = Fs.existsSync( `${ process.cwd() }/src/react/react.js` ); + // 2. copy files if( _hasJS ) { + CreateDir(`./lib/js/`); + CopyFile(`./src/js/module.js`, `./lib/js/module.js`); } if( _hasJquery ) { - CopyFile(`./src/js/jquery.js`, `./lib/js/jquery.js`); + CreateDir(`./lib/jquery/`); + + CopyFile(`./src/jquery/jquery.js`, `./lib/jquery/jquery.js`); } if( _hasReact ) { - CopyFile(`./src/js/react.js`, `./lib/js/react.js`); - CopyFile(`./src/js/react.js`, `./tests/react/${ HELPER.NAME.substring( 8 ) }.js`); + CreateDir(`./lib/react/`); + + CopyFile(`./src/react/react.js`, `./lib/react/react.js`); + CopyFile(`./src/react/react.js`, `./tests/react/${ HELPER.NAME.substring( 8 ) }.js`); } // 3.replace strings inside new files in lib @@ -370,11 +371,11 @@ HELPER.precompile = (() => { } if( _hasJquery ) { - ReplaceFileContent( searches, `./lib/js/jquery.js` ); + ReplaceFileContent( searches, `./lib/jquery/jquery.js` ); } if( _hasReact ) { - ReplaceFileContent( searches, `./lib/js/react.js` ); + ReplaceFileContent( searches, `./lib/react/react.js` ); ReplaceFileContent( searches, `./tests/react/${ HELPER.NAME.substring( 8 ) }.js` ); } }, @@ -389,7 +390,7 @@ HELPER.precompile = (() => { * Compile and autoprefix Sass */ reactSass: () => { - if( Fs.existsSync(`${ process.cwd() }/lib/js/react.js`) ) { + if( Fs.existsSync(`${ process.cwd() }/lib/react/react.js`) ) { // 1. create directory CreateDir('./lib/css/'); @@ -406,7 +407,7 @@ HELPER.precompile = (() => { * Transpile react to es5, compile css file and include it into our react component */ react: () => { - if( Fs.existsSync(`${ process.cwd() }/lib/js/react.js`) ) { + if( Fs.existsSync(`${ process.cwd() }/lib/react/react.js`) ) { const reactOptions = { ast: false, compact: true, @@ -426,20 +427,20 @@ HELPER.precompile = (() => { }; // 1. Copy files - CopyFile('./src/js/react.js', './lib/js/react.es5.js'); + CopyFile('./src/react/react.js', './lib/react/react.es5.js'); // 2. Replace the comment with an import statement - ReplaceFileContent( searches, `${ process.cwd() }/lib/js/react.es5.js` ); + ReplaceFileContent( searches, `${ process.cwd() }/lib/react/react.es5.js` ); // 3. Compile /lib/react.js to react.es5.js - Babel.transformFile( `./lib/js/react.es5.js`, reactOptions, ( error, result ) => { + Babel.transformFile( `./lib/react/react.es5.js`, reactOptions, ( error, result ) => { if( error ) { - HELPER.log.error(`We encountered an error when transpiling the react file in ${ Chalk.yellow( `${ process.cwd() }/lib/js/react.es5.js` ) }`); + HELPER.log.error(`We encountered an error when transpiling the react file in ${ Chalk.yellow( `${ process.cwd() }/lib/react/react.es5.js` ) }`); HELPER.log.error( error ); } else { - Fs.writeFileSync( `./lib/js/react.es5.js`, result.code ); - Fs.writeFileSync( `./lib/js/react.es5.js.map`, JSON.stringify( result.map, null, 2 ) ); + Fs.writeFileSync( `./lib/react/react.es5.js`, result.code ); + Fs.writeFileSync( `./lib/react/react.es5.js.map`, JSON.stringify( result.map, null, 2 ) ); } }); } @@ -579,11 +580,11 @@ HELPER.compile = (() => { getAllJs( '/lib/js/module.js', '/tests/site/script.js' ); // get all js for jquery.js - getAllJs( '/lib/js/jquery.js', '/tests/jquery/jquery.js' ); + getAllJs( '/lib/jquery/jquery.js', '/tests/jquery/jquery.js' ); getAllJs( '/lib/js/module.js', '/tests/jquery/script.js' ); // get all react scripts - getAllReact( '/lib/js/react.js', '/tests/react/' ); + getAllReact( '/lib/react/react.js', '/tests/react/' ); }, img: () => { @@ -948,8 +949,8 @@ HELPER.test = (() => { const packagesPKG = require( Path.normalize(`${ __dirname }/../packages/${ module }/package.json`) ); const hasSass = Fs.existsSync( Path.normalize(`${ __dirname }/../packages/${ module }/src/sass/_module.scss`) ); const hasJS = Fs.existsSync( Path.normalize(`${ __dirname }/../packages/${ module }/src/js/module.js`) ); - const hasReact = Fs.existsSync( Path.normalize(`${ __dirname }/../packages/${ module }/src/js/react.js`) ); - // const hasJQuery = Fs.existsSync( Path.normalize(`${ __dirname }/../packages/${ module }/src/js/jquery.js`) ); + const hasReact = Fs.existsSync( Path.normalize(`${ __dirname }/../packages/${ module }/src/react/react.js`) ); + // const hasJQuery = Fs.existsSync( Path.normalize(`${ __dirname }/../packages/${ module }/src/jquery/jquery.js`) ); // testing lifecycle script if( packagesPKG.scripts.postinstall !== 'pancake' ) { From 9e8f869be0a922b3b2c7635da29e2b8ed5fc4d87 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Mon, 8 Apr 2019 13:45:08 +1000 Subject: [PATCH 06/22] Split calllout into seperate files --- packages/callout/src/react/callout.js | 62 +++++++++++++++++++ .../react/{react.js => calloutCalendar.js} | 57 +---------------- 2 files changed, 65 insertions(+), 54 deletions(-) create mode 100644 packages/callout/src/react/callout.js rename packages/callout/src/react/{react.js => calloutCalendar.js} (58%) diff --git a/packages/callout/src/react/callout.js b/packages/callout/src/react/callout.js new file mode 100644 index 000000000..5fec3def6 --- /dev/null +++ b/packages/callout/src/react/callout.js @@ -0,0 +1,62 @@ +/*! [replace-name] v[replace-version] */ +/*************************************************************************************************************************************************************** + * + * Callout function + * + * Use callout to notify and alert users of important snippets of information. + * + **************************************************************************************************************************************************************/ + +import React from 'react'; +import PropTypes from 'prop-types'; + + +// The following line will be replaced automatically with generic imports for the ES5 pipeline. +// You can safely ignore this bit if you use this module with pancake +// +// [replace-imports] + + +/** + * Default callout + * + * @param {string} title - The title of the header + * @param {string} level - The tag level (

etc), default: '1' + * @param {boolean} srOnlyTitle - Title is visible to screen readers only + * @param {boolean} dark - Add the dark variation class, optional + * @param {boolean} alt - Add the alt variation class, optional + * @param {string} children - Anything inside + * @param {string} className - An additional class, optional + * @param {object} attributeOptions - Any other attribute options + */ +export const AUcallout = ({ title, level, srOnlyTitle, dark, alt, description, children, className = '', ...attributeOptions }) => { + const HeadingTag = `h${ level }`; + + return ( +
+ + { children } +
+ ) +}; + +AUcallout.propTypes = { + title: PropTypes.string.isRequired, + level: PropTypes.number, + srOnlyTitle: PropTypes.bool, + dark: PropTypes.bool, + alt: PropTypes.bool, + children: PropTypes.node.isRequired, + className: PropTypes.string, +}; + +AUcallout.defaultProps = { + level: 2, + srOnlyTitle: false, +}; diff --git a/packages/callout/src/react/react.js b/packages/callout/src/react/calloutCalendar.js similarity index 58% rename from packages/callout/src/react/react.js rename to packages/callout/src/react/calloutCalendar.js index ef03d2099..098b27d8f 100644 --- a/packages/callout/src/react/react.js +++ b/packages/callout/src/react/calloutCalendar.js @@ -1,67 +1,16 @@ -/*! [replace-name] v[replace-version] */ /*************************************************************************************************************************************************************** * - * Callout function + * Callout calendar function * - * Use callout to notify and alert users of important snippets of information. + * Use callout calendar to ... * **************************************************************************************************************************************************************/ + import React from 'react'; import PropTypes from 'prop-types'; -// The following line will be replaced automatically with generic imports for the ES5 pipeline. -// You can safely ignore this bit if you use this module with pancake -// -// [replace-imports] - - -/** - * Default callout - * - * @param {string} title - The title of the header - * @param {string} level - The tag level (

etc), default: '1' - * @param {boolean} srOnlyTitle - Title is visible to screen readers only - * @param {boolean} dark - Add the dark variation class, optional - * @param {boolean} alt - Add the alt variation class, optional - * @param {string} children - Anything inside - * @param {string} className - An additional class, optional - * @param {object} attributeOptions - Any other attribute options - */ -export const AUcallout = ({ title, level, srOnlyTitle, dark, alt, description, children, className = '', ...attributeOptions }) => { - const HeadingTag = `h${ level }`; - - return ( -
- - { children } -
- ) -}; - -AUcallout.propTypes = { - title: PropTypes.string.isRequired, - level: PropTypes.number, - srOnlyTitle: PropTypes.bool, - dark: PropTypes.bool, - alt: PropTypes.bool, - children: PropTypes.node.isRequired, - className: PropTypes.string, -}; - -AUcallout.defaultProps = { - level: 2, - srOnlyTitle: false, -}; - - /** * Calendar callout * From 535f9422ce752167a83cd45c85258bff2f27d650 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Mon, 8 Apr 2019 13:48:01 +1000 Subject: [PATCH 07/22] Refactored component short name --- scripts/helper.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/helper.js b/scripts/helper.js index e356711b9..7283aa57c 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -223,6 +223,7 @@ const HELPER = (() => { // constructor factory // Settings //-------------------------------------------------------------------------------------------------------------------------------------------------------------- NAME: PKG.name, + SHORTNAME: PKG.name.substring( 8 ), VERSION: PKG.version, DEPENDENCIES: PKG.peerDependencies, TEMPLATES: Path.normalize(`${ __dirname }/../.templates`), @@ -325,7 +326,7 @@ HELPER.precompile = (() => { */ readme: () => { const depTree = GetDepTree( HELPER.NAME ); - const prettyTree = `${ HELPER.NAME.substring( 8 ) }\n${ Treeify.asTree( depTree ) }`; + const prettyTree = `${ HELPER.SHORTNAME }\n${ Treeify.asTree( depTree ) }`; let readme = Fs.readFileSync( `./README.md`, `utf-8`); readme = readme.replace(/## Dependency graph\n\n```shell[\s\S]*?```/, `## Dependency graph\n\n\`\`\`shell\n${ prettyTree }\`\`\``); @@ -356,7 +357,7 @@ HELPER.precompile = (() => { CreateDir(`./lib/react/`); CopyFile(`./src/react/react.js`, `./lib/react/react.js`); - CopyFile(`./src/react/react.js`, `./tests/react/${ HELPER.NAME.substring( 8 ) }.js`); + CopyFile(`./src/react/react.js`, `./tests/react/${ HELPER.SHORTNAME }.js`); } // 3.replace strings inside new files in lib @@ -376,7 +377,7 @@ HELPER.precompile = (() => { if( _hasReact ) { ReplaceFileContent( searches, `./lib/react/react.js` ); - ReplaceFileContent( searches, `./tests/react/${ HELPER.NAME.substring( 8 ) }.js` ); + ReplaceFileContent( searches, `./tests/react/${ HELPER.SHORTNAME }.js` ); } }, @@ -1185,7 +1186,7 @@ HELPER.init = () => { if( process.argv.indexOf( 'precompile' ) !== -1 ) { - CFonts.say( `Precompile ${ PKG.name.substring( 8 ) }`, { + CFonts.say( `Precompile ${ HELPER.SHORTNAME }`, { font: 'chrome', space: false, colors: ['red', 'magenta', 'blue'], @@ -1202,7 +1203,7 @@ HELPER.init = () => { if( process.argv.indexOf( 'compile' ) !== -1 ) { - CFonts.say( `Compiling ${ PKG.name.substring( 8 ) }`, { + CFonts.say( `Compiling ${ HELPER.SHORTNAME }`, { font: 'chrome', space: false, colors: ['red', 'magenta', 'blue'], From fed44f42ca7ba24eb9353137f790ed258d5f9d00 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Mon, 8 Apr 2019 17:11:21 +1000 Subject: [PATCH 08/22] Seperated react src files --- .../src/react/{react.js => accordion.js} | 0 .../src/react/{react.js => breadcrumbs.js} | 0 .../src/react/{react.js => buttons.js} | 0 .../src/react/{react.js => control-input.js} | 46 +--- .../src/react/control-inputRadio.js | 53 ++++ .../src/react/{react.js => cta-link.js} | 0 .../react/{react.js => direction-links.js} | 0 .../footer/src/react/{react.js => footer.js} | 45 ---- packages/footer/src/react/footerEnd.js | 30 +++ packages/footer/src/react/footerNav.js | 36 +++ packages/form/src/react/form.js | 47 ++++ packages/form/src/react/formErrorText.js | 58 +++++ packages/form/src/react/formGroup.js | 50 ++++ packages/form/src/react/formHintText.js | 58 +++++ packages/form/src/react/formLabel.js | 57 +++++ packages/form/src/react/formLegend.js | 21 ++ packages/form/src/react/react.js | 230 ------------------ packages/header/src/react/header.js | 47 ++++ .../src/react/{react.js => headerBrand.js} | 40 +-- .../src/react/{react.js => headings.js} | 0 .../src/react/{react.js => inpage-nav.js} | 60 ----- .../inpage-nav/src/react/inpage-navLinks.js | 50 ++++ .../src/react/inpage-navLinksItem.js | 32 +++ .../keyword-list/src/react/keyword-list.js | 61 +++++ .../react/{react.js => keyword-listItem.js} | 55 +---- packages/link-list/src/react/link-list.js | 56 +++++ .../src/react/{react.js => link-listItem.js} | 48 +--- packages/main-nav/src/react/main-nav.js | 46 ++++ .../react/{react.js => main-navContent.js} | 100 +------- packages/main-nav/src/react/main-navMenu.js | 67 +++++ .../src/react/{react.js => page-alerts.js} | 0 .../src/react/progress-indicator.js | 58 +++++ .../{react.js => progress-indicatorItem.js} | 50 +--- .../select/src/react/{react.js => select.js} | 18 -- packages/select/src/react/selectItem.js | 29 +++ .../src/react/{react.js => side-nav.js} | 39 --- packages/side-nav/src/react/side-navMenu.js | 50 ++++ 37 files changed, 920 insertions(+), 717 deletions(-) rename packages/accordion/src/react/{react.js => accordion.js} (100%) rename packages/breadcrumbs/src/react/{react.js => breadcrumbs.js} (100%) rename packages/buttons/src/react/{react.js => buttons.js} (100%) rename packages/control-input/src/react/{react.js => control-input.js} (57%) create mode 100644 packages/control-input/src/react/control-inputRadio.js rename packages/cta-link/src/react/{react.js => cta-link.js} (100%) rename packages/direction-links/src/react/{react.js => direction-links.js} (100%) rename packages/footer/src/react/{react.js => footer.js} (54%) create mode 100644 packages/footer/src/react/footerEnd.js create mode 100644 packages/footer/src/react/footerNav.js create mode 100644 packages/form/src/react/form.js create mode 100644 packages/form/src/react/formErrorText.js create mode 100644 packages/form/src/react/formGroup.js create mode 100644 packages/form/src/react/formHintText.js create mode 100644 packages/form/src/react/formLabel.js create mode 100644 packages/form/src/react/formLegend.js delete mode 100644 packages/form/src/react/react.js create mode 100644 packages/header/src/react/header.js rename packages/header/src/react/{react.js => headerBrand.js} (67%) rename packages/headings/src/react/{react.js => headings.js} (100%) rename packages/inpage-nav/src/react/{react.js => inpage-nav.js} (52%) create mode 100644 packages/inpage-nav/src/react/inpage-navLinks.js create mode 100644 packages/inpage-nav/src/react/inpage-navLinksItem.js create mode 100644 packages/keyword-list/src/react/keyword-list.js rename packages/keyword-list/src/react/{react.js => keyword-listItem.js} (54%) create mode 100644 packages/link-list/src/react/link-list.js rename packages/link-list/src/react/{react.js => link-listItem.js} (60%) create mode 100644 packages/main-nav/src/react/main-nav.js rename packages/main-nav/src/react/{react.js => main-navContent.js} (83%) create mode 100644 packages/main-nav/src/react/main-navMenu.js rename packages/page-alerts/src/react/{react.js => page-alerts.js} (100%) create mode 100644 packages/progress-indicator/src/react/progress-indicator.js rename packages/progress-indicator/src/react/{react.js => progress-indicatorItem.js} (64%) rename packages/select/src/react/{react.js => select.js} (79%) create mode 100644 packages/select/src/react/selectItem.js rename packages/side-nav/src/react/{react.js => side-nav.js} (76%) create mode 100644 packages/side-nav/src/react/side-navMenu.js diff --git a/packages/accordion/src/react/react.js b/packages/accordion/src/react/accordion.js similarity index 100% rename from packages/accordion/src/react/react.js rename to packages/accordion/src/react/accordion.js diff --git a/packages/breadcrumbs/src/react/react.js b/packages/breadcrumbs/src/react/breadcrumbs.js similarity index 100% rename from packages/breadcrumbs/src/react/react.js rename to packages/breadcrumbs/src/react/breadcrumbs.js diff --git a/packages/buttons/src/react/react.js b/packages/buttons/src/react/buttons.js similarity index 100% rename from packages/buttons/src/react/react.js rename to packages/buttons/src/react/buttons.js diff --git a/packages/control-input/src/react/react.js b/packages/control-input/src/react/control-input.js similarity index 57% rename from packages/control-input/src/react/react.js rename to packages/control-input/src/react/control-input.js index dc25070b5..6543bd7ed 100644 --- a/packages/control-input/src/react/react.js +++ b/packages/control-input/src/react/control-input.js @@ -1,7 +1,6 @@ -/*! [replace-name] v[replace-version] */ /*************************************************************************************************************************************************************** * - * control-input function + * control-input checkbox function * * Control inputs include radio buttons and checkboxes. They allow users to select one or more options. * @@ -58,46 +57,3 @@ AUcheckbox.propTypes = { status: PropTypes.oneOf([ 'valid', 'invalid' ]), className: PropTypes.string, }; - - -/** - * The radio component - * - * @param {boolean} dark - Add the dark variation class, optional - * @param {boolean} alt - Add the alt variation class, optional - * @param {boolean} small - Add the small variation class - * @param {boolean} block - Add the block variation class - * @param {string} label - The label text - * @param {string} status - Mark this field as either 'valid' or 'invalid', optional - * @param {string} id - The id of the radio input - * @param {string} className - An additional class, optional - * @param {object} attributeOptions - Any other attribute options - */ -export const AUradio = ({ dark, alt, small, block, label, status, id, className = '', ...attributeOptions }) => { - - return ( -
- - -
- ); -}; - -AUradio.propTypes = { - dark: PropTypes.bool, - alt: PropTypes.bool, - small: PropTypes.bool, - block: PropTypes.bool, - label: PropTypes.string.isRequired, - id: PropTypes.string.isRequired, - status: PropTypes.oneOf([ 'valid', 'invalid' ]), - className: PropTypes.string, -}; diff --git a/packages/control-input/src/react/control-inputRadio.js b/packages/control-input/src/react/control-inputRadio.js new file mode 100644 index 000000000..b80912f14 --- /dev/null +++ b/packages/control-input/src/react/control-inputRadio.js @@ -0,0 +1,53 @@ +/*************************************************************************************************************************************************************** + * + * control-input radio function + * + * Control inputs include radio buttons and checkboxes. They allow users to select one or more options. + * + **************************************************************************************************************************************************************/ + +import React from 'react'; +import PropTypes from 'prop-types'; + + +/** + * The radio component + * + * @param {boolean} dark - Add the dark variation class, optional + * @param {boolean} alt - Add the alt variation class, optional + * @param {boolean} small - Add the small variation class + * @param {boolean} block - Add the block variation class + * @param {string} label - The label text + * @param {string} status - Mark this field as either 'valid' or 'invalid', optional + * @param {string} id - The id of the radio input + * @param {string} className - An additional class, optional + * @param {object} attributeOptions - Any other attribute options + */ +export const AUradio = ({ dark, alt, small, block, label, status, id, className = '', ...attributeOptions }) => { + + return ( +
+ + +
+ ); +}; + +AUradio.propTypes = { + dark: PropTypes.bool, + alt: PropTypes.bool, + small: PropTypes.bool, + block: PropTypes.bool, + label: PropTypes.string.isRequired, + id: PropTypes.string.isRequired, + status: PropTypes.oneOf([ 'valid', 'invalid' ]), + className: PropTypes.string, +}; diff --git a/packages/cta-link/src/react/react.js b/packages/cta-link/src/react/cta-link.js similarity index 100% rename from packages/cta-link/src/react/react.js rename to packages/cta-link/src/react/cta-link.js diff --git a/packages/direction-links/src/react/react.js b/packages/direction-links/src/react/direction-links.js similarity index 100% rename from packages/direction-links/src/react/react.js rename to packages/direction-links/src/react/direction-links.js diff --git a/packages/footer/src/react/react.js b/packages/footer/src/react/footer.js similarity index 54% rename from packages/footer/src/react/react.js rename to packages/footer/src/react/footer.js index e124f0917..ad3cb0aa6 100644 --- a/packages/footer/src/react/react.js +++ b/packages/footer/src/react/footer.js @@ -17,51 +17,6 @@ import PropTypes from 'prop-types'; // [replace-imports] - -/** - * A section for the footer that contains navigational elements - * - * @param {node} children - The inside of this section - * @param {string} className - An additional class, optional - * @param {string} ariaLabel - The aria-label attribute, optional - * @param {object} attributeOptions - Any other attribute options - */ -export const AUfooterNav = ({ children, className = '', ariaLabel, ...attributeOptions }) => ( - -); - -AUfooterNav.propTypes = { - children: PropTypes.node.isRequired, - className: PropTypes.string, - ariaLabel: PropTypes.string, -}; - -AUfooterNav.defaultProps = { - ariaLabel: 'footer', -} - - -/** - * A section for the footer that sits at the end - * - * @param {node} children - The inside of this section - * @param {string} className - An additional class, optional - * @param {object} attributeOptions - Any other attribute options - */ -export const AUfooterEnd = ({ children, className = '', ...attributeOptions }) => ( -
- { children } -
-); - -AUfooterEnd.propTypes = { - children: PropTypes.node.isRequired, - className: PropTypes.string, -}; - - /** * DEFAULT * The footer component diff --git a/packages/footer/src/react/footerEnd.js b/packages/footer/src/react/footerEnd.js new file mode 100644 index 000000000..f3e0a206a --- /dev/null +++ b/packages/footer/src/react/footerEnd.js @@ -0,0 +1,30 @@ +/*************************************************************************************************************************************************************** + * + * footer end function + * + * Footers help users who reach the bottom of a page without finding what they want. + * + **************************************************************************************************************************************************************/ + + +import React from 'react'; +import PropTypes from 'prop-types'; + + +/** + * A section for the footer that sits at the end + * + * @param {node} children - The inside of this section + * @param {string} className - An additional class, optional + * @param {object} attributeOptions - Any other attribute options + */ +export const AUfooterEnd = ({ children, className = '', ...attributeOptions }) => ( +
+ { children } +
+); + +AUfooterEnd.propTypes = { + children: PropTypes.node.isRequired, + className: PropTypes.string, +}; diff --git a/packages/footer/src/react/footerNav.js b/packages/footer/src/react/footerNav.js new file mode 100644 index 000000000..cb6b05606 --- /dev/null +++ b/packages/footer/src/react/footerNav.js @@ -0,0 +1,36 @@ +/*************************************************************************************************************************************************************** + * + * footer nav function + * + * Footers help users who reach the bottom of a page without finding what they want. + * + **************************************************************************************************************************************************************/ + + +import React from 'react'; +import PropTypes from 'prop-types'; + + +/** + * A section for the footer that contains navigational elements + * + * @param {node} children - The inside of this section + * @param {string} className - An additional class, optional + * @param {string} ariaLabel - The aria-label attribute, optional + * @param {object} attributeOptions - Any other attribute options + */ +export const AUfooterNav = ({ children, className = '', ariaLabel, ...attributeOptions }) => ( + +); + +AUfooterNav.propTypes = { + children: PropTypes.node.isRequired, + className: PropTypes.string, + ariaLabel: PropTypes.string, +}; + +AUfooterNav.defaultProps = { + ariaLabel: 'footer', +} diff --git a/packages/form/src/react/form.js b/packages/form/src/react/form.js new file mode 100644 index 000000000..09e5f1bcb --- /dev/null +++ b/packages/form/src/react/form.js @@ -0,0 +1,47 @@ +/*! [replace-name] v[replace-version] */ +/*************************************************************************************************************************************************************** + * + * form fieldset function + * + * The form component contains layout, labelling and inline validations for form fields + * +**************************************************************************************************************************************************************/ + +import React from 'react'; +import PropTypes from 'prop-types'; + + +// The following line will be replaced automatically with generic imports for the ES5 pipeline. +// You can safely ignore this bit if you use this module with pancake +// +// [replace-imports] + + +/** + * The fieldset component + * + * @param {string} className - An additional class, optional + * @param {object} attributeOptions - Any other attribute options + */ +export const AUfieldset = ( { dark, className, ...attributeOptions } ) => ( +
+
+); + + +AUfieldset.propTypes = { + /** + * An additional class, optional + */ + className: PropTypes.string, +}; + + +AUfieldset.defaultProps = { + className: '' +} diff --git a/packages/form/src/react/formErrorText.js b/packages/form/src/react/formErrorText.js new file mode 100644 index 000000000..034a02563 --- /dev/null +++ b/packages/form/src/react/formErrorText.js @@ -0,0 +1,58 @@ +/*************************************************************************************************************************************************************** + * + * form error text function + * + * The form component contains layout, labelling and inline validations for form fields + * +**************************************************************************************************************************************************************/ + + +import React from 'react'; +import PropTypes from 'prop-types'; + + +/** + * The error text component + * + * @param {string} text - Text of the label, required + * @param {boolean} dark - Add the dark variation class, optional + * @param {boolean} inline - Display the error text inline, optional + * @param {string} className - An additional class, optional + * @param {object} attributeOptions - Any other attribute options + */ +export const AUerrorText = ( { text, dark, inline, className, ...attributeOptions } ) => ( + + { text } + +); + + +AUerrorText.propTypes = { + /** + * Text of the label, required + */ + dark: PropTypes.bool, + /** + * Add the dark variation class, optional + */ + text: PropTypes.string.isRequired, + /** + * Display the error text inline, optional + */ + inline: PropTypes.bool, + /** + * An additional class, optional + */ + className: PropTypes.string, +}; + + +AUerrorText.defaultProps = { + className: '' +} diff --git a/packages/form/src/react/formGroup.js b/packages/form/src/react/formGroup.js new file mode 100644 index 000000000..527792bb5 --- /dev/null +++ b/packages/form/src/react/formGroup.js @@ -0,0 +1,50 @@ +/*************************************************************************************************************************************************************** + * + * form group function + * + * The form component contains layout, labelling and inline validations for form fields + * +**************************************************************************************************************************************************************/ + +import React from 'react'; +import PropTypes from 'prop-types'; + + +// The following line will be replaced automatically with generic imports for the ES5 pipeline. +// You can safely ignore this bit if you use this module with pancake +// +// [replace-imports] + + +/** + * The form group component + * + * @param {string} status - Adds invalid state to form group + * @param {string} className - An additional class, optional + * @param {object} attributeOptions - Any other attribute options + */ +export const AUformGroup = ( { status, dark, className, ...attributeOptions } ) => ( +
+); + + +AUformGroup.propTypes = { + /** + * Adds invalid state to form group + */ + status: PropTypes.oneOf(['valid', 'invalid']), + /** + * An additional class, optional + */ + className: PropTypes.string, +}; + +AUformGroup.defaultProps = { + status: "valid", + className: '' +} diff --git a/packages/form/src/react/formHintText.js b/packages/form/src/react/formHintText.js new file mode 100644 index 000000000..131eec2cb --- /dev/null +++ b/packages/form/src/react/formHintText.js @@ -0,0 +1,58 @@ +/*************************************************************************************************************************************************************** + * + * form hint text function + * + * The form component contains layout, labelling and inline validations for form fields + * +**************************************************************************************************************************************************************/ + + +import React from 'react'; +import PropTypes from 'prop-types'; + + +/** + * The hint text component + * + * @param {string} text - Text of the label, required + * @param {boolean} dark - Add the dark variation class, optional + * @param {boolean} alt - Add the alt variation class, optional + * @param {string} className - An additional class, optional + * @param {object} attributeOptions - Any other attribute options + */ +export const AUhintText = ( { text, dark, alt, className, ...attributeOptions } ) => ( + + { text } + +); + + +AUhintText.propTypes = { + /** + * Text of the label, required + */ + text: PropTypes.string.isRequired, + /** + * Add the dark variation class, optional + */ + alt: PropTypes.bool, + /** + * Add the alt variation class, optional + */ + dark: PropTypes.bool, + /** + * An additional class, optional + */ + className: PropTypes.string, +}; + + +AUhintText.defaultProps = { + className: '' +} diff --git a/packages/form/src/react/formLabel.js b/packages/form/src/react/formLabel.js new file mode 100644 index 000000000..a2b55195b --- /dev/null +++ b/packages/form/src/react/formLabel.js @@ -0,0 +1,57 @@ +/*************************************************************************************************************************************************************** + * + * form label function + * + * The form component contains layout, labelling and inline validations for form fields + * +**************************************************************************************************************************************************************/ + + +import React from 'react'; +import PropTypes from 'prop-types'; + + +/** + * The label component + * + * @param {string} text - Text of the label, required + * @param {boolean} dark - Add the dark variation class, optional + * @param {boolean} inline - Display the label inline, optional + * @param {string} className - An additional class, optional + * @param {object} attributeOptions - Any other attribute options + */ +export const AUlabel = ( { text, dark, inline, className, ...attributeOptions } ) => ( + +); + +AUlabel.propTypes = { + /** + * Text of the label, required + */ + text: PropTypes.string.isRequired, + /** + * Add the dark variation class, optional + */ + dark: PropTypes.bool, + /** + * Display the label inline, optional + */ + inline: PropTypes.bool, + /** + * An additional class, optional + */ + className: PropTypes.string, +}; + + +AUlabel.defaultProps = { + className: '' +} diff --git a/packages/form/src/react/formLegend.js b/packages/form/src/react/formLegend.js new file mode 100644 index 000000000..132bc06b3 --- /dev/null +++ b/packages/form/src/react/formLegend.js @@ -0,0 +1,21 @@ +/*************************************************************************************************************************************************************** + * + * form legend function + * + * The form component contains layout, labelling and inline validations for form fields + * +**************************************************************************************************************************************************************/ + + +import React from 'react'; +import PropTypes from 'prop-types'; + + +/** + * The legend component + * + * @param {object} attributeOptions - Any other attribute options + */ +export const AUlegend = ( {...attributeOptions} ) => ( + +); diff --git a/packages/form/src/react/react.js b/packages/form/src/react/react.js deleted file mode 100644 index 125fecbe1..000000000 --- a/packages/form/src/react/react.js +++ /dev/null @@ -1,230 +0,0 @@ -/*! [replace-name] v[replace-version] */ -/*************************************************************************************************************************************************************** - * - * form function - * - * The form component contains layout, labelling and inline validations for form fields - * - **************************************************************************************************************************************************************/ - -import React from 'react'; -import PropTypes from 'prop-types'; - - -// The following line will be replaced automatically with generic imports for the ES5 pipeline. -// You can safely ignore this bit if you use this module with pancake -// -// [replace-imports] - - -/** - * The label component - * - * @param {string} text - Text of the label, required - * @param {boolean} dark - Add the dark variation class, optional - * @param {boolean} inline - Display the label inline, optional - * @param {string} className - An additional class, optional - * @param {object} attributeOptions - Any other attribute options - */ -export const AUlabel = ( { text, dark, inline, className, ...attributeOptions } ) => ( - -); - -AUlabel.propTypes = { - /** - * Text of the label, required - */ - text: PropTypes.string.isRequired, - /** - * Add the dark variation class, optional - */ - dark: PropTypes.bool, - /** - * Display the label inline, optional - */ - inline: PropTypes.bool, - /** - * An additional class, optional - */ - className: PropTypes.string, -}; - - -AUlabel.defaultProps = { - className: '' -} - - -/** - * The hint text component - * - * @param {string} text - Text of the label, required - * @param {boolean} dark - Add the dark variation class, optional - * @param {boolean} alt - Add the alt variation class, optional - * @param {string} className - An additional class, optional - * @param {object} attributeOptions - Any other attribute options - */ -export const AUhintText = ( { text, dark, alt, className, ...attributeOptions } ) => ( - - { text } - -); - - -AUhintText.propTypes = { - /** - * Text of the label, required - */ - text: PropTypes.string.isRequired, - /** - * Add the dark variation class, optional - */ - alt: PropTypes.bool, - /** - * Add the alt variation class, optional - */ - dark: PropTypes.bool, - /** - * An additional class, optional - */ - className: PropTypes.string, -}; - - -AUhintText.defaultProps = { - className: '' -} - - -/** - * The error text component - * - * @param {string} text - Text of the label, required - * @param {boolean} dark - Add the dark variation class, optional - * @param {boolean} inline - Display the error text inline, optional - * @param {string} className - An additional class, optional - * @param {object} attributeOptions - Any other attribute options - */ -export const AUerrorText = ( { text, dark, inline, className, ...attributeOptions } ) => ( - - { text } - -); - - -AUerrorText.propTypes = { - /** - * Text of the label, required - */ - dark: PropTypes.bool, - /** - * Add the dark variation class, optional - */ - text: PropTypes.string.isRequired, - /** - * Display the error text inline, optional - */ - inline: PropTypes.bool, - /** - * An additional class, optional - */ - className: PropTypes.string, -}; - - -AUerrorText.defaultProps = { - className: '' -} - -/** - * The form group component - * - * @param {string} status - Adds invalid state to form group - * @param {string} className - An additional class, optional - * @param {object} attributeOptions - Any other attribute options - */ -export const AUformGroup = ( { status, dark, className, ...attributeOptions } ) => ( -
-); - - -AUformGroup.propTypes = { - /** - * Adds invalid state to form group - */ - status: PropTypes.oneOf(['valid', 'invalid']), - /** - * An additional class, optional - */ - className: PropTypes.string, -}; - -AUformGroup.defaultProps = { - status: "valid", - className: '' -} - - -/** - * The fieldset component - * - * @param {string} className - An additional class, optional - * @param {object} attributeOptions - Any other attribute options - */ -export const AUfieldset = ( { dark, className, ...attributeOptions } ) => ( -
-
-); - - -AUfieldset.propTypes = { - /** - * An additional class, optional - */ - className: PropTypes.string, -}; - - -AUfieldset.defaultProps = { - className: '' -} - - -/** - * The legend component - * - * @param {object} attributeOptions - Any other attribute options - */ -export const AUlegend = ( {...attributeOptions} ) => ( - -); diff --git a/packages/header/src/react/header.js b/packages/header/src/react/header.js new file mode 100644 index 000000000..f96e6bf10 --- /dev/null +++ b/packages/header/src/react/header.js @@ -0,0 +1,47 @@ +/*! [replace-name] v[replace-version] */ +/*************************************************************************************************************************************************************** + * + * header function + * + * Headers provide a consistent start to pages. + * + **************************************************************************************************************************************************************/ + +import React from 'react'; +import PropTypes from 'prop-types'; + + +// The following line will be replaced automatically with generic imports for the ES5 pipeline. +// You can safely ignore this bit if you use this module with pancake +// +// [replace-imports] + + +/** + * DEFAULT + * The header component + * + * @param {boolean} hero - The hero option, optional + * @param {boolean} dark - Add the dark variation class, optional + * @param {boolean} alt - Add the alt variation class, optional + * @param {node} children - The inside of this section + * @param {string} className - An additional class, optional + * @param {object} attributeOptions - Any other attribute options + */ +const AUheader = ({ hero, dark, alt, children, className = '', ...attributeOptions }) => ( +
+ { children } +
+); + +AUheader.propTypes = { + hero: PropTypes.bool, + dark: PropTypes.bool, + alt: PropTypes.bool, + children: PropTypes.node, + className: PropTypes.string, +}; + +export default AUheader; diff --git a/packages/header/src/react/react.js b/packages/header/src/react/headerBrand.js similarity index 67% rename from packages/header/src/react/react.js rename to packages/header/src/react/headerBrand.js index a1b7faccb..b1568a0df 100644 --- a/packages/header/src/react/react.js +++ b/packages/header/src/react/headerBrand.js @@ -1,22 +1,16 @@ -/*! [replace-name] v[replace-version] */ /*************************************************************************************************************************************************************** * * header function * * Headers provide a consistent start to pages. * - **************************************************************************************************************************************************************/ +**************************************************************************************************************************************************************/ + import React from 'react'; import PropTypes from 'prop-types'; -// The following line will be replaced automatically with generic imports for the ES5 pipeline. -// You can safely ignore this bit if you use this module with pancake -// -// [replace-imports] - - /** * The header brand component * @@ -105,33 +99,3 @@ AUheaderBrand.defaultProps = { brandImageAlt: 'Australian Government Crest', linkComponent: 'a', }; - - -/** - * DEFAULT - * The header component - * - * @param {boolean} hero - The hero option, optional - * @param {boolean} dark - Add the dark variation class, optional - * @param {boolean} alt - Add the alt variation class, optional - * @param {node} children - The inside of this section - * @param {string} className - An additional class, optional - * @param {object} attributeOptions - Any other attribute options - */ -const AUheader = ({ hero, dark, alt, children, className = '', ...attributeOptions }) => ( -
- { children } -
-); - -AUheader.propTypes = { - hero: PropTypes.bool, - dark: PropTypes.bool, - alt: PropTypes.bool, - children: PropTypes.node, - className: PropTypes.string, -}; - -export default AUheader; diff --git a/packages/headings/src/react/react.js b/packages/headings/src/react/headings.js similarity index 100% rename from packages/headings/src/react/react.js rename to packages/headings/src/react/headings.js diff --git a/packages/inpage-nav/src/react/react.js b/packages/inpage-nav/src/react/inpage-nav.js similarity index 52% rename from packages/inpage-nav/src/react/react.js rename to packages/inpage-nav/src/react/inpage-nav.js index c01ae4ce7..7a91439e8 100644 --- a/packages/inpage-nav/src/react/react.js +++ b/packages/inpage-nav/src/react/inpage-nav.js @@ -17,66 +17,6 @@ import PropTypes from 'prop-types'; // [replace-imports] -/** - * The section component for the AUinpageNavLinks component - * - * @param {object} link - The link of this section - * @param {object} title - The title of the section - * @param {object} li - An additional object to be spread into the wrapping element, optional - * @param {object} attributeOptions - Any other attribute options - */ -export const AUinpageNavLinksItem = ({ link, title, li = {}, ...attributeOptions }) => ( -
  • - { title } -
  • -); - -AUinpageNavLinksItem.propTypes = { - link: PropTypes.string.isRequired, - title: PropTypes.string.isRequired, - li: PropTypes.object, -}; - - -/** - * The inpage-nav component - * - * @param {boolean} dark - Add the dark variation class, optional - * @param {string} title - The title of the content link block, default: Contents - * @param {array} sections - An array of objects of all sections, sample: { link: '', title: '', onClick: () } - * @param {string} className - An additional class, optional - * @param {string} ariaLabel - The aria-label attribute, optional - * @param {object} attributeOptions - Any other attribute options - */ -export const AUinpageNavLinks = ({ dark, title, sections, ariaLabel, className = '', ...attributeOptions }) => ( - -); - -AUinpageNavLinks.propTypes = { - dark: PropTypes.bool, - title: PropTypes.string.isRequired, - sections: PropTypes.arrayOf( - PropTypes.shape({ - link: PropTypes.string.isRequired, - title: PropTypes.string.isRequired, - li: PropTypes.object, - }) - ).isRequired, - className: PropTypes.string, -}; - -AUinpageNavLinks.defaultProps = { - title: 'Contents', - ariaLabel: 'in page navigation', -}; - - /** * The inpage-nav component * diff --git a/packages/inpage-nav/src/react/inpage-navLinks.js b/packages/inpage-nav/src/react/inpage-navLinks.js new file mode 100644 index 000000000..6b1dc54ed --- /dev/null +++ b/packages/inpage-nav/src/react/inpage-navLinks.js @@ -0,0 +1,50 @@ +/*************************************************************************************************************************************************************** + * + * inpage-nav links function + * + * Use inpage-nav links to help users scan and jump to content of a page. + * +**************************************************************************************************************************************************************/ + + +import React from 'react'; +import PropTypes from 'prop-types'; + + +/** + * The inpage-nav component + * + * @param {boolean} dark - Add the dark variation class, optional + * @param {string} title - The title of the content link block, default: Contents + * @param {array} sections - An array of objects of all sections, sample: { link: '', title: '', onClick: () } + * @param {string} className - An additional class, optional + * @param {string} ariaLabel - The aria-label attribute, optional + * @param {object} attributeOptions - Any other attribute options + */ +export const AUinpageNavLinks = ({ dark, title, sections, ariaLabel, className = '', ...attributeOptions }) => ( + +); + +AUinpageNavLinks.propTypes = { + dark: PropTypes.bool, + title: PropTypes.string.isRequired, + sections: PropTypes.arrayOf( + PropTypes.shape({ + link: PropTypes.string.isRequired, + title: PropTypes.string.isRequired, + li: PropTypes.object, + }) + ).isRequired, + className: PropTypes.string, +}; + +AUinpageNavLinks.defaultProps = { + title: 'Contents', + ariaLabel: 'in page navigation', +}; diff --git a/packages/inpage-nav/src/react/inpage-navLinksItem.js b/packages/inpage-nav/src/react/inpage-navLinksItem.js new file mode 100644 index 000000000..faff4e416 --- /dev/null +++ b/packages/inpage-nav/src/react/inpage-navLinksItem.js @@ -0,0 +1,32 @@ +/*************************************************************************************************************************************************************** + * + * inpage-nav links item function + * + * Use inpage-nav links to help users scan and jump to content of a page. + * +**************************************************************************************************************************************************************/ + + +import React from 'react'; +import PropTypes from 'prop-types'; + + +/** + * The section component for the AUinpageNavLinks component + * + * @param {object} link - The link of this section + * @param {object} title - The title of the section + * @param {object} li - An additional object to be spread into the wrapping element, optional + * @param {object} attributeOptions - Any other attribute options + */ +export const AUinpageNavLinksItem = ({ link, title, li = {}, ...attributeOptions }) => ( +
  • + { title } +
  • +); + +AUinpageNavLinksItem.propTypes = { + link: PropTypes.string.isRequired, + title: PropTypes.string.isRequired, + li: PropTypes.object, +}; diff --git a/packages/keyword-list/src/react/keyword-list.js b/packages/keyword-list/src/react/keyword-list.js new file mode 100644 index 000000000..a611cf4b7 --- /dev/null +++ b/packages/keyword-list/src/react/keyword-list.js @@ -0,0 +1,61 @@ +/*! [replace-name] v[replace-version] */ +/*************************************************************************************************************************************************************** + * + * keyword-list function + * + * Headers provide a consistent start to pages. + * +**************************************************************************************************************************************************************/ + +import React from 'react'; +import PropTypes from 'prop-types'; + + +// The following line will be replaced automatically with generic imports for the ES5 pipeline. +// You can safely ignore this bit if you use this module with pancake +// +// [replace-imports] + + +/** + * DEFAULT + * The keyword-list component + * + * @param {string} repeatedName - The repeated bit in each item + * @param {array} items - All items in this list, format: { link: '', name: '', onClick: () } + * @param {boolean} dark - Add the dark variation class, optional + * @param {string} className - An additional class, optional + * @param {string} linkComponent - The component used for the link + * @param {object} attributeOptions - Any other attribute options + */ +const AUkeywordList = ({ repeatedName, linkComponent, items, dark, className = '', ...attributeOptions }) => ( +
      + { + items.map( + ( item, i ) => + ) + } +
    +); + +AUkeywordList.propTypes = { + repeatedName: PropTypes.string.isRequired, + dark: PropTypes.bool, + items: PropTypes.arrayOf( + PropTypes.shape({ + link: PropTypes.string, + name: PropTypes.string.isRequired, + li: PropTypes.object, + }) + ).isRequired, + className: PropTypes.string, + linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), +}; + + +AUkeywordList.defaultProps = { + linkComponent: 'a', +}; + + +export default AUkeywordList; diff --git a/packages/keyword-list/src/react/react.js b/packages/keyword-list/src/react/keyword-listItem.js similarity index 54% rename from packages/keyword-list/src/react/react.js rename to packages/keyword-list/src/react/keyword-listItem.js index cc7c791b5..07b10fb69 100644 --- a/packages/keyword-list/src/react/react.js +++ b/packages/keyword-list/src/react/keyword-listItem.js @@ -1,21 +1,16 @@ -/*! [replace-name] v[replace-version] */ /*************************************************************************************************************************************************************** * - * keyword-list function + * keyword-list item function * * Headers provide a consistent start to pages. * - **************************************************************************************************************************************************************/ +**************************************************************************************************************************************************************/ + import React from 'react'; import PropTypes from 'prop-types'; -// The following line will be replaced automatically with generic imports for the ES5 pipeline. -// You can safely ignore this bit if you use this module with pancake -// -// [replace-imports] - /** * An item inside the AUkeywordList component * @@ -72,47 +67,3 @@ AUkeywordListItem.propTypes = { AUkeywordListItem.defaultProps = { linkComponent: 'a', }; - - -/** - * DEFAULT - * The keyword-list component - * - * @param {string} repeatedName - The repeated bit in each item - * @param {array} items - All items in this list, format: { link: '', name: '', onClick: () } - * @param {boolean} dark - Add the dark variation class, optional - * @param {string} className - An additional class, optional - * @param {string} linkComponent - The component used for the link - * @param {object} attributeOptions - Any other attribute options - */ -const AUkeywordList = ({ repeatedName, linkComponent, items, dark, className = '', ...attributeOptions }) => ( -
      - { - items.map( - ( item, i ) => - ) - } -
    -); - -AUkeywordList.propTypes = { - repeatedName: PropTypes.string.isRequired, - dark: PropTypes.bool, - items: PropTypes.arrayOf( - PropTypes.shape({ - link: PropTypes.string, - name: PropTypes.string.isRequired, - li: PropTypes.object, - }) - ).isRequired, - className: PropTypes.string, - linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), -}; - - -AUkeywordList.defaultProps = { - linkComponent: 'a', -}; - - -export default AUkeywordList; diff --git a/packages/link-list/src/react/link-list.js b/packages/link-list/src/react/link-list.js new file mode 100644 index 000000000..81339b984 --- /dev/null +++ b/packages/link-list/src/react/link-list.js @@ -0,0 +1,56 @@ +/*! [replace-name] v[replace-version] */ +/*************************************************************************************************************************************************************** + * + * link-lists function + * + * A simple list of inline links. + * + **************************************************************************************************************************************************************/ + +import React from 'react'; +import PropTypes from 'prop-types'; + + +// The following line will be replaced automatically with generic imports for the ES5 pipeline. +// You can safely ignore this bit if you use this module with pancake +// +// [replace-imports] + + +/** + * DEFAULT + * The Link List component + * + * @param {array} items - All items inside the link list to be passed to AUlinkListItem, format: { link: '', text: '', onClick: () } + * @param {string} className - An additional class, optional + * @param {string} linkComponent - The component used for the link + * @param {object} attributeOptions - Any other attribute options, optional + */ +const AUlinkList = ({ inline, items, linkComponent, className = '', ...attributeOptions }) => ( +
      + { + items.map( + ( item, i ) => + ) + } +
    +); + +AUlinkList.propTypes = { + inline: PropTypes.bool, + items: PropTypes.arrayOf( + PropTypes.shape({ + link: PropTypes.string, + text: PropTypes.node.isRequired, + li: PropTypes.object, + }) + ).isRequired, + linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]) +}; + +AUlinkList.defaultProps = { + linkComponent: "a", +}; + + +export default AUlinkList; diff --git a/packages/link-list/src/react/react.js b/packages/link-list/src/react/link-listItem.js similarity index 60% rename from packages/link-list/src/react/react.js rename to packages/link-list/src/react/link-listItem.js index 571b88bf8..c378f4c8a 100644 --- a/packages/link-list/src/react/react.js +++ b/packages/link-list/src/react/link-listItem.js @@ -1,21 +1,16 @@ -/*! [replace-name] v[replace-version] */ /*************************************************************************************************************************************************************** * - * link-lists function + * link-lists item function * * A simple list of inline links. * **************************************************************************************************************************************************************/ + import React from 'react'; import PropTypes from 'prop-types'; -// The following line will be replaced automatically with generic imports for the ES5 pipeline. -// You can safely ignore this bit if you use this module with pancake -// -// [replace-imports] - /** * An item inside the AUlinkList component * @@ -71,42 +66,3 @@ AUlinkListItem.propTypes = { AUlinkListItem.defaultProps = { linkComponent: "a", }; - - -/** - * DEFAULT - * The Link List component - * - * @param {array} items - All items inside the link list to be passed to AUlinkListItem, format: { link: '', text: '', onClick: () } - * @param {string} className - An additional class, optional - * @param {string} linkComponent - The component used for the link - * @param {object} attributeOptions - Any other attribute options, optional - */ -const AUlinkList = ({ inline, items, linkComponent, className = '', ...attributeOptions }) => ( -
      - { - items.map( - ( item, i ) => - ) - } -
    -); - -AUlinkList.propTypes = { - inline: PropTypes.bool, - items: PropTypes.arrayOf( - PropTypes.shape({ - link: PropTypes.string, - text: PropTypes.node.isRequired, - li: PropTypes.object, - }) - ).isRequired, - linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]) -}; - -AUlinkList.defaultProps = { - linkComponent: "a", -}; - - -export default AUlinkList; diff --git a/packages/main-nav/src/react/main-nav.js b/packages/main-nav/src/react/main-nav.js new file mode 100644 index 000000000..1deccbb70 --- /dev/null +++ b/packages/main-nav/src/react/main-nav.js @@ -0,0 +1,46 @@ +/*! [replace-name] v[replace-version] */ +/*************************************************************************************************************************************************************** + * + * mainNav function + * + * Horizontal list of links to key areas on the website. Usually located in the header. + * + **************************************************************************************************************************************************************/ + +import React from 'react'; +import PropTypes from 'prop-types'; + + +// The following line will be replaced automatically with generic imports for the ES5 pipeline. +// You can safely ignore this bit if you use this module with pancake +// +// [replace-imports] + + +const AUmainNav = ({ dark, alt, className, ariaLabel, children, ...attributeOptions }) => ( + +); + +AUmainNav.propTypes = { + dark: PropTypes.bool, + alt: PropTypes.bool, + ariaLabel: PropTypes.string, + children: PropTypes.node.isRequired, +}; + +AUmainNav.defaultProps = { + ariaLabel: 'main', +}; + +export default AUmainNav; diff --git a/packages/main-nav/src/react/react.js b/packages/main-nav/src/react/main-navContent.js similarity index 83% rename from packages/main-nav/src/react/react.js rename to packages/main-nav/src/react/main-navContent.js index 685a5e1eb..dce39f4ba 100644 --- a/packages/main-nav/src/react/react.js +++ b/packages/main-nav/src/react/main-navContent.js @@ -1,80 +1,17 @@ -/*! [replace-name] v[replace-version] */ /*************************************************************************************************************************************************************** * - * mainNav function + * mainNav content function * * Horizontal list of links to key areas on the website. Usually located in the header. * **************************************************************************************************************************************************************/ + import React from 'react'; import PropTypes from 'prop-types'; -import AU from '@gov.au/animate'; // interdependency with our animate lib - - -// ES5 dependency: import AUlinkList from '@gov.au/link-list'; -// ES6 dependency: import AUlinkList from './link-list'; - - -// The following line will be replaced automatically with generic imports for the ES5 pipeline. -// You can safely ignore this bit if you use this module with pancake -// -// [replace-imports] - - -/** - * A menu inside the AUmainNav - * - * @param {array} items - The links in an array containing text, location and active status - * @param {string} linkComponent - The component used for the link - */ -const AUmainNavMenu = ({ items, linkComponent }) => { - // Generate the menu - const GenerateMenu = ( items ) => { - const menu = items.map( item => { - const link = item.active ? { - link: item.link, - text: item.text, - 'aria-current': 'page', - li: { - className: 'active', - }, - } : - { - link: item.link, - text: item.text, - }; - - // return the link, maybe with children - return link; - }); - - return menu; - } - - // Create the menu with children - return ( - - ); -} - - -AUmainNavMenu.propTypes = { - items: PropTypes.arrayOf( - PropTypes.shape({ - link: PropTypes.string, - text: PropTypes.node.isRequired, - children: PropTypes.array, - }) - ).isRequired, - linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), -}; - -AUmainNavMenu.defaultProps = { - linkComponent: 'a', -}; - +// ES5 dependency: import AU from '@gov.au/animate'; +// ES6 dependency: import AU from './animate'; // This value gets increased for each navigation component let IDvalue = 0; @@ -454,32 +391,3 @@ AUmainNavContent.propTypes = { afterClose: PropTypes.func, className: PropTypes.string, }; - - -const AUmainNav = ({ dark, alt, className, ariaLabel, children, ...attributeOptions }) => ( - -); - -AUmainNav.propTypes = { - dark: PropTypes.bool, - alt: PropTypes.bool, - ariaLabel: PropTypes.string, - children: PropTypes.node.isRequired, -}; - -AUmainNav.defaultProps = { - ariaLabel: 'main', -}; - -export default AUmainNav; diff --git a/packages/main-nav/src/react/main-navMenu.js b/packages/main-nav/src/react/main-navMenu.js new file mode 100644 index 000000000..92c346a90 --- /dev/null +++ b/packages/main-nav/src/react/main-navMenu.js @@ -0,0 +1,67 @@ +/*************************************************************************************************************************************************************** + * + * mainNav menu function + * + * Horizontal list of links to key areas on the website. Usually located in the header. + * + **************************************************************************************************************************************************************/ + + +import React from 'react'; +import PropTypes from 'prop-types'; + +// ES5 dependency: import AUaccordion from '@gov.au/link-list'; +// ES6 dependency: import AUlinkList from './link-list'; + + +/** + * A menu inside the AUmainNav + * + * @param {array} items - The links in an array containing text, location and active status + * @param {string} linkComponent - The component used for the link + */ +const AUmainNavMenu = ({ items, linkComponent }) => { + // Generate the menu + const GenerateMenu = ( items ) => { + const menu = items.map( item => { + const link = item.active ? { + link: item.link, + text: item.text, + 'aria-current': 'page', + li: { + className: 'active', + }, + } : + { + link: item.link, + text: item.text, + }; + + // return the link, maybe with children + return link; + }); + + return menu; + } + + // Create the menu with children + return ( + + ); +} + + +AUmainNavMenu.propTypes = { + items: PropTypes.arrayOf( + PropTypes.shape({ + link: PropTypes.string, + text: PropTypes.node.isRequired, + children: PropTypes.array, + }) + ).isRequired, + linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), +}; + +AUmainNavMenu.defaultProps = { + linkComponent: 'a', +}; diff --git a/packages/page-alerts/src/react/react.js b/packages/page-alerts/src/react/page-alerts.js similarity index 100% rename from packages/page-alerts/src/react/react.js rename to packages/page-alerts/src/react/page-alerts.js diff --git a/packages/progress-indicator/src/react/progress-indicator.js b/packages/progress-indicator/src/react/progress-indicator.js new file mode 100644 index 000000000..b13224c5e --- /dev/null +++ b/packages/progress-indicator/src/react/progress-indicator.js @@ -0,0 +1,58 @@ +/*! [replace-name] v[replace-version] */ +/*************************************************************************************************************************************************************** + * + * progress-indicator function + * + * Indicator of progress through a multitude of pages mostly used for forms. + * + **************************************************************************************************************************************************************/ + +import React from 'react'; +import PropTypes from 'prop-types'; + + +// The following line will be replaced automatically with generic imports for the ES5 pipeline. +// You can safely ignore this bit if you use this module with pancake +// +// [replace-imports] + + +/** + * DEFAULT + * The progress-indicator component + * + * @param {boolean} dark - Add the dark variation class, optional + * @param {array} items - All items for this progress indicator + * @param {string} className - An additional class, optional + * @param {string} linkComponent - The component used for the link + * @param {object} attributeOptions - Any other attribute options + */ +const AUprogressIndicator = ({ dark, linkComponent, items, className = '', ...attributeOptions }) => ( +
      + { + items.map( + ( item, i ) => + ) + } +
    +); + +AUprogressIndicator.propTypes = { + dark: PropTypes.bool, + items: PropTypes.arrayOf( + PropTypes.shape({ + link: PropTypes.string, + text: PropTypes.string.isRequired, + status: PropTypes.PropTypes.oneOf([ 'doing', 'todo', 'done' ]).isRequired, + statusText: PropTypes.string, + li: PropTypes.object, + }) + ).isRequired, + linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), +}; + +AUprogressIndicator.defaultProps = { + linkComponent: 'a', +}; + +export default AUprogressIndicator; diff --git a/packages/progress-indicator/src/react/react.js b/packages/progress-indicator/src/react/progress-indicatorItem.js similarity index 64% rename from packages/progress-indicator/src/react/react.js rename to packages/progress-indicator/src/react/progress-indicatorItem.js index 7af9bea16..d9f6d2742 100644 --- a/packages/progress-indicator/src/react/react.js +++ b/packages/progress-indicator/src/react/progress-indicatorItem.js @@ -1,21 +1,16 @@ -/*! [replace-name] v[replace-version] */ /*************************************************************************************************************************************************************** * - * progress-indicator function + * progress-indicator item function * * Indicator of progress through a multitude of pages mostly used for forms. * **************************************************************************************************************************************************************/ + import React from 'react'; import PropTypes from 'prop-types'; -// The following line will be replaced automatically with generic imports for the ES5 pipeline. -// You can safely ignore this bit if you use this module with pancake -// -// [replace-imports] - /** * All status options, can be overwritten * @@ -86,44 +81,3 @@ AUprogressIndicatorItem.propTypes = { AUprogressIndicatorItem.defaultProps = { linkComponent: 'a', }; - - -/** - * DEFAULT - * The progress-indicator component - * - * @param {boolean} dark - Add the dark variation class, optional - * @param {array} items - All items for this progress indicator - * @param {string} className - An additional class, optional - * @param {string} linkComponent - The component used for the link - * @param {object} attributeOptions - Any other attribute options - */ -const AUprogressIndicator = ({ dark, linkComponent, items, className = '', ...attributeOptions }) => ( -
      - { - items.map( - ( item, i ) => - ) - } -
    -); - -AUprogressIndicator.propTypes = { - dark: PropTypes.bool, - items: PropTypes.arrayOf( - PropTypes.shape({ - link: PropTypes.string, - text: PropTypes.string.isRequired, - status: PropTypes.PropTypes.oneOf([ 'doing', 'todo', 'done' ]).isRequired, - statusText: PropTypes.string, - li: PropTypes.object, - }) - ).isRequired, - linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), -}; - -AUprogressIndicator.defaultProps = { - linkComponent: 'a', -}; - -export default AUprogressIndicator; diff --git a/packages/select/src/react/react.js b/packages/select/src/react/select.js similarity index 79% rename from packages/select/src/react/react.js rename to packages/select/src/react/select.js index f31261cde..6f4b4968b 100644 --- a/packages/select/src/react/react.js +++ b/packages/select/src/react/select.js @@ -17,24 +17,6 @@ import PropTypes from 'prop-types'; // [replace-imports] -/** - * An item inside the Select component - * - * @param {string} text - The text of this option - * @param {string} value - The value of this option - * @param {object} attributeOptions - Any other attribute options - */ -export const AUselectItem = ({ text, value, ...attributeOptions }) => ( - -); - -AUselectItem.propTypes = { - text: PropTypes.string.isRequired, - value: PropTypes.string.isRequired, - className: PropTypes.string, -}; - - /** * DEFAULT * The select component diff --git a/packages/select/src/react/selectItem.js b/packages/select/src/react/selectItem.js new file mode 100644 index 000000000..f3200a70d --- /dev/null +++ b/packages/select/src/react/selectItem.js @@ -0,0 +1,29 @@ +/*************************************************************************************************************************************************************** + * + * select item function + * + * The form select element for multiple options + * + **************************************************************************************************************************************************************/ + + +import React from 'react'; +import PropTypes from 'prop-types'; + + +/** + * An item inside the Select component + * + * @param {string} text - The text of this option + * @param {string} value - The value of this option + * @param {object} attributeOptions - Any other attribute options + */ +export const AUselectItem = ({ text, value, ...attributeOptions }) => ( + +); + +AUselectItem.propTypes = { + text: PropTypes.string.isRequired, + value: PropTypes.string.isRequired, + className: PropTypes.string, +}; diff --git a/packages/side-nav/src/react/react.js b/packages/side-nav/src/react/side-nav.js similarity index 76% rename from packages/side-nav/src/react/react.js rename to packages/side-nav/src/react/side-nav.js index 11f1bd96b..6ae52b0c4 100644 --- a/packages/side-nav/src/react/react.js +++ b/packages/side-nav/src/react/side-nav.js @@ -10,8 +10,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -// ES5 dependency: import AUlinkList from '@gov.au/link-list'; -// ES6 dependency: import AUlinkList from './link-list'; // ES5 dependency: import AUaccordion from '@gov.au/accordion'; // ES6 dependency: import AUaccordion from './accordion'; @@ -22,43 +20,6 @@ import PropTypes from 'prop-types'; // [replace-imports] -/** - * A menu inside the AUsideNav - * - * @param {array} items - The links in an array containing text, location and active status - * @param {string} linkComponent - The component used for the link - */ -const AUsideNavMenu = ({ items, linkComponent }) => { - // Recursively re generate the menu with children as necessary - const GenerateMenu = ( items ) => { - const menu = items.map( item => { - const link = { - link: item.active ? '' : item.link, - text: item.active ? { item.text } : item.text, - li: { - className: item.active ? 'active' : '', - }, - }; - - // If it has children create a menu again - if( item.children ){ - link.children = - } - - // return the link, maybe with children - return link; - }); - - return menu; - } - - // Create the menu with children - return ( - - ); -} - - /** * DEFAULT * The side navigation component diff --git a/packages/side-nav/src/react/side-navMenu.js b/packages/side-nav/src/react/side-navMenu.js new file mode 100644 index 000000000..e18783011 --- /dev/null +++ b/packages/side-nav/src/react/side-navMenu.js @@ -0,0 +1,50 @@ +/*************************************************************************************************************************************************************** + * + * sideNav menu function + * + * A vertical list of links for site navigation typically placed next to the body content. + * + **************************************************************************************************************************************************************/ + + +import React from 'react'; +import PropTypes from 'prop-types'; + +// ES5 dependency: import AUlinkList from '@gov.au/link-list'; +// ES6 dependency: import AUlinkList from './link-list'; + +/** + * A menu inside the AUsideNav + * + * @param {array} items - The links in an array containing text, location and active status + * @param {string} linkComponent - The component used for the link + */ +const AUsideNavMenu = ({ items, linkComponent }) => { + // Recursively re generate the menu with children as necessary + const GenerateMenu = ( items ) => { + const menu = items.map( item => { + const link = { + link: item.active ? '' : item.link, + text: item.active ? { item.text } : item.text, + li: { + className: item.active ? 'active' : '', + }, + }; + + // If it has children create a menu again + if( item.children ){ + link.children = + } + + // return the link, maybe with children + return link; + }); + + return menu; + } + + // Create the menu with children + return ( + + ); +} \ No newline at end of file From d269430425a9c106977e338541595f231f800dc6 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Tue, 9 Apr 2019 16:38:05 +1000 Subject: [PATCH 09/22] Modified helper.js --- scripts/helper.js | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/scripts/helper.js b/scripts/helper.js index 7283aa57c..d748caae9 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -338,7 +338,7 @@ HELPER.precompile = (() => { js: () => { const _hasJS = Fs.existsSync( `${ process.cwd() }/src/js/module.js` ); const _hasJquery = Fs.existsSync( `${ process.cwd() }/src/jquery/jquery.js` ); - const _hasReact = Fs.existsSync( `${ process.cwd() }/src/react/react.js` ); + const _hasReact = Fs.existsSync( `${ process.cwd() }/src/react/${ HELPER.SHORTNAME }.js` ); // 2. copy files if( _hasJS ) { @@ -354,10 +354,26 @@ HELPER.precompile = (() => { } if( _hasReact ) { - CreateDir(`./lib/react/`); - - CopyFile(`./src/react/react.js`, `./lib/react/react.js`); - CopyFile(`./src/react/react.js`, `./tests/react/${ HELPER.SHORTNAME }.js`); + CreateDir( `./lib/react/` ); + + CopyFile( `./src/react/${ HELPER.SHORTNAME }.js`, `./lib/react/react.js` ); + + // Inject seperate react files into main component file + let reactFiles = Fs.readdirSync( `${ process.cwd() }/src/react/`, `utf-8` ) + // Remove the main component file from our list + .filter( item => item !== `${ HELPER.SHORTNAME }.js` ); + + reactFiles.forEach( item => { + let reactFile = `${ process.cwd() }/src/react/${ item }`; + let reactFileData = Fs.readFileSync( reactFile, `utf-8` ); + + reactFileData = reactFileData.replace( /^import React from (\'|\")react(\'|\");/gm, ''); + reactFileData = reactFileData.replace( /^import PropTypes from (\'|\")prop-types(\'|\");/gm, ''); + + Fs.appendFileSync( `${ process.cwd() }/lib/react/react.js`, reactFileData ); + }) + + CopyFile( `./lib/react/react.js`, `./tests/react/${ HELPER.SHORTNAME }.js` ); } // 3.replace strings inside new files in lib @@ -376,7 +392,6 @@ HELPER.precompile = (() => { } if( _hasReact ) { - ReplaceFileContent( searches, `./lib/react/react.js` ); ReplaceFileContent( searches, `./tests/react/${ HELPER.SHORTNAME }.js` ); } }, @@ -411,7 +426,6 @@ HELPER.precompile = (() => { if( Fs.existsSync(`${ process.cwd() }/lib/react/react.js`) ) { const reactOptions = { ast: false, - compact: true, minified: true, presets: [ `@babel/preset-env`, @@ -428,7 +442,7 @@ HELPER.precompile = (() => { }; // 1. Copy files - CopyFile('./src/react/react.js', './lib/react/react.es5.js'); + CopyFile('./lib/react/react.js', './lib/react/react.es5.js'); // 2. Replace the comment with an import statement ReplaceFileContent( searches, `${ process.cwd() }/lib/react/react.es5.js` ); @@ -585,7 +599,7 @@ HELPER.compile = (() => { getAllJs( '/lib/js/module.js', '/tests/jquery/script.js' ); // get all react scripts - getAllReact( '/lib/react/react.js', '/tests/react/' ); + getAllReact( '/src/react/react.js', '/tests/react/' ); }, img: () => { From 4d00dc61a1585795706838bcb3b526fb6cf8cab1 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 10 Apr 2019 10:22:13 +1000 Subject: [PATCH 10/22] Trailing removing webpack build from main build step, moving to watch --- packages/form/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/form/package.json b/packages/form/package.json index 619a2c02d..78ab86e1d 100644 --- a/packages/form/package.json +++ b/packages/form/package.json @@ -23,10 +23,10 @@ "build:pre": "node ../../scripts/helper.js precompile publish", "build:js": "npm run build:pre && node ../../scripts/helper.js compile", "build:react": "cd tests/react/ && webpack", - "build": "npm run build:js && npm run build:react", + "build": "npm run build:js", "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build && npm run build:react", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, From b8da03a60985a3b973733d937396066dc260838c Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 10 Apr 2019 10:38:21 +1000 Subject: [PATCH 11/22] Updated scripts/helper to get reactDeps from lib --- scripts/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/helper.js b/scripts/helper.js index d748caae9..198f29e9a 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -599,7 +599,7 @@ HELPER.compile = (() => { getAllJs( '/lib/js/module.js', '/tests/jquery/script.js' ); // get all react scripts - getAllReact( '/src/react/react.js', '/tests/react/' ); + getAllReact( `/lib/react/react.js`, '/tests/react/' ); }, img: () => { From c6e70e460aca38d284dfe9db9ed8f422431aa0de Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 10 Apr 2019 10:42:40 +1000 Subject: [PATCH 12/22] Corrected filenames for react components --- packages/skip-link/src/react/{react.js => skip-link.js} | 0 packages/tags/src/react/{react.js => tags.js} | 0 packages/text-inputs/src/react/{react.js => text-inputs.js} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename packages/skip-link/src/react/{react.js => skip-link.js} (100%) rename packages/tags/src/react/{react.js => tags.js} (100%) rename packages/text-inputs/src/react/{react.js => text-inputs.js} (100%) diff --git a/packages/skip-link/src/react/react.js b/packages/skip-link/src/react/skip-link.js similarity index 100% rename from packages/skip-link/src/react/react.js rename to packages/skip-link/src/react/skip-link.js diff --git a/packages/tags/src/react/react.js b/packages/tags/src/react/tags.js similarity index 100% rename from packages/tags/src/react/react.js rename to packages/tags/src/react/tags.js diff --git a/packages/text-inputs/src/react/react.js b/packages/text-inputs/src/react/text-inputs.js similarity index 100% rename from packages/text-inputs/src/react/react.js rename to packages/text-inputs/src/react/text-inputs.js From c2b46da0db0321c2379ae670f38acd5ac5021223 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 10 Apr 2019 10:50:27 +1000 Subject: [PATCH 13/22] trailing webpack before libs are built :( --- packages/form/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/form/package.json b/packages/form/package.json index 78ab86e1d..4d92f1377 100644 --- a/packages/form/package.json +++ b/packages/form/package.json @@ -26,7 +26,7 @@ "build": "npm run build:js", "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build && npm run build:react", + "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build:react", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, From 7326f69ec22025c04014d80143850202cfcd5a00 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 10 Apr 2019 11:02:44 +1000 Subject: [PATCH 14/22] Added custom case for 'animate' when required in react --- scripts/helper.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/helper.js b/scripts/helper.js index 198f29e9a..c2f77f790 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -544,13 +544,18 @@ HELPER.compile = (() => { let code = ''; dependencies.forEach( dependency => { - if( Fs.existsSync( Path.normalize(`${ process.cwd() }/../${ dependency }${ from }`) ) ) { - const fileLocation = Path.normalize(`${ to }/${ dependency }.js`); + const fileLocation = Path.normalize(`${ to }/${ dependency }.js`); + if( Fs.existsSync( Path.normalize(`${ process.cwd() }/../${ dependency }${ from }`) ) ) { CopyFile( Path.normalize(`${ process.cwd() }/../${ dependency }${ from }`), `.${ fileLocation }` ); HELPER.log.success(`Written file ${ Chalk.yellow( `.${ fileLocation }` ) }`); } + else if( dependency == 'animate' ) { + CopyFile( Path.normalize(`${ process.cwd() }/../${ dependency }/lib/js/module.js`), `.${ fileLocation }` ); + + HELPER.log.success(`WARNING: Writing custom JS file 'animate' ${ Chalk.yellow( `.${ fileLocation }` ) } `); + } }); } From a83da307cf3e8c4582f03659c1130d24f578f275 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 10 Apr 2019 11:53:07 +1000 Subject: [PATCH 15/22] Fixed old src/react/react.js file ref in package.json --- .templates/new-module/package.json | 2 +- packages/accordion/package.json | 2 +- packages/body/package.json | 2 +- packages/breadcrumbs/package.json | 2 +- packages/buttons/package.json | 2 +- packages/callout/package.json | 2 +- packages/control-input/package.json | 2 +- packages/core/package.json | 2 +- packages/cta-link/package.json | 2 +- packages/direction-links/package.json | 2 +- packages/footer/package.json | 2 +- packages/form/package.json | 2 +- packages/grid-12/package.json | 2 +- packages/header/package.json | 2 +- packages/headings/package.json | 2 +- packages/inpage-nav/package.json | 2 +- packages/keyword-list/package.json | 2 +- packages/link-list/package.json | 2 +- packages/main-nav/package.json | 2 +- packages/page-alerts/package.json | 2 +- packages/progress-indicator/package.json | 2 +- packages/responsive-media/package.json | 2 +- packages/select/package.json | 2 +- packages/side-nav/package.json | 2 +- packages/skip-link/package.json | 2 +- packages/tags/package.json | 2 +- packages/text-inputs/package.json | 2 +- 27 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.templates/new-module/package.json b/.templates/new-module/package.json index e453c81fe..5471a402a 100644 --- a/.templates/new-module/package.json +++ b/.templates/new-module/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/accordion/package.json b/packages/accordion/package.json index 2b2bf2a7a..b0dcaacdb 100644 --- a/packages/accordion/package.json +++ b/packages/accordion/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/body/package.json b/packages/body/package.json index 8d6a34f4a..b18156aec 100644 --- a/packages/body/package.json +++ b/packages/body/package.json @@ -33,7 +33,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/breadcrumbs/package.json b/packages/breadcrumbs/package.json index cfe9c8c28..457b8aab9 100644 --- a/packages/breadcrumbs/package.json +++ b/packages/breadcrumbs/package.json @@ -33,7 +33,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/buttons/package.json b/packages/buttons/package.json index aa70628c0..f7890ebd4 100644 --- a/packages/buttons/package.json +++ b/packages/buttons/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/callout/package.json b/packages/callout/package.json index f0e99c322..0b7cd3bdb 100644 --- a/packages/callout/package.json +++ b/packages/callout/package.json @@ -35,7 +35,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/control-input/package.json b/packages/control-input/package.json index 51dd8a39b..eb5b8d008 100644 --- a/packages/control-input/package.json +++ b/packages/control-input/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/core/package.json b/packages/core/package.json index 78f1accbd..9fece00ba 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/cta-link/package.json b/packages/cta-link/package.json index c44719199..a6b9ba908 100644 --- a/packages/cta-link/package.json +++ b/packages/cta-link/package.json @@ -34,7 +34,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/direction-links/package.json b/packages/direction-links/package.json index c8dbfb77d..56afd27d8 100644 --- a/packages/direction-links/package.json +++ b/packages/direction-links/package.json @@ -37,7 +37,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/footer/package.json b/packages/footer/package.json index 5c2067c10..8de4e2cd4 100644 --- a/packages/footer/package.json +++ b/packages/footer/package.json @@ -34,7 +34,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/form/package.json b/packages/form/package.json index 4d92f1377..aa3f4ca9a 100644 --- a/packages/form/package.json +++ b/packages/form/package.json @@ -26,7 +26,7 @@ "build": "npm run build:js", "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build:react", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build:react", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/grid-12/package.json b/packages/grid-12/package.json index 64f5b7783..e1e8d28aa 100644 --- a/packages/grid-12/package.json +++ b/packages/grid-12/package.json @@ -33,7 +33,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/header/package.json b/packages/header/package.json index 55f9a41b9..45cbb361d 100644 --- a/packages/header/package.json +++ b/packages/header/package.json @@ -33,7 +33,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/headings/package.json b/packages/headings/package.json index 9ea407fb9..a0c9027bb 100644 --- a/packages/headings/package.json +++ b/packages/headings/package.json @@ -35,7 +35,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/inpage-nav/package.json b/packages/inpage-nav/package.json index 3e6c7ef97..3852ced15 100644 --- a/packages/inpage-nav/package.json +++ b/packages/inpage-nav/package.json @@ -35,7 +35,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/keyword-list/package.json b/packages/keyword-list/package.json index e12efa941..2111f5f9f 100644 --- a/packages/keyword-list/package.json +++ b/packages/keyword-list/package.json @@ -35,7 +35,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/link-list/package.json b/packages/link-list/package.json index 9fb4da99d..09f496b63 100644 --- a/packages/link-list/package.json +++ b/packages/link-list/package.json @@ -34,7 +34,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/main-nav/package.json b/packages/main-nav/package.json index 425b62928..81b0b1ced 100644 --- a/packages/main-nav/package.json +++ b/packages/main-nav/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/page-alerts/package.json b/packages/page-alerts/package.json index 92892117c..3a55460ef 100644 --- a/packages/page-alerts/package.json +++ b/packages/page-alerts/package.json @@ -38,7 +38,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/progress-indicator/package.json b/packages/progress-indicator/package.json index e2c5904d1..e74e3f59f 100644 --- a/packages/progress-indicator/package.json +++ b/packages/progress-indicator/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/responsive-media/package.json b/packages/responsive-media/package.json index dcc9d617e..0ead8fd5e 100644 --- a/packages/responsive-media/package.json +++ b/packages/responsive-media/package.json @@ -37,7 +37,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/select/package.json b/packages/select/package.json index d6e6e2fc1..0f7e7e72c 100644 --- a/packages/select/package.json +++ b/packages/select/package.json @@ -33,7 +33,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/side-nav/package.json b/packages/side-nav/package.json index b603c454f..600155c15 100644 --- a/packages/side-nav/package.json +++ b/packages/side-nav/package.json @@ -31,7 +31,7 @@ "serve": "browser-sync tests --files 'tests/**/*.html, tests/**/*.css, tests/**/*.js'", "watch:js": "onchange 'src/js/*.js' -- npm run build:js", - "watch:jsx": "onchange 'src/react/react.js' 'tests/react/index.js' -- npm run build", + "watch:jsx": "onchange 'src/react/*.js' 'tests/react/index.js' -- npm run build", "watch:sass": "onchange 'src/sass/*.scss' 'tests/site/test.scss' -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/skip-link/package.json b/packages/skip-link/package.json index b7297bd29..32399a7cd 100644 --- a/packages/skip-link/package.json +++ b/packages/skip-link/package.json @@ -35,7 +35,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/tags/package.json b/packages/tags/package.json index 44cfe8541..b574d2f10 100644 --- a/packages/tags/package.json +++ b/packages/tags/package.json @@ -33,7 +33,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, diff --git a/packages/text-inputs/package.json b/packages/text-inputs/package.json index 500ab1a19..fadd439ed 100644 --- a/packages/text-inputs/package.json +++ b/packages/text-inputs/package.json @@ -39,7 +39,7 @@ "serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"", "watch:js": "onchange \"src/js/*.js\" -- npm run build:js", - "watch:jsx": "onchange \"src/react/react.js\" \"tests/react/index.js\" -- npm run build", + "watch:jsx": "onchange \"src/react/*.js\" \"tests/react/index.js\" -- npm run build", "watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build", "watch": "npm run build && npm-run-all --parallel serve watch:*" }, From e639088a16a31a13735d69ecea745bc1ae39bc1b Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Tue, 2 Apr 2019 15:40:24 +1100 Subject: [PATCH 16/22] Added basic react proptype jsdoc --- packages/accordion/src/react/accordion.js | 32 ++++++++- packages/breadcrumbs/src/react/breadcrumbs.js | 12 ++++ packages/buttons/src/react/buttons.js | 21 ++++++ packages/callout/src/react/callout.js | 21 ++++++ packages/callout/src/react/calloutCalendar.js | 33 +++++++++ .../control-input/src/react/control-input.js | 26 ++++++- .../src/react/control-inputRadio.js | 24 +++++++ packages/cta-link/src/react/cta-link.js | 15 ++++ .../src/react/direction-links.js | 18 +++++ packages/footer/src/react/footer.js | 12 ++++ packages/footer/src/react/footerEnd.js | 6 ++ packages/footer/src/react/footerNav.js | 9 +++ packages/header/src/react/headerBrand.js | 27 +++++++ packages/headings/src/react/headings.js | 9 +++ packages/inpage-nav/src/react/inpage-nav.js | 21 ++++++ .../inpage-nav/src/react/inpage-navLinks.js | 12 ++++ .../src/react/inpage-navLinksItem.js | 9 +++ .../keyword-list/src/react/keyword-list.js | 15 ++++ .../src/react/keyword-listItem.js | 15 ++++ packages/link-list/src/react/link-list.js | 9 +++ packages/link-list/src/react/link-listItem.js | 15 ++++ .../main-nav/src/react/main-navContent.js | 71 +++++++++++++++++++ packages/main-nav/src/react/main-navMenu.js | 6 ++ packages/page-alerts/src/react/page-alerts.js | 15 ++++ packages/select/src/react/select.js | 15 ++++ packages/select/src/react/selectItem.js | 9 +++ packages/side-nav/src/react/side-nav.js | 45 ++++++++++++ packages/skip-link/src/react/skip-link.js | 15 ++++ packages/tags/src/react/tags.js | 24 +++++++ packages/text-inputs/src/react/text-inputs.js | 18 +++++ 30 files changed, 577 insertions(+), 2 deletions(-) diff --git a/packages/accordion/src/react/accordion.js b/packages/accordion/src/react/accordion.js index e002c7633..ffd31f9f2 100644 --- a/packages/accordion/src/react/accordion.js +++ b/packages/accordion/src/react/accordion.js @@ -350,7 +350,7 @@ class AUaccordion extends React.PureComponent { /** * Toggle an accordion on click * - * @param {event object} event - The event object of the click + * @param {object} event - The event object of the click */ toggle( event ) { event.preventDefault(); @@ -391,15 +391,45 @@ class AUaccordion extends React.PureComponent { }; AUaccordion.propTypes = { + /** + * The elements inside. + */ children: PropTypes.node.isRequired, + /** + * The headline of the accordion + */ header: PropTypes.string.isRequired, + /** + * Closed state, optional + */ closed: PropTypes.bool, + /** + * Speed of the animation in ms, optional + */ speed: PropTypes.number, + /** + * A dark variation of the component + */ dark: PropTypes.bool, + /** + * A function executed when the accordion opens, optional + */ onOpen: PropTypes.func, + /** + * A function executed after the accordion opened, optional + */ afterOpen: PropTypes.func, + /** + * A function executed when the accordion closes, optional + */ onClose: PropTypes.func, + /** + * A function executed when the accordion closes, optional + */ afterClose: PropTypes.func, + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; diff --git a/packages/breadcrumbs/src/react/breadcrumbs.js b/packages/breadcrumbs/src/react/breadcrumbs.js index 9bf5e9ef6..61ffddaf5 100644 --- a/packages/breadcrumbs/src/react/breadcrumbs.js +++ b/packages/breadcrumbs/src/react/breadcrumbs.js @@ -42,14 +42,26 @@ const AUbreadcrumbs = ({ dark, label, items, linkComponent, className = '', ...a ); AUbreadcrumbs.propTypes = { + /** + * A dark variation of the component. + */ dark: PropTypes.bool, + /** + * Provide the aria label + */ label: PropTypes.string.isRequired, + /** + * The link, text and props for each of the breadcrumbs + */ items: PropTypes.arrayOf( PropTypes.shape({ link: PropTypes.string, text: PropTypes.string.isRequired, }) ).isRequired, + /** + * The component used for the link, optional. + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]) }; diff --git a/packages/buttons/src/react/buttons.js b/packages/buttons/src/react/buttons.js index 7bb8c932e..effc33fb5 100644 --- a/packages/buttons/src/react/buttons.js +++ b/packages/buttons/src/react/buttons.js @@ -79,13 +79,34 @@ const AUbutton = ({ linkComponent, link, children, as, dark, type, block, classN }; AUbutton.propTypes = { + /** + * If an link is set the button will render as a link. + */ link: PropTypes.string, + /** + * Anything inside. + */ children: PropTypes.node.isRequired, + /** + * The kind of button, secondary or tertiary. + */ as: PropTypes.oneOf([ 'primary', 'secondary', 'tertiary' ]).isRequired, + /** + * A dark variation of the component. + */ dark: PropTypes.bool, type: PropTypes.string, + /** + * The block option to make the button fill the available width. + */ block: PropTypes.bool, + /** + * The class name for the element, optional. + */ className: PropTypes.string, + /** + * The component used for the link, optional. + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), }; diff --git a/packages/callout/src/react/callout.js b/packages/callout/src/react/callout.js index 5fec3def6..339babd12 100644 --- a/packages/callout/src/react/callout.js +++ b/packages/callout/src/react/callout.js @@ -47,12 +47,33 @@ export const AUcallout = ({ title, level, srOnlyTitle, dark, alt, description, c }; AUcallout.propTypes = { + /** + * Title of the callout. + */ title: PropTypes.string.isRequired, + /** + * The tag level (

    etc), default: '1'. + */ level: PropTypes.number, + /** + * Make title screen reader visible. + */ srOnlyTitle: PropTypes.bool, + /** + * A dark variation of the component. + */ dark: PropTypes.bool, + /** + * A alternate variation of the component. + */ alt: PropTypes.bool, + /** + * Anything inside. + */ children: PropTypes.node.isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; diff --git a/packages/callout/src/react/calloutCalendar.js b/packages/callout/src/react/calloutCalendar.js index 098b27d8f..46dfc9a43 100644 --- a/packages/callout/src/react/calloutCalendar.js +++ b/packages/callout/src/react/calloutCalendar.js @@ -46,19 +46,52 @@ export const AUcalloutCalendar = ({ title, level, srOnlyTitle, dark, alt, sublin } AUcalloutCalendar.propTypes = { + /** + * Title of the callout. + */ title: PropTypes.string.isRequired, + /** + * The tag level (

    etc), default: '1'. + */ level: PropTypes.number, + /** + * Make title screen reader visible. + */ srOnlyTitle: PropTypes.bool, + /** + * A dark variation of the component. + */ dark: PropTypes.bool, + /** + * A alternate variation of the component. + */ alt: PropTypes.bool, + /** + * The subline of the event, optional. + */ subline: PropTypes.string, + /** + * The date time string. + */ datetime: PropTypes.string.isRequired, + /** + * The same date but human readable. + */ time: PropTypes.string.isRequired, + /** + * The name of the event, optional. + */ name: PropTypes.string, + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; AUcalloutCalendar.defaultProps = { + title: 'Title of the calendar callout', + datetime: '2017-01-01T00:00:00+00:00', + time: 'Sunday 32 Jun', level: 2, srOnlyTitle: true, }; diff --git a/packages/control-input/src/react/control-input.js b/packages/control-input/src/react/control-input.js index 6543bd7ed..cb6042f88 100644 --- a/packages/control-input/src/react/control-input.js +++ b/packages/control-input/src/react/control-input.js @@ -48,12 +48,36 @@ export const AUcheckbox = ({ dark, alt, small, block, label, status, id, classNa }; AUcheckbox.propTypes = { + /** + * A dark variation of the component + */ dark: PropTypes.bool, + /** + * An alternate variation of the component + */ alt: PropTypes.bool, + /** + * The small variation of the component + */ small: PropTypes.bool, + /** + * + */ block: PropTypes.bool, + /** + * The label of the radio button + */ label: PropTypes.string.isRequired, - id: PropTypes.string.isRequired, + /** + * + */ + id: PropTypes.string.isRequired, + /** + * + */ status: PropTypes.oneOf([ 'valid', 'invalid' ]), + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; diff --git a/packages/control-input/src/react/control-inputRadio.js b/packages/control-input/src/react/control-inputRadio.js index b80912f14..fe62eaca0 100644 --- a/packages/control-input/src/react/control-inputRadio.js +++ b/packages/control-input/src/react/control-inputRadio.js @@ -42,12 +42,36 @@ export const AUradio = ({ dark, alt, small, block, label, status, id, className }; AUradio.propTypes = { + /** + * A dark variation of the component + */ dark: PropTypes.bool, + /** + * An alternate variation of the component + */ alt: PropTypes.bool, + /** + * The small variation of the component + */ small: PropTypes.bool, + /** + * + */ block: PropTypes.bool, + /** + * The label of the radio button + */ label: PropTypes.string.isRequired, + /** + * The label of the checkbox button + */ id: PropTypes.string.isRequired, + /** + * + */ status: PropTypes.oneOf([ 'valid', 'invalid' ]), + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; diff --git a/packages/cta-link/src/react/cta-link.js b/packages/cta-link/src/react/cta-link.js index e77e8d0c2..b8642c8dd 100644 --- a/packages/cta-link/src/react/cta-link.js +++ b/packages/cta-link/src/react/cta-link.js @@ -53,10 +53,25 @@ const AUctaLink = ({ linkComponent, dark, link, text, className = '', ...attribu } AUctaLink.propTypes = { + /** + * A dark variation of the component. + */ dark: PropTypes.bool, + /** + * The link to the location of the cta-link. + */ link: PropTypes.string, + /** + * Provide the aria label. + */ text: PropTypes.string.isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, + /** + * The component used for the link, optional. + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]) }; diff --git a/packages/direction-links/src/react/direction-links.js b/packages/direction-links/src/react/direction-links.js index 81b7356e8..1ce1ae465 100644 --- a/packages/direction-links/src/react/direction-links.js +++ b/packages/direction-links/src/react/direction-links.js @@ -67,11 +67,29 @@ const AUdirectionLink = ({ linkComponent, dark, link, text, direction, className }; AUdirectionLink.propTypes = { + /** + * A dark variation of the component. + */ dark: PropTypes.bool, + /** + * The href link, optional. + */ link: PropTypes.string, + /** + * The text of the link. + */ text: PropTypes.string.isRequired, + /** + * The direction the link goes. + */ direction: PropTypes.oneOf([ 'up', 'right', 'down', 'left' ]).isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, + /** + * The component used for the link, optional. + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]) }; diff --git a/packages/footer/src/react/footer.js b/packages/footer/src/react/footer.js index ad3cb0aa6..0e3f25174 100644 --- a/packages/footer/src/react/footer.js +++ b/packages/footer/src/react/footer.js @@ -38,9 +38,21 @@ const AUfooter = ({ dark, alt, children, className = '', ...attributeOptions }) ); AUfooter.propTypes = { + /** + * A dark variation of the component + */ dark: PropTypes.bool, + /** + * A alternate variation of the component + */ alt: PropTypes.bool, + /** + * The elements inside. + */ children: PropTypes.node.isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; diff --git a/packages/footer/src/react/footerEnd.js b/packages/footer/src/react/footerEnd.js index f3e0a206a..fdb7b7d4c 100644 --- a/packages/footer/src/react/footerEnd.js +++ b/packages/footer/src/react/footerEnd.js @@ -25,6 +25,12 @@ export const AUfooterEnd = ({ children, className = '', ...attributeOptions }) = ); AUfooterEnd.propTypes = { + /** + * The elements inside. + */ children: PropTypes.node.isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; diff --git a/packages/footer/src/react/footerNav.js b/packages/footer/src/react/footerNav.js index cb6b05606..ad604a6da 100644 --- a/packages/footer/src/react/footerNav.js +++ b/packages/footer/src/react/footerNav.js @@ -26,8 +26,17 @@ export const AUfooterNav = ({ children, className = '', ariaLabel, ...attributeO ); AUfooterNav.propTypes = { + /** + * The elements inside. + */ children: PropTypes.node.isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, + /** + * The aria-label attribute, defaults to "footer navigation" + */ ariaLabel: PropTypes.string, }; diff --git a/packages/header/src/react/headerBrand.js b/packages/header/src/react/headerBrand.js index b1568a0df..7b705a8d6 100644 --- a/packages/header/src/react/headerBrand.js +++ b/packages/header/src/react/headerBrand.js @@ -83,14 +83,41 @@ export const AUheaderBrand = ({ } AUheaderBrand.propTypes = { + /** + * + */ title: PropTypes.node, + /** + * + */ level: PropTypes.oneOf([ '1', '2', '3', '4', '5', '6' ]), + /** + * + */ subline: PropTypes.node, + /** + * + */ link: PropTypes.string, + /** + * + */ brandImage: PropTypes.string, + /** + * + */ brandImageAlt: PropTypes.string, + /** + * + */ children: PropTypes.node, + /** + * The class name for the element, optional. + */ className: PropTypes.string, + /** + * + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), } diff --git a/packages/headings/src/react/headings.js b/packages/headings/src/react/headings.js index 4af8d15aa..847ebf347 100644 --- a/packages/headings/src/react/headings.js +++ b/packages/headings/src/react/headings.js @@ -51,9 +51,18 @@ const AUheading = ({ level, size, children, className = '', ...attributeOptions }; AUheading.propTypes = { + /** + * The semantic headline tag level, h1-h6. + */ level: PropTypes.oneOf([ '1', '2', '3', '4', '5', '6' ]).isRequired, + /** + * The display size, 'xs', 'sm', 'md', 'lg', 'xl', 'xxl', 'xxxl'. + */ size: PropTypes.oneOf([ 'xs', 'sm', 'md', 'lg', 'xl', 'xxl', 'xxxl' ]).isRequired, children: PropTypes.node.isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; diff --git a/packages/inpage-nav/src/react/inpage-nav.js b/packages/inpage-nav/src/react/inpage-nav.js index 7a91439e8..e63427ee7 100644 --- a/packages/inpage-nav/src/react/inpage-nav.js +++ b/packages/inpage-nav/src/react/inpage-nav.js @@ -47,12 +47,33 @@ export const AUinpageNavSection = ({ title, link, children, level, headingClass, }; AUinpageNavSection.propTypes = { + /** + * + */ title: PropTypes.string.isRequired, + /** + * + */ link: PropTypes.string.isRequired, + /** + * The elements inside. + */ children: PropTypes.node.isRequired, + /** + * + */ level: PropTypes.oneOf([ '1', '2', '3', '4', '5', '6' ]).isRequired, + /** + * + */ headingClass: PropTypes.string, + /** + * + */ sectionLink: PropTypes.string, + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; diff --git a/packages/inpage-nav/src/react/inpage-navLinks.js b/packages/inpage-nav/src/react/inpage-navLinks.js index 6b1dc54ed..0915b6c78 100644 --- a/packages/inpage-nav/src/react/inpage-navLinks.js +++ b/packages/inpage-nav/src/react/inpage-navLinks.js @@ -32,8 +32,17 @@ export const AUinpageNavLinks = ({ dark, title, sections, ariaLabel, className = ); AUinpageNavLinks.propTypes = { + /** + * A dark variation of the component + */ dark: PropTypes.bool, + /** + * + */ title: PropTypes.string.isRequired, + /** + * + */ sections: PropTypes.arrayOf( PropTypes.shape({ link: PropTypes.string.isRequired, @@ -41,6 +50,9 @@ AUinpageNavLinks.propTypes = { li: PropTypes.object, }) ).isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; diff --git a/packages/inpage-nav/src/react/inpage-navLinksItem.js b/packages/inpage-nav/src/react/inpage-navLinksItem.js index faff4e416..a3c3f3cbd 100644 --- a/packages/inpage-nav/src/react/inpage-navLinksItem.js +++ b/packages/inpage-nav/src/react/inpage-navLinksItem.js @@ -26,7 +26,16 @@ export const AUinpageNavLinksItem = ({ link, title, li = {}, ...attributeOptions ); AUinpageNavLinksItem.propTypes = { + /** + * + */ link: PropTypes.string.isRequired, + /** + * The title of the link + */ title: PropTypes.string.isRequired, + /** + * + */ li: PropTypes.object, }; diff --git a/packages/keyword-list/src/react/keyword-list.js b/packages/keyword-list/src/react/keyword-list.js index a611cf4b7..1432fc302 100644 --- a/packages/keyword-list/src/react/keyword-list.js +++ b/packages/keyword-list/src/react/keyword-list.js @@ -39,8 +39,17 @@ const AUkeywordList = ({ repeatedName, linkComponent, items, dark, className = ' ); AUkeywordList.propTypes = { + /** + * + */ repeatedName: PropTypes.string.isRequired, + /** + * A dark variation of the component + */ dark: PropTypes.bool, + /** + * + */ items: PropTypes.arrayOf( PropTypes.shape({ link: PropTypes.string, @@ -48,7 +57,13 @@ AUkeywordList.propTypes = { li: PropTypes.object, }) ).isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, + /** + * + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), }; diff --git a/packages/keyword-list/src/react/keyword-listItem.js b/packages/keyword-list/src/react/keyword-listItem.js index 07b10fb69..c58c5e3bc 100644 --- a/packages/keyword-list/src/react/keyword-listItem.js +++ b/packages/keyword-list/src/react/keyword-listItem.js @@ -56,10 +56,25 @@ export const AUkeywordListItem = ({ linkComponent, repeatedName, link, name, li }; AUkeywordListItem.propTypes = { + /** + * + */ repeatedName: PropTypes.string.isRequired, + /** + * + */ link: PropTypes.string, + /** + * + */ name: PropTypes.string.isRequired, + /** + * + */ li: PropTypes.object, + /** + * + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), }; diff --git a/packages/link-list/src/react/link-list.js b/packages/link-list/src/react/link-list.js index 81339b984..7b49f1e32 100644 --- a/packages/link-list/src/react/link-list.js +++ b/packages/link-list/src/react/link-list.js @@ -37,7 +37,13 @@ const AUlinkList = ({ inline, items, linkComponent, className = '', ...attribute ); AUlinkList.propTypes = { + /** + * + */ inline: PropTypes.bool, + /** + * + */ items: PropTypes.arrayOf( PropTypes.shape({ link: PropTypes.string, @@ -45,6 +51,9 @@ AUlinkList.propTypes = { li: PropTypes.object, }) ).isRequired, + /** + * + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]) }; diff --git a/packages/link-list/src/react/link-listItem.js b/packages/link-list/src/react/link-listItem.js index c378f4c8a..abf9776fa 100644 --- a/packages/link-list/src/react/link-listItem.js +++ b/packages/link-list/src/react/link-listItem.js @@ -56,10 +56,25 @@ export const AUlinkListItem = ({ text, link, linkComponent, li = {}, children, o }; AUlinkListItem.propTypes = { + /** + * + */ text: PropTypes.node.isRequired, + /** + * + */ link: PropTypes.string, + /** + * + */ li: PropTypes.object, + /** + * + */ onClick: PropTypes.object, + /** + * + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]) }; diff --git a/packages/main-nav/src/react/main-navContent.js b/packages/main-nav/src/react/main-navContent.js index dce39f4ba..4e3e06461 100644 --- a/packages/main-nav/src/react/main-navContent.js +++ b/packages/main-nav/src/react/main-navContent.js @@ -381,13 +381,84 @@ export class AUmainNavContent extends React.PureComponent { }; AUmainNavContent.propTypes = { + /** + * A dark variation of the component + */ dark: PropTypes.bool, + /** + * An alternate variation of the component + */ alt: PropTypes.bool, + /** + * + */ children: PropTypes.node, + /** + * + */ speed: PropTypes.number, + /** + * + */ onOpen: PropTypes.func, + /** + * + */ afterOpen: PropTypes.func, + /** + * + */ onClose: PropTypes.func, + /** + * + */ afterClose: PropTypes.func, + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; +<<<<<<< HEAD:packages/main-nav/src/react/main-navContent.js +======= + + +const AUmainNav = ({ dark, alt, className, ariaLabel, children, ...attributeOptions }) => ( + +); + +AUmainNav.propTypes = { + /** + * A dark variation of the component + */ + dark: PropTypes.bool, + /** + * An alternate variation of the component + */ + alt: PropTypes.bool, + /** + * + */ + ariaLabel: PropTypes.string, + /** + * The elements inside. + */ + children: PropTypes.node.isRequired, +}; + +AUmainNav.defaultProps = { + ariaLabel: 'main', +}; + +export default AUmainNav; +>>>>>>> Added basic react proptype jsdoc:packages/main-nav/src/react/react.js diff --git a/packages/main-nav/src/react/main-navMenu.js b/packages/main-nav/src/react/main-navMenu.js index 92c346a90..c765d31b1 100644 --- a/packages/main-nav/src/react/main-navMenu.js +++ b/packages/main-nav/src/react/main-navMenu.js @@ -52,6 +52,9 @@ const AUmainNavMenu = ({ items, linkComponent }) => { AUmainNavMenu.propTypes = { + /** + * + */ items: PropTypes.arrayOf( PropTypes.shape({ link: PropTypes.string, @@ -59,6 +62,9 @@ AUmainNavMenu.propTypes = { children: PropTypes.array, }) ).isRequired, + /** + * + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), }; diff --git a/packages/page-alerts/src/react/page-alerts.js b/packages/page-alerts/src/react/page-alerts.js index efb092d8e..8d7b0a1dc 100644 --- a/packages/page-alerts/src/react/page-alerts.js +++ b/packages/page-alerts/src/react/page-alerts.js @@ -57,10 +57,25 @@ const AUpageAlert = ({ as, alt, dark, children, className = '', ...attributeOpti ); AUpageAlert.propTypes = { + /** + * One of four kinds: 'info', 'success', 'warning', 'error'. + */ as: PropTypes.oneOf([ 'info', 'warning', 'error', 'success' ]).isRequired, + /** + * An alternate variation of the component. + */ alt: PropTypes.bool, + /** + * A dark variation of the component. + */ dark: PropTypes.bool, + /** + * Anything inside. + */ children: PropTypes.node.isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; diff --git a/packages/select/src/react/select.js b/packages/select/src/react/select.js index 6f4b4968b..0fd4dd45b 100644 --- a/packages/select/src/react/select.js +++ b/packages/select/src/react/select.js @@ -48,15 +48,30 @@ const AUselect = ({ dark, options, block, status, className = '', ...attributeOp }; AUselect.propTypes = { + /** + * A dark variation of the component + */ dark: PropTypes.bool, + /** + * + */ options: PropTypes.arrayOf( PropTypes.shape({ value: PropTypes.string.isRequired, text: PropTypes.string.isRequired, }) ).isRequired, + /** + * + */ block: PropTypes.bool, + /** + * + */ status: PropTypes.oneOf([ 'valid', 'invalid' ]), + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; diff --git a/packages/select/src/react/selectItem.js b/packages/select/src/react/selectItem.js index f3200a70d..c52da1efd 100644 --- a/packages/select/src/react/selectItem.js +++ b/packages/select/src/react/selectItem.js @@ -23,7 +23,16 @@ export const AUselectItem = ({ text, value, ...attributeOptions }) => ( ); AUselectItem.propTypes = { + /** + * + */ text: PropTypes.string.isRequired, + /** + * + */ value: PropTypes.string.isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; diff --git a/packages/side-nav/src/react/side-nav.js b/packages/side-nav/src/react/side-nav.js index 6ae52b0c4..f67be3948 100644 --- a/packages/side-nav/src/react/side-nav.js +++ b/packages/side-nav/src/react/side-nav.js @@ -85,18 +85,57 @@ const AUsideNav = ({ ); AUsideNav.propTypes = { + /** + * A dark variation of the component. + */ dark: PropTypes.bool, + /** + * An alternate variation of the component. + */ alt: PropTypes.bool, + /** + * The headline of the accordion. + */ accordionHeader: PropTypes.string.isRequired, + /** + * A function executed when the accordion opens, optional. + */ onOpen: PropTypes.func, + /** + * A function executed after the accordion opens, optional. + */ afterOpen: PropTypes.func, + /** + * A function executed when the accordion closes, optional. + */ onClose: PropTypes.func, + /** + * A function executed after the accordion closes, optional. + */ afterClose: PropTypes.func, + /** + * The headline of the menu. + */ menuHeader: PropTypes.string, + /** + * The menu headers link. + */ menuHeaderLink: PropTypes.string, + /** + * Closed state, optional. + */ closed: PropTypes.bool, + /** + * Speed of the animation in ms, optional. + */ speed: PropTypes.number, + /** + * The component used for the child links, optional. + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), + /** + * The menu items. + */ items: PropTypes.arrayOf( PropTypes.shape({ link: PropTypes.string, @@ -104,7 +143,13 @@ AUsideNav.propTypes = { children: PropTypes.array, }) ).isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, + /** + * The aria-label attribute, defaults to "side navigation". + */ ariaLabel: PropTypes.string, }; diff --git a/packages/skip-link/src/react/skip-link.js b/packages/skip-link/src/react/skip-link.js index c3bf965bb..df9c49167 100644 --- a/packages/skip-link/src/react/skip-link.js +++ b/packages/skip-link/src/react/skip-link.js @@ -24,8 +24,17 @@ export const AUskipLinkItem = ({ link, text, className = '', ...attributeOptions ); AUskipLinkItem.propTypes = { + /** + * + */ link: PropTypes.string.isRequired, + /** + * + */ text: PropTypes.string.isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, }; @@ -50,12 +59,18 @@ const AUskipLink = ({ links, className = '', ariaLabel, ...attributeOptions }) = ); AUskipLink.propTypes = { + /** + * + */ links: PropTypes.arrayOf( PropTypes.shape({ link: PropTypes.string.isRequired, text: PropTypes.string.isRequired, }) ).isRequired, + /** + * + */ ariaLabel: PropTypes.string, }; diff --git a/packages/tags/src/react/tags.js b/packages/tags/src/react/tags.js index cca0dae27..10adf4b99 100644 --- a/packages/tags/src/react/tags.js +++ b/packages/tags/src/react/tags.js @@ -46,9 +46,21 @@ const AUtagItem = ({ link, linkComponent, text, li = {}, ...attributeOptions }) AUtagItem.propTypes = { + /** + * + */ link: PropTypes.string, + /** + * + */ text: PropTypes.string.isRequired, + /** + * + */ li: PropTypes.object, + /** + * + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), }; @@ -77,7 +89,13 @@ const AUtags = ({ dark, linkComponent, tags, className = '', ...attributeOptions ); AUtags.propTypes = { + /** + * A dark variation of the component. + */ dark: PropTypes.bool, + /** + * All tags inside a neat array. + */ tags: PropTypes.arrayOf( PropTypes.shape({ link: PropTypes.string, @@ -85,7 +103,13 @@ AUtags.propTypes = { li: PropTypes.object, }) ).isRequired, + /** + * The class name for the element, optional. + */ className: PropTypes.string, + /** + * The component used for the child links, optional. + */ linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]), }; diff --git a/packages/text-inputs/src/react/text-inputs.js b/packages/text-inputs/src/react/text-inputs.js index bad27ccb0..e1888dd3a 100644 --- a/packages/text-inputs/src/react/text-inputs.js +++ b/packages/text-inputs/src/react/text-inputs.js @@ -55,11 +55,29 @@ const AUtextInput = ({ as, dark, block, status, width, type = 'text', className ); AUtextInput.propTypes = { + /** + * The kind of input, can be either 'input' or 'textarea', default: 'input'. + */ as: PropTypes.oneOf([ 'input', 'textarea' ]), + /** + * A dark variation of the component. + */ dark: PropTypes.bool, + /** + * Add the block variation class. + */ block: PropTypes.bool, + /** + * Mark this field as either 'valid' or 'invalid'. + */ status: PropTypes.oneOf([ 'valid', 'invalid' ]), + /** + * The class name for the element, optional. + */ className: PropTypes.string, + /** + * + */ width: PropTypes.oneOf([ 'xs', 'sm', 'md', 'lg', 'xl' ]) }; From c11a01f28a98249d71c2ae14502e4bd9e2ff0b86 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 10 Apr 2019 11:22:37 +1000 Subject: [PATCH 17/22] Corrected git rebase diff --- packages/main-nav/src/react/main-nav.js | 12 +++++ .../main-nav/src/react/main-navContent.js | 44 ------------------- 2 files changed, 12 insertions(+), 44 deletions(-) diff --git a/packages/main-nav/src/react/main-nav.js b/packages/main-nav/src/react/main-nav.js index 1deccbb70..6b4c9d333 100644 --- a/packages/main-nav/src/react/main-nav.js +++ b/packages/main-nav/src/react/main-nav.js @@ -33,9 +33,21 @@ const AUmainNav = ({ dark, alt, className, ariaLabel, children, ...attributeOpti ); AUmainNav.propTypes = { + /** + * A dark variation of the component + */ dark: PropTypes.bool, + /** + * An alternate variation of the component + */ alt: PropTypes.bool, + /** + * + */ ariaLabel: PropTypes.string, + /** + * The elements inside. + */ children: PropTypes.node.isRequired, }; diff --git a/packages/main-nav/src/react/main-navContent.js b/packages/main-nav/src/react/main-navContent.js index 4e3e06461..7b3799b54 100644 --- a/packages/main-nav/src/react/main-navContent.js +++ b/packages/main-nav/src/react/main-navContent.js @@ -418,47 +418,3 @@ AUmainNavContent.propTypes = { */ className: PropTypes.string, }; -<<<<<<< HEAD:packages/main-nav/src/react/main-navContent.js -======= - - -const AUmainNav = ({ dark, alt, className, ariaLabel, children, ...attributeOptions }) => ( - -); - -AUmainNav.propTypes = { - /** - * A dark variation of the component - */ - dark: PropTypes.bool, - /** - * An alternate variation of the component - */ - alt: PropTypes.bool, - /** - * - */ - ariaLabel: PropTypes.string, - /** - * The elements inside. - */ - children: PropTypes.node.isRequired, -}; - -AUmainNav.defaultProps = { - ariaLabel: 'main', -}; - -export default AUmainNav; ->>>>>>> Added basic react proptype jsdoc:packages/main-nav/src/react/react.js From d9e81a78ade52e4267df87342616a6fdd12cd080 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 10 Apr 2019 12:15:35 +1000 Subject: [PATCH 18/22] Added previously removed name version from main control-input component --- packages/control-input/src/react/control-input.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/control-input/src/react/control-input.js b/packages/control-input/src/react/control-input.js index cb6042f88..5121f4614 100644 --- a/packages/control-input/src/react/control-input.js +++ b/packages/control-input/src/react/control-input.js @@ -1,3 +1,4 @@ +/*! [replace-name] v[replace-version] */ /*************************************************************************************************************************************************************** * * control-input checkbox function From 06720ceb65d654061e5beaed555f5d8c11855704 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 10 Apr 2019 12:15:57 +1000 Subject: [PATCH 19/22] Added back replacement for lib/react/react.js --- scripts/helper.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/helper.js b/scripts/helper.js index c2f77f790..6127b97ec 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -392,6 +392,7 @@ HELPER.precompile = (() => { } if( _hasReact ) { + ReplaceFileContent( searches, `./lib/react/react.js` ); ReplaceFileContent( searches, `./tests/react/${ HELPER.SHORTNAME }.js` ); } }, @@ -969,7 +970,7 @@ HELPER.test = (() => { const packagesPKG = require( Path.normalize(`${ __dirname }/../packages/${ module }/package.json`) ); const hasSass = Fs.existsSync( Path.normalize(`${ __dirname }/../packages/${ module }/src/sass/_module.scss`) ); const hasJS = Fs.existsSync( Path.normalize(`${ __dirname }/../packages/${ module }/src/js/module.js`) ); - const hasReact = Fs.existsSync( Path.normalize(`${ __dirname }/../packages/${ module }/src/react/react.js`) ); + const hasReact = Fs.existsSync( Path.normalize( `${ __dirname }/../packages/${ module }/src/react/${ HELPER.SHORTNAME }.js` ) ); // const hasJQuery = Fs.existsSync( Path.normalize(`${ __dirname }/../packages/${ module }/src/jquery/jquery.js`) ); // testing lifecycle script From a95f0d096221d3f45679c173870331b2b9980bb4 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 10 Apr 2019 12:24:48 +1000 Subject: [PATCH 20/22] Removed form from package.json tests --- scripts/helper.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/helper.js b/scripts/helper.js index 6127b97ec..bbde6ad1c 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -992,7 +992,8 @@ HELPER.test = (() => { error += `The module ${ module } is missing the "build:react" script.\n`; } - if( hasReact && !packagesPKG.scripts['build'].includes('npm run build:react') ) { + // If we isolate a component like this again we need to refactor. + if( hasReact && module !== 'form' && !packagesPKG.scripts['build'].includes('npm run build:react' ) ) { error += `The module ${ module } is missing the "build:react" task inside the build script.\n`; } From 0930a20b2bcd97022e087fb269f0919ea6ac79cd Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 10 Apr 2019 14:47:30 +1000 Subject: [PATCH 21/22] Updating babel transform file --- scripts/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/helper.js b/scripts/helper.js index bbde6ad1c..7152c61f6 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -449,7 +449,7 @@ HELPER.precompile = (() => { ReplaceFileContent( searches, `${ process.cwd() }/lib/react/react.es5.js` ); // 3. Compile /lib/react.js to react.es5.js - Babel.transformFile( `./lib/react/react.es5.js`, reactOptions, ( error, result ) => { + Babel.transformFile( `./lib/react/react.js`, reactOptions, ( error, result ) => { if( error ) { HELPER.log.error(`We encountered an error when transpiling the react file in ${ Chalk.yellow( `${ process.cwd() }/lib/react/react.es5.js` ) }`); HELPER.log.error( error ); From b4086e86de562da8c595111e955f0f9d024a8905 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 10 Apr 2019 14:59:34 +1000 Subject: [PATCH 22/22] Removed comments from babel transform --- scripts/helper.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/helper.js b/scripts/helper.js index 7152c61f6..a2da448a9 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -428,6 +428,7 @@ HELPER.precompile = (() => { const reactOptions = { ast: false, minified: true, + comments: false, presets: [ `@babel/preset-env`, `@babel/preset-react`