-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update npm package generator to place layouts and components in templ…
…ates to satisfy flask (#276) * Update npm package generator to place layouts and components in templates to satisfy flask * update template for runner * Fix loops in jinja * Improve page template assetsURL for runner * Upgrade details and accordion to be able to pass own attributes * Fix unit tests * Fix attributes and page validity * Put generate npm package back to match master * Allow attributes to be passed to feedback buttons * Add ability to configure signout button and service links * Allow header title to be different to html title * Add ability to add attributes to panels * Fix panel body * Fix panels classes logic * Allow attributes on labels and fix classes for jinja * Fix field classes for jinja * Fix checkbox config for jinja * Update date input configs * Fix input for nunjucks * Fix mutually exclusive date unit tests * Fix language selection examples render error and fix error handling in nunjucks html loader * Remove rogue import * Fix nunjucks-html-loader render error handling * Improve error logging * Refactor summary component so that config it closer aligned to eq schema * Remove summary border bottom on last item * Revert "Remove summary border bottom on last item" This reverts commit afe4ce6. * Added summary no border bottom variant * Added print-button helper * Added print-button unit tests * Fix checkboxes / radios when theres an error * Fix inpage link to work with new runner layout * Ensure inpagelink only focuses visible editable inputs * Fix mutually exclusive date example labels * Fix mutually exclusive getLabelText function where label is within a h1 in the legend * Update field component so that it doesn't automatically set the wrapping element to fieldset when mutually exclusive unless a legend is provided * Add scripts block to template
- Loading branch information
Showing
124 changed files
with
1,069 additions
and
739 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default function setAttribute(dictionary, key, value) { | ||
dictionary[key] = value; | ||
return dictionary; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export default function setAttributes(dictionary, attributes) { | ||
for (const key in attributes) { | ||
if (attributes.hasOwnProperty(key)) { | ||
dictionary[key] = attributes[key]; | ||
} | ||
} | ||
|
||
return dictionary; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const setAttribute = require('./lib/filters/set-attribute').default; | ||
const setAttributes = require('./lib/filters/set-attributes').default; | ||
|
||
module.exports = function(environment) { | ||
environment.addFilter('setAttribute', setAttribute); | ||
environment.addFilter('setAttributes', setAttributes); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,42 +5,29 @@ | |
"main": "index.js", | ||
"license": "MIT", | ||
"author": { | ||
"email": "[email protected]", | ||
"name": "Ben Meyrick", | ||
"email": "[email protected]", | ||
"url": "https://github.com/bameyrick" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"start": "yarn tidy-clean && yarn webpack-dev-server --host 0.0.0.0 --watch --config webpack.dev.babel.js", | ||
"build": "yarn tidy-clean && yarn webpack --config webpack.prod.babel.js", | ||
"check-unused": "npx npm-check-unused", | ||
"dedupe-deps": "npx yarn-deduplicate yarn.lock", | ||
"lint-staged": "lint-staged", | ||
"npm-bundle": "NODE_ENV=production yarn build && babel-node lib/generate-npm-package.js", | ||
"start": "yarn tidy-clean && yarn webpack-dev-server --host 0.0.0.0 --watch --config webpack.dev.babel.js", | ||
"test": "karma start ./src/tests/config/karma.conf.js && karma start ./src/tests/config/karma.conf.nomodule.js && codecov", | ||
"test:browserstack": "TEST_ON_BROWSERSTACK=true karma start ./src/tests/config/karma.conf.js && TEST_ON_BROWSERSTACK=true karma start ./src/tests/config/karma.conf.nomodule.js", | ||
"test:local": "KARMA_SINGLE_RUN=false karma start ./src/tests/config/karma.conf.js", | ||
"dedupe-deps": "npx yarn-deduplicate yarn.lock", | ||
"tidy-clean": "rm -rf build css favicons fonts img components page-templates scripts coverage scss", | ||
"npm-bundle": "NODE_ENV=production yarn build && babel-node lib/generate-npm-package.js" | ||
"tidy-clean": "rm -rf build css favicons fonts img templates scripts coverage scss" | ||
}, | ||
"browserslist": [ | ||
"last 2 versions", | ||
"not ie < 11", | ||
"not ie_mob < 11" | ||
], | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged", | ||
"post-checkout": "yarn tidy-clean && yarn check" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.scss": [ | ||
"prettier --print-width 140 --single-quote --parser postcss --write", | ||
"sass-lint", | ||
"git add" | ||
], | ||
"*.js": [ | ||
"prettier --print-width 140 --single-quote --parser babylon --write", | ||
"eslint --fix", | ||
|
@@ -50,8 +37,18 @@ | |
"prettier --write", | ||
"remark", | ||
"git add" | ||
], | ||
"*.scss": [ | ||
"prettier --print-width 140 --single-quote --parser postcss --write", | ||
"sass-lint", | ||
"git add" | ||
] | ||
}, | ||
"browserslist": [ | ||
"last 2 versions", | ||
"not ie < 11", | ||
"not ie_mob < 11" | ||
], | ||
"devDependencies": { | ||
"@babel/core": "^7.1.6", | ||
"@babel/node": "^7.2.2", | ||
|
@@ -61,6 +58,7 @@ | |
"@babel/preset-env": "^7.1.6", | ||
"@babel/register": "^7.0.0", | ||
"@babel/runtime": "^7.2.0", | ||
"abortcontroller-polyfill": "^1.2.3", | ||
"autoprefixer": "^9.3.1", | ||
"babel-eslint": "^10.0.1", | ||
"babel-loader": "^8.0.4", | ||
|
@@ -70,6 +68,7 @@ | |
"circular-dependency-plugin": "^5.0.2", | ||
"codecov": "^3.1.0", | ||
"copy-webpack-plugin": "^4.6.0", | ||
"core-js": "^2.6.0", | ||
"cssnano": "^4.1.7", | ||
"eslint": "^5.9.0", | ||
"eslint-cli": "^1.1.1", | ||
|
@@ -99,10 +98,12 @@ | |
"loader-utils": "^1.1.0", | ||
"lodash": "^4.17.11", | ||
"marked": "^0.5.2", | ||
"mdn-polyfills": "^5.14.0", | ||
"mocha": "^5.2.0", | ||
"ncp": "^2.0.0", | ||
"node-sass": "^4.10.0", | ||
"node-sass-glob-importer": "^5.2.0", | ||
"normalize-scss": "^7.0.1", | ||
"nunjucks": "^3.1.4", | ||
"nunjucks-loader": "^3.0.0", | ||
"postcss-loader": "^3.0.0", | ||
|
@@ -119,6 +120,7 @@ | |
"rimraf": "^2.6.3", | ||
"sass-lint": "^1.12.1", | ||
"sass-loader": "^7.1.0", | ||
"throttle-typescript": "^1.0.1", | ||
"url-loader": "^1.1.2", | ||
"url-search-params-polyfill": "^5.0.0", | ||
"webpack": "^4.26.0", | ||
|
@@ -127,14 +129,10 @@ | |
"webpack-dev-server": "^3.1.10", | ||
"webpack-fix-style-only-entries": "^0.0.5", | ||
"webpack-livereload-plugin": "^2.1.1", | ||
"webpack-merge": "^4.1.4" | ||
}, | ||
"dependencies": { | ||
"abortcontroller-polyfill": "^1.2.3", | ||
"core-js": "^2.6.0", | ||
"mdn-polyfills": "^5.14.0", | ||
"normalize-scss": "^7.0.1", | ||
"throttle-typescript": "^1.0.1", | ||
"webpack-merge": "^4.1.4", | ||
"whatwg-fetch": "^3.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,31 @@ | ||
| Name | Type | Required | Description | | ||
| ----------- | -------------------- | -------- | -------------------------------------------------------------------------- | | ||
| id | string | true | id of the accordion | | ||
| classes | string | false | Classes to add to the button component | | ||
| closeButton | string | true | The close button text for each accordion item | | ||
| buttonOpen | string | true | The open button text for each accordion item | | ||
| items | Array<AccordionItem> | true | Accordion items to render | | ||
| openAll | string | false | Text for the open all button. If not specified the button will not render | | ||
| closeAll | string | false | Text for the close all button. If not specified the button will not render | | ||
| Name | Type | Required | Description | | ||
| --------- | ---------------------- | -------- | ---------------------------------------------------------------------------------------- | | ||
| id | string | true | id of the accordion | | ||
| classes | string | false | Classes to add to the accordion component | | ||
| itemList | `Array<AccordionItem>` | true | Accordion items to render | | ||
| allButton | `AccordionButton` | false | Settings for the show all / hide all button. If not specified the button will not render | | ||
|
||
## AccordionItem | ||
| Name | Type | Required | Description | | ||
| ------- | ------ | -------- | --------------------------------- | | ||
| ----------------- | --------------------- | -------- | --------------------------------------------------------------------------- | | ||
| title | string | true | The title of the accordion item | | ||
| content | string | true | The content of the accordion item | | ||
| button | `AccordionItemButton` | false | Settings for the button | | ||
| attributes | object | false | HTML attributes (for example data attributes) to add to the details element | | ||
| summaryAttributes | object | false | HTML attributes (for example data attributes) to add to the summary element | | ||
|
||
## AccordionButton | ||
|
||
| Name | Type | Required | Description | | ||
| ---------- | ------ | -------- | ------------------------------------------------------------------ | | ||
| open | string | true | Text to show when all of the items aren't open | | ||
| close | string | true | Text to show when all of the items are open | | ||
| attributes | object | false | HTML attributes (for example data attributes) to add to the button | | ||
|
||
## AccordionItemButton | ||
|
||
| Name | Type | Required | Description | | ||
| ---------- | ------ | -------- | ------------------------------------------------------------------ | | ||
| open | string | true | Text for the button when the item is closed | | ||
| close | string | true | Text for the button when the item is open | | ||
| attributes | object | false | HTML attributes (for example data attributes) to add to the button | |
Oops, something went wrong.