@ilo-org/twig 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +37 -49
- package/.stylelintrc +2 -6
- package/.turbo/turbo-build:lib.log +2 -2
- package/CHANGELOG.md +12 -0
- package/apps/storybook/assets.js +5 -0
- package/apps/storybook/main.js +17 -8
- package/apps/storybook/manager-head.html +1 -1
- package/apps/storybook/manager.js +2 -2
- package/apps/storybook/patterns/colors.stories.mdx +9 -4
- package/apps/storybook/patterns/intro.stories.mdx +47 -42
- package/apps/storybook/patterns/typeset.stories.mdx +10 -6
- package/apps/storybook/patterns/welcome.stories.mdx +21 -16
- package/apps/storybook/preview-body.html +1 -1
- package/apps/storybook/preview.js +16 -16
- package/apps/storybook/styles.scss +1 -1
- package/apps/storybook/theme.js +5 -5
- package/babel.config.js +3 -3
- package/importprefix.js +5 -5
- package/importsvgs.js +3 -3
- package/jest.config.js +8 -8
- package/outputtwigs.js +16 -13
- package/package.json +46 -55
- package/postcss.config.js +2 -2
- package/src/namespaces.js +5 -5
- package/src/patterns/components/accordion/accordion-item.wingsuit.yml +1 -1
- package/src/patterns/components/accordion/accordion.behavior.js +2 -2
- package/src/patterns/components/accordion/accordion.js +31 -21
- package/src/patterns/components/accordion/accordion.stories.jsx +4 -2
- package/src/patterns/components/accordion/accordion.wingsuit.yml +4 -3
- package/src/patterns/components/accordion/index.js +3 -3
- package/src/patterns/components/breadcrumb/breadcrumb.behavior.js +2 -2
- package/src/patterns/components/breadcrumb/breadcrumb.js +14 -12
- package/src/patterns/components/breadcrumb/breadcrumb.stories.jsx +4 -2
- package/src/patterns/components/breadcrumb/breadcrumb.wingsuit.yml +1 -1
- package/src/patterns/components/breadcrumb/index.js +3 -3
- package/src/patterns/components/button/button.stories.jsx +4 -2
- package/src/patterns/components/button/button.wingsuit.yml +12 -12
- package/src/patterns/components/button/index.js +2 -2
- package/src/patterns/components/callout/callout.behavior.js +2 -2
- package/src/patterns/components/callout/callout.js +18 -13
- package/src/patterns/components/callout/callout.stories.jsx +4 -2
- package/src/patterns/components/callout/callout.wingsuit.yml +2 -2
- package/src/patterns/components/callout/index.js +3 -3
- package/src/patterns/components/card/card.stories.jsx +4 -2
- package/src/patterns/components/card/card.wingsuit.yml +8 -8
- package/src/patterns/components/card/index.js +2 -2
- package/src/patterns/components/cardgroup/cardgroup.stories.jsx +4 -2
- package/src/patterns/components/cardgroup/cardgroup.wingsuit.yml +31 -31
- package/src/patterns/components/cardgroup/index.js +2 -2
- package/src/patterns/components/contextmenu/contextmenu.stories.jsx +4 -2
- package/src/patterns/components/contextmenu/contextmenu.wingsuit.yml +7 -7
- package/src/patterns/components/contextmenu/index.js +2 -2
- package/src/patterns/components/dropdown/dropdown.stories.jsx +4 -2
- package/src/patterns/components/dropdown/dropdown.wingsuit.yml +4 -4
- package/src/patterns/components/dropdown/index.js +2 -2
- package/src/patterns/components/footer/footer.stories.jsx +4 -2
- package/src/patterns/components/footer/footer.wingsuit.yml +1 -1
- package/src/patterns/components/footer/index.js +2 -2
- package/src/patterns/components/form/fileupload.behavior.js +2 -2
- package/src/patterns/components/form/fileupload.js +6 -5
- package/src/patterns/components/form/form.stories.jsx +4 -2
- package/src/patterns/components/form/form.wingsuit.yml +92 -92
- package/src/patterns/components/form/index.js +3 -3
- package/src/patterns/components/hero/hero.stories.jsx +4 -2
- package/src/patterns/components/hero/hero.wingsuit.yml +4 -4
- package/src/patterns/components/hero/index.js +2 -2
- package/src/patterns/components/herocard/herocard.stories.jsx +4 -2
- package/src/patterns/components/herocard/herocard.wingsuit.yml +5 -5
- package/src/patterns/components/herocard/index.js +2 -2
- package/src/patterns/components/icon/index.js +2 -2
- package/src/patterns/components/image/image.stories.jsx +4 -2
- package/src/patterns/components/image/image.wingsuit.yml +9 -9
- package/src/patterns/components/image/index.js +2 -2
- package/src/patterns/components/link/index.js +2 -2
- package/src/patterns/components/link/link.stories.jsx +4 -2
- package/src/patterns/components/link/link.wingsuit.yml +3 -3
- package/src/patterns/components/linklist/index.js +2 -2
- package/src/patterns/components/linklist/linklist.stories.jsx +4 -2
- package/src/patterns/components/linklist/linklist.wingsuit.yml +15 -15
- package/src/patterns/components/list/index.js +2 -2
- package/src/patterns/components/list/list-item.wingsuit.yml +1 -1
- package/src/patterns/components/list/list.stories.jsx +4 -2
- package/src/patterns/components/list/list.wingsuit.yml +4 -4
- package/src/patterns/components/loading/index.js +3 -3
- package/src/patterns/components/loading/loading.behavior.js +2 -2
- package/src/patterns/components/loading/loading.js +2 -2
- package/src/patterns/components/loading/loading.stories.jsx +4 -2
- package/src/patterns/components/loading/loading.wingsuit.yml +5 -5
- package/src/patterns/components/localnav/index.js +3 -3
- package/src/patterns/components/localnav/localnav.stories.jsx +4 -2
- package/src/patterns/components/localnav/localnav.twig +3 -1
- package/src/patterns/components/localnav/localnav.wingsuit.yml +17 -19
- package/src/patterns/components/modal/index.js +3 -3
- package/src/patterns/components/modal/modal.behavior.js +2 -2
- package/src/patterns/components/modal/modal.js +9 -7
- package/src/patterns/components/modal/modal.stories.jsx +5 -2
- package/src/patterns/components/modal/modal.wingsuit.yml +20 -20
- package/src/patterns/components/navigation/index.js +3 -3
- package/src/patterns/components/navigation/navigation.behavior.js +2 -2
- package/src/patterns/components/navigation/navigation.js +110 -37
- package/src/patterns/components/navigation/navigation.stories.jsx +5 -2
- package/src/patterns/components/navigation/navigation.wingsuit.yml +7 -7
- package/src/patterns/components/notification/index.js +3 -3
- package/src/patterns/components/notification/notification.behavior.js +3 -3
- package/src/patterns/components/notification/notification.js +4 -2
- package/src/patterns/components/notification/notification.stories.jsx +5 -2
- package/src/patterns/components/notification/notification.wingsuit.yml +7 -7
- package/src/patterns/components/pagination/Pagination.stories.jsx +4 -2
- package/src/patterns/components/pagination/index.js +2 -2
- package/src/patterns/components/pagination/pagination.wingsuit.yml +12 -12
- package/src/patterns/components/polyfill/index.js +2 -2
- package/src/patterns/components/profile/index.js +2 -2
- package/src/patterns/components/profile/profile.stories.jsx +5 -2
- package/src/patterns/components/profile/profile.wingsuit.yml +3 -3
- package/src/patterns/components/readmore/index.js +3 -3
- package/src/patterns/components/readmore/readmore.behavior.js +2 -2
- package/src/patterns/components/readmore/readmore.js +4 -2
- package/src/patterns/components/readmore/readmore.stories.jsx +5 -2
- package/src/patterns/components/readmore/readmore.wingsuit.yml +4 -4
- package/src/patterns/components/richtext/index.js +2 -2
- package/src/patterns/components/richtext/richtext.stories.jsx +5 -2
- package/src/patterns/components/richtext/richtext.wingsuit.yml +1 -1
- package/src/patterns/components/searchfield/index.js +2 -2
- package/src/patterns/components/searchfield/searchfield.stories.jsx +5 -2
- package/src/patterns/components/searchfield/searchfield.wingsuit.yml +1 -1
- package/src/patterns/components/table/index.js +3 -3
- package/src/patterns/components/table/table.behavior.js +2 -2
- package/src/patterns/components/table/table.js +66 -44
- package/src/patterns/components/table/table.stories.jsx +5 -2
- package/src/patterns/components/table/table.wingsuit.yml +11 -21
- package/src/patterns/components/tableofcontents/index.js +3 -3
- package/src/patterns/components/tableofcontents/tableofcontents.behavior.js +2 -2
- package/src/patterns/components/tableofcontents/tableofcontents.js +27 -19
- package/src/patterns/components/tableofcontents/tableofcontents.stories.jsx +5 -2
- package/src/patterns/components/tableofcontents/tableofcontents.wingsuit.yml +14 -14
- package/src/patterns/components/tabs/index.js +3 -3
- package/src/patterns/components/tabs/tabs.behavior.js +4 -4
- package/src/patterns/components/tabs/tabs.js +12 -8
- package/src/patterns/components/tabs/tabs.stories.jsx +5 -2
- package/src/patterns/components/tabs/tabs.wingsuit.yml +120 -120
- package/src/patterns/components/tags/index.js +3 -3
- package/src/patterns/components/tags/tag.behavior.js +2 -2
- package/src/patterns/components/tags/tag.js +12 -12
- package/src/patterns/components/tags/tag.stories.jsx +5 -2
- package/src/patterns/components/tags/tag.wingsuit.yml +3 -3
- package/src/patterns/components/tags/tags.wingsuit.yml +1 -1
- package/src/patterns/components/tooltip/index.js +3 -3
- package/src/patterns/components/tooltip/tooltip.behavior.js +2 -2
- package/src/patterns/components/tooltip/tooltip.js +35 -25
- package/src/patterns/components/tooltip/tooltip.stories.jsx +5 -2
- package/src/patterns/components/tooltip/tooltip.wingsuit.yml +4 -4
- package/src/patterns/components/video/index.js +3 -3
- package/src/patterns/components/video/video.behavior.js +2 -2
- package/src/patterns/components/video/video.js +6 -5
- package/src/patterns/components/video/video.stories.jsx +5 -2
- package/src/patterns/components/video/video.wingsuit.yml +11 -11
- package/src/vendorjs/lib.vendor.js +1 -1
- package/wingsuit.config.js +14 -13
- package/.editorconfig +0 -12
- package/.eslintignore +0 -11
- package/.prettierignore +0 -16
- package/.prettierrc.js +0 -13
package/jest.config.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
projects: [
|
|
2
|
+
projects: ["<rootDir>/source/*/jest.config.js"],
|
|
3
3
|
|
|
4
4
|
// Everything below here is used by merging into per-design-system jest config
|
|
5
5
|
verbose: true,
|
|
6
|
-
testURL:
|
|
7
|
-
setupFiles: [
|
|
8
|
-
moduleFileExtensions: [
|
|
6
|
+
testURL: "http://localhost/",
|
|
7
|
+
setupFiles: ["<rootDir>/tools/tests/unit/setupJest.js"],
|
|
8
|
+
moduleFileExtensions: ["js", "json", "vue"],
|
|
9
9
|
moduleNameMapper: {
|
|
10
10
|
// Jest doesn't care about styles, twig, images, fonts, etc
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
"\\.(twig|md|yml|yaml|css|scss|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
|
|
12
|
+
"<rootDir>/tools/tests/unit/__mocks__/fileMock.js",
|
|
13
13
|
},
|
|
14
14
|
transform: {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
"^.+\\.js$": "babel-jest",
|
|
16
|
+
"^.+\\.vue$": "vue-jest",
|
|
17
17
|
},
|
|
18
18
|
};
|
package/outputtwigs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The build file for Twig package - this copies the twigs from where Storybook needs them to a more convenient folder for use in a CMS
|
|
2
|
-
const fs = require(
|
|
3
|
-
const path = require(
|
|
4
|
-
const theme = require(
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const theme = require("@ilo-org/themes/tokens/theme/base.json");
|
|
5
5
|
let buffer = new Buffer.from(`prefix: ${theme.themeprefix.value}`);
|
|
6
6
|
const srcpath = `./src/patterns/components`;
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@ const checkFolder = async (dir) => {
|
|
|
13
13
|
|
|
14
14
|
const traverseDirectory = (directory) => {
|
|
15
15
|
let files = fs.readdirSync(directory).filter((file) => {
|
|
16
|
-
return file !==
|
|
16
|
+
return file !== ".DS_Store";
|
|
17
17
|
});
|
|
18
18
|
for (const f in files) {
|
|
19
19
|
const file = files[f];
|
|
@@ -22,23 +22,26 @@ const traverseDirectory = (directory) => {
|
|
|
22
22
|
if (fs.statSync(absolute).isDirectory()) {
|
|
23
23
|
traverseDirectory(absolute);
|
|
24
24
|
} else {
|
|
25
|
-
if (ext ===
|
|
26
|
-
filepath = directory
|
|
25
|
+
if (ext === ".twig" || (ext === ".js" && file !== "index.js")) {
|
|
26
|
+
let filepath = directory
|
|
27
27
|
.replace(`src/`, `dist/`)
|
|
28
|
-
.replace(
|
|
29
|
-
.replace(`/${file}`,
|
|
28
|
+
.replace("patterns/", "")
|
|
29
|
+
.replace(`/${file}`, "");
|
|
30
30
|
checkFolder(filepath);
|
|
31
|
-
fs.readFile(absolute,
|
|
31
|
+
fs.readFile(absolute, "utf8", function (err, filedata) {
|
|
32
32
|
let formatted = filedata.replace(/{{prefix}}/g, buffer);
|
|
33
33
|
fs.writeFile(
|
|
34
|
-
`${path
|
|
34
|
+
`${path
|
|
35
|
+
.dirname(absolute)
|
|
36
|
+
.replace(`src/`, `dist/`)
|
|
37
|
+
.replace("patterns/", "")}/${file}`,
|
|
35
38
|
formatted,
|
|
36
|
-
|
|
39
|
+
"utf8",
|
|
37
40
|
function (err) {
|
|
38
|
-
if (err) return console.log(
|
|
41
|
+
if (err) return console.log(".writeFile", err);
|
|
39
42
|
}
|
|
40
43
|
);
|
|
41
|
-
if (err) return console.log(
|
|
44
|
+
if (err) return console.log("readFile", err);
|
|
42
45
|
});
|
|
43
46
|
}
|
|
44
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilo-org/twig",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Twig components for the ILO's Design System",
|
|
6
6
|
"main": "",
|
|
@@ -20,82 +20,73 @@
|
|
|
20
20
|
"components"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
23
|
+
"video.js": "^7.21.2",
|
|
24
|
+
"@ilo-org/brand-assets": "0.1.0",
|
|
25
25
|
"@ilo-org/fonts": "0.1.0",
|
|
26
26
|
"@ilo-org/icons": "0.1.16",
|
|
27
|
-
"@ilo-org/styles": "0.1.
|
|
27
|
+
"@ilo-org/styles": "0.1.18",
|
|
28
28
|
"@ilo-org/themes": "0.1.15",
|
|
29
29
|
"@ilo-org/utils": "0.0.11"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@babel/core": "^7.
|
|
33
|
-
"@babel/preset-env": "^7.
|
|
34
|
-
"@storybook/addon-actions": "^6.
|
|
35
|
-
"@storybook/addon-essentials": "^6.
|
|
36
|
-
"@storybook/addon-links": "^6.
|
|
32
|
+
"@babel/core": "^7.20.12",
|
|
33
|
+
"@babel/preset-env": "^7.20.2",
|
|
34
|
+
"@storybook/addon-actions": "^6.5.16",
|
|
35
|
+
"@storybook/addon-essentials": "^6.5.16",
|
|
36
|
+
"@storybook/addon-links": "^6.5.16",
|
|
37
37
|
"@storybook/addon-postcss": "^2.0.0",
|
|
38
|
-
"@storybook/addons": "^6.
|
|
39
|
-
"@storybook/linter-config": "^
|
|
40
|
-
"@storybook/react": "^6.
|
|
41
|
-
"@storybook/storybook-deployer": "^2.8.
|
|
42
|
-
"@types/react": "^16.
|
|
43
|
-
"@types/react-dom": "^16.9.
|
|
44
|
-
"@wingsuit-designsystem/cli": "1.2.
|
|
45
|
-
"@wingsuit-designsystem/core": "1.2.
|
|
46
|
-
"@wingsuit-designsystem/pattern": "1.2.
|
|
47
|
-
"@wingsuit-designsystem/preset-scss": "^1.2.
|
|
48
|
-
"@wingsuit-designsystem/storybook": "1.2.
|
|
49
|
-
"autoprefixer": "^10.4.
|
|
50
|
-
"cross-env": "^
|
|
51
|
-
"eslint": "^6.7.2",
|
|
52
|
-
"eslint-config-airbnb-base": "^14.0.0",
|
|
53
|
-
"eslint-config-prettier": "^6.10.0",
|
|
54
|
-
"eslint-import-resolver-alias": "^1.1.2",
|
|
55
|
-
"eslint-import-resolver-webpack": "^0.12.0",
|
|
56
|
-
"eslint-loader": "^3.0.3",
|
|
57
|
-
"eslint-plugin-import": "^2.20.1",
|
|
58
|
-
"eslint-plugin-jest": "^23.7.0",
|
|
59
|
-
"eslint-plugin-prettier": "^3.1.2",
|
|
60
|
-
"eslint-plugin-vue": "^6.0.1",
|
|
38
|
+
"@storybook/addons": "^6.5.16",
|
|
39
|
+
"@storybook/linter-config": "^3.1.2",
|
|
40
|
+
"@storybook/react": "^6.5.16",
|
|
41
|
+
"@storybook/storybook-deployer": "^2.8.16",
|
|
42
|
+
"@types/react": "^16.14.35",
|
|
43
|
+
"@types/react-dom": "^16.9.17",
|
|
44
|
+
"@wingsuit-designsystem/cli": "1.2.7",
|
|
45
|
+
"@wingsuit-designsystem/core": "1.2.7",
|
|
46
|
+
"@wingsuit-designsystem/pattern": "1.2.7",
|
|
47
|
+
"@wingsuit-designsystem/preset-scss": "^1.2.7",
|
|
48
|
+
"@wingsuit-designsystem/storybook": "1.2.7",
|
|
49
|
+
"autoprefixer": "^10.4.13",
|
|
50
|
+
"cross-env": "^7.0.3",
|
|
61
51
|
"file-loader": "^6.2.0",
|
|
62
52
|
"fs": "0.0.1-security",
|
|
63
53
|
"fs-extra": "^8.1.0",
|
|
64
|
-
"glob": "^7.
|
|
54
|
+
"glob": "^7.2.3",
|
|
65
55
|
"jquery-once": "^2.2.3",
|
|
66
56
|
"lodash": "^4.17.20",
|
|
67
|
-
"mini-css-extract-plugin": "^1.
|
|
68
|
-
"optimize-css-assets-webpack-plugin": "^5.0.
|
|
69
|
-
"postcss": "^8.4.
|
|
70
|
-
"postcss-loader": "^4.
|
|
71
|
-
"postcss-nested": "^4.2.
|
|
72
|
-
"postcss-scss": "^
|
|
73
|
-
"prettier": "^1.19.1",
|
|
57
|
+
"mini-css-extract-plugin": "^1.6.2",
|
|
58
|
+
"optimize-css-assets-webpack-plugin": "^5.0.8",
|
|
59
|
+
"postcss": "^8.4.21",
|
|
60
|
+
"postcss-loader": "^4.3.0",
|
|
61
|
+
"postcss-nested": "^4.2.3",
|
|
62
|
+
"postcss-scss": "^4.0.6",
|
|
74
63
|
"raw-loader": "^4.0.2",
|
|
75
|
-
"react": "^16.
|
|
76
|
-
"react-dom": "^16.
|
|
64
|
+
"react": "^16.14.0",
|
|
65
|
+
"react-dom": "^16.14.0",
|
|
77
66
|
"regenerator-runtime": "^0.13.3",
|
|
78
67
|
"require-context": "^1.1.0",
|
|
79
|
-
"resolve-url-loader": "^3.1.
|
|
80
|
-
"sass-loader": "^10.1
|
|
81
|
-
"storybook": "^6.5.
|
|
82
|
-
"style-loader": "^1.0
|
|
83
|
-
"stylelint-scss": "^3.
|
|
84
|
-
"webpack": "^4.
|
|
85
|
-
"yaml-loader": "
|
|
86
|
-
"yo": "^3.1.1"
|
|
68
|
+
"resolve-url-loader": "^3.1.5",
|
|
69
|
+
"sass-loader": "^10.4.1",
|
|
70
|
+
"storybook": "^6.5.16",
|
|
71
|
+
"style-loader": "^1.3.0",
|
|
72
|
+
"stylelint-scss": "^3.21.0",
|
|
73
|
+
"webpack": "^4.46.0",
|
|
74
|
+
"yaml-loader": "0.6.0",
|
|
75
|
+
"yo": "^3.1.1",
|
|
76
|
+
"@ilo-org/eslint-config": "0.0.3",
|
|
77
|
+
"@ilo-org/prettier-config": "0.0.2"
|
|
87
78
|
},
|
|
88
79
|
"scripts": {
|
|
89
80
|
"storybook": "node importprefix.js; node importsvgs.js; start-storybook --config-dir apps/storybook",
|
|
90
81
|
"build:docs": "node importprefix.js; node importsvgs.js; build-storybook --config-dir apps/storybook -o ./storybook-static",
|
|
91
82
|
"build:lib": "pnpm output",
|
|
92
83
|
"build": "pnpm build:lib",
|
|
93
|
-
"lint:js": "eslint --ext .js
|
|
84
|
+
"lint:js": "eslint . --ext .js,.jsx",
|
|
94
85
|
"lint:css": "stylelint '**/*.css'",
|
|
95
|
-
"lint": "
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
86
|
+
"lint:fix": "pnpm lint:js -- --fix",
|
|
87
|
+
"lint": "pnpm lint:js && pnpm lint:css",
|
|
88
|
+
"format": "prettier --check . --ignore-path ../../.prettierignore",
|
|
89
|
+
"format:fix": "prettier --write . --ignore-path ../../.prettierignore",
|
|
99
90
|
"ci": "npm run lint && npm run build:drupal",
|
|
100
91
|
"import:prefix": "node importprefix.js",
|
|
101
92
|
"import:svgs": "node importsvgs.js",
|
package/postcss.config.js
CHANGED
package/src/namespaces.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Global namespaces
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
const path = require(
|
|
5
|
+
const path = require("path");
|
|
6
6
|
|
|
7
|
-
const patterns = path.resolve(__dirname,
|
|
7
|
+
const patterns = path.resolve(__dirname, "patterns");
|
|
8
8
|
|
|
9
9
|
module.exports = {
|
|
10
10
|
patterns: patterns,
|
|
11
|
-
components: path.resolve(patterns,
|
|
12
|
-
tokens: path.resolve(__dirname,
|
|
13
|
-
svgs: path.resolve(__dirname,
|
|
11
|
+
components: path.resolve(patterns, "components"),
|
|
12
|
+
tokens: path.resolve(__dirname, "tokens"),
|
|
13
|
+
svgs: path.resolve(__dirname, "svgs"),
|
|
14
14
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Accordion from
|
|
1
|
+
import Accordion from "./accordion";
|
|
2
2
|
|
|
3
3
|
Drupal.behaviors.accordion = {
|
|
4
4
|
attach() {
|
|
@@ -6,7 +6,7 @@ Drupal.behaviors.accordion = {
|
|
|
6
6
|
document.querySelectorAll(`[data-loadcomponent="Accordion"]`),
|
|
7
7
|
(element) => {
|
|
8
8
|
// eslint-disable-next-line no-console
|
|
9
|
-
console.log(
|
|
9
|
+
console.log("loading Accordion component....");
|
|
10
10
|
new Accordion(element);
|
|
11
11
|
}
|
|
12
12
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EVENTS, ARIA } from "@ilo-org/utils";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The Accordion module which handles rendering field labels inline on a form.
|
|
@@ -33,7 +33,10 @@ export default class Accordion {
|
|
|
33
33
|
* @chainable
|
|
34
34
|
*/
|
|
35
35
|
init() {
|
|
36
|
-
this.cacheDomReferences()
|
|
36
|
+
this.cacheDomReferences()
|
|
37
|
+
.setupHandlers()
|
|
38
|
+
.enable()
|
|
39
|
+
.evaluateAccordionHeights();
|
|
37
40
|
|
|
38
41
|
return this;
|
|
39
42
|
}
|
|
@@ -49,10 +52,17 @@ export default class Accordion {
|
|
|
49
52
|
* The field that a user interacts with on a form
|
|
50
53
|
* @type {Object}
|
|
51
54
|
*/
|
|
52
|
-
this.accordionItems = this.element.querySelectorAll(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.
|
|
55
|
+
this.accordionItems = this.element.querySelectorAll(
|
|
56
|
+
".ilo--accordion--item"
|
|
57
|
+
);
|
|
58
|
+
this.multipleExpanded =
|
|
59
|
+
this.element.getAttribute("data-multipleexpanded") === "true";
|
|
60
|
+
this.accordionPanels = this.element.querySelectorAll(
|
|
61
|
+
".ilo--accordion--panel"
|
|
62
|
+
);
|
|
63
|
+
this.accordionButtons = this.element.querySelectorAll(
|
|
64
|
+
".ilo--accordion--button"
|
|
65
|
+
);
|
|
56
66
|
console.log(this.multipleExpanded);
|
|
57
67
|
|
|
58
68
|
return this;
|
|
@@ -81,7 +91,7 @@ export default class Accordion {
|
|
|
81
91
|
*/
|
|
82
92
|
enable() {
|
|
83
93
|
if (this.accordionButtons.length > 0) {
|
|
84
|
-
this.accordionButtons.forEach((button
|
|
94
|
+
this.accordionButtons.forEach((button) => {
|
|
85
95
|
button.addEventListener(EVENTS.CLICK, (e) => this.onClick(e));
|
|
86
96
|
});
|
|
87
97
|
}
|
|
@@ -107,10 +117,10 @@ export default class Accordion {
|
|
|
107
117
|
* @chainable
|
|
108
118
|
*/
|
|
109
119
|
evaluateAccordionHeights() {
|
|
110
|
-
this.accordionPanels.forEach((item
|
|
120
|
+
this.accordionPanels.forEach((item) => {
|
|
111
121
|
item.style.setProperty(
|
|
112
|
-
|
|
113
|
-
item.querySelector(
|
|
122
|
+
"--height",
|
|
123
|
+
item.querySelector(".ilo--accordion--innerpanel").scrollHeight + "px"
|
|
114
124
|
);
|
|
115
125
|
});
|
|
116
126
|
|
|
@@ -124,9 +134,9 @@ export default class Accordion {
|
|
|
124
134
|
*/
|
|
125
135
|
updateAccordionItems(panelbutton) {
|
|
126
136
|
const panel = panelbutton
|
|
127
|
-
.closest(
|
|
128
|
-
.querySelector(
|
|
129
|
-
const isopen = panel.classList.contains(
|
|
137
|
+
.closest(".ilo--accordion--item")
|
|
138
|
+
.querySelector(".ilo--accordion--panel");
|
|
139
|
+
const isopen = panel.classList.contains("ilo--accordion--panel--open");
|
|
130
140
|
|
|
131
141
|
if (!this.multipleExpanded) {
|
|
132
142
|
this.accordionPanels.forEach((item) => {
|
|
@@ -155,10 +165,10 @@ export default class Accordion {
|
|
|
155
165
|
*/
|
|
156
166
|
collapseSection(element) {
|
|
157
167
|
element.parentElement
|
|
158
|
-
.querySelector(
|
|
159
|
-
.setAttribute(ARIA.EXPANDED,
|
|
160
|
-
element.setAttribute(ARIA.HIDDEN,
|
|
161
|
-
element.classList.remove(
|
|
168
|
+
.querySelector(".ilo--accordion--button")
|
|
169
|
+
.setAttribute(ARIA.EXPANDED, "false");
|
|
170
|
+
element.setAttribute(ARIA.HIDDEN, "false");
|
|
171
|
+
element.classList.remove("ilo--accordion--panel--open");
|
|
162
172
|
}
|
|
163
173
|
|
|
164
174
|
/**
|
|
@@ -170,9 +180,9 @@ export default class Accordion {
|
|
|
170
180
|
*/
|
|
171
181
|
expandSection(element) {
|
|
172
182
|
element.parentElement
|
|
173
|
-
.querySelector(
|
|
174
|
-
.setAttribute(ARIA.EXPANDED,
|
|
175
|
-
element.setAttribute(ARIA.HIDDEN,
|
|
176
|
-
element.classList.add(
|
|
183
|
+
.querySelector(".ilo--accordion--button")
|
|
184
|
+
.setAttribute(ARIA.EXPANDED, "true");
|
|
185
|
+
element.setAttribute(ARIA.HIDDEN, "true");
|
|
186
|
+
element.classList.add("ilo--accordion--panel--open");
|
|
177
187
|
}
|
|
178
188
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./index";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default {};
|
|
4
|
+
const patternDefinition = require("./accordion.wingsuit.yml");
|
|
4
5
|
|
|
6
|
+
/* eslint-disable-next-line */
|
|
5
7
|
export const wingsuit = {
|
|
6
8
|
patternDefinition,
|
|
7
9
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
accordion:
|
|
2
|
-
use:
|
|
2
|
+
use: "@components/accordion/accordion.twig"
|
|
3
3
|
label: Accordion
|
|
4
|
-
description:
|
|
4
|
+
description:
|
|
5
|
+
The accordion component allows the user to show and hide sections of
|
|
5
6
|
related content on a page. Click the accordions below to
|
|
6
7
|
expand/collapse the accordion content.
|
|
7
8
|
fields:
|
|
@@ -36,6 +37,6 @@ accordion:
|
|
|
36
37
|
options:
|
|
37
38
|
true: True
|
|
38
39
|
false: False
|
|
39
|
-
preview:
|
|
40
|
+
preview: "true"
|
|
40
41
|
required: false
|
|
41
42
|
visibility: storybook
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Breadcrumb from
|
|
1
|
+
import Breadcrumb from "./breadcrumb";
|
|
2
2
|
|
|
3
3
|
Drupal.behaviors.breadcrumb = {
|
|
4
4
|
attach() {
|
|
@@ -6,7 +6,7 @@ Drupal.behaviors.breadcrumb = {
|
|
|
6
6
|
document.querySelectorAll(`[data-loadcomponent="Breadcrumb"]`),
|
|
7
7
|
(element) => {
|
|
8
8
|
// eslint-disable-next-line no-console
|
|
9
|
-
console.log(
|
|
9
|
+
console.log("loading Breadcrumb component....");
|
|
10
10
|
new Breadcrumb(element);
|
|
11
11
|
}
|
|
12
12
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EVENTS } from
|
|
1
|
+
import { EVENTS } from "@ilo-org/utils";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The Breadcrumb module which handles rendering field labels inline on a form.
|
|
@@ -45,9 +45,11 @@ export default class Breadcrumb {
|
|
|
45
45
|
* @chainable
|
|
46
46
|
*/
|
|
47
47
|
cacheDomReferences() {
|
|
48
|
-
this.breadcrumbs = this.element.querySelector(
|
|
48
|
+
this.breadcrumbs = this.element.querySelector(".ilo--breadcrumb--items");
|
|
49
49
|
this.breadcrumbwidth = this.breadcrumbs.offsetWidth;
|
|
50
|
-
this.ContextButton = this.element.querySelector(
|
|
50
|
+
this.ContextButton = this.element.querySelector(
|
|
51
|
+
`.${this.prefix}--breadcrumb--item--context`
|
|
52
|
+
);
|
|
51
53
|
this.ContextMenu = this.element.querySelector(`.context--menu`);
|
|
52
54
|
|
|
53
55
|
return this;
|
|
@@ -85,13 +87,13 @@ export default class Breadcrumb {
|
|
|
85
87
|
* @return {Object} Breadcrumb A reference to the instance of the class
|
|
86
88
|
* @chainable
|
|
87
89
|
*/
|
|
88
|
-
onResize(
|
|
90
|
+
onResize() {
|
|
89
91
|
if (this.breadcrumbwidth > this.element.offsetWidth / 2) {
|
|
90
|
-
this.element.classList.add(
|
|
91
|
-
this.ContextMenu.classList.remove(
|
|
92
|
+
this.element.classList.add("contextmenu");
|
|
93
|
+
this.ContextMenu.classList.remove("open");
|
|
92
94
|
} else {
|
|
93
|
-
this.element.classList.remove(
|
|
94
|
-
this.ContextMenu.classList.remove(
|
|
95
|
+
this.element.classList.remove("contextmenu");
|
|
96
|
+
this.ContextMenu.classList.remove("open");
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
return this;
|
|
@@ -104,11 +106,11 @@ export default class Breadcrumb {
|
|
|
104
106
|
* @chainable
|
|
105
107
|
*/
|
|
106
108
|
onClick() {
|
|
107
|
-
if (this.element.classList.contains(
|
|
108
|
-
if (this.ContextMenu.classList.contains(
|
|
109
|
-
this.ContextMenu.classList.remove(
|
|
109
|
+
if (this.element.classList.contains("contextmenu")) {
|
|
110
|
+
if (this.ContextMenu.classList.contains("open")) {
|
|
111
|
+
this.ContextMenu.classList.remove("open");
|
|
110
112
|
} else {
|
|
111
|
-
this.ContextMenu.classList.add(
|
|
113
|
+
this.ContextMenu.classList.add("open");
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./index";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default {};
|
|
4
|
+
const patternDefinition = require("./breadcrumb.wingsuit.yml");
|
|
4
5
|
|
|
6
|
+
/* eslint-disable-next-line */
|
|
5
7
|
export const wingsuit = {
|
|
6
8
|
patternDefinition,
|
|
7
9
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./index";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default {};
|
|
4
|
+
const patternDefinition = require("./button.wingsuit.yml");
|
|
4
5
|
|
|
6
|
+
/* eslint-disable-next-line */
|
|
5
7
|
export const wingsuit = {
|
|
6
8
|
patternDefinition,
|
|
7
9
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
button:
|
|
2
|
-
use:
|
|
2
|
+
use: "@components/button/button.twig"
|
|
3
3
|
label: Button
|
|
4
4
|
description: A button or a link styled like a button.
|
|
5
5
|
fields:
|
|
@@ -7,19 +7,19 @@ button:
|
|
|
7
7
|
type: string
|
|
8
8
|
label: Label
|
|
9
9
|
description: The label for the button
|
|
10
|
-
preview:
|
|
10
|
+
preview: "Button"
|
|
11
11
|
required: true
|
|
12
12
|
url:
|
|
13
13
|
type: string
|
|
14
14
|
label: url
|
|
15
15
|
description: The url for the button if it's a link
|
|
16
|
-
preview:
|
|
16
|
+
preview: ""
|
|
17
17
|
required: false
|
|
18
18
|
target:
|
|
19
19
|
type: string
|
|
20
20
|
label: target
|
|
21
21
|
description: Should the button open in a new tab? If so, include the name of the tab. Only evaluated if the url field is populated.
|
|
22
|
-
preview:
|
|
22
|
+
preview: "true"
|
|
23
23
|
required: false
|
|
24
24
|
icon:
|
|
25
25
|
type: string
|
|
@@ -31,7 +31,7 @@ button:
|
|
|
31
31
|
type: string
|
|
32
32
|
label: Class name
|
|
33
33
|
description: optional class name
|
|
34
|
-
preview:
|
|
34
|
+
preview: "optionalclass"
|
|
35
35
|
required: false
|
|
36
36
|
settings:
|
|
37
37
|
size:
|
|
@@ -43,7 +43,7 @@ button:
|
|
|
43
43
|
small: Small
|
|
44
44
|
medium: Medium
|
|
45
45
|
large: Large
|
|
46
|
-
preview:
|
|
46
|
+
preview: "large"
|
|
47
47
|
type:
|
|
48
48
|
type: select
|
|
49
49
|
label: Type
|
|
@@ -55,16 +55,16 @@ button:
|
|
|
55
55
|
tertiary: Tertiary
|
|
56
56
|
alert: Alert
|
|
57
57
|
icononly: Icon Only
|
|
58
|
-
preview:
|
|
58
|
+
preview: "primary"
|
|
59
59
|
disabled:
|
|
60
60
|
type: select
|
|
61
61
|
label: Disabled
|
|
62
62
|
description: The disabled state of the button.
|
|
63
63
|
required: false
|
|
64
64
|
options:
|
|
65
|
-
true:
|
|
65
|
+
true: "true"
|
|
66
66
|
false: false
|
|
67
|
-
preview:
|
|
67
|
+
preview: "false"
|
|
68
68
|
kind:
|
|
69
69
|
type: select
|
|
70
70
|
label: Kind
|
|
@@ -74,7 +74,7 @@ button:
|
|
|
74
74
|
button: button
|
|
75
75
|
reset: reset
|
|
76
76
|
submit: submit
|
|
77
|
-
preview:
|
|
77
|
+
preview: "button"
|
|
78
78
|
iconPosition:
|
|
79
79
|
type: select
|
|
80
80
|
label: Icon Position
|
|
@@ -89,7 +89,7 @@ button:
|
|
|
89
89
|
label: Icon Only
|
|
90
90
|
description: Is this an icon-only button?
|
|
91
91
|
options:
|
|
92
|
-
true:
|
|
92
|
+
true: "true"
|
|
93
93
|
false: false
|
|
94
94
|
preview: false
|
|
95
95
|
required: false
|
|
@@ -98,7 +98,7 @@ button:
|
|
|
98
98
|
label: Opens Modal
|
|
99
99
|
description: Does this button trigger open a modal?
|
|
100
100
|
options:
|
|
101
|
-
true:
|
|
101
|
+
true: "true"
|
|
102
102
|
false: false
|
|
103
103
|
preview: false
|
|
104
104
|
required: false
|