diff --git a/.eslintrc.js b/.eslintrc.js index a7ed5c782f3..7a43b923e81 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -22,6 +22,12 @@ module.exports = { 'no-param-reassign': 'off', }, overrides: [ + { + files: ['src/**/*.story.js', 'src/**/*.test.js'], + rules: { + 'import/no-unresolved': 'off', + }, + }, { files: '**/scripts/**/*.js', rules: { diff --git a/package.json b/package.json index 12ee39a9fb1..3afc60e6b9a 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "dist": "npm run clean && npm run browserstats && npm run dist:presets && npm run dist:storybook && npm run dist:website", "lint:js": "eslint . --ext .js --ext .jsx", "lint:scss": "stylelint \"./src/**/*.scss\"", - "lint": "pnpm recursive lint:* -cln", + "lint": "run-p lint:* -cln", "prepare": "husky", "postinstall": "patch-package && [ -z \"$NOYARNPOSTINSTALL\" ] && (pnpm recursive run postinstall && pnpm recursive run prepublish) || echo \"Bypass prepublish\"", "pretty-check": "prettier --check \"src/**/*.{md,mdx,html,json,yml,js,jsx,scss,svg}\"", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5dee9661fdb..2601302da3d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1265,6 +1265,9 @@ importers: '@ecl/dom-utils': specifier: 4.8.1 version: 4.8.1 + '@ecl/event-manager': + specifier: 4.8.1 + version: 4.8.1 '@ecl/vanilla-layout-grid': specifier: 4.8.1 version: 4.8.1 @@ -1274,6 +1277,9 @@ importers: '@ecl/dom-utils': specifier: 4.8.1 version: 4.8.1 + '@ecl/event-manager': + specifier: 4.8.1 + version: 4.8.1 '@ecl/vanilla-layout-grid': specifier: 4.8.1 version: 4.8.1 @@ -1369,6 +1375,9 @@ importers: '@ecl/dom-utils': specifier: 4.8.1 version: 4.8.1 + '@ecl/event-manager': + specifier: 4.8.1 + version: 4.8.1 src/implementations/vanilla/components/fact-figures: dependencies: @@ -1396,6 +1405,9 @@ importers: '@ecl/dom-utils': specifier: 4.8.1 version: 4.8.1 + '@ecl/event-manager': + specifier: 4.8.1 + version: 4.8.1 '@ecl/vanilla-utility-screen-reader': specifier: 4.8.1 version: 4.8.1 @@ -1432,6 +1444,9 @@ importers: '@ecl/dom-utils': specifier: 4.8.1 version: 4.8.1 + '@ecl/event-manager': + specifier: 4.8.1 + version: 4.8.1 '@ecl/vanilla-layout-grid': specifier: 4.8.1 version: 4.8.1 @@ -1464,6 +1479,9 @@ importers: '@ecl/dom-utils': specifier: 4.8.1 version: 4.8.1 + '@ecl/event-manager': + specifier: 4.8.1 + version: 4.8.1 '@ecl/vanilla-utility-media': specifier: 4.8.1 version: 4.8.1 @@ -1476,9 +1494,15 @@ importers: '@ecl/dom-utils': specifier: 4.8.1 version: 4.8.1 + '@ecl/event-manager': + specifier: 4.8.1 + version: 4.8.1 '@ecl/vanilla-layout-grid': specifier: 4.8.1 version: 4.8.1 + focus-trap: + specifier: 7.6.2 + version: 7.6.2 mobile-device-detect: specifier: 0.4.3 version: 0.4.3 @@ -1488,9 +1512,15 @@ importers: '@ecl/dom-utils': specifier: 4.8.1 version: 4.8.1 + '@ecl/event-manager': + specifier: 4.8.1 + version: 4.8.1 '@ecl/vanilla-layout-grid': specifier: 4.8.1 version: 4.8.1 + focus-trap: + specifier: 7.6.2 + version: 7.6.2 mobile-device-detect: specifier: 0.4.3 version: 0.4.3 @@ -1530,6 +1560,9 @@ importers: '@ecl/dom-utils': specifier: 4.8.1 version: 4.8.1 + '@ecl/event-manager': + specifier: 4.8.1 + version: 4.8.1 '@ecl/vanilla-layout-grid': specifier: 4.8.1 version: 4.8.1 @@ -1587,9 +1620,15 @@ importers: src/implementations/vanilla/components/select: dependencies: + '@ecl/builder': + specifier: 4.8.1 + version: 4.8.1(eslint@8.57.0) '@ecl/dom-utils': specifier: 4.8.1 version: 4.8.1 + '@ecl/event-manager': + specifier: 4.8.1 + version: 4.8.1 '@ecl/resources-icons': specifier: 4.8.1 version: 4.8.1 @@ -1663,6 +1702,9 @@ importers: '@ecl/dom-utils': specifier: 4.8.1 version: 4.8.1 + '@ecl/event-manager': + specifier: 4.8.1 + version: 4.8.1 '@ecl/vanilla-layout-grid': specifier: 4.8.1 version: 4.8.1 @@ -2829,6 +2871,10 @@ importers: '@ecl/specs-component-site-header': specifier: 4.8.1 version: 4.8.1 + devDependencies: + '@ecl/builder': + specifier: 4.8.1 + version: 4.8.1(eslint@8.57.0) src/specs/pages/page-inner: dependencies: @@ -2862,6 +2908,10 @@ importers: '@ecl/specs-component-unordered-list': specifier: 4.8.1 version: 4.8.1 + devDependencies: + '@ecl/builder': + specifier: 4.8.1 + version: 4.8.1(eslint@8.57.0) src/specs/pages/page-search: dependencies: @@ -2898,6 +2948,10 @@ importers: '@ecl/specs-component-text-input': specifier: 4.8.1 version: 4.8.1 + devDependencies: + '@ecl/builder': + specifier: 4.8.1 + version: 4.8.1(eslint@8.57.0) src/specs/utilities/typography: {} @@ -2980,6 +3034,9 @@ importers: src/tools/test-utils: devDependencies: + '@ecl/twig-ec-storybook': + specifier: workspace:* + version: link:../../playground/ec deepmerge: specifier: 4.3.1 version: 4.3.1 @@ -4357,6 +4414,9 @@ packages: '@ecl/dom-utils@4.8.1': resolution: {integrity: sha512-dssLyzG8cXdLF9+iSzGRc/li2KAQC7+ORinmtZ+z58ZE6nxUX9/NsGJunFnb/ZjssjQxP2QUe7GT1CIU2P8c0w==} + '@ecl/event-manager@4.8.1': + resolution: {integrity: sha512-ZQxCEqry7oHbJS4DgIDFEcEyCcol7K7oV8dHeA5HOX5GSaG5+E19z35RKgXSolWDaMU1Fs2/KW16+90ky48agQ==} + '@ecl/preset-ec@4.8.1': resolution: {integrity: sha512-PaJn6FszhW8Y3xQz5SimnVOELvQf8WCdEyk2Rvh7WgP8rwXRl7R5jgVhp9t1L2XvxfJvYNt1H7jnaaF+EhXFNQ==} @@ -15511,6 +15571,8 @@ snapshots: '@ecl/dom-utils@4.8.1': {} + '@ecl/event-manager@4.8.1': {} + '@ecl/preset-ec@4.8.1(eslint@8.57.0)(svg4everybody@2.1.9)': dependencies: '@ecl/dom-utils': 4.8.1 @@ -21453,7 +21515,7 @@ snapshots: dependencies: basic-ftp: 5.0.5 data-uri-to-buffer: 6.0.2 - debug: 4.3.4 + debug: 4.3.7 fs-extra: 11.2.0 transitivePeerDependencies: - supports-color @@ -24881,7 +24943,7 @@ snapshots: dependencies: '@tootallnate/quickjs-emscripten': 0.23.0 agent-base: 7.1.1 - debug: 4.3.4 + debug: 4.3.7 get-uri: 6.0.3 http-proxy-agent: 7.0.2 https-proxy-agent: 7.0.5 @@ -25471,7 +25533,7 @@ snapshots: proxy-agent@6.4.0: dependencies: agent-base: 7.1.1 - debug: 4.3.4 + debug: 4.3.7 http-proxy-agent: 7.0.2 https-proxy-agent: 7.0.5 lru-cache: 7.18.3 diff --git a/scripts/set-netlify-deployment-status.js b/scripts/set-netlify-deployment-status.js deleted file mode 100755 index 1af9c07820b..00000000000 --- a/scripts/set-netlify-deployment-status.js +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/env node - -const fetch = require('node-fetch'); - -const run = async () => { - const NETLIFY_API = 'https://api.netlify.com/api/v1'; - - const { - GH_TOKEN, - DRONE_BUILD_NUMBER, - DRONE_REPO, - DRONE_COMMIT_SHA, - DRONE_BUILD_LINK, - NETLIFY_SITE_ID, - NETLIFY_AUTH_TOKEN, - } = process.env; - - if (!DRONE_BUILD_NUMBER) { - console.info('Missing information about build number.'); - return; - } - - if (!GH_TOKEN) { - console.info("Won't be able to communicate Netlify deployment to Github."); - console.info('GH_TOKEN environment variable is required!'); - return; - } - - if (!DRONE_REPO || !DRONE_COMMIT_SHA) { - console.info( - 'Current script depends on Drone CI 0.8 environment variables.' - ); - console.info( - 'Please see https://0-8-0.docs.drone.io/environment-reference' - ); - console.log('Required: DRONE_REPO, DRONE_COMMIT_SHA'); - return; - } - - try { - const deploymentsResponse = await fetch( - `${NETLIFY_API}/sites/${NETLIFY_SITE_ID}/deploys`, - { - method: 'GET', - headers: { - Accept: 'application/json', - 'Accept-Charset': 'utf-8', - 'Content-Type': 'application/json', - Authorization: `Bearer ${NETLIFY_AUTH_TOKEN}`, - }, - } - ); - - const deployments = await deploymentsResponse.json(); - - const currentDeployment = deployments.find( - (deployment) => deployment.title === `Drone build: ${DRONE_BUILD_NUMBER}` - ); - - const siteDeploymentResponse = await fetch( - `${NETLIFY_API}/sites/${NETLIFY_SITE_ID}/deploys/${currentDeployment.id}`, - { - method: 'GET', - headers: { - Accept: 'application/json', - 'Accept-Charset': 'utf-8', - 'Content-Type': 'application/json', - Authorization: `Bearer ${NETLIFY_AUTH_TOKEN}`, - }, - } - ); - - const siteDeployment = await siteDeploymentResponse.json(); - - await fetch( - `https://api.github.com/repos/${DRONE_REPO}/statuses/${DRONE_COMMIT_SHA}`, - { - method: 'POST', - headers: { - Accept: 'application/json', - 'Accept-Charset': 'utf-8', - 'Content-Type': 'application/json', - Authorization: `Bearer ${GH_TOKEN}`, - }, - body: JSON.stringify({ - state: 'success', - target_url: siteDeployment.deploy_ssl_url, - description: 'Preview with URL based on current branch', - context: 'drone/netlify-preview/branch-alias', - }), - } - ); - - await fetch( - `https://api.github.com/repos/${DRONE_REPO}/statuses/${DRONE_COMMIT_SHA}`, - { - method: 'POST', - headers: { - Accept: 'application/json', - 'Accept-Charset': 'utf-8', - 'Content-Type': 'application/json', - Authorization: `Bearer ${GH_TOKEN}`, - }, - body: JSON.stringify({ - state: 'success', - target_url: `https://${currentDeployment.id}--europa-component-library.netlify.app`, - description: 'Preview with URL based on the deployment ID', - context: 'drone/netlify-preview/deployment-id', - }), - } - ); - } catch (error) { - // @see https://developer.github.com/v3/repos/statuses - await fetch( - `https://api.github.com/repos/${DRONE_REPO}/statuses/${DRONE_COMMIT_SHA}`, - { - method: 'POST', - headers: { - Accept: 'application/json', - 'Accept-Charset': 'utf-8', - 'Content-Type': 'application/json', - Authorization: `Bearer ${GH_TOKEN}`, - }, - body: JSON.stringify({ - state: 'error', - target_url: DRONE_BUILD_LINK, - description: `[${error.name}: ${error.message}]`, - context: 'drone/netlify-preview', - }), - } - ); - } - - console.log('Status on pull request successfully updated!'); -}; - -try { - run(); -} catch (error) { - console.error(error); -} diff --git a/scripts/unpublish.js b/scripts/unpublish.js index 55b9c25738f..96921af49e7 100644 --- a/scripts/unpublish.js +++ b/scripts/unpublish.js @@ -1,3 +1,4 @@ +/* eslint-disable import/no-unresolved */ /* For some reasons the query on nom doesn't return some packages: @ecl/vanilla-component-site-header diff --git a/src/implementations/twig/components/accordion/.npmignore b/src/implementations/twig/components/accordion/.npmignore new file mode 100644 index 00000000000..f5441b6356a --- /dev/null +++ b/src/implementations/twig/components/accordion/.npmignore @@ -0,0 +1,2 @@ +__snapshots__ +*.js \ No newline at end of file diff --git a/src/implementations/vanilla/components/accordion/package.json b/src/implementations/vanilla/components/accordion/package.json index cd1dcb746fa..fc8e5f3aa7c 100644 --- a/src/implementations/vanilla/components/accordion/package.json +++ b/src/implementations/vanilla/components/accordion/package.json @@ -10,7 +10,8 @@ "module": "accordion.js", "dependencies": { "@ecl/dom-utils": "4.8.1", - "@ecl/vanilla-layout-grid": "4.8.1" + "@ecl/vanilla-layout-grid": "4.8.1", + "@ecl/event-manager": "4.8.1" }, "publishConfig": { "access": "public" diff --git a/src/implementations/vanilla/components/banner/package.json b/src/implementations/vanilla/components/banner/package.json index 5fe3cf6d514..3ee231fe797 100644 --- a/src/implementations/vanilla/components/banner/package.json +++ b/src/implementations/vanilla/components/banner/package.json @@ -10,7 +10,8 @@ "module": "banner.js", "dependencies": { "@ecl/dom-utils": "4.8.1", - "@ecl/vanilla-layout-grid": "4.8.1" + "@ecl/vanilla-layout-grid": "4.8.1", + "@ecl/event-manager": "4.8.1" }, "publishConfig": { "access": "public" diff --git a/src/implementations/vanilla/components/expandable/package.json b/src/implementations/vanilla/components/expandable/package.json index 078395b3b2c..5d5eb6f42d5 100644 --- a/src/implementations/vanilla/components/expandable/package.json +++ b/src/implementations/vanilla/components/expandable/package.json @@ -9,7 +9,8 @@ "style": "expandable.scss", "sass": "expandable.scss", "dependencies": { - "@ecl/dom-utils": "4.8.1" + "@ecl/dom-utils": "4.8.1", + "@ecl/event-manager": "4.8.1" }, "publishConfig": { "access": "public" diff --git a/src/implementations/vanilla/components/file-upload/package.json b/src/implementations/vanilla/components/file-upload/package.json index 740d422f5d8..37273d7f836 100644 --- a/src/implementations/vanilla/components/file-upload/package.json +++ b/src/implementations/vanilla/components/file-upload/package.json @@ -10,7 +10,8 @@ "main": "file-upload.js", "dependencies": { "@ecl/dom-utils": "4.8.1", - "@ecl/vanilla-utility-screen-reader": "4.8.1" + "@ecl/vanilla-utility-screen-reader": "4.8.1", + "@ecl/event-manager": "4.8.1" }, "publishConfig": { "access": "public" diff --git a/src/implementations/vanilla/components/inpage-navigation/package.json b/src/implementations/vanilla/components/inpage-navigation/package.json index 1f105acb1fd..9e685f17dc9 100644 --- a/src/implementations/vanilla/components/inpage-navigation/package.json +++ b/src/implementations/vanilla/components/inpage-navigation/package.json @@ -13,7 +13,8 @@ "@ecl/vanilla-layout-grid": "4.8.1", "focus-trap": "7.6.2", "gumshoejs": "5.1.2", - "stickyfilljs": "2.1.0" + "stickyfilljs": "2.1.0", + "@ecl/event-manager": "4.8.1" }, "publishConfig": { "access": "public" diff --git a/src/implementations/vanilla/components/media-container/package.json b/src/implementations/vanilla/components/media-container/package.json index 29994251f4f..8138f6f5fba 100644 --- a/src/implementations/vanilla/components/media-container/package.json +++ b/src/implementations/vanilla/components/media-container/package.json @@ -11,7 +11,8 @@ "dependencies": { "@ecl/dom-utils": "4.8.1", "@ecl/vanilla-utility-media": "4.8.1", - "@ecl/vanilla-utility-screen-reader": "4.8.1" + "@ecl/vanilla-utility-screen-reader": "4.8.1", + "@ecl/event-manager": "4.8.1" }, "publishConfig": { "access": "public" diff --git a/src/implementations/vanilla/components/mega-menu/package.json b/src/implementations/vanilla/components/mega-menu/package.json index 261b48a9d36..491a2f4a678 100644 --- a/src/implementations/vanilla/components/mega-menu/package.json +++ b/src/implementations/vanilla/components/mega-menu/package.json @@ -11,7 +11,9 @@ "dependencies": { "@ecl/dom-utils": "4.8.1", "@ecl/vanilla-layout-grid": "4.8.1", - "mobile-device-detect": "0.4.3" + "mobile-device-detect": "0.4.3", + "@ecl/event-manager": "4.8.1", + "focus-trap": "7.6.2" }, "publishConfig": { "access": "public" diff --git a/src/implementations/vanilla/components/menu/package.json b/src/implementations/vanilla/components/menu/package.json index 461e5393bff..ce97a868700 100644 --- a/src/implementations/vanilla/components/menu/package.json +++ b/src/implementations/vanilla/components/menu/package.json @@ -12,7 +12,9 @@ "@ecl/dom-utils": "4.8.1", "@ecl/vanilla-layout-grid": "4.8.1", "mobile-device-detect": "0.4.3", - "stickyfilljs": "2.1.0" + "stickyfilljs": "2.1.0", + "@ecl/event-manager": "4.8.1", + "focus-trap": "7.6.2" }, "publishConfig": { "access": "public" diff --git a/src/implementations/vanilla/components/notification/package.json b/src/implementations/vanilla/components/notification/package.json index 4cca1c85c12..bb97c6891f9 100644 --- a/src/implementations/vanilla/components/notification/package.json +++ b/src/implementations/vanilla/components/notification/package.json @@ -10,7 +10,8 @@ "sass": "notification.scss", "dependencies": { "@ecl/dom-utils": "4.8.1", - "@ecl/vanilla-layout-grid": "4.8.1" + "@ecl/vanilla-layout-grid": "4.8.1", + "@ecl/event-manager": "4.8.1" }, "publishConfig": { "access": "public" diff --git a/src/implementations/vanilla/components/select/package.json b/src/implementations/vanilla/components/select/package.json index ba1014073e4..261e845f24c 100644 --- a/src/implementations/vanilla/components/select/package.json +++ b/src/implementations/vanilla/components/select/package.json @@ -11,7 +11,9 @@ "dependencies": { "@ecl/dom-utils": "4.8.1", "@ecl/resources-icons": "4.8.1", - "@ecl/vanilla-layout-form": "4.8.1" + "@ecl/vanilla-layout-form": "4.8.1", + "@ecl/event-manager": "4.8.1", + "@ecl/builder": "4.8.1" }, "publishConfig": { "access": "public" diff --git a/src/implementations/vanilla/components/tabs/package.json b/src/implementations/vanilla/components/tabs/package.json index 31843f5a570..a925011cfd1 100644 --- a/src/implementations/vanilla/components/tabs/package.json +++ b/src/implementations/vanilla/components/tabs/package.json @@ -11,7 +11,8 @@ "dependencies": { "@ecl/dom-utils": "4.8.1", "@ecl/vanilla-layout-grid": "4.8.1", - "@ecl/vanilla-utility-screen-reader": "4.8.1" + "@ecl/vanilla-utility-screen-reader": "4.8.1", + "@ecl/event-manager": "4.8.1" }, "publishConfig": { "access": "public" diff --git a/src/specs/pages/page-home/package.json b/src/specs/pages/page-home/package.json index ab3319dd7d1..42a204e7cf2 100644 --- a/src/specs/pages/page-home/package.json +++ b/src/specs/pages/page-home/package.json @@ -17,6 +17,9 @@ "@ecl/specs-component-site-footer": "4.8.1", "@ecl/specs-component-site-header": "4.8.1" }, + "devDependencies": { + "@ecl/builder": "4.8.1" + }, "repository": { "type": "git", "url": "git+https://github.com/ec-europa/europa-component-library.git" diff --git a/src/specs/pages/page-inner/package.json b/src/specs/pages/page-inner/package.json index e2611bd931a..b65b963e110 100644 --- a/src/specs/pages/page-inner/package.json +++ b/src/specs/pages/page-inner/package.json @@ -19,6 +19,9 @@ "@ecl/specs-component-site-header": "4.8.1", "@ecl/specs-component-unordered-list": "4.8.1" }, + "devDependencies": { + "@ecl/builder": "4.8.1" + }, "repository": { "type": "git", "url": "git+https://github.com/ec-europa/europa-component-library.git" diff --git a/src/specs/pages/page-search/package.json b/src/specs/pages/page-search/package.json index 6e5ad3bee2e..ea120386173 100644 --- a/src/specs/pages/page-search/package.json +++ b/src/specs/pages/page-search/package.json @@ -20,6 +20,9 @@ "@ecl/specs-component-site-header": "4.8.1", "@ecl/specs-component-text-input": "4.8.1" }, + "devDependencies": { + "@ecl/builder": "4.8.1" + }, "repository": { "type": "git", "url": "git+https://github.com/ec-europa/europa-component-library.git" diff --git a/src/tools/test-utils/package.json b/src/tools/test-utils/package.json index 440c8999881..1e4cdaf9950 100644 --- a/src/tools/test-utils/package.json +++ b/src/tools/test-utils/package.json @@ -5,6 +5,7 @@ "main": "index.js", "private": true, "devDependencies": { - "deepmerge": "4.3.1" + "deepmerge": "4.3.1", + "@ecl/twig-ec-storybook": "workspace:*" } }