diff --git a/.prettierrc b/.prettierrc
index 5528f1141dd..3c695c929f6 100644
--- a/.prettierrc
+++ b/.prettierrc
@@ -6,7 +6,7 @@
"useTabs": false,
"semi": false,
"bracketSameLine": false,
- "trailingComma": "es5",
+ "trailingComma": "all",
"overrides": [
{
"files": ".yarnrc.yml",
diff --git a/packages/dnb-design-system-portal/.lintstagedrc b/packages/dnb-design-system-portal/.lintstagedrc
index 3eb33f0e22f..b45e06968c0 100644
--- a/packages/dnb-design-system-portal/.lintstagedrc
+++ b/packages/dnb-design-system-portal/.lintstagedrc
@@ -1,5 +1,5 @@
{
- "*.js": [
+ "*.{js,ts,tsx}": [
"yarn prettier:js:staged",
"yarn lint:js:staged"
],
@@ -7,7 +7,7 @@
"yarn lint:styles:staged",
"yarn test:staged"
],
- "*.{json,md}": [
+ "*.{json,md,mdx}": [
"yarn prettier:other:staged"
]
}
diff --git a/packages/dnb-design-system-portal/.prettierrc b/packages/dnb-design-system-portal/.prettierrc
index d0a95358513..587f2705ece 100644
--- a/packages/dnb-design-system-portal/.prettierrc
+++ b/packages/dnb-design-system-portal/.prettierrc
@@ -6,5 +6,5 @@
"useTabs": false,
"semi": false,
"bracketSameLine": false,
- "trailingComma": "es5"
+ "trailingComma": "all"
}
diff --git a/packages/dnb-design-system-portal/above_the_line_medium.js b/packages/dnb-design-system-portal/above_the_line_medium.js
index 42c5a345c80..c2418479ee5 100644
--- a/packages/dnb-design-system-portal/above_the_line_medium.js
+++ b/packages/dnb-design-system-portal/above_the_line_medium.js
@@ -1,21 +1,30 @@
-import _extends from "@babel/runtime/helpers/esm/extends";
+import _extends from '@babel/runtime/helpers/esm/extends'
-var _path;
+var _path
-import React from 'react';
+import React from 'react'
-const above_the_line_medium = props => React.createElement("svg", _extends({
- xmlns: "http://www.w3.org/2000/svg",
- width: 24,
- height: 24,
- fill: "none",
- viewBox: "0 0 24 24"
-}, props), _path || (_path = React.createElement("path", {
- stroke: "#000",
- strokeLinecap: "round",
- strokeLinejoin: "round",
- strokeWidth: 1.5,
- d: "M12 21V9m0 0-4 4m4-4s2.243 2.047 4 4M2 3.5h2m4 0h2m4 0h2m4 0h2"
-})));
+const above_the_line_medium = (props) =>
+ React.createElement(
+ 'svg',
+ _extends(
+ {
+ xmlns: 'http://www.w3.org/2000/svg',
+ width: 24,
+ height: 24,
+ fill: 'none',
+ viewBox: '0 0 24 24',
+ },
+ props,
+ ),
+ _path ||
+ (_path = React.createElement('path', {
+ stroke: '#000',
+ strokeLinecap: 'round',
+ strokeLinejoin: 'round',
+ strokeWidth: 1.5,
+ d: 'M12 21V9m0 0-4 4m4-4s2.243 2.047 4 4M2 3.5h2m4 0h2m4 0h2m4 0h2',
+ })),
+ )
-export default above_the_line_medium;
\ No newline at end of file
+export default above_the_line_medium
diff --git a/packages/dnb-design-system-portal/gatsby-node.js b/packages/dnb-design-system-portal/gatsby-node.js
index 9f69116d4d9..734b3af47a4 100644
--- a/packages/dnb-design-system-portal/gatsby-node.js
+++ b/packages/dnb-design-system-portal/gatsby-node.js
@@ -191,7 +191,7 @@ exports.onCreateWebpackConfig = ({
'global.STYLE_IMPORT_PATH': JSON.stringify(
PREBUILD_EXISTS
? '@dnb/eufemia/build/style/dnb-ui-core.min.css'
- : '@dnb/eufemia/src/style/core'
+ : '@dnb/eufemia/src/style/core',
),
}),
@@ -203,7 +203,7 @@ exports.onCreateWebpackConfig = ({
if (PREBUILD_EXISTS && stage === 'build-javascript') {
if (PREBUILD_EXISTS && !isCI) {
reporter.warn(
- 'š± There is a "dnb-eufemia/build" in your local repo. It is used durnig your local Portal build! \nKeep in mind, the code from "dnb-eufemia/build" may be outdated. \n\nš You can remove the build with: "yarn build:clean"\n\n'
+ 'š± There is a "dnb-eufemia/build" in your local repo. It is used durnig your local Portal build! \nKeep in mind, the code from "dnb-eufemia/build" may be outdated. \n\nš You can remove the build with: "yarn build:clean"\n\n',
)
}
@@ -211,9 +211,9 @@ exports.onCreateWebpackConfig = ({
plugins.normalModuleReplacement(/@dnb\/eufemia\/src/, (resource) => {
resource.request = resource.request.replace(
/@dnb\/eufemia\/src(.*)/,
- '@dnb/eufemia/build$1'
+ '@dnb/eufemia/build$1',
)
- })
+ }),
)
}
diff --git a/packages/dnb-design-system-portal/package.json b/packages/dnb-design-system-portal/package.json
index 56dcbeb7596..04b73568a36 100644
--- a/packages/dnb-design-system-portal/package.json
+++ b/packages/dnb-design-system-portal/package.json
@@ -9,32 +9,36 @@
"scripts": {
"build": "cross-env NODE_OPTIONS=--max-old-space-size=8192 gatsby build",
"build:ci": "yarn build:version && gatsby build --prefix-paths",
- "build:visual-test": "SKIP_IMAGE_PROCESSING=1 IS_VISUAL_TEST=1 NODE_OPTIONS=--max-old-space-size=8192 gatsby build --no-uglify",
"build:version": "node ./scripts/version.js --new-version",
+ "build:visual-test": "SKIP_IMAGE_PROCESSING=1 IS_VISUAL_TEST=1 NODE_OPTIONS=--max-old-space-size=8192 gatsby build --no-uglify",
"clean": "gatsby clean",
- "precommit": "yarn lint-staged",
"lint": "eslint --quiet ./src",
- "lint-staged": "lint-staged",
- "lint:ci": "NODE_ENV=test yarn lint:js && yarn lint:styles",
+ "lint:ci": "NODE_ENV=test yarn lint:js && yarn lint:styles && yarn prettier:diff && yarn prettier:package",
"lint:js": "yarn lint --fix",
"lint:js:staged": "eslint --quiet --fix",
"lint:styles": "stylelint './src/**/*.scss'",
"lint:styles:staged": "stylelint './src/**/*.scss'",
+ "lint-staged": "lint-staged",
+ "precommit": "yarn lint-staged",
+ "prettier:diff": "prettier --list-different '**/*.{md,mdx,js,ts,tsx}'",
+ "prettier:package": "prettier-package-json --list-different ./package.json",
+ "prettier:package:write": "prettier-package-json --write ./package.json",
+ "prettier:write": "prettier --log-level warn --write '**/*.{md,mdx,js,ts,tsx}'",
"reset": "yarn clean && rm -rf ./node_modules",
"serve": "gatsby serve -p 8000",
"start": "cross-env NODE_OPTIONS=--max-old-space-size=8192 gatsby develop",
"test": "jest",
+ "test:ci": "jest --ci --passWithNoTests",
"test:e2e": "yarn playwright test",
- "test:e2e:watch": "playwright test --ui",
"test:e2e:ci": "start-server-and-test serve 8000 test:e2e",
- "test:watch": "jest --watch",
- "test:ci": "jest --ci --passWithNoTests",
- "test:staged": "jest --bail --findRelatedTests ",
+ "test:e2e:watch": "playwright test --ui",
"test:screenshots": "yarn workspace @dnb/eufemia test:screenshots",
"test:screenshots:ci": "start-server-and-test serve 8000 'yarn workspace @dnb/eufemia test:screenshots:ci'",
+ "test:staged": "jest --bail --findRelatedTests ",
"test:types": "tsc --noEmit",
"test:types:watch": "tsc --noEmit --watch",
- "test:update": "jest --updateSnapshot"
+ "test:update": "jest --updateSnapshot",
+ "test:watch": "jest --watch"
},
"dependencies": {
"@dnb/eufemia": "workspace:*",
@@ -99,6 +103,8 @@
"ora": "5.4.1",
"postcss": "8.3.11",
"postcss-preset-env": "6.7.0",
+ "prettier": "3.0.3",
+ "prettier-package-json": "2.8.0",
"prism-react-renderer": "1.3.3",
"process": "0.11.10",
"prop-types": "15.7.2",
@@ -117,8 +123,8 @@
"unist-util-visit": "^2"
},
"buildVersion": "[LOCAL BUILD]",
- "releaseVersion": "[LOCAL BUILD]",
"changelogVersion": "[LOCAL BUILD]",
+ "releaseVersion": "[LOCAL BUILD]",
"volta": {
"extends": "../../package.json"
}
diff --git a/packages/dnb-design-system-portal/scripts/version.js b/packages/dnb-design-system-portal/scripts/version.js
index e182f4388b0..c8bd1560c6c 100644
--- a/packages/dnb-design-system-portal/scripts/version.js
+++ b/packages/dnb-design-system-portal/scripts/version.js
@@ -13,7 +13,7 @@ const {
const init = async () => {
if (!isCI) {
console.log(
- 'You may only set a new deploy version on a CI environment!'
+ 'You may only set a new deploy version on a CI environment!',
)
return false
}
@@ -73,7 +73,7 @@ async function createNewChangelogVersion() {
const packageJson = await fs.readJson(file)
const changelogFilePath = path.resolve(
__dirname,
- '../src/docs/EUFEMIA_CHANGELOG.mdx'
+ '../src/docs/EUFEMIA_CHANGELOG.mdx',
)
const content = await fs.readFile(changelogFilePath, 'utf-8')
@@ -87,7 +87,7 @@ async function createNewChangelogVersion() {
await fs.writeFile(file, JSON.stringify(packageJson, null, 2))
} catch (e) {
console.warn(
- `Failed to create new static version file! \n${e.message}`
+ `Failed to create new static version file! \n${e.message}`,
)
}
}
diff --git a/packages/dnb-design-system-portal/src/core/PortalHead.tsx b/packages/dnb-design-system-portal/src/core/PortalHead.tsx
index c9b2f1fd8aa..1a6c4ed4934 100644
--- a/packages/dnb-design-system-portal/src/core/PortalHead.tsx
+++ b/packages/dnb-design-system-portal/src/core/PortalHead.tsx
@@ -18,7 +18,7 @@ export const renderBody =
My Paragraph
{''}
@@ -71,7 +71,7 @@ const LegacyCodeStyling = () => (
SpacingExample,
'dnb-core-style',
'dnb-spacing',
- 'dnb-dev-grid'
+ 'dnb-dev-grid',
)}
>
{''}
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/usage/customisation/theming/theme/info.mdx b/packages/dnb-design-system-portal/src/docs/uilib/usage/customisation/theming/theme/info.mdx
index d4122c90e25..fe028e96897 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/usage/customisation/theming/theme/info.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/usage/customisation/theming/theme/info.mdx
@@ -23,7 +23,7 @@ render(
-
+ ,
)
```
@@ -56,7 +56,7 @@ import { Theme } from '@dnb/eufemia/shared'
render(
-
+ ,
)
```
@@ -123,6 +123,6 @@ render(
Only shown in Sbanken then or Eiendom theme ā that also includes the
fictive variant="blue".
-
+ ,
)
```
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/usage/layout/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/usage/layout/Examples.tsx
index 777b724aa7c..a4add3586ff 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/usage/layout/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/usage/layout/Examples.tsx
@@ -11,7 +11,7 @@ import { Code, Button } from '@dnb/eufemia/src'
const useWindowWidth = () => {
const [innerWidth, setWidth] = React.useState(
- typeof window !== 'undefined' ? window.innerWidth : 0
+ typeof window !== 'undefined' ? window.innerWidth : 0,
)
React.useEffect(() => {
@@ -38,7 +38,7 @@ export const MediaQueryUseMedia = () => (
{JSON.stringify(
{ isSmall, isMedium, isLarge, isSSR, innerWidth },
null,
- 2
+ 2,
)}
diff --git a/packages/dnb-design-system-portal/src/e2e/color-table.spec.ts b/packages/dnb-design-system-portal/src/e2e/color-table.spec.ts
index 7dc153040ab..e5bb777d072 100644
--- a/packages/dnb-design-system-portal/src/e2e/color-table.spec.ts
+++ b/packages/dnb-design-system-portal/src/e2e/color-table.spec.ts
@@ -12,7 +12,7 @@ test.afterEach(async ({ page }) => {
test.describe('Colors for UI', () => {
test.beforeEach(async ({ page }) => {
await page.goto(
- '/quickguide-designer/colors?data-visual-test&eufemia-theme=ui'
+ '/quickguide-designer/colors?data-visual-test&eufemia-theme=ui',
)
// Check if app is mounted
@@ -23,11 +23,11 @@ test.describe('Colors for UI', () => {
test('table should have correct color', async ({ page }) => {
await expect(
- page.locator('.dnb-table__scroll-view table tbody tr td').first()
+ page.locator('.dnb-table__scroll-view table tbody tr td').first(),
).toHaveCSS('color', 'rgb(0, 52, 62)')
const lastCellText = await page.textContent(
- '.dnb-table__scroll-view table tbody tr td:last-of-type'
+ '.dnb-table__scroll-view table tbody tr td:last-of-type',
)
expect(lastCellText).toContain('--color-ocean-green')
})
@@ -36,7 +36,7 @@ test.describe('Colors for UI', () => {
test.describe('Colors for Sbanken', () => {
test.beforeEach(async ({ page }) => {
await page.goto(
- '/quickguide-designer/colors?data-visual-test&eufemia-theme=sbanken'
+ '/quickguide-designer/colors?data-visual-test&eufemia-theme=sbanken',
)
// Check if app is mounted
@@ -47,11 +47,11 @@ test.describe('Colors for Sbanken', () => {
test('table should have correct color', async ({ page }) => {
await expect(
- page.locator('.dnb-table__scroll-view table tbody tr td').first()
+ page.locator('.dnb-table__scroll-view table tbody tr td').first(),
).toHaveCSS('color', 'rgb(28, 27, 78)')
const lastCellText = await page.textContent(
- '.dnb-table__scroll-view table tbody tr td:last-of-type'
+ '.dnb-table__scroll-view table tbody tr td:last-of-type',
)
expect(lastCellText).toContain('--sb-color-purple')
})
diff --git a/packages/dnb-design-system-portal/src/e2e/pageHeading.spec.ts b/packages/dnb-design-system-portal/src/e2e/pageHeading.spec.ts
index d2830bc24fe..22d0a3d9e57 100644
--- a/packages/dnb-design-system-portal/src/e2e/pageHeading.spec.ts
+++ b/packages/dnb-design-system-portal/src/e2e/pageHeading.spec.ts
@@ -16,30 +16,30 @@ test.describe('Page Heading', () => {
const firstElementTagName = await page.$eval(
'#tabbar-content > *',
- (element) => element.tagName
+ (element) => element.tagName,
)
expect(firstElementTagName).toBe('H1')
const secondElementTagName = await page.$eval(
'#tabbar-content > h1 ~ p ~ *',
- (element) => element.tagName
+ (element) => element.tagName,
)
expect(secondElementTagName).toBe('H2')
const thirdElementTagName = await page.$eval(
'#tabbar-content > h1 ~ p ~ *',
- (element) => element.tagName
+ (element) => element.tagName,
)
expect(thirdElementTagName).toBe('H2')
// App should re-render
await page.click(
- '#portal-sidebar-menu ul li a[href*="/uilib/components/"]:first-child'
+ '#portal-sidebar-menu ul li a[href*="/uilib/components/"]:first-child',
)
const reRenderedElementTagName = await page.$eval(
'#tabbar-content > h1 ~ p ~ *',
- (element) => element.tagName
+ (element) => element.tagName,
)
expect(reRenderedElementTagName).toBe('H2')
})
diff --git a/packages/dnb-design-system-portal/src/e2e/pageLists.spec.ts b/packages/dnb-design-system-portal/src/e2e/pageLists.spec.ts
index 5b7792d5a86..8fbcc612f27 100644
--- a/packages/dnb-design-system-portal/src/e2e/pageLists.spec.ts
+++ b/packages/dnb-design-system-portal/src/e2e/pageLists.spec.ts
@@ -20,14 +20,14 @@ test.describe('Page Lists', () => {
test('should have same amount of components', async ({ page }) => {
const listLength = await page
.locator(
- '#portal-sidebar-menu ul li:has(> a[href*="/uilib/components"]) ~ li:is(.l-3, .l-4):has(> a[href*="/components"]):has(> a:not([href*="/fragments"]))'
+ '#portal-sidebar-menu ul li:has(> a[href*="/uilib/components"]) ~ li:is(.l-3, .l-4):has(> a[href*="/components"]):has(> a:not([href*="/fragments"]))',
)
.count()
await expect(
page.locator(
- '#tabbar-content h2:has(a[href*="/uilib/components/"])'
- )
+ '#tabbar-content h2:has(a[href*="/uilib/components/"])',
+ ),
).toHaveCount(listLength)
})
})
@@ -51,14 +51,14 @@ test.describe('Page Lists', () => {
test('should have same amount of extensions', async ({ page }) => {
const listLength = await page
.locator(
- '#portal-sidebar-menu ul li:has(> a[href*="/uilib/extensions"]) ~ li.l-3:has(> a[href*="/uilib/extensions/"])'
+ '#portal-sidebar-menu ul li:has(> a[href*="/uilib/extensions"]) ~ li.l-3:has(> a[href*="/uilib/extensions/"])',
)
.count()
await expect(
page.locator(
- '#tabbar-content h2:has(a[href*="/uilib/extensions/"])'
- )
+ '#tabbar-content h2:has(a[href*="/uilib/extensions/"])',
+ ),
).toHaveCount(listLength)
})
})
@@ -82,13 +82,13 @@ test.describe('Page Lists', () => {
test('should have same amount of elements', async ({ page }) => {
const listLength = await page
.locator(
- '#portal-sidebar-menu ul li.l-2:has(> a[href*="/uilib/elements"]) ~ li:has(> a[href*="/uilib/elements"])'
+ '#portal-sidebar-menu ul li.l-2:has(> a[href*="/uilib/elements"]) ~ li:has(> a[href*="/uilib/elements"])',
)
.count()
await expect(
page.locator(
- '#tabbar-content ul li:has(a[href*="/uilib/elements/"])'
- )
+ '#tabbar-content ul li:has(a[href*="/uilib/elements/"])',
+ ),
).toHaveCount(listLength)
})
})
diff --git a/packages/dnb-design-system-portal/src/e2e/pageNavigation.spec.ts b/packages/dnb-design-system-portal/src/e2e/pageNavigation.spec.ts
index f45991ce891..f654a7eae74 100644
--- a/packages/dnb-design-system-portal/src/e2e/pageNavigation.spec.ts
+++ b/packages/dnb-design-system-portal/src/e2e/pageNavigation.spec.ts
@@ -12,7 +12,7 @@ test.describe('Page Navigation', () => {
test('noscript element should be visible', async ({ page }) => {
await expect(page.locator('noscript').first()).toHaveCSS(
'display',
- 'block'
+ 'block',
)
})
@@ -51,7 +51,7 @@ test.describe('Page Navigation', () => {
expect(heading).toContain('Components')
const accordionLinkText = await page.textContent(
- 'a[href="/uilib/components/accordion"]'
+ 'a[href="/uilib/components/accordion"]',
)
expect(accordionLinkText).toContain('Accordion')
})
@@ -107,7 +107,7 @@ test.describe('Page Navigation', () => {
await element?.click()
await page.click('nav a[href="/uilib/components/button/"]')
await page.click(
- 'main a[href="/uilib/components/button/properties/"]'
+ 'main a[href="/uilib/components/button/properties/"]',
)
await page.waitForURL('**/uilib/components/button/properties/')
await page.waitForSelector('#dnb-drawer-list__portal', {
@@ -136,7 +136,7 @@ test.describe('Page Navigation', () => {
expect(heading).toContain('Components')
const accordionLinkText = await page.textContent(
- 'a[href="/uilib/components/accordion"]'
+ 'a[href="/uilib/components/accordion"]',
)
expect(accordionLinkText).toContain('Accordion')
})
diff --git a/packages/dnb-design-system-portal/src/e2e/responsiveness.spec.ts b/packages/dnb-design-system-portal/src/e2e/responsiveness.spec.ts
index 0c7d862e013..e5696ead4b4 100644
--- a/packages/dnb-design-system-portal/src/e2e/responsiveness.spec.ts
+++ b/packages/dnb-design-system-portal/src/e2e/responsiveness.spec.ts
@@ -16,18 +16,18 @@ test.describe('Responsiveness', () => {
}) => {
await expect(page.locator('nav#portal-sidebar-menu')).toHaveCSS(
'display',
- 'block'
+ 'block',
)
await page.setViewportSize({ width: 375, height: 667 }) // Set viewport size to iPhone 6 dimensions
await expect(page.locator('nav#portal-sidebar-menu')).toHaveCSS(
'display',
- 'none'
+ 'none',
)
await page.click('#toggle-sidebar-menu')
await page.click(
- 'nav#portal-sidebar-menu a[href="/uilib/about-the-lib/"]'
+ 'nav#portal-sidebar-menu a[href="/uilib/about-the-lib/"]',
)
// Check if app is mounted
diff --git a/packages/dnb-design-system-portal/src/e2e/themeSwitch.spec.ts b/packages/dnb-design-system-portal/src/e2e/themeSwitch.spec.ts
index b666d91349a..c753ef48a74 100644
--- a/packages/dnb-design-system-portal/src/e2e/themeSwitch.spec.ts
+++ b/packages/dnb-design-system-portal/src/e2e/themeSwitch.spec.ts
@@ -21,13 +21,13 @@ test.describe('Theme', () => {
test('should have no preload link', async ({ page }) => {
expect(
- await page.locator('link[href^="/ui."][rel="preload"]').count()
+ await page.locator('link[href^="/ui."][rel="preload"]').count(),
).toEqual(0)
})
test('should have one default theme loaded', async ({ page }) => {
expect(await page.locator('style[data-href^="/ui."]').count()).toEqual(
- 1
+ 1,
)
})
@@ -40,11 +40,11 @@ test.describe('Theme', () => {
state: 'attached',
})
expect(await page.locator('link[href^="/sbanken."]').count()).toEqual(
- 1
+ 1,
)
expect(await page.locator('style[data-href^="/ui."]').count()).toEqual(
- 0
+ 0,
)
})
@@ -55,7 +55,7 @@ test.describe('Theme', () => {
const localStorageData = await page.evaluate(() => {
return JSON.parse(
- window.localStorage.getItem('eufemia-theme') || '{}'
+ window.localStorage.getItem('eufemia-theme') || '{}',
)
})
@@ -75,7 +75,7 @@ test.describe('Theme', () => {
})
const uiCssFileCount = await page.$$eval(
'link[href^="/ui."][rel="stylesheet"]',
- (elements) => elements.length
+ (elements) => elements.length,
)
expect(uiCssFileCount).toBe(1)
@@ -89,7 +89,7 @@ test.describe('Theme', () => {
await page.click('#change-theme-portal ul li:nth-child(3)')
const sbankenCssAfterTemplateExists = await page.$(
- '#eufemia-style-theme + link[href^="/sbanken."][rel="stylesheet"]'
+ '#eufemia-style-theme + link[href^="/sbanken."][rel="stylesheet"]',
)
expect(sbankenCssAfterTemplateExists).toBeTruthy()
@@ -97,7 +97,7 @@ test.describe('Theme', () => {
await page.click('#change-theme-portal ul li:first-child')
const uiCssAfterTemplateExists = await page.$(
- '#eufemia-style-theme + link[href^="/ui."][rel="stylesheet"]'
+ '#eufemia-style-theme + link[href^="/ui."][rel="stylesheet"]',
)
expect(uiCssAfterTemplateExists).toBeTruthy()
})
diff --git a/packages/dnb-design-system-portal/src/e2e/typography.spec.ts b/packages/dnb-design-system-portal/src/e2e/typography.spec.ts
index d1efcf97ca1..e550431296f 100644
--- a/packages/dnb-design-system-portal/src/e2e/typography.spec.ts
+++ b/packages/dnb-design-system-portal/src/e2e/typography.spec.ts
@@ -12,7 +12,7 @@ test.afterEach(async ({ page }) => {
test.describe('Typography for UI', () => {
test.beforeEach(async ({ page }) => {
await page.goto(
- '/quickguide-designer/fonts?data-visual-test&eufemia-theme=ui'
+ '/quickguide-designer/fonts?data-visual-test&eufemia-theme=ui',
)
// Check if app is mounted
@@ -99,7 +99,7 @@ test.describe('Typography for UI', () => {
test.describe('Typography for Sbanken', () => {
test.beforeEach(async ({ page }) => {
await page.goto(
- '/quickguide-designer/fonts?data-visual-test&eufemia-theme=sbanken'
+ '/quickguide-designer/fonts?data-visual-test&eufemia-theme=sbanken',
)
// Check if app is mounted
diff --git a/packages/dnb-design-system-portal/src/shared/menu/Card.js b/packages/dnb-design-system-portal/src/shared/menu/Card.js
index 86d57551b5e..5a1b0f68cd3 100644
--- a/packages/dnb-design-system-portal/src/shared/menu/Card.js
+++ b/packages/dnb-design-system-portal/src/shared/menu/Card.js
@@ -39,14 +39,14 @@ export default class Card extends React.PureComponent {
{
acc[slug] = {
url: `/${slug}/`,
@@ -81,7 +81,7 @@ function MainMenu() {
}
return acc
},
- {}
+ {},
)
return (
diff --git a/packages/dnb-design-system-portal/src/shared/menu/SearchBar.js b/packages/dnb-design-system-portal/src/shared/menu/SearchBar.js
index 54e22e5c25d..4160bc7b62e 100644
--- a/packages/dnb-design-system-portal/src/shared/menu/SearchBar.js
+++ b/packages/dnb-design-system-portal/src/shared/menu/SearchBar.js
@@ -40,7 +40,7 @@ export const SearchBarInput = () => {
?.search(value)
.then(({ hits }) => {
updateData(
- makeHitsHumanFriendly({ hits, setHidden, emptyData })
+ makeHitsHumanFriendly({ hits, setHidden, emptyData }),
)
hideIndicator()
})
@@ -49,7 +49,7 @@ export const SearchBarInput = () => {
hideIndicator()
})
},
- { value }
+ { value },
)
showIndicator()
}
@@ -155,7 +155,7 @@ const makeHitsHumanFriendly = ({ hits, setHidden }) => {
}}
>
{value}
-
+ ,
)
}
})
diff --git a/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.tsx b/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.tsx
index a7f47891fe2..111cd64a9cd 100644
--- a/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.tsx
+++ b/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.tsx
@@ -105,7 +105,7 @@ export default function SidebarLayout({
showAll,
pathPrefix,
}),
- location
+ location,
)
.filter(({ title, menuTitle }) => title || menuTitle)
.map(
@@ -122,7 +122,7 @@ export default function SidebarLayout({
isInsideActiveCategory,
subheadings,
},
- nr
+ nr,
) => {
const props = {
level,
@@ -138,7 +138,7 @@ export default function SidebarLayout({
}
return
- }
+ },
)
return (
@@ -149,7 +149,7 @@ export default function SidebarLayout({
navStyle,
'dnb-scrollbar-appearance',
isOpen && 'show-mobile-menu',
- isClosing && 'hide-mobile-menu'
+ isClosing && 'hide-mobile-menu',
)}
ref={scrollRef}
>
@@ -222,7 +222,7 @@ const ThemeBadge = ({ theme, ...props }: { theme: ThemeNames }) => {
@@ -294,7 +294,7 @@ function ListItem({
isInsideActivePath && 'is-inside-active-path',
isInsideActiveCategory && !isInsideActivePath && 'is-inside',
status && `status-${status}`,
- className
+ className,
)}
ref={ref}
style={
@@ -313,7 +313,7 @@ function ListItem({
'dnb-anchor--no-underline',
'dnb-anchor--no-radius',
'dnb-anchor--no-hover',
- icon && graphics[icon] ? 'has-icon' : null
+ icon && graphics[icon] ? 'has-icon' : null,
)}
{...params}
>
@@ -383,7 +383,7 @@ const prepareNav = ({
node: {
fields: { slug },
},
- }) => slug
+ }) => slug,
)
.filter((slug) => slug !== '/')
// preorder
@@ -416,7 +416,7 @@ const prepareNav = ({
}
}
},
- { items: [] }
+ { items: [] },
)
let countLevels = 0
@@ -437,7 +437,7 @@ const prepareNav = ({
node: {
fields: { slug },
},
- }) => slug === slugPath
+ }) => slug === slugPath,
)
const level = slug.split('/').filter(Boolean).length
@@ -484,7 +484,7 @@ const prepareNav = ({
list
// reorder regarding potential manually defined order
.sort(({ _order: oA }, { _order: oB }) =>
- oA < oB ? -1 : oA > oB ? 1 : 0
+ oA < oB ? -1 : oA > oB ? 1 : 0,
)
return list
@@ -553,7 +553,7 @@ function groupNavItems(navItems: NavItem[], location: Location) {
function getActiveStatusForItem(
currentPath: string,
- { path: itemPath, showTabs, tabs }: NavItem
+ { path: itemPath, showTabs, tabs }: NavItem,
) {
const portalSlug = itemPath.split('/').filter(Boolean)[0] ?? ''
const categorySlug = itemPath.split('/').filter(Boolean)[1] ?? ''
@@ -564,13 +564,13 @@ function getActiveStatusForItem(
const isInsideActivePath = checkIfActivePath(
currentPath,
itemPath,
- isActive
+ isActive,
)
const isInsideActiveCategory = checkIfActiveCategory(
currentPath,
startOfCurrentPath,
- isInsideActivePath
+ isInsideActivePath,
)
return { isActive, isInsideActiveCategory, isInsideActivePath }
@@ -579,7 +579,7 @@ function getActiveStatusForItem(
function checkIfActiveCategory(
currentPath: string,
startOfCurrentPath: string,
- isInsideActivePath?: boolean
+ isInsideActivePath?: boolean,
) {
return (
!isInsideActivePath &&
@@ -590,7 +590,7 @@ function checkIfActiveCategory(
function checkIfActivePath(
currentPath: string,
itemPath: string,
- isActive?: boolean
+ isActive?: boolean,
) {
return !isActive && (currentPath + '/').startsWith(itemPath + '/')
}
@@ -599,7 +599,7 @@ function checkIfActiveItem(
currentPath: string,
itemPath: string,
showTabs?: boolean,
- tabs?: NavItemTabs[]
+ tabs?: NavItemTabs[],
): boolean {
if (!showTabs) {
return itemPath === currentPath
@@ -618,7 +618,7 @@ function checkIfActiveItem(
const lastSlug = slugs[slugs.length - 1]
const currentPathWithoutTabSlug = currentPath.replace(
`/${lastSlug}`,
- ''
+ '',
)
if (itemPath === currentPathWithoutTabSlug) {
diff --git a/packages/dnb-design-system-portal/src/shared/menu/SidebarMenuContext.js b/packages/dnb-design-system-portal/src/shared/menu/SidebarMenuContext.js
index 0abec7fa157..b899f74ad96 100644
--- a/packages/dnb-design-system-portal/src/shared/menu/SidebarMenuContext.js
+++ b/packages/dnb-design-system-portal/src/shared/menu/SidebarMenuContext.js
@@ -64,7 +64,7 @@ export class SidebarMenuProvider extends React.PureComponent {
}
}, 100) // after animation is done
},
- this.state.isOpen ? 260 : 10
+ this.state.isOpen ? 260 : 10,
)
if (this.state.isOpen) {
this.setState({
diff --git a/packages/dnb-design-system-portal/src/shared/menu/StickyMenuBar.js b/packages/dnb-design-system-portal/src/shared/menu/StickyMenuBar.js
index 6ddf80c3544..e2c3a89e819 100644
--- a/packages/dnb-design-system-portal/src/shared/menu/StickyMenuBar.js
+++ b/packages/dnb-design-system-portal/src/shared/menu/StickyMenuBar.js
@@ -56,7 +56,7 @@ export default function StickyMenuBar({
headerStyle,
hideSidebarToggleButton && hideSidebarToggleButtonStyle,
'sticky-menu',
- 'dev-grid'
+ 'dev-grid',
)}
>
@@ -80,7 +80,7 @@ export default function StickyMenuBar({
{slogan}
diff --git a/packages/dnb-design-system-portal/src/shared/menu/ToggleGrid.tsx b/packages/dnb-design-system-portal/src/shared/menu/ToggleGrid.tsx
index 1fed63744e6..1520746ee56 100644
--- a/packages/dnb-design-system-portal/src/shared/menu/ToggleGrid.tsx
+++ b/packages/dnb-design-system-portal/src/shared/menu/ToggleGrid.tsx
@@ -20,7 +20,7 @@ function makeGridVisible(showGrid = true) {
function isGridVisible() {
return Boolean(
typeof window !== 'undefined' &&
- parseFloat(window.localStorage.getItem('showGrid'))
+ parseFloat(window.localStorage.getItem('showGrid')),
)
}
diff --git a/packages/dnb-design-system-portal/src/shared/parts/Layout.tsx b/packages/dnb-design-system-portal/src/shared/parts/Layout.tsx
index b09fd1d1a37..eb8997614b5 100644
--- a/packages/dnb-design-system-portal/src/shared/parts/Layout.tsx
+++ b/packages/dnb-design-system-portal/src/shared/parts/Layout.tsx
@@ -148,7 +148,7 @@ const Content = ({
contentStyle,
'dnb-app-content',
fullscreen && 'fullscreen-page',
- className
+ className,
)}
>
{children}
diff --git a/packages/dnb-design-system-portal/src/shared/parts/ListSummaryFromEdges.tsx b/packages/dnb-design-system-portal/src/shared/parts/ListSummaryFromEdges.tsx
index 0ee43a883f6..e77d487a882 100644
--- a/packages/dnb-design-system-portal/src/shared/parts/ListSummaryFromEdges.tsx
+++ b/packages/dnb-design-system-portal/src/shared/parts/ListSummaryFromEdges.tsx
@@ -37,7 +37,7 @@ export default function ListSummaryFromEdges({
fields: { slug },
},
},
- i
+ i,
) => {
return (
@@ -64,7 +64,7 @@ export default function ListSummaryFromEdges({
>
)
}
- }
+ },
)
return <>{jsx}>
diff --git a/packages/dnb-design-system-portal/src/shared/parts/TableOfContents.tsx b/packages/dnb-design-system-portal/src/shared/parts/TableOfContents.tsx
index 55a9ef77cf3..d18412db763 100644
--- a/packages/dnb-design-system-portal/src/shared/parts/TableOfContents.tsx
+++ b/packages/dnb-design-system-portal/src/shared/parts/TableOfContents.tsx
@@ -21,7 +21,7 @@ type TableOfContentsProps = {
const TableOfContents = ({ edges }: TableOfContentsProps) => {
const orderedContents = edges
.sort((edgeA, edgeB) =>
- edgeA.node.frontmatter.order > edgeB.node.frontmatter.order ? 1 : -1
+ edgeA.node.frontmatter.order > edgeB.node.frontmatter.order ? 1 : -1,
)
.map(({ node }) => node.tableOfContents.items)
.reduce>((allContent, currentContent) => {
diff --git a/packages/dnb-design-system-portal/src/shared/parts/icons/ListAllIcons.js b/packages/dnb-design-system-portal/src/shared/parts/icons/ListAllIcons.js
index bea225fe560..1c98060499b 100644
--- a/packages/dnb-design-system-portal/src/shared/parts/icons/ListAllIcons.js
+++ b/packages/dnb-design-system-portal/src/shared/parts/icons/ListAllIcons.js
@@ -116,9 +116,7 @@ export default class ListAllIcons extends React.PureComponent {
element="figcaption"
useSlug={iconName}
>
-
- {iconName}
-
+ {iconName}
{tags.length > 0 ? tags.join(', ') : '(no tags)'}
@@ -142,7 +140,7 @@ export default class ListAllIcons extends React.PureComponent {
{this.renderListItem(icons)}
- )
+ ),
)
} else {
return (
diff --git a/packages/dnb-design-system-portal/src/shared/tags/CodeBlock.tsx b/packages/dnb-design-system-portal/src/shared/tags/CodeBlock.tsx
index 8b4ffa0b1cc..1a00bc4e239 100644
--- a/packages/dnb-design-system-portal/src/shared/tags/CodeBlock.tsx
+++ b/packages/dnb-design-system-portal/src/shared/tags/CodeBlock.tsx
@@ -46,7 +46,7 @@ const CodeBlock = ({
@@ -68,7 +68,7 @@ const CodeBlock = ({
@@ -211,7 +211,7 @@ class LiveCode extends React.PureComponent<
@@ -227,14 +227,14 @@ class LiveCode extends React.PureComponent<
onFocus={() => {
if (this._editorElementRef.current) {
this._editorElementRef.current.classList.add(
- 'dnb-pre--focus'
+ 'dnb-pre--focus',
)
}
}}
onBlur={() => {
if (this._editorElementRef.current) {
this._editorElementRef.current.classList.remove(
- 'dnb-pre--focus'
+ 'dnb-pre--focus',
)
}
}}
diff --git a/packages/dnb-design-system-portal/src/shared/tags/Tabbar.tsx b/packages/dnb-design-system-portal/src/shared/tags/Tabbar.tsx
index 83857e020f2..c7a365e8694 100644
--- a/packages/dnb-design-system-portal/src/shared/tags/Tabbar.tsx
+++ b/packages/dnb-design-system-portal/src/shared/tags/Tabbar.tsx
@@ -38,7 +38,7 @@ export default function Tabbar({
children,
}: TabbarProps) {
const [wasFullscreen, setFullscreen] = React.useState(
- /fullscreen/.test(location.search)
+ /fullscreen/.test(location.search),
)
const openFullscreen = () => {
@@ -74,7 +74,7 @@ export default function Tabbar({
(tabs || defaultTabs)
// remove the tab if it is hidden in frontmatter
.filter(
- ({ title }) => !hideTabs?.find(({ title: t }) => t === title)
+ ({ title }) => !hideTabs?.find(({ title: t }) => t === title),
)
.map(({ key, ...rest }) => {
const search = cleanFullscreen(location.search)
diff --git a/packages/dnb-design-system-portal/src/shared/tags/Table.tsx b/packages/dnb-design-system-portal/src/shared/tags/Table.tsx
index 2b2a5686f18..fff5588d983 100644
--- a/packages/dnb-design-system-portal/src/shared/tags/Table.tsx
+++ b/packages/dnb-design-system-portal/src/shared/tags/Table.tsx
@@ -18,7 +18,7 @@ export default function Table({ children }) {
// make sure we get the table children
children =
recursiveFind(children, (child: React.ReactElement) =>
- child.type === 'table' ? child.props.children : false
+ child.type === 'table' ? child.props.children : false,
) || children
children = recursiveMap(
@@ -46,7 +46,7 @@ export default function Table({ children }) {
}
return child
- }
+ },
)
return (
@@ -84,7 +84,7 @@ function recursiveFind(children: ChildrenWithChildren, func) {
function recursiveMap(
children: ChildrenWithChildren,
- func = null
+ func = null,
): Array {
return React.Children.map(children, (child: React.ReactNode) => {
if (!React.isValidElement(child)) {
@@ -95,7 +95,7 @@ function recursiveMap(
child = React.cloneElement(
child,
null,
- recursiveMap(child.props.children, func)
+ recursiveMap(child.props.children, func),
)
}
diff --git a/packages/dnb-design-system-portal/src/uilib/search/__tests__/searchQuery.test.ts b/packages/dnb-design-system-portal/src/uilib/search/__tests__/searchQuery.test.ts
index dea6a48a134..b73ee7a3416 100644
--- a/packages/dnb-design-system-portal/src/uilib/search/__tests__/searchQuery.test.ts
+++ b/packages/dnb-design-system-portal/src/uilib/search/__tests__/searchQuery.test.ts
@@ -22,7 +22,9 @@ describe('searchQuery', () => {
it('should skip node when no title is found', () => {
expect(
- transformer(makeNode({ fields: { slug: '/page' }, frontmatter: {} }))
+ transformer(
+ makeNode({ fields: { slug: '/page' }, frontmatter: {} }),
+ ),
).toHaveLength(0)
})
@@ -32,8 +34,8 @@ describe('searchQuery', () => {
makeNode({
fields: { slug: '/page' },
frontmatter: { skipSearch: true },
- })
- )
+ }),
+ ),
).toHaveLength(0)
})
@@ -44,8 +46,8 @@ describe('searchQuery', () => {
fields: { slug: '/page' },
frontmatter: {},
headings: [{ value: 'Heading 1', depth: 1 }],
- })
- )
+ }),
+ ),
).toEqual([{ headings: [], slug: '/page', title: 'Heading 1' }])
})
@@ -59,8 +61,8 @@ describe('searchQuery', () => {
{ value: 'Heading 1', depth: 1 },
{ value: 'Heading 2', depth: 2 },
],
- })
- )
+ }),
+ ),
).toEqual([
{
slug: '/page',
@@ -88,8 +90,8 @@ describe('searchQuery', () => {
fields: { slug: '/page' },
frontmatter: { search: 'search string' },
headings: [{ value: 'Heading 1', depth: 1 }],
- })
- )
+ }),
+ ),
).toEqual([
{
slug: '/page',
@@ -120,8 +122,8 @@ describe('searchQuery', () => {
headings: [{ value: 'Heading 2', depth: 1 }],
},
],
- })
- )
+ }),
+ ),
).toEqual([
{
category: {
@@ -153,8 +155,8 @@ describe('searchQuery', () => {
headings: [{ value: 'Heading 2', depth: 1 }],
},
],
- })
- )
+ }),
+ ),
).toEqual([
{
category: {
@@ -186,8 +188,8 @@ describe('searchQuery', () => {
headings: [{ value: 'Heading 1', depth: 1 }],
},
],
- })
- )
+ }),
+ ),
).toEqual([
{
category: {
diff --git a/packages/dnb-design-system-portal/src/uilib/search/remark-headings-plugin.js b/packages/dnb-design-system-portal/src/uilib/search/remark-headings-plugin.js
index 6091913f9af..37befb2dc78 100644
--- a/packages/dnb-design-system-portal/src/uilib/search/remark-headings-plugin.js
+++ b/packages/dnb-design-system-portal/src/uilib/search/remark-headings-plugin.js
@@ -61,7 +61,7 @@ function makeHeadingsResolver({
reporter,
cache,
store,
- }
+ },
)
if (!result) {
diff --git a/packages/dnb-design-system-portal/src/uilib/search/searchHelpers.js b/packages/dnb-design-system-portal/src/uilib/search/searchHelpers.js
index 97bb616f7b3..9dcb13c0253 100644
--- a/packages/dnb-design-system-portal/src/uilib/search/searchHelpers.js
+++ b/packages/dnb-design-system-portal/src/uilib/search/searchHelpers.js
@@ -16,7 +16,7 @@ const getIndexName = (currentBranch) => {
const runQueriesWhen = (currentBranch) => {
if ((process.env.ALGOLIA_API_KEY || '').length === 0) {
console.info(
- 'If you want to submit searchable data to Algolia, you need to request access keys and put them in a local .env file.'
+ 'If you want to submit searchable data to Algolia, you need to request access keys and put them in a local .env file.',
)
return false
}
diff --git a/packages/dnb-design-system-portal/src/uilib/search/searchQuery.js b/packages/dnb-design-system-portal/src/uilib/search/searchQuery.js
index 5a3cbde16db..02ebb33a863 100644
--- a/packages/dnb-design-system-portal/src/uilib/search/searchQuery.js
+++ b/packages/dnb-design-system-portal/src/uilib/search/searchQuery.js
@@ -51,7 +51,7 @@ const flatten = (arr) =>
fields: { slug },
frontmatter: { skipSearch },
},
- }) => !slug.includes('not_in_use') && skipSearch !== true
+ }) => !slug.includes('not_in_use') && skipSearch !== true,
)
.map(
({
@@ -91,7 +91,7 @@ const flatten = (arr) =>
const category = siblings
.reverse()
.find(({ fields: { slug: _slug } }) =>
- slug.includes(_slug)
+ slug.includes(_slug),
)
let newTitle = null
@@ -149,7 +149,7 @@ const flatten = (arr) =>
}
return result
- }
+ },
)
.filter(Boolean)
diff --git a/packages/dnb-eufemia/.lintstagedrc b/packages/dnb-eufemia/.lintstagedrc
index 37b5c0c0eb7..a987171161f 100644
--- a/packages/dnb-eufemia/.lintstagedrc
+++ b/packages/dnb-eufemia/.lintstagedrc
@@ -1,6 +1,5 @@
{
- "*.js": [
- "yarn prettier:js:staged",
+ "*.{js,ts,tsx}": [
"yarn lint:js:staged"
],
"*.scss": [
@@ -10,7 +9,7 @@
"yarn lint:styles:staged",
"yarn test:staged"
],
- "*.{json,md}": [
+ "*.{json,md,mdx}": [
"yarn prettier:other"
]
}
diff --git a/packages/dnb-eufemia/.prettierrc b/packages/dnb-eufemia/.prettierrc
index 5490f6ff104..071343de25c 100644
--- a/packages/dnb-eufemia/.prettierrc
+++ b/packages/dnb-eufemia/.prettierrc
@@ -6,7 +6,7 @@
"useTabs": false,
"semi": false,
"bracketSameLine": false,
- "trailingComma": "es5",
+ "trailingComma": "all",
"overrides": [
{
"files": "*.d.ts",
diff --git a/packages/dnb-eufemia/package.json b/packages/dnb-eufemia/package.json
index 2b95091c3e5..dd797624511 100644
--- a/packages/dnb-eufemia/package.json
+++ b/packages/dnb-eufemia/package.json
@@ -25,11 +25,9 @@
"postbuild:ci": "./scripts/postbuild/postbuild.sh",
"build:cjs": "./scripts/postbuild/babel-cjs.sh",
"build:clean": "rm -rf build",
- "postbuild:commit": "babel-node --extensions .js,.ts,.tsx ./scripts/figma/tasks/commitChanges",
"build:copy": "./scripts/postbuild/copy-build-artifacts.sh",
"build:es": "./scripts/postbuild/babel-es.sh",
"build:esm": "./scripts/postbuild/babel-esm.sh",
- "prebuild:figma:ci": "yarn figma",
"build:pack": "yarn build && yarn publish:prepare && cd ./build && yarn pack",
"build:packages": "./scripts/postbuild/build-packages.sh",
"build:prebuild": "babel-node --extensions .js,.ts,.tsx ./scripts/prebuild/runPrepub",
@@ -39,7 +37,6 @@
"build:types:docs": "./scripts/prebuild/generate-types-docs.sh",
"build:types:esm": "yarn tsc --project tsconfig.definitions.json --declarationDir ./build/esm --rootDir src",
"build:types:generate": "./scripts/prebuild/generate-types.sh",
- "precommit": "yarn lint-staged",
"dev:packages": "nodemon --exec 'yarn build:packages && yarn build:copy' --ext js,html,json,css,scss --watch './src/**/*' --ignore './umd/*'",
"dev:resources": "nodemon --exec 'babel-node --extensions .js,.ts,.tsx ./scripts/prebuild/resources/makeResourcesPackage' --ext js,html,json,css,scss --watch './build/style/**/*' --watch './scripts/**/*' --ignore '*.json'",
"dev:tasks": "nodemon --exec 'babel-node --extensions .js,.ts,.tsx ./scripts/prebuild/dev' --watch 'rollup.config.js' --ext ts,js,html,json,css,scss --watch './src/components/**/*' --watch './scripts/**/*' --ignore '*.json'",
@@ -48,48 +45,54 @@
"figma:icons:dev": "nodemon --exec 'babel-node --extensions .js,.ts,.tsx ./scripts/figma/updateIcons' --ignore '*.svg' --ignore '*.json'",
"figma:refetch": "yarn figma --force-refetch",
"figma:reset": "babel-node --extensions .js,.ts,.tsx ./scripts/figma/resetIcons && babel-node --extensions .js,.ts,.tsx ./scripts/tools/convertIcons",
- "icons:dev": "nodemon --exec 'babel-node --extensions .js,.ts,.tsx ./scripts/tools/convertIcons' --ext ts --ignore '/icons/**' --ignore '*.json'",
"icons:convert": "babel-node --extensions .js,.ts,.tsx ./scripts/tools/convertIcons && babel-node --extensions .js,.ts,.tsx ./scripts/figma/updateIcons",
- "jest": "cross-env NODE_ICU_DATA=../../node_modules/full-icu jest",
+ "icons:dev": "nodemon --exec 'babel-node --extensions .js,.ts,.tsx ./scripts/tools/convertIcons' --ext ts --ignore '/icons/**' --ignore '*.json'",
+ "jest": "cross-env NODE_ICU_DATA=../../node_modules/full-icu NODE_OPTIONS=--experimental-vm-modules jest",
"lint": "eslint --quiet ./src ./scripts",
- "lint-staged": "lint-staged -d",
- "lint:ci": "yarn lint:js && yarn lint:styles",
+ "lint:ci": "yarn lint:js && yarn lint:styles && yarn prettier:diff && yarn prettier:package",
"lint:ci-needs-to-be-used-when-lint:lockfile-works": "yarn lint:lockfile && yarn lint:js && yarn lint:styles",
"lint:js": "yarn lint --fix",
"lint:js:staged": "eslint --quiet --fix",
"lint:lockfile": "yarn lockfile-lint --path ../../yarn.lock --type yarn --validate-https --allowed-hosts yarn github.com codeload.github.com",
"lint:styles": "stylelint './src/**/*{.stories.*,.scss}'",
"lint:styles:staged": "stylelint './src/**/*{.stories.*,.scss}'",
+ "lint-staged": "lint-staged -d",
"make-properties": "babel-node --extensions .js,.ts,.tsx ./scripts/prebuild/makeProperties",
+ "postbuild:commit": "babel-node --extensions .js,.ts,.tsx ./scripts/figma/tasks/commitChanges",
+ "prebuild:figma:ci": "yarn figma",
+ "precommit": "yarn lint-staged",
+ "prettier:diff": "prettier --list-different '{scripts,src}/**/*.{md,mdx,js,ts,tsx}'",
+ "prettier:js:staged": "prettier --config ./.prettierrc --log-level warn '{scripts,src}/**/*.{js,ts,tsx}'",
+ "prettier:js:write": "prettier --log-level warn --write '{scripts,src}/**/*.{js,ts,tsx}'",
+ "prettier:other": "prettier --log-level warn './src/**/*.{json,md,mdx}' && yarn prettier:package",
+ "prettier:other:staged": "prettier --log-level warn './**/*.{json,md,mdx}'",
+ "prettier:other:write": "prettier --log-level warn --write './src/**/*.{json,md,mdx}' && yarn prettier:package",
+ "prettier:package": "prettier-package-json --list-different ./package.json",
+ "prettier:package:write": "prettier-package-json --write ./package.json",
+ "prettier:styles:staged": "prettier --log-level warn --parser scss './src/**/*.scss'",
+ "prettier:styles:write": "prettier --log-level warn --parser scss --write './src/**/*.scss'",
+ "prettier:write": "yarn prettier:js:write && yarn prettier:styles:write",
"publish:ci": "yarn publish:prepare && ./scripts/postbuild/publish-release.sh",
"publish:dry": "dotenv semantic-release --no-ci --dry-run",
"publish:prepare": "./scripts/postbuild/publish-prepare.sh",
"reset": "rm -rf ./node_modules ./build",
"skeleton:font": "nodemon --exec 'babel-node --extensions .js,.ts,.tsx ./scripts/tools/createSkeletonFont.js'",
"start": "storybook dev -s / -p 8002 --ci --no-release-notes --no-version-updates",
- "test": "jest",
- "test:auto-generated-types": "jest ./postTypeGeneration.test.ts --ci --testPathIgnorePatterns=[]",
- "test:ci": "jest --ci",
- "test:postbuild": "jest ./postbuild.test.ts --ci --testPathIgnorePatterns=[]",
- "test:screenshots": "jest --config=./jest.config.screenshots.js --maxWorkers=1 --detectOpenHandles --testPathPattern ",
- "test:screenshots:ci": "jest --config=./jest.config.screenshots.js --ci --bail --maxWorkers=1",
+ "test": "yarn jest",
+ "test:auto-generated-types": "yarn jest ./postTypeGeneration.test.ts --ci --testPathIgnorePatterns=[]",
+ "test:ci": "yarn jest --ci",
+ "test:postbuild": "yarn jest ./postbuild.test.ts --ci --testPathIgnorePatterns=[]",
+ "test:screenshots": "yarn jest --config=./jest.config.screenshots.js --maxWorkers=1 --detectOpenHandles --testPathPattern ",
+ "test:screenshots:ci": "yarn jest --config=./jest.config.screenshots.js --ci --bail --maxWorkers=1",
"test:screenshots:ci:update": "yarn test:screenshots:ci --maxWorkers=1 --updateSnapshot",
"test:screenshots:reset": "find . -name '*.snap.png' -type f|xargs rm -f && yarn test:screenshots",
- "test:screenshots:update": "jest --config=./jest.config.screenshots.js --maxWorkers=1 --updateSnapshot --testPathPattern ",
+ "test:screenshots:update": "yarn jest --config=./jest.config.screenshots.js --maxWorkers=1 --updateSnapshot --testPathPattern ",
"test:screenshots:watch": "JEST_IMAGE_SNAPSHOT_TRACK_OBSOLETE=1 jest --config=./jest.config.screenshots.js --watchAll --detectOpenHandles --testPathPattern ",
- "test:staged": "jest --bail --findRelatedTests ",
+ "test:staged": "yarn jest --bail --findRelatedTests ",
"test:types": "tsc --noEmit",
"test:types:watch": "tsc --noEmit --watch",
- "test:update": "jest --updateSnapshot",
- "test:watch": "jest --watchAll --testPathPattern ",
- "prettier:diff": "prettier --list-different '{scripts,src}/**/*.{md,js}'",
- "prettier:js": "prettier --loglevel warn --write '{scripts,src}/**/*.js'",
- "prettier:js:staged": "prettier --config ./.prettierrc --loglevel warn",
- "prettier:other": "prettier --loglevel warn --write './src/**/*.{json,md}' && yarn prettier:package",
- "prettier:other:staged": "prettier --loglevel warn",
- "prettier:package": "prettier-package-json --write ./package.json",
- "prettier:styles": "prettier --loglevel warn --parser scss --write './src/**/*.scss'",
- "prettier:styles:staged": "prettier --loglevel warn --parser scss"
+ "test:update": "yarn jest --updateSnapshot",
+ "test:watch": "yarn jest --watchAll --testPathPattern "
},
"sideEffects": [
"*.css",
@@ -191,7 +194,7 @@
"eslint": "8.17.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jsx-a11y": "6.5.1",
- "eslint-plugin-prettier": "4.0.0",
+ "eslint-plugin-prettier": "5.0.0",
"eslint-plugin-react": "7.30.0",
"eslint-plugin-react-hooks": "4.5.0",
"eslint-plugin-security": "1.5.0",
@@ -228,8 +231,8 @@
"postcss": "8.3.11",
"postcss-calc": "8.0.0",
"postcss-preset-env": "6.7.0",
- "prettier": "2.4.1",
- "prettier-package-json": "2.6.0",
+ "prettier": "3.0.3",
+ "prettier-package-json": "2.8.0",
"process": "0.11.10",
"prop-types": "15.7.2",
"react": "18.2.0",
diff --git a/packages/dnb-eufemia/scripts/figma/FigmaAPI.ts b/packages/dnb-eufemia/scripts/figma/FigmaAPI.ts
index b419e13cc1a..86f72d3f9a8 100644
--- a/packages/dnb-eufemia/scripts/figma/FigmaAPI.ts
+++ b/packages/dnb-eufemia/scripts/figma/FigmaAPI.ts
@@ -24,7 +24,7 @@ export const fetchFigmaIcons = async ({
}: FetchFigmaIconsOptions = {}) => {
if (!figmaFile) {
return log.info(
- '> Figma: No "FIGMA_ICONS_FILE" defined, skipped to run fetchFigmaIcons'
+ '> Figma: No "FIGMA_ICONS_FILE" defined, skipped to run fetchFigmaIcons',
)
}
diff --git a/packages/dnb-eufemia/scripts/figma/helpers/__tests__/docHelpers.test.js b/packages/dnb-eufemia/scripts/figma/helpers/__tests__/docHelpers.test.js
index 7894c96772b..d168e446882 100644
--- a/packages/dnb-eufemia/scripts/figma/helpers/__tests__/docHelpers.test.js
+++ b/packages/dnb-eufemia/scripts/figma/helpers/__tests__/docHelpers.test.js
@@ -30,11 +30,11 @@ describe('FigmaDoc', () => {
expect(start).toHaveBeenCalledTimes(1)
expect(start).toHaveBeenCalledWith(
- expect.stringContaining('Fetching the figma doc')
+ expect.stringContaining('Fetching the figma doc'),
)
expect(succeed).toHaveBeenCalledTimes(1)
expect(succeed).toHaveBeenCalledWith(
- expect.stringContaining('Using old Figma document')
+ expect.stringContaining('Using old Figma document'),
)
})
})
diff --git a/packages/dnb-eufemia/scripts/figma/helpers/docHelpers.js b/packages/dnb-eufemia/scripts/figma/helpers/docHelpers.js
index 5188f3d1b9b..4d8b73a8f08 100644
--- a/packages/dnb-eufemia/scripts/figma/helpers/docHelpers.js
+++ b/packages/dnb-eufemia/scripts/figma/helpers/docHelpers.js
@@ -58,7 +58,7 @@ export const fetchColors = (fills) => {
})
.reduce((acc, c) => {
acc.push(
- Color([c.r * 255, c.g * 255, c.b * 255, c.a]).hex()
+ Color([c.r * 255, c.g * 255, c.b * 255, c.a]).hex(),
// .rgb()
// .string()
)
@@ -80,7 +80,7 @@ export const findAll = (
childrenKey,
objToFindBy,
objToIgnoreBy = null,
- findFirst = false
+ findFirst = false,
) => {
const objToReturn = []
if (!tree) return objToReturn
@@ -100,12 +100,12 @@ export const findAll = (
// )
// make sure we match all
const findSuccess = findKeys.every((key) =>
- isEqualWith(tree[key], objToFindBy[key], customizer)
+ isEqualWith(tree[key], objToFindBy[key], customizer),
)
if (objToIgnoreBy) {
const ignoreKeys = Object.keys(objToIgnoreBy)
ignoreSuccess = ignoreKeys.some((key) =>
- isEqualWith(tree[key], objToIgnoreBy[key], customizer)
+ isEqualWith(tree[key], objToIgnoreBy[key], customizer),
)
}
if (findSuccess && !ignoreSuccess) {
@@ -165,7 +165,7 @@ const saveLiveVersionOfFigmaDoc = async ({ figmaFile, version }) => {
JSON.stringify({
...existingLockFileContent,
...newLockFileContent,
- })
+ }),
)
} catch (e) {
log.fail('Could not create a new "version.lock" file', e)
@@ -196,7 +196,7 @@ export const getFigmaDoc = async ({
!localFile
) {
ErrorHandler(
- 'No Figma file defined. Make sure there is a .env file with a valid "figmaFile" defined!'
+ 'No Figma file defined. Make sure there is a .env file with a valid "figmaFile" defined!',
)
}
@@ -229,17 +229,17 @@ export const getFigmaDoc = async ({
const localVersion = await getLocalVersionFromLockFile({ figmaFile })
log.info(
- `> Figma: Comparing old vs new version. (local version is ${localVersion})`
+ `> Figma: Comparing old vs new version. (local version is ${localVersion})`,
)
if (localVersion === liveVersion) {
log.succeed(
- `> Figma: No newer version available. Both the local and online versions are ${liveVersion}`
+ `> Figma: No newer version available. Both the local and online versions are ${liveVersion}`,
)
return false
} else {
log.succeed(
- `> Figma: There is a new version available: ${liveVersion}`
+ `> Figma: There is a new version available: ${liveVersion}`,
)
await saveLiveVersionOfFigmaDoc({
figmaFile,
@@ -270,7 +270,7 @@ export const getFigmaDoc = async ({
ErrorHandler(
'Failed to client.file(figmaFile) and write the result with writeFile',
e,
- ERROR_HARMLESS
+ ERROR_HARMLESS,
)
}
} else {
@@ -312,7 +312,7 @@ export const getFigmaUrlByImageIds = async ({
export const streamToDisk = (
{ file = '.tmp/file.json', url },
- { errorExceptionType = ERROR_HARMLESS }
+ { errorExceptionType = ERROR_HARMLESS },
) =>
new Promise((resolve, reject) => {
const streamHandler = ({ localFile, oldContent = null }) => {
@@ -325,8 +325,8 @@ export const streamToDisk = (
ErrorHandler(
'Failed on createWriteStream',
err,
- errorExceptionType
- )
+ errorExceptionType,
+ ),
)
})
.on('finish', async () => {
@@ -337,7 +337,7 @@ export const streamToDisk = (
if (isEmpty) {
ErrorHandler(
- `streamToDisk failed because the stream did not end with content by using the url: ${url}`
+ `streamToDisk failed because the stream did not end with content by using the url: ${url}`,
)
}
@@ -362,12 +362,16 @@ export const streamToDisk = (
await fs.unlink(localFile)
} catch (err) {
reject(
- ErrorHandler('Failed on unlink', err, errorExceptionType)
+ ErrorHandler('Failed on unlink', err, errorExceptionType),
)
}
reject(
- ErrorHandler('Failed on streamToDisk', err, errorExceptionType)
+ ErrorHandler(
+ 'Failed on streamToDisk',
+ err,
+ errorExceptionType,
+ ),
)
})
}
@@ -381,7 +385,7 @@ export const streamToDisk = (
? fs.readFile(localFile, 'utf-8', (err, oldContent) => {
if (err) {
reject(
- ErrorHandler('Failed on readFile', err, errorExceptionType)
+ ErrorHandler('Failed on readFile', err, errorExceptionType),
)
}
diff --git a/packages/dnb-eufemia/scripts/figma/resetIcons.ts b/packages/dnb-eufemia/scripts/figma/resetIcons.ts
index b74374554e9..8a86dd7e21f 100644
--- a/packages/dnb-eufemia/scripts/figma/resetIcons.ts
+++ b/packages/dnb-eufemia/scripts/figma/resetIcons.ts
@@ -19,14 +19,14 @@ export const runFigmaReset = async () => {
}
const svgLockFile = path.resolve(
__dirname,
- '../../src/icons/icons-svg.lock'
+ '../../src/icons/icons-svg.lock',
)
if (fs.existsSync(svgLockFile)) {
await fs.unlink(svgLockFile)
}
const pdfLockFile = path.resolve(
__dirname,
- '../../src/icons/icons-pdf.lock'
+ '../../src/icons/icons-pdf.lock',
)
if (fs.existsSync(pdfLockFile)) {
await fs.unlink(pdfLockFile)
@@ -44,5 +44,5 @@ runFigmaReset().then(() =>
ignoreBranchCheck: true,
}).then(() => {
log.succeed('Resetting Figma is done')
- })
+ }),
)
diff --git a/packages/dnb-eufemia/scripts/figma/tasks/__tests__/assetsExtractors.test.ts b/packages/dnb-eufemia/scripts/figma/tasks/__tests__/assetsExtractors.test.ts
index 5f7c52bdbb3..9adffb4abb4 100644
--- a/packages/dnb-eufemia/scripts/figma/tasks/__tests__/assetsExtractors.test.ts
+++ b/packages/dnb-eufemia/scripts/figma/tasks/__tests__/assetsExtractors.test.ts
@@ -16,10 +16,10 @@ import {
} from '../assetsExtractors'
const localFile = require.resolve(
- '../../helpers/__tests__/files/FigmaTestDoc.json'
+ '../../helpers/__tests__/files/FigmaTestDoc.json',
)
const iconsLockFile = require.resolve(
- '../../helpers/__tests__/files/icons-svg.lock'
+ '../../helpers/__tests__/files/icons-svg.lock',
)
afterEach(() => {
@@ -164,7 +164,7 @@ describe('assetsExtractors', () => {
expect(config).toHaveProperty('imageUrlExpireAfterDays')
expect(config).toHaveProperty('destDir')
expect(config.iconsLockFile).toContain(
- 'packages/dnb-eufemia/src/icons/icons-svg.lock'
+ 'packages/dnb-eufemia/src/icons/icons-svg.lock',
)
expect(config.destDir).toContain('/packages/dnb-eufemia/assets/icons')
})
@@ -206,18 +206,18 @@ describe('assetsExtractors', () => {
expect(fs.rmdir).toHaveBeenNthCalledWith(
1,
expect.stringContaining(
- '/packages/dnb-eufemia/assets/icons/dnb/objects'
- )
+ '/packages/dnb-eufemia/assets/icons/dnb/objects',
+ ),
)
expect(runCommand).toHaveBeenCalledTimes(1)
expect(runCommand).toHaveBeenNthCalledWith(
1,
- expect.stringContaining('yarn vd-tool -c -in')
+ expect.stringContaining('yarn vd-tool -c -in'),
)
expect(runCommand).toHaveBeenNthCalledWith(
1,
- expect.stringContaining('/packages/dnb-eufemia/assets/icons/dnb')
+ expect.stringContaining('/packages/dnb-eufemia/assets/icons/dnb'),
)
expect(tar.create).toHaveBeenCalledTimes(3)
@@ -228,29 +228,29 @@ describe('assetsExtractors', () => {
file: expect.stringContaining('/assets/icons/dnb/tmp.tgz'),
gzip: true,
},
- ['bell_medium.xml', 'bell.xml']
+ ['bell_medium.xml', 'bell.xml'],
)
expect(tar.create).toHaveBeenNthCalledWith(
2,
{
cwd: expect.stringContaining('/assets/icons'),
file: expect.stringContaining(
- '/assets/icons/dnb/eufemia-icons-xml.tgz'
+ '/assets/icons/dnb/eufemia-icons-xml.tgz',
),
gzip: true,
},
- ['bell_medium.xml', 'bell.xml']
+ ['bell_medium.xml', 'bell.xml'],
)
expect(tar.create).toHaveBeenNthCalledWith(
3,
{
cwd: expect.stringContaining('/assets/icons'),
file: expect.stringContaining(
- '/assets/icons/dnb/eufemia-icons-xml-categorized.tgz'
+ '/assets/icons/dnb/eufemia-icons-xml-categorized.tgz',
),
gzip: true,
},
- ['objects/bell_medium.xml', 'objects/bell.xml']
+ ['objects/bell_medium.xml', 'objects/bell.xml'],
)
})
@@ -261,143 +261,143 @@ describe('assetsExtractors', () => {
expect(start).toHaveBeenNthCalledWith(
3,
expect.stringContaining(
- 'Starting to fetch 2 icons from the "Icons" Canvas'
- )
+ 'Starting to fetch 2 icons from the "Icons" Canvas',
+ ),
)
expect(info).toHaveBeenCalledTimes(9)
expect(info).toHaveBeenNthCalledWith(
1,
expect.stringContaining(
- 'Saved file bell_medium.svg (ID=2:63, CREATED=1577836800000)'
- )
+ 'Saved file bell_medium.svg (ID=2:63, CREATED=1577836800000)',
+ ),
)
expect(info).toHaveBeenNthCalledWith(
2,
expect.stringContaining(
- 'Saved file bell.svg (ID=41:2, CREATED=1577836800000)'
- )
+ 'Saved file bell.svg (ID=41:2, CREATED=1577836800000)',
+ ),
)
expect(info).toHaveBeenNthCalledWith(
3,
expect.stringContaining(
- 'finished fetching SVGs icons by using frameIconsFactory. Processed 2 files along with 2 new files.'
- )
+ 'finished fetching SVGs icons by using frameIconsFactory. Processed 2 files along with 2 new files.',
+ ),
)
expect(info).toHaveBeenNthCalledWith(
4,
- expect.stringContaining('Icon was optimized: bell_medium.svg')
+ expect.stringContaining('Icon was optimized: bell_medium.svg'),
)
expect(info).toHaveBeenNthCalledWith(
5,
- expect.stringContaining('Icon was optimized: bell.svg')
+ expect.stringContaining('Icon was optimized: bell.svg'),
)
expect(info).toHaveBeenNthCalledWith(
6,
- expect.stringContaining('started to create eufemia-icons-xml.tgz')
+ expect.stringContaining('started to create eufemia-icons-xml.tgz'),
)
expect(info).toHaveBeenNthCalledWith(
7,
- expect.stringContaining('convert SVG to XML')
+ expect.stringContaining('convert SVG to XML'),
)
expect(info).toHaveBeenNthCalledWith(
8,
expect.stringContaining(
- '/dnb-eufemia/src/icons/dnb/icons-svg.lock file got generated'
- )
+ '/dnb-eufemia/src/icons/dnb/icons-svg.lock file got generated',
+ ),
)
expect(info).toHaveBeenNthCalledWith(
9,
- expect.stringContaining('icons-meta.json file got generated')
+ expect.stringContaining('icons-meta.json file got generated'),
)
expect(succeed).toHaveBeenCalledTimes(2)
expect(succeed).toHaveBeenNthCalledWith(
1,
- expect.stringContaining('Using old Figma document')
+ expect.stringContaining('Using old Figma document'),
)
expect(succeed).toHaveBeenNthCalledWith(
2,
- expect.stringContaining('finished to create eufemia-icons-xml.tgz')
+ expect.stringContaining('finished to create eufemia-icons-xml.tgz'),
)
expect(fs.move).toHaveBeenCalledTimes(2)
expect(fs.move).toHaveBeenNthCalledWith(
1,
expect.stringContaining('/assets/icons/dnb/bell_medium.xml'),
- expect.stringContaining('/assets/icons/dnb/objects/bell_medium.xml')
+ expect.stringContaining('/assets/icons/dnb/objects/bell_medium.xml'),
)
expect(fs.move).toHaveBeenNthCalledWith(
2,
expect.stringContaining('/assets/icons/dnb/bell.xml'),
- expect.stringContaining('/assets/icons/dnb/objects/bell.xml')
+ expect.stringContaining('/assets/icons/dnb/objects/bell.xml'),
)
expect(fs.unlink).toHaveBeenCalledTimes(5)
expect(fs.unlink).toHaveBeenNthCalledWith(
1,
- expect.stringContaining('/assets/icons/dnb/tmp.tgz')
+ expect.stringContaining('/assets/icons/dnb/tmp.tgz'),
)
expect(fs.unlink).toHaveBeenNthCalledWith(
2,
- expect.stringContaining('/assets/icons/dnb/objects/bell_medium.xml')
+ expect.stringContaining('/assets/icons/dnb/objects/bell_medium.xml'),
)
expect(fs.unlink).toHaveBeenNthCalledWith(
3,
- expect.stringContaining('/assets/icons/dnb/objects/bell.xml')
+ expect.stringContaining('/assets/icons/dnb/objects/bell.xml'),
)
expect(fs.unlink).toHaveBeenNthCalledWith(
4,
- expect.stringContaining('/assets/icons/dnb/bell_medium.xml')
+ expect.stringContaining('/assets/icons/dnb/bell_medium.xml'),
)
expect(fs.unlink).toHaveBeenNthCalledWith(
5,
- expect.stringContaining('/assets/icons/dnb/bell.xml')
+ expect.stringContaining('/assets/icons/dnb/bell.xml'),
)
expect(fs.readFile).toHaveBeenCalledTimes(8)
expect(fs.readFile).toHaveBeenNthCalledWith(
1,
expect.stringContaining(
- '/scripts/figma/helpers/__tests__/files/FigmaTestDoc.json'
- )
+ '/scripts/figma/helpers/__tests__/files/FigmaTestDoc.json',
+ ),
)
expect(fs.readFile).toHaveBeenNthCalledWith(
2,
expect.stringContaining(
- '/scripts/figma/helpers/__tests__/files/icons-svg.lock'
+ '/scripts/figma/helpers/__tests__/files/icons-svg.lock',
),
- 'utf-8'
+ 'utf-8',
)
expect(fs.readFile).toHaveBeenNthCalledWith(
3,
expect.stringContaining('/assets/icons/dnb/bell_medium.svg'),
'utf-8',
- expect.any(Function)
+ expect.any(Function),
)
expect(fs.readFile).toHaveBeenNthCalledWith(
4,
expect.stringContaining('/assets/icons/dnb/bell_medium.svg'),
- 'utf-8'
+ 'utf-8',
)
expect(fs.readFile).toHaveBeenNthCalledWith(
5,
expect.stringContaining('/assets/icons/dnb/bell.svg'),
'utf-8',
- expect.any(Function)
+ expect.any(Function),
)
expect(fs.readFile).toHaveBeenNthCalledWith(
6,
expect.stringContaining('/assets/icons/dnb/bell.svg'),
- 'utf-8'
+ 'utf-8',
)
expect(fs.readFile).toHaveBeenNthCalledWith(
7,
expect.stringContaining('/assets/icons/dnb/bell_medium.svg'),
- 'utf-8'
+ 'utf-8',
)
expect(fs.readFile).toHaveBeenNthCalledWith(
8,
expect.stringContaining('/assets/icons/dnb/bell.svg'),
- 'utf-8'
+ 'utf-8',
)
expect(fs.writeFile).toHaveBeenCalledTimes(4)
@@ -405,24 +405,24 @@ describe('assetsExtractors', () => {
expect(fs.writeFile).toHaveBeenNthCalledWith(
1,
expect.stringContaining(
- '/dnb-eufemia/assets/icons/dnb/bell_medium.svg'
+ '/dnb-eufemia/assets/icons/dnb/bell_medium.svg',
),
expect.stringContaining(
- ``
- )
+ ``,
+ ),
)
expect(fs.writeFile).toHaveBeenNthCalledWith(
2,
expect.stringContaining('/dnb-eufemia/assets/icons/dnb/bell.svg'),
expect.stringContaining(
- ``
- )
+ ``,
+ ),
)
expect(fs.writeFile).toHaveBeenNthCalledWith(
3,
expect.stringContaining('/dnb-eufemia/src/icons/dnb/icons-svg.lock'),
expect.stringContaining(
- formatIconsMetaFile({
+ await formatIconsMetaFile({
'bell_medium.svg': {
iconName: 'bell_medium',
name: 'bell',
@@ -449,14 +449,14 @@ describe('assetsExtractors', () => {
created: 1577836800000,
updated: 1577836800000,
},
- })
- )
+ }),
+ ),
)
expect(fs.writeFile).toHaveBeenNthCalledWith(
4,
expect.stringContaining('/dnb-eufemia/src/icons/icons-meta.json'),
expect.stringContaining(
- formatIconsMetaFile({
+ await formatIconsMetaFile({
bell_medium: {
tags: [
'component-tag-24',
@@ -485,8 +485,8 @@ describe('assetsExtractors', () => {
variant: 'primary',
category: 'objects',
},
- })
- )
+ }),
+ ),
)
expect(result).toHaveLength(2)
@@ -520,7 +520,7 @@ describe('assetsExtractors', () => {
url: 'file:./12b63b85ba08cf1588a42fb69cb9654c',
variant: 'primary',
},
- ])
+ ]),
)
})
})
diff --git a/packages/dnb-eufemia/scripts/figma/tasks/assetsExtractors.ts b/packages/dnb-eufemia/scripts/figma/tasks/assetsExtractors.ts
index c08b3481f1d..cb80c5f07b1 100644
--- a/packages/dnb-eufemia/scripts/figma/tasks/assetsExtractors.ts
+++ b/packages/dnb-eufemia/scripts/figma/tasks/assetsExtractors.ts
@@ -61,7 +61,7 @@ type IconsConfig = {
export function IconsConfig(overwrite: IconsConfig = {}) {
if (overwrite?.assetsDir && /^\//.test(overwrite.assetsDir)) {
log.fail(
- ErrorHandler('assetsDir should not start with a slash (/dir)')
+ ErrorHandler('assetsDir should not start with a slash (/dir)'),
)
}
@@ -77,13 +77,13 @@ export function IconsConfig(overwrite: IconsConfig = {}) {
const destDir = path.resolve(
__dirname,
'../../../assets/icons',
- overwrite?.assetsDir || ''
+ overwrite?.assetsDir || '',
)
const iconsLockFile = path.resolve(
__dirname,
'../../../src/icons',
overwrite?.assetsDir || '',
- 'icons-svg.lock'
+ 'icons-svg.lock',
)
return {
@@ -102,7 +102,10 @@ export function IconsConfig(overwrite: IconsConfig = {}) {
}
const prettierrc = JSON.parse(
- fs.readFileSync(path.resolve(__dirname, '../../../.prettierrc'), 'utf-8')
+ fs.readFileSync(
+ path.resolve(__dirname, '../../../.prettierrc'),
+ 'utf-8',
+ ),
)
export const extractIcons = async ({
@@ -128,7 +131,7 @@ export const extractIcons = async ({
})
log.start(
- '> Figma: started to fetch SVGs icons by using frameIconsFactory'
+ '> Figma: started to fetch SVGs icons by using frameIconsFactory',
)
const { listOfProcessedFiles, listWithNewFiles } =
@@ -142,7 +145,7 @@ export const extractIcons = async ({
})
log.info(
- `> Figma: finished fetching SVGs icons by using frameIconsFactory. Processed ${listOfProcessedFiles.length} files along with ${listWithNewFiles.length} new files.`
+ `> Figma: finished fetching SVGs icons by using frameIconsFactory. Processed ${listOfProcessedFiles.length} files along with ${listWithNewFiles.length} new files.`,
)
if (listWithNewFiles.length > 0) {
@@ -216,7 +219,7 @@ async function collectIconsFromFigmaDoc({
listWithNewFiles.push(...newFiles)
return files
- }
+ },
)
runDiffControll({ controllStorageLists })
@@ -235,7 +238,7 @@ const runDiffControll = ({ controllStorageLists }) => {
const getDiff = (a, b) =>
a.filter(
({ name }) =>
- !b.some(({ name: n }) => removeSizes(n) === removeSizes(name))
+ !b.some(({ name: n }) => removeSizes(n) === removeSizes(name)),
)
controllStorageLists.forEach((cur, i, arr) => {
@@ -254,8 +257,8 @@ const runDiffControll = ({ controllStorageLists }) => {
`> Figma: Detected a difference between the frames!. Here are the differences:\n ${JSON.stringify(
collectDiff,
null,
- 4
- )}`
+ 4,
+ )}`,
)
}
}
@@ -303,7 +306,7 @@ const frameIconsFactory = async ({
const underlineLimit = 4
if (iconName.split(/_/g).length > underlineLimit) {
log.fail(
- `${iconName} was skipped, cause it had more than ${underlineLimit} parts on name split by _`
+ `${iconName} was skipped, cause it had more than ${underlineLimit} parts on name split by _`,
)
return acc
}
@@ -320,7 +323,7 @@ const frameIconsFactory = async ({
return acc
},
- []
+ [],
)
// check if lock file exists
@@ -335,7 +338,7 @@ const frameIconsFactory = async ({
const listOfCachedIconUrls = Object.entries(oldLockFileContent)
.filter(
([file, { id, url, slug }]) =>
- file && id && url && slug === md5(figmaFile + frameId)
+ file && id && url && slug === md5(figmaFile + frameId),
)
// define the same format as we get from "getFigmaUrlByImageIds"
.map(([file, { id, url, updated }]) => ({
@@ -352,7 +355,7 @@ const frameIconsFactory = async ({
if (found) {
// Check if created has passed 30 days
const countDays = Math.ceil(
- (Date.now() - found.updated) / (1e3 * 60 * 60 * 24)
+ (Date.now() - found.updated) / (1e3 * 60 * 60 * 24),
)
const outdated = countDays > imageUrlExpireAfterDays
@@ -365,7 +368,7 @@ const frameIconsFactory = async ({
})
log.start(
- `> Figma: Starting to fetch ${iconIdsToFetchFrom.length} icons from the "${originalFrameName}" Canvas`
+ `> Figma: Starting to fetch ${iconIdsToFetchFrom.length} icons from the "${originalFrameName}" Canvas`,
)
// go and load additional images
@@ -374,7 +377,7 @@ const frameIconsFactory = async ({
figmaFile,
ids: iconIdsToFetchFrom.map(({ id }) => id),
params: { format },
- })
+ }),
).map(([id, url]) => ({
id,
url,
@@ -397,7 +400,7 @@ const frameIconsFactory = async ({
// clean the list of icons we will process
.map(({ id, url }) => {
const existingObject = listOfIconObjectsFromDoc.find(
- ({ id: i }) => i === id
+ ({ id: i }) => i === id,
)
return {
@@ -421,11 +424,11 @@ const frameIconsFactory = async ({
return acc
},
- rawListOfIconsToProcess
+ rawListOfIconsToProcess,
)
log.start(
- `> Figma: Starting to fetch process ${listOfIconsToProcess.length} icons`
+ `> Figma: Starting to fetch process ${listOfIconsToProcess.length} icons`,
)
const listOfProcessedFiles = (
@@ -480,7 +483,7 @@ const frameIconsFactory = async ({
// Check if created has passed 30 days
const countDays = Math.ceil(
(Date.now() - lockFileFrameContent?.updated) /
- (1e3 * 60 * 60 * 24)
+ (1e3 * 60 * 60 * 24),
)
if (countDays > imageUrlExpireAfterDays) {
existsAndIsValid = false
@@ -491,7 +494,7 @@ const frameIconsFactory = async ({
ret.updated = lockFileFrameContent?.updated
log.info(
- `> Figma: File already exists: ${iconFile} (ID=${id}, CREATED=${ret.created})`
+ `> Figma: File already exists: ${iconFile} (ID=${id}, CREATED=${ret.created})`,
)
existingFiles.push(ret)
@@ -503,7 +506,7 @@ const frameIconsFactory = async ({
},
{
errorExceptionType: ERROR_HARMLESS,
- }
+ },
)
let streamResult = null
@@ -519,8 +522,8 @@ const frameIconsFactory = async ({
if (streamResult === 'ACCESS_DENIED') {
log.fail(
ErrorHandler(
- `> Figma: Failed to stream content of (${iconName}): ${content}`
- )
+ `> Figma: Failed to stream content of (${iconName}): ${content}`,
+ ),
)
}
@@ -539,7 +542,7 @@ const frameIconsFactory = async ({
newFiles.push(ret)
log.info(
- `> Figma: Saved file ${iconFile} (ID=${id}, CREATED=${ret.created})`
+ `> Figma: Saved file ${iconFile} (ID=${id}, CREATED=${ret.created})`,
)
}
}
@@ -548,7 +551,7 @@ const frameIconsFactory = async ({
} catch (e) {
log.fail(ErrorHandler('Failed to process new icons', e))
}
- }
+ },
)
).filter(Boolean)
@@ -577,15 +580,15 @@ const prerenderIconName = (name, size = null) => {
iconName = iconRenameList.reduce(
(acc, cur) => (cur.from === acc ? cur.to : acc),
- iconName
+ iconName,
)
const isReservedWord = reservedJavaScriptWords.some(
- (name) => name === iconName
+ (name) => name === iconName,
)
if (isReservedWord) {
log.fail(
- `\nReserved name found for icon "${iconName}" ā it got renamed to "${iconName}_1".\n\n\n`
+ `\nReserved name found for icon "${iconName}" ā it got renamed to "${iconName}_1".\n\n\n`,
)
iconName = `${iconName}_1`
}
@@ -645,7 +648,7 @@ const makeMetaFile = async ({
suffix
? iconName.replace(NAME_SEPARATOR + suffix, '')
: iconName,
- iconName
+ iconName,
)
tags = tags.filter((item, index) => {
if (item === cleanedName) {
@@ -676,10 +679,10 @@ const makeMetaFile = async ({
}
return acc
},
- {}
+ {},
)
- await saveToFile(iconsMetaFile, formatIconsMetaFile(data))
+ await saveToFile(iconsMetaFile, await formatIconsMetaFile(data))
log.info('> Figma: icons-meta.json file got generated')
}
@@ -720,7 +723,7 @@ const createXMLTarBundles = async ({
({ iconFile, ...rest }) => {
const iconFileXML = iconFile.replace(/\.svg$/, '.xml')
return { iconFile, iconFileXML, ...rest }
- }
+ },
)
await convertSvgToXml()
@@ -741,7 +744,7 @@ const createXMLTarBundles = async ({
await runCommand(`yarn vd-tool -c -in ${destDir}`)
} catch (error) {
log.fail(
- `> Figma: failed to convert SVG to XML in ${destDir}\n\n${error}`
+ `> Figma: failed to convert SVG to XML in ${destDir}\n\n${error}`,
)
}
}
@@ -757,7 +760,7 @@ const createXMLTarBundles = async ({
async function hasSizeChanged() {
const fileList = listOfProcessedFiles.map(
- ({ iconFileXML }) => iconFileXML
+ ({ iconFileXML }) => iconFileXML,
)
const tmp = path.resolve(destDir, 'tmp.tgz')
@@ -767,7 +770,7 @@ const createXMLTarBundles = async ({
cwd: destDir,
file: tmp,
},
- fileList
+ fileList,
)
const tmpSize = (await fs.stat(tmp)).size
@@ -778,7 +781,7 @@ const createXMLTarBundles = async ({
async function createTarWithoutCategories() {
const fileList = listOfProcessedFiles.map(
- ({ iconFileXML }) => iconFileXML
+ ({ iconFileXML }) => iconFileXML,
)
await create(
@@ -787,7 +790,7 @@ const createXMLTarBundles = async ({
cwd: destDir,
file: tarFile,
},
- fileList
+ fileList,
)
}
@@ -801,11 +804,11 @@ const createXMLTarBundles = async ({
if (fs.existsSync(source)) {
await fs.move(source, dest)
}
- }
+ },
)
const fileList = listOfProcessedFiles.map(
- ({ category, iconFileXML }) => `${category}/${iconFileXML}`
+ ({ category, iconFileXML }) => `${category}/${iconFileXML}`,
)
const tarFile = path.resolve(destDir, outputNameCategorized)
@@ -815,7 +818,7 @@ const createXMLTarBundles = async ({
cwd: destDir,
file: tarFile,
},
- fileList
+ fileList,
)
// Empty category dir
@@ -893,7 +896,7 @@ const insertInlineStylesToSVG = (svg) => {
if (acc.includes(val)) {
acc = acc.replace(
/(fill|stroke)="([^"]*)"/g,
- `style="$1:var(${key})" $1="$2"`
+ `style="$1:var(${key})" $1="$2"`,
)
}
return acc
@@ -929,7 +932,7 @@ export const readIconsLockFile = async ({ file }) => {
if (fs.existsSync(file)) {
try {
return JSON.parse(
- (await fs.readFile(file, 'utf-8')) || '{}'
+ (await fs.readFile(file, 'utf-8')) || '{}',
) as IconsLockFileMap
} catch (e) {
log.fail('Failed to read the lock file and parse the result')
@@ -940,17 +943,17 @@ export const readIconsLockFile = async ({ file }) => {
return {} as IconsLockFileMap
}
export const saveIconsLockFile = async ({ file, data }) => {
- await saveToFile(file, formatIconsMetaFile(data))
+ await saveToFile(file, await formatIconsMetaFile(data))
log.info(`> Figma: ${file} file got generated`)
}
const iconsMetaFile = path.resolve(
__dirname,
- '../../../src/icons/icons-meta.json'
+ '../../../src/icons/icons-meta.json',
)
-export const formatIconsMetaFile = (data) => {
- return prettier.format(JSON.stringify(data), {
+export const formatIconsMetaFile = async (data) => {
+ return await prettier.format(JSON.stringify(data), {
...prettierrc,
filepath: iconsMetaFile,
})
diff --git a/packages/dnb-eufemia/scripts/figma/tasks/makeStyleFromFigmaDoc.js b/packages/dnb-eufemia/scripts/figma/tasks/makeStyleFromFigmaDoc.js
index be2ddfc9f48..ee4ab22cff1 100644
--- a/packages/dnb-eufemia/scripts/figma/tasks/makeStyleFromFigmaDoc.js
+++ b/packages/dnb-eufemia/scripts/figma/tasks/makeStyleFromFigmaDoc.js
@@ -34,7 +34,7 @@ export const makeScssFromFigmaDoc = (
prependKey = null,
subkeyToFind = null,
doReturnExpression = false,
- } = {}
+ } = {},
) => {
if (!value) return null
@@ -121,7 +121,7 @@ const findexistingSassVars = ({
const index = entries.find(
([key]) =>
key === `${prependKey}-${keyToFind}` ||
- key === `${prependKey}-${subkeyToFind}-${keyToFind}`
+ key === `${prependKey}-${subkeyToFind}-${keyToFind}`,
)
let res = index && index.length > 0 ? index[1] : null
if (typeof res === 'string') {
diff --git a/packages/dnb-eufemia/scripts/figma/tasks/makeStylePrettier.js b/packages/dnb-eufemia/scripts/figma/tasks/makeStylePrettier.js
index 7f9ccbfdea7..a4ce613f341 100644
--- a/packages/dnb-eufemia/scripts/figma/tasks/makeStylePrettier.js
+++ b/packages/dnb-eufemia/scripts/figma/tasks/makeStylePrettier.js
@@ -5,8 +5,8 @@
import prettier from 'prettier'
-export const makeStylePrettier = (style) =>
- prettier.format(style, {
+export const makeStylePrettier = async (style) =>
+ await prettier.format(style, {
filepath: `file.scss`,
printWidth: 75,
tabWidth: 2,
diff --git a/packages/dnb-eufemia/scripts/lib/error.ts b/packages/dnb-eufemia/scripts/lib/error.ts
index df5fc6ddc64..8e788bc794e 100644
--- a/packages/dnb-eufemia/scripts/lib/error.ts
+++ b/packages/dnb-eufemia/scripts/lib/error.ts
@@ -11,7 +11,7 @@ type ErrorHandlerMessage = string
function ErrorHandler(
message: ErrorHandlerMessage,
error = null,
- code = ERROR_HARMLESS
+ code = ERROR_HARMLESS,
): string {
if (error === null && typeof message !== 'string') {
error = message
diff --git a/packages/dnb-eufemia/scripts/postbuild/__tests__/postbuild.test.ts b/packages/dnb-eufemia/scripts/postbuild/__tests__/postbuild.test.ts
index 3c921cf745a..b19a62a6705 100644
--- a/packages/dnb-eufemia/scripts/postbuild/__tests__/postbuild.test.ts
+++ b/packages/dnb-eufemia/scripts/postbuild/__tests__/postbuild.test.ts
@@ -34,9 +34,9 @@ describe('type definitions', () => {
fs.existsSync(
path.resolve(
packpath.self(),
- `build${stage}/components/Input.d.ts`
- )
- )
+ `build${stage}/components/Input.d.ts`,
+ ),
+ ),
).toBe(true)
// To ensure babel did not compile the d.ts file
@@ -44,16 +44,16 @@ describe('type definitions', () => {
fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/components/input/Input.d.ts`
+ `build${stage}/components/input/Input.d.ts`,
),
- 'utf-8'
- )
+ 'utf-8',
+ ),
).toMatch(/export interface/g)
// Test the output of js files
const file = path.resolve(
packpath.self(),
- `build${stage}/components/input/Input.d.ts`
+ `build${stage}/components/input/Input.d.ts`,
)
expect(fs.existsSync(file)).toBe(true)
@@ -61,10 +61,10 @@ describe('type definitions', () => {
const content = fs.readFileSync(file, 'utf-8')
expect(content).toContain('export interface InputProps')
expect(content).toContain(
- "extends Omit, 'ref'>,"
+ "extends Omit, 'ref'>,",
)
expect(content).toContain('SpacingProps')
- }
+ },
)
it.each(buildStages)(
@@ -75,11 +75,11 @@ describe('type definitions', () => {
// Test the output of tsx files
const tsxFile = path.resolve(
packpath.self(),
- `build${stage}/components/breadcrumb/Breadcrumb.tsx`
+ `build${stage}/components/breadcrumb/Breadcrumb.tsx`,
)
const dtsFile = path.resolve(
packpath.self(),
- `build${stage}/components/breadcrumb/Breadcrumb.d.ts`
+ `build${stage}/components/breadcrumb/Breadcrumb.d.ts`,
)
expect(fs.existsSync(tsxFile)).toBe(false)
@@ -87,7 +87,7 @@ describe('type definitions', () => {
const content = fs.readFileSync(dtsFile, 'utf-8')
expect(content).toContain('export interface BreadcrumbProps')
- }
+ },
)
})
@@ -122,7 +122,7 @@ describe('babel build', () => {
// In case the git CLI command fails, we do not want to break the run
console.error(
'Could not run the CLI command to get the commited files (getCommittedFiles)',
- error
+ error,
)
}
})
@@ -134,22 +134,25 @@ describe('babel build', () => {
{
const content = fs.readFileSync(
path.resolve(packpath.self(), `build${stage}/index.js`),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain(
- 'Object.defineProperty(exports, "__esModule", {'
+ 'Object.defineProperty(exports, "__esModule", {',
)
expect(content).toContain(`var _default = {};`)
// Has extra cjs package
expect(
fs.existsSync(
- path.resolve(packpath.self(), `build${stage}/package.json`)
- )
+ path.resolve(
+ packpath.self(),
+ `build${stage}/package.json`,
+ ),
+ ),
).toBe(true)
const packageJson = fs.readJsonSync(
- path.resolve(packpath.self(), `build${stage}/package.json`)
+ path.resolve(packpath.self(), `build${stage}/package.json`),
)
expect(packageJson.type).toBe('commonjs')
@@ -159,9 +162,9 @@ describe('babel build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/components/input/Input.js`
+ `build${stage}/components/input/Input.js`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain('class Input extends')
expect(content).toMatch(/^"use strict";/g)
@@ -171,9 +174,9 @@ describe('babel build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/components/breadcrumb/Breadcrumb.js`
+ `build${stage}/components/breadcrumb/Breadcrumb.js`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain('var _default = Breadcrumb')
expect(content).toMatch(/^"use strict";/g)
@@ -188,7 +191,7 @@ describe('babel build', () => {
{
const content = fs.readFileSync(
path.resolve(packpath.self(), `build${stage}/index.js`),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain('export default {};')
}
@@ -197,14 +200,14 @@ describe('babel build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/components/input/Input.js`
+ `build${stage}/components/input/Input.js`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain('export default class Input extends')
expect(content).not.toContain('core-js/modules/es')
expect(content).toContain(
- 'import _extends from "@babel/runtime/helpers/esm/extends";'
+ 'import _extends from "@babel/runtime/helpers/esm/extends";',
)
}
@@ -212,13 +215,13 @@ describe('babel build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/components/breadcrumb/Breadcrumb.js`
+ `build${stage}/components/breadcrumb/Breadcrumb.js`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain('export default Breadcrumb;')
expect(content).toContain(
- 'import _extends from "@babel/runtime/helpers/esm/extends";'
+ 'import _extends from "@babel/runtime/helpers/esm/extends";',
)
}
}
@@ -229,7 +232,7 @@ describe('babel build', () => {
{
const content = fs.readFileSync(
path.resolve(packpath.self(), `build${stage}/index.js`),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain('export default {};')
}
@@ -238,14 +241,14 @@ describe('babel build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/components/input/Input.js`
+ `build${stage}/components/input/Input.js`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toMatch(/export default class Input extends/g)
expect(content).not.toContain('core-js/modules/es')
expect(content).toContain(
- 'import _extends from "@babel/runtime/helpers/esm/extends";'
+ 'import _extends from "@babel/runtime/helpers/esm/extends";',
)
}
@@ -253,14 +256,14 @@ describe('babel build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/components/breadcrumb/Breadcrumb.js`
+ `build${stage}/components/breadcrumb/Breadcrumb.js`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain('export default Breadcrumb;')
expect(content).not.toContain('core-js/modules/es')
expect(content).toContain(
- 'import _extends from "@babel/runtime/helpers/esm/extends";'
+ 'import _extends from "@babel/runtime/helpers/esm/extends";',
)
}
}
@@ -271,8 +274,8 @@ describe('babel build', () => {
expect(
fs.existsSync(
- path.resolve(packpath.self(), `build${stage}/components/Input.js`)
- )
+ path.resolve(packpath.self(), `build${stage}/components/Input.js`),
+ ),
).toBe(true)
})
})
@@ -288,9 +291,9 @@ describe('rollup build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/dnb-ui-lib.min.mjs`
+ `build${stage}/dnb-ui-lib.min.mjs`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain(`import*as `)
expect(content).toContain(` from"react-dom";`)
@@ -305,9 +308,9 @@ describe('rollup build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/dnb-ui-lib.min.js`
+ `build${stage}/dnb-ui-lib.min.js`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain('require("react")')
expect(content).toContain('require("react-dom")')
@@ -326,9 +329,9 @@ describe('style build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/style/dnb-ui-basis.scss`
+ `build${stage}/style/dnb-ui-basis.scss`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain(`@import './core/scopes.scss';`)
expect(content).toContain(`
@@ -336,7 +339,7 @@ describe('style build', () => {
@include bodyDefault();
}`)
expect(content).toContain(
- `@import './core/helper-classes/helper-classes.scss';`
+ `@import './core/helper-classes/helper-classes.scss';`,
)
}
@@ -344,15 +347,15 @@ describe('style build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/style/themes/theme-ui/ui-theme-basis.scss`
+ `build${stage}/style/themes/theme-ui/ui-theme-basis.scss`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain(`@import './properties.scss';`)
expect(content).toContain(`@import './fonts.scss';`)
expect(content).toContain(`@import './ui-theme-elements.scss';`)
expect(content).not.toContain(
- `@import '../../dnb-ui-elements.scss';`
+ `@import '../../dnb-ui-elements.scss';`,
)
}
@@ -360,15 +363,15 @@ describe('style build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/style/themes/theme-sbanken/sbanken-theme-basis.scss`
+ `build${stage}/style/themes/theme-sbanken/sbanken-theme-basis.scss`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain(`@import './properties.scss';`)
expect(content).toContain(`@import './fonts.scss';`)
expect(content).toContain(`@import './sbanken-theme-elements.scss';`)
expect(content).not.toContain(
- `@import '../../dnb-ui-elements.scss';`
+ `@import '../../dnb-ui-elements.scss';`,
)
}
@@ -376,15 +379,15 @@ describe('style build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/style/dnb-ui-core.css`
+ `build${stage}/style/dnb-ui-core.css`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toMatch(
- /\.dnb-core-style {([\r\n][^}]*)+font-family: var\(--font-family-default\);/
+ /\.dnb-core-style {([\r\n][^}]*)+font-family: var\(--font-family-default\);/,
)
expect(content).toMatch(
- /html {([\r\n][^}]*)+line-height: var\(--line-height-basis\);/
+ /html {([\r\n][^}]*)+line-height: var\(--line-height-basis\);/,
)
}
@@ -392,15 +395,15 @@ describe('style build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/style/dnb-ui-basis.css`
+ `build${stage}/style/dnb-ui-basis.css`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toMatch(
- /\.dnb-core-style {([\r\n][^}]*)+font-family: var\(--font-family-default\);/
+ /\.dnb-core-style {([\r\n][^}]*)+font-family: var\(--font-family-default\);/,
)
expect(content).not.toMatch(
- /html {([\r\n][^}]*)+line-height: var\(--line-height-basis\);/
+ /html {([\r\n][^}]*)+line-height: var\(--line-height-basis\);/,
)
}
@@ -408,17 +411,17 @@ describe('style build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/style/themes/theme-ui/ui-theme-basis.css`
+ `build${stage}/style/themes/theme-ui/ui-theme-basis.css`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain(
- `--font-family-default: "DNB", sans-serif;`
+ `--font-family-default: "DNB", sans-serif;`,
)
expect(content).toContain(`.dnb-typo-regular`)
expect(content).toContain(`@font-face`)
expect(content).toContain(
- `src: url("../../../assets/fonts/dnb/DNB-Regular.woff2") format("woff2"),`
+ `src: url("../../../assets/fonts/dnb/DNB-Regular.woff2") format("woff2"),`,
)
expect(content).toContain(`
.dnb-p {
@@ -437,9 +440,9 @@ describe('style build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/style/themes/theme-sbanken/sbanken-theme-basis.css`
+ `build${stage}/style/themes/theme-sbanken/sbanken-theme-basis.css`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain(`font-family: MaisonNeueHeadings;`)
expect(content).toContain(`
@@ -459,9 +462,9 @@ describe('style build', () => {
const content = fs.readFileSync(
path.resolve(
packpath.self(),
- `build${stage}/style/themes/theme-sbanken/sbanken-theme-components.css`
+ `build${stage}/style/themes/theme-sbanken/sbanken-theme-components.css`,
),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain(`.dnb-button {`)
}
diff --git a/packages/dnb-eufemia/scripts/postbuild/__tests__/prepareForRelease.test.js b/packages/dnb-eufemia/scripts/postbuild/__tests__/prepareForRelease.test.js
index fa5df60c1f2..ba90caa5027 100644
--- a/packages/dnb-eufemia/scripts/postbuild/__tests__/prepareForRelease.test.js
+++ b/packages/dnb-eufemia/scripts/postbuild/__tests__/prepareForRelease.test.js
@@ -45,7 +45,7 @@ if(typeof window !== 'undefined'){
window.Eufemia = window.Eufemia || {};
window.Eufemia.version = '0.0.0-development';
}
-`)
+`),
)
})
})
@@ -53,7 +53,7 @@ if(typeof window !== 'undefined'){
describe('package.json', () => {
const packageJsonFile = path.resolve(
packpath.self(),
- 'build/package.json'
+ 'build/package.json',
)
let packageJson = {}
@@ -86,7 +86,7 @@ describe('package.json', () => {
'style/**/*',
'es/style/**/*',
'esm/style/**/*',
- ])
+ ]),
)
})
@@ -95,7 +95,7 @@ describe('package.json', () => {
expect.objectContaining({
react: expect.anything(),
'react-dom': expect.anything(),
- })
+ }),
)
})
@@ -107,7 +107,7 @@ describe('package.json', () => {
it('has publishConfig', () => {
expect(packageJson.publishConfig).toEqual(
- expect.objectContaining({ access: 'public' })
+ expect.objectContaining({ access: 'public' }),
)
})
})
diff --git a/packages/dnb-eufemia/scripts/postbuild/getNextReleaseVersion.js b/packages/dnb-eufemia/scripts/postbuild/getNextReleaseVersion.js
index d16b7a333e6..c015b2f5696 100644
--- a/packages/dnb-eufemia/scripts/postbuild/getNextReleaseVersion.js
+++ b/packages/dnb-eufemia/scripts/postbuild/getNextReleaseVersion.js
@@ -28,7 +28,7 @@ async function getNextReleaseVersion() {
try {
const log = await runCommand(command)
const nextVersion = log.match(
- /The next release version is ([^\n]*)/
+ /The next release version is ([^\n]*)/,
)?.[1]
if (nextVersion) {
@@ -40,8 +40,8 @@ async function getNextReleaseVersion() {
} else {
console.warn(
`The current git branch ${branchName} is not one of the release branches ${releaseBranches.join(
- ','
- )}`
+ ',',
+ )}`,
)
}
diff --git a/packages/dnb-eufemia/scripts/postbuild/postbuild.sh b/packages/dnb-eufemia/scripts/postbuild/postbuild.sh
index 47ae664b081..ab81c866dfe 100755
--- a/packages/dnb-eufemia/scripts/postbuild/postbuild.sh
+++ b/packages/dnb-eufemia/scripts/postbuild/postbuild.sh
@@ -5,7 +5,7 @@ set -e # Exit immediately if a command exits with a non-zero status.
echo 'Postbuild started ...'
yarn build:types:generate
-yarn prettier:other
+yarn prettier:other:write
yarn build:cjs
yarn build:es
yarn build:esm
diff --git a/packages/dnb-eufemia/scripts/postbuild/prepareForRelease.js b/packages/dnb-eufemia/scripts/postbuild/prepareForRelease.js
index 83f5364cb7a..b78ecf46c71 100644
--- a/packages/dnb-eufemia/scripts/postbuild/prepareForRelease.js
+++ b/packages/dnb-eufemia/scripts/postbuild/prepareForRelease.js
@@ -49,11 +49,11 @@ export async function cleanupPackage({ packageString, filepath }) {
const prettierrc = JSON.parse(
await fs.readFile(
path.resolve(packpath.self(), '.prettierrc'),
- 'utf-8'
- )
+ 'utf-8',
+ ),
)
- return prettier.format(JSON.stringify(packageJson), {
+ return await prettier.format(JSON.stringify(packageJson), {
...prettierrc,
filepath,
})
@@ -94,7 +94,7 @@ if(typeof window !== 'undefined'){
if (require.main === module) {
console.info(
- `prepareForRelease: Has written version ${version} to files`
+ `prepareForRelease: Has written version ${version} to files`,
)
}
} catch (e) {
diff --git a/packages/dnb-eufemia/scripts/postbuild/publish-prepare.sh b/packages/dnb-eufemia/scripts/postbuild/publish-prepare.sh
index 8c3d6ba8796..bc5b08e8937 100755
--- a/packages/dnb-eufemia/scripts/postbuild/publish-prepare.sh
+++ b/packages/dnb-eufemia/scripts/postbuild/publish-prepare.sh
@@ -8,6 +8,6 @@ babel-node --extensions .js,.ts,.tsx ./scripts/postbuild/prepareForRelease.js
echo 'Testing the postbuild before publish ...'
-jest ./prepareForRelease.test.js --ci --testPathIgnorePatterns=[]
+NODE_OPTIONS=--experimental-vm-modules jest ./prepareForRelease.test.js --ci --testPathIgnorePatterns=[]
echo 'Prepare before publish is done!'
diff --git a/packages/dnb-eufemia/scripts/prebuild/audit/prepareForAudit.js b/packages/dnb-eufemia/scripts/prebuild/audit/prepareForAudit.js
index 323acef17ff..a7cbd6f2ad4 100644
--- a/packages/dnb-eufemia/scripts/prebuild/audit/prepareForAudit.js
+++ b/packages/dnb-eufemia/scripts/prebuild/audit/prepareForAudit.js
@@ -20,7 +20,7 @@ function renameDependencies(direction = 'auto') {
return async () => {
const filepath = path.resolve(packpath.self(), './package.json')
const packageJson = JSON.parse(
- (await fs.readFile(filepath)).toString()
+ (await fs.readFile(filepath)).toString(),
)
if (direction === 'auto' && packageJson.devDependencies) {
@@ -37,7 +37,7 @@ function renameDependencies(direction = 'auto') {
delete packageJson.devDependencies
} else
throw new Error(
- 'Could not rename pkg key! There has to exist: devDependencies'
+ 'Could not rename pkg key! There has to exist: devDependencies',
)
}
break
@@ -50,7 +50,7 @@ function renameDependencies(direction = 'auto') {
delete packageJson.optionalDependencies
} else
throw new Error(
- 'Could not rename pkg key! There has to exist: optionalDependencies'
+ 'Could not rename pkg key! There has to exist: optionalDependencies',
)
}
break
@@ -62,12 +62,12 @@ function renameDependencies(direction = 'auto') {
const prettierrc = JSON.parse(
await fs.readFile(
path.resolve(packpath.self(), '.prettierrc'),
- 'utf-8'
- )
+ 'utf-8',
+ ),
)
const newPackageJson = JSON.stringify(packageJson, null, 2)
- const formattedPackageJson = prettier.format(newPackageJson, {
+ const formattedPackageJson = await prettier.format(newPackageJson, {
...prettierrc,
filepath,
})
diff --git a/packages/dnb-eufemia/scripts/prebuild/commitToBranch.js b/packages/dnb-eufemia/scripts/prebuild/commitToBranch.js
index c2e6697aea4..1802b6b5e31 100644
--- a/packages/dnb-eufemia/scripts/prebuild/commitToBranch.js
+++ b/packages/dnb-eufemia/scripts/prebuild/commitToBranch.js
@@ -60,13 +60,13 @@ const getRequiredBranchName = async ({
if (
requiredBranch &&
!requiredBranch.some((name) =>
- (name instanceof RegExp ? name : new RegExp(name)).test(branchName)
+ (name instanceof RegExp ? name : new RegExp(name)).test(branchName),
)
) {
log.fail(
`The current branch (${branchName}) was not the required one: ${requiredBranch.join(
- ' or '
- )}`
+ ' or ',
+ )}`,
)
return false
}
@@ -106,8 +106,8 @@ const commitToBranch = async ({
Array.isArray(filePathsIncludelist)
? filePathsIncludelist.join('|')
: filePathsIncludelist,
- 'g'
- ).test(f)
+ 'g',
+ ).test(f),
)
// check if the changes where in the files directories
@@ -116,7 +116,7 @@ const commitToBranch = async ({
if (hasChanges) {
if (config.user && config.user.name && config.user.email) {
log.info(
- `Commit: Add Git user: ${config.user.name}, ${config.user.email}`
+ `Commit: Add Git user: ${config.user.name}, ${config.user.email}`,
)
await repo.addConfig('user.name', config.user.name)
await repo.addConfig('user.email', config.user.email)
@@ -140,7 +140,7 @@ const commitToBranch = async ({
isFeature ? 'feat:' : 'chore:'
} some ${what} got added/changed during CI | ${files.join(', ')}${
skipCI ? ' [skip ci]' : ''
- }`
+ }`,
).trim()
log.info(`Commit: ${commitMessage}`)
@@ -158,7 +158,7 @@ const commitToBranch = async ({
await repo.push('origin', branchName, force ? ['--force'] : null)
log.succeed(
- `Commit: These ${what} were successfully updated/added: ${files}`
+ `Commit: These ${what} were successfully updated/added: ${files}`,
)
return files
diff --git a/packages/dnb-eufemia/scripts/prebuild/index.ts b/packages/dnb-eufemia/scripts/prebuild/index.ts
index 3e72c965ca2..0fd493ef039 100644
--- a/packages/dnb-eufemia/scripts/prebuild/index.ts
+++ b/packages/dnb-eufemia/scripts/prebuild/index.ts
@@ -91,7 +91,7 @@ export const cleanupLib = async ({ preventDelete = false } = {}) => {
],
{
force: true,
- }
+ },
)
}
}
diff --git a/packages/dnb-eufemia/scripts/prebuild/resources/makeResourcesPackage.js b/packages/dnb-eufemia/scripts/prebuild/resources/makeResourcesPackage.js
index 0659b100a6f..e42435e7af6 100644
--- a/packages/dnb-eufemia/scripts/prebuild/resources/makeResourcesPackage.js
+++ b/packages/dnb-eufemia/scripts/prebuild/resources/makeResourcesPackage.js
@@ -30,7 +30,7 @@ export default async function makeResourcesPackage() {
const copyStylePackages = (
src = './build/style/**/*.css',
- { returnResult = false } = {}
+ { returnResult = false } = {},
) =>
new Promise((resolve, reject) => {
log.start('> PrePublish: copy style resources')
@@ -45,7 +45,7 @@ const copyStylePackages = (
? transform('utf8', (result) => resolve(result))
: gulp.dest('./dnb-ui-resources/style', {
cwd: ROOT_DIR,
- })
+ }),
)
.on('end', resolve)
.on('error', reject)
@@ -55,7 +55,7 @@ const copyStylePackages = (
})
const copyFonts = (
- src = ['./assets/fonts/dnb/*', '!./assets/fonts/dnb/*.zip']
+ src = ['./assets/fonts/dnb/*', '!./assets/fonts/dnb/*.zip'],
) =>
new Promise((resolve, reject) => {
log.start('> PrePublish: copy fonts resources')
@@ -67,7 +67,7 @@ const copyFonts = (
.pipe(
gulp.dest('./dnb-ui-resources/resources/fonts', {
cwd: ROOT_DIR,
- })
+ }),
)
.on('end', resolve)
.on('error', reject)
@@ -77,7 +77,7 @@ const copyFonts = (
})
const copyBrowser = (
- src = ['./assets/browser/*', '!./assets/browser/*.zip']
+ src = ['./assets/browser/*', '!./assets/browser/*.zip'],
) =>
new Promise((resolve, reject) => {
log.start('> PrePublish: copy browser resources')
@@ -89,7 +89,7 @@ const copyBrowser = (
.pipe(
gulp.dest('./dnb-ui-resources/resources/browser', {
cwd: ROOT_DIR,
- })
+ }),
)
.on('end', resolve)
.on('error', reject)
@@ -99,7 +99,7 @@ const copyBrowser = (
})
const copyUMD = (
- src = ['./build/umd/*', '../../node_modules/react/umd/*']
+ src = ['./build/umd/*', '../../node_modules/react/umd/*'],
) =>
new Promise((resolve, reject) => {
log.start('> PrePublish: copy UMD resources')
@@ -111,7 +111,7 @@ const copyUMD = (
.pipe(
gulp.dest('./dnb-ui-resources/umd', {
cwd: ROOT_DIR,
- })
+ }),
)
.on('end', resolve)
.on('error', reject)
@@ -134,7 +134,7 @@ To make usage of the content, copy the \`style\`, \`umd\` and \`resources\` fold
For documentation, visit: https://eufemia.dnb.no/
License: Apache 2.0 with Commons Clause
-`
+`,
)
}
@@ -151,7 +151,7 @@ const createTar = async () => {
gzip: true,
file: path.resolve(distPath, 'dnb-ui-resources.tgz'),
},
- ['./dnb-ui-resources']
+ ['./dnb-ui-resources'],
)
}
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/convertSvgToJsx.test.tsx b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/convertSvgToJsx.test.tsx
index c7aea6ad8bf..f32501756c7 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/convertSvgToJsx.test.tsx
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/convertSvgToJsx.test.tsx
@@ -24,7 +24,7 @@ beforeAll(async () => {
destPath: path.resolve(__dirname, './test-files/dist'),
customIconsLockFilePath: path.resolve(
__dirname,
- './test-files/dnb/icons-svg.lock'
+ './test-files/dnb/icons-svg.lock',
),
})
jest.useFakeTimers()
@@ -61,7 +61,7 @@ describe('run convertSvgToJsx to convert ES6 to ES5', () => {
const index = await import(
path.resolve(
__dirname,
- 'test-files/dist/dnb/primary_icons_medium.ts'
+ 'test-files/dist/dnb/primary_icons_medium.ts',
)
)
expect(index).toMatchSnapshot()
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/generateTypes.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/generateTypes.test.js
index 74a05cf81dd..3c9c54c2a43 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/generateTypes.test.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/generateTypes.test.js
@@ -13,7 +13,7 @@ describe('generateTypes', () => {
const docsDir = nodePath.resolve(
__dirname,
'../generateTypes/__tests__',
- '__mocks__'
+ '__mocks__',
)
const file = nodePath.resolve(docsDir, 'PrimaryComponent.js')
const [{ destFile, definitionContent }] = await createTypes([file], {
@@ -30,7 +30,7 @@ describe('generateTypes', () => {
const docsDir = nodePath.resolve(
__dirname,
'../generateTypes/__tests__',
- '__mocks__'
+ '__mocks__',
)
const file = nodePath.resolve(docsDir, 'SecondaryComponent.js')
const [{ destFile, definitionContent }] = await createTypes([file], {
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeLibStyles.test.ts b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeLibStyles.test.ts
index 448b0b681f8..c81c4849227 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeLibStyles.test.ts
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeLibStyles.test.ts
@@ -25,13 +25,13 @@ if (isCI) {
'./src/components/button/style/dnb-button.scss',
{
returnResult: true,
- }
+ },
)
global.files = await runFactory(
'./src/components/button/style/dnb-button.scss',
{
returnFiles: true,
- }
+ },
)
})
@@ -55,10 +55,10 @@ if (isCI) {
it('includes correct files', () => {
expect(global.files).toHaveLength(2)
expect(global.files[0]).toContain(
- '/components/button/style/dnb-button.css'
+ '/components/button/style/dnb-button.css',
)
expect(global.files[1]).toContain(
- '/components/button/style/dnb-button.min.css'
+ '/components/button/style/dnb-button.min.css',
)
})
})
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeMainStyle.test.ts b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeMainStyle.test.ts
index d4a495166f2..ec8dc7b575a 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeMainStyle.test.ts
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeMainStyle.test.ts
@@ -45,13 +45,13 @@ if (isCI) {
'./src/style/themes/theme-ui/ui-theme-components.scss',
{
returnResult: true,
- }
+ },
)
global.files = await runFactory(
'./src/style/themes/theme-ui/ui-theme-components.scss',
{
returnFiles: true,
- }
+ },
)
})
@@ -70,7 +70,7 @@ if (isCI) {
it('should contain a non minified and a minified content', () => {
expect(global.components[0]).toContain(
- 'ATTENTION: This file is auto generated'
+ 'ATTENTION: This file is auto generated',
)
expect(global.components[1]).toMatch(/^:root{--/)
})
@@ -78,10 +78,10 @@ if (isCI) {
it('includes correct files', () => {
expect(global.files).toHaveLength(2)
expect(global.files[0]).toContain(
- '/style/themes/theme-ui/ui-theme-components.css'
+ '/style/themes/theme-ui/ui-theme-components.css',
)
expect(global.files[1]).toContain(
- '/style/themes/theme-ui/ui-theme-components.min.css'
+ '/style/themes/theme-ui/ui-theme-components.min.css',
)
})
})
@@ -92,7 +92,7 @@ if (isCI) {
'./src/style/dnb-ui-elements.scss',
{
returnResult: true,
- }
+ },
)
})
@@ -108,7 +108,7 @@ if (isCI) {
'./src/style/themes/theme-ui/ui-theme-basis.scss',
{
returnResult: true,
- }
+ },
)
})
@@ -119,10 +119,10 @@ if (isCI) {
it('has to have correct custom properties', () => {
expect(global.theme[0]).toMatch(
- new RegExp('--color-sea-green:\\s?#007272;')
+ new RegExp('--color-sea-green:\\s?#007272;'),
)
expect(global.theme[0]).toMatch(
- new RegExp('color:\\s?var\\(--color-sea-green\\);')
+ new RegExp('color:\\s?var\\(--color-sea-green\\);'),
)
expect(global.theme[0]).not.toMatch(new RegExp('color:\\s?#007272;'))
expect(global.theme[0]).not.toContain('fuchsia')
@@ -130,7 +130,7 @@ if (isCI) {
it('has to have correct core path to fonts', () => {
expect(global.theme[0]).toMatch(
- new RegExp('("|\\()../../../assets/fonts/dnb/')
+ new RegExp('("|\\()../../../assets/fonts/dnb/'),
)
})
})
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makePropertiesFile.test.ts b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makePropertiesFile.test.ts
index 573a0cf467c..8cd79495c9e 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makePropertiesFile.test.ts
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makePropertiesFile.test.ts
@@ -37,7 +37,7 @@ describe('Properties for sbanken', () => {
it('has to validate', () => {
expect(global.sbanken).toMatchSnapshot()
expect(global.sbanken).toContain(
- `'--sb-font-family-default': '"Roboto", "Helvetica", "Arial", sans-serif'`
+ `'--sb-font-family-default': '"Roboto", "Helvetica", "Arial", sans-serif'`,
)
})
})
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeReleaseVersion.test.ts b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeReleaseVersion.test.ts
index 5287bc0628c..8716522d34b 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeReleaseVersion.test.ts
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeReleaseVersion.test.ts
@@ -77,7 +77,7 @@ describe('makeReleaseVersion', () => {
expect(fs.writeFile).toHaveBeenCalledTimes(1)
expect(fs.writeFile).toHaveBeenLastCalledWith(
expect.stringContaining('src/shared/Eufemia.js'),
- expect.stringContaining(`return '123456789'`)
+ expect.stringContaining(`return '123456789'`),
)
})
@@ -94,11 +94,11 @@ describe('makeReleaseVersion', () => {
expect(fs.writeFile).toHaveBeenCalledTimes(1)
expect(fs.writeFile).toHaveBeenLastCalledWith(
expect.stringContaining('src/shared/Eufemia.js'),
- expect.stringContaining(`return 'release'`)
+ expect.stringContaining(`return 'release'`),
)
expect(fs.writeFile).toHaveBeenLastCalledWith(
expect.stringContaining('src/shared/Eufemia.js'),
- expect.stringContaining(`export const version = 'release'`)
+ expect.stringContaining(`export const version = 'release'`),
)
})
})
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/postTypeGeneration.test.ts b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/postTypeGeneration.test.ts
index 467a8aca3dd..a696e573f36 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/postTypeGeneration.test.ts
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/postTypeGeneration.test.ts
@@ -9,7 +9,7 @@ describe('generateTypes did generate', () => {
it('Input index', async () => {
const content = await fs.readFile(
require.resolve('@dnb/eufemia/src/components/Input.d.ts'),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain('export default Input')
})
@@ -17,7 +17,7 @@ describe('generateTypes did generate', () => {
it('Input components', async () => {
const content = await fs.readFile(
require.resolve('@dnb/eufemia/src/components/input/Input.d.ts'),
- 'utf-8'
+ 'utf-8',
)
expect(content).toContain('export interface InputProps')
})
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/prepareTemplates.test.ts b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/prepareTemplates.test.ts
index c4569b03f9f..15a154bc4a5 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/prepareTemplates.test.ts
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/prepareTemplates.test.ts
@@ -76,42 +76,42 @@ describe('prepareTemplates', () => {
expect(writeFile).toHaveBeenNthCalledWith(
9,
dest9,
- expect.stringContaining(`export default {}`)
+ expect.stringContaining(`export default {}`),
)
expect(writeFile).toHaveBeenNthCalledWith(
9,
dest9,
expect.stringContaining(
- `export { ComponentA, ComponentB, ElementA, ElementB }`
- )
+ `export { ComponentA, ComponentB, ElementA, ElementB }`,
+ ),
)
expect(writeFile).toHaveBeenNthCalledWith(
9,
dest9,
expect.stringContaining(
- `import ElementB from './elements/element-b'`
- )
+ `import ElementB from './elements/element-b'`,
+ ),
)
expect(writeFile).toHaveBeenNthCalledWith(
9,
dest9,
expect.stringContaining(
- `import ElementA from './elements/element-a'`
- )
+ `import ElementA from './elements/element-a'`,
+ ),
)
expect(writeFile).toHaveBeenNthCalledWith(
9,
dest9,
expect.stringContaining(
- `import ComponentB from './components/component-b/ComponentB'`
- )
+ `import ComponentB from './components/component-b/ComponentB'`,
+ ),
)
expect(writeFile).toHaveBeenNthCalledWith(
9,
dest9,
expect.stringContaining(
- `import ComponentA from './components/component-a/ComponentA'`
- )
+ `import ComponentA from './components/component-a/ComponentA'`,
+ ),
)
})
@@ -128,20 +128,20 @@ describe('prepareTemplates', () => {
1,
dest1,
expect.stringContaining(
- `import ComponentA from './component-a/ComponentA'`
- )
+ `import ComponentA from './component-a/ComponentA'`,
+ ),
)
expect(writeFile).toHaveBeenNthCalledWith(
1,
dest1,
expect.stringContaining(
- `import ComponentB from './component-b/ComponentB'`
- )
+ `import ComponentB from './component-b/ComponentB'`,
+ ),
)
expect(writeFile).toHaveBeenNthCalledWith(
1,
dest1,
- expect.stringContaining(`export { ComponentA, ComponentB }`)
+ expect.stringContaining(`export { ComponentA, ComponentB }`),
)
const dest2 = expect.stringContaining('/src/components/lib.ts')
@@ -149,25 +149,25 @@ describe('prepareTemplates', () => {
2,
dest2,
expect.stringContaining(
- `import ComponentA from './component-a/ComponentA'`
- )
+ `import ComponentA from './component-a/ComponentA'`,
+ ),
)
expect(writeFile).toHaveBeenNthCalledWith(
2,
dest2,
expect.stringContaining(
- `import ComponentB from './component-b/ComponentB'`
- )
+ `import ComponentB from './component-b/ComponentB'`,
+ ),
)
expect(writeFile).toHaveBeenNthCalledWith(
2,
dest2,
- expect.stringContaining(`export { ComponentA, ComponentB }`)
+ expect.stringContaining(`export { ComponentA, ComponentB }`),
)
expect(writeFile).toHaveBeenNthCalledWith(
2,
dest2,
- expect.stringContaining(`return { ComponentA, ComponentB }`)
+ expect.stringContaining(`return { ComponentA, ComponentB }`),
)
const dest3 = expect.stringContaining('/src/components/ComponentA.ts')
@@ -175,18 +175,18 @@ describe('prepareTemplates', () => {
3,
dest3,
expect.stringContaining(
- `import ComponentA from './component-a/ComponentA'`
- )
+ `import ComponentA from './component-a/ComponentA'`,
+ ),
)
expect(writeFile).toHaveBeenNthCalledWith(
3,
dest3,
- expect.stringContaining(`export * from './component-a/ComponentA'`)
+ expect.stringContaining(`export * from './component-a/ComponentA'`),
)
expect(writeFile).toHaveBeenNthCalledWith(
3,
dest3,
- expect.stringContaining(`export default ComponentA`)
+ expect.stringContaining(`export default ComponentA`),
)
const dest4 = expect.stringContaining('/src/components/ComponentB.ts')
@@ -194,18 +194,18 @@ describe('prepareTemplates', () => {
4,
dest4,
expect.stringContaining(
- `import ComponentB from './component-b/ComponentB'`
- )
+ `import ComponentB from './component-b/ComponentB'`,
+ ),
)
expect(writeFile).toHaveBeenNthCalledWith(
4,
dest4,
- expect.stringContaining(`export * from './component-b/ComponentB'`)
+ expect.stringContaining(`export * from './component-b/ComponentB'`),
)
expect(writeFile).toHaveBeenNthCalledWith(
4,
dest4,
- expect.stringContaining(`export default ComponentB`)
+ expect.stringContaining(`export default ComponentB`),
)
})
@@ -221,14 +221,14 @@ describe('prepareTemplates', () => {
expect(writeFile).toHaveBeenNthCalledWith(
1,
dest1,
- expect.stringContaining(`export { FragmentA, FragmentB }`)
+ expect.stringContaining(`export { FragmentA, FragmentB }`),
)
const dest2 = expect.stringContaining('/src/fragments/lib.ts')
expect(writeFile).toHaveBeenNthCalledWith(
2,
dest2,
- expect.stringContaining(`return { FragmentA, FragmentB }`)
+ expect.stringContaining(`return { FragmentA, FragmentB }`),
)
const dest3 = expect.stringContaining('/fragments/FragmentA.ts')
@@ -236,15 +236,15 @@ describe('prepareTemplates', () => {
3,
dest3,
expect.stringContaining(
- `import FragmentA from './fragment-a/FragmentA'`
- )
+ `import FragmentA from './fragment-a/FragmentA'`,
+ ),
)
const dest4 = expect.stringContaining('/fragments/FragmentB.ts')
expect(writeFile).toHaveBeenNthCalledWith(
4,
dest4,
- expect.stringContaining(`export * from './fragment-b/FragmentB'`)
+ expect.stringContaining(`export * from './fragment-b/FragmentB'`),
)
})
@@ -260,14 +260,14 @@ describe('prepareTemplates', () => {
expect(writeFile).toHaveBeenNthCalledWith(
1,
dest1,
- expect.stringContaining(`export { ElementA, ElementB }`)
+ expect.stringContaining(`export { ElementA, ElementB }`),
)
const dest2 = expect.stringContaining('/src/elements/lib.ts')
expect(writeFile).toHaveBeenNthCalledWith(
2,
dest2,
- expect.stringContaining(`return { ElementA, ElementB }`)
+ expect.stringContaining(`return { ElementA, ElementB }`),
)
})
@@ -283,14 +283,14 @@ describe('prepareTemplates', () => {
expect(writeFile).toHaveBeenNthCalledWith(
1,
dest1,
- expect.stringContaining(`export { ExtensionA, ExtensionB }`)
+ expect.stringContaining(`export { ExtensionA, ExtensionB }`),
)
const dest2 = expect.stringContaining('/src/extensions/lib.ts')
expect(writeFile).toHaveBeenNthCalledWith(
2,
dest2,
- expect.stringContaining(`return { ExtensionA, ExtensionB }`)
+ expect.stringContaining(`return { ExtensionA, ExtensionB }`),
)
})
})
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/themeFactory.test.ts b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/themeFactory.test.ts
index 88609c50319..888ee8214f0 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/themeFactory.test.ts
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/themeFactory.test.ts
@@ -19,7 +19,7 @@ jest.mock('fs-extra', () => {
jest.requireActual('../themeFactory')
return `${editAdvice.replace(
'',
- 'components'
+ 'components',
)}${insertBelowAdvice}`
}
@@ -162,12 +162,12 @@ describe('runFactory', () => {
expect(fs.writeFile).toHaveBeenNthCalledWith(
1,
'./theme-sbanken/sbanken-theme-components.scss',
- expect.any(String)
+ expect.any(String),
)
expect(fs.writeFile).toHaveBeenNthCalledWith(
2,
'./theme-ui/ui-theme-components.scss',
- expect.any(String)
+ expect.any(String),
)
expect(result).toMatchInlineSnapshot(`
"
@@ -204,7 +204,7 @@ const make = async ({ scssOutputPath, targetFile }) => {
filesToFindGlob: [
path.resolve(
__dirname,
- '../../../../src/{components,fragments}/**/style/themes/**/*-theme-*.scss'
+ '../../../../src/{components,fragments}/**/style/themes/**/*-theme-*.scss',
),
],
returnResult: true,
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/convertSvgToJsx.ts b/packages/dnb-eufemia/scripts/prebuild/tasks/convertSvgToJsx.ts
index c5cf6ab3aa6..27d2153b4d9 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/convertSvgToJsx.ts
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/convertSvgToJsx.ts
@@ -52,11 +52,11 @@ export default async function convertSvgToJsx({
],
{
force: true,
- }
+ },
)
log.info(
- '> PrePublish: deleted all svg files before converting "svg to jsx"!'
+ '> PrePublish: deleted all svg files before converting "svg to jsx"!',
)
}
@@ -65,7 +65,7 @@ export default async function convertSvgToJsx({
path.dirname(path.resolve(ROOT_DIR, srcPath, '../')),
{
withFileTypes: true,
- }
+ },
)
)
.filter((dir) => dir.isDirectory())
@@ -73,7 +73,7 @@ export default async function convertSvgToJsx({
await asyncForEach(dirs, async (assetsDir) => {
log.start(
- `> PrePublish: converting "svg to jsx" for "${assetsDir}" as started ...`
+ `> PrePublish: converting "svg to jsx" for "${assetsDir}" as started ...`,
)
const icons: TransformedIcons = await transformSvg({
@@ -88,7 +88,7 @@ export default async function convertSvgToJsx({
log.succeed(
`> PrePublish: Converting "svg to jsx" for "${assetsDir}" is done (converted ${
icons.length
- } icons with ${icons.length / sizes.length} in total)`
+ } icons with ${icons.length / sizes.length} in total)`,
)
await controllRoutine(icons)
@@ -97,7 +97,7 @@ export default async function convertSvgToJsx({
const controllRoutine = async (icons: TransformedIcons) => {
const sizes = Object.values(ICON_SIZES).filter(({ suffix }) =>
- Boolean(suffix)
+ Boolean(suffix),
)
sizes.forEach(({ suffix: size }) => {
@@ -113,7 +113,7 @@ const controllRoutine = async (icons: TransformedIcons) => {
log.fail(
`The icon "${origName}" was not found with another size${
origName.endsWith(size) ? '' : ` (${size})`
- }! They should be looked up. The failure can be in several places.`
+ }! They should be looked up. The failure can be in several places.`,
)
}
})
@@ -155,7 +155,7 @@ const transformSvgToReact = ({ srcPath, destPath }) => {
.pipe(
rename((path) => {
path.extname = '.tsx'
- })
+ }),
)
.pipe(gulp.dest(destPath, { cwd: ROOT_DIR }))
.on('end', resolve)
@@ -179,7 +179,7 @@ const transformToJsx = (content, file): PromiseLike => {
try {
content = content.replace(
/clip[0-9]+/g,
- `clip-${md5(filename).substring(0, 6)}`
+ `clip-${md5(filename).substring(0, 6)}`,
)
return new Promise((resolve, reject) =>
svgr(
@@ -194,29 +194,30 @@ const transformToJsx = (content, file): PromiseLike => {
*/
plugins: ['@svgr/plugin-jsx'],
},
- { componentName }
+ { componentName },
)
- .then((res) => {
+ .then(async (res) => {
log.info(`> PrePublish: Icon was converted: ${basename}`)
resolve(
'/** This file is auto generated by convertSvgToJsx.ts */\n\n' +
- prettier
- .format(res, {
+ (
+ await prettier.format(res, {
...prettierrc,
parser: 'babel',
})
+ )
// This is a fix, so the Rollup ESM export does export React.createElement, and not only createElement with a named import
.replace(
new RegExp(`import \\* as React from 'react'`, 'g'),
- `import React from 'react'`
- )
+ `import React from 'react'`,
+ ),
)
})
- .catch(reject)
+ .catch(reject),
)
} catch (e) {
log.fail(
- `> PrePublish: convertSvgToJsx conversion of "${basename}" failed`
+ `> PrePublish: convertSvgToJsx conversion of "${basename}" failed`,
)
throw e
}
@@ -283,12 +284,12 @@ const generateIndexFile = async ({
({ name, filename }) =>
`import ${name} from '.${
assetsDir === '' ? `/${FALLBACK}` : ''
- }/${filename}'`
+ }/${filename}'`,
)
.join('\n')
const _keys = icons.map(({ name }) => name).join(', ')
- const indexContent = prettier.format(
+ const indexContent = await prettier.format(
`/** This file is auto generated by convertSvgToJsx.ts */
${_imports}
@@ -298,7 +299,7 @@ const generateIndexFile = async ({
{
...prettierrc,
parser: 'babel',
- }
+ },
)
try {
@@ -306,7 +307,7 @@ const generateIndexFile = async ({
ROOT_DIR,
destPath,
assetsDir,
- `index.ts`
+ `index.ts`,
)
await fs.writeFile(indexFile, indexContent)
@@ -329,7 +330,7 @@ const generateGroupFiles = async ({
// from the svg lock file we can generate groups out of the "bundleName"
const groups: Record> = Object.entries(
- lockFileContent
+ lockFileContent,
).reduce((acc, [file, { bundleName }]) => {
acc[bundleName] = acc[bundleName] || []
const basename = path.basename(file)
@@ -338,7 +339,7 @@ const generateGroupFiles = async ({
ROOT_DIR,
destPath,
assetsDir,
- `${filename}.tsx`
+ `${filename}.tsx`,
)
// make sure the file actually exists
@@ -360,23 +361,23 @@ const generateGroupFiles = async ({
Object.entries(groups),
async ([groupName, entries]) => {
entries = entries.sort(({ name: a }, { name: b }) =>
- a > b ? 1 : -1
+ a > b ? 1 : -1,
)
const groupFile = path.resolve(
ROOT_DIR,
destPath,
assetsDir,
- `${groupName}.ts`
+ `${groupName}.ts`,
)
const _imports = entries
.map(
- ({ name, filename }) => `import ${name} from './${filename}'`
+ ({ name, filename }) => `import ${name} from './${filename}'`,
)
.join('\n')
const _keys = entries.map(({ name }) => name).join(', ')
- const groupFileContent = prettier.format(
+ const groupFileContent = await prettier.format(
`/** This file is auto generated by convertSvgToJsx.ts */
${_imports}
@@ -386,11 +387,11 @@ const generateGroupFiles = async ({
{
...prettierrc,
parser: 'babel',
- }
+ },
)
await fs.writeFile(groupFile, groupFileContent)
- }
+ },
)
} catch (e) {
throw new Error(e)
@@ -404,7 +405,7 @@ const generateFallbackIndexFiles = async ({
}: ForwardParams) => {
try {
await asyncForEach(Object.entries(icons), async ([, { filename }]) => {
- const indexFileContent = prettier.format(
+ const indexFileContent = await prettier.format(
`/** This file is auto generated by convertSvgToJsx.ts */
import icon from './${assetsDir}/${filename}'
@@ -413,7 +414,7 @@ const generateFallbackIndexFiles = async ({
{
...prettierrc,
parser: 'babel',
- }
+ },
)
const indexFile = path.resolve(ROOT_DIR, destPath, `${filename}.ts`)
@@ -426,5 +427,8 @@ const generateFallbackIndexFiles = async ({
}
const prettierrc = JSON.parse(
- fs.readFileSync(path.resolve(__dirname, '../../../.prettierrc'), 'utf-8')
+ fs.readFileSync(
+ path.resolve(__dirname, '../../../.prettierrc'),
+ 'utf-8',
+ ),
)
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes.js
index 3199cc46004..7121620e745 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes.js
@@ -54,12 +54,12 @@ export default async function generateTypes({
export const createTypes = async (
listOfAllFiles,
- { isTest = false, ...opts } = {}
+ { isTest = false, ...opts } = {},
) => {
try {
const prettierrc = await fs.readJSON(
nodePath.resolve('./.prettierrc'),
- 'utf-8'
+ 'utf-8',
)
// "prettier.format" does not handle "overwrites", so we merge it manually
@@ -109,7 +109,7 @@ export const createTypes = async (
if (collectProps.findIndex((k) => k === key) === -1) {
if (!sharedProps.includes(key)) {
log.fail(
- `The property "${key}" is not defined in PropTypes!\nComponent: ${componentName}\nFile: ${file}\n\n`
+ `The property "${key}" is not defined in PropTypes!\nComponent: ${componentName}\nFile: ${file}\n\n`,
)
}
}
@@ -216,13 +216,13 @@ export const createTypes = async (
],
],
...babelPluginConfigDefaults,
- }
+ },
)
definitionContent = codeWithTransformedTypes
}
- definitionContent = prettier.format(definitionContent, {
+ definitionContent = await prettier.format(definitionContent, {
...prettierrc,
filepath: 'file.d.ts',
})
@@ -246,7 +246,7 @@ function existsInGit(destFile) {
return new Promise((resolve, reject) => {
try {
exec(`git show HEAD~1:${destFile}`, (error, stdout, stderr) =>
- resolve(!(error || stderr))
+ resolve(!(error || stderr)),
)
} catch (e) {
log.fail(e)
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginCorrectTypes.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginCorrectTypes.test.js
index 2d35b038097..9d0f3997b85 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginCorrectTypes.test.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginCorrectTypes.test.js
@@ -13,7 +13,7 @@ describe('babelPluginCorrectTypes', () => {
it('has to match snapshot', async () => {
const file = nodePath.resolve(
__dirname,
- '__mocks__/PrimaryComponent.js'
+ '__mocks__/PrimaryComponent.js',
)
const sourceDir = nodePath.dirname(file)
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginExtendTypes.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginExtendTypes.test.js
index 0ecc1bf9a02..6c3c8abf665 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginExtendTypes.test.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginExtendTypes.test.js
@@ -12,11 +12,11 @@ describe('babelPluginExtendTypes', () => {
it('has to match snapshot', async () => {
const targetFile = nodePath.resolve(
__dirname,
- '__mocks__/PrimaryComponent.d.ts'
+ '__mocks__/PrimaryComponent.d.ts',
)
const file = nodePath.resolve(
__dirname,
- '__mocks__/PrimaryComponent.js'
+ '__mocks__/PrimaryComponent.js',
)
const { code } = await transformFileAsync(targetFile, {
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginPropTypesRelations.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginPropTypesRelations.test.js
index 4750d7a6b4f..a01ce63730d 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginPropTypesRelations.test.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginPropTypesRelations.test.js
@@ -12,7 +12,7 @@ describe('babelPluginPropTypesRelations', () => {
it('has to match snapshot', async () => {
const file = nodePath.resolve(
__dirname,
- '__mocks__/PrimaryComponent.js'
+ '__mocks__/PrimaryComponent.js',
)
const sourceDir = nodePath.dirname(file)
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginExtendTypes.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginExtendTypes.js
index 9e9eeb81b79..b98da93be5b 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginExtendTypes.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginExtendTypes.js
@@ -145,7 +145,7 @@ export function babelPluginExtendTypes(babel, { file } = {}) {
}
},
})
- }
+ },
)
}
},
@@ -163,8 +163,8 @@ function inertClassProperty({ t, path, property, value, type }) {
: null,
null,
false,
- true
- )
+ true,
+ ),
)
}
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginIncludeDocs.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginIncludeDocs.js
index 8f368772a98..a5f4ada930b 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginIncludeDocs.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginIncludeDocs.js
@@ -1,6 +1,6 @@
export function babelPluginIncludeDocs(
plugin,
- { docs, onComplete = null, insertLeadingComment = null }
+ { docs, onComplete = null, insertLeadingComment = null },
) {
if (!docs) {
return {} // stop here
@@ -30,8 +30,8 @@ export function babelPluginIncludeDocs(
'leading',
insertLeadingComment === true
? `*\n * NB: Do not change the docs (comments) in here. The docs are updated during build time by "generateTypes.js" and "fetchPropertiesFromDocs.js".\n `
- : insertLeadingComment
- )
+ : insertLeadingComment,
+ ),
)
}
}
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginPropTypesRelations.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginPropTypesRelations.js
index 11bd25c192d..0ba1b932174 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginPropTypesRelations.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginPropTypesRelations.js
@@ -168,7 +168,7 @@ export function babelPluginPropTypesRelations(babel, { sourceDir }) {
const code = fs.readFileSync(
nodePath.resolve(sourceDir, sourceFile + '.js'),
- 'utf-8'
+ 'utf-8',
)
ast = parse(code, babylonConfigDefaults)
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/fetchPropertiesFromDocs.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/fetchPropertiesFromDocs.js
index cfd41093c72..1e64e929735 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/fetchPropertiesFromDocs.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/fetchPropertiesFromDocs.js
@@ -16,7 +16,7 @@ import {
const ROOT_DIR = path.resolve(
path.dirname(require.resolve('dnb-design-system-portal/package.json')),
- 'src/docs/uilib'
+ 'src/docs/uilib',
)
/**
@@ -30,20 +30,20 @@ const ROOT_DIR = path.resolve(
function extractPathParts({ file }) {
const basename = path.basename(file)
const componentName = toPascalCase(
- toSnakeCase(basename.replace(path.extname(file), ''))
+ toSnakeCase(basename.replace(path.extname(file), '')),
)
const tmpComponentName = toKebabCase(componentName)
const firstPartOfFilename = tmpComponentName.split('-')[0]
const parts = file
.split('/')
.map((name) =>
- toKebabCase(path.basename(name).replace(path.extname(file), ''))
+ toKebabCase(path.basename(name).replace(path.extname(file), '')),
)
const componentDir =
parts.find((path) =>
new RegExp(
- `(${firstPartOfFilename}-|^${firstPartOfFilename}$)`
- ).test(path)
+ `(${firstPartOfFilename}-|^${firstPartOfFilename}$)`,
+ ).test(path),
) || ''
const index = parts.findIndex((part) => part === componentDir)
const groupDir = parts[index - 1] || ''
@@ -209,13 +209,13 @@ async function extractorFactory({
let cleanedKey = propName.replace(
/<[^<]*>([^<]*)<\/[^<]*>/g,
- '$1'
+ '$1',
) // removes e.g. defined as **
// Drop empty types
if (cleanedKey.trim() === '') {
log.fail(
- `This file below has an empty prop-type entry!\n${file}\n\n`
+ `This file below has an empty prop-type entry!\n${file}\n\n`,
)
return // skip here
}
@@ -236,7 +236,7 @@ async function extractorFactory({
if (description) {
collection[cleanedKey] = description
}
- }
+ },
)
if (process.env.NODE_ENV !== 'test') {
@@ -244,7 +244,7 @@ async function extractorFactory({
}
return collection
- }
+ },
)
const docs = collections
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/makeLibStyles.js b/packages/dnb-eufemia/scripts/prebuild/tasks/makeLibStyles.js
index 04b86eb1043..0f78063d4d5 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/makeLibStyles.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/makeLibStyles.js
@@ -29,7 +29,7 @@ export default async function makeLibStyles() {
await runFactory('./src/components/**/style/**/dnb-*.scss')
await runFactory('./src/extensions/**/style/**/dnb-*.scss')
log.succeed(
- `> PrePublish: "makeLibStyles" converting sass to css done`
+ `> PrePublish: "makeLibStyles" converting sass to css done`,
)
} catch (e) {
throw new Error(e)
@@ -38,7 +38,7 @@ export default async function makeLibStyles() {
export const runFactory = (
src,
- { returnResult = false, returnFiles = false } = {}
+ { returnResult = false, returnFiles = false } = {},
) =>
new Promise((resolve, reject) => {
log.start(`> PrePublish: converting sass to css | ${src}`)
@@ -62,13 +62,13 @@ export const runFactory = (
.pipe(
rename({
extname: '.css',
- })
+ }),
)
.pipe(
transform(
'utf8',
- transformPaths('../../../../assets/', '../../../assets/')
- )
+ transformPaths('../../../../assets/', '../../../assets/'),
+ ),
)
.pipe(transform('utf8', transformPostcss(postcssConfig({ sass }))))
.pipe(cloneSink)
@@ -80,14 +80,14 @@ export const runFactory = (
stream.pipe(
gulp.dest(`./build/${dest}/`, {
cwd: ROOT_DIR,
- })
+ }),
)
}
// so tests can test the minified code
if (returnResult) {
stream.pipe(
- transform('utf8', transformCssnano({ reduceIdents: false }))
+ transform('utf8', transformCssnano({ reduceIdents: false })),
)
}
@@ -98,8 +98,8 @@ export const runFactory = (
.pipe(
transform(
'utf8',
- transformPaths('../../../../assets/', '../../../assets/')
- )
+ transformPaths('../../../../assets/', '../../../assets/'),
+ ),
)
.pipe(
returnResult || returnFiles
@@ -115,7 +115,7 @@ export const runFactory = (
})
: gulp.dest(`./build/${dest}/`, {
cwd: ROOT_DIR,
- })
+ }),
)
.on('end', resolve)
.on('error', reject)
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/makeMainStyle.js b/packages/dnb-eufemia/scripts/prebuild/tasks/makeMainStyle.js
index 89251f67c76..ec70645dcfc 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/makeMainStyle.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/makeMainStyle.js
@@ -29,7 +29,7 @@ export default async function makeMainStyle() {
// this way we avoid cross "includePaths" and the result is:
// Now a custom theme can overwrite existing CSS Custom Properties
const listWithThemesToProcess = await globby(
- './src/style/themes/theme-*/*-theme-*.scss'
+ './src/style/themes/theme-*/*-theme-*.scss',
)
await asyncForEach(listWithThemesToProcess, async (themeFile) => {
// in order to keep the folder structure, we have to add these asterisks
@@ -38,7 +38,7 @@ export default async function makeMainStyle() {
})
const listWithPackagesToProcess = await globby(
- './src/style/**/*-ui-*.scss'
+ './src/style/**/*-ui-*.scss',
)
await asyncForEach(listWithPackagesToProcess, async (packageFile) => {
// in order to keep the folder structure, we have to add these asterisks
@@ -47,13 +47,13 @@ export default async function makeMainStyle() {
})
log.succeed(
- '> PrePublish: "makeMainStyle" transforming style modules done'
+ '> PrePublish: "makeMainStyle" transforming style modules done',
)
}
export const runFactory = (
src,
- { returnResult = false, returnFiles = false } = {}
+ { returnResult = false, returnFiles = false } = {},
) =>
new Promise((resolve, reject) => {
log.start('> PrePublish: transforming main style')
@@ -69,7 +69,7 @@ export const runFactory = (
.pipe(
rename({
extname: '.css',
- })
+ }),
)
.pipe(transform('utf8', transformPostcss(postcssConfig({ sass }))))
.pipe(cloneSink)
@@ -81,14 +81,14 @@ export const runFactory = (
stream.pipe(
gulp.dest('./build/style', {
cwd: ROOT_DIR,
- })
+ }),
)
}
// so tests can test the minified code
if (returnResult) {
stream.pipe(
- transform('utf8', transformCssnano({ reduceIdents: false }))
+ transform('utf8', transformCssnano({ reduceIdents: false })),
)
}
@@ -97,7 +97,7 @@ export const runFactory = (
stream
.pipe(
- transform('utf8', transformPaths('../../assets/', '../assets/'))
+ transform('utf8', transformPaths('../../assets/', '../assets/')),
)
.pipe(
returnResult || returnFiles
@@ -113,7 +113,7 @@ export const runFactory = (
})
: gulp.dest('./build/style', {
cwd: ROOT_DIR,
- })
+ }),
)
.on('end', resolve)
.on('error', reject)
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/makePropertiesFile.js b/packages/dnb-eufemia/scripts/prebuild/tasks/makePropertiesFile.js
index 00d78493c82..7f4f4e4ba96 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/makePropertiesFile.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/makePropertiesFile.js
@@ -17,11 +17,11 @@ export default async function makePropertiesFile() {
await runFactory()
log.succeed(
- '> PrePublish: "makePropertiesFile" creating properties file done'
+ '> PrePublish: "makePropertiesFile" creating properties file done',
)
}
-const transformModulesContent = (content) => {
+const transformModulesContent = async (content) => {
const variables = content
.split('\n')
.map((s) => s.trim())
@@ -37,7 +37,7 @@ const transformModulesContent = (content) => {
return (
String(
- prettier.format(
+ await prettier.format(
`/** This file is auto generated by makePropertiesFile.js */
export default ${JSON.stringify(variables, null, 2)}`,
@@ -46,8 +46,8 @@ export default ${JSON.stringify(variables, null, 2)}`,
semi: true,
trailingComma: 'none',
singleQuote: true,
- }
- )
+ },
+ ),
).trim() + ' // prettier-ignore\n' // so manual changes not removes the semi
)
}
@@ -68,7 +68,7 @@ export const runFactory = ({
.pipe(
rename({
extname: '.js',
- })
+ }),
)
.pipe(
returnResult
@@ -76,7 +76,7 @@ export const runFactory = ({
: gulp.dest('./src/style/themes/', {
overwrite: true,
cwd: ROOT_DIR,
- })
+ }),
)
.on('end', resolve)
.on('error', reject)
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/prepareTemplates.js b/packages/dnb-eufemia/scripts/prebuild/tasks/prepareTemplates.js
index 76b0e0d3ded..a1b50afb02b 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/prepareTemplates.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/prepareTemplates.js
@@ -12,7 +12,10 @@ import { ErrorHandler, log } from '../../lib'
import { asyncForEach } from '../../tools'
const prettierrc = JSON.parse(
- fs.readFileSync(path.resolve(__dirname, '../../../.prettierrc'), 'utf-8')
+ fs.readFileSync(
+ path.resolve(__dirname, '../../../.prettierrc'),
+ 'utf-8',
+ ),
)
const isCLI = require.main === module
@@ -37,7 +40,7 @@ export const processComponents = async () => {
templateListToExtendBy: 'Template',
srcFile: path.resolve(
__dirname,
- '../../../src/core/templates/components-index-template.js'
+ '../../../src/core/templates/components-index-template.js',
),
destFile: path.resolve(__dirname, '../../../src/components/index.ts'),
filesToFindGlob: path.resolve(__dirname, '../../../src/components/'),
@@ -48,23 +51,23 @@ export const processComponents = async () => {
(res) => {
if (isCLI) {
log.succeed(
- '> PrePublish: Created the index template with all the components'
+ '> PrePublish: Created the index template with all the components',
)
}
return res
- }
+ },
)
await runFactory({
...componentsTemplateConfig,
srcFile: path.resolve(
__dirname,
- '../../../src/core/templates/components-lib-template.js'
+ '../../../src/core/templates/components-lib-template.js',
),
destFile: path.resolve(__dirname, '../../../src/components/lib.ts'),
}).then((res) => {
if (isCLI) {
log.succeed(
- '> PrePublish: Created the index template with all the components'
+ '> PrePublish: Created the index template with all the components',
)
}
return res
@@ -73,14 +76,14 @@ export const processComponents = async () => {
...componentsTemplateConfig,
srcFile: path.resolve(
__dirname,
- '../../../src/core/templates/component-export-template.js'
+ '../../../src/core/templates/component-export-template.js',
),
destFile: false,
destPath: path.resolve(__dirname, '../../../src/components'),
}).then((res) => {
if (isCLI) {
log.succeed(
- '> PrePublish: Created the index template with all the components'
+ '> PrePublish: Created the index template with all the components',
)
}
return res
@@ -96,7 +99,7 @@ export const processFragments = async () => {
templateListToExtendBy: 'Template',
srcFile: path.resolve(
__dirname,
- '../../../src/core/templates/components-index-template.js'
+ '../../../src/core/templates/components-index-template.js',
),
destFile: path.resolve(__dirname, '../../../src/fragments/index.ts'),
filesToFindGlob: path.resolve(__dirname, '../../../src/fragments/'),
@@ -106,7 +109,7 @@ export const processFragments = async () => {
await runFactory(fragmentsTemplateConfig).then((res) => {
if (isCLI) {
log.succeed(
- '> PrePublish: Created the index template with all the fragments'
+ '> PrePublish: Created the index template with all the fragments',
)
}
return res
@@ -115,13 +118,13 @@ export const processFragments = async () => {
...fragmentsTemplateConfig,
srcFile: path.resolve(
__dirname,
- '../../../src/core/templates/fragments-lib-template.js'
+ '../../../src/core/templates/fragments-lib-template.js',
),
destFile: path.resolve(__dirname, '../../../src/fragments/lib.ts'),
}).then((res) => {
if (isCLI) {
log.succeed(
- '> PrePublish: Created the index template with all the fragments'
+ '> PrePublish: Created the index template with all the fragments',
)
}
return res
@@ -130,14 +133,14 @@ export const processFragments = async () => {
...fragmentsTemplateConfig,
srcFile: path.resolve(
__dirname,
- '../../../src/core/templates/fragment-export-template.js'
+ '../../../src/core/templates/fragment-export-template.js',
),
destFile: false,
destPath: path.resolve(__dirname, '../../../src/fragments'),
}).then((res) => {
if (isCLI) {
log.succeed(
- '> PrePublish: Created the index template with all the fragments'
+ '> PrePublish: Created the index template with all the fragments',
)
}
return res
@@ -151,7 +154,7 @@ export const processElements = async () => {
templateListToExtendBy: 'Template',
srcFile: path.resolve(
__dirname,
- '../../../src/core/templates/elements-index-template.js'
+ '../../../src/core/templates/elements-index-template.js',
),
destFile: path.resolve(__dirname, '../../../src/elements/index.ts'),
filesToFindGlob: path.resolve(__dirname, '../../../src/elements/'),
@@ -176,7 +179,7 @@ export const processElements = async () => {
...elementsTemplateConfig,
srcFile: path.resolve(
__dirname,
- '../../../src/core/templates/elements-lib-template.js'
+ '../../../src/core/templates/elements-lib-template.js',
),
destFile: path.resolve(__dirname, '../../../src/elements/lib.ts'),
processToNamesIgnoreList: ['index', 'lib', 'Element'],
@@ -191,14 +194,14 @@ export const processElements = async () => {
filesToFindGlobByUsingFolders: true,
srcFile: path.resolve(
__dirname,
- '../../../src/core/templates/element-export-template.js'
+ '../../../src/core/templates/element-export-template.js',
),
destFile: false,
destPath: path.resolve(__dirname, '../../../src/elements'),
}).then((res) => {
if (isCLI) {
log.succeed(
- '> PrePublish: Created the index template with all the elements'
+ '> PrePublish: Created the index template with all the elements',
)
}
return res
@@ -214,7 +217,7 @@ export const processExtensions = async () => {
templateListToExtendBy: 'Template',
srcFile: path.resolve(
__dirname,
- '../../../src/core/templates/components-index-template.js'
+ '../../../src/core/templates/components-index-template.js',
),
destFile: path.resolve(__dirname, '../../../src/extensions/index.ts'),
filesToFindGlob: path.resolve(__dirname, '../../../src/extensions/'),
@@ -233,7 +236,7 @@ export const processExtensions = async () => {
...{
srcFile: path.resolve(
__dirname,
- '../../../src/core/templates/extensions-lib-template.js'
+ '../../../src/core/templates/extensions-lib-template.js',
),
destFile: path.resolve(__dirname, '../../../src/extensions/lib.ts'),
},
@@ -253,7 +256,7 @@ export const processMainIndex = async ({ components, elements }) => {
templateListToExtendBy: 'Template',
srcFile: path.resolve(
__dirname,
- '../../../src/core/templates/main-index-template.js'
+ '../../../src/core/templates/main-index-template.js',
),
destFile: path.resolve(__dirname, '../../../src/index.ts'),
filesToFindGlob: [...components, ...elements],
@@ -295,7 +298,7 @@ export const runFactory = async ({
})
if (filesToFindGlobByUsingFolders) {
filesToFindGlob = filesToFindGlob.filter(({ source }) =>
- fs.lstatSync(source).isDirectory()
+ fs.lstatSync(source).isDirectory(),
)
} else {
filesToFindGlob = filesToFindGlob
@@ -328,7 +331,7 @@ export const runFactory = async ({
await asyncForEach(filesToFindGlob, async ({ file }) => {
const destFile = path.resolve(
destPath,
- `${camelCase(file, { pascalCase: true })}.ts`
+ `${camelCase(file, { pascalCase: true })}.ts`,
)
try {
@@ -338,20 +341,20 @@ export const runFactory = async ({
// 1. replace templateListToExtendBy
.replace(
new RegExp(templateListToExtendBy, 'g'),
- camelCase(file, { pascalCase: true })
+ camelCase(file, { pascalCase: true }),
)
// 2. replace templateListToExtendBy, but lower case
.replace(
new RegExp(templateListToExtendBy.toLowerCase(), 'g'),
- file
+ file,
)
await fs.writeFile(
destFile,
- prettier.format(`${autoAdvice}${content}`, {
+ await prettier.format(`${autoAdvice}${content}`, {
...prettierrc,
parser: 'babel',
- })
+ }),
)
} catch (e) {
log.fail(`There was an error on creating ${destFile}!`)
@@ -369,7 +372,7 @@ export const runFactory = async ({
new RegExp(templateObjectToFill, 'g'),
`{ ${filesToFindGlob
.map(({ file }) => camelCase(file, { pascalCase: true }))
- .join(', ')} }`
+ .join(', ')} }`,
)
// 2. replace templateListToExtend
.replace(
@@ -379,11 +382,11 @@ export const runFactory = async ({
let res = templateListToExtend
.replace(
new RegExp(templateListToExtendBy, 'g'),
- camelCase(file, { pascalCase: true })
+ camelCase(file, { pascalCase: true }),
)
.replace(
new RegExp(templateListToExtendBy.toLowerCase(), 'g'),
- file
+ file,
)
// in case we have a type to replace
@@ -405,15 +408,15 @@ export const runFactory = async ({
return res
})
- .join('\n')
+ .join('\n'),
)
try {
await fs.writeFile(
destFile,
- prettier.format(`${autoAdvice}${content}`, {
+ await prettier.format(`${autoAdvice}${content}`, {
...prettierrc,
parser: 'babel',
- })
+ }),
)
} catch (e) {
log.fail(`There was an error on creating ${destFile}!`)
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/styleFactory.ts b/packages/dnb-eufemia/scripts/prebuild/tasks/styleFactory.ts
index 06432594494..95edf41c766 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/styleFactory.ts
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/styleFactory.ts
@@ -10,7 +10,10 @@ import prettier from 'prettier'
import { ErrorHandler, log } from '../../lib'
const prettierrc = JSON.parse(
- fs.readFileSync(path.resolve(__dirname, '../../../.prettierrc'), 'utf-8')
+ fs.readFileSync(
+ path.resolve(__dirname, '../../../.prettierrc'),
+ 'utf-8',
+ ),
)
const fallbackPrefix = 'dnb'
@@ -30,7 +33,7 @@ const runStyleFactory = async () => {
await runFactory({
scssOutputFile: path.resolve(
__dirname,
- `../../../src/style/${fallbackPrefix}-ui-components.scss`
+ `../../../src/style/${fallbackPrefix}-ui-components.scss`,
),
customContent: `
@import './core/utilities.scss';
@@ -46,7 +49,7 @@ const runStyleFactory = async () => {
}).then(() => {
if (require.main === module) {
log.succeed(
- '> PrePublish: "styleFactory" Created the style file with all the components'
+ '> PrePublish: "styleFactory" Created the style file with all the components',
)
}
})
@@ -55,7 +58,7 @@ const runStyleFactory = async () => {
await runFactory({
scssOutputFile: path.resolve(
__dirname,
- `../../../src/style/${fallbackPrefix}-ui-elements.scss`
+ `../../../src/style/${fallbackPrefix}-ui-elements.scss`,
),
customContent: `
@import './core/utilities.scss';`,
@@ -69,7 +72,7 @@ const runStyleFactory = async () => {
}).then(() => {
if (require.main === module) {
log.succeed(
- '> PrePublish: "styleFactory" Created the style file with all the elements'
+ '> PrePublish: "styleFactory" Created the style file with all the elements',
)
}
})
@@ -78,7 +81,7 @@ const runStyleFactory = async () => {
await runFactory({
scssOutputFile: path.resolve(
__dirname,
- `../../../src/style/${fallbackPrefix}-ui-fragments.scss`
+ `../../../src/style/${fallbackPrefix}-ui-fragments.scss`,
),
customContent: `
@import './core/utilities.scss';
@@ -93,7 +96,7 @@ const runStyleFactory = async () => {
}).then(() => {
if (require.main === module) {
log.succeed(
- '> PrePublish: "styleFactory" Created the style file with all the fragments'
+ '> PrePublish: "styleFactory" Created the style file with all the fragments',
)
}
})
@@ -102,7 +105,7 @@ const runStyleFactory = async () => {
await runFactory({
scssOutputFile: path.resolve(
__dirname,
- `../../../src/style/${fallbackPrefix}-ui-extensions.scss`
+ `../../../src/style/${fallbackPrefix}-ui-extensions.scss`,
),
customContent: `
@import './core/utilities.scss';
@@ -140,7 +143,7 @@ const runFactory = async ({
if (processOnlyList) {
const processedList = await globby(processOnlyList)
filesToFindGlob = filesToFindGlob.filter((source) =>
- processedList.some((file) => file.indexOf(source) !== -1)
+ processedList.some((file) => file.indexOf(source) !== -1),
)
}
} catch (e) {
@@ -163,10 +166,10 @@ const runFactory = async ({
// make sure we have newline at the end - because of StyleLint "no-missing-end-of-source-newline"
await fs.writeFile(
scssOutputFile,
- prettier.format(`${autoAdvice}${customContent}${content}\n`, {
+ await prettier.format(`${autoAdvice}${customContent}${content}\n`, {
...prettierrc,
filepath: scssOutputFile,
- })
+ }),
)
} catch (e) {
log.fail(`There was an error on creating ${scssOutputFile}!`)
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/themeFactory.ts b/packages/dnb-eufemia/scripts/prebuild/tasks/themeFactory.ts
index 8c56d97939f..e2ef2b1a73c 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/themeFactory.ts
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/themeFactory.ts
@@ -23,7 +23,10 @@ type FallbackFilesParams = {
}
const prettierrc = JSON.parse(
- fs.readFileSync(path.resolve(__dirname, '../../../.prettierrc'), 'utf-8')
+ fs.readFileSync(
+ path.resolve(__dirname, '../../../.prettierrc'),
+ 'utf-8',
+ ),
)
const runThemeFactory = async () => {
@@ -43,7 +46,7 @@ const runThemeFactory = async () => {
filesToFindGlob: [
path.resolve(
__dirname,
- '../../../src/{components,fragments}/**/style/themes/**/*-theme-*.scss'
+ '../../../src/{components,fragments}/**/style/themes/**/*-theme-*.scss',
),
...processToNamesIgnoreList,
],
@@ -53,7 +56,7 @@ const runThemeFactory = async () => {
}).then(() => {
if (require.main === module) {
log.succeed(
- '> PrePublish: "themeFactory" Created the themes files with all the components, elements, fragments and extensions'
+ '> PrePublish: "themeFactory" Created the themes files with all the components, elements, fragments and extensions',
)
}
})
@@ -63,7 +66,7 @@ const runThemeFactory = async () => {
filesToFindGlob: [
path.resolve(
__dirname,
- '../../../src/elements/**/style/themes/**/*-theme-*.scss'
+ '../../../src/elements/**/style/themes/**/*-theme-*.scss',
),
...processToNamesIgnoreList,
],
@@ -73,7 +76,7 @@ const runThemeFactory = async () => {
}).then(() => {
if (require.main === module) {
log.succeed(
- '> PrePublish: "themeFactory" Created the themes files with all the components, elements, fragments and extensions'
+ '> PrePublish: "themeFactory" Created the themes files with all the components, elements, fragments and extensions',
)
}
})
@@ -83,7 +86,7 @@ const runThemeFactory = async () => {
filesToFindGlob: [
path.resolve(
__dirname,
- '../../../src/extensions/**/style/themes/**/*-theme-*.scss'
+ '../../../src/extensions/**/style/themes/**/*-theme-*.scss',
),
...processToNamesIgnoreList,
],
@@ -93,7 +96,7 @@ const runThemeFactory = async () => {
}).then(() => {
if (require.main === module) {
log.succeed(
- '> PrePublish: "themeFactory" Created the themes files with all the components, elements, fragments and extensions'
+ '> PrePublish: "themeFactory" Created the themes files with all the components, elements, fragments and extensions',
)
}
})
@@ -130,9 +133,8 @@ export const runFactory = async ({
returnResult = false,
}) => {
const themeSources = await getThemeSources(filesToFindGlob)
- const themesWithRelatedFiles = await collecetRelatedThemeFiles(
- themeSources
- )
+ const themesWithRelatedFiles =
+ await collecetRelatedThemeFiles(themeSources)
const collectedOutput = {}
@@ -143,10 +145,10 @@ export const runFactory = async ({
}
await fs.writeFile(
file,
- prettier.format(fileContent, {
+ await prettier.format(fileContent, {
...prettierrc,
filepath: file,
- })
+ }),
)
}
@@ -158,9 +160,9 @@ export const runFactory = async ({
if (!fs.existsSync(file)) {
fileContent = `${editAdvice.replace(
'',
- targetFile
+ targetFile,
)}\n\n${customContent}\n\n${insertBelowAdvice}\n\n${files.join(
- ''
+ '',
)}`
await write(file, fileContent)
@@ -177,7 +179,7 @@ export const runFactory = async ({
fileContent = fileContent.replace(
new RegExp(`(\\/\\*\\*[^]*${insertBelowTitle}[^]*\\*\\/)([^]*)`),
- `$1\n\n${updatedFiles.join('')}\n`
+ `$1\n\n${updatedFiles.join('')}\n`,
)
if (returnResult) {
@@ -214,14 +216,14 @@ function getFallbackFiles({
if (fallbackThemeName) {
const fallbackIndex = themesWithRelatedFiles.findIndex(
- ({ name }) => fallbackThemeName === name
+ ({ name }) => fallbackThemeName === name,
)
if (fallbackIndex >= 0) {
files = [
...files,
...themesWithRelatedFiles[fallbackIndex].files.filter((file) => {
return !files.includes(
- file.replace(`-${fallbackThemeName}`, `-${currentThemeName}`)
+ file.replace(`-${fallbackThemeName}`, `-${currentThemeName}`),
)
}),
]
@@ -289,8 +291,8 @@ async function collecetRelatedThemeFiles(themeSources: ThemeSources) {
acc.push(
`\n@import '${source.replace(
new RegExp(`${path}/src/`, 'g'),
- '../../../'
- )}';`
+ '../../../',
+ )}';`,
)
return acc
}, [])
diff --git a/packages/dnb-eufemia/scripts/tools/cliTools.js b/packages/dnb-eufemia/scripts/tools/cliTools.js
index 0c833b0df96..a4323d039e7 100644
--- a/packages/dnb-eufemia/scripts/tools/cliTools.js
+++ b/packages/dnb-eufemia/scripts/tools/cliTools.js
@@ -29,7 +29,7 @@ const getCommittedFiles = async (countCommits = 10) => {
try {
const files = (
await runCommand(
- `git config diff.renames 0 && git show --pretty="format:" --name-only HEAD...HEAD~${countCommits}`
+ `git config diff.renames 0 && git show --pretty="format:" --name-only HEAD...HEAD~${countCommits}`,
)
)
.split('\n')
diff --git a/packages/dnb-eufemia/scripts/tools/createSkeletonFont.js b/packages/dnb-eufemia/scripts/tools/createSkeletonFont.js
index d095db3e41f..63789a89e93 100644
--- a/packages/dnb-eufemia/scripts/tools/createSkeletonFont.js
+++ b/packages/dnb-eufemia/scripts/tools/createSkeletonFont.js
@@ -29,7 +29,7 @@ asyncForEach(
const sourcePath = path.resolve(
__dirname,
'../../assets/fonts/dnb/',
- soruceFile
+ soruceFile,
)
const familyName = `${fontName}Skeleton`
@@ -67,7 +67,7 @@ asyncForEach(
log.fail(`Failed: ${fileName}-${styleName}`)
console.error(e)
}
- }
+ },
)
const createChar = (s) => s.charCodeAt(0)
@@ -134,7 +134,7 @@ async function minifyFonts() {
const fontmin = new Fontmin()
fontmin.src(
- path.resolve(__dirname, '../../assets/fonts/dnb/skeleton/*.otf')
+ path.resolve(__dirname, '../../assets/fonts/dnb/skeleton/*.otf'),
)
fontmin.use(Fontmin.otf2ttf())
@@ -142,7 +142,7 @@ async function minifyFonts() {
fontmin.use(Fontmin.ttf2woff2())
fontmin.dest(
- path.resolve(__dirname, '../../assets/fonts/dnb/skeleton/')
+ path.resolve(__dirname, '../../assets/fonts/dnb/skeleton/'),
)
fontmin.run(function (err) {
diff --git a/packages/dnb-eufemia/scripts/tools/index.ts b/packages/dnb-eufemia/scripts/tools/index.ts
index 378411933e8..99789bb95a4 100644
--- a/packages/dnb-eufemia/scripts/tools/index.ts
+++ b/packages/dnb-eufemia/scripts/tools/index.ts
@@ -7,16 +7,20 @@
export type AsyncForEachCallback = (
item: Array[number],
i: number,
- array: Array
+ array: Array,
) => unknown
export async function asyncForEach(
array: Array,
- callback: AsyncForEachCallback
+ callback: AsyncForEachCallback,
) {
let res = []
for (let i = 0, l = array.length; i < l; ++i) {
- const cur = await callback(array[i] as typeof array[number], i, array)
+ const cur = await callback(
+ array[i] as (typeof array)[number],
+ i,
+ array,
+ )
if (typeof cur !== 'undefined') {
res = res.concat(cur)
}
diff --git a/packages/dnb-eufemia/src/components/accordion/Accordion.tsx b/packages/dnb-eufemia/src/components/accordion/Accordion.tsx
index 6007aee8a80..ef6b9295252 100644
--- a/packages/dnb-eufemia/src/components/accordion/Accordion.tsx
+++ b/packages/dnb-eufemia/src/components/accordion/Accordion.tsx
@@ -174,7 +174,7 @@ function Accordion({
// States ordered last here to make sure that the getInitialExpandedState have access to the store
const [previousExpanded, setPreviousExpanded] = useState(props.expanded)
const [expanded, setExpanded] = useState(
- getInitialExpandedState()
+ getInitialExpandedState(),
)
// replacement for getDerivedStateFromProps
@@ -314,7 +314,7 @@ function Accordion({
nestedContext as Record, // internal context
{ skeleton: globalContext?.skeleton },
globalContext.Accordion, // global context
- globalContext.translation.Accordion
+ globalContext.translation.Accordion,
)
if (expandedState === undefined && globalContext.Accordion) {
@@ -365,7 +365,7 @@ function Accordion({
prerender && 'dnb-accordion--prerender',
createSpacingClasses(extendedProps),
className,
- _className
+ _className,
),
} as HTMLProps
@@ -380,7 +380,7 @@ function Accordion({
props,
accordionDefaultProps,
{ expanded, group },
- context
+ context,
)
const accordionContext = {
@@ -403,13 +403,13 @@ function Accordion({
{findElementInChildren(
children,
- (cur) => cur.type === AccordionHeader
+ (cur) => cur.type === AccordionHeader,
) ? null : (
)}
{findElementInChildren(
children,
- (cur) => cur.type === AccordionContent
+ (cur) => cur.type === AccordionContent,
) ? (
children
) : (
diff --git a/packages/dnb-eufemia/src/components/accordion/AccordionContent.tsx b/packages/dnb-eufemia/src/components/accordion/AccordionContent.tsx
index 764cf0ff09f..04cc43345a5 100644
--- a/packages/dnb-eufemia/src/components/accordion/AccordionContent.tsx
+++ b/packages/dnb-eufemia/src/components/accordion/AccordionContent.tsx
@@ -63,7 +63,7 @@ export default function AccordionContent(props: AccordionContentProps) {
const containerElement = getPreviousSibling(
'dnb-accordion-group--single-container',
- contentElem
+ contentElem,
) as HTMLElement
if (no_animation) {
@@ -153,7 +153,7 @@ export default function AccordionContent(props: AccordionContentProps) {
'aria-labelledby': `${id}-header`,
className: classnames(
'dnb-accordion__content__inner',
- createSpacingClasses(rest)
+ createSpacingClasses(rest),
),
} as HTMLProps
diff --git a/packages/dnb-eufemia/src/components/accordion/AccordionGroup.tsx b/packages/dnb-eufemia/src/components/accordion/AccordionGroup.tsx
index f3abbdbaf6a..ddac78cd79d 100644
--- a/packages/dnb-eufemia/src/components/accordion/AccordionGroup.tsx
+++ b/packages/dnb-eufemia/src/components/accordion/AccordionGroup.tsx
@@ -50,7 +50,7 @@ const AccordionGroup = (props: AccordionGroupProps) => {
props,
accordionDefaultProps,
context.Accordion,
- context.getTranslation(props).Accordion
+ context.getTranslation(props).Accordion,
)
const {
@@ -80,7 +80,7 @@ const AccordionGroup = (props: AccordionGroupProps) => {
isTrue(single_container) && 'dnb-accordion-group--single-container',
createSpacingClasses(extendedProps),
className,
- _className
+ _className,
)
const params = {
diff --git a/packages/dnb-eufemia/src/components/accordion/AccordionHeader.tsx b/packages/dnb-eufemia/src/components/accordion/AccordionHeader.tsx
index aac63142f6d..a2705c24cee 100644
--- a/packages/dnb-eufemia/src/components/accordion/AccordionHeader.tsx
+++ b/packages/dnb-eufemia/src/components/accordion/AccordionHeader.tsx
@@ -37,7 +37,7 @@ function AccordionHeaderTitle({
{children}
@@ -57,7 +57,7 @@ function AccordionHeaderDescription({
{children}
@@ -77,7 +77,7 @@ function AccordionHeaderContainer({
{children}
@@ -197,7 +197,9 @@ export const AccordionHeader = ({
}
function onClickHandler(
- event: React.MouseEvent | React.KeyboardEvent
+ event:
+ | React.MouseEvent
+ | React.KeyboardEvent,
) {
const { id, group } = context
@@ -226,7 +228,7 @@ export const AccordionHeader = ({
const extendedProps = extendPropsWithContext(
props,
accordionHeaderDefaultProps,
- context as Record
+ context as Record,
)
const {
@@ -338,7 +340,7 @@ export const AccordionHeader = ({
// position the icon to the right, if the element is not in the beginning
if (icon_position === undefined) {
const iconIndex = partsToRender.findIndex(
- (c) => c.type === AccordionHeaderIcon
+ (c) => c.type === AccordionHeaderIcon,
)
// because of the container at the beginning, we use 1
if (iconIndex > 1) {
@@ -365,7 +367,7 @@ export const AccordionHeader = ({
no_animation && 'dnb-accordion__header--no-animation',
createSkeletonClass('font', skeleton, context),
createSpacingClasses(rest),
- className
+ className,
),
disabled,
...rest,
diff --git a/packages/dnb-eufemia/src/components/accordion/AccordionStore.ts b/packages/dnb-eufemia/src/components/accordion/AccordionStore.ts
index 8d5c04bd9d9..14725d3af4f 100644
--- a/packages/dnb-eufemia/src/components/accordion/AccordionStore.ts
+++ b/packages/dnb-eufemia/src/components/accordion/AccordionStore.ts
@@ -95,7 +95,7 @@ export class Store {
if (
Object.prototype.hasOwnProperty.call(
window.localStorage,
- storeId
+ storeId,
)
) {
return JSON.parse(window.localStorage.getItem(storeId))
diff --git a/packages/dnb-eufemia/src/components/accordion/__tests__/Accordion.test.tsx b/packages/dnb-eufemia/src/components/accordion/__tests__/Accordion.test.tsx
index ab1bb923375..6e4773bf165 100644
--- a/packages/dnb-eufemia/src/components/accordion/__tests__/Accordion.test.tsx
+++ b/packages/dnb-eufemia/src/components/accordion/__tests__/Accordion.test.tsx
@@ -28,19 +28,19 @@ describe('Accordion component', () => {
expect(
document
.querySelector('.dnb-accordion__header')
- .getAttribute('aria-expanded')
+ .getAttribute('aria-expanded'),
).toBe('false')
fireEvent.click(document.querySelector('.dnb-accordion__header')) // we could send inn the event data structure like this: , { target: { expanded: true } }
expect(
document
.querySelector('.dnb-accordion__header')
- .getAttribute('aria-expanded')
+ .getAttribute('aria-expanded'),
).toBe('true')
rerender( )
expect(
document
.querySelector('.dnb-accordion__header')
- .getAttribute('aria-expanded')
+ .getAttribute('aria-expanded'),
).toBe('false')
})
@@ -53,7 +53,7 @@ describe('Accordion component', () => {
on_change={my_event}
onChange={myEvent}
expanded={false}
- />
+ />,
)
// first click
@@ -73,22 +73,22 @@ describe('Accordion component', () => {
const { rerender } = render(
string content
-
+ ,
)
expect(document.querySelector('.dnb-p').textContent).toBe(
- 'string content'
+ 'string content',
)
rerender(
no string content
-
+ ,
)
expect(document.querySelector('.dnb-p')).toBeFalsy()
expect(document.querySelector('.no-string').textContent).toBe(
- 'no string content'
+ 'no string content',
)
})
@@ -97,7 +97,7 @@ describe('Accordion component', () => {
rerender( )
expect(
- document.querySelector('.dnb-accordion__header')
+ document.querySelector('.dnb-accordion__header'),
).toHaveAttribute('disabled')
})
@@ -106,10 +106,10 @@ describe('Accordion component', () => {
expect(
Array.from(
- document.querySelector('.dnb-accordion__header').classList
- )
+ document.querySelector('.dnb-accordion__header').classList,
+ ),
).toEqual(
- expect.arrayContaining(['dnb-accordion__header--no-animation'])
+ expect.arrayContaining(['dnb-accordion__header--no-animation']),
)
})
@@ -121,34 +121,34 @@ describe('Accordion component', () => {
closed: AddIcon,
expanded: SubtractIcon,
}}
- />
+ />,
)
const { container: c1 } = render( )
const { container: c2 } = render( )
expect(document.querySelector('.dnb-accordion svg').outerHTML).toBe(
- c1.innerHTML
+ c1.innerHTML,
)
fireEvent.click(document.querySelector('.dnb-accordion__header'))
expect(document.querySelector('.dnb-accordion svg').outerHTML).toBe(
- c2.innerHTML
+ c2.innerHTML,
)
})
it('supports default outlined variant', () => {
render( )
expect(document.querySelector('.dnb-accordion').classList).toContain(
- 'dnb-accordion__variant--outlined'
+ 'dnb-accordion__variant--outlined',
)
})
it('supports plain variant', () => {
render( )
expect(document.querySelector('.dnb-accordion').classList).toContain(
- 'dnb-accordion__variant--plain'
+ 'dnb-accordion__variant--plain',
)
})
@@ -157,16 +157,16 @@ describe('Accordion component', () => {
expect(
Array.from(
- document.querySelector('.dnb-accordion__content').classList
- )
+ document.querySelector('.dnb-accordion__content').classList,
+ ),
).toEqual(expect.arrayContaining(['dnb-height-animation--hidden']))
fireEvent.click(document.querySelector('.dnb-accordion__header'))
expect(
Array.from(
- document.querySelector('.dnb-accordion__content').classList
- )
+ document.querySelector('.dnb-accordion__content').classList,
+ ),
).toEqual(expect.arrayContaining(['dnb-height-animation--is-in-dom']))
})
@@ -221,14 +221,14 @@ describe('Accordion group component', () => {
Accordion 2
-
+ ,
)
expect(
- document.querySelector('#accordion-1 .dnb-accordion__content')
+ document.querySelector('#accordion-1 .dnb-accordion__content'),
).toBeInTheDocument()
expect(
- document.querySelector('#accordion-2 .dnb-accordion__content')
+ document.querySelector('#accordion-2 .dnb-accordion__content'),
).toBeFalsy()
})
@@ -255,11 +255,11 @@ describe('Accordion group component', () => {
data-prop="value-2"
attributes={{ 'data-attr': 'value' }}
/>
-
+ ,
)
fireEvent.click(
- document.querySelector('#accordion-1 .dnb-accordion__header')
+ document.querySelector('#accordion-1 .dnb-accordion__header'),
)
expect(my_event).toHaveBeenCalled()
expect(my_event.mock.calls[0][0].id).toBe('accordion-1')
@@ -267,13 +267,13 @@ describe('Accordion group component', () => {
expect(myEvent.mock.calls.length).toBe(1)
fireEvent.click(
- document.querySelector('#accordion-2 .dnb-accordion__header')
+ document.querySelector('#accordion-2 .dnb-accordion__header'),
)
expect(my_event.mock.calls[1][0].id).toBe('accordion-2')
expect(my_event.mock.calls[1][0].expanded).toBe(true)
fireEvent.click(
- document.querySelector('#accordion-1 .dnb-accordion__header')
+ document.querySelector('#accordion-1 .dnb-accordion__header'),
)
expect(my_event.mock.calls[2][0].expanded).toBe(true)
})
@@ -335,64 +335,64 @@ describe('Accordion container component', () => {
render( )
expect(document.querySelector('button#increment').textContent).toBe(
- '1'
+ '1',
)
fireEvent.click(document.querySelector('button#increment'))
expect(document.querySelector('button#increment').textContent).toBe(
- '2'
+ '2',
)
expect(document.querySelector('div#mounted-1')).toBeFalsy()
expect(document.querySelector('div#mounted-2').textContent).toBe(
- 'true'
+ 'true',
)
expect(document.querySelector('div#mounted-3')).toBeFalsy()
expect(
document
.querySelector('#accordion-2 .dnb-accordion__header')
- .getAttribute('aria-expanded')
+ .getAttribute('aria-expanded'),
).toBe('true')
fireEvent.click(
- document.querySelector('#accordion-1 .dnb-accordion__header')
+ document.querySelector('#accordion-1 .dnb-accordion__header'),
)
fireEvent.click(document.querySelector('button#increment'))
expect(document.querySelector('button#increment').textContent).toBe(
- '3'
+ '3',
)
expect(document.querySelector('div#mounted-1').textContent).toBe(
- 'true'
+ 'true',
)
expect(document.querySelector('div#mounted-2').textContent).toBe(
- 'true'
+ 'true',
)
expect(document.querySelector('div#mounted-3')).toBeFalsy()
fireEvent.click(
- document.querySelector('#accordion-2 .dnb-accordion__header')
+ document.querySelector('#accordion-2 .dnb-accordion__header'),
)
fireEvent.click(document.querySelector('button#increment'))
expect(document.querySelector('button#increment').textContent).toBe(
- '4'
+ '4',
)
expect(document.querySelector('div#mounted-3')).toBeFalsy()
fireEvent.click(
- document.querySelector('#accordion-3 .dnb-accordion__header')
+ document.querySelector('#accordion-3 .dnb-accordion__header'),
)
fireEvent.click(document.querySelector('button#increment'))
expect(document.querySelector('button#increment').textContent).toBe(
- '5'
+ '5',
)
expect(document.querySelector('div#mounted-3').textContent).toBe(
- 'true'
+ 'true',
)
})
@@ -407,13 +407,13 @@ describe('Accordion container component', () => {
jest.spyOn(contentElem, 'offsetTop', 'get').mockReturnValue(48)
fireEvent.click(
- document.querySelector('#accordion-1 .dnb-accordion__header')
+ document.querySelector('#accordion-1 .dnb-accordion__header'),
)
expect(
document
.querySelector('.dnb-accordion-group--single-container')
- .getAttribute('style')
+ .getAttribute('style'),
).toBe('transition-duration: 1ms; min-height: 6rem;')
})
})
@@ -426,7 +426,7 @@ describe('Accordion scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-accordion-theme-ui.scss')
+ require.resolve('../style/themes/dnb-accordion-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/accordion/style/dnb-accordion.scss b/packages/dnb-eufemia/src/components/accordion/style/dnb-accordion.scss
index 4451daeb60d..e23bd7e618e 100644
--- a/packages/dnb-eufemia/src/components/accordion/style/dnb-accordion.scss
+++ b/packages/dnb-eufemia/src/components/accordion/style/dnb-accordion.scss
@@ -122,7 +122,8 @@
width: 100%;
will-change: height;
- transition: height 400ms var(--accordion-easing),
+ transition:
+ height 400ms var(--accordion-easing),
opacity 600ms var(--accordion-easing);
&__inner {
diff --git a/packages/dnb-eufemia/src/components/anchor/Anchor.tsx b/packages/dnb-eufemia/src/components/anchor/Anchor.tsx
index 5cf63d96811..77c6661b728 100644
--- a/packages/dnb-eufemia/src/components/anchor/Anchor.tsx
+++ b/packages/dnb-eufemia/src/components/anchor/Anchor.tsx
@@ -48,7 +48,7 @@ export function AnchorInstance(localProps: AnchorAllProps) {
defaultProps,
{ skeleton: context?.skeleton },
context?.getTranslation(localProps as AnchorAllProps).Anchor,
- context?.Anchor
+ context?.Anchor,
)
// deprecated: inner_ref is still needed to support Button's usage of Anchor
@@ -113,7 +113,7 @@ export function AnchorInstance(localProps: AnchorAllProps) {
'dnb-anchor--no-icon',
typeof children !== 'string' && 'dnb-anchor--has-icon',
prefix && 'dnb-anchor--icon-left',
- suffix && 'dnb-anchor--icon-right'
+ suffix && 'dnb-anchor--icon-right',
)}
{...attributes}
innerRef={innerRef}
@@ -140,13 +140,13 @@ export function AnchorInstance(localProps: AnchorAllProps) {
const Anchor = React.forwardRef(
(props: AnchorAllProps, ref: React.RefObject) => {
return
- }
+ },
)
export default Anchor
export function scrollToHashHandler(
- e: React.MouseEvent
+ e: React.MouseEvent,
) {
const element = e.currentTarget as HTMLAnchorElement
const href = element.getAttribute('href')
@@ -176,7 +176,7 @@ export function scrollToHashHandler(
e.preventDefault()
const scrollPadding = parseFloat(
- window.getComputedStyle(document.documentElement).scrollPaddingTop
+ window.getComputedStyle(document.documentElement).scrollPaddingTop,
)
const top = getOffsetTop(anchorElem) - scrollPadding || 0
diff --git a/packages/dnb-eufemia/src/components/anchor/__tests__/Anchor.screenshot.test.ts b/packages/dnb-eufemia/src/components/anchor/__tests__/Anchor.screenshot.test.ts
index e8ceb444cf1..645fe91204d 100644
--- a/packages/dnb-eufemia/src/components/anchor/__tests__/Anchor.screenshot.test.ts
+++ b/packages/dnb-eufemia/src/components/anchor/__tests__/Anchor.screenshot.test.ts
@@ -222,7 +222,7 @@ describe.each(['ui', 'sbanken'])(
expect(screenshot).toMatchImageSnapshot()
})
}
- }
+ },
)
describe.each(['ui', 'sbanken'])(
@@ -250,5 +250,5 @@ describe.each(['ui', 'sbanken'])(
})
expect(screenshot).toMatchImageSnapshot()
})
- }
+ },
)
diff --git a/packages/dnb-eufemia/src/components/anchor/__tests__/Anchor.test.tsx b/packages/dnb-eufemia/src/components/anchor/__tests__/Anchor.test.tsx
index 241bbcb80eb..31fa6839459 100644
--- a/packages/dnb-eufemia/src/components/anchor/__tests__/Anchor.test.tsx
+++ b/packages/dnb-eufemia/src/components/anchor/__tests__/Anchor.test.tsx
@@ -28,10 +28,10 @@ describe('Anchor element', () => {
render(
text
-
+ ,
)
expect(document.querySelector('a').getAttribute('id')).toBe(
- 'unique-id'
+ 'unique-id',
)
})
@@ -39,12 +39,12 @@ describe('Anchor element', () => {
render(
text
-
+ ,
)
expect(
document.querySelector('#unique-id-tooltip.dnb-tooltip__content')
- .textContent
+ .textContent,
).toBe('Tooltip')
})
@@ -52,13 +52,13 @@ describe('Anchor element', () => {
render(
text
-
+ ,
)
const element = document.getElementById('unique-id')
expect(element.getAttribute('aria-describedby')).toBe(
- 'unique-id-tooltip'
+ 'unique-id-tooltip',
)
})
@@ -66,7 +66,7 @@ describe('Anchor element', () => {
render(
text
-
+ ,
)
const element = document.getElementById('unique-id')
@@ -74,7 +74,7 @@ describe('Anchor element', () => {
expect(
document.querySelector('#unique-id-tooltip.dnb-tooltip__content')
- .parentElement.classList
+ .parentElement.classList,
).toContain('dnb-tooltip--active')
})
@@ -82,10 +82,10 @@ describe('Anchor element', () => {
render(
text
-
+ ,
)
expect(
- document.querySelector('.dnb-anchor--no-icon')
+ document.querySelector('.dnb-anchor--no-icon'),
).toBeInTheDocument()
})
@@ -95,7 +95,7 @@ describe('Anchor element', () => {
render(
text
-
+ ,
)
act(() => {
@@ -108,7 +108,7 @@ describe('Anchor element', () => {
const { rerender } = render(
text
-
+ ,
)
const id = (
@@ -116,7 +116,7 @@ describe('Anchor element', () => {
).getAttribute('aria-describedby')
expect(
(document.body.querySelector('#' + id) as HTMLAnchorElement)
- .textContent
+ .textContent,
).toBe('Opens a new Window')
const title = 'External site'
@@ -124,13 +124,13 @@ describe('Anchor element', () => {
rerender(
text
-
+ ,
)
expect(
(document.querySelector('a') as HTMLAnchorElement).getAttribute(
- 'title'
- )
+ 'title',
+ ),
).toBe(title)
expect(document.body.querySelector('#' + id)).toBe(null)
})
@@ -139,7 +139,7 @@ describe('Anchor element', () => {
render(
text
-
+ ,
)
expect(document.querySelector('[rel="external"]')).toBeInTheDocument()
})
@@ -153,10 +153,10 @@ describe('Anchor element', () => {
render(
text
-
+ ,
)
expect(
- document.querySelector('.dnb-anchor--icon-left')
+ document.querySelector('.dnb-anchor--icon-left'),
).toBeInTheDocument()
})
@@ -164,10 +164,10 @@ describe('Anchor element', () => {
render(
text
-
+ ,
)
expect(
- document.querySelector('.dnb-anchor--icon-right')
+ document.querySelector('.dnb-anchor--icon-right'),
).toBeInTheDocument()
})
@@ -175,10 +175,10 @@ describe('Anchor element', () => {
render(
text
-
+ ,
)
expect(
- document.querySelector('.dnb-anchor--icon-left')
+ document.querySelector('.dnb-anchor--icon-left'),
).toBeInTheDocument()
})
@@ -186,10 +186,10 @@ describe('Anchor element', () => {
render(
text
-
+ ,
)
expect(
- document.querySelector('.dnb-anchor--no-icon')
+ document.querySelector('.dnb-anchor--no-icon'),
).toBeInTheDocument()
})
})
@@ -205,10 +205,10 @@ describe('Anchor scss', () => {
(themeName) => {
const css = loadScss(
require.resolve(
- `../style/themes/dnb-anchor-theme-${themeName}.scss`
- )
+ `../style/themes/dnb-anchor-theme-${themeName}.scss`,
+ ),
)
expect(css).toMatchSnapshot()
- }
+ },
)
})
diff --git a/packages/dnb-eufemia/src/components/anchor/__tests__/AnchorScroll.test.tsx b/packages/dnb-eufemia/src/components/anchor/__tests__/AnchorScroll.test.tsx
index ae43334b198..60c77fa50f1 100644
--- a/packages/dnb-eufemia/src/components/anchor/__tests__/AnchorScroll.test.tsx
+++ b/packages/dnb-eufemia/src/components/anchor/__tests__/AnchorScroll.test.tsx
@@ -29,7 +29,7 @@ describe('Anchor with scrollToHashHandler', () => {
text
- >
+ >,
)
const element = document.querySelector('a')
@@ -57,7 +57,7 @@ describe('Anchor with scrollToHashHandler', () => {
text
- >
+ >,
)
const element = document.querySelector('a')
@@ -82,7 +82,7 @@ describe('Anchor with scrollToHashHandler', () => {
text
- >
+ >,
)
const element = document.querySelector('a')
@@ -103,7 +103,7 @@ describe('Anchor with scrollToHashHandler', () => {
render(
text
-
+ ,
)
const element = document.querySelector('a')
@@ -127,7 +127,7 @@ describe('Anchor with scrollToHashHandler', () => {
text
- >
+ >,
)
const element = document.querySelector('a')
diff --git a/packages/dnb-eufemia/src/components/anchor/style/anchor-mixins.scss b/packages/dnb-eufemia/src/components/anchor/style/anchor-mixins.scss
index 12824ba8d72..31e8a25d0fb 100644
--- a/packages/dnb-eufemia/src/components/anchor/style/anchor-mixins.scss
+++ b/packages/dnb-eufemia/src/components/anchor/style/anchor-mixins.scss
@@ -105,7 +105,9 @@
@mixin anchorBackground($color, $overflow: 0.125em) {
@if $overflow {
- box-shadow: inset 100vw 100vw 0 0 $color, -$overflow 0 0 0 $color,
+ box-shadow:
+ inset 100vw 100vw 0 0 $color,
+ -$overflow 0 0 0 $color,
$overflow 0 0 0 $color;
} @else {
box-shadow: inset 100vw 100vw 0 0 $color;
@@ -164,7 +166,9 @@
background-image: inherit;
- transition: transform 0.3s ease-out, filter 1s ease-in-out;
+ transition:
+ transform 0.3s ease-out,
+ filter 1s ease-in-out;
transform-origin: bottom;
}
@@ -200,7 +204,9 @@
}
}
- transition: box-shadow 200ms ease-in-out, border-radius 200ms ease-in-out,
+ transition:
+ box-shadow 200ms ease-in-out,
+ border-radius 200ms ease-in-out,
background 200ms ease-in-out;
[data-visual-test-wrapper] & {
diff --git a/packages/dnb-eufemia/src/components/anchor/style/themes/dnb-anchor-theme-sbanken.scss b/packages/dnb-eufemia/src/components/anchor/style/themes/dnb-anchor-theme-sbanken.scss
index 5bd8756472a..2ccd1f915ec 100644
--- a/packages/dnb-eufemia/src/components/anchor/style/themes/dnb-anchor-theme-sbanken.scss
+++ b/packages/dnb-eufemia/src/components/anchor/style/themes/dnb-anchor-theme-sbanken.scss
@@ -107,7 +107,9 @@
}
}
- &:not(.dnb-anchor--no-underline):not(.dnb-anchor--has-icon):not(.anchor-hash):not(.dnb-anchor--inline):not(.dnb-anchor--no-style) {
+ &:not(.dnb-anchor--no-underline):not(.dnb-anchor--has-icon):not(
+ .anchor-hash
+ ):not(.dnb-anchor--inline):not(.dnb-anchor--no-style) {
&:not(.dnb-anchor--icon-left) {
&::before {
text-decoration-color: var(--sb-color-green-dark);
diff --git a/packages/dnb-eufemia/src/components/autocomplete/Autocomplete.js b/packages/dnb-eufemia/src/components/autocomplete/Autocomplete.js
index a6ad01bfe1b..2e407b59116 100644
--- a/packages/dnb-eufemia/src/components/autocomplete/Autocomplete.js
+++ b/packages/dnb-eufemia/src/components/autocomplete/Autocomplete.js
@@ -190,7 +190,7 @@ export default class Autocomplete extends React.PureComponent {
PropTypes.arrayOf(PropTypes.string),
]),
}),
- ])
+ ]),
),
]),
search_in_word_index: PropTypes.oneOfType([
@@ -365,7 +365,7 @@ class AutocompleteInstance extends React.PureComponent {
dataItem.search_content || dataItem,
{
separator: ' ',
- }
+ },
)
if (typeof searchWord !== 'string' && Array.isArray(searchWord)) {
return AutocompleteInstance.parseDataItem(searchWord)
@@ -452,7 +452,7 @@ class AutocompleteInstance extends React.PureComponent {
this.setState({}, () => {
const inputValue = AutocompleteInstance.getCurrentDataTitle(
this.context.drawerList.selected_item,
- this.context.drawerList.original_data
+ this.context.drawerList.original_data,
)
this.setState({
inputValue,
@@ -587,12 +587,12 @@ class AutocompleteInstance extends React.PureComponent {
runFilterToHighlight = (
{ fillDataIfEmpty = false, ...options } = {},
- value = this.state.inputValue
+ value = this.state.inputValue,
) => {
// do not filter or highlight if the current selected item is the same as the input value
const possibleTitle = AutocompleteInstance.getCurrentDataTitle(
this.context.drawerList.selected_item,
- this.context.drawerList.original_data
+ this.context.drawerList.original_data,
)
if (value === possibleTitle) {
@@ -678,7 +678,7 @@ class AutocompleteInstance extends React.PureComponent {
},
{
overwriteOriginalData: true,
- }
+ },
)
}
@@ -759,7 +759,7 @@ class AutocompleteInstance extends React.PureComponent {
this.resetSelectionItem()
}
}
- }
+ },
)
this.context.drawerList.setData(
@@ -783,12 +783,12 @@ class AutocompleteInstance extends React.PureComponent {
this.showAllItems()
}
}
- }
+ },
)
},
{
overwriteOriginalData: true,
- }
+ },
)
return this
@@ -907,7 +907,7 @@ class AutocompleteInstance extends React.PureComponent {
clearTimeout(this._blurTimeout)
this._blurTimeout = setTimeout(
resetAfterClose,
- DrawerList.blurDelay
+ DrawerList.blurDelay,
) // only to let the animation pass, before we make the effect. Else this would be a visible change
}
}
@@ -1065,7 +1065,7 @@ class AutocompleteInstance extends React.PureComponent {
overwriteSearchIndex = false,
data = this.context.drawerList.original_data,
} = {},
- cb
+ cb,
) {
this._cacheMemory = {}
@@ -1080,7 +1080,7 @@ class AutocompleteInstance extends React.PureComponent {
searchIndex,
_listenForPropChanges: false,
},
- cb
+ cb,
)
return searchIndex
@@ -1101,7 +1101,7 @@ class AutocompleteInstance extends React.PureComponent {
ignore_events: false, // we also have to reset this one
})
}, 10) // make sure we reset once the rerender of DrawerList is done, because then we keep the active_item at it's position by using key="down"
- }
+ },
)
}
@@ -1124,7 +1124,7 @@ class AutocompleteInstance extends React.PureComponent {
this.context.drawerList.selected_item,
{
scrollTo: false,
- }
+ },
)
}
@@ -1163,7 +1163,7 @@ class AutocompleteInstance extends React.PureComponent {
...this.getEventObjects('on_change'),
})
}
- }
+ },
)
}
@@ -1172,7 +1172,7 @@ class AutocompleteInstance extends React.PureComponent {
const inputValue = AutocompleteInstance.getCurrentDataTitle(
this.context.drawerList.selected_item,
- this.context.drawerList.original_data
+ this.context.drawerList.original_data,
)
clearTimeout(this._selectTimeout)
@@ -1208,7 +1208,7 @@ class AutocompleteInstance extends React.PureComponent {
disableHighlighting = false,
skipFilter = false,
skipReorder = false,
- } = {}
+ } = {},
) => {
if (data) {
searchIndex = this.setSearchIndex({ data })
@@ -1250,7 +1250,7 @@ class AutocompleteInstance extends React.PureComponent {
// if the uses reached word 3, then we go inside words as well
const regexWord = new RegExp(
wordIndex > inWordIndex ? `${word}` : `(${wordCond})${word}`,
- 'i'
+ 'i',
)
if (regexWord.test(contentChunk)) {
@@ -1274,7 +1274,7 @@ class AutocompleteInstance extends React.PureComponent {
// and give a score for each one
wordScore += (
contentChunk.match(
- new RegExp(`(${wordCond})${escapeRegexChars(word)}`, 'ig')
+ new RegExp(`(${wordCond})${escapeRegexChars(word)}`, 'ig'),
) || []
).length
@@ -1283,7 +1283,7 @@ class AutocompleteInstance extends React.PureComponent {
// Check if the first chunk starts the first written word
const isFirstWord = new RegExp(
`^${escapeRegexChars(searchWords[0])}`,
- 'i'
+ 'i',
).test(contentChunk.split(' ')[0])
// If yes, add the amount of possible words + 1
@@ -1360,7 +1360,7 @@ class AutocompleteInstance extends React.PureComponent {
if (/[\d\w]/.test(char)) {
segment = segment.replace(
new RegExp(`(${char})`, 'gi'),
- `${strS}$1${strE}`
+ `${strS}$1${strE}`,
)
}
})
@@ -1368,12 +1368,12 @@ class AutocompleteInstance extends React.PureComponent {
if (wordIndex > inWordIndex) {
segment = segment.replace(
new RegExp(`(${word})`, 'gi'),
- `${strS}$1${strE}`
+ `${strS}$1${strE}`,
)
} else {
segment = segment.replace(
new RegExp(`(${wordCond})(${word})`, 'gi'),
- `$1${strS}$2${strE}`
+ `$1${strS}$2${strE}`,
)
}
}
@@ -1421,7 +1421,7 @@ class AutocompleteInstance extends React.PureComponent {
result = React.cloneElement(
originalChild,
{ key: 'clone' + cacheHash + idx },
- result
+ result,
)
}
}
@@ -1457,7 +1457,7 @@ class AutocompleteInstance extends React.PureComponent {
if (!this.skipReorder && !skipReorder) {
searchIndex = searchIndex.sort(
- ({ totalScore: a }, { totalScore: b }) => b - a
+ ({ totalScore: a }, { totalScore: b }) => b - a,
)
}
@@ -1506,7 +1506,7 @@ class AutocompleteInstance extends React.PureComponent {
hasFocus: false,
})
}, 1) // we have to wait in order to make sure the focus situation is cleared up
- }
+ },
)
}
@@ -1565,18 +1565,18 @@ class AutocompleteInstance extends React.PureComponent {
{
inputValue: AutocompleteInstance.getCurrentDataTitle(
selected_item,
- this.context.drawerList.data
+ this.context.drawerList.data,
),
skipFocusDuringChange: false,
_listenForPropChanges: false,
},
- () => this.setFocusOnInput()
+ () => this.setFocusOnInput(),
)
} else {
this.setState({
inputValue: AutocompleteInstance.getCurrentDataTitle(
selected_item,
- this.context.drawerList.data
+ this.context.drawerList.data,
),
_listenForPropChanges: false,
})
@@ -1637,7 +1637,7 @@ class AutocompleteInstance extends React.PureComponent {
const { active_item, selected_item } = this.context.drawerList
const currentDataItem = getCurrentData(
active_item,
- this.context.drawerList.data
+ this.context.drawerList.data,
)
return (
@@ -1662,7 +1662,7 @@ class AutocompleteInstance extends React.PureComponent {
Autocomplete.defaultProps,
this.context.getTranslation(this.props).Autocomplete,
includeValidProps(this.context.FormRow),
- this.context.Autocomplete
+ this.context.Autocomplete,
))
const {
@@ -1774,7 +1774,7 @@ class AutocompleteInstance extends React.PureComponent {
'dnb-form-component',
createSpacingClasses(props),
_className,
- className
+ className,
),
}
@@ -1840,7 +1840,7 @@ class AutocompleteInstance extends React.PureComponent {
inputParams['aria-describedby'] = combineDescribedBy(
inputParams,
showStatus ? id + '-status' : null,
- suffix ? id + '-suffix' : null
+ suffix ? id + '-suffix' : null,
)
}
@@ -1880,7 +1880,7 @@ class AutocompleteInstance extends React.PureComponent {
const suffixValue = getCurrentData(
selected_item,
- this.context.drawerList.original_data
+ this.context.drawerList.original_data,
)?.suffix_value
const innerId = suffixValue && showStatus ? `${id}-inner` : null
@@ -1986,7 +1986,7 @@ class AutocompleteInstance extends React.PureComponent {
id={id}
className={classnames(
'dnb-autocomplete__root',
- drawer_class
+ drawer_class,
)}
portal_class={portal_class}
list_class="dnb-autocomplete__list"
diff --git a/packages/dnb-eufemia/src/components/autocomplete/__tests__/Autocomplete.test.tsx b/packages/dnb-eufemia/src/components/autocomplete/__tests__/Autocomplete.test.tsx
index cd616705c0d..6ba9ba806e3 100644
--- a/packages/dnb-eufemia/src/components/autocomplete/__tests__/Autocomplete.test.tsx
+++ b/packages/dnb-eufemia/src/components/autocomplete/__tests__/Autocomplete.test.tsx
@@ -62,12 +62,12 @@ describe('Autocomplete component', () => {
opened
input_value="the g th"
{...mockProps}
- />
+ />,
)
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML
+ document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML,
).toBe(
- /* html */ `The Godfather the godfather The Godfather `
+ /* html */ `The Godfather the godfather The Godfather `,
)
})
@@ -90,7 +90,7 @@ describe('Autocomplete component', () => {
it('has correct options after filter', () => {
render(
-
+ ,
)
toggle()
@@ -100,13 +100,13 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll(
- 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)'
- ).length
+ 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)',
+ ).length,
).toBe(1)
expect(
document.querySelector(
- 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)'
- ).textContent
+ 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)',
+ ).textContent,
).toBe(mockData[0])
// check "cc"
@@ -115,8 +115,8 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll(
- 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)'
- ).length
+ 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)',
+ ).length,
).toBe(2)
// check "bb cc"
@@ -125,12 +125,12 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[1])
expect(
document.querySelectorAll(
- 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)'
- ).length
+ 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)',
+ ).length,
).toBe(2)
// check "aa cc"
@@ -139,7 +139,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[0])
// check inside words
@@ -148,12 +148,12 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[1])
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML
+ document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML,
).toBe(
- /* html */ `BB cc zethx `
+ /* html */ `BB cc zethx `,
)
// check "invalid"
@@ -162,7 +162,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe('Ingen alternativer')
})
@@ -174,30 +174,30 @@ describe('Autocomplete component', () => {
jest.spyOn(window, 'getComputedStyle').mockImplementation(() => style)
const { rerender } = render(
-
+ ,
)
const styleElement = document.querySelector(
- '.dnb-drawer-list__portal__style'
+ '.dnb-drawer-list__portal__style',
)
await waitFor(() => {
expect(styleElement.getAttribute('style')).toBe(
- 'width: 64px; --drawer-list-width: 4rem; top: 0px; left: 0px;'
+ 'width: 64px; --drawer-list-width: 4rem; top: 0px; left: 0px;',
)
})
rerender(
-
+ ,
)
expect(styleElement.getAttribute('style')).toBe(
- 'width: 320px; --drawer-list-width: 20rem; top: 0px; left: 0px;'
+ 'width: 320px; --drawer-list-width: 20rem; top: 0px; left: 0px;',
)
const element = document.querySelector('.dnb-drawer-list')
expect(Array.from(element.classList)).toContain(
- 'dnb-drawer-list--independent-width'
+ 'dnb-drawer-list--independent-width',
)
})
@@ -224,13 +224,13 @@ describe('Autocomplete component', () => {
let index = 1
const { rerender } = render(
-
+ ,
)
const assertInputValue = () => {
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe(mockData[index].selected_value)
}
@@ -238,7 +238,7 @@ describe('Autocomplete component', () => {
index = 2
rerender(
-
+ ,
)
assertInputValue()
@@ -250,29 +250,29 @@ describe('Autocomplete component', () => {
document
.querySelectorAll('.dnb-drawer-list__option')[1]
.querySelector(
- '.dnb-drawer-list__option__item.dnb-drawer-list__option__suffix'
- ).textContent
+ '.dnb-drawer-list__option__item.dnb-drawer-list__option__suffix',
+ ).textContent,
).toBe('b suffix')
expect(
document
.querySelectorAll('.dnb-drawer-list__option')[2]
.querySelector(
- '.dnb-drawer-list__option__item.dnb-drawer-list__option__suffix'
- ).textContent
+ '.dnb-drawer-list__option__item.dnb-drawer-list__option__suffix',
+ ).textContent,
).toBe(mockData[2].suffix_value)
})
it('will not open drawer-list when click on suffix_value and is disabled', () => {
render(
-
+ ,
)
fireEvent.click(
- document.querySelector('.dnb-autocomplete__suffix_value')
+ document.querySelector('.dnb-autocomplete__suffix_value'),
)
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).not.toContain('dnb-autocomplete--opened')
expect(document.activeElement.tagName).toBe('BODY')
@@ -282,14 +282,14 @@ describe('Autocomplete component', () => {
render( )
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).not.toContain('dnb-autocomplete--opened')
fireEvent.click(
- document.querySelector('.dnb-autocomplete__suffix_value')
+ document.querySelector('.dnb-autocomplete__suffix_value'),
)
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).toContain('dnb-autocomplete--opened')
expect(document.activeElement.tagName).toBe('INPUT')
@@ -306,11 +306,11 @@ describe('Autocomplete component', () => {
show_submit_button
stretch
value={1}
- />
+ />,
)
expect(
- document.querySelector('.dnb-autocomplete__inner')
+ document.querySelector('.dnb-autocomplete__inner'),
).toHaveAttribute('id')
})
})
@@ -322,7 +322,7 @@ describe('Autocomplete component', () => {
search_in_word_index="1"
show_submit_button
{...mockProps}
- />
+ />,
)
toggle()
@@ -332,7 +332,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[1])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -340,7 +340,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[1])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -348,7 +348,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe('Ingen alternativer')
})
@@ -359,7 +359,7 @@ describe('Autocomplete component', () => {
show_submit_button
ariaLiveDelay={1}
{...mockProps}
- />
+ />,
)
toggle()
@@ -375,7 +375,7 @@ describe('Autocomplete component', () => {
expect(nodes[nodes.length - 1].textContent).toBe('1 alternativer')
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[1])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -389,7 +389,7 @@ describe('Autocomplete component', () => {
const content = (mockData[2] as DrawerListDataObject).content
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe((content as string[]).join(''))
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -402,7 +402,7 @@ describe('Autocomplete component', () => {
expect(nodes2[nodes2.length - 1].textContent).toBe('3 alternativer')
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe((content as string[]).join(''))
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -413,11 +413,11 @@ describe('Autocomplete component', () => {
const nodes3 = document.querySelectorAll('.dnb-sr-only')
expect(nodes3[nodes3.length - 1].textContent).toBe(
- 'Ingen alternativer'
+ 'Ingen alternativer',
)
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe('Ingen alternativer')
})
@@ -430,7 +430,7 @@ describe('Autocomplete component', () => {
]
render(
-
+ ,
)
toggle()
@@ -439,9 +439,9 @@ describe('Autocomplete component', () => {
target: { value: 'bb' },
})
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML
+ document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML,
).toBe(
- 'item bb '
+ 'item bb ',
)
// First result direction
@@ -449,9 +449,9 @@ describe('Autocomplete component', () => {
target: { value: 'cc bb' },
})
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML
+ document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML,
).toBe(
- 'item cc '
+ 'item cc ',
)
// Second result direction
@@ -459,9 +459,9 @@ describe('Autocomplete component', () => {
target: { value: 'bb cc' },
})
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML
+ document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML,
).toBe(
- 'item bb '
+ 'item bb ',
)
// With three matches, we prioritize the second one to be on the first place
@@ -469,9 +469,9 @@ describe('Autocomplete component', () => {
target: { value: 'cc bb more' },
})
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML
+ document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML,
).toBe(
- 'item cc second '
+ 'item cc second ',
)
// Do not find item, as there is defined a search_content
@@ -480,7 +480,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe('Ingen alternativer')
})
@@ -490,46 +490,46 @@ describe('Autocomplete component', () => {
})
render(
-
+ ,
)
toggle()
expect(document.querySelectorAll('.dnb-sr-only')[0].textContent).toBe(
- ''
+ '',
)
// simulate changes
keydown(40) // down
expect(document.querySelectorAll('.dnb-sr-only')[0].textContent).toBe(
- 'AA c'
+ 'AA c',
)
// simulate changes
keydown(40) // down
expect(document.querySelectorAll('.dnb-sr-only')[0].textContent).toBe(
- 'BB cc zethx'
+ 'BB cc zethx',
)
// simulate changes
keydown(40) // down
expect(document.querySelectorAll('.dnb-sr-only')[0].textContent).toBe(
- 'CCcc'
+ 'CCcc',
)
act(() => {
document.dispatchEvent(
new KeyboardEvent('keydown', {
keyCode: 13, // enter
- })
+ }),
)
})
expect(document.querySelectorAll('.dnb-sr-only')[0].textContent).toBe(
- 'Valgt: CCcc'
+ 'Valgt: CCcc',
)
// simulate changes
@@ -537,7 +537,7 @@ describe('Autocomplete component', () => {
keydown(38) // up
expect(document.querySelectorAll('.dnb-sr-only')[0].textContent).toBe(
- 'BB cc zethx'
+ 'BB cc zethx',
)
// eslint-disable-next-line
@@ -549,7 +549,7 @@ describe('Autocomplete component', () => {
keydown(38) // up
expect(document.querySelectorAll('.dnb-sr-only')[0].textContent).toBe(
- ''
+ '',
)
})
@@ -564,7 +564,7 @@ describe('Autocomplete component', () => {
]
render(
-
+ ,
)
toggle()
@@ -574,7 +574,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe('Ingen alternativer')
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -582,7 +582,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[0])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -590,7 +590,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[1])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -598,7 +598,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[2])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -606,7 +606,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[3])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -614,7 +614,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[4])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -622,7 +622,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[5])
})
@@ -640,7 +640,7 @@ describe('Autocomplete component', () => {
search_numbers
show_submit_button
{...mockProps}
- />
+ />,
)
toggle()
@@ -650,12 +650,12 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[1])
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML
+ document.querySelectorAll('li.dnb-drawer-list__option')[0].outerHTML,
).toBe(
- /* html */ `2223 33 44425 `
+ /* html */ `2223 33 44425 `,
)
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -663,7 +663,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[1])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -671,7 +671,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[2])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -679,7 +679,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[3])
})
@@ -693,7 +693,7 @@ describe('Autocomplete component', () => {
search_numbers
search_in_word_index={1}
{...mockProps}
- />
+ />,
)
toggle()
@@ -703,7 +703,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[0])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -711,7 +711,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[0])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -719,7 +719,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[0])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -727,7 +727,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[2])
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -735,8 +735,8 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll(
- 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)'
- ).length
+ 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)',
+ ).length,
).toBe(3)
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -744,7 +744,7 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe(mockData[0])
})
@@ -752,7 +752,7 @@ describe('Autocomplete component', () => {
let elem
render(
-
+ ,
)
// check "cc"
@@ -762,38 +762,38 @@ describe('Autocomplete component', () => {
const content = (mockData[2] as DrawerListDataObject).content
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe((content as string[]).join(''))
expect(
document.querySelectorAll(
- 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)'
- ).length
+ 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)',
+ ).length,
).toBe(2)
expect(
- document.querySelector('li.dnb-drawer-list__option--focus')
+ document.querySelector('li.dnb-drawer-list__option--focus'),
).not.toBeInTheDocument()
// then simulate changes
keydown(40) // down
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[0].classList
+ document.querySelectorAll('li.dnb-drawer-list__option')[0].classList,
).toContain('dnb-drawer-list__option--focus')
// then simulate changes
keydown(40) // down
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[1].classList
+ document.querySelectorAll('li.dnb-drawer-list__option')[1].classList,
).toContain('dnb-drawer-list__option--focus')
expect(
document
.querySelectorAll('li.dnb-drawer-list__option')[1]
- .getAttribute('id')
+ .getAttribute('id'),
).toBe(
document
.querySelector('.dnb-input__input')
- .getAttribute('aria-activedescendant')
+ .getAttribute('aria-activedescendant'),
)
// check "cc bb"
@@ -802,19 +802,19 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll(
- 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)'
- ).length
+ 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)',
+ ).length,
).toBe(2)
expect(
- document.querySelector('li.dnb-autocomplete__show-all').textContent
+ document.querySelector('li.dnb-autocomplete__show-all').textContent,
).toBe('Vis alt')
expect(
- document.querySelectorAll('li.dnb-drawer-list__option').length
+ document.querySelectorAll('li.dnb-drawer-list__option').length,
).toBe(3)
expect(
document
.querySelectorAll('li.dnb-drawer-list__option')[1]
- .getAttribute('aria-selected')
+ .getAttribute('aria-selected'),
).toBe('true')
elem = document.querySelectorAll('li.dnb-drawer-list__option')[1]
@@ -838,7 +838,7 @@ describe('Autocomplete component', () => {
data={mockData}
show_submit_button
{...mockProps}
- />
+ />,
)
toggle()
@@ -848,8 +848,8 @@ describe('Autocomplete component', () => {
})
expect(
document.querySelectorAll(
- 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)'
- ).length
+ 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)',
+ ).length,
).toBe(3)
})
@@ -862,9 +862,9 @@ describe('Autocomplete component', () => {
expect(
elem
.querySelector(
- 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)'
+ 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)',
)
- .getAttribute('aria-expanded')
+ .getAttribute('aria-expanded'),
).toBe('true')
})
@@ -878,8 +878,8 @@ describe('Autocomplete component', () => {
expect(
elem.querySelectorAll(
- 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)'
- ).length
+ 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)',
+ ).length,
).toBe(3)
})
@@ -899,7 +899,7 @@ describe('Autocomplete component', () => {
expect(
document
.querySelector('button.dnb-input__submit-button__button')
- .getAttribute('type')
+ .getAttribute('type'),
).toBe('button')
})
@@ -910,8 +910,8 @@ describe('Autocomplete component', () => {
expect(
document.querySelectorAll(
- 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)'
- ).length
+ 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)',
+ ).length,
).toBe(mockData.length)
})
@@ -932,7 +932,7 @@ describe('Autocomplete component', () => {
data={mockData}
show_submit_button
{...mockProps}
- />
+ />,
)
document.querySelector('input').focus()
@@ -968,11 +968,11 @@ describe('Autocomplete component', () => {
expect(on_hide).toHaveBeenCalledTimes(1)
expect(on_hide.mock.calls[0][0].attributes).toMatchObject(params)
expect(on_hide.mock.calls[0][0].event).toEqual(
- new KeyboardEvent('keydown', {})
+ new KeyboardEvent('keydown', {}),
)
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).not.toContain('dnb-autocomplete--opened')
// ensure we blur only once
@@ -984,13 +984,13 @@ describe('Autocomplete component', () => {
expect(on_show.mock.calls[1][0].attributes).toMatchObject(params)
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).toContain('dnb-autocomplete--opened')
keydown(27) // esc
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).not.toContain('dnb-autocomplete--opened')
toggle()
@@ -1005,7 +1005,7 @@ describe('Autocomplete component', () => {
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe(data[value])
const newValue = 1
@@ -1015,7 +1015,7 @@ describe('Autocomplete component', () => {
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe(newData[newValue])
})
@@ -1027,15 +1027,15 @@ describe('Autocomplete component', () => {
placeholder="placeholder"
value={null}
data={mockData}
- />
+ />,
)
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe('')
expect(
- document.querySelector('.dnb-input__placeholder').textContent
+ document.querySelector('.dnb-input__placeholder').textContent,
).toBe('placeholder')
value = 1
@@ -1045,12 +1045,12 @@ describe('Autocomplete component', () => {
placeholder="placeholder"
value={value}
data={mockData}
- />
+ />,
)
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe(mockData[value])
rerender(
@@ -1059,12 +1059,12 @@ describe('Autocomplete component', () => {
placeholder="placeholder"
value={undefined}
data={mockData}
- />
+ />,
)
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe('')
value = 0
@@ -1074,12 +1074,12 @@ describe('Autocomplete component', () => {
placeholder="placeholder"
value={value}
data={mockData}
- />
+ />,
)
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe(mockData[value])
rerender(
@@ -1088,12 +1088,12 @@ describe('Autocomplete component', () => {
placeholder="placeholder"
value={null}
data={mockData}
- />
+ />,
)
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe('')
})
@@ -1111,7 +1111,7 @@ describe('Autocomplete component', () => {
on_change={on_change}
data={mockData}
{...mockProps}
- />
+ />,
)
fireEvent.focus(document.querySelector('input'))
@@ -1131,7 +1131,7 @@ describe('Autocomplete component', () => {
document.dispatchEvent(
new KeyboardEvent('keydown', {
keyCode: 13, // enter
- })
+ }),
)
fireEvent.blur(document.querySelector('input'))
expect(on_blur).toHaveBeenCalledTimes(0)
@@ -1139,7 +1139,7 @@ describe('Autocomplete component', () => {
// Make a selection
fireEvent.click(
- document.querySelectorAll('li.dnb-drawer-list__option')[1]
+ document.querySelectorAll('li.dnb-drawer-list__option')[1],
)
expect(on_change).toHaveBeenCalledTimes(1)
@@ -1186,7 +1186,7 @@ describe('Autocomplete component', () => {
on_change={on_change}
on_type={on_type}
data={mockData}
- />
+ />,
)
// 1. Make first a selected_item change
@@ -1197,7 +1197,7 @@ describe('Autocomplete component', () => {
on_type={on_type}
data={mockData}
value={2}
- />
+ />,
)
// 2. Then update the data
@@ -1208,7 +1208,7 @@ describe('Autocomplete component', () => {
on_type={on_type}
data={newMockData}
value={2}
- />
+ />,
)
// 3. And change the value again
@@ -1219,13 +1219,13 @@ describe('Autocomplete component', () => {
on_type={on_type}
data={newMockData}
value={1}
- />
+ />,
)
// It should not trigger the resetSelectionItem method
expect(on_change).toHaveBeenCalledTimes(0)
expect(document.querySelector('input').value).toBe(
- newMockData[1].content
+ newMockData[1].content,
)
// Reset data and value
@@ -1236,7 +1236,7 @@ describe('Autocomplete component', () => {
on_type={on_type}
data={mockData}
value={null}
- />
+ />,
)
fireEvent.change(document.querySelector('input'), {
@@ -1245,7 +1245,7 @@ describe('Autocomplete component', () => {
// Make a selection
fireEvent.click(
- document.querySelectorAll('li.dnb-drawer-list__option')[1]
+ document.querySelectorAll('li.dnb-drawer-list__option')[1],
)
expect(document.querySelector('input').value).toBe(mockData[1].content)
@@ -1270,13 +1270,13 @@ describe('Autocomplete component', () => {
// Make a selection
fireEvent.click(
- document.querySelectorAll('li.dnb-drawer-list__option')[1]
+ document.querySelectorAll('li.dnb-drawer-list__option')[1],
)
expect(on_change).toHaveBeenCalledTimes(3)
expect(on_change.mock.calls[2][0].data).toEqual(newMockData[1])
expect(document.querySelector('input').value).toBe(
- newMockData[1].content
+ newMockData[1].content,
)
})
@@ -1298,7 +1298,7 @@ describe('Autocomplete component', () => {
show_submit_button
data={mockData}
on_change={on_change}
- />
+ />,
)
// open first
@@ -1311,7 +1311,7 @@ describe('Autocomplete component', () => {
document.dispatchEvent(
new KeyboardEvent('keydown', {
keyCode: 13, // enter
- })
+ }),
)
})
}
@@ -1320,7 +1320,7 @@ describe('Autocomplete component', () => {
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe('A value')
expect(on_change.mock.calls[0][0].data.selected_key).toBe('a')
@@ -1332,12 +1332,12 @@ describe('Autocomplete component', () => {
data={mockData}
on_change={on_change}
value="b"
- />
+ />,
)
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe('B value')
toggle()
@@ -1345,7 +1345,7 @@ describe('Autocomplete component', () => {
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe('C value')
expect(on_change.mock.calls[1][0].data.selected_key).toBe('c')
@@ -1357,12 +1357,12 @@ describe('Autocomplete component', () => {
data={mockData}
on_change={on_change}
value="id-123"
- />
+ />,
)
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe('123 value')
toggle()
@@ -1370,7 +1370,7 @@ describe('Autocomplete component', () => {
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe('456 value')
expect(on_change.mock.calls[2][0].data.selected_key).toBe('id-456')
rerender(
@@ -1381,12 +1381,12 @@ describe('Autocomplete component', () => {
data={mockData}
on_change={on_change}
value={123}
- />
+ />,
)
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe('')
})
@@ -1408,7 +1408,7 @@ describe('Autocomplete component', () => {
fireEvent.mouseDown(document.querySelector('.dnb-input__input'))
expect(
- document.querySelectorAll('li.dnb-drawer-list__option').length
+ document.querySelectorAll('li.dnb-drawer-list__option').length,
).toBe(3)
fireEvent.focus(document.querySelector('.dnb-input__input'))
@@ -1420,13 +1420,13 @@ describe('Autocomplete component', () => {
keydown(40) // down
expect(
- document.querySelector('li.dnb-drawer-list__option--focus')
+ document.querySelector('li.dnb-drawer-list__option--focus'),
).toBeInTheDocument()
closeAndReopen()
expect(
- document.querySelector('li.dnb-drawer-list__option--focus') !== null
+ document.querySelector('li.dnb-drawer-list__option--focus') !== null,
).toBe(shouldHaveActiveItem)
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -1434,20 +1434,20 @@ describe('Autocomplete component', () => {
})
expect(
- document.querySelector('li.dnb-drawer-list__option--focus')
+ document.querySelector('li.dnb-drawer-list__option--focus'),
).not.toBeInTheDocument()
keydown(40) // down
expect(
- document.querySelector('li.dnb-drawer-list__option--focus')
+ document.querySelector('li.dnb-drawer-list__option--focus'),
).toBeInTheDocument()
closeAndReopen()
// This here is what we expect
expect(
- document.querySelector('li.dnb-drawer-list__option--focus') !== null
+ document.querySelector('li.dnb-drawer-list__option--focus') !== null,
).toBe(shouldHaveActiveItemWhenEmpty)
// This also opens the drawer-list
@@ -1459,21 +1459,21 @@ describe('Autocomplete component', () => {
document.dispatchEvent(
new KeyboardEvent('keydown', {
keyCode: 13, // enter
- })
+ }),
)
closeAndReopen()
// Now we have a selected item
expect(
- document.querySelector('li.dnb-drawer-list__option--selected')
+ document.querySelector('li.dnb-drawer-list__option--selected'),
).toBeInTheDocument()
expect(
- document.querySelector('li.dnb-drawer-list__option--focus')
+ document.querySelector('li.dnb-drawer-list__option--focus'),
).toBeInTheDocument()
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe('CC cc')
fireEvent.change(document.querySelector('.dnb-input__input'), {
@@ -1484,10 +1484,10 @@ describe('Autocomplete component', () => {
// This here is what we expect
expect(
- document.querySelector('li.dnb-drawer-list__option--focus') !== null
+ document.querySelector('li.dnb-drawer-list__option--focus') !== null,
).toBe(shouldHaveActiveItemWhenEmpty)
expect(
- document.querySelector('li.dnb-drawer-list__option--selected')
+ document.querySelector('li.dnb-drawer-list__option--selected'),
).not.toBeInTheDocument()
cleanup()
@@ -1602,7 +1602,7 @@ describe('Autocomplete component', () => {
.querySelector('button')
expect(buttonElem.textContent).toBe(
- 'Bla gjennom alternativer, lukk med esc knappen'
+ 'Bla gjennom alternativer, lukk med esc knappen',
)
expect(buttonElem).toBeInTheDocument()
expect(buttonElem.getAttribute('tabindex')).toBe('-1')
@@ -1610,19 +1610,19 @@ describe('Autocomplete component', () => {
fireEvent.click(buttonElem)
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).toContain('dnb-autocomplete--opened')
expect(Array.from(document.activeElement.classList)).toContain(
- 'dnb-drawer-list__options'
+ 'dnb-drawer-list__options',
)
fireEvent.click(buttonElem)
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).not.toContain('dnb-autocomplete--opened')
expect(Array.from(document.activeElement.classList)).toContain(
- 'dnb-input__input'
+ 'dnb-input__input',
)
})
@@ -1635,45 +1635,45 @@ describe('Autocomplete component', () => {
})
expect(Array.from(document.activeElement.classList)).toContain(
- 'dnb-input__input'
+ 'dnb-input__input',
)
expect(
document.querySelectorAll(
- 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)'
- ).length
+ 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)',
+ ).length,
).toBe(mockData.length - 1)
document.querySelector('input').focus()
expect(Array.from(document.activeElement.classList)).toContain(
- 'dnb-input__input'
+ 'dnb-input__input',
)
fireEvent.click(
- document.querySelector('li.dnb-autocomplete__show-all')
+ document.querySelector('li.dnb-autocomplete__show-all'),
)
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[1].classList
+ document.querySelectorAll('li.dnb-drawer-list__option')[1].classList,
).toContain('dnb-drawer-list__option--focus')
expect(Array.from(document.activeElement.classList)).toContain(
- 'dnb-input__input'
+ 'dnb-input__input',
)
expect(
document.querySelectorAll(
- 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)'
- ).length
+ 'li.dnb-drawer-list__option:not(.dnb-autocomplete__show-all)',
+ ).length,
).toBe(mockData.length)
fireEvent.blur(document.querySelector('input'))
fireEvent.click(
- document.querySelectorAll('li.dnb-drawer-list__option')[0]
+ document.querySelectorAll('li.dnb-drawer-list__option')[0],
)
expect(Array.from(document.activeElement.classList)).toContain(
- 'dnb-input__input'
+ 'dnb-input__input',
)
})
@@ -1683,20 +1683,20 @@ describe('Autocomplete component', () => {
fireEvent.mouseDown(document.querySelector('.dnb-input__input'))
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).toContain('dnb-autocomplete--opened')
// close
keydown(27) // esc
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).not.toContain('dnb-autocomplete--opened')
fireEvent.mouseDown(document.querySelector('.dnb-input__input'))
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).toContain('dnb-autocomplete--opened')
})
@@ -1711,19 +1711,19 @@ describe('Autocomplete component', () => {
on_change={on_change}
data={mockData}
{...mockProps}
- />
+ />,
)
fireEvent.focus(document.querySelector('input'))
expect(on_focus).toHaveBeenCalledTimes(1)
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).toContain('dnb-autocomplete--opened')
// Make a selection
fireEvent.click(
- document.querySelectorAll('li.dnb-drawer-list__option')[1]
+ document.querySelectorAll('li.dnb-drawer-list__option')[1],
)
expect(on_change).toHaveBeenCalledTimes(1)
@@ -1739,14 +1739,14 @@ describe('Autocomplete component', () => {
data={mockData}
show_submit_button
{...mockProps}
- />
+ />,
)
// first open
toggle()
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).toContain('dnb-autocomplete--opened')
act(() => {
@@ -1756,14 +1756,14 @@ describe('Autocomplete component', () => {
expect(on_hide).toHaveBeenCalledTimes(1)
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).not.toContain('dnb-autocomplete--opened')
// reopen
toggle()
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).toContain('dnb-autocomplete--opened')
preventClose = true
@@ -1776,7 +1776,7 @@ describe('Autocomplete component', () => {
// we are still open
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).toContain('dnb-autocomplete--opened')
})
@@ -1788,7 +1788,7 @@ describe('Autocomplete component', () => {
data={mockData}
show_submit_button
{...mockProps}
- />
+ />,
)
toggle()
@@ -1804,7 +1804,7 @@ describe('Autocomplete component', () => {
expect(
document
.querySelectorAll('li.dnb-drawer-list__option')[0]
- .querySelector('.dnb-drawer-list__option__inner').outerHTML
+ .querySelector('.dnb-drawer-list__option__inner').outerHTML,
).toBe(result)
})
@@ -1812,7 +1812,7 @@ describe('Autocomplete component', () => {
const replaceData = ['aaa']
const { rerender } = render(
-
+ ,
)
keydown(40) // down
@@ -1822,7 +1822,7 @@ describe('Autocomplete component', () => {
})
expect(
- document.querySelectorAll('li.dnb-drawer-list__option').length
+ document.querySelectorAll('li.dnb-drawer-list__option').length,
).toBe(2)
// update data
@@ -1833,11 +1833,11 @@ describe('Autocomplete component', () => {
})
expect(
- document.querySelectorAll('li.dnb-drawer-list__option').length
+ document.querySelectorAll('li.dnb-drawer-list__option').length,
).toBe(1)
expect(
document.querySelectorAll('li.dnb-drawer-list__option')[0]
- .textContent
+ .textContent,
).toBe('aaa')
})
@@ -1852,7 +1852,7 @@ describe('Autocomplete component', () => {
on_type={on_type}
data={mockData}
{...mockProps}
- />
+ />,
)
keydown(40) // down
@@ -1863,7 +1863,7 @@ describe('Autocomplete component', () => {
const callOne = on_type.mock.calls[0][0]
expect(
- document.querySelectorAll('li.dnb-drawer-list__option').length
+ document.querySelectorAll('li.dnb-drawer-list__option').length,
).toBe(3)
expect(on_type).toHaveBeenCalledTimes(1)
expect(callOne.value).toBe('aa')
@@ -1880,7 +1880,7 @@ describe('Autocomplete component', () => {
const callTwo = on_type.mock.calls[1][0]
expect(
- document.querySelectorAll('li.dnb-drawer-list__option').length
+ document.querySelectorAll('li.dnb-drawer-list__option').length,
).toBe(1)
expect(on_type).toHaveBeenCalledTimes(2)
expect(callTwo.dataList.length).toBe(1)
@@ -1904,13 +1904,13 @@ describe('Autocomplete component', () => {
let index = 1
const { rerender } = render(
-
+ ,
)
const assert = () => {
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe(mockData[index].selected_value)
}
@@ -1959,12 +1959,12 @@ describe('Autocomplete component', () => {
})
fireEvent.click(
- document.querySelectorAll('li.dnb-drawer-list__option')[1]
+ document.querySelectorAll('li.dnb-drawer-list__option')[1],
)
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe('c value')
})
@@ -1972,7 +1972,7 @@ describe('Autocomplete component', () => {
render( )
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe(mockData[props.value])
})
@@ -1985,7 +1985,7 @@ describe('Autocomplete component', () => {
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe(mockData[props.value])
})
@@ -1997,10 +1997,10 @@ describe('Autocomplete component', () => {
title={title}
show_submit_button
{...mockProps}
- />
+ />,
)
expect(
- document.querySelector('.dnb-input__placeholder').textContent
+ document.querySelector('.dnb-input__placeholder').textContent,
).toBe(title)
})
@@ -2012,11 +2012,11 @@ describe('Autocomplete component', () => {
value={value}
show_submit_button
{...mockProps}
- />
+ />,
)
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe(mockData[value])
})
@@ -2036,13 +2036,13 @@ describe('Autocomplete component', () => {
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe(mockData[newValue])
})
it('has a disabled attribute, once we set disabled to true', () => {
const { rerender } = render(
-
+ ,
)
rerender(
{
show_submit_button
{...mockProps}
disabled={true}
- />
+ />,
)
expect(
document.querySelector(
- 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)'
- )
+ 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)',
+ ),
).toHaveAttribute('disabled')
expect(
document
.querySelector(
- 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)'
+ 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)',
)
.querySelector('.dnb-icon')
- .getAttribute('data-testid')
+ .getAttribute('data-testid'),
).toContain('chevron down')
})
@@ -2081,15 +2081,15 @@ describe('Autocomplete component', () => {
onChange={onChange}
/>
)}
- />
+ />,
)
expect(document.querySelector('input')).toBeInTheDocument()
expect(
- Array.from(document.querySelector('input').classList)
+ Array.from(document.querySelector('input').classList),
).toContain('dnb-autocomplete__input')
expect(
- document.querySelector('input').getAttribute('aria-label')
+ document.querySelector('input').getAttribute('aria-label'),
).toBe('label')
const value = 'new value'
@@ -2133,13 +2133,13 @@ describe('Autocomplete component', () => {
await userEvent.tab()
expect(Array.from(document.activeElement.classList)).toContain(
- 'first-anchor'
+ 'first-anchor',
)
await userEvent.tab()
expect(Array.from(document.activeElement.classList)).toContain(
- 'second-anchor'
+ 'second-anchor',
)
})
@@ -2162,7 +2162,7 @@ describe('Autocomplete component', () => {
data={mockData}
{...mockProps}
submit_element={ }
- />
+ />,
)
rerender(
{
{...mockProps}
submit_element={ }
disabled={true}
- />
+ />,
)
expect(
document.querySelector(
- 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)'
- )
+ 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)',
+ ),
).toHaveAttribute('disabled')
expect(
document
.querySelector(
- 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)'
+ 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)',
)
- .querySelector('.dnb-icon')
+ .querySelector('.dnb-icon'),
).toBeInTheDocument()
expect(
document
.querySelector(
- 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)'
+ 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)',
)
.querySelector('.dnb-icon')
- .getAttribute('data-testid')
+ .getAttribute('data-testid'),
).toContain('bell')
})
@@ -2201,8 +2201,8 @@ describe('Autocomplete component', () => {
// open first
fireEvent.click(
document.querySelector(
- 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)'
- )
+ 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)',
+ ),
)
await testDirectionObserver()
@@ -2215,21 +2215,21 @@ describe('Autocomplete component', () => {
{...mockProps}
status="status text"
show_submit_button
- />
+ />,
)
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).toContain('dnb-autocomplete__status--error')
expect(document.querySelector('.dnb-form-status').classList).toContain(
- 'dnb-form-status--error'
+ 'dnb-form-status--error',
)
expect(document.querySelector('.dnb-input').classList).toContain(
- 'dnb-input__status--error'
+ 'dnb-input__status--error',
)
expect(
document.querySelector('button.dnb-input__submit-button__button')
- .classList
+ .classList,
).toContain('dnb-button__status--error')
})
@@ -2241,21 +2241,21 @@ describe('Autocomplete component', () => {
status="status text"
status_state="error"
show_submit_button
- />
+ />,
)
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).toContain('dnb-autocomplete__status--error')
expect(document.querySelector('.dnb-form-status').classList).toContain(
- 'dnb-form-status--error'
+ 'dnb-form-status--error',
)
expect(document.querySelector('.dnb-input').classList).toContain(
- 'dnb-input__status--error'
+ 'dnb-input__status--error',
)
expect(
document.querySelector('button.dnb-input__submit-button__button')
- .classList
+ .classList,
).toContain('dnb-button__status--error')
})
@@ -2267,21 +2267,21 @@ describe('Autocomplete component', () => {
status="status text"
status_state="info"
show_submit_button
- />
+ />,
)
expect(
- document.querySelector('.dnb-autocomplete').classList
+ document.querySelector('.dnb-autocomplete').classList,
).toContain('dnb-autocomplete__status--info')
expect(document.querySelector('.dnb-form-status').classList).toContain(
- 'dnb-form-status--info'
+ 'dnb-form-status--info',
)
expect(document.querySelector('.dnb-input').classList).toContain(
- 'dnb-input__status--info'
+ 'dnb-input__status--info',
)
expect(
document.querySelector('button.dnb-input__submit-button__button')
- .classList
+ .classList,
).toContain('dnb-button__status--info')
})
@@ -2297,12 +2297,12 @@ describe('Autocomplete component', () => {
render(
-
+ ,
)
const element = document.querySelector('.dnb-autocomplete')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -2331,7 +2331,7 @@ describe('Autocomplete markup', () => {
skip_portal: true,
}
const CheckComponent = render(
-
+ ,
)
expect(
@@ -2340,7 +2340,7 @@ describe('Autocomplete markup', () => {
'aria-valid-attr-value': { enabled: false },
'aria-required-children': { enabled: false },
},
- })
+ }),
).toHaveNoViolations()
})
})
@@ -2353,7 +2353,7 @@ describe('Autocomplete scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-autocomplete-theme-ui.scss')
+ require.resolve('../style/themes/dnb-autocomplete-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
@@ -2368,7 +2368,7 @@ const keydown = (keyCode) => {
const toggle = () => {
fireEvent.click(
document.querySelector(
- 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)'
- )
+ 'button.dnb-input__submit-button__button:not(.dnb-input__clear-button)',
+ ),
)
}
diff --git a/packages/dnb-eufemia/src/components/autocomplete/stories/Autocomplete.stories.tsx b/packages/dnb-eufemia/src/components/autocomplete/stories/Autocomplete.stories.tsx
index 33a719e6280..5e1f35dc8f0 100644
--- a/packages/dnb-eufemia/src/components/autocomplete/stories/Autocomplete.stories.tsx
+++ b/packages/dnb-eufemia/src/components/autocomplete/stories/Autocomplete.stories.tsx
@@ -91,7 +91,7 @@ export function UpdateEachOther() {
setSelectedAccountsB(
accounts.filter(({ selected_id }) => {
return selected_id !== account?.selected_id
- })
+ }),
)
}}
/>
@@ -105,7 +105,7 @@ export function UpdateEachOther() {
setSelectedAccountsA(
accounts.filter(({ selected_id }) => {
return selected_id !== account?.selected_id
- })
+ }),
)
}}
/>
@@ -204,7 +204,7 @@ const AutocompleteWithState = () => {
return () => clearTimeout(timeout)
},
{ value, results },
- 1e3
+ 1e3,
)
}}
/>
@@ -787,7 +787,7 @@ function UpdateDataExample() {
size="small"
on_click={() => {
const updatedSelectedData = selectedData.filter(
- (data) => item.selected_value !== data.selected_value
+ (data) => item.selected_value !== data.selected_value,
)
setSelectedData(updatedSelectedData)
setChoiceData(
@@ -795,9 +795,9 @@ function UpdateDataExample() {
(data) =>
updatedSelectedData.findIndex(
({ selected_value: updatedValue }) =>
- updatedValue === data?.selected_value
- ) === -1
- )
+ updatedValue === data?.selected_value,
+ ) === -1,
+ ),
)
}}
>
@@ -819,8 +819,8 @@ function UpdateDataExample() {
// update our choices
setChoiceData(
choiceData.filter(
- (item) => item.selected_value !== data.selected_value
- )
+ (item) => item.selected_value !== data.selected_value,
+ ),
)
// we could have used updateData
@@ -830,7 +830,7 @@ function UpdateDataExample() {
if (
selectedData.findIndex(
({ selected_value }) =>
- selected_value === data.selected_value
+ selected_value === data.selected_value,
) === -1
) {
setSelectedData([...selectedData, data])
diff --git a/packages/dnb-eufemia/src/components/avatar/Avatar.tsx b/packages/dnb-eufemia/src/components/avatar/Avatar.tsx
index f48725d1020..5d2d0e74bc0 100644
--- a/packages/dnb-eufemia/src/components/avatar/Avatar.tsx
+++ b/packages/dnb-eufemia/src/components/avatar/Avatar.tsx
@@ -100,7 +100,7 @@ const Avatar = (localProps: AvatarProps & SpacingProps) => {
defaultProps,
context?.Avatar,
{ skeleton: context?.skeleton },
- avatarGroupContext
+ avatarGroupContext,
)
const {
@@ -135,7 +135,7 @@ const Avatar = (localProps: AvatarProps & SpacingProps) => {
if (!avatarGroupContext && !hasLabel) {
warn(
- `Avatar group required: An Avatar requires an Avatar.Group with label description as a parent component. This is to ensure correct semantic and accessibility.`
+ `Avatar group required: An Avatar requires an Avatar.Group with label description as a parent component. This is to ensure correct semantic and accessibility.`,
)
}
@@ -149,7 +149,7 @@ const Avatar = (localProps: AvatarProps & SpacingProps) => {
`dnb-avatar--size-${size || 'medium'}`,
skeletonClasses,
spacingClasses,
- className
+ className,
)}
{...props}
>
diff --git a/packages/dnb-eufemia/src/components/avatar/AvatarGroup.tsx b/packages/dnb-eufemia/src/components/avatar/AvatarGroup.tsx
index 5d9268614e5..8855b5973a0 100644
--- a/packages/dnb-eufemia/src/components/avatar/AvatarGroup.tsx
+++ b/packages/dnb-eufemia/src/components/avatar/AvatarGroup.tsx
@@ -88,7 +88,7 @@ const AvatarGroup = (localProps: AvatarGroupProps & SpacingProps) => {
context?.AvatarGroup,
{
skeleton: context?.skeleton,
- }
+ },
)
const maxElements =
@@ -132,7 +132,7 @@ const AvatarGroup = (localProps: AvatarGroupProps & SpacingProps) => {
className={classnames(
'dnb-avatar__group',
spacingClasses,
- className
+ className,
)}
{...attributes}
>
@@ -170,7 +170,7 @@ function ElementsHidden(props: ElementsHiddenProps) {
{children}
diff --git a/packages/dnb-eufemia/src/components/avatar/__tests__/Avatar.test.tsx b/packages/dnb-eufemia/src/components/avatar/__tests__/Avatar.test.tsx
index 0bbeb4a6f14..0d4054febc5 100644
--- a/packages/dnb-eufemia/src/components/avatar/__tests__/Avatar.test.tsx
+++ b/packages/dnb-eufemia/src/components/avatar/__tests__/Avatar.test.tsx
@@ -13,7 +13,7 @@ describe('Avatar', () => {
render(
-
+ ,
)
expect(document.querySelector('.dnb-avatar')).toBeInTheDocument()
@@ -24,7 +24,7 @@ describe('Avatar', () => {
render(
{children}
-
+ ,
)
expect(screen.queryAllByText(children)[0]).toBeInTheDocument()
@@ -35,7 +35,7 @@ describe('Avatar', () => {
render(
{children}
-
+ ,
)
expect(screen.queryByText('E')).toBeInTheDocument()
@@ -47,7 +47,7 @@ describe('Avatar', () => {
render(
{children}
-
+ ,
)
expect(screen.queryByText(children)).toBeInTheDocument()
@@ -59,7 +59,7 @@ describe('Avatar', () => {
-
+ ,
)
expect(screen.queryByTestId('confetti icon')).toBeInTheDocument()
@@ -70,7 +70,7 @@ describe('Avatar', () => {
render(
-
+ ,
)
expect(screen.queryByRole('img').getAttribute('src')).toBe(img_src)
@@ -81,7 +81,7 @@ describe('Avatar', () => {
render(
-
+ ,
)
expect(screen.getByAltText(img_alt)).toBeInTheDocument()
@@ -103,7 +103,7 @@ describe('Avatar', () => {
render(
-
+ ,
)
const image = screen.queryByRole('img')
@@ -134,10 +134,10 @@ describe('Avatar', () => {
render(
A
-
+ ,
)
expect(
- document.getElementsByClassName(skeletonClassName)
+ document.getElementsByClassName(skeletonClassName),
).toHaveLength(1)
})
@@ -149,11 +149,11 @@ describe('Avatar', () => {
A
-
+ ,
)
expect(
- document.getElementsByClassName(skeletonClassName)
+ document.getElementsByClassName(skeletonClassName),
).toHaveLength(1)
})
@@ -167,12 +167,12 @@ describe('Avatar', () => {
alt={img_alt}
src="/dnb/android-chrome-192x192.png"
/>
-
+ ,
)
const element = document.querySelector('.dnb-avatar')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -192,7 +192,7 @@ describe('Avatar', () => {
A
B
C
-
+ ,
)
expect(screen.queryByText(label)).toBeInTheDocument()
@@ -205,7 +205,7 @@ describe('Avatar', () => {
A
B
C
-
+ ,
)
expect(screen.queryByTestId('react-node')).toBeInTheDocument()
})
@@ -216,7 +216,7 @@ describe('Avatar', () => {
A
B
C
-
+ ,
)
const avatarsDisplayed =
@@ -233,7 +233,7 @@ describe('Avatar', () => {
A
B
C
-
+ ,
)
const avatarsDisplayed =
@@ -250,14 +250,14 @@ describe('Avatar', () => {
A
B
C
-
+ ,
)
const avatarsDisplayed =
document.getElementsByClassName('dnb-avatar')
expect(
- document.querySelector('.dnb-avatar__group--elements-left')
+ document.querySelector('.dnb-avatar__group--elements-left'),
).not.toBeInTheDocument()
expect(avatarsDisplayed).toHaveLength(3)
@@ -269,14 +269,14 @@ describe('Avatar', () => {
A
B
C
-
+ ,
)
const avatarsDisplayed =
document.getElementsByClassName('dnb-avatar')
expect(
- document.querySelector('.dnb-avatar__group--elements-left')
+ document.querySelector('.dnb-avatar__group--elements-left'),
).not.toBeInTheDocument()
expect(avatarsDisplayed).toHaveLength(3)
})
@@ -287,14 +287,14 @@ describe('Avatar', () => {
A
B
C
-
+ ,
)
const avatarsDisplayed =
document.getElementsByClassName('dnb-avatar')
expect(
- document.querySelector('.dnb-avatar__group--elements-left')
+ document.querySelector('.dnb-avatar__group--elements-left'),
).not.toBeInTheDocument()
expect(avatarsDisplayed).toHaveLength(3)
})
@@ -304,14 +304,14 @@ describe('Avatar', () => {
A
B
-
+ ,
)
const avatarsDisplayed =
document.getElementsByClassName('dnb-avatar')
expect(
- document.querySelector('.dnb-avatar__group--elements-left')
+ document.querySelector('.dnb-avatar__group--elements-left'),
).not.toBeInTheDocument()
expect(avatarsDisplayed).toHaveLength(2)
})
@@ -324,14 +324,14 @@ describe('Avatar', () => {
C
D
E
-
+ ,
)
const avatarsDisplayed =
document.getElementsByClassName('dnb-avatar')
expect(
- document.querySelector('.dnb-avatar__group--elements-left')
+ document.querySelector('.dnb-avatar__group--elements-left'),
).toBeInTheDocument()
expect(avatarsDisplayed).toHaveLength(3)
})
@@ -353,7 +353,7 @@ describe('Avatar scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-avatar-theme-ui.scss')
+ require.resolve('../style/themes/dnb-avatar-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/avatar/style/index.d.ts b/packages/dnb-eufemia/src/components/avatar/style/index.d.ts
index e400b4a3433..2dfade00e25 100644
--- a/packages/dnb-eufemia/src/components/avatar/style/index.d.ts
+++ b/packages/dnb-eufemia/src/components/avatar/style/index.d.ts
@@ -3,4 +3,4 @@
*
*/
-import './dnb-avatar.scss'
+import './dnb-avatar.scss';
diff --git a/packages/dnb-eufemia/src/components/avatar/style/themes/dnb-avatar-theme-sbanken.scss b/packages/dnb-eufemia/src/components/avatar/style/themes/dnb-avatar-theme-sbanken.scss
index de9b3d2d8f7..a4d43e5531c 100644
--- a/packages/dnb-eufemia/src/components/avatar/style/themes/dnb-avatar-theme-sbanken.scss
+++ b/packages/dnb-eufemia/src/components/avatar/style/themes/dnb-avatar-theme-sbanken.scss
@@ -37,5 +37,6 @@
&__group {
--avatar-font-size-left--medium: var(--font-size-basis);
--avatar-font-size-left--large: var(--font-size-medium);
- --avatar-font-size-left--x-large: var(--font-size-medium);}
+ --avatar-font-size-left--x-large: var(--font-size-medium);
+ }
}
diff --git a/packages/dnb-eufemia/src/components/badge/Badge.tsx b/packages/dnb-eufemia/src/components/badge/Badge.tsx
index 7a961ba4b1f..089c687185a 100644
--- a/packages/dnb-eufemia/src/components/badge/Badge.tsx
+++ b/packages/dnb-eufemia/src/components/badge/Badge.tsx
@@ -87,7 +87,7 @@ function Badge(localProps: BadgeAndSpacingProps) {
localProps,
defaultProps,
context?.Badge,
- { skeleton: context?.skeleton }
+ { skeleton: context?.skeleton },
)
const {
@@ -132,12 +132,12 @@ function Badge(localProps: BadgeAndSpacingProps) {
if (variantIsNotification && !contentIsNum) {
warn(
- `Type of content should be a number: A notification badge is best suited to display content of type number.`
+ `Type of content should be a number: A notification badge is best suited to display content of type number.`,
)
}
if (!label && contentIsNum) {
warn(
- `Label required: A Badge with a number as content requires a label describing the content of the badge. This is to ensure correct semantic and accessibility.`
+ `Label required: A Badge with a number as content requires a label describing the content of the badge. This is to ensure correct semantic and accessibility.`,
)
}
@@ -151,7 +151,7 @@ function Badge(localProps: BadgeAndSpacingProps) {
vertical && `dnb-badge--vertical-${vertical}`,
skeletonClasses,
spacingClasses,
- className
+ className,
)}
{...props}
>
diff --git a/packages/dnb-eufemia/src/components/badge/__tests__/Badge.test.tsx b/packages/dnb-eufemia/src/components/badge/__tests__/Badge.test.tsx
index 151889ee6f1..56ee410b6dc 100644
--- a/packages/dnb-eufemia/src/components/badge/__tests__/Badge.test.tsx
+++ b/packages/dnb-eufemia/src/components/badge/__tests__/Badge.test.tsx
@@ -63,7 +63,7 @@ describe('Badge', () => {
A
-
+ ,
)
expect(screen.queryByTestId('confetti icon')).toBeInTheDocument()
@@ -80,7 +80,7 @@ describe('Badge', () => {
process.env.NODE_ENV = 'development'
global.console.log = jest.fn()
render(
-
+ ,
)
expect(global.console.log).not.toBeCalled()
})
@@ -112,12 +112,12 @@ describe('Badge', () => {
top="2rem"
aria-label="Info about the badge"
content="content"
- />
+ />,
)
const element = document.querySelector('.dnb-badge')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['role', 'class', 'aria-label'])
@@ -140,7 +140,7 @@ describe('Badge', () => {
render(
-
+ ,
)
const element = document.querySelector('.dnb-badge')
@@ -158,7 +158,7 @@ describe('Badge', () => {
render( )
expect(
- document.getElementsByClassName('dnb-badge--variant-information')
+ document.getElementsByClassName('dnb-badge--variant-information'),
).toHaveLength(1)
})
})
@@ -179,7 +179,7 @@ describe('Badge scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-badge-theme-ui.scss')
+ require.resolve('../style/themes/dnb-badge-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/breadcrumb/Breadcrumb.tsx b/packages/dnb-eufemia/src/components/breadcrumb/Breadcrumb.tsx
index b28a87db50e..d0b3d696ded 100644
--- a/packages/dnb-eufemia/src/components/breadcrumb/Breadcrumb.tsx
+++ b/packages/dnb-eufemia/src/components/breadcrumb/Breadcrumb.tsx
@@ -148,7 +148,7 @@ const Breadcrumb = (localProps: BreadcrumbProps & SpacingProps) => {
defaultProps,
context?.translation?.Breadcrumb,
context?.Breadcrumb,
- { skeleton: context?.skeleton }
+ { skeleton: context?.skeleton },
)
const {
@@ -203,7 +203,7 @@ const Breadcrumb = (localProps: BreadcrumbProps & SpacingProps) => {
'dnb-breadcrumb',
skeletonClasses,
spacingClasses,
- className
+ className,
)}
{...props}
>
diff --git a/packages/dnb-eufemia/src/components/breadcrumb/BreadcrumbItem.tsx b/packages/dnb-eufemia/src/components/breadcrumb/BreadcrumbItem.tsx
index b109f645d7a..d6aa42ab99f 100644
--- a/packages/dnb-eufemia/src/components/breadcrumb/BreadcrumbItem.tsx
+++ b/packages/dnb-eufemia/src/components/breadcrumb/BreadcrumbItem.tsx
@@ -88,7 +88,7 @@ const BreadcrumbItem = (localProps: BreadcrumbItemProps) => {
} = extendPropsWithContext(
localProps,
defaultProps,
- context?.BreadcrumbItem
+ context?.BreadcrumbItem,
)
const currentIcon: IconIcon =
diff --git a/packages/dnb-eufemia/src/components/breadcrumb/BreadcrumbMultiple.tsx b/packages/dnb-eufemia/src/components/breadcrumb/BreadcrumbMultiple.tsx
index c4c5f6c43d7..7081372e1ed 100644
--- a/packages/dnb-eufemia/src/components/breadcrumb/BreadcrumbMultiple.tsx
+++ b/packages/dnb-eufemia/src/components/breadcrumb/BreadcrumbMultiple.tsx
@@ -47,7 +47,7 @@ export const BreadcrumbMultiple = ({
{React.Children.toArray(items)
.filter((item) => React.isValidElement(item))
.map((item: React.ReactElement, i) =>
- React.cloneElement(item, { key: i, itemNr: i })
+ React.cloneElement(item, { key: i, itemNr: i }),
)}
diff --git a/packages/dnb-eufemia/src/components/breadcrumb/__tests__/Breadcrumb.test.tsx b/packages/dnb-eufemia/src/components/breadcrumb/__tests__/Breadcrumb.test.tsx
index c98762f8785..feae23f1264 100644
--- a/packages/dnb-eufemia/src/components/breadcrumb/__tests__/Breadcrumb.test.tsx
+++ b/packages/dnb-eufemia/src/components/breadcrumb/__tests__/Breadcrumb.test.tsx
@@ -29,7 +29,7 @@ describe('Breadcrumb', () => {
{ href: '/page1', text: 'Page 1' },
{ href: '/page1/page2', text: 'Page 2' },
]}
- />
+ />,
)
expect(screen.queryByText('Home')).toBeInTheDocument()
@@ -41,7 +41,7 @@ describe('Breadcrumb', () => {
it('renders a breadcrumb with a single item by data prop', () => {
render(
-
+ ,
)
expect(screen.queryByText('Page 2')).toBeInTheDocument()
@@ -54,7 +54,7 @@ describe('Breadcrumb', () => {
-
+ ,
)
expect(screen.queryByText('Home')).toBeInTheDocument()
@@ -68,7 +68,7 @@ describe('Breadcrumb', () => {
render(
-
+ ,
)
expect(screen.queryByText('Page item #1')).toBeInTheDocument()
@@ -96,7 +96,7 @@ describe('Breadcrumb', () => {
{null}
{null}
-
+ ,
)
expect(screen.queryByText('Page item #1')).toBeInTheDocument()
@@ -111,7 +111,7 @@ describe('Breadcrumb', () => {
render(
-
+ ,
)
expect(screen.queryAllByRole('link')).toHaveLength(1)
@@ -133,17 +133,17 @@ describe('Breadcrumb', () => {
variant="collapse"
isCollapsed={overrideCollapse}
onClick={jest.fn()}
- />
+ />,
)
expect(
- document.querySelector('.dnb-breadcrumb__animation')
+ document.querySelector('.dnb-breadcrumb__animation'),
).not.toBeInTheDocument()
fireEvent.click(screen.getByRole('button'))
expect(
- document.querySelector('.dnb-breadcrumb__animation')
+ document.querySelector('.dnb-breadcrumb__animation'),
).not.toBeInTheDocument()
})
@@ -155,12 +155,12 @@ describe('Breadcrumb', () => {
{ href: '/page1', text: 'Page 1' },
{ href: '/page1/page2', text: 'Last Item' },
]}
- />
+ />,
)
const lastElem = screen.getByText('Last Item')
expect(
- lastElem.parentElement.parentElement.getAttribute('aria-current')
+ lastElem.parentElement.parentElement.getAttribute('aria-current'),
).toBe('page')
})
@@ -172,13 +172,13 @@ describe('Breadcrumb', () => {
{ href: '/page1', text: 'Current Item', variant: 'current' },
{ href: '/page1/page2', text: 'Page 2' },
]}
- />
+ />,
)
const currentItem = screen.getByText('Current Item')
expect(
- currentItem.parentElement.parentElement.getAttribute('aria-current')
+ currentItem.parentElement.parentElement.getAttribute('aria-current'),
).toBe('page')
})
@@ -192,13 +192,13 @@ describe('Breadcrumb', () => {
{ href: '/page1', text: 'Page 1' },
{ href: '/page1/page2', text: 'Page 2' },
]}
- />
+ />,
)
fireEvent.click(screen.getByRole('button'))
expect(
- document.querySelector('.dnb-breadcrumb__animation')
+ document.querySelector('.dnb-breadcrumb__animation'),
).toBeDefined()
})
@@ -208,7 +208,7 @@ describe('Breadcrumb', () => {
render(
-
+ ,
)
expect(screen.getByRole('button').className).toMatch(skeletonClassName)
@@ -223,12 +223,12 @@ describe('Breadcrumb', () => {
{ href: '/page1/page2', text: 'Page 2' },
]}
top="2rem"
- />
+ />,
)
const element = document.querySelector('.dnb-breadcrumb')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['aria-label', 'class'])
@@ -288,11 +288,11 @@ describe('Breadcrumb', () => {
const skeletonClassName = 'dnb-skeleton'
render(
-
+ ,
)
expect(screen.getByRole('button').className).toMatch(
- skeletonClassName
+ skeletonClassName,
)
})
@@ -302,11 +302,11 @@ describe('Breadcrumb', () => {
render(
-
+ ,
)
expect(screen.getByRole('button').className).toMatch(
- skeletonClassName
+ skeletonClassName,
)
})
@@ -320,7 +320,7 @@ describe('Breadcrumb', () => {
]}
variant="collapse"
isCollapsed={false}
- />
+ />,
)
const items = document.querySelectorAll('.dnb-breadcrumb__item')
@@ -343,7 +343,7 @@ describe('Breadcrumb aria', () => {
]}
variant="collapse"
isCollapsed={false}
- />
+ />,
)
expect(await axeComponent(Component)).toHaveNoViolations()
})
diff --git a/packages/dnb-eufemia/src/components/button/Button.js b/packages/dnb-eufemia/src/components/button/Button.js
index ec4cfadf50d..33539c05b35 100644
--- a/packages/dnb-eufemia/src/components/button/Button.js
+++ b/packages/dnb-eufemia/src/components/button/Button.js
@@ -93,7 +93,7 @@ export default class Button extends React.PureComponent {
Button.defaultProps,
{ skeleton: this.context?.skeleton },
includeValidProps(this.context.FormRow),
- this.context.Button
+ this.context.Button,
)
const {
@@ -141,7 +141,7 @@ export default class Button extends React.PureComponent {
) {
warn(
`Icon required: A Tertiary Button requires an icon to be WCAG compliant in most cases, because variant tertiary has no underline.
-(Override this warning using icon={false}, or consider using one of the other variants)`
+(Override this warning using icon={false}, or consider using one of the other variants)`,
)
}
@@ -200,12 +200,12 @@ export default class Button extends React.PureComponent {
createSkeletonClass(
variant === 'tertiary' ? 'font' : 'shape',
skeleton,
- this.context
+ this.context,
),
createSpacingClasses(props),
class_name,
className,
- props.href || props.to ? '' : null // dnb-anchor--no-underline dnb-anchor--no-hover
+ props.href || props.to ? '' : null, // dnb-anchor--no-underline dnb-anchor--no-hover
)
const params = {
@@ -439,7 +439,7 @@ function Content({
key: 'button-icon-clone',
className: classnames(
icon.props?.className,
- 'dnb-button__icon'
+ 'dnb-button__icon',
),
})
) : (
diff --git a/packages/dnb-eufemia/src/components/button/__tests__/Button.screenshot.test.ts b/packages/dnb-eufemia/src/components/button/__tests__/Button.screenshot.test.ts
index 5662106185a..11313d4d2fa 100644
--- a/packages/dnb-eufemia/src/components/button/__tests__/Button.screenshot.test.ts
+++ b/packages/dnb-eufemia/src/components/button/__tests__/Button.screenshot.test.ts
@@ -279,7 +279,7 @@ describe.each(['ui', 'sbanken', 'eiendom'])(
expect(screenshot).toMatchImageSnapshot()
})
})
- }
+ },
)
describe.each(['sbanken'])('Button for %s', (themeName) => {
diff --git a/packages/dnb-eufemia/src/components/button/__tests__/Button.test.tsx b/packages/dnb-eufemia/src/components/button/__tests__/Button.test.tsx
index 2447bd4e470..3404b1e2cc2 100644
--- a/packages/dnb-eufemia/src/components/button/__tests__/Button.test.tsx
+++ b/packages/dnb-eufemia/src/components/button/__tests__/Button.test.tsx
@@ -66,7 +66,7 @@ describe('Button component', () => {
it('has to have a bounding tag if property is set', () => {
render()
expect(
- document.querySelector('.dnb-button__bounding')
+ document.querySelector('.dnb-button__bounding'),
).toBeInTheDocument()
})
@@ -78,7 +78,7 @@ describe('Button component', () => {
it('has a anchor tag and includes a launch icon', () => {
render(
-
+ ,
)
expect(document.querySelector('svg')).toBeInTheDocument()
})
@@ -91,7 +91,7 @@ describe('Button component', () => {
it('has a disabled attribute, once we set disabled to true', () => {
const { rerender } = render()
expect(document.querySelector('button')).not.toHaveAttribute(
- 'disabled'
+ 'disabled',
)
rerender()
@@ -108,7 +108,7 @@ describe('Button component', () => {
render()
expect(document.querySelector('.dnb-button').tagName).toBe('SPAN')
expect(
- document.querySelector('.dnb-button').getAttribute('type')
+ document.querySelector('.dnb-button').getAttribute('type'),
).toBe('button')
})
@@ -128,12 +128,12 @@ describe('Button component', () => {
render(
-
+ ,
)
const element = document.querySelector('.dnb-button')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual([
@@ -180,10 +180,10 @@ describe('Button component', () => {
expect(
document
.querySelector('.dnb-button__alignment')
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('true')
expect(document.querySelector('.dnb-button__text').textContent).toBe(
- text
+ text,
)
rerender()
@@ -191,10 +191,10 @@ describe('Button component', () => {
expect(
document
.querySelector('.dnb-button__alignment')
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('true')
expect(
- document.querySelector('.dnb-button__text')
+ document.querySelector('.dnb-button__text'),
).not.toBeInTheDocument()
})
@@ -240,7 +240,7 @@ describe('Button component', () => {
it('will replace icon with icon component', () => {
const { rerender } = render(
- } />
+ } />,
)
expect(document.querySelector('.custom-icon')).toBeInTheDocument()
@@ -249,19 +249,19 @@ describe('Button component', () => {
icon={
}
- />
+ />,
)
expect(document.querySelector('.custom-icon')).not.toBeInTheDocument()
expect(
- document.querySelector('.custom-icon-component')
+ document.querySelector('.custom-icon-component'),
).toBeInTheDocument()
})
it('will only have attached event listener if one is given', () => {
const on_click = jest.fn()
const { rerender } = render(
-
+ ,
)
type Button = HTMLButtonElement & { onClickHandler: ButtonOnClick }
@@ -295,10 +295,10 @@ describe('Button component', () => {
it('has no size when only setting text', () => {
render()
expect(
- document.querySelector('.dnb-button--size-medium')
+ document.querySelector('.dnb-button--size-medium'),
).not.toBeInTheDocument()
expect(
- document.querySelector('.dnb-button--size-large')
+ document.querySelector('.dnb-button--size-large'),
).not.toBeInTheDocument()
})
})
@@ -314,10 +314,10 @@ describe('Button scss', () => {
(themeName) => {
const css = loadScss(
require.resolve(
- `../style/themes/dnb-button-theme-${themeName}.scss`
- )
+ `../style/themes/dnb-button-theme-${themeName}.scss`,
+ ),
)
expect(css).toMatchSnapshot()
- }
+ },
)
})
diff --git a/packages/dnb-eufemia/src/components/button/style/themes/dnb-button-theme-ui.scss b/packages/dnb-eufemia/src/components/button/style/themes/dnb-button-theme-ui.scss
index e16e5a7de77..4e5c415f67f 100644
--- a/packages/dnb-eufemia/src/components/button/style/themes/dnb-button-theme-ui.scss
+++ b/packages/dnb-eufemia/src/components/button/style/themes/dnb-button-theme-ui.scss
@@ -77,7 +77,9 @@
var(--color-mint-green-50)
);
}
- &--secondary:not(#{&}--has-text):not(#{&}--input-button)#{&}--size-large {
+ &--secondary:not(#{&}--has-text):not(
+ #{&}--input-button
+ )#{&}--size-large {
// Make exception for icon button as it should be smaller than the original large button
width: calc(var(--button-width--large) - 0.5rem);
line-height: calc(var(--button-height--large) - 0.5rem);
diff --git a/packages/dnb-eufemia/src/components/checkbox/Checkbox.js b/packages/dnb-eufemia/src/components/checkbox/Checkbox.js
index ace91250f6b..f06010a243f 100644
--- a/packages/dnb-eufemia/src/components/checkbox/Checkbox.js
+++ b/packages/dnb-eufemia/src/components/checkbox/Checkbox.js
@@ -180,7 +180,7 @@ export default class Checkbox extends React.PureComponent {
{ skeleton: this.context && this.context.skeleton },
this.context.getTranslation(this.props).Checkbox,
includeValidProps(this.context.FormRow),
- this.context.Checkbox
+ this.context.Checkbox,
)
const {
@@ -229,7 +229,7 @@ export default class Checkbox extends React.PureComponent {
createSkeletonClass(null, skeleton),
createSpacingClasses(props),
className,
- _className
+ _className,
),
}
@@ -243,7 +243,7 @@ export default class Checkbox extends React.PureComponent {
inputParams['aria-describedby'] = combineDescribedBy(
inputParams,
showStatus ? id + '-status' : null,
- suffix ? id + '-suffix' : null
+ suffix ? id + '-suffix' : null,
)
}
if (readOnly) {
@@ -309,7 +309,7 @@ export default class Checkbox extends React.PureComponent {
diff --git a/packages/dnb-eufemia/src/components/checkbox/__tests__/Checkbox.test.tsx b/packages/dnb-eufemia/src/components/checkbox/__tests__/Checkbox.test.tsx
index 5476a6d3805..665ee1f6de8 100644
--- a/packages/dnb-eufemia/src/components/checkbox/__tests__/Checkbox.test.tsx
+++ b/packages/dnb-eufemia/src/components/checkbox/__tests__/Checkbox.test.tsx
@@ -19,29 +19,29 @@ describe('Checkbox component', () => {
// default checked value has to be false
expect(
- (screen.getByRole('checkbox') as HTMLInputElement).checked
+ (screen.getByRole('checkbox') as HTMLInputElement).checked,
).toBe(false)
screen.getByRole('checkbox').click()
expect(
- (screen.getByRole('checkbox') as HTMLInputElement).checked
+ (screen.getByRole('checkbox') as HTMLInputElement).checked,
).toBe(true)
screen.getByRole('checkbox').click()
expect(
- (screen.getByRole('checkbox') as HTMLInputElement).checked
+ (screen.getByRole('checkbox') as HTMLInputElement).checked,
).toBe(false)
// also check if getDerivedStateFromProps sets the state as expected
rerender( )
expect(
- (screen.getByRole('checkbox') as HTMLInputElement).checked
+ (screen.getByRole('checkbox') as HTMLInputElement).checked,
).toBe(true)
const value = 'new value'
rerender( )
expect((screen.getByRole('checkbox') as HTMLInputElement).value).toBe(
- value
+ value,
)
})
@@ -49,7 +49,7 @@ describe('Checkbox component', () => {
const my_event = jest.fn()
const myEvent = jest.fn()
render(
-
+ ,
)
screen.getByRole('checkbox').click()
expect(my_event.mock.calls.length).toBe(1)
@@ -117,7 +117,7 @@ describe('Checkbox component', () => {
TestStates(
-
+ ,
)
})
@@ -125,7 +125,7 @@ describe('Checkbox component', () => {
render( )
expect(
- (screen.getByRole('checkbox') as HTMLInputElement).disabled
+ (screen.getByRole('checkbox') as HTMLInputElement).disabled,
).toBe(true)
})
@@ -145,16 +145,16 @@ describe('Checkbox component', () => {
render(
-
+ ,
)
const element = document.querySelector('.dnb-checkbox')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
const inputElement = document.querySelector('.dnb-checkbox input')
const inputAttributes = Array.from(inputElement.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -204,7 +204,7 @@ describe('Checkbox scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-checkbox-theme-ui.scss')
+ require.resolve('../style/themes/dnb-checkbox-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/checkbox/style/themes/dnb-checkbox-theme-ui.scss b/packages/dnb-eufemia/src/components/checkbox/style/themes/dnb-checkbox-theme-ui.scss
index f084d4fd1e8..4ab8f77ffad 100644
--- a/packages/dnb-eufemia/src/components/checkbox/style/themes/dnb-checkbox-theme-ui.scss
+++ b/packages/dnb-eufemia/src/components/checkbox/style/themes/dnb-checkbox-theme-ui.scss
@@ -7,7 +7,9 @@
.dnb-checkbox {
&__gfx {
- transition: opacity 200ms ease-out, transform 200ms ease-out;
+ transition:
+ opacity 200ms ease-out,
+ transform 200ms ease-out;
}
// When checkbox is ON
diff --git a/packages/dnb-eufemia/src/components/date-picker/DatePicker.js b/packages/dnb-eufemia/src/components/date-picker/DatePicker.js
index 526f03b38ba..59f08a60d19 100644
--- a/packages/dnb-eufemia/src/components/date-picker/DatePicker.js
+++ b/packages/dnb-eufemia/src/components/date-picker/DatePicker.js
@@ -277,7 +277,7 @@ export default class DatePicker extends React.PureComponent {
if (props.end_date && !isTrue(props.range)) {
warn(
- `The DatePicker got a "end_date". You have to set range={true} as well!.`
+ `The DatePicker got a "end_date". You have to set range={true} as well!.`,
)
}
@@ -350,7 +350,7 @@ export default class DatePicker extends React.PureComponent {
dispatchCustomElementEvent(
this,
'on_submit',
- this.getReturnObject(args)
+ this.getReturnObject(args),
)
}
@@ -359,7 +359,7 @@ export default class DatePicker extends React.PureComponent {
dispatchCustomElementEvent(
this,
'on_cancel',
- this.getReturnObject(args)
+ this.getReturnObject(args),
)
}
@@ -368,7 +368,7 @@ export default class DatePicker extends React.PureComponent {
dispatchCustomElementEvent(
this,
'on_reset',
- this.getReturnObject(args)
+ this.getReturnObject(args),
)
}
@@ -409,9 +409,9 @@ export default class DatePicker extends React.PureComponent {
dispatchCustomElementEvent(
this,
'on_hide',
- this.getReturnObject(args)
+ this.getReturnObject(args),
)
- }
+ },
)
this._hideTimeout = setTimeout(
@@ -431,10 +431,10 @@ export default class DatePicker extends React.PureComponent {
warn(e)
}
}
- }
+ },
)
},
- isTrue(this.props.no_animation) ? 1 : DatePicker.blurDelay
+ isTrue(this.props.no_animation) ? 1 : DatePicker.blurDelay,
) // wait until animation is over
this.removeOutsideClickHandler()
@@ -450,7 +450,7 @@ export default class DatePicker extends React.PureComponent {
const { range } = this.props
const { startDate, endDate } = this.state
const { selected_date, start, end } = this.context.getTranslation(
- this.props
+ this.props,
).DatePicker
let currentDate = startDate ? format(startDate, 'PPPP') : null
@@ -458,7 +458,7 @@ export default class DatePicker extends React.PureComponent {
if (isTrue(range) && startDate && endDate) {
currentDate = `${start} ${currentDate} - ${end} ${format(
endDate,
- 'PPPP'
+ 'PPPP',
)}`
}
@@ -473,7 +473,7 @@ export default class DatePicker extends React.PureComponent {
{ skeleton: this.context?.skeleton },
this.context.getTranslation(this.props).DatePicker,
includeValidProps(this.context.FormRow),
- this.context.DatePicker
+ this.context.DatePicker,
)
if (props.locale !== enLocale && /en-/.test(this.context.locale)) {
@@ -558,7 +558,7 @@ export default class DatePicker extends React.PureComponent {
pickerParams['aria-describedby'] = combineDescribedBy(
pickerParams,
showStatus ? id + '-status' : null,
- suffix ? id + '-suffix' : null
+ suffix ? id + '-suffix' : null,
)
}
@@ -587,7 +587,7 @@ export default class DatePicker extends React.PureComponent {
size && `dnb-date-picker--${size}`,
createSpacingClasses(props),
_className,
- className
+ className,
),
}
diff --git a/packages/dnb-eufemia/src/components/date-picker/DatePickerCalc.js b/packages/dnb-eufemia/src/components/date-picker/DatePickerCalc.js
index a1cc2b84590..5717f91260e 100644
--- a/packages/dnb-eufemia/src/components/date-picker/DatePickerCalc.js
+++ b/packages/dnb-eufemia/src/components/date-picker/DatePickerCalc.js
@@ -27,7 +27,7 @@ import { warn } from '../../shared/component-helper'
// Is used as DatePickerCalc
export const makeDayObject = (
date,
- { startDate, endDate, hoverDate, minDate, maxDate, month }
+ { startDate, endDate, hoverDate, minDate, maxDate, month },
) => {
const range = getRange(startDate, endDate, hoverDate)
const isLastMonth = isSameMonth(subMonths(date, 1), month)
@@ -57,7 +57,7 @@ export const makeDayObject = (
export const getCalendar = (
month,
weekStartsOn = 0,
- { onlyMonth = false, hideNextMonthWeek = false } = {}
+ { onlyMonth = false, hideNextMonthWeek = false } = {},
) => {
// Get the main month
const thisMonth = getMonth(month)
@@ -74,7 +74,7 @@ export const getCalendar = (
const firstDay = (7 + getDay(startOfMonth(month)) - weekStartsOn) % 7
const lastMonth = getMonth(
subMonths(month, 1),
- getDaysInMonth(subMonths(month, 1)) - firstDay
+ getDaysInMonth(subMonths(month, 1)) - firstDay,
)
let fillCount = -1
if (hideNextMonthWeek) {
@@ -87,7 +87,7 @@ export const getCalendar = (
const nextMonth = getMonth(
addMonths(month, 1),
0,
- fillCount > -1 ? fillCount : 0
+ fillCount > -1 ? fillCount : 0,
)
return (calendarCache[month] = [
...lastMonth,
@@ -210,7 +210,7 @@ export const correctV1Format = (date) => {
// TODO: Remove this in next major version
if (/YYYY/.test(date) && /DD/.test(date)) {
warn(
- 'You are using "YYYY-MM-DD" as the date_format or return_format? Please use "yyyy-MM-dd" instead!'
+ 'You are using "YYYY-MM-DD" as the date_format or return_format? Please use "yyyy-MM-dd" instead!',
)
date = date.replace(/DD/, 'dd').replace(/YYYY/, 'yyyy')
}
diff --git a/packages/dnb-eufemia/src/components/date-picker/DatePickerCalendar.js b/packages/dnb-eufemia/src/components/date-picker/DatePickerCalendar.js
index e1c99ba779b..f8dbfb03dfd 100644
--- a/packages/dnb-eufemia/src/components/date-picker/DatePickerCalendar.js
+++ b/packages/dnb-eufemia/src/components/date-picker/DatePickerCalendar.js
@@ -295,7 +295,7 @@ export default class DatePickerCalendar extends React.PureComponent {
if (Array.isArray(this._days[month])) {
const foundDate = this._days[month].find((cur) =>
- isSameDay(cur.date, date)
+ isSameDay(cur.date, date),
)
if (
@@ -333,7 +333,7 @@ export default class DatePickerCalendar extends React.PureComponent {
'dnb-date-picker__day--disabled': day.isDisabled,
'dnb-date-picker__day--today': day.isToday,
},
- day.className
+ day.className,
)
getCacheKey() {
@@ -375,7 +375,7 @@ export default class DatePickerCalendar extends React.PureComponent {
count++
}
return acc
- }, {})
+ }, {}),
))
}
}
@@ -392,7 +392,7 @@ export default class DatePickerCalendar extends React.PureComponent {
{
onlyMonth,
hideNextMonthWeek,
- }
+ },
).map((date) =>
makeDayObject(date, {
startDate,
@@ -401,7 +401,7 @@ export default class DatePickerCalendar extends React.PureComponent {
minDate,
maxDate,
month,
- })
+ }),
)
if (this.context.props.on_days_render) {
@@ -476,7 +476,7 @@ export default class DatePickerCalendar extends React.PureComponent {
/%s/,
format(month, titleFormat, {
locale,
- })
+ }),
)}
tabIndex="-1"
ref={this._labelRef}
@@ -519,7 +519,7 @@ export default class DatePickerCalendar extends React.PureComponent {
'dnb-date-picker__labels__day',
`dnb-date-picker__labels__day--${format(day, 'i', {
locale,
- })}`
+ })}`,
)}
aria-label={format(day, 'EEEE', {
locale,
@@ -574,7 +574,7 @@ export default class DatePickerCalendar extends React.PureComponent {
className={classnames(
'dnb-date-picker__day',
'dnb-no-focus',
- this.buildClassNames(day)
+ this.buildClassNames(day),
)}
onFocus={this.onKeyDownHandler}
{...paramsCell}
@@ -606,7 +606,7 @@ export default class DatePickerCalendar extends React.PureComponent {
event,
nr,
hidePicker: !isRange,
- })
+ }),
),
})
}
@@ -661,7 +661,7 @@ const PrevButton = ({
/%s/,
format(subMonths(month, 1), 'MMMM yyyy', {
locale,
- })
+ }),
)
return (
@@ -715,7 +715,7 @@ const NextButton = ({
/%s/,
format(addMonths(month, 1), 'MMMM yyyy', {
locale,
- })
+ }),
)
return (
@@ -777,10 +777,10 @@ const onSelectRange = ({
const hasEndDate = endDate
// set either startDate or endDate
const daysToStartDate = Math.abs(
- differenceInCalendarDays(startDate, day.date)
+ differenceInCalendarDays(startDate, day.date),
)
const daysToEndDate = Math.abs(
- differenceInCalendarDays(endDate, day.date)
+ differenceInCalendarDays(endDate, day.date),
)
let range = toRange(startDate, day.date)
diff --git a/packages/dnb-eufemia/src/components/date-picker/DatePickerFooter.js b/packages/dnb-eufemia/src/components/date-picker/DatePickerFooter.js
index 58f9048b15a..6a137d1624c 100644
--- a/packages/dnb-eufemia/src/components/date-picker/DatePickerFooter.js
+++ b/packages/dnb-eufemia/src/components/date-picker/DatePickerFooter.js
@@ -69,7 +69,7 @@ export default class DatePickerFooter extends React.PureComponent {
if (onCancel) {
onCancel(args)
}
- }
+ },
)
}
@@ -89,7 +89,7 @@ export default class DatePickerFooter extends React.PureComponent {
if (onReset) {
onReset(args)
}
- }
+ },
)
}
diff --git a/packages/dnb-eufemia/src/components/date-picker/DatePickerInput.js b/packages/dnb-eufemia/src/components/date-picker/DatePickerInput.js
index 929864cc6fa..f18390eb684 100644
--- a/packages/dnb-eufemia/src/components/date-picker/DatePickerInput.js
+++ b/packages/dnb-eufemia/src/components/date-picker/DatePickerInput.js
@@ -177,7 +177,7 @@ export default class DatePickerInput extends React.PureComponent {
}
this.context.callOnChangeHandler({ startDate, endDate, event })
}
- }
+ },
)
}
@@ -364,7 +364,7 @@ export default class DatePickerInput extends React.PureComponent {
const secondSelectionStart = target.selectionStart
const isValid = /[0-9]/.test(keyCode)
const index = this.refList.findIndex(
- ({ current }) => current === target
+ ({ current }) => current === target,
)
if (
@@ -455,7 +455,7 @@ export default class DatePickerInput extends React.PureComponent {
const date = new Date(
parseFloat(year),
parseFloat(month) - 1,
- parseFloat(day)
+ parseFloat(day),
)
const isValidDate =
@@ -559,7 +559,7 @@ export default class DatePickerInput extends React.PureComponent {
params.className,
'dnb-date-picker__input',
'dnb-date-picker__input--day',
- inputSizeClassName
+ inputSizeClassName,
)}
size="2"
mask={[/[0-3]/, /[0-9]/]}
@@ -590,7 +590,7 @@ export default class DatePickerInput extends React.PureComponent {
params.className,
'dnb-date-picker__input',
'dnb-date-picker__input--month',
- inputSizeClassName
+ inputSizeClassName,
)}
size="2"
mask={[/[0-1]/, /[0-9]/]}
@@ -621,7 +621,7 @@ export default class DatePickerInput extends React.PureComponent {
params.className,
'dnb-date-picker__input',
'dnb-date-picker__input--year',
- inputSizeClassName
+ inputSizeClassName,
)}
size="4"
mask={[/[1-2]/, /[0-9]/, /[0-9]/, /[0-9]/]}
@@ -733,7 +733,7 @@ export default class DatePickerInput extends React.PureComponent {
skeleton={skeleton}
className={classnames(
showInput && 'dnb-button--input-button',
- opened ? 'dnb-button--active' : null
+ opened ? 'dnb-button--active' : null,
)}
aria-label={this.formatDate()}
title={title}
diff --git a/packages/dnb-eufemia/src/components/date-picker/DatePickerProvider.js b/packages/dnb-eufemia/src/components/date-picker/DatePickerProvider.js
index 634785ec4eb..205b033f3ef 100644
--- a/packages/dnb-eufemia/src/components/date-picker/DatePickerProvider.js
+++ b/packages/dnb-eufemia/src/components/date-picker/DatePickerProvider.js
@@ -258,7 +258,7 @@ export default class DatePickerProvider extends React.PureComponent {
dispatchCustomElementEvent(
this,
'on_change',
- this.getReturnObject(args)
+ this.getReturnObject(args),
)
const lastEventCallCache = {
diff --git a/packages/dnb-eufemia/src/components/date-picker/DatePickerRange.js b/packages/dnb-eufemia/src/components/date-picker/DatePickerRange.js
index 7a04499ff4a..cdd57067a1a 100644
--- a/packages/dnb-eufemia/src/components/date-picker/DatePickerRange.js
+++ b/packages/dnb-eufemia/src/components/date-picker/DatePickerRange.js
@@ -146,7 +146,7 @@ export const getViews = (state, isRange) => {
: Array(
isRange
? 2 // set default range calendars
- : state.views
+ : state.views,
).fill(1)
).map((view, nr) => ({
...view,
diff --git a/packages/dnb-eufemia/src/components/date-picker/__tests__/DatePicker.test.tsx b/packages/dnb-eufemia/src/components/date-picker/__tests__/DatePicker.test.tsx
index 758cc33a7a0..e0e533ec47f 100644
--- a/packages/dnb-eufemia/src/components/date-picker/__tests__/DatePicker.test.tsx
+++ b/packages/dnb-eufemia/src/components/date-picker/__tests__/DatePicker.test.tsx
@@ -50,10 +50,10 @@ describe('DatePicker component', () => {
const { rerender } = render( )
rerender( )
expect(document.querySelectorAll('input')[0]).toHaveAttribute(
- 'disabled'
+ 'disabled',
)
expect(
- document.querySelector('button.dnb-input__submit-button__button')
+ document.querySelector('button.dnb-input__submit-button__button'),
).toHaveAttribute('disabled')
})
@@ -61,44 +61,44 @@ describe('DatePicker component', () => {
render( )
fireEvent.click(
- document.querySelector('button.dnb-input__submit-button__button')
+ document.querySelector('button.dnb-input__submit-button__button'),
)
expect(
document
.querySelector('button.dnb-input__submit-button__button')
- .getAttribute('aria-expanded')
+ .getAttribute('aria-expanded'),
).toBe('true')
expect(
document
.querySelector('.dnb-date-picker')
- .getAttribute('class')
+ .getAttribute('class'),
).toContain('dnb-date-picker--opened')
expect(
- document.querySelector('.dnb-date-picker').classList
+ document.querySelector('.dnb-date-picker').classList,
).not.toContain('dnb-date-picker--closed')
})
it('will close the picker after selection', () => {
const on_change = jest.fn()
const { rerender } = render(
-
+ ,
)
fireEvent.click(
- document.querySelector('button.dnb-input__submit-button__button')
+ document.querySelector('button.dnb-input__submit-button__button'),
)
expect(
- document.querySelector('.dnb-date-picker').getAttribute('class')
+ document.querySelector('.dnb-date-picker').getAttribute('class'),
).toContain('dnb-date-picker--opened')
const startTd = document.querySelectorAll(
- 'td.dnb-date-picker__day'
+ 'td.dnb-date-picker__day',
)[10]
const startButton = startTd.querySelector('button')
const startLabel = startButton.getAttribute('aria-label')
@@ -123,17 +123,17 @@ describe('DatePicker component', () => {
expect(on_change.mock.calls[1][0].end_date).toBe('2019-02-15')
expect(
- document.querySelector('.dnb-date-picker').classList
+ document.querySelector('.dnb-date-picker').classList,
).not.toContain('dnb-date-picker--closed')
rerender(
-
+ ,
)
expect(on_change).toHaveBeenCalledTimes(2)
const singleTd = document.querySelectorAll(
- 'td.dnb-date-picker__day'
+ 'td.dnb-date-picker__day',
)[11]
const singleButton = singleTd.querySelector('button')
const singleLabel = singleButton.getAttribute('aria-label')
@@ -148,7 +148,7 @@ describe('DatePicker component', () => {
expect(on_change.mock.calls[2][0].end_date).toBe(undefined)
expect(
- document.querySelector('.dnb-date-picker').getAttribute('class')
+ document.querySelector('.dnb-date-picker').getAttribute('class'),
).not.toContain('dnb-date-picker--opened')
})
@@ -161,19 +161,19 @@ describe('DatePicker component', () => {
show_reset_button
show_input
on_reset={on_reset}
- />
+ />,
)
fireEvent.click(
- document.querySelector('button.dnb-input__submit-button__button')
+ document.querySelector('button.dnb-input__submit-button__button'),
)
expect(
- document.querySelector('.dnb-date-picker').getAttribute('class')
+ document.querySelector('.dnb-date-picker').getAttribute('class'),
).toContain('dnb-date-picker--opened')
const resetButton = document.querySelector(
- 'button[data-testid="reset"]'
+ 'button[data-testid="reset"]',
)
fireEvent.click(resetButton)
@@ -182,7 +182,7 @@ describe('DatePicker component', () => {
expect(on_reset.mock.calls[0][0].date).toBe(null)
expect(
- document.querySelector('.dnb-date-picker').getAttribute('class')
+ document.querySelector('.dnb-date-picker').getAttribute('class'),
).not.toContain('dnb-date-picker--opened')
})
@@ -204,15 +204,15 @@ describe('DatePicker component', () => {
on_days_render={on_days_render}
range={false}
end_date={null}
- />
+ />,
)
fireEvent.click(
- document.querySelector('button.dnb-input__submit-button__button')
+ document.querySelector('button.dnb-input__submit-button__button'),
)
expect(
- document.querySelector('.dnb-date-picker').getAttribute('class')
+ document.querySelector('.dnb-date-picker').getAttribute('class'),
).toContain('dnb-date-picker--opened')
expect(on_days_render).toHaveBeenCalledTimes(1)
@@ -220,7 +220,7 @@ describe('DatePicker component', () => {
expect((on_days_render.mock as any).calls[0][1]).toBe(0)
const singleTd = document.querySelectorAll(
- 'td.dnb-date-picker__day'
+ 'td.dnb-date-picker__day',
)[12]
const singleButton = singleTd.querySelector('button')
const singleLabel = singleButton.getAttribute('aria-label')
@@ -240,7 +240,7 @@ describe('DatePicker component', () => {
{ title: 'Set date', date: '2020-05-23' },
{ title: 'Set date', close_on_select: true, date: '2020-04-23' },
]}
- />
+ />,
)
fireEvent.click(document.querySelector('button.dnb-button'))
@@ -248,15 +248,15 @@ describe('DatePicker component', () => {
fireEvent.click(
document
.querySelector('div.dnb-date-picker__addon')
- .querySelectorAll('.dnb-button--secondary')[0]
+ .querySelectorAll('.dnb-button--secondary')[0],
)
expect(
document.querySelector('label.dnb-date-picker__header__title')
- .textContent
+ .textContent,
).toBe('mai 2020')
expect(
- document.querySelector('.dnb-date-picker--opened')
+ document.querySelector('.dnb-date-picker--opened'),
).toBeInTheDocument()
expect(on_change).toBeCalledTimes(1)
@@ -264,15 +264,15 @@ describe('DatePicker component', () => {
fireEvent.click(
document
.querySelector('div.dnb-date-picker__addon')
- .querySelectorAll('.dnb-button--secondary')[1]
+ .querySelectorAll('.dnb-button--secondary')[1],
)
expect(
document.querySelector('label.dnb-date-picker__header__title')
- .textContent
+ .textContent,
).toBe('april 2020')
expect(
- document.querySelector('.dnb-date-picker--opened')
+ document.querySelector('.dnb-date-picker--opened'),
).not.toBeInTheDocument()
expect(on_change).toBeCalledTimes(2)
})
@@ -281,20 +281,20 @@ describe('DatePicker component', () => {
render( )
fireEvent.click(
- document.querySelector('button.dnb-input__submit-button__button')
+ document.querySelector('button.dnb-input__submit-button__button'),
)
expect(
- document.querySelector('.dnb-date-picker__views')
+ document.querySelector('.dnb-date-picker__views'),
).toBeInTheDocument()
expect(
- document.querySelectorAll('.dnb-date-picker__calendar').length
+ document.querySelectorAll('.dnb-date-picker__calendar').length,
).toBe(2)
})
it('has a reacting start date input with valid value', () => {
const { rerender } = render( )
const elem = document.querySelectorAll(
- 'input.dnb-date-picker__input--day'
+ 'input.dnb-date-picker__input--day',
)[0] as HTMLInputElement
// by default we have the start day
@@ -308,7 +308,7 @@ describe('DatePicker component', () => {
on_change={({ start_date }) => {
changedStartDate = start_date
}}
- />
+ />,
)
// change the date
@@ -331,7 +331,7 @@ describe('DatePicker component', () => {
changedStartDate = start_date
}}
start_date="2019-01-03"
- />
+ />,
)
expect(elem.value).toBe('03')
@@ -347,28 +347,28 @@ describe('DatePicker component', () => {
changedStartDate = start_date
}}
start_date={defaultProps.start_date}
- />
+ />,
)
})
it('has to reset second input fields to blank during new date selection', () => {
render( )
fireEvent.click(
- document.querySelector('button.dnb-input__submit-button__button')
+ document.querySelector('button.dnb-input__submit-button__button'),
)
fireEvent.click(
document.querySelectorAll(
- 'table tbody button.dnb-button--secondary'
- )[10]
+ 'table tbody button.dnb-button--secondary',
+ )[10],
)
expect(
(
document.querySelectorAll(
- 'input.dnb-date-picker__input--year'
+ 'input.dnb-date-picker__input--year',
)[1] as HTMLInputElement
- ).value
+ ).value,
).toBe('Ć„Ć„Ć„Ć„')
})
@@ -390,7 +390,7 @@ describe('DatePicker component', () => {
on_submit={on_submit}
on_cancel={on_cancel}
on_reset={on_reset}
- />
+ />,
)
const resetElem = document.querySelector('button[data-testid="reset"]')
@@ -398,13 +398,13 @@ describe('DatePicker component', () => {
expect(resetElem.textContent).toMatch('Tilbakestill')
const cancelElem = document.querySelector(
- 'button[data-testid="cancel"]'
+ 'button[data-testid="cancel"]',
)
expect(cancelElem).toBeInTheDocument()
expect(cancelElem.textContent).toMatch('Avbryt')
const submitElem = document.querySelector(
- 'button[data-testid="submit"]'
+ 'button[data-testid="submit"]',
)
expect(submitElem).toBeInTheDocument()
expect(submitElem.textContent).toMatch('Ok')
@@ -412,9 +412,9 @@ describe('DatePicker component', () => {
expect(
(
document.querySelector(
- 'input.dnb-date-picker__input--year'
+ 'input.dnb-date-picker__input--year',
) as HTMLInputElement
- ).value
+ ).value,
).toBe('2020')
fireEvent.click(resetElem)
@@ -425,9 +425,9 @@ describe('DatePicker component', () => {
expect(
(
document.querySelector(
- 'input.dnb-date-picker__input--year'
+ 'input.dnb-date-picker__input--year',
) as HTMLInputElement
- ).value
+ ).value,
).toBe('Ć„Ć„Ć„Ć„')
fireEvent.click(cancelElem)
@@ -435,9 +435,9 @@ describe('DatePicker component', () => {
expect(
(
document.querySelector(
- 'input.dnb-date-picker__input--year'
+ 'input.dnb-date-picker__input--year',
) as HTMLInputElement
- ).value
+ ).value,
).toBe('2020')
expect(on_cancel).toHaveBeenCalled()
@@ -446,16 +446,16 @@ describe('DatePicker component', () => {
fireEvent.click(
document
.querySelector('span.dnb-input__submit-element')
- .querySelector('button.dnb-button')
+ .querySelector('button.dnb-button'),
)
fireEvent.click(submitElem)
expect(
(
document.querySelector(
- 'input.dnb-date-picker__input--year'
+ 'input.dnb-date-picker__input--year',
) as HTMLInputElement
- ).value
+ ).value,
).toBe('2020')
expect(on_submit).toHaveBeenCalled()
@@ -471,7 +471,7 @@ describe('DatePicker component', () => {
no_animation
show_reset_button
reset_button_text={reset_button_text}
- />
+ />,
)
const resetElem = document.querySelector('button[data-testid="reset"]')
@@ -483,7 +483,7 @@ describe('DatePicker component', () => {
render( )
const datePickerFooter = document.querySelector(
- '.dnb-date-picker__footer'
+ '.dnb-date-picker__footer',
)
expect(datePickerFooter).toBeInTheDocument()
})
@@ -492,7 +492,7 @@ describe('DatePicker component', () => {
render( )
const datePickerFooter = document.querySelector(
- '.dnb-date-picker__footer'
+ '.dnb-date-picker__footer',
)
expect(datePickerFooter).toBeInTheDocument()
})
@@ -501,7 +501,7 @@ describe('DatePicker component', () => {
render( )
const datePickerFooter = document.querySelector(
- '.dnb-date-picker__footer'
+ '.dnb-date-picker__footer',
)
expect(datePickerFooter).toBeInTheDocument()
})
@@ -510,7 +510,7 @@ describe('DatePicker component', () => {
render( )
const datePickerFooter = document.querySelector(
- '.dnb-date-picker__footer'
+ '.dnb-date-picker__footer',
)
expect(datePickerFooter).toBeInTheDocument()
})
@@ -524,11 +524,11 @@ describe('DatePicker component', () => {
show_cancel_button={false}
show_submit_button={false}
range={false}
- />
+ />,
)
const datePickerFooter = document.querySelector(
- '.dnb-date-picker__footer'
+ '.dnb-date-picker__footer',
)
expect(datePickerFooter).not.toBeInTheDocument()
})
@@ -537,13 +537,13 @@ describe('DatePicker component', () => {
render( )
const dayElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--day'
+ 'input.dnb-date-picker__input--day',
)[0]
const monthElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--month'
+ 'input.dnb-date-picker__input--month',
)[0]
const yearElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--year'
+ 'input.dnb-date-picker__input--year',
)[0]
// change the date
@@ -577,10 +577,10 @@ describe('DatePicker component', () => {
correct_invalid_date={true}
min_date="2019-01-02"
max_date="2019-03-01"
- />
+ />,
)
const elem = document.querySelectorAll(
- 'input.dnb-date-picker__input--day'
+ 'input.dnb-date-picker__input--day',
)[0]
// by default we have the corrected start day
@@ -615,13 +615,13 @@ describe('DatePicker component', () => {
start_date="2019-01-02T00:00:00.000Z"
on_change={on_change}
on_type={on_type}
- />
+ />,
)
const startElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--day'
+ 'input.dnb-date-picker__input--day',
)[0]
const endElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--day'
+ 'input.dnb-date-picker__input--day',
)[1]
// by default we have the start day
@@ -663,15 +663,15 @@ describe('DatePicker component', () => {
fireEvent.click(document.querySelector('button'))
const invalidDayElem = document.querySelectorAll(
- '.dnb-date-picker__day button'
+ '.dnb-date-picker__day button',
)[1]
expect(invalidDayElem.getAttribute('aria-label')).toBe(
- 'tirsdag 1. januar 2019'
+ 'tirsdag 1. januar 2019',
)
expect(invalidDayElem).toBeInTheDocument()
expect(invalidDayElem).toHaveAttribute('disabled')
expect(
- document.querySelectorAll('.dnb-date-picker__day button')[2]
+ document.querySelectorAll('.dnb-date-picker__day button')[2],
).not.toHaveAttribute('disabled')
expect(on_change.mock.calls[2][0].date).toBe(undefined)
@@ -686,7 +686,7 @@ describe('DatePicker component', () => {
on_change={on_change}
on_type={on_type}
range={false}
- />
+ />,
)
// change the date to a valid date
@@ -718,27 +718,27 @@ describe('DatePicker component', () => {
show_input={true}
on_type={on_type}
on_change={on_change}
- />
+ />,
)
const startDayElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--day'
+ 'input.dnb-date-picker__input--day',
)[0]
const startMonthElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--month'
+ 'input.dnb-date-picker__input--month',
)[0]
const startYearElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--year'
+ 'input.dnb-date-picker__input--year',
)[0]
const endDayElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--day'
+ 'input.dnb-date-picker__input--day',
)[1]
const endMonthElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--month'
+ 'input.dnb-date-picker__input--month',
)[1]
const endYearElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--year'
+ 'input.dnb-date-picker__input--year',
)[1]
const testInteraction = ({
@@ -760,7 +760,7 @@ describe('DatePicker component', () => {
expect(dayElem.value).toBe('03')
expect(on_type).toHaveBeenCalledTimes(typeIndex + 1)
expect(on_type.mock.calls[typeIndex][0][`${type}_date`]).toBe(
- 'yyyy-mm-03'
+ 'yyyy-mm-03',
)
typeIndex++
@@ -772,10 +772,10 @@ describe('DatePicker component', () => {
expect(monthElem.value).toBe('01')
expect(on_type).toHaveBeenCalledTimes(typeIndex + 1)
expect(
- on_type.mock.calls[typeIndex][0][`is_valid_${type}_date`]
+ on_type.mock.calls[typeIndex][0][`is_valid_${type}_date`],
).toBe(false)
expect(on_type.mock.calls[typeIndex][0][`${type}_date`]).toBe(
- 'yyyy-01-03'
+ 'yyyy-01-03',
)
expect(on_change).toHaveBeenCalledTimes(changeIndex)
@@ -823,41 +823,41 @@ describe('DatePicker component', () => {
range
opened
show_input
- />
+ />,
)
const FirstCalendar = document.querySelectorAll(
- '.dnb-date-picker__calendar'
+ '.dnb-date-picker__calendar',
)[0]
const SecondCalendar = document.querySelectorAll(
- '.dnb-date-picker__calendar'
+ '.dnb-date-picker__calendar',
)[1]
const firstDayElem = FirstCalendar.querySelectorAll(
- 'td.dnb-date-picker__day--selectable'
+ 'td.dnb-date-picker__day--selectable',
)[0]
const lastDayElem = SecondCalendar.querySelectorAll(
- 'td.dnb-date-picker__day--selectable'
+ 'td.dnb-date-picker__day--selectable',
)[
SecondCalendar.querySelectorAll(
- 'td.dnb-date-picker__day--selectable'
+ 'td.dnb-date-picker__day--selectable',
).length - 1
]
// 1. Get ready. No selection made
expect(
- FirstCalendar.querySelector('.dnb-date-picker__day--preview')
+ FirstCalendar.querySelector('.dnb-date-picker__day--preview'),
).not.toBeInTheDocument()
expect(
FirstCalendar.querySelector(
- '.dnb-date-picker__day--within-selection'
- )
+ '.dnb-date-picker__day--within-selection',
+ ),
).not.toBeInTheDocument()
expect(firstDayElem.classList).not.toContain(
- 'dnb-date-picker__day--start-date'
+ 'dnb-date-picker__day--start-date',
)
expect(firstDayElem.classList).not.toContain(
- 'dnb-date-picker__day--end-date'
+ 'dnb-date-picker__day--end-date',
)
// 2. Click on start date
@@ -867,21 +867,21 @@ describe('DatePicker component', () => {
// 3. Should be marked with start and end date
expect(firstDayElem.classList).toContain(
- 'dnb-date-picker__day--start-date'
+ 'dnb-date-picker__day--start-date',
)
expect(firstDayElem.classList).toContain(
- 'dnb-date-picker__day--end-date'
+ 'dnb-date-picker__day--end-date',
)
// 4. But still no "selection"
expect(
- FirstCalendar.querySelector('.dnb-date-picker__day--preview')
+ FirstCalendar.querySelector('.dnb-date-picker__day--preview'),
).not.toBeInTheDocument()
expect(
FirstCalendar.querySelector(
- '.dnb-date-picker__day--within-selection'
- )
+ '.dnb-date-picker__day--within-selection',
+ ),
).not.toBeInTheDocument()
// 5. Hover on last day
@@ -892,21 +892,21 @@ describe('DatePicker component', () => {
// - and we should have marked it as the end-date
expect(lastDayElem.classList).toContain(
- 'dnb-date-picker__day--end-date'
+ 'dnb-date-picker__day--end-date',
)
expect(
FirstCalendar.querySelectorAll(
- 'td.dnb-date-picker__day--selectable'
- )[1].classList
+ 'td.dnb-date-picker__day--selectable',
+ )[1].classList,
).toContain('dnb-date-picker__day--preview')
expect(
SecondCalendar.querySelectorAll(
- 'td.dnb-date-picker__day--selectable'
+ 'td.dnb-date-picker__day--selectable',
)[
SecondCalendar.querySelectorAll(
- 'td.dnb-date-picker__day--selectable'
+ 'td.dnb-date-picker__day--selectable',
).length - 2
- ].classList
+ ].classList,
).toContain('dnb-date-picker__day--preview')
// 7. simulate mouse leave the calendar
@@ -916,21 +916,21 @@ describe('DatePicker component', () => {
// 8. remove the selection when mouse leaves the calendar
expect(lastDayElem.classList).not.toContain(
- 'dnb-date-picker__day--end-date'
+ 'dnb-date-picker__day--end-date',
)
expect(
FirstCalendar.querySelectorAll(
- 'td.dnb-date-picker__day--selectable'
- )[1].classList
+ 'td.dnb-date-picker__day--selectable',
+ )[1].classList,
).not.toContain('dnb-date-picker__day--preview')
expect(
SecondCalendar.querySelectorAll(
- 'td.dnb-date-picker__day--selectable'
+ 'td.dnb-date-picker__day--selectable',
)[
SecondCalendar.querySelectorAll(
- 'td.dnb-date-picker__day--selectable'
+ 'td.dnb-date-picker__day--selectable',
).length - 2
- ].classList
+ ].classList,
).not.toContain('dnb-date-picker__day--preview')
// 9. Now, click on the last day as well
@@ -941,17 +941,17 @@ describe('DatePicker component', () => {
expect(
FirstCalendar.querySelectorAll(
- 'td.dnb-date-picker__day--selectable'
- )[1].classList
+ 'td.dnb-date-picker__day--selectable',
+ )[1].classList,
).toContain('dnb-date-picker__day--within-selection')
expect(
SecondCalendar.querySelectorAll(
- 'td.dnb-date-picker__day--selectable'
+ 'td.dnb-date-picker__day--selectable',
)[
SecondCalendar.querySelectorAll(
- 'td.dnb-date-picker__day--selectable'
+ 'td.dnb-date-picker__day--selectable',
).length - 2
- ].classList
+ ].classList,
).toContain('dnb-date-picker__day--within-selection')
})
@@ -959,7 +959,7 @@ describe('DatePicker component', () => {
let outerState
const on_change = jest.fn(({ date }) => (outerState = date))
const { rerender } = render(
-
+ ,
)
function changeState() {
@@ -972,28 +972,28 @@ describe('DatePicker component', () => {
})
// Siulate prop update, like a state update would do
rerender(
-
+ ,
)
expect(
(
document.querySelectorAll(
- 'input.dnb-input__input'
+ 'input.dnb-input__input',
)[0] as HTMLInputElement
- ).value
+ ).value,
).toBe('16')
// 2. change the date by prop
rerender(
-
+ ,
)
expect(
(
document.querySelectorAll(
- 'input.dnb-input__input'
+ 'input.dnb-input__input',
)[0] as HTMLInputElement
- ).value
+ ).value,
).toBe('01')
}
@@ -1011,7 +1011,7 @@ describe('DatePicker component', () => {
range
start_date={defaultProps.start_date}
end_date={defaultProps.end_date}
- />
+ />,
)
rerender(
@@ -1020,32 +1020,32 @@ describe('DatePicker component', () => {
range
start_date={null}
end_date={defaultProps.end_date}
- />
+ />,
)
expect(
(
document.querySelectorAll(
- 'input.dnb-input__input'
+ 'input.dnb-input__input',
)[0] as HTMLInputElement
- ).value
+ ).value,
).toBe('dd')
expect(
(
document.querySelectorAll(
- 'input.dnb-input__input'
+ 'input.dnb-input__input',
)[3] as HTMLInputElement
- ).value
+ ).value,
).toBe('15')
rerender(
-
+ ,
)
expect(
(
document.querySelectorAll(
- 'input.dnb-input__input'
+ 'input.dnb-input__input',
)[5] as HTMLInputElement
- ).value
+ ).value,
).toBe('Ć„Ć„Ć„Ć„')
})
@@ -1056,10 +1056,10 @@ describe('DatePicker component', () => {
range
start_date={defaultProps.start_date}
end_date={defaultProps.end_date}
- />
+ />,
)
const elem = document.querySelectorAll(
- 'input.dnb-date-picker__input--day'
+ 'input.dnb-date-picker__input--day',
)[1]
// by default we have the start day
@@ -1076,7 +1076,7 @@ describe('DatePicker component', () => {
on_change={({ end_date }) => {
changedStartDate = end_date
}}
- />
+ />,
)
expect(document.querySelectorAll('input')[0].value).toBe('dd')
@@ -1103,7 +1103,7 @@ describe('DatePicker component', () => {
on_change={({ end_date }) => {
changedStartDate = end_date
}}
- />
+ />,
)
expect((elem as HTMLInputElement).value).toBe('17')
@@ -1121,7 +1121,7 @@ describe('DatePicker component', () => {
on_change={({ end_date }) => {
changedStartDate = end_date
}}
- />
+ />,
)
})
@@ -1141,13 +1141,13 @@ describe('DatePicker component', () => {
range
start_date={defaultProps.start_date}
end_date={defaultProps.end_date}
- />
+ />,
)
fireEvent.click(document.querySelector('button'))
const elem = document.querySelectorAll(
- 'input.dnb-date-picker__input--day'
+ 'input.dnb-date-picker__input--day',
)[1]
fireEvent.change(elem, {
target: { value: '15' },
@@ -1155,31 +1155,31 @@ describe('DatePicker component', () => {
expect(
document.querySelectorAll('.dnb-date-picker__header__title')[0]
- .textContent
+ .textContent,
).toBe('januar 2019')
expect(
document.querySelector(
- 'td.dnb-date-picker__day--start-date .dnb-button__text'
- ).textContent
+ 'td.dnb-date-picker__day--start-date .dnb-button__text',
+ ).textContent,
).toBe('1')
expect(
document.querySelector(
- 'td.dnb-date-picker__day--end-date .dnb-button__text'
- ).textContent
+ 'td.dnb-date-picker__day--end-date .dnb-button__text',
+ ).textContent,
).toBe('15')
// from now on, check the second calendar
fireEvent.click(
document
.querySelectorAll('.dnb-date-picker__calendar')[1]
- .querySelector('button.dnb-date-picker__next')
+ .querySelector('button.dnb-date-picker__next'),
)
expect(
document.querySelectorAll('.dnb-date-picker__header__title')[1]
- .textContent
+ .textContent,
).toBe('mars 2019')
})
@@ -1193,7 +1193,7 @@ describe('DatePicker component', () => {
range
start_date={defaultProps.start_date}
end_date={defaultProps.end_date}
- />
+ />,
)
const legendElem = document.querySelector('fieldset > legend')
@@ -1208,11 +1208,11 @@ describe('DatePicker component', () => {
label="Input Label"
range
start_date={defaultProps.start_date}
- />
+ />,
)
const inputElement = document.querySelector(
- 'input.dnb-input__input'
+ 'input.dnb-input__input',
) as HTMLInputElement
fireEvent.focus(inputElement)
@@ -1247,12 +1247,12 @@ describe('DatePicker component', () => {
range
start_date={defaultProps.start_date}
end_date={defaultProps.end_date}
- />
+ />,
)
const element = document.querySelector('.dnb-date-picker')
const buttonElement = document.querySelector(
- 'button.dnb-input__submit-button__button'
+ 'button.dnb-input__submit-button__button',
)
expect(document.activeElement).toBe(document.body)
@@ -1274,12 +1274,12 @@ describe('DatePicker component', () => {
show_input
disable_autofocus
start_date={defaultProps.start_date}
- />
+ />,
)
const element = document.querySelector('.dnb-date-picker')
const buttonElement = document.querySelector(
- 'button.dnb-input__submit-button__button'
+ 'button.dnb-input__submit-button__button',
)
expect(document.activeElement).toBe(document.body)
@@ -1298,17 +1298,17 @@ describe('DatePicker component', () => {
start_date={defaultProps.start_date}
end_date={defaultProps.end_date}
id="unique-id"
- />
+ />,
)
const dayElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--day'
+ 'input.dnb-date-picker__input--day',
)[0] as HTMLInputElement
const monthElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--month'
+ 'input.dnb-date-picker__input--month',
)[0]
const yearElem = document.querySelectorAll(
- 'input.dnb-date-picker__input--year'
+ 'input.dnb-date-picker__input--year',
)[0]
// set the cursor to the end of the input
@@ -1322,7 +1322,7 @@ describe('DatePicker component', () => {
// and check the class of that element
expect(document.activeElement.classList).toContain(
- 'dnb-date-picker__input--month'
+ 'dnb-date-picker__input--month',
)
// also test the key up to change the value on the month input
@@ -1339,7 +1339,7 @@ describe('DatePicker component', () => {
// and check the class of that element
expect(document.activeElement.classList).toContain(
- 'dnb-date-picker__input--day'
+ 'dnb-date-picker__input--day',
)
// also test the key up to change the value on the day input
@@ -1361,19 +1361,19 @@ describe('DatePicker component', () => {
it('has correct small size', () => {
render( )
expect(
- document.querySelector('.dnb-date-picker--small')
+ document.querySelector('.dnb-date-picker--small'),
).toBeInTheDocument()
})
it('has correct medium size', () => {
render( )
expect(
- document.querySelector('.dnb-date-picker--medium')
+ document.querySelector('.dnb-date-picker--medium'),
).toBeInTheDocument()
})
it('has correct large size', () => {
render( )
expect(
- document.querySelector('.dnb-date-picker--large')
+ document.querySelector('.dnb-date-picker--large'),
).toBeInTheDocument()
})
})
@@ -1435,7 +1435,7 @@ describe('DatePicker calc', () => {
expect(getMonth(date, skip)).toHaveLength(daysInMonth - skip)
expect(getMonth(date, 0, limit)).toHaveLength(limit)
expect(getMonth(date, skip, limit)).toHaveLength(
- Math.min(limit, daysInMonth - skip)
+ Math.min(limit, daysInMonth - skip),
)
}
})
@@ -1506,12 +1506,12 @@ describe('DatePicker calc', () => {
render(
-
+ ,
)
const element = document.querySelector('.dnb-date-picker')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class', 'lang'])
@@ -1533,7 +1533,7 @@ describe('DatePicker scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-date-picker-theme-ui.scss')
+ require.resolve('../style/themes/dnb-date-picker-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
@@ -1542,34 +1542,34 @@ describe('DatePicker scss', () => {
describe('Custom text for buttons', () => {
it('should show custom text for submit button', () => {
render(
-
+ ,
)
expect(
document.querySelector('[data-testid="submit"] .dnb-button__text')
- .textContent
+ .textContent,
).toBe('Yes')
})
it('should show custom text for cancel button', () => {
render(
-
+ ,
)
expect(
document.querySelector('[data-testid="cancel"] .dnb-button__text')
- .textContent
+ .textContent,
).toBe('No')
})
it('should show custom text for reset button', () => {
render(
-
+ ,
)
expect(
document.querySelector('[data-testid="reset"] .dnb-button__text')
- .textContent
+ .textContent,
).toBe('Maybe')
})
})
@@ -1583,7 +1583,7 @@ describe('DatePicker ARIA', () => {
disable_autofocus={true}
start_date="2019-05-05"
end_date="2019-06-05"
- />
+ />,
)
expect(await axeComponent(Comp)).toHaveNoViolations()
})
diff --git a/packages/dnb-eufemia/src/components/date-picker/stories/DatePicker.stories.tsx b/packages/dnb-eufemia/src/components/date-picker/stories/DatePicker.stories.tsx
index b2c51fbdb33..d78bba2ba3a 100644
--- a/packages/dnb-eufemia/src/components/date-picker/stories/DatePicker.stories.tsx
+++ b/packages/dnb-eufemia/src/components/date-picker/stories/DatePicker.stories.tsx
@@ -88,7 +88,7 @@ export const DatePickerSandbox = () => (
console.log('on_show', props)
}}
on_days_render={(
- days
+ days,
// , nr
) => {
// console.log('on_days_render', nr, days)
@@ -211,21 +211,21 @@ export const DatePickerSandbox = () => (
console.log(
'on_show',
// props,
- props.event
+ props.event,
)
}}
on_hide={(props) => {
console.log(
'on_hide',
// props,
- props.event
+ props.event,
)
}}
on_change={(props) => {
console.log(
'on_change',
// props,
- props.event
+ props.event,
)
}}
/>
diff --git a/packages/dnb-eufemia/src/components/date-picker/style/themes/dnb-date-picker-theme-ui.scss b/packages/dnb-eufemia/src/components/date-picker/style/themes/dnb-date-picker-theme-ui.scss
index 52b0a0ed5e5..89836c7b885 100644
--- a/packages/dnb-eufemia/src/components/date-picker/style/themes/dnb-date-picker-theme-ui.scss
+++ b/packages/dnb-eufemia/src/components/date-picker/style/themes/dnb-date-picker-theme-ui.scss
@@ -93,8 +93,12 @@
background-color: transparent;
}
- &--preview:not(#{&}--inactive):not(#{&}--start-date):not(#{&}--end-date),
- &--within-selection:not(#{&}--inactive):not(#{&}--start-date):not(#{&}--end-date) {
+ &--preview:not(#{&}--inactive):not(#{&}--start-date):not(
+ #{&}--end-date
+ ),
+ &--within-selection:not(#{&}--inactive):not(#{&}--start-date):not(
+ #{&}--end-date
+ ) {
background-color: var(--color-mint-green-50);
}
diff --git a/packages/dnb-eufemia/src/components/dialog/Dialog.tsx b/packages/dnb-eufemia/src/components/dialog/Dialog.tsx
index 8819ede7469..978fc98ebbe 100644
--- a/packages/dnb-eufemia/src/components/dialog/Dialog.tsx
+++ b/packages/dnb-eufemia/src/components/dialog/Dialog.tsx
@@ -25,7 +25,7 @@ function Dialog(localProps: DialogProps & DialogContentProps) {
const propsWithContext = extendPropsWithContext(
localProps,
defaultProps,
- context?.Dialog
+ context?.Dialog,
)
const {
diff --git a/packages/dnb-eufemia/src/components/dialog/DialogContent.tsx b/packages/dnb-eufemia/src/components/dialog/DialogContent.tsx
index 1144d6305a0..866a719bc98 100644
--- a/packages/dnb-eufemia/src/components/dialog/DialogContent.tsx
+++ b/packages/dnb-eufemia/src/components/dialog/DialogContent.tsx
@@ -54,7 +54,7 @@ export default function DialogContent({
getContent(
typeof rest.children === 'function'
? Object.freeze({ ...rest, close: context?.close })
- : rest
+ : rest,
)
if (alignContent === null) {
@@ -75,7 +75,7 @@ export default function DialogContent({
isTrue(context?.hide) && `dnb-dialog--hide`,
isTrue(noAnimation) && `dnb-dialog--no-animation`,
isTrue(noAnimationOnMobile) && `dnb-dialog--no-animation-on-mobile`,
- className
+ className,
),
style: (minWidth || maxWidth) && { minWidth, maxWidth },
onClick: context?.preventClick,
@@ -86,17 +86,17 @@ export default function DialogContent({
const navExists = findElementInChildren(
content,
- (cur) => cur.type === DialogNavigation || cur.type === ModalHeaderBar
+ (cur) => cur.type === DialogNavigation || cur.type === ModalHeaderBar,
)
const headerExists = findElementInChildren(
content,
- (cur) => cur.type === DialogHeader || cur.type === ModalHeader
+ (cur) => cur.type === DialogHeader || cur.type === ModalHeader,
)
const actionExists = findElementInChildren(
content,
- (cur) => cur.type === DialogAction
+ (cur) => cur.type === DialogAction,
)
const dialogActionProps = {
@@ -129,7 +129,7 @@ export default function DialogContent({
aria-hidden
className={classnames(
'dnb-dialog__icon__primary',
- 'dnb-dialog__icon--' + confirmType
+ 'dnb-dialog__icon--' + confirmType,
)}
/>
diff --git a/packages/dnb-eufemia/src/components/dialog/__tests__/Dialog.test.tsx b/packages/dnb-eufemia/src/components/dialog/__tests__/Dialog.test.tsx
index 72d0bc306bd..e886ee350cd 100644
--- a/packages/dnb-eufemia/src/components/dialog/__tests__/Dialog.test.tsx
+++ b/packages/dnb-eufemia/src/components/dialog/__tests__/Dialog.test.tsx
@@ -29,7 +29,7 @@ describe('Dialog', () => {
render(
+ ,
)
expect(document.body.getAttribute('style')).toBe(null)
@@ -37,7 +37,7 @@ describe('Dialog', () => {
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
expect(document.body.getAttribute('style')).toContain(
- 'overflow: hidden;'
+ 'overflow: hidden;',
)
})
@@ -45,13 +45,13 @@ describe('Dialog', () => {
render(
+ ,
)
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
expect(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
).toBeInTheDocument()
})
@@ -59,7 +59,7 @@ describe('Dialog', () => {
render()
expect(
- document.querySelector('button.dnb-modal__trigger')
+ document.querySelector('button.dnb-modal__trigger'),
).not.toBeInTheDocument()
})
@@ -76,7 +76,7 @@ describe('Dialog', () => {
{({ close }) => (
)}
-
+ ,
)
fireEvent.click(document.querySelector('button'))
expect(on_open).toHaveBeenCalledTimes(1)
@@ -117,13 +117,13 @@ describe('Dialog', () => {
}}
>
-
+ ,
)
fireEvent.click(document.querySelector('button'))
expect(document.querySelector('.dnb-dialog__title').textContent).toBe(
- contextTitle
+ contextTitle,
)
})
@@ -131,7 +131,7 @@ describe('Dialog', () => {
const { rerender } = render(
+ ,
)
const elem = document.querySelector('.dnb-modal__content')
expect(elem.getAttribute('role')).toBe('dialog')
@@ -145,7 +145,7 @@ describe('Dialog', () => {
rerender(
+ ,
)
expect(elem.getAttribute('role')).toBe('region')
@@ -164,7 +164,7 @@ describe('Dialog', () => {
variant="confirmation"
>
-
+ ,
)
expect(elem.getAttribute('role')).toBe('alertdialog')
@@ -196,7 +196,7 @@ describe('Dialog', () => {
it('is closed by keyboardevent esc', () => {
let testTriggeredBy = null
const on_close = jest.fn(
- ({ triggeredBy }) => (testTriggeredBy = triggeredBy)
+ ({ triggeredBy }) => (testTriggeredBy = triggeredBy),
)
const props: DialogProps & DialogContentProps = {
@@ -277,24 +277,24 @@ describe('Dialog', () => {
getComponent({
directDomReturn: false,
noAnimation: true,
- })
+ }),
)
expect(
- document.querySelector('#content-third')
+ document.querySelector('#content-third'),
).not.toBeInTheDocument()
fireEvent.click(document.querySelector('button#modal-first'))
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-first')
fireEvent.click(document.querySelector('button#modal-second'))
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-second')
fireEvent.click(document.querySelector('button#modal-third'))
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-third')
expect(on_open.first).toHaveBeenCalledTimes(1)
@@ -302,25 +302,25 @@ describe('Dialog', () => {
expect(on_open.third).toHaveBeenCalledTimes(1)
expect(
- document.querySelectorAll('button.dnb-modal__close-button').length
+ document.querySelectorAll('button.dnb-modal__close-button').length,
).toBe(3)
expect(document.querySelector('#content-first')).toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(document.querySelector('#content-second')).toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(document.querySelector('#content-third')).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
).toHaveAttribute('aria-hidden')
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[1]
+ document.querySelectorAll('button.dnb-modal__close-button')[1],
).toHaveAttribute('aria-hidden')
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[2]
+ document.querySelectorAll('button.dnb-modal__close-button')[2],
).not.toHaveAttribute('aria-hidden')
// Close the third one
@@ -332,19 +332,19 @@ describe('Dialog', () => {
})
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-second')
expect(
- document.querySelector('#content-third')
+ document.querySelector('#content-third'),
).not.toBeInTheDocument()
expect(document.querySelector('#content-second')).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
).toHaveAttribute('aria-hidden')
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[1]
+ document.querySelectorAll('button.dnb-modal__close-button')[1],
).not.toHaveAttribute('aria-hidden')
// Close the second one
@@ -356,16 +356,16 @@ describe('Dialog', () => {
})
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-first')
expect(
- document.querySelector('#content-second')
+ document.querySelector('#content-second'),
).not.toBeInTheDocument()
expect(document.querySelector('#content-first')).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
).not.toHaveAttribute('aria-hidden')
// Close the first one
@@ -376,10 +376,10 @@ describe('Dialog', () => {
expect(on_close.third).toHaveBeenCalledTimes(1)
expect(
- document.querySelector('#content-first')
+ document.querySelector('#content-first'),
).not.toBeInTheDocument()
expect(document.documentElement).not.toHaveAttribute(
- 'data-dnb-modal-active'
+ 'data-dnb-modal-active',
)
})
})
@@ -398,7 +398,7 @@ describe('Dialog', () => {
{({ close }) => (
)}
-
+ ,
)
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
@@ -414,20 +414,20 @@ describe('Dialog', () => {
navigation
header
body
-
+ ,
)
fireEvent.click(document.querySelector('button'))
const elements = document.querySelectorAll(
- '.dnb-dialog__content > .dnb-section'
+ '.dnb-dialog__content > .dnb-section',
)
expect(elements[0].textContent).toContain('navigation')
expect(elements[1].textContent).toContain('header')
expect(elements[2].textContent).toContain('body')
expect(
- document.querySelectorAll('button.dnb-modal__close-button').length
+ document.querySelectorAll('button.dnb-modal__close-button').length,
).toBe(1)
})
@@ -436,13 +436,13 @@ describe('Dialog', () => {
fireEvent.click(document.querySelector('.dnb-modal__content'))
expect(
- document.querySelector('.dnb-dialog__inner')
+ document.querySelector('.dnb-dialog__inner'),
).toBeInTheDocument()
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 27 }))
await waitFor(() => {
expect(
- document.querySelector('.dnb-dialog__inner')
+ document.querySelector('.dnb-dialog__inner'),
).not.toBeInTheDocument()
})
})
diff --git a/packages/dnb-eufemia/src/components/dialog/__tests__/DialogAction.test.tsx b/packages/dnb-eufemia/src/components/dialog/__tests__/DialogAction.test.tsx
index d881a29668e..ce1f3772662 100644
--- a/packages/dnb-eufemia/src/components/dialog/__tests__/DialogAction.test.tsx
+++ b/packages/dnb-eufemia/src/components/dialog/__tests__/DialogAction.test.tsx
@@ -18,7 +18,7 @@ describe('Dialog.Action', () => {
render( )
expect(
- document.querySelector('.dnb-dialog__actions')
+ document.querySelector('.dnb-dialog__actions'),
).toBeInTheDocument()
})
@@ -50,7 +50,7 @@ describe('Dialog.Action', () => {
-
+ ,
)
const element = document.querySelector('.dnb-dialog__actions')
diff --git a/packages/dnb-eufemia/src/components/dialog/parts/DialogAction.tsx b/packages/dnb-eufemia/src/components/dialog/parts/DialogAction.tsx
index 3e0ccc4b79b..e64fa36bfac 100644
--- a/packages/dnb-eufemia/src/components/dialog/parts/DialogAction.tsx
+++ b/packages/dnb-eufemia/src/components/dialog/parts/DialogAction.tsx
@@ -85,7 +85,7 @@ const DialogAction = ({
})
},
},
- child.props.children
+ child.props.children,
)
} else {
return child
diff --git a/packages/dnb-eufemia/src/components/drawer/DrawerContent.tsx b/packages/dnb-eufemia/src/components/drawer/DrawerContent.tsx
index d647f0ef02b..ed904825d05 100644
--- a/packages/dnb-eufemia/src/components/drawer/DrawerContent.tsx
+++ b/packages/dnb-eufemia/src/components/drawer/DrawerContent.tsx
@@ -44,7 +44,7 @@ export default function DrawerContent({
getContent(
typeof rest.children === 'function'
? Object.freeze({ ...rest, close: context?.close })
- : rest
+ : rest,
)
const innerParams = {
@@ -62,7 +62,7 @@ export default function DrawerContent({
isTrue(noAnimationOnMobile) && `dnb-drawer--no-animation-on-mobile`,
`dnb-drawer--${containerPlacement || 'right'}`,
- className
+ className,
),
style: (minWidth || maxWidth) && { minWidth, maxWidth },
onClick: context?.preventClick,
@@ -79,7 +79,7 @@ export default function DrawerContent({
const height = getOffsetTop(context?.contentRef.current) / 16
context?.contentRef.current.style.setProperty(
'--header-height',
- `${height}rem`
+ `${height}rem`,
)
} catch (e) {
warn(e)
@@ -89,12 +89,12 @@ export default function DrawerContent({
const navigationElement = findElementInChildren(
content,
(cur: React.ReactElement) =>
- cur.type === DrawerNavigation || cur.type === ModalHeaderBar
+ cur.type === DrawerNavigation || cur.type === ModalHeaderBar,
)
const headerElement = findElementInChildren(
content,
(cur: React.ReactElement) =>
- cur.type === DrawerHeader || cur.type === ModalHeader
+ cur.type === DrawerHeader || cur.type === ModalHeader,
)
return (
diff --git a/packages/dnb-eufemia/src/components/drawer/__tests__/Drawer.test.tsx b/packages/dnb-eufemia/src/components/drawer/__tests__/Drawer.test.tsx
index 4ad7323f361..bfa51d5970b 100644
--- a/packages/dnb-eufemia/src/components/drawer/__tests__/Drawer.test.tsx
+++ b/packages/dnb-eufemia/src/components/drawer/__tests__/Drawer.test.tsx
@@ -28,7 +28,7 @@ describe('Drawer', () => {
render(
-
+ ,
)
expect(document.body.getAttribute('style')).toBe(null)
@@ -36,7 +36,7 @@ describe('Drawer', () => {
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
expect(document.body.getAttribute('style')).toContain(
- 'overflow: hidden;'
+ 'overflow: hidden;',
)
})
@@ -44,13 +44,13 @@ describe('Drawer', () => {
render(
-
+ ,
)
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
expect(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
).toBeInTheDocument()
})
@@ -58,7 +58,7 @@ describe('Drawer', () => {
render( )
expect(
- document.querySelector('button.dnb-modal__trigger')
+ document.querySelector('button.dnb-modal__trigger'),
).not.toBeInTheDocument()
})
@@ -75,7 +75,7 @@ describe('Drawer', () => {
{({ close }) => (
)}
-
+ ,
)
fireEvent.click(document.querySelector('button'))
@@ -98,20 +98,20 @@ describe('Drawer', () => {
}}
>
-
+ ,
)
fireEvent.click(document.querySelector('button'))
expect(document.querySelector('.dnb-drawer__title').textContent).toBe(
- contextTitle
+ contextTitle,
)
})
it('is closed by keyboardevent esc', () => {
let testTriggeredBy = null
const on_close = jest.fn(
- ({ triggeredBy }) => (testTriggeredBy = triggeredBy)
+ ({ triggeredBy }) => (testTriggeredBy = triggeredBy),
)
const props: DrawerAllProps = {
@@ -187,24 +187,24 @@ describe('Drawer', () => {
-
+ ,
)
expect(
- document.querySelector('#content-third')
+ document.querySelector('#content-third'),
).not.toBeInTheDocument()
fireEvent.click(document.querySelector('button#modal-first'))
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-first')
fireEvent.click(document.querySelector('button#modal-second'))
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-second')
fireEvent.click(document.querySelector('button#modal-third'))
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-third')
expect(on_open.first).toHaveBeenCalledTimes(1)
@@ -212,29 +212,29 @@ describe('Drawer', () => {
expect(on_open.third).toHaveBeenCalledTimes(1)
expect(
- document.querySelectorAll('button.dnb-modal__close-button').length
+ document.querySelectorAll('button.dnb-modal__close-button').length,
).toBe(3)
expect(document.querySelector('#content-first')).toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(document.querySelector('#content-second')).toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(document.querySelector('#content-third')).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[0]
+ document.querySelectorAll('button.dnb-modal__close-button')[0],
).toHaveAttribute('aria-hidden')
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[0]
+ document.querySelectorAll('button.dnb-modal__close-button')[0],
).toHaveAttribute('aria-hidden')
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[1]
+ document.querySelectorAll('button.dnb-modal__close-button')[1],
).toHaveAttribute('aria-hidden')
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[2]
+ document.querySelectorAll('button.dnb-modal__close-button')[2],
).not.toHaveAttribute('aria-hidden')
// Close the third one
@@ -246,19 +246,19 @@ describe('Drawer', () => {
})
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-second')
expect(
- document.querySelector('#content-third')
+ document.querySelector('#content-third'),
).not.toBeInTheDocument()
expect(document.querySelector('#content-second')).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[0]
+ document.querySelectorAll('button.dnb-modal__close-button')[0],
).toHaveAttribute('aria-hidden')
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[1]
+ document.querySelectorAll('button.dnb-modal__close-button')[1],
).not.toHaveAttribute('aria-hidden')
// Close the second one
@@ -270,16 +270,16 @@ describe('Drawer', () => {
})
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-first')
expect(
- document.querySelector('#content-second')
+ document.querySelector('#content-second'),
).not.toBeInTheDocument()
expect(document.querySelector('#content-first')).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[0]
+ document.querySelectorAll('button.dnb-modal__close-button')[0],
).not.toHaveAttribute('aria-hidden')
// Close the first one
@@ -291,10 +291,10 @@ describe('Drawer', () => {
})
expect(
- document.querySelector('#content-first')
+ document.querySelector('#content-first'),
).not.toBeInTheDocument()
expect(document.documentElement).not.toHaveAttribute(
- 'data-dnb-modal-active'
+ 'data-dnb-modal-active',
)
})
@@ -335,7 +335,7 @@ describe('Drawer', () => {
{({ close }) => (
)}
-
+ ,
)
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
@@ -351,14 +351,14 @@ describe('Drawer', () => {
navigation
header
body
-
+ ,
)
fireEvent.click(document.querySelector('button'))
{
const elements = document.querySelectorAll(
- '.dnb-drawer.dnb-scroll-view > .dnb-section'
+ '.dnb-drawer.dnb-scroll-view > .dnb-section',
)
expect(elements[0].textContent).toContain('navigation')
expect(elements[1].textContent).toContain('header')
@@ -366,13 +366,13 @@ describe('Drawer', () => {
{
const elements = document.querySelectorAll(
- '.dnb-drawer__content > .dnb-section'
+ '.dnb-drawer__content > .dnb-section',
)
expect(elements[0].textContent).toContain('body')
}
expect(
- document.querySelectorAll('button.dnb-modal__close-button').length
+ document.querySelectorAll('button.dnb-modal__close-button').length,
).toBe(1)
})
})
diff --git a/packages/dnb-eufemia/src/components/drawer/helpers.ts b/packages/dnb-eufemia/src/components/drawer/helpers.ts
index 985c782a392..7888a66f26f 100644
--- a/packages/dnb-eufemia/src/components/drawer/helpers.ts
+++ b/packages/dnb-eufemia/src/components/drawer/helpers.ts
@@ -2,7 +2,7 @@ import { processChildren } from '../../shared/component-helper'
export const checkMinMaxWidth = (
min: number | string,
- max: number | string
+ max: number | string,
) => {
// ensure the min/max don't conflict
let maxWidth = max
diff --git a/packages/dnb-eufemia/src/components/drawer/stories/Drawer.stories.tsx b/packages/dnb-eufemia/src/components/drawer/stories/Drawer.stories.tsx
index 9d537eb56fd..d300467bd66 100644
--- a/packages/dnb-eufemia/src/components/drawer/stories/Drawer.stories.tsx
+++ b/packages/dnb-eufemia/src/components/drawer/stories/Drawer.stories.tsx
@@ -542,7 +542,7 @@ const LargeListOfTrs = (): Array => {
Row {i} Column 2
Row {i} Column 3
Row {i} Column 4
-
+ ,
)
}
diff --git a/packages/dnb-eufemia/src/components/dropdown/Dropdown.js b/packages/dnb-eufemia/src/components/dropdown/Dropdown.js
index 2c1fd04ce51..048e1758b6b 100644
--- a/packages/dnb-eufemia/src/components/dropdown/Dropdown.js
+++ b/packages/dnb-eufemia/src/components/dropdown/Dropdown.js
@@ -129,7 +129,7 @@ export default class Dropdown extends React.PureComponent {
PropTypes.arrayOf(PropTypes.string),
]),
}),
- ])
+ ]),
),
]),
default_value: PropTypes.oneOfType([
@@ -389,7 +389,7 @@ class DropdownInstance extends React.PureComponent {
if (data && data.length > 0) {
const currentOptionData = getCurrentData(
this.context.drawerList.selected_item,
- data
+ data,
)
if (currentOptionData) {
title =
@@ -408,7 +408,7 @@ class DropdownInstance extends React.PureComponent {
{ skeleton: this.context?.skeleton },
this.context.getTranslation(this.props).Dropdown,
includeValidProps(this.context.FormRow),
- this.context.Dropdown
+ this.context.Dropdown,
)
const {
@@ -485,7 +485,7 @@ class DropdownInstance extends React.PureComponent {
// make it possible to grab the rest attributes and return it with all events
Object.assign(
this.context.drawerList.attributes,
- validateDOMAttributes(null, attributes)
+ validateDOMAttributes(null, attributes),
)
const mainParams = {
@@ -507,14 +507,14 @@ class DropdownInstance extends React.PureComponent {
'dnb-form-component',
createSpacingClasses(props),
_className,
- className
+ className,
),
}
const triggerParams = {
className: classnames(
'dnb-dropdown__trigger',
- opened && 'dnb-button--active'
+ opened && 'dnb-button--active',
),
id,
disabled,
@@ -536,7 +536,7 @@ class DropdownInstance extends React.PureComponent {
triggerParams['aria-describedby'] = combineDescribedBy(
triggerParams,
showStatus ? id + '-status' : null,
- suffix ? id + '-suffix' : null
+ suffix ? id + '-suffix' : null,
)
}
@@ -544,7 +544,7 @@ class DropdownInstance extends React.PureComponent {
triggerParams['aria-labelledby'] = combineLabelledBy(
triggerParams,
id + '-label',
- id // used to read the current value
+ id, // used to read the current value
)
}
@@ -610,7 +610,7 @@ class DropdownInstance extends React.PureComponent {
className={classnames(
'dnb-dropdown__icon',
parseFloat(selected_item) === 0 &&
- 'dnb-dropdown__icon--first'
+ 'dnb-dropdown__icon--first',
)}
>
{icon !== false && (
diff --git a/packages/dnb-eufemia/src/components/dropdown/__tests__/Dropdown.test.tsx b/packages/dnb-eufemia/src/components/dropdown/__tests__/Dropdown.test.tsx
index 2d3dbbc0801..ee5bb2792ae 100644
--- a/packages/dnb-eufemia/src/components/dropdown/__tests__/Dropdown.test.tsx
+++ b/packages/dnb-eufemia/src/components/dropdown/__tests__/Dropdown.test.tsx
@@ -66,7 +66,7 @@ describe('Dropdown component', () => {
let elem
expect(
- document.querySelector('.dnb-dropdown__text__inner').textContent
+ document.querySelector('.dnb-dropdown__text__inner').textContent,
).toBe((mockData[props.value] as DrawerListDataObject).selected_value)
keydown(32) // space
@@ -89,10 +89,10 @@ describe('Dropdown component', () => {
expect(elem.classList).toContain('dnb-drawer-list__option--selected')
expect(
- document.querySelector('.dnb-dropdown__text__inner').textContent
+ document.querySelector('.dnb-dropdown__text__inner').textContent,
).toBe(
(mockData[(props.value as number) + 1] as DrawerListDataObject)
- .selected_value
+ .selected_value,
)
})
@@ -102,7 +102,7 @@ describe('Dropdown component', () => {
keydown(32) // space
expect(
- document.querySelector('.dnb-drawer-list__option--focus')
+ document.querySelector('.dnb-drawer-list__option--focus'),
).toBeInTheDocument()
keydown(83) // S
@@ -111,7 +111,7 @@ describe('Dropdown component', () => {
rerender( )
expect(
- document.querySelectorAll('.dnb-drawer-list__option')[1].classList
+ document.querySelectorAll('.dnb-drawer-list__option')[1].classList,
).toContain('dnb-drawer-list__option--focus')
keydown(70) // F
@@ -120,22 +120,22 @@ describe('Dropdown component', () => {
rerender( )
expect(
- document.querySelectorAll('.dnb-drawer-list__option')[2].classList
+ document.querySelectorAll('.dnb-drawer-list__option')[2].classList,
).toContain('dnb-drawer-list__option--focus')
})
it('has correct state when opened prop is given', () => {
render(
-
+ ,
)
expect(
- document.querySelector('button').getAttribute('aria-expanded')
+ document.querySelector('button').getAttribute('aria-expanded'),
).toBe('true')
expect(
document
.querySelector('.dnb-drawer-list__options')
- .getAttribute('aria-expanded')
+ .getAttribute('aria-expanded'),
).toBe('true')
})
@@ -146,12 +146,12 @@ describe('Dropdown component', () => {
no_animation
trigger_element={(props) => }
data={mockData}
- />
+ />,
)
expect(document.querySelector('button')).toBeInTheDocument()
expect(
- Array.from(document.querySelector('button').classList)
+ Array.from(document.querySelector('button').classList),
).toContain('dnb-dropdown__trigger')
expect(document.querySelector('button').textContent).toBe('test')
@@ -162,7 +162,7 @@ describe('Dropdown component', () => {
document
.querySelector('.dnb-drawer-list__options')
- .getAttribute('aria-expanded')
+ .getAttribute('aria-expanded'),
).toBe('true')
})
@@ -175,11 +175,11 @@ describe('Dropdown component', () => {
status="status text"
status_state="warn"
status_props={{ stretch: true }}
- />
+ />,
)
expect(
- Array.from(document.querySelector('.dnb-form-status').classList)
+ Array.from(document.querySelector('.dnb-form-status').classList),
).toEqual([
'dnb-form-status',
'dnb-form-status--warn',
@@ -199,11 +199,11 @@ describe('Dropdown component', () => {
keep_open={true}
on_change={on_change}
data={mockData}
- />
+ />,
)
expect(
- document.querySelector('.dnb-drawer-list__option--selected')
+ document.querySelector('.dnb-drawer-list__option--selected'),
).not.toBeInTheDocument()
// then simulate changes
@@ -213,17 +213,17 @@ describe('Dropdown component', () => {
expect(on_change).toHaveBeenCalledTimes(1)
expect(
- document.querySelector('.dnb-drawer-list__option--selected')
+ document.querySelector('.dnb-drawer-list__option--selected'),
).toBeInTheDocument()
expect(document.querySelector('.dnb-dropdown').classList).toContain(
- 'dnb-dropdown--opened'
+ 'dnb-dropdown--opened',
)
// close
keydown(27) // esc
expect(
- document.querySelector('.dnb-dropdown').classList
+ document.querySelector('.dnb-dropdown').classList,
).not.toContain('dnb-dropdown--opened')
})
@@ -238,11 +238,11 @@ describe('Dropdown component', () => {
on_change={on_change}
on_hide={on_hide}
data={mockData}
- />
+ />,
)
expect(
- document.querySelector('.dnb-drawer-list__option--selected')
+ document.querySelector('.dnb-drawer-list__option--selected'),
).not.toBeInTheDocument()
// then simulate changes
@@ -252,17 +252,17 @@ describe('Dropdown component', () => {
expect(on_change).toHaveBeenCalledTimes(1)
expect(
- document.querySelector('.dnb-drawer-list__option--selected')
+ document.querySelector('.dnb-drawer-list__option--selected'),
).toBeInTheDocument()
expect(document.querySelector('.dnb-dropdown').classList).toContain(
- 'dnb-dropdown--opened'
+ 'dnb-dropdown--opened',
)
// try to close it
keydown(27) // esc
expect(document.querySelector('.dnb-dropdown').classList).toContain(
- 'dnb-dropdown--opened'
+ 'dnb-dropdown--opened',
)
expect(on_hide).toHaveBeenCalledTimes(0)
@@ -279,7 +279,7 @@ describe('Dropdown component', () => {
expect(
document.querySelectorAll('.dnb-drawer-list__option--selected')
- .length
+ .length,
).toBe(1)
const notChangedItem = mockData[(props.value as number) + 1]
@@ -303,14 +303,14 @@ describe('Dropdown component', () => {
title={title}
on_change={on_change}
prevent_selection
- />
+ />,
)
// open first
open()
expect(
- document.querySelector('.dnb-drawer-list__option--selected')
+ document.querySelector('.dnb-drawer-list__option--selected'),
).not.toBeInTheDocument()
// then simulate changes
@@ -322,7 +322,7 @@ describe('Dropdown component', () => {
open()
expect(
- document.querySelector('.dnb-drawer-list__option--selected')
+ document.querySelector('.dnb-drawer-list__option--selected'),
).not.toBeInTheDocument()
rerender(
@@ -333,7 +333,7 @@ describe('Dropdown component', () => {
title={title}
on_change={on_change}
prevent_selection={false}
- />
+ />,
)
// open again
@@ -346,7 +346,7 @@ describe('Dropdown component', () => {
open()
expect(
- document.querySelector('.dnb-drawer-list__option--selected')
+ document.querySelector('.dnb-drawer-list__option--selected'),
).toBeInTheDocument()
rerender(
@@ -358,7 +358,7 @@ describe('Dropdown component', () => {
on_change={on_change}
prevent_selection={false}
action_menu={true}
- />
+ />,
)
// open again
@@ -371,7 +371,7 @@ describe('Dropdown component', () => {
open()
expect(
- document.querySelector('.dnb-drawer-list__option--selected')
+ document.querySelector('.dnb-drawer-list__option--selected'),
).not.toBeInTheDocument()
rerender(
@@ -383,14 +383,14 @@ describe('Dropdown component', () => {
on_change={on_change}
prevent_selection={true}
action_menu={false}
- />
+ />,
)
expect(
document
.querySelector('.dnb-icon')
- .getAttribute('data-testid')
+ .getAttribute('data-testid'),
).toBe('chevron down icon')
const event = on_change.mock.calls[0][0]
@@ -401,10 +401,10 @@ describe('Dropdown component', () => {
expect(event.data).toStrictEqual(selectedItem)
expect(document.querySelector('.dnb-dropdown__text').textContent).toBe(
- title
+ title,
)
expect(
- document.querySelector('.dnb-dropdown--is-popup')
+ document.querySelector('.dnb-dropdown--is-popup'),
).not.toBeInTheDocument()
rerender(
@@ -416,51 +416,51 @@ describe('Dropdown component', () => {
on_change={on_change}
prevent_selection={true}
action_menu={false}
- />
+ />,
)
expect(
- document.querySelector('.dnb-dropdown__text')
+ document.querySelector('.dnb-dropdown__text'),
).not.toBeInTheDocument()
expect(
- document.querySelector('.dnb-dropdown--is-popup')
+ document.querySelector('.dnb-dropdown--is-popup'),
).toBeInTheDocument()
})
it('can be reset to null', () => {
let value
const { rerender } = render(
-
+ ,
)
expect(document.querySelector('.dnb-dropdown__text').textContent).toBe(
- 'Valgmeny'
+ 'Valgmeny',
)
value = 2
rerender( )
expect(document.querySelector('.dnb-dropdown__text').textContent).toBe(
- (mockData[value] as DrawerListDataObject).selected_value
+ (mockData[value] as DrawerListDataObject).selected_value,
)
rerender( )
expect(document.querySelector('.dnb-dropdown__text').textContent).toBe(
- 'Valgmeny'
+ 'Valgmeny',
)
value = 3
rerender( )
expect(document.querySelector('.dnb-dropdown__text').textContent).toBe(
- (mockData[value] as DrawerListDataObject).selected_value
+ (mockData[value] as DrawerListDataObject).selected_value,
)
rerender( )
expect(document.querySelector('.dnb-dropdown__text').textContent).toBe(
- 'Valgmeny'
+ 'Valgmeny',
)
})
@@ -476,7 +476,7 @@ describe('Dropdown component', () => {
const on_change = jest.fn()
const { rerender } = render(
-
+ ,
)
// open first
@@ -493,7 +493,7 @@ describe('Dropdown component', () => {
openAndSelectNext()
expect(document.querySelector('.dnb-dropdown__text').textContent).toBe(
- 'A value'
+ 'A value',
)
expect(on_change.mock.calls[0][0].data.selected_key).toBe('a')
@@ -503,17 +503,17 @@ describe('Dropdown component', () => {
data={mockData}
on_change={on_change}
value="b"
- />
+ />,
)
expect(document.querySelector('.dnb-dropdown__text').textContent).toBe(
- 'B value'
+ 'B value',
)
openAndSelectNext()
expect(document.querySelector('.dnb-dropdown__text').textContent).toBe(
- 'C value'
+ 'C value',
)
expect(on_change.mock.calls[1][0].data.selected_key).toBe('c')
@@ -523,17 +523,17 @@ describe('Dropdown component', () => {
data={mockData}
on_change={on_change}
value="id-123"
- />
+ />,
)
expect(document.querySelector('.dnb-dropdown__text').textContent).toBe(
- '123 value'
+ '123 value',
)
openAndSelectNext()
expect(document.querySelector('.dnb-dropdown__text').textContent).toBe(
- '456 value'
+ '456 value',
)
expect(on_change.mock.calls[2][0].data.selected_key).toBe('id-456')
@@ -543,11 +543,11 @@ describe('Dropdown component', () => {
data={mockData}
on_change={on_change}
value={123}
- />
+ />,
)
expect(document.querySelector('.dnb-dropdown__text').textContent).toBe(
- 'Valgmeny'
+ 'Valgmeny',
)
})
@@ -560,7 +560,7 @@ describe('Dropdown component', () => {
data={mockData}
title={title}
more_menu
- />
+ />,
)
// open first
@@ -575,21 +575,21 @@ describe('Dropdown component', () => {
open()
expect(
- document.querySelector('.dnb-drawer-list__option--selected')
+ document.querySelector('.dnb-drawer-list__option--selected'),
).not.toBeInTheDocument()
expect(
document
.querySelector('.dnb-icon')
- .getAttribute('data-testid')
+ .getAttribute('data-testid'),
).toBe('more icon')
expect(
- document.querySelector('.dnb-dropdown__text')
+ document.querySelector('.dnb-dropdown__text'),
).not.toBeInTheDocument()
expect(
- document.querySelector('.dnb-dropdown--is-popup')
+ document.querySelector('.dnb-dropdown--is-popup'),
).toBeInTheDocument()
})
@@ -604,7 +604,7 @@ describe('Dropdown component', () => {
data={mockData}
on_change={on_change}
on_select={on_select}
- />
+ />,
)
// open first
open()
@@ -653,7 +653,7 @@ describe('Dropdown component', () => {
{...props}
data={{ 'en-GB': 'English', 'nb-NO': 'Norsk' }}
on_change={on_change}
- />
+ />,
)
open()
@@ -704,7 +704,7 @@ describe('Dropdown component', () => {
expect(
elem
.querySelector('button.dnb-dropdown__trigger')
- .getAttribute('aria-expanded')
+ .getAttribute('aria-expanded'),
).toBe('true')
expect(elem.getAttribute('class')).toContain('dnb-dropdown--opened')
@@ -716,7 +716,7 @@ describe('Dropdown component', () => {
open()
expect(
- document.querySelectorAll('li.dnb-drawer-list__option').length
+ document.querySelectorAll('li.dnb-drawer-list__option').length,
).toBe(mockData.length)
})
@@ -731,7 +731,7 @@ describe('Dropdown component', () => {
on_hide={on_hide}
{...params}
data={mockData}
- />
+ />,
)
open()
@@ -774,7 +774,7 @@ describe('Dropdown component', () => {
on_show_focus={on_show_focus}
on_hide_focus={on_hide_focus}
data={mockData}
- />
+ />,
)
// 1. open the dropdown
@@ -789,7 +789,7 @@ describe('Dropdown component', () => {
expect(on_show_focus).toBeCalledTimes(1)
expect(on_show_focus.mock.calls[0][0].element).toBe(
- document.activeElement
+ document.activeElement,
)
// 2. close the dropdown with tab
@@ -807,7 +807,7 @@ describe('Dropdown component', () => {
})
expect(on_hide_focus).toBeCalledTimes(1)
expect(on_hide_focus.mock.calls[0][0].element).toBe(
- document.querySelector('.dnb-button')
+ document.querySelector('.dnb-button'),
)
})
@@ -820,7 +820,7 @@ describe('Dropdown component', () => {
open()
expect(document.querySelector('.dnb-dropdown').classList).toContain(
- 'dnb-dropdown--opened'
+ 'dnb-dropdown--opened',
)
act(() => {
@@ -831,14 +831,14 @@ describe('Dropdown component', () => {
expect(on_hide.mock.calls.length).toBe(1)
expect(
- document.querySelector('.dnb-dropdown').classList
+ document.querySelector('.dnb-dropdown').classList,
).not.toContain('dnb-dropdown--opened')
// reopen
open()
expect(document.querySelector('.dnb-dropdown').classList).toContain(
- 'dnb-dropdown--opened'
+ 'dnb-dropdown--opened',
)
preventClose = true
@@ -852,24 +852,24 @@ describe('Dropdown component', () => {
// we are still open
expect(document.querySelector('.dnb-dropdown').classList).toContain(
- 'dnb-dropdown--opened'
+ 'dnb-dropdown--opened',
)
})
it('will set focus on options when key down/up is pressed on first item', async () => {
const { rerender } = render(
-
+ ,
)
// first open
keydown(40) // down
expect(document.querySelector('.dnb-dropdown').classList).toContain(
- 'dnb-dropdown--opened'
+ 'dnb-dropdown--opened',
)
expect(document.activeElement.classList).toContain(
- 'dnb-drawer-list__options'
+ 'dnb-drawer-list__options',
)
keydown(40) // down
@@ -878,19 +878,19 @@ describe('Dropdown component', () => {
await wait(1)
expect(document.activeElement.classList).toContain(
- 'dnb-drawer-list__option'
+ 'dnb-drawer-list__option',
)
expect(document.activeElement.classList).toContain(
- 'dnb-drawer-list__option--focus'
+ 'dnb-drawer-list__option--focus',
)
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[0].classList
+ document.querySelectorAll('li.dnb-drawer-list__option')[0].classList,
).toContain('dnb-drawer-list__option--focus')
keydown(38) // up
expect(document.activeElement.classList).toContain(
- 'dnb-drawer-list__options'
+ 'dnb-drawer-list__options',
)
// then simulate changes
@@ -900,18 +900,18 @@ describe('Dropdown component', () => {
await wait(1)
expect(document.activeElement.classList).toContain(
- 'dnb-drawer-list__option'
+ 'dnb-drawer-list__option',
)
let options = document.querySelectorAll('li.dnb-drawer-list__option')
expect(options[mockData.length - 1].classList).toContain(
- 'dnb-drawer-list__option--focus'
+ 'dnb-drawer-list__option--focus',
)
// then simulate changes
keydown(40) // down
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[0].classList // the first item
+ document.querySelectorAll('li.dnb-drawer-list__option')[0].classList, // the first item
).toContain('dnb-drawer-list__option--focus')
rerender(
@@ -920,7 +920,7 @@ describe('Dropdown component', () => {
no_animation
data={mockData}
direction="top"
- />
+ />,
)
// then simulate changes
@@ -928,7 +928,7 @@ describe('Dropdown component', () => {
options = document.querySelectorAll('li.dnb-drawer-list__option')
expect(
- options[mockData.length - 1].classList // the last item
+ options[mockData.length - 1].classList, // the last item
).toContain('dnb-drawer-list__option--focus')
// delay because we want to wait to have the DOM focus to be called
@@ -938,7 +938,7 @@ describe('Dropdown component', () => {
keydown(40) // down
expect(document.activeElement.classList).toContain(
- 'dnb-drawer-list__options'
+ 'dnb-drawer-list__options',
)
// then simulate changes
@@ -946,7 +946,7 @@ describe('Dropdown component', () => {
options = document.querySelectorAll('li.dnb-drawer-list__option')
expect(
- options[mockData.length - 1].classList // the last item
+ options[mockData.length - 1].classList, // the last item
).toContain('dnb-drawer-list__option--focus')
// then simulate changes
@@ -954,14 +954,14 @@ describe('Dropdown component', () => {
options = document.querySelectorAll('li.dnb-drawer-list__option')
expect(
- options[mockData.length - 2].classList // the second item
+ options[mockData.length - 2].classList, // the second item
).toContain('dnb-drawer-list__option--focus')
// then simulate changes
keydown(33) // pageUp
expect(
- document.querySelectorAll('li.dnb-drawer-list__option')[0].classList // the first item
+ document.querySelectorAll('li.dnb-drawer-list__option')[0].classList, // the first item
).toContain('dnb-drawer-list__option--focus')
// then simulate changes
@@ -969,7 +969,7 @@ describe('Dropdown component', () => {
options = document.querySelectorAll('li.dnb-drawer-list__option')
expect(
- options[mockData.length - 1].classList // the last item
+ options[mockData.length - 1].classList, // the last item
).toContain('dnb-drawer-list__option--focus')
})
@@ -977,7 +977,7 @@ describe('Dropdown component', () => {
render(
-
+ ,
)
// first open
@@ -988,17 +988,17 @@ describe('Dropdown component', () => {
keydown(13) // enter
expect(
- document.querySelector('.dnb-dropdown__text__inner').textContent
+ document.querySelector('.dnb-dropdown__text__inner').textContent,
).toBe(
(mockData[(props.value as number) + 1] as DrawerListDataObject)
- .selected_value
+ .selected_value,
)
})
it('has correct selected value', () => {
render( )
expect(
- document.querySelector('.dnb-dropdown__text__inner').textContent
+ document.querySelector('.dnb-dropdown__text__inner').textContent,
).toBe((mockData[props.value] as DrawerListDataObject).selected_value)
})
@@ -1010,7 +1010,7 @@ describe('Dropdown component', () => {
keydown(40) // down
expect(
- document.querySelector('.dnb-dropdown__text__inner').textContent
+ document.querySelector('.dnb-dropdown__text__inner').textContent,
).toBe((mockData[props.value] as DrawerListDataObject).selected_value)
})
@@ -1029,17 +1029,17 @@ describe('Dropdown component', () => {
render( )
expect(
- document.querySelector('.dnb-dropdown__text__inner').textContent
+ document.querySelector('.dnb-dropdown__text__inner').textContent,
).toBe((mockData[newValue] as DrawerListDataObject).selected_value)
open()
const options = document.querySelectorAll('li.dnb-drawer-list__option')
expect(options[newValue].classList).toContain(
- 'dnb-drawer-list__option--selected'
+ 'dnb-drawer-list__option--selected',
)
expect(options[newValue].classList).toContain(
- 'dnb-drawer-list__option--focus'
+ 'dnb-drawer-list__option--focus',
)
})
@@ -1047,7 +1047,7 @@ describe('Dropdown component', () => {
const title = 'Make a selection'
render( )
expect(
- document.querySelector('.dnb-dropdown__text__inner').innerHTML
+ document.querySelector('.dnb-dropdown__text__inner').innerHTML,
).toBe(title)
})
@@ -1057,12 +1057,12 @@ describe('Dropdown component', () => {
keydown(32) // space
expect(
- document.querySelector('button').getAttribute('aria-expanded')
+ document.querySelector('button').getAttribute('aria-expanded'),
).toBe('true')
expect(
document
.querySelector('.dnb-drawer-list__option')
- .querySelector('.dnb-drawer-list__option__inner').innerHTML
+ .querySelector('.dnb-drawer-list__option__inner').innerHTML,
).toBe('')
})
@@ -1071,28 +1071,28 @@ describe('Dropdown component', () => {
render( )
expect(
- document.querySelector('.dnb-dropdown__text__inner').innerHTML
+ document.querySelector('.dnb-dropdown__text__inner').innerHTML,
).toBe(aStringOf)
render( )
expect(
- document.querySelector('.dnb-dropdown__text__inner').innerHTML
+ document.querySelector('.dnb-dropdown__text__inner').innerHTML,
).toBe(aStringOf)
render( )
expect(
- document.querySelector('.dnb-dropdown__text__inner').innerHTML
+ document.querySelector('.dnb-dropdown__text__inner').innerHTML,
).toBe(aStringOf)
})
it('has a disabled attribute, once we set disabled to true', () => {
const { rerender } = render(
-
+ ,
)
rerender( )
expect(
- document.querySelector('button.dnb-dropdown__trigger')
+ document.querySelector('button.dnb-dropdown__trigger'),
).toHaveAttribute('disabled')
})
@@ -1161,7 +1161,7 @@ describe('Dropdown markup', () => {
}
const CheckComponent = render(
-
+ ,
)
expect(
@@ -1169,7 +1169,7 @@ describe('Dropdown markup', () => {
rules: {
'aria-required-children': { enabled: false },
},
- })
+ }),
).toHaveNoViolations()
})
})
@@ -1182,7 +1182,7 @@ describe('Dropdown scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-dropdown-theme-ui.scss')
+ require.resolve('../style/themes/dnb-dropdown-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
@@ -1193,7 +1193,7 @@ const keydown = (keyCode) => {
document.querySelector('button.dnb-dropdown__trigger'),
{
keyCode,
- }
+ },
)
}
diff --git a/packages/dnb-eufemia/src/components/dropdown/stories/Dropdown.stories.tsx b/packages/dnb-eufemia/src/components/dropdown/stories/Dropdown.stories.tsx
index 87e507a5010..4befb92d4e8 100644
--- a/packages/dnb-eufemia/src/components/dropdown/stories/Dropdown.stories.tsx
+++ b/packages/dnb-eufemia/src/components/dropdown/stories/Dropdown.stories.tsx
@@ -401,7 +401,7 @@ const DropdownStory = () => {
console.log(
'on_change',
// event.currentTarget.dataset,
- attributes
+ attributes,
)
}}
data-attr={123}
@@ -864,7 +864,7 @@ function UpdateDataExample() {
size="small"
on_click={() => {
const updatedSelectedData = selectedData.filter(
- (data) => item?.selected_value !== data?.selected_value
+ (data) => item?.selected_value !== data?.selected_value,
)
setSelectedData(updatedSelectedData)
setChoiceData(
@@ -872,9 +872,9 @@ function UpdateDataExample() {
(data) =>
updatedSelectedData.findIndex(
({ selected_value: updatedValue }) =>
- updatedValue === data?.selected_value
- ) === -1
- )
+ updatedValue === data?.selected_value,
+ ) === -1,
+ ),
)
}}
>
@@ -897,12 +897,12 @@ function UpdateDataExample() {
return (
data && item?.selected_value !== data?.selected_value
)
- })
+ }),
)
if (
selectedData.findIndex(
({ selected_value }) =>
- selected_value === data.selected_value
+ selected_value === data.selected_value,
) === -1
) {
setSelectedData([...selectedData, data])
diff --git a/packages/dnb-eufemia/src/components/form-label/FormLabel.js b/packages/dnb-eufemia/src/components/form-label/FormLabel.js
index 0e23c229545..70fbaea33e8 100644
--- a/packages/dnb-eufemia/src/components/form-label/FormLabel.js
+++ b/packages/dnb-eufemia/src/components/form-label/FormLabel.js
@@ -82,7 +82,7 @@ export default class FormLabel extends React.PureComponent {
FormLabel.defaultProps,
{ skeleton: this.context?.skeleton },
includeValidProps(this.context.FormRow),
- this.context.FormLabel
+ this.context.FormLabel,
)
const {
@@ -113,7 +113,7 @@ export default class FormLabel extends React.PureComponent {
createSkeletonClass('font', skeleton, this.context),
createSpacingClasses(props),
className,
- _className
+ _className,
),
htmlFor: for_id,
id,
diff --git a/packages/dnb-eufemia/src/components/form-label/__tests__/FormLabel.test.tsx b/packages/dnb-eufemia/src/components/form-label/__tests__/FormLabel.test.tsx
index b9ff7342b80..6f97d74ae33 100644
--- a/packages/dnb-eufemia/src/components/form-label/__tests__/FormLabel.test.tsx
+++ b/packages/dnb-eufemia/src/components/form-label/__tests__/FormLabel.test.tsx
@@ -18,10 +18,10 @@ describe('FormLabel component', () => {
it('should forward unlisted attributes like "aria-hidden"', () => {
render( )
expect(
- document.querySelector('label[aria-hidden]')
+ document.querySelector('label[aria-hidden]'),
).toBeInTheDocument()
expect(document.querySelector('label[aria-hidden]')).toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
})
@@ -51,12 +51,12 @@ describe('FormLabel component', () => {
render(
-
+ ,
)
const element = document.querySelector('.dnb-form-label')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class', 'label'])
@@ -86,7 +86,7 @@ describe('FormLabel scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-form-label-theme-ui.scss')
+ require.resolve('../style/themes/dnb-form-label-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/form-row/FormRow.js b/packages/dnb-eufemia/src/components/form-row/FormRow.js
index bd7de9663e6..7cad73c858a 100644
--- a/packages/dnb-eufemia/src/components/form-row/FormRow.js
+++ b/packages/dnb-eufemia/src/components/form-row/FormRow.js
@@ -137,7 +137,7 @@ export default class FormRow extends React.PureComponent {
const props = extendPropsWithContextInClassComponent(
this.props,
FormRow.defaultProps,
- this.context.FormRow // nested FormRow
+ this.context.FormRow, // nested FormRow
)
const {
@@ -197,7 +197,7 @@ export default class FormRow extends React.PureComponent {
isNested && 'dnb-form-row--nested',
createSpacingClasses(props),
className,
- _className
+ _className,
),
...attributes,
}
@@ -270,7 +270,7 @@ export default class FormRow extends React.PureComponent {
'dnb-form-row__content',
isTrue(wrap) && 'dnb-form-row__content--wrap',
label && !isTrue(vertical) && direction !== 'vertical',
- responsive && 'dnb-responsive-component'
+ responsive && 'dnb-responsive-component',
)}
>
{children}
diff --git a/packages/dnb-eufemia/src/components/form-row/FormRowHelpers.tsx b/packages/dnb-eufemia/src/components/form-row/FormRowHelpers.tsx
index 6bb52b54de1..61a6a8d2a9f 100644
--- a/packages/dnb-eufemia/src/components/form-row/FormRowHelpers.tsx
+++ b/packages/dnb-eufemia/src/components/form-row/FormRowHelpers.tsx
@@ -24,7 +24,7 @@ const validFormRowProps = {
export const includeValidProps = (
props: FormRowProps,
- excludeProps?: Record
+ excludeProps?: Record,
) => {
return filterValidProps(props, validFormRowProps, excludeProps)
}
diff --git a/packages/dnb-eufemia/src/components/form-row/__tests__/FormRow.test.tsx b/packages/dnb-eufemia/src/components/form-row/__tests__/FormRow.test.tsx
index 7f4a0d0cb67..040625b9e38 100644
--- a/packages/dnb-eufemia/src/components/form-row/__tests__/FormRow.test.tsx
+++ b/packages/dnb-eufemia/src/components/form-row/__tests__/FormRow.test.tsx
@@ -19,7 +19,7 @@ describe('FormRow component', () => {
it('should have vertical direction class', () => {
render( )
expect(document.querySelector('.dnb-form-row').classList).toContain(
- 'dnb-form-row--vertical'
+ 'dnb-form-row--vertical',
)
})
@@ -31,16 +31,16 @@ describe('FormRow component', () => {
-
+ ,
)
expect(
- document.querySelectorAll('span.dnb-input')[0].classList
+ document.querySelectorAll('span.dnb-input')[0].classList,
).toContain('dnb-input--vertical')
expect(
- document.querySelectorAll('span.dnb-input')[1].classList
+ document.querySelectorAll('span.dnb-input')[1].classList,
).toContain('dnb-input--horizontal')
expect(
- document.querySelectorAll('span.dnb-input')[2].classList
+ document.querySelectorAll('span.dnb-input')[2].classList,
).toContain('dnb-input--vertical')
})
@@ -62,25 +62,25 @@ describe('FormRow component', () => {
const { rerender } = render(
1234
-
+ ,
)
expect(
document
.querySelector('.dnb-number-format')
- .querySelector('.dnb-number-format__visible').textContent
+ .querySelector('.dnb-number-format__visible').textContent,
).toBe('1Ā 234,00 kr')
rerender(
1234
-
+ ,
)
expect(
document
.querySelector('.dnb-number-format')
- .querySelector('.dnb-number-format__visible').textContent
+ .querySelector('.dnb-number-format__visible').textContent,
).toBe('NOKĀ 1Ā 234.00')
})
@@ -90,13 +90,13 @@ describe('FormRow component', () => {
1234
-
+ ,
)
expect(
document
.querySelector('.dnb-number-format')
- .querySelector('.dnb-number-format__visible').textContent
+ .querySelector('.dnb-number-format__visible').textContent,
).toBe('NOKĀ 1Ā 234.00')
})
@@ -104,12 +104,12 @@ describe('FormRow component', () => {
const { rerender } = render(
-
+ ,
)
rerender(
-
+ ,
)
expect(document.querySelector('input[disabled]')).toBeInTheDocument()
})
@@ -128,7 +128,7 @@ describe('FormRow scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-form-row-theme-ui.scss')
+ require.resolve('../style/themes/dnb-form-row-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/form-set/FormSet.js b/packages/dnb-eufemia/src/components/form-set/FormSet.js
index 8bce576c6c7..839375ad8ec 100644
--- a/packages/dnb-eufemia/src/components/form-set/FormSet.js
+++ b/packages/dnb-eufemia/src/components/form-set/FormSet.js
@@ -69,7 +69,7 @@ export default class FormSet extends React.PureComponent {
const props = extendPropsWithContextInClassComponent(
this.props,
FormSet.defaultProps,
- this.context.FormSet
+ this.context.FormSet,
)
const {
@@ -107,7 +107,7 @@ export default class FormSet extends React.PureComponent {
'dnb-form-set',
createSpacingClasses(this.props),
className,
- _className
+ _className,
),
...attributes,
}
diff --git a/packages/dnb-eufemia/src/components/form-set/__tests__/FormSet.test.tsx b/packages/dnb-eufemia/src/components/form-set/__tests__/FormSet.test.tsx
index 6bfe221097d..8e8396e73f9 100644
--- a/packages/dnb-eufemia/src/components/form-set/__tests__/FormSet.test.tsx
+++ b/packages/dnb-eufemia/src/components/form-set/__tests__/FormSet.test.tsx
@@ -28,10 +28,10 @@ describe('FormSet component', () => {
render(
-
+ ,
)
expect(document.querySelector('.dnb-form-row').classList).toContain(
- 'dnb-form-row--vertical'
+ 'dnb-form-row--vertical',
)
})
@@ -41,10 +41,10 @@ describe('FormSet component', () => {
-
+ ,
)
expect(
- document.querySelector('input.dnb-input__input[disabled]')
+ document.querySelector('input.dnb-input__input[disabled]'),
).toBeInTheDocument()
rerender(
@@ -52,10 +52,10 @@ describe('FormSet component', () => {
-
+ ,
)
expect(
- document.querySelector('input.dnb-input__input[disabled]')
+ document.querySelector('input.dnb-input__input[disabled]'),
).not.toBeInTheDocument()
rerender(
@@ -63,10 +63,10 @@ describe('FormSet component', () => {
-
+ ,
)
expect(
- document.querySelector('input.dnb-input__input[disabled]')
+ document.querySelector('input.dnb-input__input[disabled]'),
).toBeInTheDocument()
rerender(
@@ -74,11 +74,11 @@ describe('FormSet component', () => {
-
+ ,
)
expect(
- document.querySelector('input.dnb-input__input[disabled]')
+ document.querySelector('input.dnb-input__input[disabled]'),
).not.toBeInTheDocument()
})
@@ -86,25 +86,25 @@ describe('FormSet component', () => {
const { rerender } = render(
1234
-
+ ,
)
expect(
document
.querySelector('.dnb-number-format')
- .querySelector('.dnb-number-format__visible').textContent
+ .querySelector('.dnb-number-format__visible').textContent,
).toBe('1Ā 234,00 kr')
rerender(
1234
-
+ ,
)
expect(
document
.querySelector('.dnb-number-format')
- .querySelector('.dnb-number-format__visible').textContent
+ .querySelector('.dnb-number-format__visible').textContent,
).toBe('NOKĀ 1Ā 234.00')
})
@@ -114,13 +114,13 @@ describe('FormSet component', () => {
1234
-
+ ,
)
expect(
document
.querySelector('.dnb-number-format')
- .querySelector('.dnb-number-format__visible').textContent
+ .querySelector('.dnb-number-format__visible').textContent,
).toBe('NOKĀ 1Ā 234.00')
})
@@ -138,7 +138,7 @@ describe('FormSet scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-form-set-theme-ui.scss')
+ require.resolve('../style/themes/dnb-form-set-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/form-status/FormStatus.js b/packages/dnb-eufemia/src/components/form-status/FormStatus.js
index da43f6e5993..9692d6a2ef8 100644
--- a/packages/dnb-eufemia/src/components/form-status/FormStatus.js
+++ b/packages/dnb-eufemia/src/components/form-status/FormStatus.js
@@ -195,7 +195,7 @@ export default class FormStatus extends React.PureComponent {
},
})
}
- }
+ },
)
this._ref = React.createRef()
@@ -283,7 +283,7 @@ export default class FormStatus extends React.PureComponent {
},
{
preventRestack: true, // because of the internal "close"
- }
+ },
)
} else if (!FormStatus.getContent(this.props)) {
const status_id = this.getStatusId()
@@ -336,7 +336,7 @@ export default class FormStatus extends React.PureComponent {
FormStatus.defaultProps,
{ skeleton: this.context && this.context.skeleton },
includeValidProps(this.context.FormRow),
- this.context.FormStatus
+ this.context.FormStatus,
)
const {
@@ -370,7 +370,7 @@ export default class FormStatus extends React.PureComponent {
state,
icon,
icon_size,
- theme: this.context?.theme?.name
+ theme: this.context?.theme?.name,
})
const contentToRender =
@@ -404,7 +404,7 @@ export default class FormStatus extends React.PureComponent {
hasStringContent ? 'dnb-form-status--has-content' : null,
createSpacingClasses(props),
className,
- _className
+ _className,
),
id: !String(id).startsWith('null') ? this.state.id : null,
title,
@@ -425,7 +425,7 @@ export default class FormStatus extends React.PureComponent {
const textParams = {
className: classnames(
'dnb-form-status__text',
- createSkeletonClass('font', skeleton, this.context)
+ createSkeletonClass('font', skeleton, this.context),
),
id: !String(text_id).startsWith('null') ? text_id : null,
}
@@ -501,8 +501,8 @@ WarnIcon.defaultProps = {
title: 'error',
}
-export const InfoIcon = props => {
- const isSbankenTheme = props && props?.theme === 'sbanken';
+export const InfoIcon = (props) => {
+ const isSbankenTheme = props && props?.theme === 'sbanken'
let fill = isSbankenTheme ? '#000' : '#007272'
if (props && props?.state === 'success') {
fill = isSbankenTheme ? '#02A56A' : '#28B482'
@@ -536,7 +536,7 @@ InfoIcon.propTypes = {
InfoIcon.defaultProps = {
title: 'info',
state: 'info',
- theme: 'ui'
+ theme: 'ui',
}
export const MarketingIcon = (props) => (
diff --git a/packages/dnb-eufemia/src/components/form-status/__tests__/FormStatus.test.tsx b/packages/dnb-eufemia/src/components/form-status/__tests__/FormStatus.test.tsx
index 474583aff57..d6f9e0509b7 100644
--- a/packages/dnb-eufemia/src/components/form-status/__tests__/FormStatus.test.tsx
+++ b/packages/dnb-eufemia/src/components/form-status/__tests__/FormStatus.test.tsx
@@ -19,24 +19,24 @@ describe('FormStatus component', () => {
+ />,
)
expect(
- document.querySelector('.dnb-input__input').getAttribute('style')
+ document.querySelector('.dnb-input__input').getAttribute('style'),
).toBe('width: 10rem;')
expect(
- document.querySelector('.dnb-form-status').getAttribute('style')
+ document.querySelector('.dnb-form-status').getAttribute('style'),
).toContain('max-width: 30rem;')
})
it('should re-calculate max-width', () => {
const { rerender } = render(
-
+ ,
)
expect(
- document.querySelector('.dnb-form-status').getAttribute('style')
+ document.querySelector('.dnb-form-status').getAttribute('style'),
).toBe('max-width: 30rem;')
rerender(
@@ -44,11 +44,11 @@ describe('FormStatus component', () => {
status="status message"
status_props={{ text: 'change width to 35rem' }}
style={{ width: '35rem' }}
- />
+ />,
)
expect(
- document.querySelector('.dnb-form-status').getAttribute('style')
+ document.querySelector('.dnb-form-status').getAttribute('style'),
).toBe('max-width: 35rem; height: auto;')
rerender(
@@ -56,11 +56,11 @@ describe('FormStatus component', () => {
status="status message"
status_props={{ text: 'change width to 40rem' }}
style={{ width: '40rem' }}
- />
+ />,
)
expect(
- document.querySelector('.dnb-form-status').getAttribute('style')
+ document.querySelector('.dnb-form-status').getAttribute('style'),
).toBe('max-width: 40rem; height: auto;')
rerender(
@@ -68,13 +68,13 @@ describe('FormStatus component', () => {
status="status message"
status_props={{ text: 'change width to 10rem' }}
style={{ width: '10rem' }}
- />
+ />,
)
window.dispatchEvent(new Event('resize'))
expect(
- document.querySelector('.dnb-form-status').getAttribute('style')
+ document.querySelector('.dnb-form-status').getAttribute('style'),
).toBe('max-width: 30rem; height: auto;')
})
@@ -82,10 +82,10 @@ describe('FormStatus component', () => {
render()
expect(
- document.querySelector('.dnb-form-status').getAttribute('id')
+ document.querySelector('.dnb-form-status').getAttribute('id'),
).toBe('custom-id-form-status')
expect(
- document.querySelector('.dnb-form-status__text').getAttribute('id')
+ document.querySelector('.dnb-form-status__text').getAttribute('id'),
).toBe('custom-id-status')
})
@@ -96,10 +96,10 @@ describe('FormStatus component', () => {
status_props={{
variant: 'outlined',
}}
- />
+ />,
)
expect(document.querySelector('.dnb-form-status').classList).toContain(
- 'dnb-form-status__variant--outlined'
+ 'dnb-form-status__variant--outlined',
)
})
@@ -109,26 +109,26 @@ describe('FormStatus component', () => {
rerender(content-a )
expect(document.querySelector('.dnb-form-status').textContent).toBe(
- 'content-a'
+ 'content-a',
)
rerender(content-b )
expect(document.querySelector('.dnb-form-status').textContent).toBe(
- 'content-b'
+ 'content-b',
)
})
it('should have correct attributes once the "hidden" prop changes', async () => {
const { rerender } = render( )
expect(
- document.querySelector('.dnb-form-status[hidden]')
+ document.querySelector('.dnb-form-status[hidden]'),
).toBeInTheDocument()
rerender( )
expect(
- document.querySelector('.dnb-form-status[hidden]')
+ document.querySelector('.dnb-form-status[hidden]'),
).not.toBeInTheDocument()
})
@@ -136,7 +136,7 @@ describe('FormStatus component', () => {
render( )
expect(
- document.querySelector('.dnb-form-status__text').textContent
+ document.querySelector('.dnb-form-status__text').textContent,
).toBe(props.text)
})
@@ -163,7 +163,7 @@ describe('FormStatus scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-form-status-theme-ui.scss')
+ require.resolve('../style/themes/dnb-form-status-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
@@ -174,7 +174,7 @@ describe('FormStatus role', () => {
render( )
expect(
- document.querySelector('.dnb-form-status').getAttribute('role')
+ document.querySelector('.dnb-form-status').getAttribute('role'),
).toBe('alert')
})
@@ -182,7 +182,7 @@ describe('FormStatus role', () => {
render( )
expect(
- document.querySelector('.dnb-form-status').getAttribute('role')
+ document.querySelector('.dnb-form-status').getAttribute('role'),
).toBe('status')
})
@@ -190,10 +190,10 @@ describe('FormStatus role', () => {
render( )
expect(
- document.querySelector('.dnb-form-status').getAttribute('role')
+ document.querySelector('.dnb-form-status').getAttribute('role'),
).not.toBe('alert')
expect(
- document.querySelector('.dnb-form-status').getAttribute('role')
+ document.querySelector('.dnb-form-status').getAttribute('role'),
).toBe('none')
})
diff --git a/packages/dnb-eufemia/src/components/form-status/style/dnb-form-status.scss b/packages/dnb-eufemia/src/components/form-status/style/dnb-form-status.scss
index f0af39b0944..acc7e4ce992 100644
--- a/packages/dnb-eufemia/src/components/form-status/style/dnb-form-status.scss
+++ b/packages/dnb-eufemia/src/components/form-status/style/dnb-form-status.scss
@@ -12,8 +12,10 @@
opacity: 1;
- transition: height 400ms var(--easing-default),
- opacity 400ms var(--easing-default), margin 400ms var(--easing-default),
+ transition:
+ height 400ms var(--easing-default),
+ opacity 400ms var(--easing-default),
+ margin 400ms var(--easing-default),
padding 400ms var(--easing-default);
&--hidden {
diff --git a/packages/dnb-eufemia/src/components/global-error/GlobalError.tsx b/packages/dnb-eufemia/src/components/global-error/GlobalError.tsx
index c120921a258..418d5149089 100644
--- a/packages/dnb-eufemia/src/components/global-error/GlobalError.tsx
+++ b/packages/dnb-eufemia/src/components/global-error/GlobalError.tsx
@@ -104,7 +104,7 @@ export default function GlobalError(localProps: GlobalErrorAllProps) {
context?.GlobalError,
translation,
translation[localProps.status || defaultProps.status],
- { skeleton: context?.skeleton }
+ { skeleton: context?.skeleton },
)
const {
@@ -138,7 +138,7 @@ export default function GlobalError(localProps: GlobalErrorAllProps) {
center && 'dnb-global-error--center',
createSpacingClasses(attributes),
className,
- spacingClasses
+ spacingClasses,
),
...attributes,
} as Record
diff --git a/packages/dnb-eufemia/src/components/global-error/__tests__/GlobalError.test.tsx b/packages/dnb-eufemia/src/components/global-error/__tests__/GlobalError.test.tsx
index 0b0d4403011..26bfe0b209e 100644
--- a/packages/dnb-eufemia/src/components/global-error/__tests__/GlobalError.test.tsx
+++ b/packages/dnb-eufemia/src/components/global-error/__tests__/GlobalError.test.tsx
@@ -25,9 +25,9 @@ describe('GlobalError', () => {
expect(
document.querySelector('.dnb-global-error__inner__content')
- .textContent
+ .textContent,
).toMatchInlineSnapshot(
- `"Vi finner ikke siden du leter etter ā¦Sikker pĆ„ at du har skrevet riktig adresse? Eller har vi rotet med lenkene?Feilmeldings-kode: 404"`
+ `"Vi finner ikke siden du leter etter ā¦Sikker pĆ„ at du har skrevet riktig adresse? Eller har vi rotet med lenkene?Feilmeldings-kode: 404"`,
)
})
@@ -36,9 +36,9 @@ describe('GlobalError', () => {
expect(
document.querySelector('.dnb-global-error__inner__content')
- .textContent
+ .textContent,
).toMatchInlineSnapshot(
- `"Beklager, her skjedde det noe feil!Tjenesten fungerer ikke slik den skal for Ćøyeblikket, men prĆøv igjen senere.Feilmeldings-kode: 500"`
+ `"Beklager, her skjedde det noe feil!Tjenesten fungerer ikke slik den skal for Ćøyeblikket, men prĆøv igjen senere.Feilmeldings-kode: 500"`,
)
})
@@ -47,9 +47,9 @@ describe('GlobalError', () => {
expect(
document.querySelector('.dnb-global-error__inner__content')
- .textContent
+ .textContent,
).toMatchInlineSnapshot(
- `"We can't find the page you're looking for ā¦Are you sure you have entered the correct address? Or have we messed with the links?Error code: 404"`
+ `"We can't find the page you're looking for ā¦Are you sure you have entered the correct address? Or have we messed with the links?Error code: 404"`,
)
})
@@ -57,14 +57,14 @@ describe('GlobalError', () => {
render(
-
+ ,
)
expect(
document.querySelector('.dnb-global-error__inner__content')
- .textContent
+ .textContent,
).toMatchInlineSnapshot(
- `"Sorry, a technical error happened!The service is not working properly at the moment. Try again later.Error code: 500"`
+ `"Sorry, a technical error happened!The service is not working properly at the moment. Try again later.Error code: 500"`,
)
})
@@ -73,11 +73,11 @@ describe('GlobalError', () => {
expect(
document.querySelector('.dnb-global-error__inner__content h1')
- .textContent
+ .textContent,
).toBe('title')
expect(
document.querySelector('.dnb-global-error__inner__content .dnb-p')
- .textContent
+ .textContent,
).toBe('text')
})
@@ -86,7 +86,7 @@ describe('GlobalError', () => {
const elem = document.querySelector('.dnb-global-error__status')
expect(elem.textContent).toMatchInlineSnapshot(
- `"Feilmeldings-kode: 404"`
+ `"Feilmeldings-kode: 404"`,
)
expect(elem.querySelector('code').textContent).toBe('404')
})
@@ -97,11 +97,11 @@ describe('GlobalError', () => {
render(
-
+ ,
)
expect(document.querySelector('.dnb-p').className).toMatch(
- skeletonClassName
+ skeletonClassName,
)
})
@@ -124,7 +124,7 @@ describe('GlobalError', () => {
const element = document.querySelector('.dnb-global-error')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class', 'aria-label', 'lang'])
@@ -138,14 +138,14 @@ describe('GlobalError', () => {
{ text: 'Anchor 1', url: 'http://' },
{ text: 'Anchor 2', url: 'http://' },
]}
- />
+ />,
)
const elem = document.querySelector('.dnb-global-error__links')
expect(elem).toBeInTheDocument()
expect(elem.previousSibling.textContent).toMatchInlineSnapshot(
- `"Her er noen lenker som kanskje kan hjelpe:"`
+ `"Her er noen lenker som kanskje kan hjelpe:"`,
)
expect(elem.textContent).toMatchInlineSnapshot(`"Anchor 1Anchor 2"`)
expect(elem.querySelectorAll('a.dnb-anchor')).toHaveLength(2)
@@ -165,7 +165,7 @@ describe('GlobalError scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-global-error-theme-ui.scss')
+ require.resolve('../style/themes/dnb-global-error-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/global-status/GlobalStatus.js b/packages/dnb-eufemia/src/components/global-status/GlobalStatus.js
index 75adcc3ceef..d4308c38a16 100644
--- a/packages/dnb-eufemia/src/components/global-status/GlobalStatus.js
+++ b/packages/dnb-eufemia/src/components/global-status/GlobalStatus.js
@@ -220,7 +220,7 @@ export default class GlobalStatus extends React.PureComponent {
dispatchCustomElementEvent(
this._globalStatus,
'on_show',
- this._globalStatus
+ this._globalStatus,
)
if (state === 'opened') {
@@ -229,7 +229,7 @@ export default class GlobalStatus extends React.PureComponent {
dispatchCustomElementEvent(
this._globalStatus,
'on_open',
- this._globalStatus
+ this._globalStatus,
)
}
@@ -241,7 +241,7 @@ export default class GlobalStatus extends React.PureComponent {
dispatchCustomElementEvent(
this._globalStatus,
'on_adjust',
- this._globalStatus
+ this._globalStatus,
)
}
} else {
@@ -251,7 +251,7 @@ export default class GlobalStatus extends React.PureComponent {
dispatchCustomElementEvent(
this._globalStatus,
'on_close',
- this._globalStatus
+ this._globalStatus,
)
}
})
@@ -352,7 +352,7 @@ export default class GlobalStatus extends React.PureComponent {
const globalStatus = extendPropsWithContextInClassComponent(
this.props,
GlobalStatus.defaultProps,
- this.state.globalStatus
+ this.state.globalStatus,
)
this.setState({
globalStatus,
@@ -397,7 +397,7 @@ export default class GlobalStatus extends React.PureComponent {
},
() => {
this.anim.open()
- }
+ },
)
}
@@ -428,7 +428,7 @@ export default class GlobalStatus extends React.PureComponent {
isClosing: false,
isActive: false,
},
- () => this.anim.close()
+ () => this.anim.close(),
)
}
@@ -481,7 +481,7 @@ export default class GlobalStatus extends React.PureComponent {
dispatchCustomElementEvent(
this._globalStatus,
'on_hide',
- this._globalStatus
+ this._globalStatus,
)
}
@@ -637,7 +637,7 @@ export default class GlobalStatus extends React.PureComponent {
const fallbackProps = extendPropsWithContextInClassComponent(
this.props,
GlobalStatus.defaultProps,
- this.context.getTranslation(this.props).GlobalStatus
+ this.context.getTranslation(this.props).GlobalStatus,
)
const props = extendPropsWithContextInClassComponent(
@@ -646,7 +646,7 @@ export default class GlobalStatus extends React.PureComponent {
this.state.globalStatus,
]),
GlobalStatus.defaultProps,
- fallbackProps
+ fallbackProps,
)
const lang = this.context.locale
@@ -687,7 +687,7 @@ export default class GlobalStatus extends React.PureComponent {
createSkeletonClass('font', skeleton, this.context),
createSpacingClasses(props),
className,
- _className
+ _className,
),
'aria-live': isActive ? 'assertive' : 'off',
onKeyDown: this.onKeyDownHandler,
@@ -699,7 +699,7 @@ export default class GlobalStatus extends React.PureComponent {
state,
icon: icon || fallbackProps.icon,
icon_size: icon_size || fallbackProps.icon_size,
- theme: this.context?.theme?.name || 'ui'
+ theme: this.context?.theme?.name || 'ui',
})
const titleToRender =
title || fallbackProps.title || fallbackProps.default_title
@@ -728,7 +728,7 @@ export default class GlobalStatus extends React.PureComponent {
!isActive && 'dnb-global-status--hidden',
isActive && keepContentVisible && 'dnb-global-status--visible',
isAnimating && 'dnb-global-status--is-animating',
- noAnimation && 'dnb-global-status--no-animation'
+ noAnimation && 'dnb-global-status--no-animation',
),
...attributes,
}
@@ -741,7 +741,7 @@ export default class GlobalStatus extends React.PureComponent {
const renderedItems = itemsToRender.length > 0 && (
{itemsToRender.map(
- this.itemsRenderHandler({ status_anchor_text, lang })
+ this.itemsRenderHandler({ status_anchor_text, lang }),
)}
)
diff --git a/packages/dnb-eufemia/src/components/global-status/GlobalStatusProvider.js b/packages/dnb-eufemia/src/components/global-status/GlobalStatusProvider.js
index 8c20252de64..ac3664e5e83 100644
--- a/packages/dnb-eufemia/src/components/global-status/GlobalStatusProvider.js
+++ b/packages/dnb-eufemia/src/components/global-status/GlobalStatusProvider.js
@@ -29,7 +29,7 @@ export class GlobalStatusProviderItem {
forceRerender(
globalStatus,
props,
- { buffer_delay = 0, isEmpty = false } = {}
+ { buffer_delay = 0, isEmpty = false } = {},
) {
const run = () => {
this._onUpdateEvents.forEach((event) => {
@@ -75,7 +75,7 @@ export class GlobalStatusProviderItem {
// replace the props if exists
const stackIndex = this.stack.findIndex(
- (cur) => cur.status_id === newProps.status_id
+ (cur) => cur.status_id === newProps.status_id,
)
if (stackIndex > -1) {
this.stack[stackIndex] = newProps
@@ -183,7 +183,7 @@ export class GlobalStatusProviderItem {
}
this._onReadyEvents[i] = null
return false
- }
+ },
)
return true
@@ -291,7 +291,7 @@ class GlobalStatusProvider {
item = GlobalStatusProvider.prepareItemWithStatusId(item)
const foundAtIndex = _acc.findIndex(
- ({ item_id }) => item_id === item.item_id
+ ({ item_id }) => item_id === item.item_id,
)
if (foundAtIndex > -1) {
_acc[foundAtIndex] = item
diff --git a/packages/dnb-eufemia/src/components/global-status/__tests__/GlobalStatus.screenshot.test.ts b/packages/dnb-eufemia/src/components/global-status/__tests__/GlobalStatus.screenshot.test.ts
index adb730b810e..b3e5f5c5bd5 100644
--- a/packages/dnb-eufemia/src/components/global-status/__tests__/GlobalStatus.screenshot.test.ts
+++ b/packages/dnb-eufemia/src/components/global-status/__tests__/GlobalStatus.screenshot.test.ts
@@ -10,10 +10,10 @@ import {
const style = { width: '25rem' }
-describe.each(['ui', 'sbanken'])('GlobalStatus for %s', themeName => {
+describe.each(['ui', 'sbanken'])('GlobalStatus for %s', (themeName) => {
setupPageScreenshot({
themeName,
- url: '/uilib/components/global-status/demos'
+ url: '/uilib/components/global-status/demos',
})
it('have to match the default state with custom content', async () => {
diff --git a/packages/dnb-eufemia/src/components/global-status/__tests__/GlobalStatus.test.tsx b/packages/dnb-eufemia/src/components/global-status/__tests__/GlobalStatus.test.tsx
index 4cf43ae2756..02ca801e687 100644
--- a/packages/dnb-eufemia/src/components/global-status/__tests__/GlobalStatus.test.tsx
+++ b/packages/dnb-eufemia/src/components/global-status/__tests__/GlobalStatus.test.tsx
@@ -35,27 +35,27 @@ describe('GlobalStatus component', () => {
expect(
document
.querySelector('div.dnb-global-status__message')
- .querySelectorAll('.dnb-p')[0].textContent
+ .querySelectorAll('.dnb-p')[0].textContent,
).toBe(props.text)
})
it('has to have list items as defined in the prop', () => {
render( )
expect(document.querySelector('.dnb-ul').textContent).toBe(
- props.items.map(({ text }) => text).join('')
+ props.items.map(({ text }) => text).join(''),
)
})
it('should have correct attributes like "aria-live"', async () => {
const { rerender } = render(
-
+ ,
)
expect(document.querySelector('[aria-live]')).toBeInTheDocument()
rerender( )
expect(
- document.querySelector('[aria-live="assertive"]')
+ document.querySelector('[aria-live="assertive"]'),
).toBeInTheDocument()
rerender( )
@@ -63,7 +63,7 @@ describe('GlobalStatus component', () => {
expect(
document
.querySelector('.dnb-global-status__wrapper')
- .getAttribute('aria-live')
+ .getAttribute('aria-live'),
).toBe('off')
})
@@ -95,25 +95,25 @@ describe('GlobalStatus component', () => {
item={{ text: 'item#3' }}
on_close={jest.fn()}
/>
- >
+ >,
)
expect(
document.querySelector(
- 'div.dnb-global-status__message__content > .dnb-p'
- ).textContent
+ 'div.dnb-global-status__message__content > .dnb-p',
+ ).textContent,
).toBe(newText)
expect(
document.querySelector(
- 'div.dnb-global-status__message__content > .dnb-ul'
- ).textContent
+ 'div.dnb-global-status__message__content > .dnb-ul',
+ ).textContent,
).toBe('item#1item#3')
expect(
document.querySelectorAll(
- 'div.dnb-global-status__message p.dnb-p'
- )[0].textContent
+ 'div.dnb-global-status__message p.dnb-p',
+ )[0].textContent,
).toBe(newText)
})
@@ -129,7 +129,7 @@ describe('GlobalStatus component', () => {
delay={0}
no_animation={true}
id="custom-status-update"
- />
+ />,
)
render(
@@ -139,7 +139,7 @@ describe('GlobalStatus component', () => {
text={startupText}
items={startupItems}
on_close={jest.fn()}
- />
+ />,
)
const ulItems = document.querySelectorAll('ul.dnb-ul li')
@@ -147,8 +147,8 @@ describe('GlobalStatus component', () => {
expect(ulItems[1].textContent).toBe('Item2')
expect(
document.querySelectorAll(
- 'div.dnb-global-status__message p.dnb-p'
- )[0].textContent
+ 'div.dnb-global-status__message p.dnb-p',
+ )[0].textContent,
).toBe(startupText)
render(
@@ -158,7 +158,7 @@ describe('GlobalStatus component', () => {
text={newText}
items={newItems}
on_close={jest.fn()}
- />
+ />,
)
const newUlItems = document.querySelectorAll('ul.dnb-ul li')
@@ -166,8 +166,8 @@ describe('GlobalStatus component', () => {
expect(newUlItems[1].textContent).toBe('Item4')
expect(
document.querySelectorAll(
- 'div.dnb-global-status__message p.dnb-p'
- )[0].textContent
+ 'div.dnb-global-status__message p.dnb-p',
+ )[0].textContent,
).toBe(newText)
render(
@@ -175,11 +175,11 @@ describe('GlobalStatus component', () => {
id="custom-status-update"
status_id="status-update-1"
buffer_delay={0}
- />
+ />,
)
expect(
- document.querySelector('div.dnb-global-status__message')
+ document.querySelector('div.dnb-global-status__message'),
).not.toBeInTheDocument()
})
@@ -195,14 +195,14 @@ describe('GlobalStatus component', () => {
delay={0}
no_animation={true}
id="custom-status-remove"
- />
+ />,
)
expect(
- document.querySelector('div.dnb-global-status__shell').innerHTML
+ document.querySelector('div.dnb-global-status__shell').innerHTML,
).toBe('')
expect(
- document.querySelector('div.dnb-global-status__shell')
+ document.querySelector('div.dnb-global-status__shell'),
).not.toHaveAttribute('style')
render(
@@ -212,7 +212,7 @@ describe('GlobalStatus component', () => {
text={startupText}
items={startupItems}
on_close={jest.fn()}
- />
+ />,
)
const ulItems = document.querySelectorAll('ul.dnb-ul li')
@@ -220,11 +220,11 @@ describe('GlobalStatus component', () => {
expect(ulItems[1].textContent).toBe('Item2')
expect(
document.querySelectorAll(
- 'div.dnb-global-status__message p.dnb-p'
- )[0].textContent
+ 'div.dnb-global-status__message p.dnb-p',
+ )[0].textContent,
).toBe(startupText)
expect(
- document.querySelector('div.dnb-global-status__message')
+ document.querySelector('div.dnb-global-status__message'),
).toBeInTheDocument()
render(
@@ -234,7 +234,7 @@ describe('GlobalStatus component', () => {
text={newText}
items={newItems}
on_close={jest.fn()}
- />
+ />,
)
const newUlItems = document.querySelectorAll('ul.dnb-ul li')
@@ -242,11 +242,11 @@ describe('GlobalStatus component', () => {
expect(newUlItems[3].textContent).toBe('Item4')
expect(
document.querySelectorAll(
- 'div.dnb-global-status__message p.dnb-p'
- )[0].textContent
+ 'div.dnb-global-status__message p.dnb-p',
+ )[0].textContent,
).toBe(newText)
expect(
- document.querySelectorAll('div.dnb-global-status__message p.dnb-p')
+ document.querySelectorAll('div.dnb-global-status__message p.dnb-p'),
).toHaveLength(5)
render(
@@ -254,7 +254,7 @@ describe('GlobalStatus component', () => {
id="custom-status-remove"
status_id="status-remove-1"
buffer_delay={0}
- />
+ />,
)
const removedUlItems = document.querySelectorAll('ul.dnb-ul li')
@@ -264,11 +264,11 @@ describe('GlobalStatus component', () => {
expect(removedUlItems[3]).toBeFalsy()
expect(
document.querySelectorAll(
- 'div.dnb-global-status__message p.dnb-p'
- )[0].textContent
+ 'div.dnb-global-status__message p.dnb-p',
+ )[0].textContent,
).toBe(newText)
expect(
- document.querySelectorAll('div.dnb-global-status__message p.dnb-p')
+ document.querySelectorAll('div.dnb-global-status__message p.dnb-p'),
).toHaveLength(3)
render(
@@ -276,16 +276,16 @@ describe('GlobalStatus component', () => {
id="custom-status-remove"
status_id="status-remove-2"
buffer_delay={0}
- />
+ />,
)
expect(
- document.querySelector('div.dnb-global-status__message')
+ document.querySelector('div.dnb-global-status__message'),
).not.toBeInTheDocument()
expect(
document
.querySelector('div.dnb-global-status__shell')
- .getAttribute('style')
+ .getAttribute('style'),
).toBe('height: 0px; visibility: hidden;')
})
@@ -348,7 +348,7 @@ describe('GlobalStatus component', () => {
- >
+ >,
)
await wait(1)
@@ -362,15 +362,15 @@ describe('GlobalStatus component', () => {
// FormStatus content
expect(
- document.querySelectorAll('.dnb-form-status__text')[0].textContent
+ document.querySelectorAll('.dnb-form-status__text')[0].textContent,
).toBe('error-message-1')
expect(
- document.querySelectorAll('.dnb-form-status__text')[1].textContent
+ document.querySelectorAll('.dnb-form-status__text')[1].textContent,
).toBe('error-message-2')
expect(
document
.querySelectorAll('.dnb-autocomplete')[0]
- .querySelector('.dnb-form-status__text').textContent
+ .querySelector('.dnb-form-status__text').textContent,
).toBe('error-message-3')
await refresh()
@@ -378,15 +378,15 @@ describe('GlobalStatus component', () => {
// GlobalStatus content
expect(
document.querySelectorAll('.dnb-global-status__message p')[0]
- .textContent
+ .textContent,
).toBe('error-message-1')
expect(
document.querySelectorAll('.dnb-global-status__message p')[1]
- .textContent
+ .textContent,
).toBe('error-message-2')
expect(
document.querySelectorAll('.dnb-global-status__message p')[2]
- .textContent
+ .textContent,
).toBe('error-message-3')
await wait(1)
@@ -399,22 +399,22 @@ describe('GlobalStatus component', () => {
fireEvent.blur(document.querySelector('input#autocomplete-3'))
expect(
- document.querySelector('.dnb-form-status__text')
+ document.querySelector('.dnb-form-status__text'),
).not.toBeInTheDocument()
await refresh()
expect(
- document.querySelector('.dnb-global-status__message p')
+ document.querySelector('.dnb-global-status__message p'),
).not.toBeInTheDocument()
expect(
- document.querySelector('.dnb-form-status__text')
+ document.querySelector('.dnb-form-status__text'),
).not.toBeInTheDocument()
const inst = document.querySelector('div.dnb-global-status__shell')
expect(inst.innerHTML).toBe('')
expect(inst.getAttribute('style')).toBe(
- 'height: 0px; visibility: hidden;'
+ 'height: 0px; visibility: hidden;',
)
})
@@ -442,7 +442,7 @@ describe('GlobalStatus component', () => {
<>
- >
+ >,
)
// Open
@@ -459,10 +459,10 @@ describe('GlobalStatus component', () => {
jest
.spyOn(
document.querySelector(
- '.dnb-global-status__wrapper'
+ '.dnb-global-status__wrapper',
) as HTMLElement,
'offsetTop',
- 'get'
+ 'get',
)
.mockImplementation(() => offsetTop)
@@ -513,7 +513,7 @@ describe('GlobalStatus component', () => {
on_close={on_close}
/>
- >
+ >,
)
// Open
@@ -550,7 +550,7 @@ describe('GlobalStatus component', () => {
<>
- >
+ >,
)
fireEvent.click(document.querySelector('input#switch'))
@@ -559,7 +559,7 @@ describe('GlobalStatus component', () => {
expect(
document
.querySelector('div.dnb-global-status__shell')
- .getAttribute('style')
+ .getAttribute('style'),
).toBe('height: auto;')
})
@@ -588,34 +588,34 @@ describe('GlobalStatus component', () => {
no_animation={true}
/>
- >
+ >,
)
fireEvent.click(document.querySelector('input#switch'))
await refresh()
expect(
- document.querySelector('.dnb-form-status__text').textContent
+ document.querySelector('.dnb-form-status__text').textContent,
).toBe('error-message')
expect(
- document.querySelector('.dnb-global-status__content')
+ document.querySelector('.dnb-global-status__content'),
).toBeInTheDocument()
expect(
- document.querySelector('.dnb-global-status__message p').textContent
+ document.querySelector('.dnb-global-status__message p').textContent,
).toBe('error-message')
fireEvent.click(document.querySelector('input#switch'))
await refresh()
expect(
- document.querySelector('.dnb-form-status__text')
+ document.querySelector('.dnb-form-status__text'),
).not.toBeInTheDocument()
const inst = document.querySelector('div.dnb-global-status__shell')
expect(inst.innerHTML).toBe('')
expect(inst.getAttribute('style')).toBe(
- 'height: 0px; visibility: hidden;'
+ 'height: 0px; visibility: hidden;',
)
})
@@ -633,7 +633,7 @@ describe('GlobalStatus component', () => {
const StatusAsComponent = React.forwardRef(
(props: { children: React.ReactNode }, ref) => {
return
- }
+ },
)
render(
@@ -642,7 +642,7 @@ describe('GlobalStatus component', () => {
autoscroll={false}
delay={0}
id="custom-status-element"
- />
+ />,
)
const provider = new GlobalStatusInterceptor({
@@ -673,9 +673,9 @@ describe('GlobalStatus component', () => {
await waitFor(() => {
expect(
document.querySelector('div.dnb-global-status__message')
- .textContent
+ .textContent,
).toBe(
- 'error-message--aGĆ„ til label--aerror-message--bGĆ„ til label--b'
+ 'error-message--aGĆ„ til label--aerror-message--bGĆ„ til label--b',
)
})
})
@@ -714,7 +714,7 @@ describe('GlobalStatus component', () => {
status_anchor_text={custom anchor text}
/>
- >
+ >,
)
fireEvent.click(document.querySelector('input#switch'))
@@ -723,12 +723,12 @@ describe('GlobalStatus component', () => {
expect(
document.querySelectorAll('.dnb-global-status__message p')[0]
- .textContent
+ .textContent,
).toBe("'error-message'")
expect(
document
.querySelectorAll('.dnb-global-status__message__content ul li')[0]
- .querySelector('a.dnb-anchor').textContent
+ .querySelector('a.dnb-anchor').textContent,
).toBe("custom anchor text 'my-label'")
})
@@ -747,7 +747,7 @@ describe('GlobalStatus component', () => {
on_open={on_open}
on_close={on_close}
on_hide={on_hide}
- />
+ />,
)
render(
@@ -756,16 +756,16 @@ describe('GlobalStatus component', () => {
status_id="status-autoclose-1"
text="text only"
on_close={jest.fn()}
- />
+ />,
)
expect(on_open.mock.calls.length).toBe(1)
expect(
- document.querySelector('div.dnb-global-status__message')
+ document.querySelector('div.dnb-global-status__message'),
).toBeInTheDocument()
expect(
- document.querySelector('div.dnb-global-status__message').textContent
+ document.querySelector('div.dnb-global-status__message').textContent,
).toBe('text only')
render(
@@ -775,11 +775,11 @@ describe('GlobalStatus component', () => {
text="text only"
items={['foo']}
on_close={jest.fn()}
- />
+ />,
)
expect(
- document.querySelector('div.dnb-global-status__message').textContent
+ document.querySelector('div.dnb-global-status__message').textContent,
).toBe('text onlyfoo')
render(
@@ -787,7 +787,7 @@ describe('GlobalStatus component', () => {
id="custom-status-autoclose"
status_id="status-autoclose-1"
buffer_delay={0}
- />
+ />,
)
expect(on_close.mock.calls.length).toBe(0)
@@ -797,14 +797,14 @@ describe('GlobalStatus component', () => {
id="custom-status-autoclose"
status_id="status-autoclose-2"
buffer_delay={0}
- />
+ />,
)
expect(on_close.mock.calls.length).toBe(1)
expect(on_hide.mock.calls.length).toBe(0)
expect(
- document.querySelector('div.dnb-global-status__message')
+ document.querySelector('div.dnb-global-status__message'),
).not.toBeInTheDocument()
render(
@@ -814,11 +814,11 @@ describe('GlobalStatus component', () => {
items={['foo']}
on_close={jest.fn()}
text="text"
- />
+ />,
)
fireEvent.click(
- document.querySelector('button.dnb-global-status__close-button')
+ document.querySelector('button.dnb-global-status__close-button'),
)
expect(on_hide.mock.calls.length).toBe(1)
@@ -832,15 +832,15 @@ describe('GlobalStatus component', () => {
autoscroll={false}
delay={0}
id="custom-status-show"
- />
+ />,
)
expect(
- document.querySelector('div.dnb-global-status__content')
+ document.querySelector('div.dnb-global-status__content'),
).not.toBeInTheDocument()
expect(
- document.querySelector('div.dnb-global-status__message__content')
+ document.querySelector('div.dnb-global-status__message__content'),
).not.toBeInTheDocument()
rerender(
@@ -850,14 +850,14 @@ describe('GlobalStatus component', () => {
autoscroll={false}
delay={0}
id="custom-status-show"
- />
+ />,
)
expect(
- document.querySelector('div.dnb-global-status__content')
+ document.querySelector('div.dnb-global-status__content'),
).toBeInTheDocument()
expect(
- document.querySelector('div.dnb-global-status__message__content')
+ document.querySelector('div.dnb-global-status__message__content'),
).not.toBeInTheDocument()
render(
@@ -866,11 +866,11 @@ describe('GlobalStatus component', () => {
status_id="status-show-1"
text="text only"
on_close={jest.fn()}
- />
+ />,
)
expect(
- document.querySelector('div.dnb-global-status__message__content')
+ document.querySelector('div.dnb-global-status__message__content'),
).toBeInTheDocument()
rerender(
@@ -880,21 +880,21 @@ describe('GlobalStatus component', () => {
autoscroll={false}
delay={0}
id="custom-status-show"
- />
+ />,
)
render(
+ />,
)
expect(
- document.querySelector('div.dnb-global-status__content')
+ document.querySelector('div.dnb-global-status__content'),
).not.toBeInTheDocument()
expect(
- document.querySelector('div.dnb-global-status__message__content')
+ document.querySelector('div.dnb-global-status__message__content'),
).not.toBeInTheDocument()
})
@@ -912,7 +912,7 @@ describe('GlobalStatus scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-global-status-theme-ui.scss')
+ require.resolve('../style/themes/dnb-global-status-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
@@ -929,6 +929,6 @@ const keydown = (keyCode) => {
document.querySelector('.dnb-global-status__wrapper'),
{
keyCode,
- }
+ },
)
}
diff --git a/packages/dnb-eufemia/src/components/global-status/style/dnb-global-status.scss b/packages/dnb-eufemia/src/components/global-status/style/dnb-global-status.scss
index 541c2c652a8..1ded52e2314 100644
--- a/packages/dnb-eufemia/src/components/global-status/style/dnb-global-status.scss
+++ b/packages/dnb-eufemia/src/components/global-status/style/dnb-global-status.scss
@@ -22,7 +22,8 @@
opacity: 1;
will-change: height;
- transition: height 800ms var(--global-status-easing),
+ transition:
+ height 800ms var(--global-status-easing),
opacity 600ms var(--global-status-easing);
}
diff --git a/packages/dnb-eufemia/src/components/global-status/style/themes/dnb-global-status-theme-sbanken.scss b/packages/dnb-eufemia/src/components/global-status/style/themes/dnb-global-status-theme-sbanken.scss
index 138016b07e9..d8586c82633 100644
--- a/packages/dnb-eufemia/src/components/global-status/style/themes/dnb-global-status-theme-sbanken.scss
+++ b/packages/dnb-eufemia/src/components/global-status/style/themes/dnb-global-status-theme-sbanken.scss
@@ -25,4 +25,4 @@
&--success &__content .dnb-hr {
color: var(--sb-color-green-dark-3);
}
-}
\ No newline at end of file
+}
diff --git a/packages/dnb-eufemia/src/components/global-status/style/themes/dnb-global-status-theme-ui.scss b/packages/dnb-eufemia/src/components/global-status/style/themes/dnb-global-status-theme-ui.scss
index 293045ecbaa..1766678515c 100644
--- a/packages/dnb-eufemia/src/components/global-status/style/themes/dnb-global-status-theme-ui.scss
+++ b/packages/dnb-eufemia/src/components/global-status/style/themes/dnb-global-status-theme-ui.scss
@@ -7,8 +7,11 @@
.dnb-global-status {
&:not(#{&}--no-animation)#{&}--fade-in#{&}.dnb-section::after {
- box-shadow: 99vw 0 0 0 currentcolor, 198vw 0 0 0 currentcolor,
- 297vw 0 0 0 currentcolor, 396vw 0 0 0 currentcolor,
+ box-shadow:
+ 99vw 0 0 0 currentcolor,
+ 198vw 0 0 0 currentcolor,
+ 297vw 0 0 0 currentcolor,
+ 396vw 0 0 0 currentcolor,
0 0.0625rem 0 0 var(--color-black-80),
100vw 0.0625rem 0 0 var(--color-black-80);
}
diff --git a/packages/dnb-eufemia/src/components/heading/Heading.tsx b/packages/dnb-eufemia/src/components/heading/Heading.tsx
index 04cd19e272d..77e484fcc43 100644
--- a/packages/dnb-eufemia/src/components/heading/Heading.tsx
+++ b/packages/dnb-eufemia/src/components/heading/Heading.tsx
@@ -288,7 +288,7 @@ export default function Heading(props: HeadingAllProps) {
`dnb-h--${size}`,
createSkeletonClass('font', skeleton, headingContext),
className,
- createSpacingClasses(props)
+ createSpacingClasses(props),
)}
>
{debug && (
diff --git a/packages/dnb-eufemia/src/components/heading/HeadingCounter.ts b/packages/dnb-eufemia/src/components/heading/HeadingCounter.ts
index 0286586ff7e..fafdfb4bc7f 100644
--- a/packages/dnb-eufemia/src/components/heading/HeadingCounter.ts
+++ b/packages/dnb-eufemia/src/components/heading/HeadingCounter.ts
@@ -162,7 +162,7 @@ export class Counter {
`Heading levels can only be changed by factor one! Got:`,
level,
'and had before',
- current
+ current,
)
if (level > current) {
@@ -213,7 +213,7 @@ export class Counter {
`Can not [${action}] heading level higher than 6! Got:`,
level,
'and had before',
- this.level
+ this.level,
)
level = 6
} else if (level < 1 && this.level !== -1) {
@@ -221,7 +221,7 @@ export class Counter {
`Can not [${action}] heading level lower than 1! Got:`,
level,
'and had before',
- this.level
+ this.level,
)
level = 1
} else if (!this.bypassChecks && level === 1 && this.level === 1) {
@@ -229,13 +229,13 @@ export class Counter {
`Can not set ([${action}]) heading level 1 several times! Got:`,
level,
'and had before',
- this.level
+ this.level,
)
level = 2
} else if (!this.bypassChecks && level < 2 && this.level === 2) {
report.push(
'Can not decrease to heading level 1! Had before',
- this.level
+ this.level,
)
level = this.level
}
diff --git a/packages/dnb-eufemia/src/components/heading/HeadingHelpers.ts b/packages/dnb-eufemia/src/components/heading/HeadingHelpers.ts
index c4829f8b9e3..af65f580eed 100644
--- a/packages/dnb-eufemia/src/components/heading/HeadingHelpers.ts
+++ b/packages/dnb-eufemia/src/components/heading/HeadingHelpers.ts
@@ -74,7 +74,7 @@ export const correctInternalHeadingLevel = ({
report(
debug,
source,
- 'Heading got inherit, but there was noting to inherit.'
+ 'Heading got inherit, but there was noting to inherit.',
)
}
}
@@ -158,13 +158,13 @@ function report(debug, source, ...reports) {
if (source) {
const props = source.props || {}
const identifiers = [props.id, props['class'], props.className].filter(
- Boolean
+ Boolean,
)
reports.push(
'\nNB: This warning was triggered by:',
identifiers.length > 0 ? identifiers.join(', ') : '',
- convertJsxToString(source)
+ convertJsxToString(source),
)
}
@@ -186,7 +186,7 @@ export const globalResetNextTime: { current: GlobalNextLevel } = {
}
export function resetLevels(
level: InternalHeadingLevel,
- { overwriteContext = false } = {}
+ { overwriteContext = false } = {},
) {
globalResetNextTime.current = { level, overwriteContext }
}
@@ -199,7 +199,7 @@ export const globalNextLevel: { current: GlobalNextLevel } = {
}
export function setNextLevel(
level: InternalHeadingLevel,
- { overwriteContext = false } = {}
+ { overwriteContext = false } = {},
) {
globalNextLevel.current = {
level,
@@ -233,6 +233,6 @@ export function debugCounter(counter) {
contextLEntry: counter.contextCounter.entry,
},
null,
- 2
+ 2,
)
}
diff --git a/packages/dnb-eufemia/src/components/heading/__tests__/Heading.test.tsx b/packages/dnb-eufemia/src/components/heading/__tests__/Heading.test.tsx
index a48c4f6ac92..1da24984c0f 100644
--- a/packages/dnb-eufemia/src/components/heading/__tests__/Heading.test.tsx
+++ b/packages/dnb-eufemia/src/components/heading/__tests__/Heading.test.tsx
@@ -53,7 +53,7 @@ describe('Heading component', () => {
Heading #12
-
+ ,
)
let i = -1
@@ -87,7 +87,7 @@ describe('Heading component', () => {
Heading #4
-
+ ,
)
let i = -1
@@ -110,7 +110,7 @@ describe('Heading component', () => {
Heading #5
-
+ ,
)
let i = -1
@@ -131,7 +131,7 @@ describe('Heading component', () => {
Heading #3
Heading #4
-
+ ,
)
const first = document.querySelectorAll('h3.dnb-h--medium')
@@ -157,14 +157,14 @@ describe('Heading component', () => {
const { rerender } = render( )
expect(document.querySelector('.dnb-heading').textContent).toBe(
- '[h1] Heading #1'
+ '[h1] Heading #1',
)
rerender( )
// We got a level correction here!
expect(document.querySelector('.dnb-heading').textContent).toBe(
- '[h2] Heading #1'
+ '[h2] Heading #1',
)
// expect(warn).toBeCalledTimes(2) // 2 because of StrictMode
@@ -177,13 +177,13 @@ describe('Heading component', () => {
2,
'\nNB: This warning was triggered by:',
'',
- 'Heading #1'
+ 'Heading #1',
)
rerender( )
expect(document.querySelector('.dnb-heading').textContent).toBe(
- '[h4] Heading #1'
+ '[h4] Heading #1',
)
// still one time, same as we had earlier
expect(warn).toBeCalledTimes(1) // 2 because of StrictMode
@@ -191,13 +191,13 @@ describe('Heading component', () => {
it('have to have correct leveling after using setNextLevel', async () => {
const { rerender: rerenderH1, container: h1 } = render(
- h1
+ h1 ,
)
Heading.setNextLevel(2)
const { rerender: rerenderH2, container: h2 } = render(
- h2
+ h2 ,
)
setNextLevel(3)
@@ -205,7 +205,7 @@ describe('Heading component', () => {
const { rerender: rerenderH3, container: h3 } = render(
h3
-
+ ,
)
expect(h1.querySelector('.dnb-heading').textContent).toBe('[h1] h1')
@@ -217,7 +217,7 @@ describe('Heading component', () => {
rerenderH2(
h2
-
+ ,
)
expect(h2.querySelector('.dnb-heading').textContent).toBe('[h4] h2')
@@ -226,14 +226,14 @@ describe('Heading component', () => {
rerenderH2(
h2
-
+ ,
)
expect(h2.querySelector('.dnb-heading').textContent).toBe('[h1] h2')
rerenderH2(
h2
-
+ ,
)
expect(h2.querySelector('.dnb-heading').textContent).toBe('[h2] h2')
@@ -242,28 +242,28 @@ describe('Heading component', () => {
rerenderH1(
h1
-
+ ,
)
expect(h1.querySelector('.dnb-heading').textContent).toBe('[h2] h1')
rerenderH3(
h1
-
+ ,
)
expect(h3.querySelector('.dnb-heading').textContent).toBe('[h3] h1')
})
it('have to have correct leveling after using resetLevels', () => {
const { rerender, container: h2 } = render(
- h2
+ h2 ,
)
expect(h2.querySelector('.dnb-heading').textContent).toBe('[h1] h2')
rerender(
h2
-
+ ,
)
expect(h2.querySelector('.dnb-heading').textContent).toBe('[h2] h2')
@@ -272,14 +272,14 @@ describe('Heading component', () => {
rerender(
h2
-
+ ,
)
expect(h2.querySelector('.dnb-heading').textContent).toBe('[h1] h2')
rerender(
h2
-
+ ,
)
expect(h2.querySelector('.dnb-heading').textContent).toBe('[h2] h2')
})
@@ -288,7 +288,7 @@ describe('Heading component', () => {
render(
Heading #1
-
+ ,
)
const elem = document.querySelectorAll('span.dnb-heading')
@@ -301,11 +301,11 @@ describe('Heading component', () => {
render(
Heading #1
-
+ ,
)
expect(document.querySelectorAll('.dnb-heading')[0].textContent).toBe(
- '[h1] Heading #1'
+ '[h1] Heading #1',
)
})
@@ -313,14 +313,14 @@ describe('Heading component', () => {
render(
Heading #1
-
+ ,
)
const elem = document.querySelectorAll('.dnb-heading')
expect(elem[0].textContent).toBe('[h1] Heading #1')
expect(elem[0].classList).toContain('dnb-h--x-large')
expect(elem[0].getAttribute('class')).toBe(
- 'dnb-heading dnb-h--x-large'
+ 'dnb-heading dnb-h--x-large',
)
})
@@ -331,7 +331,7 @@ describe('Heading component', () => {
Heading #1
Heading #2
-
+ ,
)
const elem = document.querySelectorAll('.dnb-heading')
@@ -349,7 +349,7 @@ describe('Heading component', () => {
Heading #3
-
+ ,
)
const elem = document.querySelectorAll('.dnb-heading')
@@ -446,7 +446,7 @@ describe('Heading component', () => {
-
+ ,
)
let i = -1
@@ -484,7 +484,7 @@ describe('Heading component', () => {
-
+ ,
)
expect(await axeComponent(Comp, {})).toHaveNoViolations()
})
@@ -521,7 +521,7 @@ function makeComp() {
-
+ ,
)
return gComp
diff --git a/packages/dnb-eufemia/src/components/height-animation/HeightAnimation.tsx b/packages/dnb-eufemia/src/components/height-animation/HeightAnimation.tsx
index b540522174e..88acd9ea67f 100644
--- a/packages/dnb-eufemia/src/components/height-animation/HeightAnimation.tsx
+++ b/packages/dnb-eufemia/src/components/height-animation/HeightAnimation.tsx
@@ -97,7 +97,7 @@ export default function HeightAnimation({
!open &&
'dnb-height-animation--hidden',
showOverflow && 'dnb-height-animation--show-overflow',
- className
+ className,
)}
style={style}
aria-hidden={keepInDOM ? !open : undefined}
diff --git a/packages/dnb-eufemia/src/components/height-animation/HeightAnimationInstance.ts b/packages/dnb-eufemia/src/components/height-animation/HeightAnimationInstance.ts
index a33026634ea..ad78bb95f3c 100644
--- a/packages/dnb-eufemia/src/components/height-animation/HeightAnimationInstance.ts
+++ b/packages/dnb-eufemia/src/components/height-animation/HeightAnimationInstance.ts
@@ -13,10 +13,10 @@ export type HeightAnimationOptions = {
animate?: boolean
}
export type HeightAnimationOnStartCallback = (
- state: HeightAnimationStates
+ state: HeightAnimationStates,
) => void
export type HeightAnimationOnEndCallback = (
- state: HeightAnimationStates
+ state: HeightAnimationStates,
) => void
export type HeightAnimationOnStartStack =
Array
@@ -188,7 +188,7 @@ export default class HeightAnimation {
start(
fromHeight: HeightAnimationFromHeight,
toHeight: HeightAnimationToHeight,
- { animate = true }: HeightAnimationOptions = {}
+ { animate = true }: HeightAnimationOptions = {},
) {
if (window?.location?.href?.includes('data-visual-test')) {
animate = false
@@ -259,7 +259,7 @@ export default class HeightAnimation {
adjustTo(
fromHeight: HeightAnimationFromHeight = null,
toHeight: HeightAnimationToHeight = null,
- { animate = true }: HeightAnimationOptions = {}
+ { animate = true }: HeightAnimationOptions = {},
) {
if (!this.elem) {
return
diff --git a/packages/dnb-eufemia/src/components/height-animation/__tests__/HeightAnimation.test.tsx b/packages/dnb-eufemia/src/components/height-animation/__tests__/HeightAnimation.test.tsx
index 6d8215896a6..e85ebcda7e3 100644
--- a/packages/dnb-eufemia/src/components/height-animation/__tests__/HeightAnimation.test.tsx
+++ b/packages/dnb-eufemia/src/components/height-animation/__tests__/HeightAnimation.test.tsx
@@ -20,9 +20,8 @@ import { wait } from '../../../core/jest/jestSetup'
testSetupInit()
const getStates = () => {
- const classes = document.querySelector(
- '.dnb-height-animation'
- )?.classList
+ const classes = document.querySelector('.dnb-height-animation')
+ ?.classList
return classes ? Array.from(classes) : []
}
@@ -71,14 +70,14 @@ describe('HeightAnimation', () => {
it('should be closed by default', () => {
render( )
expect(
- document.querySelector('.dnb-height-animation--is-visible')
+ document.querySelector('.dnb-height-animation--is-visible'),
).not.toBeInTheDocument()
})
it('should use given span element', () => {
render( )
expect(
- document.querySelector('span.dnb-height-animation--is-visible')
+ document.querySelector('span.dnb-height-animation--is-visible'),
).not.toBeInTheDocument()
})
@@ -86,13 +85,13 @@ describe('HeightAnimation', () => {
const { rerender } = render( )
expect(
- document.querySelector('.dnb-height-animation')
+ document.querySelector('.dnb-height-animation'),
).not.toBeInTheDocument()
rerender( )
expect(
- document.querySelector('.dnb-height-animation--is-visible')
+ document.querySelector('.dnb-height-animation--is-visible'),
).toBeInTheDocument()
})
@@ -100,7 +99,9 @@ describe('HeightAnimation', () => {
render( )
expect(
- document.querySelector('.dnb-height-animation').getAttribute('style')
+ document
+ .querySelector('.dnb-height-animation')
+ .getAttribute('style'),
).toBe('--duration: 1000ms; height: auto;')
})
@@ -108,13 +109,15 @@ describe('HeightAnimation', () => {
render(visible content )
expect(
- document.querySelector('.dnb-height-animation').textContent
+ document.querySelector('.dnb-height-animation').textContent,
).toBe('visible content')
expect(
- document.querySelector('.dnb-height-animation--is-visible')
+ document.querySelector('.dnb-height-animation--is-visible'),
).toBeInTheDocument()
expect(
- document.querySelector('.dnb-height-animation').getAttribute('style')
+ document
+ .querySelector('.dnb-height-animation')
+ .getAttribute('style'),
).toBe('height: auto;')
})
@@ -122,14 +125,14 @@ describe('HeightAnimation', () => {
render( )
expect(
- document.querySelector('.dnb-height-animation')
+ document.querySelector('.dnb-height-animation'),
).not.toBeInTheDocument()
fireEvent.click(document.querySelector('button'))
act(() => {
expect(
- document.querySelector('.dnb-height-animation--is-visible')
+ document.querySelector('.dnb-height-animation--is-visible'),
).toBeInTheDocument()
})
})
@@ -138,7 +141,7 @@ describe('HeightAnimation', () => {
const { rerender } = render( )
expect(
- document.querySelector('.dnb-height-animation')
+ document.querySelector('.dnb-height-animation'),
).not.toBeInTheDocument()
rerender( )
@@ -149,7 +152,9 @@ describe('HeightAnimation', () => {
})
expect(
- document.querySelector('.dnb-height-animation').getAttribute('style')
+ document
+ .querySelector('.dnb-height-animation')
+ .getAttribute('style'),
).toBe('height: auto;')
rerender(123 )
@@ -158,7 +163,7 @@ describe('HeightAnimation', () => {
expect(
document
.querySelector('.dnb-height-animation')
- .getAttribute('style')
+ .getAttribute('style'),
).toBe('height: 0px;')
})
@@ -172,7 +177,7 @@ describe('HeightAnimation', () => {
expect(
document
.querySelector('.dnb-height-animation')
- .getAttribute('style')
+ .getAttribute('style'),
).toBe('height: 100px;')
})
})
@@ -182,7 +187,7 @@ describe('HeightAnimation', () => {
const { rerender } = render( )
expect(
- document.querySelector('.dnb-height-animation')
+ document.querySelector('.dnb-height-animation'),
).not.toBeInTheDocument()
rerender( )
@@ -205,11 +210,11 @@ describe('HeightAnimation', () => {
it('should call onAnimationEnd', () => {
const onAnimationEnd = jest.fn()
const { rerender } = render(
-
+ ,
)
expect(
- document.querySelector('.dnb-height-animation')
+ document.querySelector('.dnb-height-animation'),
).not.toBeInTheDocument()
rerender( )
@@ -233,7 +238,7 @@ describe('HeightAnimation', () => {
const { rerender } = render( )
expect(
- document.querySelector('.dnb-height-animation')
+ document.querySelector('.dnb-height-animation'),
).not.toBeInTheDocument()
rerender( )
@@ -242,7 +247,7 @@ describe('HeightAnimation', () => {
simulateAnimationEnd()
expect(onInit).toHaveBeenCalledTimes(1)
expect(onInit).toHaveBeenCalledWith(
- expect.any(HeightAnimationInstance)
+ expect.any(HeightAnimationInstance),
)
})
@@ -258,16 +263,16 @@ describe('HeightAnimation', () => {
const { rerender } = render( )
expect(
- document.querySelector('.dnb-height-animation')
+ document.querySelector('.dnb-height-animation'),
).toBeInTheDocument()
expect(
- document.querySelector('.dnb-height-animation--is-visible')
+ document.querySelector('.dnb-height-animation--is-visible'),
).not.toBeInTheDocument()
rerender( )
expect(
- document.querySelector('.dnb-height-animation--is-visible')
+ document.querySelector('.dnb-height-animation--is-visible'),
).toBeInTheDocument()
rerender( )
@@ -325,7 +330,7 @@ describe('HeightAnimation', () => {
expect(getElem().getAttribute('aria-hidden')).toBe('true')
expect(getElem().getAttribute('style')).toBe(
- 'height: auto; visibility: hidden;'
+ 'height: auto; visibility: hidden;',
)
})
@@ -343,7 +348,7 @@ describe('HeightAnimation', () => {
const getClasses = () =>
Array.from(
- document.querySelector('.dnb-height-animation')?.classList || []
+ document.querySelector('.dnb-height-animation')?.classList || [],
)
expect(getClasses()).toEqual([
@@ -361,7 +366,7 @@ describe('HeightAnimation', () => {
expect.arrayContaining([
'dnb-height-animation--is-in-dom',
'dnb-height-animation--is-visible',
- ])
+ ]),
)
})
@@ -371,7 +376,7 @@ describe('HeightAnimation', () => {
act(() => {
expect(getClasses()).toEqual(
- expect.arrayContaining(['dnb-height-animation--hidden'])
+ expect.arrayContaining(['dnb-height-animation--hidden']),
)
})
})
diff --git a/packages/dnb-eufemia/src/components/height-animation/__tests__/HeightAnimationInstance.test.ts b/packages/dnb-eufemia/src/components/height-animation/__tests__/HeightAnimationInstance.test.ts
index 8a0027fb0d6..1b916d606b9 100644
--- a/packages/dnb-eufemia/src/components/height-animation/__tests__/HeightAnimationInstance.test.ts
+++ b/packages/dnb-eufemia/src/components/height-animation/__tests__/HeightAnimationInstance.test.ts
@@ -105,7 +105,7 @@ describe('HeightAnimationInstance', () => {
element.style.width = '200px'
expect(element.getAttribute('style')).toBe(
- 'position: absolute; visibility: hidden; height: 100px; width: 200px;'
+ 'position: absolute; visibility: hidden; height: 100px; width: 200px;',
)
inst._restore()
@@ -234,11 +234,11 @@ describe('HeightAnimationInstance', () => {
expect(window.cancelAnimationFrame).toHaveBeenCalledTimes(2)
expect(window.cancelAnimationFrame).toHaveBeenNthCalledWith(
1,
- undefined
+ undefined,
)
expect(window.cancelAnimationFrame).toHaveBeenNthCalledWith(
2,
- undefined
+ undefined,
)
expect(window.requestAnimationFrame).toHaveBeenCalledTimes(1)
@@ -282,11 +282,11 @@ describe('HeightAnimationInstance', () => {
expect(window.cancelAnimationFrame).toHaveBeenCalledTimes(2)
expect(window.cancelAnimationFrame).toHaveBeenNthCalledWith(
1,
- undefined
+ undefined,
)
expect(window.cancelAnimationFrame).toHaveBeenNthCalledWith(
2,
- undefined
+ undefined,
)
expect(window.requestAnimationFrame).toHaveBeenCalledTimes(1)
@@ -418,11 +418,11 @@ describe('HeightAnimationInstance', () => {
await wait(1)
expect(element.getAttribute('style')).toBe(
- 'height: 0px; visibility: hidden;'
+ 'height: 0px; visibility: hidden;',
)
expect(element.getAttribute('style')).toBe(
- 'height: 0px; visibility: hidden;'
+ 'height: 0px; visibility: hidden;',
)
expect(window.requestAnimationFrame).toHaveBeenCalledTimes(0)
@@ -460,7 +460,7 @@ describe('HeightAnimationInstance', () => {
simulateAnimationEnd()
expect(element.getAttribute('style')).toBe(
- 'height: 0px; visibility: hidden;'
+ 'height: 0px; visibility: hidden;',
)
expect(onStart).toHaveBeenCalledTimes(1)
diff --git a/packages/dnb-eufemia/src/components/height-animation/__tests__/HeightAnimationUtils.ts b/packages/dnb-eufemia/src/components/height-animation/__tests__/HeightAnimationUtils.ts
index 2605bf81fc4..8330f5f088e 100644
--- a/packages/dnb-eufemia/src/components/height-animation/__tests__/HeightAnimationUtils.ts
+++ b/packages/dnb-eufemia/src/components/height-animation/__tests__/HeightAnimationUtils.ts
@@ -13,7 +13,7 @@ export function testSetupInit() {
}
export function simulateAnimationEnd(
- element: Element = document.querySelector('.dnb-height-animation')
+ element: Element = document.querySelector('.dnb-height-animation'),
) {
const event = new CustomEvent('transitionend')
element.dispatchEvent(event)
diff --git a/packages/dnb-eufemia/src/components/height-animation/__tests__/useHeightAnimation.test.tsx b/packages/dnb-eufemia/src/components/height-animation/__tests__/useHeightAnimation.test.tsx
index 033eb7865ed..b2a861f6ece 100644
--- a/packages/dnb-eufemia/src/components/height-animation/__tests__/useHeightAnimation.test.tsx
+++ b/packages/dnb-eufemia/src/components/height-animation/__tests__/useHeightAnimation.test.tsx
@@ -53,7 +53,7 @@ describe('useHeightAnimation', () => {
isInDOM && 'is-in-dom',
isVisible && 'is-visible',
isVisibleParallax && 'is-in-parallax',
- isOpen && 'is-open'
+ isOpen && 'is-open',
)}
>
@@ -217,7 +217,7 @@ describe('useHeightAnimation', () => {
const ref: React.RefObject = { current }
const { result } = renderHook(() =>
- useHeightAnimation(ref, { open: false })
+ useHeightAnimation(ref, { open: false }),
)
expect(result.current).toEqual({
@@ -232,7 +232,7 @@ describe('useHeightAnimation', () => {
})
function simulateAnimationEnd(
- element: Element = document.querySelector('.animation-element')
+ element: Element = document.querySelector('.animation-element'),
) {
const event = new CustomEvent('transitionend')
element.dispatchEvent(event)
diff --git a/packages/dnb-eufemia/src/components/height-animation/useHeightAnimation.tsx b/packages/dnb-eufemia/src/components/height-animation/useHeightAnimation.tsx
index b29cfcac4f0..0903816a9fa 100644
--- a/packages/dnb-eufemia/src/components/height-animation/useHeightAnimation.tsx
+++ b/packages/dnb-eufemia/src/components/height-animation/useHeightAnimation.tsx
@@ -55,7 +55,7 @@ export function useHeightAnimation(
onInit = null,
onOpen = null,
onAnimationEnd = null,
- }: useHeightAnimationOptions = {}
+ }: useHeightAnimationOptions = {},
) {
const animRef = React.useRef(null)
const [isOpen, setIsOpen] = React.useState(open)
@@ -193,7 +193,7 @@ function useAdjust({ children, animRef, isInitialRender }) {
animRef.current.adjustTo(
fromHeight.current,
- animRef.current.getHeight() // use getHeight instead of getUnknownHeight because of the additional, disturbing DOM manipulation
+ animRef.current.getHeight(), // use getHeight instead of getUnknownHeight because of the additional, disturbing DOM manipulation
)
}
}, [children]) // eslint-disable-line react-hooks/exhaustive-deps
diff --git a/packages/dnb-eufemia/src/components/help-button/HelpButton.tsx b/packages/dnb-eufemia/src/components/help-button/HelpButton.tsx
index 71bfb3a1865..53389898e50 100644
--- a/packages/dnb-eufemia/src/components/help-button/HelpButton.tsx
+++ b/packages/dnb-eufemia/src/components/help-button/HelpButton.tsx
@@ -18,7 +18,7 @@ const defaultProps = {
export type HelpButtonProps = {
render?: (
children: React.ReactNode,
- props: ButtonProps
+ props: ButtonProps,
) => React.ReactElement
} & ButtonProps
diff --git a/packages/dnb-eufemia/src/components/help-button/HelpButtonInstance.tsx b/packages/dnb-eufemia/src/components/help-button/HelpButtonInstance.tsx
index 55815930f96..8637a84f207 100644
--- a/packages/dnb-eufemia/src/components/help-button/HelpButtonInstance.tsx
+++ b/packages/dnb-eufemia/src/components/help-button/HelpButtonInstance.tsx
@@ -25,7 +25,7 @@ export default function HelpButtonInstance(localProps: ButtonProps) {
const props = extendPropsWithContext(
localProps,
defaultProps,
- context.HelpButton
+ context.HelpButton,
)
const {
@@ -42,7 +42,7 @@ export default function HelpButtonInstance(localProps: ButtonProps) {
'dnb-help-button',
createSpacingClasses(props),
className,
- _className
+ _className,
),
size,
icon,
diff --git a/packages/dnb-eufemia/src/components/help-button/__tests__/HelpButton.test.tsx b/packages/dnb-eufemia/src/components/help-button/__tests__/HelpButton.test.tsx
index 6e5a9d80b9b..2e4b56c42d2 100644
--- a/packages/dnb-eufemia/src/components/help-button/__tests__/HelpButton.test.tsx
+++ b/packages/dnb-eufemia/src/components/help-button/__tests__/HelpButton.test.tsx
@@ -19,39 +19,39 @@ describe('HelpButton', () => {
it('should have question icon by default', () => {
render( )
expect(
- document.querySelector('.dnb-icon').getAttribute('data-testid')
+ document.querySelector('.dnb-icon').getAttribute('data-testid'),
).toBe('question icon')
expect(document.querySelector('svg').outerHTML).toBe(
- render( ).container.innerHTML
+ render( ).container.innerHTML,
)
expect(document.querySelector('.dnb-button').textContent.trim()).toBe(
- 'ā'
+ 'ā',
)
})
it('should use "information" icon when set', () => {
render( )
expect(
- document.querySelector('.dnb-icon').getAttribute('data-testid')
+ document.querySelector('.dnb-icon').getAttribute('data-testid'),
).toBe('information icon')
expect(document.querySelector('svg').outerHTML).toBe(
- render( ).container.innerHTML
+ render( ).container.innerHTML,
)
expect(document.querySelector('.dnb-button').textContent.trim()).toBe(
- 'ā'
+ 'ā',
)
})
it('should use given icon', () => {
render( )
expect(
- document.querySelector('.dnb-icon').getAttribute('data-testid')
+ document.querySelector('.dnb-icon').getAttribute('data-testid'),
).toBe('information medium icon')
expect(document.querySelector('svg').outerHTML).toBe(
- render( ).container.innerHTML
+ render( ).container.innerHTML,
)
expect(document.querySelector('.dnb-button').textContent.trim()).toBe(
- 'ā'
+ 'ā',
)
})
@@ -61,7 +61,7 @@ describe('HelpButton', () => {
document
.querySelector('.dnb-button')
- .getAttribute('aria-roledescription')
+ .getAttribute('aria-roledescription'),
).toBe('Hjelp-knapp')
})
@@ -69,27 +69,27 @@ describe('HelpButton', () => {
it('should have correct aria-label', () => {
render( )
expect(
- document.querySelector('.dnb-button').getAttribute('aria-label')
+ document.querySelector('.dnb-button').getAttribute('aria-label'),
).toBe('Hjelpetekst')
})
it('should have not aria-label if text is given', () => {
render( )
expect(document.querySelector('.dnb-button')).not.toHaveAttribute(
- 'aria-label'
+ 'aria-label',
)
expect(
- document.querySelector('.dnb-button').textContent.trim()
+ document.querySelector('.dnb-button').textContent.trim(),
).toBe('ābutton text')
})
it('should have aria-label if title is given, but no text', () => {
render( )
expect(
- document.querySelector('.dnb-button').getAttribute('aria-label')
+ document.querySelector('.dnb-button').getAttribute('aria-label'),
).toBe('button title')
expect(
- document.querySelector('.dnb-button').textContent.trim()
+ document.querySelector('.dnb-button').textContent.trim(),
).toBe('ā')
})
@@ -100,13 +100,13 @@ describe('HelpButton', () => {
icon="bell"
title="button title"
aria-label="custom aria-label"
- />
+ />,
)
expect(
- document.querySelector('.dnb-button').getAttribute('aria-label')
+ document.querySelector('.dnb-button').getAttribute('aria-label'),
).toBe('custom aria-label')
expect(
- document.querySelector('.dnb-button').textContent.trim()
+ document.querySelector('.dnb-button').textContent.trim(),
).toBe('ā')
})
@@ -126,7 +126,7 @@ describe('HelpButton', () => {
const dialogElem = document.getElementById(id)
const textContent = String(dialogElem.textContent).replace(
/\u200C/g,
- ''
+ '',
)
expect(textContent).toContain(dialogContent)
@@ -143,7 +143,7 @@ describe('HelpButton', () => {
)}
>
Help text
-
+ ,
)
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
@@ -151,10 +151,10 @@ describe('HelpButton', () => {
const dialogElem = document.querySelector('.custom-class')
expect(
- dialogElem.querySelector('.dnb-dialog__header').textContent
+ dialogElem.querySelector('.dnb-dialog__header').textContent,
).toBe('Title')
expect(
- dialogElem.querySelector('.dnb-dialog__content').textContent
+ dialogElem.querySelector('.dnb-dialog__content').textContent,
).toBe('Help text')
})
@@ -172,7 +172,7 @@ describe('HelpButton scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-help-button-theme-ui.scss')
+ require.resolve('../style/themes/dnb-help-button-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/icon-primary/IconPrimary.js b/packages/dnb-eufemia/src/components/icon-primary/IconPrimary.js
index cca654ff84d..01b27c8ba4f 100644
--- a/packages/dnb-eufemia/src/components/icon-primary/IconPrimary.js
+++ b/packages/dnb-eufemia/src/components/icon-primary/IconPrimary.js
@@ -45,12 +45,12 @@ export default class IconPrimary extends React.PureComponent {
IconPrimary.defaultProps,
{ skeleton: this.context?.skeleton },
this.context.Icon,
- this.context.IconPrimary
+ this.context.IconPrimary,
)
const { icon, size, wrapperParams, iconParams, alt } = prepareIcon(
props,
- this.context
+ this.context,
)
const IconContainer = prerenderIcon({
diff --git a/packages/dnb-eufemia/src/components/icon/Icon.js b/packages/dnb-eufemia/src/components/icon/Icon.js
index cd6eb459a2b..13b6b24efb7 100644
--- a/packages/dnb-eufemia/src/components/icon/Icon.js
+++ b/packages/dnb-eufemia/src/components/icon/Icon.js
@@ -115,12 +115,12 @@ export default class Icon extends React.PureComponent {
this.props,
Icon.defaultProps,
{ skeleton: this.context?.skeleton },
- this.context.Icon
+ this.context.Icon,
)
const { icon, size, wrapperParams, iconParams, alt } = prepareIcon(
props,
- this.context
+ this.context,
)
if (!icon) {
@@ -167,7 +167,7 @@ export const calcSize = (props) => {
if (nameParts.length > 1) {
const lastPartOfIconName = nameParts.reverse()[0]
const potentialSize = ListDefaultIconSizes.filter(
- ([key]) => key === lastPartOfIconName
+ ([key]) => key === lastPartOfIconName,
).reduce((acc, [key, value]) => {
return key && value
}, null)
@@ -187,7 +187,7 @@ export const calcSize = (props) => {
}
if (!potentialSize && elem.props.viewBox) {
potentialSize = /[0-9]+ [0-9]+ ([0-9]+)/.exec(
- elem.props.viewBox
+ elem.props.viewBox,
)[1] // get the width
}
if (potentialSize) {
@@ -201,7 +201,7 @@ export const calcSize = (props) => {
// if size is defined as a string, find the size number
else if (typeof size === 'string' && !(parseFloat(size) > 0)) {
sizeAsInt = ListDefaultIconSizes.filter(
- ([key]) => key === size
+ ([key]) => key === size,
).reduce((acc, [key, value]) => {
return key && value
}, -1)
@@ -215,7 +215,7 @@ export const calcSize = (props) => {
// check if the size is given as a number, and if is a default size
else if (parseFloat(size) > 0) {
sizeAsInt = ListDefaultIconSizes.filter(
- ([key, value]) => key && value === parseFloat(size)
+ ([key, value]) => key && value === parseFloat(size),
).reduce((acc, [key, value]) => {
if (key && value) return value
return acc
@@ -237,7 +237,7 @@ export const calcSize = (props) => {
}
return acc
},
- null
+ null,
)
if (potentialSizeAsString) {
@@ -364,7 +364,7 @@ export const prepareIcon = (props, context) => {
createSkeletonClass(null, skeleton, context),
createSpacingClasses(props),
_className,
- className
+ className,
)
let iconToRender = Icon.getIcon(props)
@@ -380,8 +380,8 @@ export const prepareIcon = (props, context) => {
size,
width,
height,
- }
- )
+ },
+ ),
)
}
diff --git a/packages/dnb-eufemia/src/components/icon/__tests__/Icon.test.tsx b/packages/dnb-eufemia/src/components/icon/__tests__/Icon.test.tsx
index d5ff8a224d8..7ba5bff224f 100644
--- a/packages/dnb-eufemia/src/components/icon/__tests__/Icon.test.tsx
+++ b/packages/dnb-eufemia/src/components/icon/__tests__/Icon.test.tsx
@@ -36,11 +36,11 @@ describe('Icon component', () => {
it('should work with medium size', () => {
const { rerender } = render( )
expect(document.querySelector('span.dnb-icon').classList).toContain(
- 'dnb-icon--medium'
+ 'dnb-icon--medium',
)
rerender( )
expect(document.querySelector('span.dnb-icon').classList).toContain(
- 'dnb-icon--default'
+ 'dnb-icon--default',
)
})
@@ -61,51 +61,51 @@ describe('Icon component', () => {
it('should have border class', () => {
render( )
expect(document.querySelector('span.dnb-icon').classList).toContain(
- 'dnb-icon--border'
+ 'dnb-icon--border',
)
})
it('should inherit color and vice versa when inherit_color is false', () => {
const { rerender } = render( )
expect(document.querySelector('span.dnb-icon').classList).toContain(
- 'dnb-icon--inherit-color'
+ 'dnb-icon--inherit-color',
)
rerender( )
expect(document.querySelector('span.dnb-icon').classList).toContain(
- 'dnb-icon--inherit-color'
+ 'dnb-icon--inherit-color',
)
rerender( )
expect(
- document.querySelector('span.dnb-icon').classList
+ document.querySelector('span.dnb-icon').classList,
).not.toContain('dnb-icon--inherit-color')
})
it('should not be hidden, given aria-hidden={false}', () => {
render( )
expect(
- document.querySelector('span.dnb-icon').getAttribute('aria-hidden')
+ document.querySelector('span.dnb-icon').getAttribute('aria-hidden'),
).toBe('false')
})
it('should work with custom size', () => {
const { rerender } = render( )
expect(document.querySelector('span.dnb-icon').classList).toContain(
- 'dnb-icon--custom-size'
+ 'dnb-icon--custom-size',
)
rerender( )
expect(
- document.querySelector('span.dnb-icon').classList
+ document.querySelector('span.dnb-icon').classList,
).not.toContain('dnb-icon--custom-size')
})
it('should set data-testid property based on the aria-label', () => {
render( )
expect(
- document.querySelector('span.dnb-icon').getAttribute('data-testid')
+ document.querySelector('span.dnb-icon').getAttribute('data-testid'),
).toBe('question icon')
})
@@ -115,10 +115,10 @@ describe('Icon component', () => {
icon={question}
aria-label="question icon"
data-testid="custom-data-testid-value"
- />
+ />,
)
expect(
- document.querySelector('span.dnb-icon').getAttribute('data-testid')
+ document.querySelector('span.dnb-icon').getAttribute('data-testid'),
).toBe('custom-data-testid-value')
})
diff --git a/packages/dnb-eufemia/src/components/info-card/InfoCard.tsx b/packages/dnb-eufemia/src/components/info-card/InfoCard.tsx
index 21a3057224d..aae680a0cbf 100644
--- a/packages/dnb-eufemia/src/components/info-card/InfoCard.tsx
+++ b/packages/dnb-eufemia/src/components/info-card/InfoCard.tsx
@@ -147,7 +147,7 @@ const InfoCard = (localProps: InfoCardAllProps) => {
'dnb-info-card',
centered && 'dnb-info-card--centered',
spacingClasses,
- className
+ className,
)}
{...props}
>
diff --git a/packages/dnb-eufemia/src/components/info-card/__tests__/InfoCard.test.tsx b/packages/dnb-eufemia/src/components/info-card/__tests__/InfoCard.test.tsx
index 3426ef69be8..cd04402379b 100644
--- a/packages/dnb-eufemia/src/components/info-card/__tests__/InfoCard.test.tsx
+++ b/packages/dnb-eufemia/src/components/info-card/__tests__/InfoCard.test.tsx
@@ -12,7 +12,7 @@ describe('InfoCard', () => {
render( )
expect(
- document.querySelector('.dnb-info-card__text')
+ document.querySelector('.dnb-info-card__text'),
).toBeInTheDocument()
})
@@ -22,10 +22,10 @@ describe('InfoCard', () => {
render( )
expect(
- document.querySelector('.dnb-info-card__title')
+ document.querySelector('.dnb-info-card__title'),
).toBeInTheDocument()
expect(
- document.querySelector('.dnb-info-card__title').textContent
+ document.querySelector('.dnb-info-card__title').textContent,
).toMatch(title)
})
@@ -35,12 +35,12 @@ describe('InfoCard', () => {
render( )
expect(
- document.querySelector('.dnb-info-card__title')
+ document.querySelector('.dnb-info-card__title'),
).toBeInTheDocument()
expect(
within(
- document.querySelector('.dnb-info-card__title')
- ).queryByTestId('react-node')
+ document.querySelector('.dnb-info-card__title'),
+ ).queryByTestId('react-node'),
).toBeInTheDocument()
})
@@ -50,10 +50,10 @@ describe('InfoCard', () => {
render( )
expect(
- document.querySelector('.dnb-info-card__text')
+ document.querySelector('.dnb-info-card__text'),
).toBeInTheDocument()
expect(
- document.querySelector('.dnb-info-card__text').textContent
+ document.querySelector('.dnb-info-card__text').textContent,
).toMatch(text)
})
@@ -63,12 +63,12 @@ describe('InfoCard', () => {
render( )
expect(
- document.querySelector('.dnb-info-card__text')
+ document.querySelector('.dnb-info-card__text'),
).toBeInTheDocument()
expect(
within(document.querySelector('.dnb-info-card__text')).queryByTestId(
- 'react-node'
- )
+ 'react-node',
+ ),
).toBeInTheDocument()
})
@@ -84,7 +84,10 @@ describe('InfoCard', () => {
const img_src = '/dnb/android-chrome-192x192.png'
render(
-
+ ,
)
expect(screen.queryByRole('img').getAttribute('src')).toBe(img_src)
@@ -105,7 +108,7 @@ describe('InfoCard', () => {
render( )
const infoCard = document.querySelector(
- '.dnb-info-card'
+ '.dnb-info-card',
) as HTMLElement
const image = within(infoCard).queryByRole('img')
@@ -119,10 +122,10 @@ describe('InfoCard', () => {
render( )
expect(
- document.querySelector('.dnb-info-card__buttons__accept-button')
+ document.querySelector('.dnb-info-card__buttons__accept-button'),
).not.toBeInTheDocument()
expect(
- document.querySelector('.dnb-info-card__buttons__close-button')
+ document.querySelector('.dnb-info-card__buttons__close-button'),
).not.toBeInTheDocument()
})
@@ -131,7 +134,7 @@ describe('InfoCard', () => {
render( )
const buttonElement = document.querySelector(
- '.dnb-info-card__buttons__accept-button'
+ '.dnb-info-card__buttons__accept-button',
)
expect(buttonElement).toBeInTheDocument()
@@ -146,7 +149,7 @@ describe('InfoCard', () => {
render( )
const buttonElement = document.querySelector(
- '.dnb-info-card__buttons__accept-button'
+ '.dnb-info-card__buttons__accept-button',
)
expect(buttonElement).toBeInTheDocument()
@@ -161,12 +164,12 @@ describe('InfoCard', () => {
render( )
expect(
- document.querySelector('.dnb-info-card__buttons__accept-button')
+ document.querySelector('.dnb-info-card__buttons__accept-button'),
).toBeInTheDocument()
expect(
within(
- document.querySelector('.dnb-info-card__buttons__accept-button')
- ).queryByTestId('react-node')
+ document.querySelector('.dnb-info-card__buttons__accept-button'),
+ ).queryByTestId('react-node'),
).toBeInTheDocument()
})
@@ -175,7 +178,7 @@ describe('InfoCard', () => {
render( )
const buttonElement = document.querySelector(
- '.dnb-info-card__buttons__close-button'
+ '.dnb-info-card__buttons__close-button',
)
expect(buttonElement).toBeInTheDocument()
@@ -190,7 +193,7 @@ describe('InfoCard', () => {
render( )
const buttonElement = document.querySelector(
- '.dnb-info-card__buttons__close-button'
+ '.dnb-info-card__buttons__close-button',
)
expect(buttonElement).toBeInTheDocument()
@@ -203,12 +206,12 @@ describe('InfoCard', () => {
render( )
expect(
- document.querySelector('.dnb-info-card__buttons__close-button')
+ document.querySelector('.dnb-info-card__buttons__close-button'),
).toBeInTheDocument()
expect(
within(
- document.querySelector('.dnb-info-card__buttons__close-button')
- ).queryByTestId('react-node')
+ document.querySelector('.dnb-info-card__buttons__close-button'),
+ ).queryByTestId('react-node'),
).toBeInTheDocument()
})
@@ -220,11 +223,11 @@ describe('InfoCard', () => {
text="text"
acceptButtonText="accept"
acceptButtonAttributes={{ href }}
- />
+ />,
)
const buttonElement = document.querySelector(
- '.dnb-info-card__buttons__accept-button'
+ '.dnb-info-card__buttons__accept-button',
)
expect(buttonElement.getAttribute('href')).toMatch(href)
@@ -238,11 +241,11 @@ describe('InfoCard', () => {
text="text"
closeButtonText="accept"
closeButtonAttributes={{ href }}
- />
+ />,
)
const buttonElement = document.querySelector(
- '.dnb-info-card__buttons__close-button'
+ '.dnb-info-card__buttons__close-button',
)
expect(buttonElement.getAttribute('href')).toMatch(href)
@@ -254,7 +257,7 @@ describe('InfoCard', () => {
render( )
expect(
- document.querySelector('.dnb-info-card__text').className
+ document.querySelector('.dnb-info-card__text').className,
).toMatch(skeletonClassName)
})
@@ -264,11 +267,11 @@ describe('InfoCard', () => {
render(
-
+ ,
)
expect(
- document.querySelector('.dnb-info-card__text').className
+ document.querySelector('.dnb-info-card__text').className,
).toMatch(skeletonClassName)
})
@@ -277,7 +280,7 @@ describe('InfoCard', () => {
const element = document.querySelector('.dnb-info-card')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
diff --git a/packages/dnb-eufemia/src/components/info-card/index.ts b/packages/dnb-eufemia/src/components/info-card/index.ts
index 1bf51e14341..062e38797f6 100644
--- a/packages/dnb-eufemia/src/components/info-card/index.ts
+++ b/packages/dnb-eufemia/src/components/info-card/index.ts
@@ -3,7 +3,6 @@
*
*/
- import InfoCard from './InfoCard';
- export default InfoCard;
- export * from './InfoCard';
-
\ No newline at end of file
+import InfoCard from './InfoCard'
+export default InfoCard
+export * from './InfoCard'
diff --git a/packages/dnb-eufemia/src/components/info-card/style.ts b/packages/dnb-eufemia/src/components/info-card/style.ts
index 52bd16bdf8c..ea1e5fb3ca5 100644
--- a/packages/dnb-eufemia/src/components/info-card/style.ts
+++ b/packages/dnb-eufemia/src/components/info-card/style.ts
@@ -3,4 +3,4 @@
*
*/
- import './style/dnb-info-card.scss'
+import './style/dnb-info-card.scss'
diff --git a/packages/dnb-eufemia/src/components/input-masked/InputMasked.js b/packages/dnb-eufemia/src/components/input-masked/InputMasked.js
index 11383fed44f..63120d1f40f 100644
--- a/packages/dnb-eufemia/src/components/input-masked/InputMasked.js
+++ b/packages/dnb-eufemia/src/components/input-masked/InputMasked.js
@@ -29,9 +29,9 @@ const InputMasked = (props) => {
extendPropsWithContext(
props,
InputMasked.defaultProps,
- context?.InputMasked
+ context?.InputMasked,
),
- [props, InputMasked.defaultProps, context?.InputMasked]
+ [props, InputMasked.defaultProps, context?.InputMasked],
)
return (
diff --git a/packages/dnb-eufemia/src/components/input-masked/InputMaskedHooks.js b/packages/dnb-eufemia/src/components/input-masked/InputMaskedHooks.js
index 06cabc8578f..0c5f530eb93 100644
--- a/packages/dnb-eufemia/src/components/input-masked/InputMaskedHooks.js
+++ b/packages/dnb-eufemia/src/components/input-masked/InputMaskedHooks.js
@@ -100,7 +100,7 @@ export const useLocalValue = () => {
locale,
props,
maskParams,
- })
+ }),
)
/**
@@ -251,7 +251,7 @@ export const useInputElement = () => {
showGuide &&
placeholderChar &&
placeholderChar !== invisibleSpace &&
- 'dnb-input-masked--guide' // will use --font-family-monospace
+ 'dnb-input-masked--guide', // will use --font-family-monospace
)}
/>
)
@@ -492,7 +492,7 @@ const useNumberMaskParams = () => {
thousandsSeparatorSymbol,
currency: getCurrencySymbol(
locale,
- typeof as_currency === 'string' ? as_currency : null
+ typeof as_currency === 'string' ? as_currency : null,
),
...currency_mask,
}
diff --git a/packages/dnb-eufemia/src/components/input-masked/InputMaskedUtils.js b/packages/dnb-eufemia/src/components/input-masked/InputMaskedUtils.js
index 32e460fa253..d479fcdb870 100644
--- a/packages/dnb-eufemia/src/components/input-masked/InputMaskedUtils.js
+++ b/packages/dnb-eufemia/src/components/input-masked/InputMaskedUtils.js
@@ -31,7 +31,7 @@ export const invisibleSpace = '\u200B'
*/
export const isRequestingLocaleSupport = (props) => {
return Object.entries(props).some(
- ([k, v]) => v && enableLocaleSupportWhen.includes(k)
+ ([k, v]) => v && enableLocaleSupportWhen.includes(k),
)
}
@@ -43,7 +43,7 @@ export const isRequestingLocaleSupport = (props) => {
*/
export const isRequestingNumberMask = (props) => {
return Object.entries(props).some(
- ([k, v]) => v && enableNumberMaskWhen.includes(k)
+ ([k, v]) => v && enableNumberMaskWhen.includes(k),
)
}
@@ -120,7 +120,7 @@ export const correctNumberValue = ({
const endsWithDecimal = localNumberValue.endsWith(decimalSymbol)
const endsWithZeroAndDecimal = localNumberValue.endsWith(
- `${decimalSymbol}0`
+ `${decimalSymbol}0`,
)
if (endsWithDecimal) {
diff --git a/packages/dnb-eufemia/src/components/input-masked/TextMask.js b/packages/dnb-eufemia/src/components/input-masked/TextMask.js
index dcc40ac72d4..769f2eb9c01 100644
--- a/packages/dnb-eufemia/src/components/input-masked/TextMask.js
+++ b/packages/dnb-eufemia/src/components/input-masked/TextMask.js
@@ -86,7 +86,7 @@ export default class TextMask extends React.PureComponent {
const isMaskChanged = mask.toString() !== prevProps.mask.toString()
const isSettingChanged =
Object.keys(settings).some(
- (prop) => settings[prop] !== prevProps[prop]
+ (prop) => settings[prop] !== prevProps[prop],
) ||
isMaskChanged ||
isPipeChanged
diff --git a/packages/dnb-eufemia/src/components/input-masked/__tests__/InputMasked.test.tsx b/packages/dnb-eufemia/src/components/input-masked/__tests__/InputMasked.test.tsx
index c6959f49ff3..c1daad4e625 100644
--- a/packages/dnb-eufemia/src/components/input-masked/__tests__/InputMasked.test.tsx
+++ b/packages/dnb-eufemia/src/components/input-masked/__tests__/InputMasked.test.tsx
@@ -31,7 +31,7 @@ describe('InputMasked component', () => {
prefix: 'NOK ',
suffix: ',- kr',
}}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('NOK 1 234,- kr')
@@ -83,7 +83,7 @@ describe('InputMasked component', () => {
allowDecimal: true,
}}
on_change={on_change}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('NOK 1 234,5,- kr')
@@ -93,14 +93,14 @@ describe('InputMasked component', () => {
})
expect(document.querySelector('input').value).toBe(
- 'NOK 1 234 567 890,,- kr'
+ 'NOK 1 234 567 890,,- kr',
)
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].value
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].value,
).toBe('NOK 123 456 789,0,- kr')
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue,
).toBe(123456789)
})
@@ -114,7 +114,7 @@ describe('InputMasked component', () => {
value="12345.678"
number_mask={{ allowDecimal: true }}
on_change={on_change}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345,67')
@@ -127,10 +127,10 @@ describe('InputMasked component', () => {
expect(on_change).toBeCalledTimes(1)
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].value
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].value,
).toBe('123 456 789,67')
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue,
).toBe(123456789.67)
})
@@ -148,7 +148,7 @@ describe('InputMasked component', () => {
allowDecimal: true,
}}
on_change={on_change}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345,67')
@@ -160,10 +160,10 @@ describe('InputMasked component', () => {
expect(document.querySelector('input').value).toBe('123 456 789,67')
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].value
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].value,
).toBe('123 456 789,67')
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue,
).toBe(123456789.67)
})
@@ -183,7 +183,7 @@ describe('InputMasked component', () => {
allowDecimal: true,
}}
onKeyDown={onKeyDown}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('NOK 1 234,56,- kr')
@@ -222,7 +222,7 @@ describe('InputMasked component', () => {
disallowLeadingZeroes: true,
}}
onKeyDown={onKeyDown}
- />
+ />,
)
fireEvent.keyDown(document.querySelector('input'), {
@@ -246,7 +246,7 @@ describe('InputMasked component', () => {
allowDecimal: false,
}}
onKeyDown={onKeyDown}
- />
+ />,
)
fireEvent.keyDown(document.querySelector('input'), {
@@ -352,11 +352,11 @@ describe('InputMasked component', () => {
value={1234.5}
number_mask
onKeyDown={onKeyDown}
- />
+ />,
)
expect(document.querySelector('input').getAttribute('inputmode')).toBe(
- 'numeric'
+ 'numeric',
)
Object.defineProperty(helpers, 'IS_ANDROID', {
@@ -367,7 +367,7 @@ describe('InputMasked component', () => {
rerender( )
expect(document.querySelector('input').getAttribute('inputmode')).toBe(
- null
+ null,
)
// Re-render
@@ -377,11 +377,11 @@ describe('InputMasked component', () => {
number_mask
onKeyDown={onKeyDown}
mask_options={{ allowNegative: false }}
- />
+ />,
)
expect(document.querySelector('input').getAttribute('inputmode')).toBe(
- 'numeric'
+ 'numeric',
)
// Re-render
@@ -391,11 +391,11 @@ describe('InputMasked component', () => {
number_mask
onKeyDown={onKeyDown}
mask_options={{ allowNegative: false, allowDecimal: true }}
- />
+ />,
)
expect(document.querySelector('input').getAttribute('inputmode')).toBe(
- 'decimal'
+ 'decimal',
)
Object.defineProperty(helpers, 'IS_ANDROID', {
@@ -433,7 +433,7 @@ describe('InputMasked component', () => {
number_mask={{
allowDecimal: true,
}}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('0,1')
@@ -444,7 +444,7 @@ describe('InputMasked component', () => {
number_mask={{
allowDecimal: true,
}}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('1 234')
@@ -461,7 +461,7 @@ describe('InputMasked component', () => {
allowDecimal: true,
}}
onKeyDown={onKeyDown}
- />
+ />,
)
const keyCode = 188 // coma
@@ -481,7 +481,7 @@ describe('InputMasked component', () => {
disallowLeadingZeroes: true,
}}
onKeyDown={onKeyDown}
- />
+ />,
)
fireEvent.keyDown(document.querySelector('input'), {
@@ -520,7 +520,7 @@ describe('InputMasked component', () => {
/\d/,
/\d/,
]}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('110203 12345')
@@ -558,7 +558,7 @@ describe('InputMasked component', () => {
/\d/,
]}
mask_options={{ disallowLeadingZeroes: true }}
- />
+ />,
)
fireEvent.keyDown(document.querySelector('input'), {
@@ -594,7 +594,7 @@ describe('InputMasked component', () => {
/\d/,
]}
/>
-
+ ,
)
expect(document.querySelector('input').value).toBe('110203 12345')
@@ -617,7 +617,7 @@ describe('InputMasked component', () => {
value="123"
mask={() => [/\d/, ' ', /\d/, ' ', /\d/]}
/>
-
+ ,
)
expect(document.querySelector('input').value).toBe('1 2 3')
@@ -625,29 +625,29 @@ describe('InputMasked component', () => {
it('should show placeholder with both value null and undefined', () => {
const { rerender } = render(
-
+ ,
)
expect(
- document.querySelector('.dnb-input__placeholder').textContent
+ document.querySelector('.dnb-input__placeholder').textContent,
).toBe('AA')
rerender( )
expect(
- document.querySelector('.dnb-input__placeholder').textContent
+ document.querySelector('.dnb-input__placeholder').textContent,
).toBe('BB')
rerender( )
expect(
- document.querySelector('.dnb-input__placeholder').textContent
+ document.querySelector('.dnb-input__placeholder').textContent,
).toBe('CC')
rerender( )
expect(
- document.querySelector('.dnb-input__placeholder')
+ document.querySelector('.dnb-input__placeholder'),
).not.toBeInTheDocument()
})
@@ -674,7 +674,7 @@ describe('InputMasked component', () => {
/\d/,
/\d/,
]}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('00__ __ __ __ __')
@@ -688,7 +688,7 @@ describe('InputMasked component', () => {
suffix: ' kr',
allowDecimal: true,
}}
- />
+ />,
)
const setSelectionRange = jest.fn()
@@ -705,7 +705,7 @@ describe('InputMasked component', () => {
focus({ value: 'ā kr' })
expect(document.querySelector('input').value).toBe(
- 'ā kr' // includes a hidden space: invisibleSpace
+ 'ā kr', // includes a hidden space: invisibleSpace
)
await wait(2) // because of the delayed requestAnimationFrame
@@ -721,12 +721,12 @@ describe('InputMasked component', () => {
suffix: ' kr',
allowDecimal: true,
}}
- />
+ />,
)
focus({ value: 'Prefixā kr' })
expect(document.querySelector('input').value).toBe(
- 'Prefixā kr' // includes a hidden space: invisibleSpace
+ 'Prefixā kr', // includes a hidden space: invisibleSpace
)
await wait(2) // because of the delayed requestAnimationFrame
@@ -745,7 +745,7 @@ describe('InputMasked component', () => {
prefix: 'NOK ',
allowDecimal: true,
}}
- />
+ />,
)
const setSelectionRange = jest.fn()
@@ -767,7 +767,7 @@ describe('InputMasked component', () => {
const element = document.querySelector('input')
expect(element.value).toBe(
- 'NOK 123 456 kr' // includes a hidden space: invisibleSpace
+ 'NOK 123 456 kr', // includes a hidden space: invisibleSpace
)
const selectionPosition = 7
@@ -783,7 +783,7 @@ describe('InputMasked component', () => {
expect(setSelectionRange).toBeCalledTimes(1)
expect(setSelectionRange).toHaveBeenCalledWith(
selectionPosition + 1,
- selectionPosition + 1
+ selectionPosition + 1,
)
})
@@ -838,7 +838,7 @@ describe('InputMasked component with currency_mask', () => {
currency_mask={{
currency: 'NOK',
}}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('1 234 NOK')
@@ -848,7 +848,7 @@ describe('InputMasked component with currency_mask', () => {
const placeholderText = 'Placeholder-text'
render(
-
+ ,
)
const elem = document.querySelector('.dnb-input')
@@ -857,7 +857,7 @@ describe('InputMasked component with currency_mask', () => {
expect(inputElem.value).toBe('')
expect(inputElem.getAttribute('aria-placeholder')).toBe(
- placeholderText
+ placeholderText,
)
expect(placeholderElem.textContent).toBe(placeholderText)
@@ -868,11 +868,11 @@ describe('InputMasked component with currency_mask', () => {
expect(inputElem.value).toBe('20,02 NOK')
expect(inputElem.getAttribute('aria-placeholder')).toBe(
- placeholderText
+ placeholderText,
)
expect(
- document.querySelector('.dnb-input__placeholder')
+ document.querySelector('.dnb-input__placeholder'),
).not.toBeInTheDocument()
})
@@ -965,7 +965,7 @@ describe('InputMasked component with currency_mask', () => {
+ />,
)
expect(document.querySelector('input').value).toBe('1 234,91 kr')
@@ -975,7 +975,7 @@ describe('InputMasked component with currency_mask', () => {
describe('InputMasked component as_percent', () => {
it('should create a "number_mask" with a % suffix', () => {
const { rerender } = render(
-
+ ,
)
expect(document.querySelector('input').value).toBe('12 345Ā %')
@@ -991,7 +991,7 @@ describe('InputMasked component as_percent', () => {
value="12345.678"
as_percent
number_mask={{ decimalLimit: 1 }}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345,6Ā %')
@@ -1004,7 +1004,7 @@ describe('InputMasked component as_percent', () => {
number_mask={{ allowDecimal: true, decimalLimit: 3 }}
value="12345.678"
locale="en-GB"
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345.678%')
@@ -1015,7 +1015,7 @@ describe('InputMasked component as_percent', () => {
number_mask={{ allowDecimal: true, decimalLimit: 3 }}
value="12345.678"
locale="nb-NO"
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345,678Ā %')
@@ -1025,7 +1025,7 @@ describe('InputMasked component as_percent', () => {
describe('InputMasked component as_number', () => {
it('should create a "number_mask" accordingly the defined properties', () => {
const { rerender } = render(
-
+ ,
)
expect(document.querySelector('input').value).toBe('12 345')
@@ -1041,7 +1041,7 @@ describe('InputMasked component as_number', () => {
value="12345.678"
as_number
number_mask={{ decimalLimit: 1 }}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345,6')
@@ -1053,7 +1053,7 @@ describe('InputMasked component as_number', () => {
value="12345.678"
as_number
mask_options={{ decimalLimit: 1 }}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345,6')
@@ -1070,7 +1070,7 @@ describe('InputMasked component as_number', () => {
as_number
mask_options={{ decimalLimit: 1 }}
on_change={on_change}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345,6')
@@ -1082,10 +1082,10 @@ describe('InputMasked component as_number', () => {
expect(document.querySelector('input').value).toBe('123 456 789,6')
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].value
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].value,
).toBe('123 456 789,6')
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue,
).toBe(123456789.6)
})
@@ -1179,7 +1179,7 @@ describe('InputMasked component as_number', () => {
mask_options={{ allowDecimal: true, decimalLimit: 3 }}
value="12345.678"
locale="en-GB"
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345.678')
@@ -1190,7 +1190,7 @@ describe('InputMasked component as_number', () => {
mask_options={{ allowDecimal: true, decimalLimit: 3 }}
value="12345.678"
locale="nb-NO"
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345,678')
@@ -1204,7 +1204,7 @@ describe('InputMasked component as_number', () => {
mask_options={{ decimalLimit: 3 }}
value="12345.678"
/>
-
+ ,
)
expect(document.querySelector('input').value).toBe('12 345.678')
@@ -1217,7 +1217,7 @@ describe('InputMasked component as_number', () => {
mask_options={{ decimalLimit: 3 }}
value="12345.678"
/>
-
+ ,
)
expect(document.querySelector('input').value).toBe('12 345,678')
@@ -1230,7 +1230,7 @@ describe('InputMasked component as_number', () => {
as_number
number_mask={{ integerLimit: 4, decimalLimit: 4 }}
locale="en-GB"
- />
+ />,
)
expect(document.querySelector('input').value).toBe('1 234.9123')
@@ -1241,7 +1241,7 @@ describe('InputMasked component as_number', () => {
as_number
number_mask={{ integerLimit: 4, decimalLimit: 4 }}
locale="nb-NO"
- />
+ />,
)
expect(document.querySelector('input').value).toBe('1 234,9123')
@@ -1261,7 +1261,7 @@ describe('InputMasked component as_currency', () => {
value="12345.678"
as_currency
currency_mask={{ decimalLimit: 1 }}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345,6 kr')
@@ -1273,7 +1273,7 @@ describe('InputMasked component as_currency', () => {
value="12345.678"
as_currency
mask_options={{ decimalLimit: 1 }}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345,6 kr')
@@ -1285,7 +1285,7 @@ describe('InputMasked component as_currency', () => {
value="12345.678"
as_currency
mask_options={{ allowDecimal: false }}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345 kr')
@@ -1298,7 +1298,7 @@ describe('InputMasked component as_currency', () => {
as_currency
currency_mask={{ integerLimit: 4, decimalLimit: 3 }}
locale="en-GB"
- />
+ />,
)
expect(document.querySelector('input').value).toBe('1 234.912 NOK')
@@ -1309,7 +1309,7 @@ describe('InputMasked component as_currency', () => {
as_currency
currency_mask={{ integerLimit: 4, decimalLimit: 3 }}
locale="nb-NO"
- />
+ />,
)
expect(document.querySelector('input').value).toBe('1 234,912 kr')
@@ -1358,7 +1358,7 @@ describe('InputMasked component as_currency', () => {
const on_change = jest.fn()
const { rerender } = render(
-
+ ,
)
expect(document.querySelector('input').value).toBe('12 345,67 kr')
@@ -1370,10 +1370,10 @@ describe('InputMasked component as_currency', () => {
expect(document.querySelector('input').value).toBe('123 456 789,67 kr')
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].value
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].value,
).toBe('123 456 789,67 kr')
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue,
).toBe(123456789.67)
rerender(
@@ -1382,7 +1382,7 @@ describe('InputMasked component as_currency', () => {
as_currency
on_change={on_change}
mask_options={{ decimalLimit: 1 }}
- />
+ />,
)
fireEvent.change(document.querySelector('input'), {
@@ -1392,10 +1392,10 @@ describe('InputMasked component as_currency', () => {
expect(document.querySelector('input').value).toBe('123 456 789,6 kr')
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].value
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].value,
).toBe('123 456 789,6 kr')
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue,
).toBe(123456789.6)
})
@@ -1408,7 +1408,7 @@ describe('InputMasked component as_currency', () => {
value="12345.678"
as_currency
on_change={on_change}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345.67 NOK')
@@ -1419,14 +1419,14 @@ describe('InputMasked component as_currency', () => {
})
expect(document.querySelector('input').value).toBe(
- '123 456 789.67 NOK'
+ '123 456 789.67 NOK',
)
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].value
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].value,
).toBe('123 456 789.67 NOK')
expect(
- on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue
+ on_change.mock.calls[on_change.mock.calls.length - 1][0].numberValue,
).toBe(123456789.67)
})
@@ -1438,7 +1438,7 @@ describe('InputMasked component as_currency', () => {
it('should have correct decimals', () => {
const { rerender } = render(
-
+ ,
)
expect(document.querySelector('input').value).toBe('12 345,6 kr')
@@ -1460,7 +1460,7 @@ describe('InputMasked component as_currency', () => {
value="12345.016"
as_currency="NOK"
number_format={{ omit_rounding: false }}
- />
+ />,
)
expect(document.querySelector('input').value).toBe('12 345,02 kr')
@@ -1502,7 +1502,7 @@ describe('InputMasked component as_currency', () => {
}}
>
-
+ ,
)
expect(document.querySelector('input').value).toBe('12 345.6 NOK')
@@ -1520,7 +1520,7 @@ describe('InputMasked component as_currency', () => {
}}
>
-
+ ,
)
expect(document.querySelector('input').value).toBe('12 345.68 NOK')
@@ -1528,7 +1528,7 @@ describe('InputMasked component as_currency', () => {
it('should react to locale change', () => {
const { rerender } = render(
-
+ ,
)
expect(document.querySelector('input').value).toBe('12 345.67 NOK')
@@ -1542,7 +1542,7 @@ describe('InputMasked component as_currency', () => {
const { rerender } = render(
-
+ ,
)
expect(document.querySelector('input').value).toBe('12 345.67 NOK')
@@ -1551,7 +1551,7 @@ describe('InputMasked component as_currency', () => {
rerender(
-
+ ,
)
expect(document.querySelector('input').value).toBe('12 345,67 kr')
@@ -1680,7 +1680,7 @@ describe('InputMasked component as_currency', () => {
it('should change both value and locale', () => {
const { rerender } = render(
-
+ ,
)
expect(document.querySelector('input').value).toBe('12 345.67 NOK')
@@ -1713,12 +1713,12 @@ describe('InputMasked component as_currency', () => {
render(
-
+ ,
)
const element = document.querySelector('.dnb-input')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual([
@@ -1737,7 +1737,7 @@ describe('InputMasked component as_currency', () => {
it('should set correct cursor position on focus and mouseUp', async () => {
render(
-
+ ,
)
const element = document.querySelector('input')
diff --git a/packages/dnb-eufemia/src/components/input-masked/addons/createNumberMask.js b/packages/dnb-eufemia/src/components/input-masked/addons/createNumberMask.js
index 9bcb3a27526..317e578e431 100644
--- a/packages/dnb-eufemia/src/components/input-masked/addons/createNumberMask.js
+++ b/packages/dnb-eufemia/src/components/input-masked/addons/createNumberMask.js
@@ -77,12 +77,12 @@ export default function createNumberMask({
if (hasDecimal && (allowDecimal || requireDecimal)) {
integer = rawValue.slice(
rawValue.slice(0, prefixLength) === prefix ? prefixLength : 0,
- indexOfLastDecimal
+ indexOfLastDecimal,
)
fraction = rawValue.slice(indexOfLastDecimal + 1, rawValueLength)
fraction = convertToMask(
- fraction.replace(nonDigitsRegExp, emptyString)
+ fraction.replace(nonDigitsRegExp, emptyString),
)
} else {
if (rawValue.slice(0, prefixLength) === prefix) {
diff --git a/packages/dnb-eufemia/src/components/input-masked/addons/emailMask.js b/packages/dnb-eufemia/src/components/input-masked/addons/emailMask.js
index dac7f89d24a..6973b46ba28 100644
--- a/packages/dnb-eufemia/src/components/input-masked/addons/emailMask.js
+++ b/packages/dnb-eufemia/src/components/input-masked/addons/emailMask.js
@@ -26,30 +26,30 @@ function emailMask(rawValue, config) {
let localPartToDomainConnector = getConnector(
rawValue,
indexOfFirstAtSymbol + 1,
- atSymbol
+ atSymbol,
)
let domainNameToTopLevelDomainConnector = getConnector(
rawValue,
indexOfTopLevelDomainDot - 1,
- dot
+ dot,
)
let localPart = getLocalPart(
rawValue,
indexOfFirstAtSymbol,
- placeholderChar
+ placeholderChar,
)
let domainName = getDomainName(
rawValue,
indexOfFirstAtSymbol,
indexOfTopLevelDomainDot,
- placeholderChar
+ placeholderChar,
)
let topLevelDomain = getTopLevelDomain(
rawValue,
indexOfTopLevelDomainDot,
placeholderChar,
- currentCaretPosition
+ currentCaretPosition,
)
localPart = convertToMask(localPart)
@@ -91,7 +91,7 @@ function getDomainName(
rawValue,
indexOfFirstAtSymbol,
indexOfTopLevelDomainDot,
- placeholderChar
+ placeholderChar,
) {
let domainName = emptyString
@@ -99,19 +99,19 @@ function getDomainName(
if (indexOfTopLevelDomainDot === -1) {
domainName = rawValue.slice(
indexOfFirstAtSymbol + 1,
- rawValue.length
+ rawValue.length,
)
} else {
domainName = rawValue.slice(
indexOfFirstAtSymbol + 1,
- indexOfTopLevelDomainDot
+ indexOfTopLevelDomainDot,
)
}
}
domainName = domainName.replace(
new RegExp(`[\\s${placeholderChar}]`, g),
- emptyString
+ emptyString,
)
if (domainName === atSymbol) {
@@ -129,20 +129,20 @@ function getTopLevelDomain(
rawValue,
indexOfTopLevelDomainDot,
placeholderChar,
- currentCaretPosition
+ currentCaretPosition,
) {
let topLevelDomain = emptyString
if (indexOfTopLevelDomainDot !== -1) {
topLevelDomain = rawValue.slice(
indexOfTopLevelDomainDot + 1,
- rawValue.length
+ rawValue.length,
)
}
topLevelDomain = topLevelDomain.replace(
new RegExp(`[\\s${placeholderChar}.]`, g),
- emptyString
+ emptyString,
)
if (topLevelDomain.length === 0) {
@@ -163,7 +163,7 @@ function convertToMask(str, noDots) {
? char
: noDots
? anyNonDotOrWhitespaceRegExp
- : anyNonWhitespaceRegExp
+ : anyNonWhitespaceRegExp,
)
}
diff --git a/packages/dnb-eufemia/src/components/input-masked/text-mask/adjustCaretPosition.js b/packages/dnb-eufemia/src/components/input-masked/text-mask/adjustCaretPosition.js
index 46e9d5a411d..7181caa9df7 100644
--- a/packages/dnb-eufemia/src/components/input-masked/text-mask/adjustCaretPosition.js
+++ b/packages/dnb-eufemia/src/components/input-masked/text-mask/adjustCaretPosition.js
@@ -84,7 +84,7 @@ export default function adjustCaretPosition({
// Now we find all the characters in the left half that exist in the conformed input
// This step ensures that we don't look for a character that was filtered out or rejected by `conformToMask`.
const intersection = leftHalfChars.filter(
- (char) => normalizedConformedValue.indexOf(char) !== -1
+ (char) => normalizedConformedValue.indexOf(char) !== -1,
)
// The last character in the intersection is the character we want to look for in the conformed
@@ -141,17 +141,17 @@ export default function adjustCaretPosition({
// If the `conformedValue` got piped, we need to know which characters were piped in so that when we look for
// our `targetChar`, we don't select a piped char by mistake
const pipedChars = indexesOfPipedChars.map(
- (index) => normalizedConformedValue[index]
+ (index) => normalizedConformedValue[index],
)
// We need to know how many times the `targetChar` occurs in the piped characters.
const countTargetCharInPipedChars = pipedChars.filter(
- (char) => char === targetChar
+ (char) => char === targetChar,
).length
// We need to know how many times it occurs in the intersection
const countTargetCharInIntersection = intersection.filter(
- (char) => char === targetChar
+ (char) => char === targetChar,
).length
// We need to know if the placeholder contains characters that look like
@@ -166,7 +166,7 @@ export default function adjustCaretPosition({
// but also make sure that both the `rawValue` and placeholder don't have the same character at the same
// index because if they are equal, that means we are already counting those characters in
// `countTargetCharInIntersection`
- rawValue[index] !== char
+ rawValue[index] !== char,
).length
// The number of times we need to see occurrences of the `targetChar` before we know it is the one we're looking
diff --git a/packages/dnb-eufemia/src/components/input-masked/text-mask/conformToMask.js b/packages/dnb-eufemia/src/components/input-masked/text-mask/conformToMask.js
index fecc40a755d..4ff33e658e0 100644
--- a/packages/dnb-eufemia/src/components/input-masked/text-mask/conformToMask.js
+++ b/packages/dnb-eufemia/src/components/input-masked/text-mask/conformToMask.js
@@ -14,7 +14,7 @@ const emptyString = ''
export default function conformToMask(
rawValue = emptyString,
mask = emptyArray,
- config = {}
+ config = {},
) {
if (!isArray(mask)) {
// If someone passes a function as the mask property, we should call the
@@ -30,7 +30,7 @@ export default function conformToMask(
mask = processCaretTraps(mask).maskWithoutCaretTraps
} else {
throw new Error(
- 'Text-mask:conformToMask; The mask property must be an array.'
+ 'Text-mask:conformToMask; The mask property must be an array.',
)
}
}
@@ -257,7 +257,7 @@ export default function conformToMask(
// We substring from the beginning until the position after the last filled placeholder char.
conformedValue = conformedValue.substr(
0,
- indexOfLastFilledPlaceholderChar + 1
+ indexOfLastFilledPlaceholderChar + 1,
)
} else {
// If we couldn't find `indexOfLastFilledPlaceholderChar` that means the user deleted
diff --git a/packages/dnb-eufemia/src/components/input-masked/text-mask/createTextMaskInputElement.js b/packages/dnb-eufemia/src/components/input-masked/text-mask/createTextMaskInputElement.js
index 51c2d7e004d..90009fc5d7b 100644
--- a/packages/dnb-eufemia/src/components/input-masked/text-mask/createTextMaskInputElement.js
+++ b/packages/dnb-eufemia/src/components/input-masked/text-mask/createTextMaskInputElement.js
@@ -48,7 +48,7 @@ export default function createTextMaskInputElement(config) {
placeholderChar = defaultPlaceholderChar,
keepCharPositions = false,
showMask = false,
- } = config
+ } = config,
) {
// if `rawValue` is `undefined`, read from the `inputElement`
if (typeof rawValue === 'undefined') {
@@ -86,7 +86,7 @@ export default function createTextMaskInputElement(config) {
if (providedMask instanceof Array) {
placeholder = convertMaskToPlaceholder(
providedMask,
- placeholderChar
+ placeholderChar,
)
}
@@ -152,7 +152,7 @@ export default function createTextMaskInputElement(config) {
const { conformedValue } = conformToMask(
safeRawValue,
mask,
- conformToMaskConfig
+ conformToMaskConfig,
)
// The following few lines are to support the `pipe` feature.
@@ -233,7 +233,7 @@ export function safeSetSelection(element, selectionPosition) {
defer(
() =>
element.setSelectionRange(selectionPosition, selectionPosition),
- 0
+ 0,
)
} else {
element.setSelectionRange(selectionPosition, selectionPosition)
@@ -251,7 +251,7 @@ function getSafeRawValue(inputValue) {
} else {
throw new Error(
"The 'value' provided to Text Mask needs to be a string or a number. The value " +
- `received was:\n\n ${JSON.stringify(inputValue)}`
+ `received was:\n\n ${JSON.stringify(inputValue)}`,
)
}
}
diff --git a/packages/dnb-eufemia/src/components/input-masked/text-mask/utilities.js b/packages/dnb-eufemia/src/components/input-masked/text-mask/utilities.js
index 3c7e87f43f0..36216616e38 100644
--- a/packages/dnb-eufemia/src/components/input-masked/text-mask/utilities.js
+++ b/packages/dnb-eufemia/src/components/input-masked/text-mask/utilities.js
@@ -4,11 +4,11 @@ const emptyArray = []
export function convertMaskToPlaceholder(
mask = emptyArray,
- placeholderChar = defaultPlaceholderChar
+ placeholderChar = defaultPlaceholderChar,
) {
if (!isArray(mask)) {
throw new Error(
- 'Text-mask:convertMaskToPlaceholder; The mask property must be an array.'
+ 'Text-mask:convertMaskToPlaceholder; The mask property must be an array.',
)
}
@@ -17,9 +17,9 @@ export function convertMaskToPlaceholder(
'Placeholder character must not be used as part of the mask. Please specify a character ' +
'that is not present in your mask as your placeholder character.\n\n' +
`The placeholder character that was received is: ${JSON.stringify(
- placeholderChar
+ placeholderChar,
)}\n\n` +
- `The mask that was received is: ${JSON.stringify(mask)}`
+ `The mask that was received is: ${JSON.stringify(mask)}`,
)
}
diff --git a/packages/dnb-eufemia/src/components/input/Input.js b/packages/dnb-eufemia/src/components/input/Input.js
index 8802d106381..7230f9ad12f 100644
--- a/packages/dnb-eufemia/src/components/input/Input.js
+++ b/packages/dnb-eufemia/src/components/input/Input.js
@@ -328,7 +328,7 @@ export default class Input extends React.PureComponent {
{ skeleton: this.context?.skeleton },
this.context.getTranslation(this.props).Input,
includeValidProps(this.context.FormRow),
- this.context.Input
+ this.context.Input,
)
const {
@@ -414,7 +414,7 @@ export default class Input extends React.PureComponent {
'dnb-form-component',
createSpacingClasses(props),
_className,
- className
+ className,
),
'data-input-state': inputState,
'data-has-content': hasValue ? 'true' : 'false',
@@ -460,7 +460,7 @@ export default class Input extends React.PureComponent {
inputParams,
hasSubmitButton && !submit_element ? id + '-submit-button' : null,
showStatus ? id + '-status' : null,
- suffix ? id + '-suffix' : null
+ suffix ? id + '-suffix' : null,
)
}
if (readOnly) {
@@ -470,7 +470,7 @@ export default class Input extends React.PureComponent {
const shellParams = {
className: classnames(
'dnb-input__shell',
- createSkeletonClass('shape', skeleton, this.context)
+ createSkeletonClass('shape', skeleton, this.context),
),
}
@@ -539,7 +539,7 @@ export default class Input extends React.PureComponent {
id={id + '-placeholder'}
className={classnames(
'dnb-input__placeholder',
- align ? `dnb-input__align--${align}` : null
+ align ? `dnb-input__align--${align}` : null,
)}
role="presentation"
aria-hidden
@@ -580,7 +580,7 @@ export default class Input extends React.PureComponent {
icon={submit_button_icon}
status={convertStatusToStateOnly(
submit_button_status || status,
- status_state
+ status_state,
)}
status_state={status_state}
icon_size={
@@ -721,7 +721,7 @@ class InputSubmitButton extends React.PureComponent {
className={classnames(
'dnb-input__submit-button__button',
'dnb-button--input-button',
- className
+ className,
)}
variant={variant}
icon={icon}
@@ -753,7 +753,7 @@ const InputIcon = React.memo(
return false
}
return typeof prev === typeof next
- }
+ },
)
InputIcon.propTypes = {
icon: PropTypes.oneOfType([
diff --git a/packages/dnb-eufemia/src/components/input/InputPassword.js b/packages/dnb-eufemia/src/components/input/InputPassword.js
index 3114d6d6904..9d473ca677a 100644
--- a/packages/dnb-eufemia/src/components/input/InputPassword.js
+++ b/packages/dnb-eufemia/src/components/input/InputPassword.js
@@ -58,13 +58,13 @@ export default class InputPassword extends React.PureComponent {
if (this._ref.current) {
this._ref.current.focus()
}
- }
+ },
)
dispatchCustomElementEvent(
this,
hidden ? 'on_show_password' : 'on_hide_password',
- { event }
+ { event },
)
}
@@ -77,14 +77,14 @@ export default class InputPassword extends React.PureComponent {
this.context.getTranslation(this.props).Input,
includeValidProps(this.context.FormRow),
this.context.Input,
- this.context.InputPassword
+ this.context.InputPassword,
)
const id = this._id
const params = { id }
params['aria-describedby'] = combineDescribedBy(
this.props,
- id + '-submit-button'
+ id + '-submit-button',
)
return (
@@ -115,7 +115,7 @@ export default class InputPassword extends React.PureComponent {
skeleton={props.skeleton}
status={convertStatusToStateOnly(
props.status,
- props.status_state
+ props.status_state,
)}
status_state={props.status_state}
onClick={this.toggleVisibility}
diff --git a/packages/dnb-eufemia/src/components/input/__tests__/Input.test.tsx b/packages/dnb-eufemia/src/components/input/__tests__/Input.test.tsx
index 2ea36b4034c..e2c062218a3 100644
--- a/packages/dnb-eufemia/src/components/input/__tests__/Input.test.tsx
+++ b/packages/dnb-eufemia/src/components/input/__tests__/Input.test.tsx
@@ -27,13 +27,15 @@ describe('Input component', () => {
render(
{null}
-
+ ,
)
fireEvent.focus(document.querySelector('input'))
expect(
- document.querySelector('.dnb-input').getAttribute('data-input-state')
+ document
+ .querySelector('.dnb-input')
+ .getAttribute('data-input-state'),
).toBe('focus')
})
@@ -41,11 +43,13 @@ describe('Input component', () => {
render(
{null}
-
+ ,
)
expect(
- document.querySelector('.dnb-input').getAttribute('data-has-content')
+ document
+ .querySelector('.dnb-input')
+ .getAttribute('data-has-content'),
).toBe('false')
const newValue = 'new value'
@@ -54,11 +58,13 @@ describe('Input component', () => {
})
expect(
- document.querySelector('.dnb-input').getAttribute('data-has-content')
+ document
+ .querySelector('.dnb-input')
+ .getAttribute('data-has-content'),
).toBe('true')
expect(document.querySelector('input').getAttribute('value')).toBe(
- newValue
+ newValue,
)
})
@@ -110,7 +116,7 @@ describe('Input component', () => {
render( )
expect(document.querySelector('input').getAttribute('value')).toBe(
- format(initialValue)
+ format(initialValue),
)
const newValue = '12345678'
@@ -119,7 +125,7 @@ describe('Input component', () => {
})
expect(document.querySelector('input').getAttribute('value')).toBe(
- format(newValue)
+ format(newValue),
)
})
@@ -129,7 +135,7 @@ describe('Input component', () => {
on_change={({ value }) => {
return String(value).toUpperCase()
}}
- />
+ />,
)
const newValue = 'new value'
@@ -138,7 +144,7 @@ describe('Input component', () => {
})
expect(document.querySelector('input').getAttribute('value')).toBe(
- 'NEW VALUE'
+ 'NEW VALUE',
)
})
@@ -148,7 +154,7 @@ describe('Input component', () => {
on_change={() => {
return false
}}
- />
+ />,
)
const newValue = 'new value'
@@ -173,7 +179,7 @@ describe('Input component', () => {
value={initValue}
on_change={on_change}
onKeyDown={onKeyDown} // additional native event test
- />
+ />,
)
expect(document.querySelector('input').value).toBe(initValue)
@@ -203,7 +209,7 @@ describe('Input component', () => {
const { rerender } = render(
{null}
-
+ ,
)
const initValue = 'new prop value'
@@ -212,43 +218,43 @@ describe('Input component', () => {
rerender(
{null}
-
+ ,
)
expect(document.querySelector('input').value).toBe(initValue)
rerender(
{null}
-
+ ,
)
expect(document.querySelector('input').value).toBe('')
})
it('should show placeholder with both value null and undefined', () => {
const { rerender } = render(
-
+ ,
)
expect(
- document.querySelector('.dnb-input__placeholder').textContent
+ document.querySelector('.dnb-input__placeholder').textContent,
).toBe('AA')
rerender()
expect(
- document.querySelector('.dnb-input__placeholder').textContent
+ document.querySelector('.dnb-input__placeholder').textContent,
).toBe('BB')
rerender()
expect(
- document.querySelector('.dnb-input__placeholder').textContent
+ document.querySelector('.dnb-input__placeholder').textContent,
).toBe('CC')
rerender()
expect(
- document.querySelector('.dnb-input__placeholder')
+ document.querySelector('.dnb-input__placeholder'),
).not.toBeInTheDocument()
})
@@ -267,7 +273,7 @@ describe('Input component', () => {
rerender()
expect(document.querySelector('input').getAttribute('value')).toBe(
- String(zeroValue)
+ String(zeroValue),
)
})
@@ -277,14 +283,14 @@ describe('Input component', () => {
id="unique"
placeholder="Placeholder-text"
label="Label-text"
- />
+ />,
)
expect(document.querySelector('label').getAttribute('for')).toContain(
- 'unique'
+ 'unique',
)
expect(
- document.querySelector('input').getAttribute('aria-placeholder')
+ document.querySelector('input').getAttribute('aria-placeholder'),
).toContain('Placeholder-text')
rerender(
@@ -292,34 +298,34 @@ describe('Input component', () => {
id="unique"
placeholder="Placeholder-text"
label={undefined}
- />
+ />,
)
expect(document.querySelector('label')).not.toBeInTheDocument()
expect(
- document.querySelector('input').getAttribute('aria-placeholder')
+ document.querySelector('input').getAttribute('aria-placeholder'),
).toContain('Placeholder-text')
expect(document.querySelector('input')).not.toHaveAttribute(
- 'aria-labelledby'
+ 'aria-labelledby',
)
rerender(
-
+ ,
)
expect(document.querySelector('label')).not.toBeInTheDocument()
expect(document.querySelector('input')).not.toHaveAttribute(
- 'aria-placeholder'
+ 'aria-placeholder',
)
expect(document.querySelector('input')).not.toHaveAttribute(
- 'aria-labelledby'
+ 'aria-labelledby',
)
})
it('has correct medium input size', () => {
render()
expect(
- document.querySelector('.dnb-input--medium')
+ document.querySelector('.dnb-input--medium'),
).toBeInTheDocument()
})
@@ -341,7 +347,7 @@ describe('Input component', () => {
it('uses children as the value', () => {
render(children)
expect(document.querySelector('input').getAttribute('value')).toBe(
- 'children'
+ 'children',
)
})
@@ -364,14 +370,14 @@ describe('Input component', () => {
const { rerender } = render(
{null}
-
+ ,
)
const value = 'new value'
rerender(
{null}
-
+ ,
)
expect(document.querySelector('input').value).toBe(value)
})
@@ -384,7 +390,7 @@ describe('Input component', () => {
it('has to to have a status value as defined in the prop', () => {
render()
expect(
- document.querySelector('.dnb-form-status__text').textContent
+ document.querySelector('.dnb-form-status__text').textContent,
).toBe('status')
})
@@ -395,11 +401,11 @@ describe('Input component', () => {
status="status text"
status_state="warn"
status_props={{ stretch: true }}
- />
+ />,
)
expect(
- Array.from(document.querySelector('.dnb-form-status').classList)
+ Array.from(document.querySelector('.dnb-form-status').classList),
).toEqual([
'dnb-form-status',
'dnb-form-status--warn',
@@ -419,13 +425,13 @@ describe('Input component', () => {
render(
{null}
-
+ ,
)
expect(
document
.querySelector('.dnb-input__input')
- .getAttribute('aria-describedby')
+ .getAttribute('aria-describedby'),
).toBe('id input-submit-button')
const Button = document.querySelector('button')
@@ -435,7 +441,7 @@ describe('Input component', () => {
expect(
document
.querySelector('.dnb-input__submit-button')
- .getAttribute('data-input-state')
+ .getAttribute('data-input-state'),
).toBe('focus')
})
@@ -447,11 +453,11 @@ describe('Input component', () => {
value="value"
type="search"
on_submit={on_submit}
- />
+ />,
)
expect(document.querySelector('input').getAttribute('value')).toBe(
- 'value'
+ 'value',
)
fireEvent.keyDown(document.querySelector('input'), {
@@ -473,11 +479,11 @@ describe('Input with clear button', () => {
render()
expect(document.querySelector('input').getAttribute('value')).toBe(
- 'value'
+ 'value',
)
const clearButton = document.querySelector(
- 'button#input-id-clear-button'
+ 'button#input-id-clear-button',
)
fireEvent.click(clearButton)
@@ -488,11 +494,11 @@ describe('Input with clear button', () => {
render()
expect(document.querySelector('input').getAttribute('value')).toBe(
- 'value'
+ 'value',
)
const clearButton = document.querySelector(
- 'button#input-id-clear-button'
+ 'button#input-id-clear-button',
)
fireEvent.click(clearButton)
@@ -507,7 +513,7 @@ describe('Input with clear button', () => {
expect(document.querySelector('input').getAttribute('value')).toBe('')
const clearButton = document.querySelector(
- 'button#input-id-clear-button'
+ 'button#input-id-clear-button',
)
expect(document.querySelector('input').getAttribute('value')).toBe('')
@@ -519,7 +525,7 @@ describe('Input with clear button', () => {
render()
expect(document.querySelector('input').getAttribute('value')).toBe(
- 'value'
+ 'value',
)
fireEvent.keyDown(document.querySelector('input'), {
@@ -534,13 +540,15 @@ describe('Input with clear button', () => {
render()
const clearButton = document.querySelector(
- 'button#input-id-clear-button'
+ 'button#input-id-clear-button',
)
fireEvent.click(clearButton)
fireEvent.focus(document.querySelector('input'))
expect(
- document.querySelector('.dnb-input').getAttribute('data-input-state')
+ document
+ .querySelector('.dnb-input')
+ .getAttribute('data-input-state'),
).toBe('focus')
})
@@ -561,12 +569,12 @@ describe('Input with clear button', () => {
render(
-
+ ,
)
const element = document.querySelector('.dnb-input')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual([
@@ -585,26 +593,26 @@ describe('Input with clear button', () => {
it('should support icon', () => {
const { rerender } = render()
expect(
- document.querySelector('.dnb-input__icon').querySelector('svg')
+ document.querySelector('.dnb-input__icon').querySelector('svg'),
).toBeInTheDocument()
expect(
- document.querySelector('.dnb-icon--default')
+ document.querySelector('.dnb-icon--default'),
).toBeInTheDocument()
expect(
- document.querySelector('.dnb-input--icon-position-right')
+ document.querySelector('.dnb-input--icon-position-right'),
).not.toBeInTheDocument()
rerender()
expect(
- document.querySelector('.dnb-input--icon-position-right')
+ document.querySelector('.dnb-input--icon-position-right'),
).toBeInTheDocument()
expect(
document
.querySelector('.dnb-input')
.querySelector('.dnb-input__input ~ .dnb-input__icon')
- .querySelector('svg')
+ .querySelector('svg'),
).toBeInTheDocument()
})
@@ -612,15 +620,15 @@ describe('Input with clear button', () => {
global.console.log = jest.fn()
render()
expect(
- document.querySelector('.dnb-input--clear')
+ document.querySelector('.dnb-input--clear'),
).not.toBeInTheDocument()
expect(
- document.querySelector('.dnb-input__icon').querySelector('svg')
+ document.querySelector('.dnb-input__icon').querySelector('svg'),
).toBeInTheDocument()
expect(global.console.log).toHaveBeenCalledTimes(1)
expect(global.console.log).toHaveBeenCalledWith(
expect.stringContaining('Eufemia'),
- `You can not have a clear button and icon_position="right"`
+ `You can not have a clear button and icon_position="right"`,
)
})
@@ -632,14 +640,14 @@ describe('Input with clear button', () => {
document
.querySelector('.dnb-input')
.querySelector('.dnb-input__input ~ .dnb-input__inner__element')
- .textContent
+ .textContent,
).toBe('custom element')
expect(
document
.querySelector('.dnb-input')
.querySelector('.dnb-input__inner__element ~ .dnb-input__icon')
- .querySelector('svg')
+ .querySelector('svg'),
).toBeInTheDocument()
})
})
@@ -655,7 +663,7 @@ describe('Input ARIA', () => {
autocomplete="off"
value="some value"
/>
- >
+ >,
)
expect(await axeComponent(Comp)).toHaveNoViolations()
@@ -666,7 +674,7 @@ describe('Input ARIA', () => {
<>
- >
+ >,
)
expect(await axeComponent(Comp)).toHaveNoViolations()
})
@@ -680,7 +688,7 @@ describe('Input scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-input-theme-ui.scss')
+ require.resolve('../style/themes/dnb-input-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/input/__tests__/InputPassword.test.tsx b/packages/dnb-eufemia/src/components/input/__tests__/InputPassword.test.tsx
index 92d601ece39..754c5019061 100644
--- a/packages/dnb-eufemia/src/components/input/__tests__/InputPassword.test.tsx
+++ b/packages/dnb-eufemia/src/components/input/__tests__/InputPassword.test.tsx
@@ -21,7 +21,7 @@ describe('InputPassword component', () => {
render( )
expect(
- document.querySelector('.dnb-input__input').getAttribute('type')
+ document.querySelector('.dnb-input__input').getAttribute('type'),
).toBe('password')
})
@@ -31,7 +31,9 @@ describe('InputPassword component', () => {
fireEvent.focus(document.querySelector('input'))
expect(
- document.querySelector('.dnb-input').getAttribute('data-input-state')
+ document
+ .querySelector('.dnb-input')
+ .getAttribute('data-input-state'),
).toBe('focus')
})
@@ -39,17 +41,17 @@ describe('InputPassword component', () => {
const { rerender } = render( )
expect(
- document.querySelector('button').getAttribute('aria-label')
+ document.querySelector('button').getAttribute('aria-label'),
).toBe(nb.show_password)
rerender( )
expect(
- document.querySelector('button').getAttribute('aria-label')
+ document.querySelector('button').getAttribute('aria-label'),
).toBe(en.show_password)
expect(
- document.querySelector('button').getAttribute('aria-label')
+ document.querySelector('button').getAttribute('aria-label'),
).toBe(en.show_password)
})
@@ -60,12 +62,12 @@ describe('InputPassword component', () => {
expect(
document
.querySelector('.dnb-input__input')
- .getAttribute('aria-describedby')
+ .getAttribute('aria-describedby'),
).toBe('input-submit-button')
expect(
document
.querySelector('button#input-submit-button')
- .getAttribute('aria-controls')
+ .getAttribute('aria-controls'),
).toBe('input')
})
@@ -73,11 +75,11 @@ describe('InputPassword component', () => {
render( )
expect(
- document.querySelector('.dnb-input__input').getAttribute('id')
+ document.querySelector('.dnb-input__input').getAttribute('id'),
).toBe(
document
.querySelector('button.dnb-button--input-button')
- .getAttribute('aria-controls')
+ .getAttribute('aria-controls'),
)
})
@@ -91,7 +93,7 @@ describe('InputPassword component', () => {
expect(
document
.querySelector('.dnb-input__submit-button')
- .getAttribute('data-input-state')
+ .getAttribute('data-input-state'),
).toBe('focus')
})
@@ -103,18 +105,18 @@ describe('InputPassword component', () => {
fireEvent.click(Button)
expect(
- document.querySelector('.dnb-input__input').getAttribute('type')
+ document.querySelector('.dnb-input__input').getAttribute('type'),
).toBe('text')
fireEvent.click(Button)
expect(
- document.querySelector('.dnb-input__input').getAttribute('type')
+ document.querySelector('.dnb-input__input').getAttribute('type'),
).toBe('password')
expect(
document
.querySelector('.dnb-input__submit-button')
- .getAttribute('data-input-state')
+ .getAttribute('data-input-state'),
).not.toBe('focus')
})
@@ -125,7 +127,7 @@ describe('InputPassword component', () => {
+ />,
)
const Button = document.querySelector('button')
@@ -161,12 +163,12 @@ describe('InputPassword component', () => {
render(
-
+ ,
)
const element = document.querySelector('.dnb-input')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual([
@@ -185,7 +187,7 @@ describe('InputPassword component', () => {
it('should validate with ARIA rules as a input with a label', async () => {
const InputPasswordComp = render(
-
+ ,
)
expect(await axeComponent(InputPasswordComp)).toHaveNoViolations()
})
diff --git a/packages/dnb-eufemia/src/components/input/__tests__/__snapshots__/Input.test.tsx.snap b/packages/dnb-eufemia/src/components/input/__tests__/__snapshots__/Input.test.tsx.snap
index f027d4290de..9459ccb3a7f 100644
--- a/packages/dnb-eufemia/src/components/input/__tests__/__snapshots__/Input.test.tsx.snap
+++ b/packages/dnb-eufemia/src/components/input/__tests__/__snapshots__/Input.test.tsx.snap
@@ -1302,10 +1302,16 @@ exports[`Input scss have to match default theme snapshot 1`] = `
box-shadow: 0 0 0 var(--border-width) var(--border-color);
border-color: transparent;
}
-html:not([data-whatintent=touch]) .dnb-input__status--error .dnb-input__submit-button__button.dnb-button--secondary:not(.dnb-input__status--error .dnb-input__submit-button__button--has-text, [disabled]):hover, html:not([data-whatintent=touch]) .dnb-input__status--error .dnb-input__submit-button__button.dnb-button--secondary:not(.dnb-input__status--error .dnb-input__submit-button__button--has-text, [disabled]):hover::after, html:not([data-whatintent=touch]) .dnb-input__status--error .dnb-input__submit-button__button.dnb-button--secondary:not(.dnb-input__status--error .dnb-input__submit-button__button--has-text, [disabled]):focus, html:not([data-whatintent=touch]) .dnb-input__status--error .dnb-input__submit-button__button.dnb-button--secondary:not(.dnb-input__status--error .dnb-input__submit-button__button--has-text, [disabled]):focus::after {
+html:not([data-whatintent=touch]) .dnb-input__status--error .dnb-input__submit-button__button.dnb-button--secondary:not(.dnb-input__status--error .dnb-input__submit-button__button--has-text,
+[disabled]):hover, html:not([data-whatintent=touch]) .dnb-input__status--error .dnb-input__submit-button__button.dnb-button--secondary:not(.dnb-input__status--error .dnb-input__submit-button__button--has-text,
+[disabled]):hover::after, html:not([data-whatintent=touch]) .dnb-input__status--error .dnb-input__submit-button__button.dnb-button--secondary:not(.dnb-input__status--error .dnb-input__submit-button__button--has-text,
+[disabled]):focus, html:not([data-whatintent=touch]) .dnb-input__status--error .dnb-input__submit-button__button.dnb-button--secondary:not(.dnb-input__status--error .dnb-input__submit-button__button--has-text,
+[disabled]):focus::after {
background-color: var(--color-fire-red);
}
-html:not([data-whatintent=touch]) .dnb-input__status--error .dnb-input__submit-button__button.dnb-button--secondary:not(.dnb-input__status--error .dnb-input__submit-button__button--has-text, [disabled]):hover:active, html:not([data-whatintent=touch]) .dnb-input__status--error .dnb-input__submit-button__button.dnb-button--secondary:not(.dnb-input__status--error .dnb-input__submit-button__button--has-text, [disabled]):focus:active {
+html:not([data-whatintent=touch]) .dnb-input__status--error .dnb-input__submit-button__button.dnb-button--secondary:not(.dnb-input__status--error .dnb-input__submit-button__button--has-text,
+[disabled]):hover:active, html:not([data-whatintent=touch]) .dnb-input__status--error .dnb-input__submit-button__button.dnb-button--secondary:not(.dnb-input__status--error .dnb-input__submit-button__button--has-text,
+[disabled]):focus:active {
color: var(--color-white);
}
.dnb-input__status--error .dnb-input__icon {
diff --git a/packages/dnb-eufemia/src/components/input/style/themes/dnb-input-theme-ui.scss b/packages/dnb-eufemia/src/components/input/style/themes/dnb-input-theme-ui.scss
index f1c1119a2f1..d94e91eaa3b 100644
--- a/packages/dnb-eufemia/src/components/input/style/themes/dnb-input-theme-ui.scss
+++ b/packages/dnb-eufemia/src/components/input/style/themes/dnb-input-theme-ui.scss
@@ -69,9 +69,15 @@
&__status--error &__submit-button {
html:not([data-whatintent='touch'])
- &__button.dnb-button--secondary:not(&__button--has-text, [disabled]):hover,
+ &__button.dnb-button--secondary:not(
+ &__button--has-text,
+ [disabled]
+ ):hover,
html:not([data-whatintent='touch'])
- &__button.dnb-button--secondary:not(&__button--has-text, [disabled]):focus {
+ &__button.dnb-button--secondary:not(
+ &__button--has-text,
+ [disabled]
+ ):focus {
&,
&::after {
background-color: var(--color-fire-red);
diff --git a/packages/dnb-eufemia/src/components/logo/Logo.js b/packages/dnb-eufemia/src/components/logo/Logo.js
index f46ced8a27d..7a119c2dbc0 100644
--- a/packages/dnb-eufemia/src/components/logo/Logo.js
+++ b/packages/dnb-eufemia/src/components/logo/Logo.js
@@ -70,7 +70,7 @@ export default class Logo extends React.PureComponent {
this.props,
Logo.defaultProps,
this.context.getTranslation(this.props).Logo,
- this.context.Logo
+ this.context.Logo,
)
let {
@@ -122,7 +122,7 @@ export default class Logo extends React.PureComponent {
createSpacingClasses(props),
(width > 0 || height > 0) && 'dnb-logo--has-size',
size === 'inherit' && 'dnb-logo--inherit-size',
- inherit_color && 'dnb-logo--inherit-color'
+ inherit_color && 'dnb-logo--inherit-color',
),
role: 'img',
alt,
@@ -138,7 +138,7 @@ export default class Logo extends React.PureComponent {
createSpacingClasses(props),
(width > 0 || height > 0) && 'sbanken-logo--has-size',
size === 'inherit' && 'sbanken-logo--inherit-size',
- inherit_color && 'sbanken-logo--inherit-color'
+ inherit_color && 'sbanken-logo--inherit-color',
),
role: 'img',
alt,
diff --git a/packages/dnb-eufemia/src/components/logo/__tests__/Logo.screenshot.test.ts b/packages/dnb-eufemia/src/components/logo/__tests__/Logo.screenshot.test.ts
index 630b213e8a5..c8971bd2f9f 100644
--- a/packages/dnb-eufemia/src/components/logo/__tests__/Logo.screenshot.test.ts
+++ b/packages/dnb-eufemia/src/components/logo/__tests__/Logo.screenshot.test.ts
@@ -57,7 +57,10 @@ describe.each(['ui', 'sbanken'])('Logo for %s', (themeName) => {
describe('png image', () => {
it('have to match image snapshot', async () => {
const image = await loadImage(
- path.resolve(__dirname, '../../../../assets/images/dnb/dnb-logo.png')
+ path.resolve(
+ __dirname,
+ '../../../../assets/images/dnb/dnb-logo.png',
+ ),
)
expect(image).toMatchImageSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/logo/__tests__/Logo.test.tsx b/packages/dnb-eufemia/src/components/logo/__tests__/Logo.test.tsx
index d00a5aeedd6..f1265e3a397 100644
--- a/packages/dnb-eufemia/src/components/logo/__tests__/Logo.test.tsx
+++ b/packages/dnb-eufemia/src/components/logo/__tests__/Logo.test.tsx
@@ -20,14 +20,14 @@ describe('Logo component', () => {
it('should set correct class when inherit_color is set', () => {
render( )
expect(document.querySelector('.dnb-logo').classList).toContain(
- 'dnb-logo--inherit-color'
+ 'dnb-logo--inherit-color',
)
})
it('should set correct class when size="inherit" is set', () => {
render( )
expect(document.querySelector('.dnb-logo').classList).toContain(
- 'dnb-logo--inherit-size'
+ 'dnb-logo--inherit-size',
)
})
@@ -45,17 +45,17 @@ describe('Logo component', () => {
render( )
expect(document.querySelector('title').textContent).toBe('DNB Logo')
expect(document.querySelector('.dnb-logo').getAttribute('alt')).toBe(
- 'DNB Logo'
+ 'DNB Logo',
)
})
it('should have Sbanken title inside SVG', () => {
render( )
expect(document.querySelector('title').textContent).toBe(
- 'Sbanken - et konsept fra DNB logo'
+ 'Sbanken - et konsept fra DNB logo',
)
expect(
- document.querySelector('.sbanken-logo').getAttribute('alt')
+ document.querySelector('.sbanken-logo').getAttribute('alt'),
).toBe('Sbanken - et konsept fra DNB logo')
})
@@ -67,14 +67,14 @@ describe('Logo component', () => {
it('should set role="img"', () => {
render( )
expect(document.querySelector('.dnb-logo').getAttribute('role')).toBe(
- 'img'
+ 'img',
)
})
it('should set custom class', () => {
render( )
expect(document.querySelector('[role="img"]').classList).toContain(
- 'custom-selector'
+ 'custom-selector',
)
})
@@ -91,7 +91,7 @@ describe('Logo component', () => {
}}
>
-
+ ,
)
const html = document.querySelector('svg').outerHTML
@@ -106,7 +106,7 @@ describe('Logo component', () => {
render(
-
+ ,
)
const html = document.querySelector('svg').outerHTML
@@ -118,7 +118,7 @@ describe('Logo component', () => {
const element = document.querySelector('.dnb-logo')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).not.toContain('top')
@@ -147,7 +147,7 @@ describe('Logo component', () => {
const element = document.querySelector('.dnb-logo')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual([
@@ -171,9 +171,11 @@ describe('Logo scss', () => {
'has to match theme css for %s',
(themeName) => {
const css = loadScss(
- require.resolve(`../style/themes/dnb-logo-theme-${themeName}.scss`)
+ require.resolve(
+ `../style/themes/dnb-logo-theme-${themeName}.scss`,
+ ),
)
expect(css).toMatchSnapshot()
- }
+ },
)
})
diff --git a/packages/dnb-eufemia/src/components/modal/Modal.tsx b/packages/dnb-eufemia/src/components/modal/Modal.tsx
index 09bce13a831..0415c5ed69b 100644
--- a/packages/dnb-eufemia/src/components/modal/Modal.tsx
+++ b/packages/dnb-eufemia/src/components/modal/Modal.tsx
@@ -231,7 +231,7 @@ class Modal extends React.PureComponent<
() => {
this.isInTransition = false
this.handleSideEffects()
- }
+ },
)
}
@@ -296,10 +296,13 @@ class Modal extends React.PureComponent<
elem.focus({ preventScroll: true })
return new Promise((resolve) => {
- setTimeout(() => {
- elem?.removeAttribute('data-autofocus')
- resolve()
- }, parseFloat(String(animation_duration)) / 3)
+ setTimeout(
+ () => {
+ elem?.removeAttribute('data-autofocus')
+ resolve()
+ },
+ parseFloat(String(animation_duration)) / 3,
+ )
})
}
@@ -331,7 +334,7 @@ class Modal extends React.PureComponent<
close = (
event: Event,
- { ifIsLatest, triggeredBy = null } = { ifIsLatest: true }
+ { ifIsLatest, triggeredBy = null } = { ifIsLatest: true },
) => {
const { prevent_close = false } = this.props
@@ -391,7 +394,7 @@ class Modal extends React.PureComponent<
try {
document.documentElement.setAttribute(
'data-dnb-modal-active',
- modalId
+ modalId,
)
} catch (e) {
warn('Modal: Error on set "data-dnb-modal-active"', e)
@@ -405,7 +408,7 @@ class Modal extends React.PureComponent<
this.props,
Modal.defaultProps,
this.context.getTranslation(this.props).Modal,
- this.context.Modal
+ this.context.Modal,
)
const {
@@ -432,7 +435,7 @@ class Modal extends React.PureComponent<
const modal_content = Modal.getContent(
typeof this.props.children === 'function'
? Object.freeze({ ...this.props, close: this.close })
- : this.props
+ : this.props,
)
const render = (suffixProps) => {
@@ -482,7 +485,7 @@ class Modal extends React.PureComponent<
'dnb-modal__trigger',
createSpacingClasses(props),
triggerAttributes.class,
- triggerAttributes.className
+ triggerAttributes.className,
)}
/>
)}
diff --git a/packages/dnb-eufemia/src/components/modal/ModalContent.tsx b/packages/dnb-eufemia/src/components/modal/ModalContent.tsx
index 351533c0042..f24eb7aa3bd 100644
--- a/packages/dnb-eufemia/src/components/modal/ModalContent.tsx
+++ b/packages/dnb-eufemia/src/components/modal/ModalContent.tsx
@@ -137,7 +137,7 @@ export default class ModalContent extends React.PureComponent<
// '.dnb-modal--bypass_invalidation_deep *',
...(this.props?.bypass_invalidation_selectors || []),
- ].filter(Boolean)
+ ].filter(Boolean),
)
this._ii.activate()
} else {
@@ -262,7 +262,7 @@ export default class ModalContent extends React.PureComponent<
warn(e)
}
},
- isTrue(no_animation) ? 0 : timeoutDuration || 0
+ isTrue(no_animation) ? 0 : timeoutDuration || 0,
) // with this delay, the user can press esc without an focus action first
}
}
@@ -400,11 +400,11 @@ export default class ModalContent extends React.PureComponent<
'aria-labelledby': combineLabelledBy(
this.props,
title ? contentId + '-title' : null,
- labelled_by
+ labelled_by,
),
'aria-describedby': combineDescribedBy(
this.props,
- contentId + '-content'
+ contentId + '-content',
),
/**
@@ -422,7 +422,7 @@ export default class ModalContent extends React.PureComponent<
? `dnb-modal__content--${container_placement || 'right'}`
: null,
getThemeClasses(this.context?.theme),
- content_class
+ content_class,
),
onMouseDown: this.onContentMouseDownHandler,
onClick: this.onContentClickHandler,
@@ -472,7 +472,7 @@ export default class ModalContent extends React.PureComponent<
isTrue(no_animation) && 'dnb-modal__overlay--no-animation',
isTrue(no_animation_on_mobile) &&
'dnb-modal__overlay--no-animation-on-mobile',
- overlay_class
+ overlay_class,
)}
aria-hidden={true}
/>
diff --git a/packages/dnb-eufemia/src/components/modal/ModalRoot.tsx b/packages/dnb-eufemia/src/components/modal/ModalRoot.tsx
index 839afe6659d..4134466cdf0 100644
--- a/packages/dnb-eufemia/src/components/modal/ModalRoot.tsx
+++ b/packages/dnb-eufemia/src/components/modal/ModalRoot.tsx
@@ -57,7 +57,7 @@ export default class ModalRoot extends React.PureComponent<
window.__modalRoot.setAttribute('id', id)
document.body.insertBefore(
window.__modalRoot,
- document.body.firstChild
+ document.body.firstChild,
)
}
} catch (e) {
@@ -122,7 +122,7 @@ export default class ModalRoot extends React.PureComponent<
) {
return ReactDOM.createPortal(
{children} ,
- this.portalElem
+ this.portalElem,
)
}
diff --git a/packages/dnb-eufemia/src/components/modal/__tests__/Modal.test.tsx b/packages/dnb-eufemia/src/components/modal/__tests__/Modal.test.tsx
index 40b82a13687..93461ea7dfc 100644
--- a/packages/dnb-eufemia/src/components/modal/__tests__/Modal.test.tsx
+++ b/packages/dnb-eufemia/src/components/modal/__tests__/Modal.test.tsx
@@ -42,7 +42,7 @@ describe('Modal component', () => {
render(
-
+ ,
)
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
@@ -51,7 +51,7 @@ describe('Modal component', () => {
expect(typeof window.__modalStack[0]).toBe('object')
fireEvent.click(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
)
expect(window.__modalStack).toHaveLength(0)
@@ -66,7 +66,7 @@ describe('Modal component', () => {
- >
+ >,
)
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
@@ -74,30 +74,30 @@ describe('Modal component', () => {
// Check the global button
expect(document.querySelector('button.bypass-me')).toBeInTheDocument()
expect(document.querySelector('button.bypass-me')).toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(
- document.querySelector('button.bypass-me').getAttribute('tabindex')
+ document.querySelector('button.bypass-me').getAttribute('tabindex'),
).toBe('-1')
expect(
- document.querySelector('.dnb-modal__content')
+ document.querySelector('.dnb-modal__content'),
).not.toHaveAttribute('aria-hidden')
expect(
document
.querySelector('.dnb-modal__content')
- .querySelector('button.but-not-me')
+ .querySelector('button.but-not-me'),
).not.toHaveAttribute('aria-hidden')
// And close it again
fireEvent.click(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
)
expect(document.querySelector('button.bypass-me')).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(document.querySelector('button.bypass-me')).not.toHaveAttribute(
- 'tabindex'
+ 'tabindex',
)
})
@@ -109,24 +109,24 @@ describe('Modal component', () => {
content
- >
+ >,
)
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
expect(document.querySelector('button.bypass-me')).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(document.querySelector('button.bypass-me')).not.toHaveAttribute(
- 'tabindex'
+ 'tabindex',
)
expect(
document
.querySelector('button.but-not-me')
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('true')
expect(
- document.querySelector('button.but-not-me').getAttribute('tabindex')
+ document.querySelector('button.but-not-me').getAttribute('tabindex'),
).toBe('-1')
})
@@ -134,7 +134,7 @@ describe('Modal component', () => {
render(
-
+ ,
)
expect(document.querySelector('h1').textContent).toBe(props.title)
})
@@ -166,12 +166,12 @@ describe('Modal component', () => {
const { rerender } = render( )
rerender( )
expect(
- document.querySelector('button.dnb-modal__trigger')
+ document.querySelector('button.dnb-modal__trigger'),
).not.toBeInTheDocument()
rerender( )
expect(
- document.querySelector('button.dnb-modal__trigger')
+ document.querySelector('button.dnb-modal__trigger'),
).toBeInTheDocument()
})
@@ -183,16 +183,16 @@ describe('Modal component', () => {
}
- />
+ />,
)
const buttonElem = document.querySelector('button.dnb-modal__trigger')
expect(buttonElem.getAttribute('aria-label')).toBe(props.title)
expect(buttonElem.getAttribute('aria-roledescription')).toBe(
- 'Hjelp-knapp'
+ 'Hjelp-knapp',
)
fireEvent.click(document.querySelector('button'))
expect(document.querySelector('.dnb-modal__title').textContent).toBe(
- props.title
+ props.title,
)
})
@@ -204,13 +204,13 @@ describe('Modal component', () => {
}
- />
+ />,
)
const buttonElem = document.querySelector('button.dnb-modal__trigger')
expect(buttonElem.getAttribute('aria-label')).toBe('Hjelpetekst')
fireEvent.click(document.querySelector('button'))
expect(document.querySelector('.dnb-modal__title').textContent).toBe(
- 'Hjelpetekst'
+ 'Hjelpetekst',
)
})
@@ -221,17 +221,17 @@ describe('Modal component', () => {
{...props}
open_state={true}
trigger_attributes={{ disabled: true }}
- />
+ />,
)
expect(
- document.querySelector('button.dnb-modal__trigger')
+ document.querySelector('button.dnb-modal__trigger'),
).toHaveAttribute('disabled')
})
it('has working open event and close event if "Esc" key gets pressed', () => {
let testTriggeredBy = null
const on_close = jest.fn(
- ({ triggeredBy }) => (testTriggeredBy = triggeredBy)
+ ({ triggeredBy }) => (testTriggeredBy = triggeredBy),
)
const on_open = jest.fn()
render( )
@@ -261,7 +261,7 @@ describe('Modal component', () => {
{({ close }) => {
return
}}
-
+ ,
)
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
@@ -275,7 +275,7 @@ describe('Modal component', () => {
render(
-
+ ,
)
fireEvent.click(document.querySelector('button'))
await wait(2)
@@ -290,7 +290,7 @@ describe('Modal component', () => {
// and check the class of that element
expect(document.activeElement.classList).toContain(
- 'dnb-modal__trigger'
+ 'dnb-modal__trigger',
)
})
@@ -298,7 +298,7 @@ describe('Modal component', () => {
render(
-
+ ,
)
fireEvent.click(document.querySelector('button'))
@@ -309,10 +309,10 @@ describe('Modal component', () => {
})
expect(document.activeElement.getAttribute('data-autofocus')).toBe(
- 'true'
+ 'true',
)
expect(document.activeElement.classList).toContain(
- 'dnb-modal__trigger'
+ 'dnb-modal__trigger',
)
await wait(1)
@@ -332,7 +332,7 @@ describe('Modal component', () => {
{H2}
-
+ ,
)
// open
@@ -340,7 +340,7 @@ describe('Modal component', () => {
expect(helpers.warn).toHaveBeenCalledTimes(1)
expect(helpers.warn).toHaveBeenCalledWith(
- 'A Dialog or Drawer needs a h1 as its first element!'
+ 'A Dialog or Drawer needs a h1 as its first element!',
)
global.console.log = log
@@ -354,7 +354,7 @@ describe('Modal component', () => {
custom heading
-
+ ,
)
fireEvent.click(document.querySelector('button'))
@@ -370,12 +370,12 @@ describe('Modal component', () => {
header content
modal content
-
+ ,
)
fireEvent.click(document.querySelector('button'))
const elements = document.querySelectorAll(
- '.dnb-dialog__content > .dnb-section'
+ '.dnb-dialog__content > .dnb-section',
)
expect(elements[0].textContent).toContain('bar content')
@@ -430,24 +430,24 @@ describe('Modal component', () => {
-
+ ,
)
expect(
- document.querySelector('#content-third')
+ document.querySelector('#content-third'),
).not.toBeInTheDocument()
fireEvent.click(document.querySelector('button#modal-first'))
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-first')
fireEvent.click(document.querySelector('button#modal-second'))
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-second')
fireEvent.click(document.querySelector('button#modal-third'))
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-third')
await waitFor(() => {
@@ -457,25 +457,25 @@ describe('Modal component', () => {
})
expect(
- document.querySelectorAll('button.dnb-modal__close-button').length
+ document.querySelectorAll('button.dnb-modal__close-button').length,
).toBe(3)
expect(document.querySelector('#content-first')).toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(document.querySelector('#content-second')).toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(document.querySelector('#content-third')).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[0]
+ document.querySelectorAll('button.dnb-modal__close-button')[0],
).toHaveAttribute('aria-hidden')
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[1]
+ document.querySelectorAll('button.dnb-modal__close-button')[1],
).toHaveAttribute('aria-hidden')
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[2]
+ document.querySelectorAll('button.dnb-modal__close-button')[2],
).not.toHaveAttribute('aria-hidden')
// Close the third one
@@ -487,19 +487,19 @@ describe('Modal component', () => {
})
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-second')
expect(
- document.querySelector('#content-third')
+ document.querySelector('#content-third'),
).not.toBeInTheDocument()
expect(document.querySelector('#content-second')).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[0]
+ document.querySelectorAll('button.dnb-modal__close-button')[0],
).toHaveAttribute('aria-hidden')
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[1]
+ document.querySelectorAll('button.dnb-modal__close-button')[1],
).not.toHaveAttribute('aria-hidden')
// Close the second one
@@ -511,16 +511,16 @@ describe('Modal component', () => {
})
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-first')
expect(
- document.querySelector('#content-second')
+ document.querySelector('#content-second'),
).not.toBeInTheDocument()
expect(document.querySelector('#content-first')).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(
- document.querySelectorAll('button.dnb-modal__close-button')[0]
+ document.querySelectorAll('button.dnb-modal__close-button')[0],
).not.toHaveAttribute('aria-hidden')
// Close the first one
@@ -532,10 +532,10 @@ describe('Modal component', () => {
})
expect(
- document.querySelector('#content-first')
+ document.querySelector('#content-first'),
).not.toBeInTheDocument()
expect(document.documentElement).not.toHaveAttribute(
- 'data-dnb-modal-active'
+ 'data-dnb-modal-active',
)
})
@@ -562,19 +562,19 @@ describe('Modal component', () => {
render( )
expect(document.documentElement).not.toHaveAttribute(
- 'data-dnb-modal-active'
+ 'data-dnb-modal-active',
)
fireEvent.click(document.querySelector('button#toggle'))
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe('modal-id')
fireEvent.click(document.querySelector('button#toggle'))
expect(document.documentElement).not.toHaveAttribute(
- 'data-dnb-modal-active'
+ 'data-dnb-modal-active',
)
})
@@ -623,7 +623,7 @@ describe('Modal component', () => {
let preventClose = true
let testTriggeredBy = null
const on_close = jest.fn(
- ({ triggeredBy }) => (testTriggeredBy = triggeredBy)
+ ({ triggeredBy }) => (testTriggeredBy = triggeredBy),
)
const on_open = jest.fn()
const on_close_prevent = jest.fn(({ triggeredBy, close }) => {
@@ -650,7 +650,7 @@ describe('Modal component', () => {
on_close_prevent={on_close_prevent}
>
-
+ ,
)
fireEvent.click(document.querySelector('button'))
expect(on_open).toHaveBeenCalledTimes(1)
@@ -659,7 +659,7 @@ describe('Modal component', () => {
new KeyboardEvent('keydown', {
key: 'esc',
keyCode: 27, // esc
- })
+ }),
)
await waitFor(() => {
@@ -680,7 +680,7 @@ describe('Modal component', () => {
// trigger the close button
fireEvent.click(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
)
await waitFor(() => {
expect(on_close_prevent).toHaveBeenCalledTimes(3)
@@ -692,13 +692,13 @@ describe('Modal component', () => {
new KeyboardEvent('keydown', {
key: 'esc',
keyCode: 27, // esc
- })
+ }),
)
await waitFor(() => {
expect(on_close_prevent).toHaveBeenCalledTimes(4)
expect(on_close_prevent.mock.calls[3][0].triggeredBy).toBe(
- 'keyboard'
+ 'keyboard',
)
})
@@ -709,24 +709,24 @@ describe('Modal component', () => {
fireEvent.click(document.querySelector('div.dnb-modal__content'))
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).toBeInTheDocument()
// trigger the close button
fireEvent.click(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
)
expect(testTriggeredBy).toBe('button')
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).not.toBeInTheDocument()
})
it('will close the modal on overlay click', () => {
let testTriggeredBy = null
const on_close = jest.fn(
- ({ triggeredBy }) => (testTriggeredBy = triggeredBy)
+ ({ triggeredBy }) => (testTriggeredBy = triggeredBy),
)
const on_open = jest.fn()
render( )
@@ -741,7 +741,7 @@ describe('Modal component', () => {
expect(on_close).toHaveBeenCalledTimes(1)
expect(testTriggeredBy).toBe('overlay')
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).not.toBeInTheDocument()
})
@@ -755,7 +755,7 @@ describe('Modal component', () => {
expect(on_close).toHaveBeenCalledTimes(0)
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).toBeInTheDocument()
})
@@ -778,7 +778,7 @@ describe('Modal component', () => {
expect(on_close).toHaveBeenCalledTimes(0)
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).toBeInTheDocument()
// trigger the close on the overlay
@@ -790,18 +790,18 @@ describe('Modal component', () => {
expect(on_close).toHaveBeenCalledTimes(1)
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).not.toBeInTheDocument()
})
it('has working open event and close event on changing the "open_state"', () => {
let testTriggeredBy = null
const on_close = jest.fn(
- ({ triggeredBy }) => (testTriggeredBy = triggeredBy)
+ ({ triggeredBy }) => (testTriggeredBy = triggeredBy),
)
const on_open = jest.fn()
const { rerender } = render(
-
+ ,
)
rerender(
{
on_close={on_close}
on_open={on_open}
open_state="opened"
- />
+ />,
)
expect(on_open).toHaveBeenCalledTimes(1)
expect(testTriggeredBy).toBe(null)
@@ -820,7 +820,7 @@ describe('Modal component', () => {
on_close={on_close}
on_open={on_open}
open_state="closed"
- />
+ />,
)
expect(on_close).toHaveBeenCalledTimes(1)
expect(testTriggeredBy).toBe('unmount')
@@ -838,7 +838,7 @@ describe('Modal component', () => {
>
{modalContent}
-
+ ,
)
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
@@ -849,7 +849,7 @@ describe('Modal component', () => {
expect(modalElem.textContent).toContain(modalContent)
fireEvent.click(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
)
})
@@ -869,7 +869,7 @@ describe('Modal component', () => {
-
+ ,
)
fireEvent.click(document.querySelector('button.dnb-modal__trigger'))
@@ -882,7 +882,7 @@ describe('Modal component', () => {
expect(outsideButton.getAttribute('aria-hidden')).toEqual('true')
fireEvent.click(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
)
})
@@ -890,7 +890,7 @@ describe('Modal component', () => {
render(
-
+ ,
)
const elem = document.querySelector('button')
@@ -905,7 +905,7 @@ describe('Modal component', () => {
expect(document.body.style.marginRight).toBe('0px')
expect(document.documentElement.style.height).toBe('100%')
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe(props.id)
// close modal
@@ -914,7 +914,7 @@ describe('Modal component', () => {
expect(document.body.getAttribute('style')).toBe('')
expect(document.documentElement.getAttribute('style')).toBe('')
expect(document.documentElement).not.toHaveAttribute(
- 'data-dnb-modal-active'
+ 'data-dnb-modal-active',
)
})
@@ -922,7 +922,7 @@ describe('Modal component', () => {
render(
-
+ ,
)
const elem = document.querySelector('button')
@@ -947,15 +947,15 @@ describe('Modal component', () => {
expect(addEventListener).toHaveBeenCalledWith(
'touchmove',
expect.any(Function),
- { passive: false }
+ { passive: false },
)
expect(addEventListener).toHaveBeenCalledWith(
'keydown',
- expect.any(Function)
+ expect.any(Function),
)
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe(props.id)
// close modal
@@ -965,18 +965,18 @@ describe('Modal component', () => {
expect(document.documentElement).not.toHaveAttribute('style')
expect(document.documentElement).not.toHaveAttribute(
- 'data-dnb-modal-active'
+ 'data-dnb-modal-active',
)
expect(removeEventListener).toBeCalledTimes(2)
expect(removeEventListener).toHaveBeenCalledWith(
'touchmove',
expect.any(Function),
- { passive: false }
+ { passive: false },
)
expect(removeEventListener).toHaveBeenCalledWith(
'keydown',
- expect.any(Function)
+ expect.any(Function),
)
})
@@ -984,7 +984,7 @@ describe('Modal component', () => {
render(
-
+ ,
)
const elem = document.querySelector('button')
@@ -1003,7 +1003,7 @@ describe('Modal component', () => {
expect(document.body.style.height).toBe('auto')
expect(document.documentElement.style.height).toBe('100%')
expect(
- document.documentElement.getAttribute('data-dnb-modal-active')
+ document.documentElement.getAttribute('data-dnb-modal-active'),
).toBe(props.id)
// close modal
@@ -1012,7 +1012,7 @@ describe('Modal component', () => {
expect(document.body.getAttribute('style')).toBe('')
expect(document.documentElement.getAttribute('style')).toBe('')
expect(document.documentElement).not.toHaveAttribute(
- 'data-dnb-modal-active'
+ 'data-dnb-modal-active',
)
})
@@ -1021,12 +1021,12 @@ describe('Modal component', () => {
rerender( )
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).toBeInTheDocument()
rerender( )
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).not.toBeInTheDocument()
})
@@ -1035,13 +1035,13 @@ describe('Modal component', () => {
rerender( )
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).toBeInTheDocument()
rerender( )
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).not.toBeInTheDocument()
})
@@ -1084,21 +1084,21 @@ describe('Modal component', () => {
expect(document.querySelector('span.count').textContent).toBe('1')
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).not.toBeInTheDocument()
fireEvent.click(document.querySelector('button#modal-trigger'))
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).toBeInTheDocument()
fireEvent.click(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
)
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).not.toBeInTheDocument()
fireEvent.click(document.querySelector('button#count-trigger'))
@@ -1162,16 +1162,16 @@ describe('Modal component', () => {
fireEvent.click(document.querySelector('button#modal-trigger'))
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).toBeInTheDocument()
// close
fireEvent.click(
- document.querySelector('button.dnb-modal__close-button')
+ document.querySelector('button.dnb-modal__close-button'),
)
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).not.toBeInTheDocument()
expect(on_open).toHaveBeenCalledTimes(1)
@@ -1182,7 +1182,7 @@ describe('Modal component', () => {
expect(document.querySelector('span#count').textContent).toBe('2')
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).not.toBeInTheDocument()
expect(on_close).toHaveBeenCalledTimes(1)
@@ -1192,7 +1192,7 @@ describe('Modal component', () => {
expect(on_open).toHaveBeenCalledTimes(2)
expect(on_close).toHaveBeenCalledTimes(1)
expect(
- document.querySelector('div.dnb-modal__content')
+ document.querySelector('div.dnb-modal__content'),
).toBeInTheDocument()
})
@@ -1240,7 +1240,7 @@ describe('Modal component', () => {
expect(on_open).toHaveBeenCalledTimes(1)
expect(on_close).toHaveBeenCalledTimes(1)
expect(
- document.querySelector('div.dnb-dialog')
+ document.querySelector('div.dnb-dialog'),
).not.toBeInTheDocument()
})
@@ -1248,8 +1248,8 @@ describe('Modal component', () => {
render( )
expect(
document.querySelector(
- `[aria-describedby="dnb-modal-${props.id}-content"]`
- )
+ `[aria-describedby="dnb-modal-${props.id}-content"]`,
+ ),
).toBeInTheDocument()
})
@@ -1282,14 +1282,14 @@ describe('Modal component', () => {
render(
-
+ ,
)
// open modal
fireEvent.click(document.querySelector('button'))
expect(
document
.querySelector('button.dnb-modal__close-button')
- .textContent.replace(/\u200C/g, '')
+ .textContent.replace(/\u200C/g, ''),
).toBe('Lukk')
})
@@ -1300,12 +1300,12 @@ describe('Modal component', () => {
expect(
document
.querySelector('.dnb-modal__content')
- .getAttribute('aria-label')
+ .getAttribute('aria-label'),
).toContain('Vindu')
rerender( )
expect(
- document.querySelector('.dnb-modal__content')
+ document.querySelector('.dnb-modal__content'),
).not.toHaveAttribute('aria-label')
})
@@ -1313,25 +1313,25 @@ describe('Modal component', () => {
render(
-
+ ,
)
// open modal
fireEvent.click(document.querySelector('button'))
expect(
document
.querySelector('.dnb-modal__content')
- .getAttribute('aria-labelledby')
+ .getAttribute('aria-labelledby'),
).toBe('dnb-modal-modal_id-title')
expect(
document
.querySelector('.dnb-modal__content')
- .getAttribute('aria-describedby')
+ .getAttribute('aria-describedby'),
).toBe('dnb-modal-modal_id-content')
expect(
- document.querySelector('.dnb-dialog__header').getAttribute('id')
+ document.querySelector('.dnb-dialog__header').getAttribute('id'),
).toBe('dnb-modal-modal_id-title')
expect(
- document.querySelector('.dnb-dialog__content').getAttribute('id')
+ document.querySelector('.dnb-dialog__content').getAttribute('id'),
).toBe('dnb-modal-modal_id-content')
})
@@ -1346,7 +1346,7 @@ describe('Modal component', () => {
variant: 'tertiary',
icon: false,
}}
- />
+ />,
)
expect(document.querySelector('.dnb-icon')).not.toBeInTheDocument()
})
@@ -1355,11 +1355,11 @@ describe('Modal component', () => {
render(
+ />,
)
expect(document.querySelector('.dnb-icon')).toBeInTheDocument()
render(
-
+ ,
)
expect(document.querySelector('.dnb-icon')).toBeInTheDocument()
})
@@ -1369,13 +1369,13 @@ describe('Modal component', () => {
render(
The informational content
-
+ ,
)
expect(
document
.querySelector('button.dnb-modal__trigger')
- .querySelector('.dnb-button__text').textContent
+ .querySelector('.dnb-button__text').textContent,
).toBe(customText)
})
})
@@ -1388,69 +1388,69 @@ describe('Modal trigger', () => {
expect(
document
.querySelector('button.dnb-modal__trigger')
- .getAttribute('aria-roledescription')
+ .getAttribute('aria-roledescription'),
).toBe(roledescription)
})
it('will have a aria-label', () => {
render(
-
+ ,
)
expect(
document
.querySelector('button.dnb-modal__trigger')
- .getAttribute('aria-roledescription')
+ .getAttribute('aria-roledescription'),
).toBe(roledescription)
expect(
document
.querySelector('button.dnb-modal__trigger')
- .getAttribute('aria-label')
+ .getAttribute('aria-label'),
).toBe('label')
})
it('will not act as a HelpButton if only trigger_text was given', () => {
render( )
expect(
- document.querySelector('button.dnb-modal__trigger')
+ document.querySelector('button.dnb-modal__trigger'),
).not.toHaveAttribute('aria-roledescription')
expect(
document
.querySelector('button.dnb-modal__trigger')
- .querySelector('.dnb-button__icon')
+ .querySelector('.dnb-button__icon'),
).not.toBeInTheDocument()
expect(
document
.querySelector('button.dnb-modal__trigger')
- .textContent.replace(/\u200C/g, '')
+ .textContent.replace(/\u200C/g, ''),
).toBe('text')
})
it('will not act as a HelpButton if a different icon was given', () => {
render( )
expect(
- document.querySelector('button.dnb-modal__trigger')
+ document.querySelector('button.dnb-modal__trigger'),
).not.toHaveAttribute('aria-roledescription')
expect(
document
.querySelector('button.dnb-modal__trigger')
- .querySelector('.dnb-button__icon')
+ .querySelector('.dnb-button__icon'),
).toBeInTheDocument()
})
it('will not act as a HelpButton if trigger text was given', () => {
render( )
expect(
- document.querySelector('button.dnb-modal__trigger')
+ document.querySelector('button.dnb-modal__trigger'),
).not.toHaveAttribute('aria-roledescription')
expect(
document
.querySelector('button.dnb-modal__trigger')
- .querySelector('.dnb-button__icon')
+ .querySelector('.dnb-button__icon'),
).not.toBeInTheDocument()
expect(
document
.querySelector('button.dnb-modal__trigger')
- .textContent.replace(/\u200C/g, '')
+ .textContent.replace(/\u200C/g, ''),
).toBe('text')
})
})
diff --git a/packages/dnb-eufemia/src/components/modal/bodyScrollLock.js b/packages/dnb-eufemia/src/components/modal/bodyScrollLock.js
index 314e3bf6298..e9bca4129a4 100644
--- a/packages/dnb-eufemia/src/components/modal/bodyScrollLock.js
+++ b/packages/dnb-eufemia/src/components/modal/bodyScrollLock.js
@@ -49,7 +49,7 @@ const setOverflowHidden = () => {
htmlElement.style.height = '100%'
htmlElement.style.setProperty(
'--scrollbar-width',
- `${scrollBarWidth}px`
+ `${scrollBarWidth}px`,
)
bodyElement.style.overflow = 'hidden'
@@ -102,7 +102,7 @@ const setOverflowHiddenIOS = (targetElement) => {
document.addEventListener(
'touchmove',
preventDefault,
- eventListenerOptions
+ eventListenerOptions,
)
documentListenerAdded = true
}
@@ -126,7 +126,7 @@ const setOverflowHiddenIOS = (targetElement) => {
document.removeEventListener(
'touchmove',
preventDefault,
- eventListenerOptions
+ eventListenerOptions,
)
documentListenerAdded = false
}
@@ -210,7 +210,7 @@ const handleScroll = (event, targetElement) => {
const hasScrollbar = isChildOfElement(
event.target,
targetElement,
- checkIfHasScrollbar
+ checkIfHasScrollbar,
)
if (hasScrollbar && hasScrollbar !== targetElement) {
@@ -234,7 +234,7 @@ const checkTargetElement = (targetElement) => {
if (targetElement === null) return
warn(
`If scrolling is also required in the floating layer, ` +
- `the target element must be provided.`
+ `the target element must be provided.`,
)
}
diff --git a/packages/dnb-eufemia/src/components/modal/helpers.ts b/packages/dnb-eufemia/src/components/modal/helpers.ts
index 3b3c68af1a4..285acf3c3b8 100644
--- a/packages/dnb-eufemia/src/components/modal/helpers.ts
+++ b/packages/dnb-eufemia/src/components/modal/helpers.ts
@@ -54,7 +54,7 @@ export function removeFromIndex(elem) {
window.__modalStack = []
}
window.__modalStack = window.__modalStack.filter(
- (cur) => cur !== elem
+ (cur) => cur !== elem,
)
} catch (e) {
warn(e)
diff --git a/packages/dnb-eufemia/src/components/modal/parts/CloseButton.tsx b/packages/dnb-eufemia/src/components/modal/parts/CloseButton.tsx
index bfc7ad5c27f..b83a06a75a1 100644
--- a/packages/dnb-eufemia/src/components/modal/parts/CloseButton.tsx
+++ b/packages/dnb-eufemia/src/components/modal/parts/CloseButton.tsx
@@ -40,7 +40,7 @@ export default class CloseButton extends React.PureComponent {
} = extendPropsWithContextInClassComponent(
this.props,
CloseButton.defaultProps,
- this.context.getTranslation(this.props).Modal
+ this.context.getTranslation(this.props).Modal,
)
return (
diff --git a/packages/dnb-eufemia/src/components/modal/parts/ModalHeader.tsx b/packages/dnb-eufemia/src/components/modal/parts/ModalHeader.tsx
index 85515d2eb9b..27b6816ff1b 100644
--- a/packages/dnb-eufemia/src/components/modal/parts/ModalHeader.tsx
+++ b/packages/dnb-eufemia/src/components/modal/parts/ModalHeader.tsx
@@ -81,7 +81,7 @@ export default class ModalHeader extends React.PureComponent<
'dnb-space__top--zero',
'dnb-space__bottom--small',
`dnb-h--${fontSize}`,
- title_class
+ title_class,
)}
>
{usedTitle}
diff --git a/packages/dnb-eufemia/src/components/modal/parts/ModalHeaderBar.tsx b/packages/dnb-eufemia/src/components/modal/parts/ModalHeaderBar.tsx
index a12017eec8f..74bcf8210e9 100644
--- a/packages/dnb-eufemia/src/components/modal/parts/ModalHeaderBar.tsx
+++ b/packages/dnb-eufemia/src/components/modal/parts/ModalHeaderBar.tsx
@@ -66,7 +66,7 @@ export default class ModalHeaderBar extends React.PureComponent<
{
rootMargin: `${marginTop}px 0px 0px 0px`,
threshold: 0.001,
- }
+ },
)
this.intersectionObserver.observe(this._ref.current)
@@ -104,7 +104,7 @@ export default class ModalHeaderBar extends React.PureComponent<
className={classnames(
'dnb-modal__header__bar',
showShadow && shadow_class,
- className
+ className,
)}
inner_ref={this._ref}
{...props}
diff --git a/packages/dnb-eufemia/src/components/modal/types.ts b/packages/dnb-eufemia/src/components/modal/types.ts
index 2390eb59308..1f749e33014 100644
--- a/packages/dnb-eufemia/src/components/modal/types.ts
+++ b/packages/dnb-eufemia/src/components/modal/types.ts
@@ -107,7 +107,7 @@ export interface ModalProps extends ModalRootProps {
*/
close_modal?: (
close?: (...args: any[]) => void,
- elem?: any
+ elem?: any,
) => () => void | void
/**
diff --git a/packages/dnb-eufemia/src/components/number-format/NumberFormat.js b/packages/dnb-eufemia/src/components/number-format/NumberFormat.js
index 5f99f024a61..526a930baec 100644
--- a/packages/dnb-eufemia/src/components/number-format/NumberFormat.js
+++ b/packages/dnb-eufemia/src/components/number-format/NumberFormat.js
@@ -200,7 +200,7 @@ export default class NumberFormat extends React.PureComponent {
if (!isTrue(this.props.copy_selection)) {
this.outsideClick = detectOutsideClick(
this._ref.current,
- this.onBlurHandler
+ this.onBlurHandler,
)
}
})
@@ -239,7 +239,7 @@ export default class NumberFormat extends React.PureComponent {
this.props,
NumberFormat.defaultProps,
this.context.getTranslation(this.props).NumberFormat,
- this.context.NumberFormat
+ this.context.NumberFormat,
)
const {
@@ -307,7 +307,7 @@ export default class NumberFormat extends React.PureComponent {
const useContext = extend(
true,
{ locale: null, currency: null },
- this.context
+ this.context,
)
if (useContext) {
@@ -347,7 +347,7 @@ export default class NumberFormat extends React.PureComponent {
isTrue(selectall) && 'dnb-number-format--selectall',
this.state.selected && 'dnb-number-format--selected',
link && 'dnb-anchor',
- createSpacingClasses(this.props)
+ createSpacingClasses(this.props),
),
...rest,
}
@@ -376,8 +376,8 @@ export default class NumberFormat extends React.PureComponent {
)
aria = String(
`${convertJsxToString(
- this.runFix(prefix, 'dnb-number-format__prefix')
- )} ${aria}`
+ this.runFix(prefix, 'dnb-number-format__prefix'),
+ )} ${aria}`,
)
}
if (suffix) {
@@ -387,7 +387,7 @@ export default class NumberFormat extends React.PureComponent {
>
)
aria = `${aria} ${convertJsxToString(
- this.runFix(suffix, 'dnb-number-format__suffix')
+ this.runFix(suffix, 'dnb-number-format__suffix'),
)}`
}
@@ -417,7 +417,7 @@ export default class NumberFormat extends React.PureComponent {
{
let display = value
let aria = null
@@ -170,7 +170,7 @@ export const format = (
opts.style = 'currency'
opts.currencyDisplay = getFallbackCurrencyDisplay(
locale,
- opts.currencyDisplay || currency_display
+ opts.currencyDisplay || currency_display,
)
// if currency has no decimal, then go ahead and remove it
@@ -213,7 +213,7 @@ export const format = (
formatter = currencyPositionFormatter(
formatter,
({ value }) => (currencySuffix = value.trim()),
- currency_position
+ currency_position,
)
}
@@ -280,13 +280,13 @@ export const format = (
default:
return item
}
- }
+ },
)
} else {
const thousandsSeparator = getThousandsSeparator(locale)
cleanedValue = String(display).replace(
new RegExp(`${thousandsSeparator}(?=\\d{3})`, 'g'),
- ''
+ '',
)
}
@@ -311,7 +311,7 @@ export const formatDecimals = (
value,
decimals,
omit_rounding = false,
- opts = {}
+ opts = {},
) => {
decimals = parseFloat(decimals)
@@ -324,7 +324,7 @@ export const formatDecimals = (
if (pos > 0 && omit_rounding === true) {
value = String(value).substring(
0,
- pos + 1 + (decimals || opts.maximumFractionDigits)
+ pos + 1 + (decimals || opts.maximumFractionDigits),
)
}
@@ -358,7 +358,7 @@ export const countDecimals = (value, decimalSeparator = '.') => {
const currencyPositionFormatter = (
existingFormatter,
callback,
- position = null
+ position = null,
) => {
let count = 0
let countCurrency = -1
@@ -477,13 +477,13 @@ export const formatNumber = (
number,
locale,
options = {},
- formatter = null
+ formatter = null,
) => {
try {
if (options.currencyDisplay) {
options.currencyDisplay = getFallbackCurrencyDisplay(
locale,
- options.currencyDisplay
+ options.currencyDisplay,
)
}
@@ -511,7 +511,7 @@ export const formatNumber = (
locale,
options,
])}`,
- e
+ e,
)
}
return number
@@ -568,7 +568,7 @@ export const formatPhone = (number, locale = null) => {
.split(
length === 6
? /^(\+[0-9]{2})|([0-9]{3})/
- : /^(\+[0-9]{2})|([0-9]{2})/
+ : /^(\+[0-9]{2})|([0-9]{2})/,
)
.filter((s) => s)
.join(' ')
@@ -688,7 +688,7 @@ export const formatNIN = (number, locale = null) => {
// correct nin for screen readers
aria = display
.split(
- /([0-9]{2})([0-9]{2})([0-9]{2}) ([0-9]{1})([0-9]{1})([0-9]{1})([0-9]{1})([0-9]{1})/
+ /([0-9]{2})([0-9]{2})([0-9]{2}) ([0-9]{1})([0-9]{1})([0-9]{1})([0-9]{1})([0-9]{1})/,
)
.filter((s) => s)
.join(IS_WIN ? '. ' : ' ') // NVDA fix with a dot to not read date on FF
@@ -716,7 +716,7 @@ export function cleanNumber(
thousandsSeparator = null,
prefix = null,
suffix = null,
- } = {}
+ } = {},
) {
if (typeof num === 'number') {
return num
@@ -773,7 +773,7 @@ export function cleanNumber(
const thousandReg = thousandsSeparator
? new RegExp(
`([0-9]|)(${escapeRegexChars(thousandsSeparator)})([0-9]{3})`,
- 'g'
+ 'g',
)
: new RegExp(`([0-9]|)(${thousands})([0-9]{3})`, 'g')
if (thousandReg.test(num)) {
@@ -834,7 +834,7 @@ export function runIOSSelectionFix() {
export async function copyWithEffect(
value,
label,
- positionElement = null
+ positionElement = null,
) {
let success = null
@@ -883,7 +883,7 @@ export function showSelectionNotice({ value, label, timeout = 3e3 }) {
const arrow = document.createElement('span')
arrow.setAttribute(
'class',
- 'dnb-tooltip__arrow dnb-tooltip__arrow__position--top'
+ 'dnb-tooltip__arrow dnb-tooltip__arrow__position--top',
)
content = document.createElement('span')
content.setAttribute('class', 'dnb-tooltip__content')
@@ -979,7 +979,7 @@ export function useCopyWithNotice() {
*/
export function getFallbackCurrencyDisplay(
locale = null,
- currency_display = null
+ currency_display = null,
) {
// If currencyDisplay is not defined and locale is "no", use narrowSymbol
if (!currency_display && (!locale || /(no|nb|nn)$/i.test(locale))) {
@@ -1035,7 +1035,7 @@ export function getThousandsSeparator(locale = null) {
export function getCurrencySymbol(
locale = null,
currency = null,
- currencyDisplay = null
+ currencyDisplay = null,
) {
if (!currency) {
currency = CURRENCY
@@ -1049,7 +1049,7 @@ export function getCurrencySymbol(
currency,
currencyDisplay: getFallbackCurrencyDisplay(
locale,
- currencyDisplay
+ currencyDisplay,
),
},
}).find(({ type }) => type === 'currency')?.value || currency
@@ -1059,7 +1059,7 @@ export function getCurrencySymbol(
function getGroupFormatter(
locale = null,
separatorSymbol = null,
- existingFormatter = null
+ existingFormatter = null,
) {
/**
* We change the thousand separator to be a non-breaking space
diff --git a/packages/dnb-eufemia/src/components/number-format/__tests__/NumberFormat.test.tsx b/packages/dnb-eufemia/src/components/number-format/__tests__/NumberFormat.test.tsx
index 91b1e2e8b77..74e4d56f54d 100644
--- a/packages/dnb-eufemia/src/components/number-format/__tests__/NumberFormat.test.tsx
+++ b/packages/dnb-eufemia/src/components/number-format/__tests__/NumberFormat.test.tsx
@@ -57,14 +57,14 @@ describe('NumberFormat component', () => {
render( )
expect(
- document.querySelector(displaySelector).textContent
+ document.querySelector(displaySelector).textContent,
).toBeTruthy()
})
it('have to match default number', () => {
render( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '12Ā 345Ā 678,9876'
+ '12Ā 345Ā 678,9876',
)
})
@@ -72,46 +72,46 @@ describe('NumberFormat component', () => {
const { rerender } = render( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12Ā 345Ā 678,99 kr'
+ '-12Ā 345Ā 678,99 kr',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12Ā 345Ā 678,99 norske kroner')
// also check the formatting with one digit less
rerender( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '12Ā 345 kr'
+ '12Ā 345 kr',
)
})
it('have to match currency in en locale', () => {
const { rerender } = render(
-
+ ,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '-NOKĀ 12Ā 345Ā 678.99'
+ '-NOKĀ 12Ā 345Ā 678.99',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12Ā 345Ā 678.99 Norwegian kroner')
// also check the formatting with one digit less
rerender( )
expect(document.querySelector(displaySelector).textContent).toBe(
- 'NOKĀ 12Ā 345'
+ 'NOKĀ 12Ā 345',
)
})
it('have to match currency with large decimals', () => {
render( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '5Ā 000,01 kr'
+ '5Ā 000,01 kr',
)
})
@@ -119,7 +119,7 @@ describe('NumberFormat component', () => {
render( )
expect(document.querySelector('span').classList).not.toContain(
- 'dnb-number-format--selected'
+ 'dnb-number-format--selected',
)
expect(document.querySelector('.dnb-tooltip')).not.toBeInTheDocument()
@@ -134,7 +134,7 @@ describe('NumberFormat component', () => {
const { rerender } = render( )
expect(document.querySelector('span').classList).not.toContain(
- 'dnb-number-format--selected'
+ 'dnb-number-format--selected',
)
expect(document.activeElement).toBe(document.body)
@@ -142,10 +142,10 @@ describe('NumberFormat component', () => {
fireEvent.click(document.querySelector('.dnb-number-format__visible'))
expect(document.activeElement).toBe(
- document.querySelector('.dnb-number-format__selection')
+ document.querySelector('.dnb-number-format__selection'),
)
expect(document.querySelector('span').classList).toContain(
- 'dnb-number-format--selected'
+ 'dnb-number-format--selected',
)
const { cleanedValue: noVal } = format(-value, {
@@ -153,7 +153,7 @@ describe('NumberFormat component', () => {
returnAria: true,
}) as formatReturnValue
expect(
- document.querySelector('.dnb-number-format__selection').textContent
+ document.querySelector('.dnb-number-format__selection').textContent,
).toBe(noVal)
expect(window.getSelection().toString()).toBe('1234.56') // Hack! Having there the "cleanedNumber" would be optimal.
expect(window.getSelection().rangeCount).toBe(1)
@@ -167,27 +167,27 @@ describe('NumberFormat component', () => {
}) as formatReturnValue
expect(
- document.querySelector('.dnb-number-format__selection').textContent
+ document.querySelector('.dnb-number-format__selection').textContent,
).toBe(enVal)
fireEvent.blur(document.querySelector('.dnb-number-format__selection'))
expect(document.querySelector('span').classList).not.toContain(
- 'dnb-number-format--selected'
+ 'dnb-number-format--selected',
)
})
it('have to match currency with currency_position="after"', () => {
const { rerender } = render(
-
+ ,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12Ā 345Ā 678,99 kr'
+ '-12Ā 345Ā 678,99 kr',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12Ā 345Ā 678,99 norske kroner')
rerender(
@@ -196,15 +196,15 @@ describe('NumberFormat component', () => {
currency
currency_position="after"
locale="en-GB"
- />
+ />,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12Ā 345Ā 678.99 NOK'
+ '-12Ā 345Ā 678.99 NOK',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12Ā 345Ā 678.99 Norwegian kroner')
rerender(
@@ -214,11 +214,11 @@ describe('NumberFormat component', () => {
locale="en-GB"
currency_position="after"
currency_display="code"
- />
+ />,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12Ā 345Ā 678.99 NOK'
+ '-12Ā 345Ā 678.99 NOK',
)
rerender(
@@ -228,25 +228,25 @@ describe('NumberFormat component', () => {
locale="no"
currency_position="before"
currency_display="code"
- />
+ />,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- 'NOKĀ ā12Ā 345Ā 678,99'
+ 'NOKĀ ā12Ā 345Ā 678,99',
)
})
it('have to match currency with currency_position="before"', () => {
const { rerender } = render(
-
+ ,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- 'krĀ ā12Ā 345Ā 678,99'
+ 'krĀ ā12Ā 345Ā 678,99',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12Ā 345Ā 678,99 norske kroner')
rerender(
@@ -255,15 +255,15 @@ describe('NumberFormat component', () => {
currency
currency_position="before"
locale="en-GB"
- />
+ />,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '-NOKĀ 12Ā 345Ā 678.99'
+ '-NOKĀ 12Ā 345Ā 678.99',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12Ā 345Ā 678.99 Norwegian kroner')
rerender(
@@ -272,11 +272,11 @@ describe('NumberFormat component', () => {
currency
currency_position="before"
locale="en-GB"
- />
+ />,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '-NOKĀ 12Ā 345Ā 678.99'
+ '-NOKĀ 12Ā 345Ā 678.99',
)
rerender(
@@ -286,11 +286,11 @@ describe('NumberFormat component', () => {
currency_position="after"
currency_display="code"
locale="no"
- />
+ />,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12Ā 345Ā 678,99 NOK'
+ '-12Ā 345Ā 678,99 NOK',
)
})
@@ -298,11 +298,11 @@ describe('NumberFormat component', () => {
render( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12Ā 345,95 kr'
+ '-12Ā 345,95 kr',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12345,95 norske kroner')
})
@@ -310,42 +310,42 @@ describe('NumberFormat component', () => {
render( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12Ā 346 kr'
+ '-12Ā 346 kr',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12346 norske kroner')
})
it('have to match phone number', () => {
render(+47 99999999 )
expect(document.querySelector(displaySelector).textContent).toBe(
- '0047 99 99 99 99'
+ '0047 99 99 99 99',
)
})
it('have to match bank account number', () => {
const { rerender } = render(20001234567 )
expect(document.querySelector(displaySelector).textContent).toBe(
- '2000 12 34567'
+ '2000 12 34567',
)
// also check the formatting with one digit less
rerender( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '2000 12 3456'
+ '2000 12 3456',
)
})
it('have to match national identification number', () => {
render(18089212345 )
expect(document.querySelector(displaySelector).textContent).toBe(
- '180892 12345'
+ '180892 12345',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('18 08 92 1 2 3 4 5')
})
@@ -353,13 +353,13 @@ describe('NumberFormat component', () => {
render(
123456789
-
+ ,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '123 456 789 MVA'
+ '123 456 789 MVA',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('1 2 3 4 5 6 7 8 9 MVA')
})
@@ -367,13 +367,13 @@ describe('NumberFormat component', () => {
render(
prefix } suffix={suffix}>
123456789.5
-
+ ,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- 'prefix 123Ā 456Ā 789,5 suffix'
+ 'prefix 123Ā 456Ā 789,5 suffix',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('prefix 123Ā 456Ā 789,5 suffix')
})
@@ -384,14 +384,14 @@ describe('NumberFormat component', () => {
currency
srLabel="Total:"
copy_selection={false}
- />
+ />,
)
expect(
- document.querySelector('.dnb-sr-only').getAttribute('data-text')
+ document.querySelector('.dnb-sr-only').getAttribute('data-text'),
).toBe('Total:Ā ')
expect(document.querySelector('.dnb-sr-only').textContent).toBe('')
expect(
- document.querySelector('.dnb-number-format').textContent
+ document.querySelector('.dnb-number-format').textContent,
).toContain('-12Ā 345Ā 678,99 kr')
})
@@ -399,19 +399,19 @@ describe('NumberFormat component', () => {
render( )
expect(
- document.querySelector('.dnb-number-format__selection').textContent
+ document.querySelector('.dnb-number-format__selection').textContent,
).toBe('')
fireEvent.click(document.querySelector('.dnb-number-format__visible'))
expect(
- document.querySelector('.dnb-number-format__selection').textContent
+ document.querySelector('.dnb-number-format__selection').textContent,
).toBe('-12345678,99 kr')
fireEvent.blur(document.querySelector('.dnb-number-format__selection'))
expect(
- document.querySelector('.dnb-number-format__selection').textContent
+ document.querySelector('.dnb-number-format__selection').textContent,
).toBe('')
})
@@ -419,7 +419,7 @@ describe('NumberFormat component', () => {
render( )
expect(
- document.querySelector('.dnb-number-format__selection')
+ document.querySelector('.dnb-number-format__selection'),
).not.toBeInTheDocument()
})
@@ -427,11 +427,11 @@ describe('NumberFormat component', () => {
const { rerender } = render(
12.3456
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,35Ā %')
rerender(
@@ -441,21 +441,21 @@ describe('NumberFormat component', () => {
options={{ maximumFractionDigits: 2 }}
>
12.3456
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,34Ā %')
rerender(
12
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12Ā %')
rerender(
@@ -464,51 +464,51 @@ describe('NumberFormat component', () => {
options={{ minimumFractionDigits: 1, maximumFractionDigits: 2 }}
>
12
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,0Ā %')
rerender(12 )
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12Ā %')
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12Ā %')
rerender(
12
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,00Ā %')
rerender(
12.3456
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,35Ā %')
rerender(
12.3456
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,34Ā %')
})
@@ -516,11 +516,11 @@ describe('NumberFormat component', () => {
const { rerender } = render(
12.3456
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,35 kr')
rerender(
@@ -530,67 +530,67 @@ describe('NumberFormat component', () => {
options={{ maximumFractionDigits: 2 }}
>
12.3456
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,34 kr')
rerender(
12
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,00 kr')
rerender(12 )
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,00 kr')
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,00 kr')
rerender(
12
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,00 kr')
rerender(
12.3456
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,35 kr')
rerender(
12.3456
-
+ ,
)
expect(
- document.querySelector('.dnb-number-format__visible').textContent
+ document.querySelector('.dnb-number-format__visible').textContent,
).toBe('12,34 kr')
})
it('should validate with ARIA rules', async () => {
const Comp = render(
-
+ ,
)
expect(await axeComponent(Comp)).toHaveNoViolations()
})
@@ -603,40 +603,40 @@ describe('NumberFormat compact', () => {
it('have to match default compact number', () => {
render( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12,3Ā mill.'
+ '-12,3Ā mill.',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12,3 millioner')
})
it('have to match short compact number', () => {
render( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12,345k'
+ '-12,345k',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12,345 tusen')
})
it('have to match long compact number', () => {
render( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12,346 millioner'
+ '-12,346 millioner',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12,346 millioner')
})
it('have to match currency based compact number', () => {
render( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12,35Ā mill. kr'
+ '-12,35Ā mill. kr',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12,35 millioner norske kroner')
})
@@ -648,37 +648,37 @@ describe('NumberFormat compact', () => {
value={-value}
decimals={3}
currency_display="name"
- />
+ />,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12,346 millioner norske kroner'
+ '-12,346 millioner norske kroner',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12,346 millioner norske kroner')
})
it('have to hide currency code on falsy currency_display', () => {
const { rerender } = render(
-
+ ,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '-1Ā 234,00'
+ '-1Ā 234,00',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-1234,00 norske kroner')
rerender( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '-1Ā 234Ā 567,00'
+ '-1Ā 234Ā 567,00',
)
const element = document.querySelector('.dnb-number-format')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['lang', 'class', 'role'])
@@ -687,23 +687,23 @@ describe('NumberFormat compact', () => {
it('have to match compact number with custom decimals', () => {
render( )
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12,3457Ā mill. kr'
+ '-12,3457Ā mill. kr',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12,3457 millioner norske kroner')
})
describe('en-GB', () => {
it('have to match default compact number', () => {
render(
-
+ ,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12.35M'
+ '-12.35M',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12.35 million')
})
@@ -714,13 +714,13 @@ describe('NumberFormat compact', () => {
compact="long"
locale="en-GB"
decimals="2"
- />
+ />,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '-12.35 million'
+ '-12.35 million',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12.35 million')
})
@@ -732,13 +732,13 @@ describe('NumberFormat compact', () => {
currency
locale="en-GB"
decimals="2"
- />
+ />,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '-NOKĀ 12.35M'
+ '-NOKĀ 12.35M',
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe('-12.35 million Norwegian kroner')
})
})
@@ -817,12 +817,12 @@ describe('NumberFormat compact', () => {
render( )
expect(document.querySelector(displaySelector).textContent).toBe(
- display
+ display,
)
expect(
- document.querySelector(ariaSelector).getAttribute('data-text')
+ document.querySelector(ariaSelector).getAttribute('data-text'),
).toBe(aria)
- }
+ },
)
})
@@ -836,10 +836,10 @@ describe('NumberFormat component with provider', () => {
NumberFormat={{ currency: true, currency_display: 'name' }}
>
-
+ ,
)
expect(document.querySelector(displaySelector).textContent).toBe(
- '12Ā 345Ā 678.99 Norwegian kroner'
+ '12Ā 345Ā 678.99 Norwegian kroner',
)
})
})
diff --git a/packages/dnb-eufemia/src/components/number-format/__tests__/NumberUtils.test.ts b/packages/dnb-eufemia/src/components/number-format/__tests__/NumberUtils.test.ts
index f9e47c69b41..8871329c5c2 100644
--- a/packages/dnb-eufemia/src/components/number-format/__tests__/NumberUtils.test.ts
+++ b/packages/dnb-eufemia/src/components/number-format/__tests__/NumberUtils.test.ts
@@ -86,49 +86,49 @@ describe('Decimals format', () => {
expect(format(num, { currency: true, decimals: 0 })).toBe('-12Ā 346 kr')
expect(format(num, { currency: true, decimals: 1 })).toBe(
- '-12Ā 345,7 kr'
+ '-12Ā 345,7 kr',
)
expect(format(num, { currency: true, decimals: 2 })).toBe(
- '-12Ā 345,68 kr'
+ '-12Ā 345,68 kr',
)
expect(format(num, { currency: true, decimals: 3 })).toBe(
- '-12Ā 345,679 kr'
+ '-12Ā 345,679 kr',
)
expect(format(num, { currency: true, decimals: 4 })).toBe(
- '-12Ā 345,6789 kr'
+ '-12Ā 345,6789 kr',
)
expect(format(String(num), { currency: true, decimals: 4 })).toBe(
- '-12Ā 345,6789 kr'
+ '-12Ā 345,6789 kr',
)
expect(
// more than 20 numbers
format('-1.123456789123456789', {
decimals: undefined,
- })
+ }),
).toBe('-1,1234567891234568')
})
it('should handle omit rounding', () => {
expect(
- format(num, { currency: true, decimals: 0, omit_rounding: true })
+ format(num, { currency: true, decimals: 0, omit_rounding: true }),
).toBe('-12Ā 345 kr')
expect(
- format(num, { currency: true, decimals: 1, omit_rounding: true })
+ format(num, { currency: true, decimals: 1, omit_rounding: true }),
).toBe('-12Ā 345,6 kr')
expect(
- format(num, { currency: true, decimals: 2, omit_rounding: true })
+ format(num, { currency: true, decimals: 2, omit_rounding: true }),
).toBe('-12Ā 345,67 kr')
expect(
- format(num, { currency: true, decimals: 3, omit_rounding: true })
+ format(num, { currency: true, decimals: 3, omit_rounding: true }),
).toBe('-12Ā 345,678 kr')
expect(
- format(num, { currency: true, decimals: 4, omit_rounding: true })
+ format(num, { currency: true, decimals: 4, omit_rounding: true }),
).toBe('-12Ā 345,6789 kr')
expect(
- format(num, { currency: true, decimals: 5, omit_rounding: true })
+ format(num, { currency: true, decimals: 5, omit_rounding: true }),
).toBe('-12Ā 345,67890 kr')
expect(
- format(num, { currency: true, decimals: 6, omit_rounding: true })
+ format(num, { currency: true, decimals: 6, omit_rounding: true }),
).toBe('-12Ā 345,678900 kr')
})
@@ -137,47 +137,47 @@ describe('Decimals format', () => {
format(num, {
currency: true,
omit_currency_sign: true,
- })
+ }),
).toBe('-12Ā 345,68')
expect(
format(num, {
currency: true,
currency_position: 'before',
omit_currency_sign: true,
- })
+ }),
).toBe('-12Ā 345,68')
expect(
format(num, {
currency: true,
currency_position: 'after',
omit_currency_sign: true,
- })
+ }),
).toBe('-12Ā 345,68')
expect(
format(num, {
currency: true,
currency_display: 'code',
omit_currency_sign: true,
- })
+ }),
).toBe('-12Ā 345,68')
expect(
format(num, {
currency: true,
currency_display: false,
- })
+ }),
).toBe('-12Ā 345,68')
expect(
format(num, {
currency: true,
currency_display: '',
- })
+ }),
).toBe('-12Ā 345,68')
expect(
format(num, {
locale: 'en',
currency: true,
omit_currency_sign: true,
- })
+ }),
).toBe('-12Ā 345.68')
expect(
format(num, {
@@ -186,7 +186,7 @@ describe('Decimals format', () => {
currency_position: 'after',
currency_display: 'symbol',
omit_currency_sign: true,
- })
+ }),
).toBe('-12,345.68')
})
})
@@ -194,19 +194,19 @@ describe('Decimals format', () => {
describe('Currency format with dirty number', () => {
it('should treat a dot as decimal', () => {
expect(format(-12345.67, { clean: true, currency: true })).toBe(
- '-12Ā 345,67 kr'
+ '-12Ā 345,67 kr',
)
expect(
- format('prefix -123.45 suffix', { clean: true, currency: true })
+ format('prefix -123.45 suffix', { clean: true, currency: true }),
).toBe('-123,45 kr')
})
it('should treat danish/german style', () => {
expect(
- format('prefix -12.345 suffix', { clean: true, currency: true })
+ format('prefix -12.345 suffix', { clean: true, currency: true }),
).toBe('-12Ā 345,00 kr')
expect(
- format('prefix -12.345,678 suffix', { clean: true, currency: true })
+ format('prefix -12.345,678 suffix', { clean: true, currency: true }),
).toBe('-12Ā 345,68 kr')
})
@@ -215,19 +215,19 @@ describe('Currency format with dirty number', () => {
format('prefix -1,234,567.891 suffix', {
clean: true,
currency: true,
- })
+ }),
).toBe('-1Ā 234Ā 567,89 kr')
})
it('should treat norwegian style (SI style (French version))', () => {
expect(
- format('prefix -12 345,678 suffix', { clean: true, currency: true })
+ format('prefix -12 345,678 suffix', { clean: true, currency: true }),
).toBe('-12Ā 345,68 kr')
expect(
format('prefix -1 234 567,891 suffix', {
clean: true,
currency: true,
- })
+ }),
).toBe('-1Ā 234Ā 567,89 kr')
})
@@ -236,7 +236,7 @@ describe('Currency format with dirty number', () => {
format('prefix -1 234 567.891 suffix', {
clean: true,
currency: true,
- })
+ }),
).toBe('-1Ā 234Ā 567,89 kr')
})
@@ -245,38 +245,38 @@ describe('Currency format with dirty number', () => {
format("prefix -1'234'567.891 suffix", {
clean: true,
currency: true,
- })
+ }),
).toBe('-1Ā 234Ā 567,89 kr')
})
it('should treat ireland style', () => {
expect(
- format('prefix -12.345Ā·678 suffix', { clean: true, currency: true })
+ format('prefix -12.345Ā·678 suffix', { clean: true, currency: true }),
).toBe('-12Ā 345,68 kr')
expect(
format('prefix -1,234,567Ā·891 suffix', {
clean: true,
currency: true,
- })
+ }),
).toBe('-1Ā 234Ā 567,89 kr')
})
it('should treat spain style', () => {
expect(
- format("prefix -12.345'678 suffix", { clean: true, currency: true })
+ format("prefix -12.345'678 suffix", { clean: true, currency: true }),
).toBe('-12Ā 345,68 kr')
expect(
format("prefix -1.234.567'891 suffix", {
clean: true,
currency: true,
- })
+ }),
).toBe('-1Ā 234Ā 567,89 kr')
})
it('return corret aria', () => {
const number = -123456789.56
expect(
- format(number, { currency: true, returnAria: true })
+ format(number, { currency: true, returnAria: true }),
).toMatchObject({
aria: '-123Ā 456Ā 789,56 norske kroner',
cleanedValue: '-123456789,56 kr',
@@ -294,7 +294,7 @@ describe('Currency format with dirty number', () => {
currency: true,
returnAria: true,
clean_copy_value: true,
- })
+ }),
).toMatchObject({
aria: '-123Ā 456Ā 789,56 norske kroner',
cleanedValue: 'ā123456789,56',
@@ -312,125 +312,125 @@ describe('Currency format with dirty number', () => {
currency: true,
currency_position: 'after',
locale: 'no',
- })
+ }),
).toBe('-123Ā 456Ā 789,50 kr')
expect(
format(number, {
currency: true,
currency_position: 'before',
locale: 'no',
- })
+ }),
).toBe('krĀ ā123Ā 456Ā 789,50')
expect(
format(number, {
currency: true,
currency_position: 'after',
locale: 'en-GB',
- })
+ }),
).toBe('-123Ā 456Ā 789.50 NOK')
expect(
format(number, {
currency: true,
currency_position: 'after',
locale: 'en-US',
- })
+ }),
).toBe('-123,456,789.50 NOK')
expect(
format(number, {
currency: true,
currency_position: 'before',
locale: 'en-GB',
- })
+ }),
).toBe('-NOKĀ 123Ā 456Ā 789.50')
expect(
format(number, {
currency: true,
currency_position: 'before',
locale: 'en-US',
- })
+ }),
).toBe('-NOKĀ 123,456,789.50')
expect(
format(-0, {
currency: true,
currency_position: 'after',
locale: 'en-GB',
- })
+ }),
).toBe('-0.00 NOK')
expect(
format(-0, {
currency: true,
currency_position: 'after',
locale: 'en-US',
- })
+ }),
).toBe('-0.00 NOK')
expect(
format('-0', {
currency: true,
currency_position: 'after',
locale: 'en-GB',
- })
+ }),
).toBe('-0.00 NOK')
expect(
format('-0', {
currency: true,
currency_position: 'after',
locale: 'en-US',
- })
+ }),
).toBe('-0.00 NOK')
expect(
format('-0', {
currency: true,
currency_position: 'before',
locale: 'en-GB',
- })
+ }),
).toBe('-NOKĀ 0.00')
expect(
format('-0', {
currency: true,
currency_position: 'before',
locale: 'en-US',
- })
+ }),
).toBe('-NOKĀ 0.00')
expect(
format('someting 1234 someting', {
clean: true,
currency: true,
currency_position: 'after',
- })
+ }),
).toBe('1Ā 234,00 kr')
expect(
format(number, {
currency: 'CHF',
locale: 'de-CH',
- })
+ }),
).toBe('CHF-123ā456ā789.50')
expect(
format(number, {
currency: 'CHF',
currency_position: 'before',
locale: 'de-CH',
- })
+ }),
).toBe('CHF-123ā456ā789.50')
expect(
format(number, {
currency: 'CHF',
currency_position: 'after',
locale: 'de-CH',
- })
+ }),
).toBe('-123ā456ā789.50 CHF')
expect(
format(number, {
currency: true,
currency_position: 'before',
currency_display: 'name',
- })
+ }),
).toBe('norske kroner -123Ā 456Ā 789,50')
expect(
format(number, {
currency: true,
currency_position: 'after',
currency_display: 'name',
- })
+ }),
).toBe('-123Ā 456Ā 789,50 norske kroner')
})
})
@@ -440,7 +440,7 @@ describe('NumberFormat percentage', () => {
it('should format with default values', () => {
expect(format(String(number), { percent: true })).toBe(
- 'ā123Ā 456Ā 789,56Ā %'
+ 'ā123Ā 456Ā 789,56Ā %',
)
expect(format(0.2, { percent: true })).toBe('0,2Ā %')
expect(format(-4.1, { percent: true, decimals: 1 })).toBe('ā4,1Ā %')
@@ -449,31 +449,31 @@ describe('NumberFormat percentage', () => {
expect(format('-4.16', { percent: true })).toBe('ā4,16Ā %')
expect(format(-4.165, { percent: true })).toBe('ā4,165Ā %')
expect(format('-4.165', { percent: true, decimals: 2 })).toBe(
- 'ā4,17Ā %'
+ 'ā4,17Ā %',
)
expect(
- format(-4.165, { percent: true, decimals: 2, omit_rounding: true })
+ format(-4.165, { percent: true, decimals: 2, omit_rounding: true }),
).toBe('ā4,16Ā %')
})
it('should format based on locale', () => {
expect(format(number, { percent: true, locale: 'no' })).toBe(
- 'ā123Ā 456Ā 789,56Ā %'
+ 'ā123Ā 456Ā 789,56Ā %',
)
expect(format(number, { percent: true, locale: 'en-GB' })).toBe(
- '-123Ā 456Ā 789.56%'
+ '-123Ā 456Ā 789.56%',
)
expect(format(number, { percent: true, locale: 'en-US' })).toBe(
- '-123,456,789.56%'
+ '-123,456,789.56%',
)
expect(
- format(number, { percent: true, decimals: 1, locale: 'no' })
+ format(number, { percent: true, decimals: 1, locale: 'no' }),
).toBe('ā123Ā 456Ā 789,6Ā %')
expect(
- format(number, { percent: true, decimals: 1, locale: 'en-GB' })
+ format(number, { percent: true, decimals: 1, locale: 'en-GB' }),
).toBe('-123Ā 456Ā 789.6%')
expect(
- format(number, { percent: true, decimals: 1, locale: 'en-US' })
+ format(number, { percent: true, decimals: 1, locale: 'en-US' }),
).toBe('-123,456,789.6%')
})
@@ -484,7 +484,7 @@ describe('NumberFormat percentage', () => {
decimals: 1,
locale: 'en-US',
returnAria: true,
- })
+ }),
).toMatchObject({
aria: '-123,456,789.6%',
cleanedValue: '-123456789.6%',
@@ -498,7 +498,7 @@ describe('NumberFormat percentage', () => {
percent: true,
locale: 'en-US',
returnAria: true,
- })
+ }),
).toMatchObject({
aria: '12.34%',
cleanedValue: '12.34%',
@@ -527,7 +527,7 @@ describe('NumberFormat cleanNumber', () => {
it('should clean up usa style', () => {
expect(cleanNumber('prefix -1,234,567.891 suffix')).toBe(
- '-1234567.891'
+ '-1234567.891',
)
})
@@ -536,103 +536,103 @@ describe('NumberFormat cleanNumber', () => {
cleanNumber('NOK 123,1234 kr', {
thousandsSeparator: ' ',
decimalSeparator: ',',
- })
+ }),
).toBe('123.1234')
expect(
cleanNumber('NOK 1234,1234 kr', {
thousandsSeparator: ' ',
decimalSeparator: ',',
- })
+ }),
).toBe('1234.1234')
expect(
cleanNumber('NOK 1 234,1234 kr', {
thousandsSeparator: ' ',
decimalSeparator: ',',
- })
+ }),
).toBe('1234.1234')
expect(
cleanNumber('NOK 1 234.1234 kr', {
thousandsSeparator: ' ',
decimalSeparator: ',',
- })
+ }),
).toBe('1234.1234')
expect(
cleanNumber('NOK 123. kr', {
thousandsSeparator: ' ',
decimalSeparator: ',',
- })
+ }),
).toBe('123.')
expect(
cleanNumber('NOK 123,12 kr', {
thousandsSeparator: ' ',
decimalSeparator: ',',
- })
+ }),
).toBe('123.12')
expect(
cleanNumber('NOK 123,1 kr', {
thousandsSeparator: ' ',
decimalSeparator: ',',
- })
+ }),
).toBe('123.1')
expect(
cleanNumber('NOK 123, kr', {
thousandsSeparator: ' ',
decimalSeparator: ',',
- })
+ }),
).toBe('123.')
expect(
cleanNumber('NOK 1234.567 kr', {
thousandsSeparator: ',',
decimalSeparator: '.',
- })
+ }),
).toBe('1234.567')
expect(
cleanNumber('NOK 1234 567,0123 kr', {
prefix: 'NOK ',
suffix: ' kr',
- })
+ }),
).toBe('1234567.0123')
})
it('should clean up norwegian style (SI style (French version))', () => {
expect(cleanNumber('prefix -12 345,678 suffix')).toBe('-12345.678')
expect(cleanNumber('prefix -1 234 567,891 suffix')).toBe(
- '-1234567.891'
+ '-1234567.891',
)
})
it('should clean up english style (SI style (English version))', () => {
expect(cleanNumber('prefix -1 234 567.891 suffix')).toBe(
- '-1234567.891'
+ '-1234567.891',
)
})
it('should clean up swiss style', () => {
expect(cleanNumber("prefix -1'234'567.891 suffix")).toBe(
- '-1234567.891'
+ '-1234567.891',
)
})
it('should clean up ireland style', () => {
expect(cleanNumber('prefix -12.345Ā·678 suffix')).toBe('-12345.678')
expect(cleanNumber('prefix -1,234,567Ā·891 suffix')).toBe(
- '-1234567.891'
+ '-1234567.891',
)
})
it('should clean up spain style', () => {
expect(cleanNumber("prefix -12.345'678 suffix")).toBe('-12345.678')
expect(cleanNumber("prefix -1.234.567'891 suffix")).toBe(
- '-1234567.891'
+ '-1234567.891',
)
})
})
diff --git a/packages/dnb-eufemia/src/components/number-format/__tests__/useNumberFormat.test.tsx b/packages/dnb-eufemia/src/components/number-format/__tests__/useNumberFormat.test.tsx
index d82fa4d2f0a..4593e623e29 100644
--- a/packages/dnb-eufemia/src/components/number-format/__tests__/useNumberFormat.test.tsx
+++ b/packages/dnb-eufemia/src/components/number-format/__tests__/useNumberFormat.test.tsx
@@ -11,7 +11,7 @@ import Provider from '../../../shared/Provider'
describe('useNumberFormat', () => {
it('will render without provider', () => {
const { result } = renderHook(() =>
- useNumberFormat(1234, { currency: true })
+ useNumberFormat(1234, { currency: true }),
)
expect(result.current).toBe('1Ā 234,00 kr')
@@ -19,7 +19,7 @@ describe('useNumberFormat', () => {
it('will return object when returnAria is true', () => {
const { result } = renderHook(() =>
- useNumberFormat(1234, { currency: true, returnAria: true })
+ useNumberFormat(1234, { currency: true, returnAria: true }),
)
expect(result.current).toEqual(
@@ -30,7 +30,7 @@ describe('useNumberFormat', () => {
number: '1Ā 234,00 kr',
type: 'currency',
value: 1234,
- })
+ }),
)
})
diff --git a/packages/dnb-eufemia/src/components/number-format/useNumberFormat.tsx b/packages/dnb-eufemia/src/components/number-format/useNumberFormat.tsx
index fa79ba98b78..34abdc3b7d4 100644
--- a/packages/dnb-eufemia/src/components/number-format/useNumberFormat.tsx
+++ b/packages/dnb-eufemia/src/components/number-format/useNumberFormat.tsx
@@ -6,13 +6,13 @@ import type { formatOptionParams, formatValue } from './NumberUtils'
function useNumberFormat(
value: formatValue,
- options: formatOptionParams = {}
+ options: formatOptionParams = {},
) {
const context = useContext(Context)
const params = extendPropsWithContext(
options,
{ locale: context.locale },
- context.NumberFormat
+ context.NumberFormat,
)
return format(value, params)
diff --git a/packages/dnb-eufemia/src/components/pagination/Pagination.js b/packages/dnb-eufemia/src/components/pagination/Pagination.js
index 2cd536b6ec8..a3a02fe3733 100644
--- a/packages/dnb-eufemia/src/components/pagination/Pagination.js
+++ b/packages/dnb-eufemia/src/components/pagination/Pagination.js
@@ -21,7 +21,6 @@ import { PaginationIndicator } from './PaginationHelpers'
import InfinityScroller from './PaginationInfinity'
import PaginationBar from './PaginationBar'
-
const paginationPropTypes = {
startup_page: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
current_page: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
@@ -175,7 +174,7 @@ class PaginationInstance extends React.PureComponent {
this.props,
paginationDefaultProps,
this.context.getTranslation(this.props).Pagination,
- this.context.Pagination
+ this.context.Pagination,
)
const {
@@ -210,7 +209,7 @@ class PaginationInstance extends React.PureComponent {
align && `dnb-pagination--${align}`,
createSpacingClasses(props),
className,
- _className
+ _className,
),
...attributes,
}
@@ -218,7 +217,7 @@ class PaginationInstance extends React.PureComponent {
validateDOMAttributes(props, mainParams)
const content = items.find(
- ({ pageNumber }) => pageNumber === currentPage
+ ({ pageNumber }) => pageNumber === currentPage,
)?.content
return (
@@ -274,7 +273,7 @@ const PaginationContent = React.forwardRef(
{children}
)
- }
+ },
)
PaginationContent.propTypes = {
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
diff --git a/packages/dnb-eufemia/src/components/pagination/PaginationBar.tsx b/packages/dnb-eufemia/src/components/pagination/PaginationBar.tsx
index 077c0aa47fe..594cde715c4 100644
--- a/packages/dnb-eufemia/src/components/pagination/PaginationBar.tsx
+++ b/packages/dnb-eufemia/src/components/pagination/PaginationBar.tsx
@@ -84,7 +84,7 @@ const PaginationBar = (localProps: PaginationBarAllProps) => {
const props = extendPropsWithContext(
localProps,
defaultProps,
- context.pagination
+ context.pagination,
) as PaginationBarProps & PaginationBarContext
const { currentPage, pageCount, disabled, skeleton } = props
@@ -159,7 +159,7 @@ const PaginationBar = (localProps: PaginationBarAllProps) => {
extendPropsWithContext(
props,
defaultProps,
- getTranslation(props as LocaleProps).Pagination
+ getTranslation(props as LocaleProps).Pagination,
)
const prevIsDisabled = currentPage > -1 ? currentPage === 1 : true
@@ -172,7 +172,7 @@ const PaginationBar = (localProps: PaginationBarAllProps) => {
const pageNumberGroups = calculatePagination(
pageCount,
currentPage,
- currentScreenSize === 'small'
+ currentScreenSize === 'small',
)
return (
@@ -180,7 +180,7 @@ const PaginationBar = (localProps: PaginationBarAllProps) => {
ref={paginationBarRef}
className={classnames(
'dnb-pagination__bar',
- pageCount >= 8 && 'dnb-pagination--many-pages'
+ pageCount >= 8 && 'dnb-pagination--many-pages',
)}
>
@@ -251,12 +251,12 @@ const PaginationBar = (localProps: PaginationBarAllProps) => {
'dnb-pagination__button',
String(pageNumber).length > 3
? 'dnb-pagination__button--large-number'
- : null
+ : null,
)}
text={String(pageNumber)}
aria-label={button_title.replace(
'%s',
- String(pageNumber)
+ String(pageNumber),
)}
variant={
pageNumber === currentPage ? 'primary' : 'secondary'
diff --git a/packages/dnb-eufemia/src/components/pagination/PaginationCalculation.ts b/packages/dnb-eufemia/src/components/pagination/PaginationCalculation.ts
index cdc9fc5688f..896d757dbdf 100644
--- a/packages/dnb-eufemia/src/components/pagination/PaginationCalculation.ts
+++ b/packages/dnb-eufemia/src/components/pagination/PaginationCalculation.ts
@@ -6,7 +6,7 @@
export const calculatePagination = (
pageCount: number,
currentPage: number,
- isSmallScreen?: boolean
+ isSmallScreen?: boolean,
): Array> => {
if (pageCount === 1) return [[1]]
// Number of buttons on each side of the current button when it's not at the start nor at the end of the pagination
diff --git a/packages/dnb-eufemia/src/components/pagination/PaginationHelpers.js b/packages/dnb-eufemia/src/components/pagination/PaginationHelpers.js
index 41b44f53efc..0d9b07f4743 100644
--- a/packages/dnb-eufemia/src/components/pagination/PaginationHelpers.js
+++ b/packages/dnb-eufemia/src/components/pagination/PaginationHelpers.js
@@ -90,7 +90,7 @@ export function isTrElement(Element) {
export function preparePageElement(
Element,
- includeClassName = 'dnb-pagination__page'
+ includeClassName = 'dnb-pagination__page',
) {
if (String(Element) === 'Symbol(react.fragment)') {
return Element
diff --git a/packages/dnb-eufemia/src/components/pagination/PaginationInfinity.js b/packages/dnb-eufemia/src/components/pagination/PaginationInfinity.js
index 47659a70b2f..6f15f76b77a 100644
--- a/packages/dnb-eufemia/src/components/pagination/PaginationInfinity.js
+++ b/packages/dnb-eufemia/src/components/pagination/PaginationInfinity.js
@@ -60,7 +60,7 @@ export default class InfinityScroller extends React.PureComponent {
position: 'after',
skipObserver,
},
- { callStartupEvent, preventWaitForDelay }
+ { callStartupEvent, preventWaitForDelay },
)
}
}
@@ -68,7 +68,7 @@ export default class InfinityScroller extends React.PureComponent {
getNewContent = (
newPageNo,
props = {},
- { callStartupEvent = false, preventWaitForDelay = false } = {}
+ { callStartupEvent = false, preventWaitForDelay = false } = {},
) => {
const { pageCount, endInfinity } = this.context.pagination
@@ -141,7 +141,7 @@ export default class InfinityScroller extends React.PureComponent {
preventWaitForDelay = false,
callOnEnd = false,
onDispatch = null,
- } = {}
+ } = {},
) {
this.waitForReachedTime(
({ pageNumber, callStartupEvent }) => {
@@ -176,7 +176,7 @@ export default class InfinityScroller extends React.PureComponent {
createEvent('on_load')
}
},
- { pageNumber, callStartupEvent, preventWaitForDelay }
+ { pageNumber, callStartupEvent, preventWaitForDelay },
)
}
@@ -306,7 +306,7 @@ export default class InfinityScroller extends React.PureComponent {
skipObserver,
ScrollElement,
},
- idx
+ idx,
) => {
const isLastItem = idx === items.length - 1
@@ -397,7 +397,7 @@ export default class InfinityScroller extends React.PureComponent {
)}
)
- }
+ },
)
}
}
@@ -423,7 +423,7 @@ class InteractionMarker extends React.PureComponent {
if (typeof props.markerElement === 'function') {
warn(
- 'Pagination: Please use a string or React element e.g. marker_element="tr"'
+ 'Pagination: Please use a string or React element e.g. marker_element="tr"',
)
}
@@ -474,7 +474,7 @@ class InteractionMarker extends React.PureComponent {
try {
const sibling = getPreviousSibling('dnb-table', this._ref.current)
height = parseFloat(
- window.getComputedStyle(sibling.querySelector('tbody')).height
+ window.getComputedStyle(sibling.querySelector('tbody')).height,
)
} catch (e) {
//
diff --git a/packages/dnb-eufemia/src/components/pagination/PaginationProvider.js b/packages/dnb-eufemia/src/components/pagination/PaginationProvider.js
index dcf78ece8d4..bf0e9aceb84 100644
--- a/packages/dnb-eufemia/src/components/pagination/PaginationProvider.js
+++ b/packages/dnb-eufemia/src/components/pagination/PaginationProvider.js
@@ -94,7 +94,7 @@ export default class PaginationProvider extends React.PureComponent {
state.parallelLoadCount = parseFloat(props.parallel_load_count) || 1
state.minTime = parseFloat(props.min_wait_time) || 0
state.placeMakerBeforeContent = isTrue(
- props.place_maker_before_content
+ props.place_maker_before_content,
)
// reset pagination, like the resetInfinity method
@@ -150,7 +150,7 @@ export default class PaginationProvider extends React.PureComponent {
// because we have a set state inside setContent and render at the same time
this.rerenderTimeout = setTimeout(
() => this.setContent(store.pageNumber, store.content),
- 1
+ 1,
)
}
}
@@ -188,7 +188,7 @@ export default class PaginationProvider extends React.PureComponent {
this._isMounted = true
this.updatePageContent(
- this.state.startupPage || this.state.currentPage
+ this.state.startupPage || this.state.currentPage,
)
}
@@ -227,7 +227,7 @@ export default class PaginationProvider extends React.PureComponent {
if (content) {
let itemToPrepare = this.state.items.find(
- ({ pageNumber: p }) => p === pageNumber
+ ({ pageNumber: p }) => p === pageNumber,
)
let items = null
@@ -250,7 +250,7 @@ export default class PaginationProvider extends React.PureComponent {
items: [...(items || this.state.items)], // we make a copy, only to rerender
currentPage: pageNumber, // update the currentPage
},
- this.callOnPageUpdate
+ this.callOnPageUpdate,
)
}
}
@@ -299,7 +299,7 @@ export default class PaginationProvider extends React.PureComponent {
pageNumber,
...this,
})
- }
+ },
)
}
@@ -308,7 +308,7 @@ export default class PaginationProvider extends React.PureComponent {
{
items,
},
- cb
+ cb,
)
}
diff --git a/packages/dnb-eufemia/src/components/pagination/__tests__/Pagination.test.tsx b/packages/dnb-eufemia/src/components/pagination/__tests__/Pagination.test.tsx
index 37d435dbbd7..eac5e5471d0 100644
--- a/packages/dnb-eufemia/src/components/pagination/__tests__/Pagination.test.tsx
+++ b/packages/dnb-eufemia/src/components/pagination/__tests__/Pagination.test.tsx
@@ -29,13 +29,13 @@ describe('Pagination bar', () => {
const innerElem = document.querySelector('.dnb-pagination__bar__inner')
expect(
- innerElem.querySelectorAll('button.dnb-pagination__button').length
+ innerElem.querySelectorAll('button.dnb-pagination__button').length,
).toBe(9)
expect(
- innerElem.querySelectorAll('button.dnb-button--secondary').length
+ innerElem.querySelectorAll('button.dnb-button--secondary').length,
).toBe(8)
expect(
- innerElem.querySelectorAll('button.dnb-button--primary').length
+ innerElem.querySelectorAll('button.dnb-button--primary').length,
).toBe(1)
})
@@ -43,7 +43,7 @@ describe('Pagination bar', () => {
const { rerender } = render(
content
-
+ ,
)
expect(document.querySelector('div#page-content')).toBeInTheDocument()
@@ -51,7 +51,7 @@ describe('Pagination bar', () => {
rerender(
content
-
+ ,
)
expect(document.querySelector('div#page-content')).toBeInTheDocument()
@@ -74,7 +74,7 @@ describe('Pagination bar', () => {
prevNavButton
.querySelector('span.dnb-icon')
- .getAttribute('data-testid')
+ .getAttribute('data-testid'),
).toBe('chevron left icon')
})
@@ -90,7 +90,7 @@ describe('Pagination bar', () => {
return {pageNumber}
}}
-
+ ,
)
expect(document.querySelector('div#page-no').textContent).toBe('15')
@@ -115,7 +115,7 @@ describe('Pagination bar', () => {
return {pageNumber}
}}
-
+ ,
)
expect(currentPage).toBe(5)
expect(document.querySelector('div#page-no').textContent).toBe('5')
@@ -128,7 +128,7 @@ describe('Pagination bar', () => {
return {pageNumber}
}}
-
+ ,
)
expect(currentPage).toBe(3)
expect(document.querySelector('div#page-no').textContent).toBe('3')
@@ -138,10 +138,10 @@ describe('Pagination bar', () => {
render(
{({ pageNumber }) => {pageNumber}}
-
+ ,
)
expect(
- document.querySelector('.dnb-pagination__content').textContent
+ document.querySelector('.dnb-pagination__content').textContent,
).toBe('2')
})
@@ -151,10 +151,10 @@ describe('Pagination bar', () => {
{({ pageNumber, setContent }) => {
setContent(pageNumber, {pageNumber})
}}
-
+ ,
)
expect(
- document.querySelector('.dnb-pagination__content').textContent
+ document.querySelector('.dnb-pagination__content').textContent,
).toBe('2')
const nextButton = document
@@ -167,7 +167,7 @@ describe('Pagination bar', () => {
fireEvent.click(nextButton)
expect(
- document.querySelector('.dnb-pagination__content').textContent
+ document.querySelector('.dnb-pagination__content').textContent,
).toBe('3')
})
@@ -186,7 +186,7 @@ describe('Pagination bar', () => {
{({ pageNumber, setContent }) => {
setContent(
pageNumber,
- {JSON.stringify({ pageNumber, count })}
+ {JSON.stringify({ pageNumber, count })}
,
)
}}
@@ -197,14 +197,14 @@ describe('Pagination bar', () => {
expect(document.querySelector('#button').textContent).toBe('1')
expect(
- document.querySelector('.dnb-pagination__content').textContent
+ document.querySelector('.dnb-pagination__content').textContent,
).toBe('{"pageNumber":2,"count":1}')
fireEvent.click(document.querySelector('#button'))
expect(document.querySelector('#button').textContent).toBe('2')
expect(
- document.querySelector('.dnb-pagination__content').textContent
+ document.querySelector('.dnb-pagination__content').textContent,
).toBe('{"pageNumber":2,"count":2}')
const nextButton = document
@@ -214,12 +214,12 @@ describe('Pagination bar', () => {
fireEvent.click(nextButton)
expect(
- document.querySelector('.dnb-pagination__content').textContent
+ document.querySelector('.dnb-pagination__content').textContent,
).toBe('{"pageNumber":3,"count":2}')
fireEvent.click(document.querySelector('#button'))
expect(
- document.querySelector('.dnb-pagination__content').textContent
+ document.querySelector('.dnb-pagination__content').textContent,
).toBe('{"pageNumber":3,"count":3}')
})
@@ -301,7 +301,7 @@ describe('Infinity scroller', () => {
on_change={on_change}
on_load={on_load}
on_end={on_end}
- />
+ />,
)
await waitForComponent()
@@ -311,10 +311,10 @@ describe('Infinity scroller', () => {
expect(document.querySelectorAll('div.page-item').length).toBe(2)
expect(document.querySelectorAll('div.page-item')[0].textContent).toBe(
- '3'
+ '3',
)
expect(document.querySelectorAll('div.page-item')[1].textContent).toBe(
- '4'
+ '4',
)
await intersect()
@@ -322,13 +322,13 @@ describe('Infinity scroller', () => {
expect(document.querySelectorAll('div.page-item').length).toBe(3)
expect(document.querySelectorAll('div.page-item')[0].textContent).toBe(
- '3'
+ '3',
)
expect(document.querySelectorAll('div.page-item')[1].textContent).toBe(
- '4'
+ '4',
)
expect(document.querySelectorAll('div.page-item')[2].textContent).toBe(
- '5'
+ '5',
)
expect(disconnect).toHaveBeenCalledTimes(2)
@@ -425,36 +425,36 @@ describe('Infinity scroller', () => {
expect(document.querySelectorAll('div.page-item').length).toBe(20)
expect(document.querySelectorAll('div.page-item')[0].textContent).toBe(
- 'page-11'
+ 'page-11',
)
expect(
document.querySelectorAll('div.page-item')[
document.querySelectorAll('div.page-item').length - 1
- ].textContent
+ ].textContent,
).toBe('page-30')
await intersect()
expect(document.querySelectorAll('div.page-item').length).toBe(30)
expect(document.querySelectorAll('div.page-item')[0].textContent).toBe(
- 'page-11'
+ 'page-11',
)
expect(
document.querySelectorAll('div.page-item')[
document.querySelectorAll('div.page-item').length - 1
- ].textContent
+ ].textContent,
).toBe('page-40')
await intersect()
expect(document.querySelectorAll('div.page-item').length).toBe(40)
expect(document.querySelectorAll('div.page-item')[0].textContent).toBe(
- 'page-11'
+ 'page-11',
)
expect(
document.querySelectorAll('div.page-item')[
document.querySelectorAll('div.page-item').length - 1
- ].textContent
+ ].textContent,
).toBe('page-50')
localStack.current = {}
@@ -464,12 +464,12 @@ describe('Infinity scroller', () => {
expect(document.querySelectorAll('div.page-item').length).toBe(10)
expect(document.querySelectorAll('div.page-item')[0].textContent).toBe(
- 'page-21'
+ 'page-21',
)
expect(
document.querySelectorAll('div.page-item')[
document.querySelectorAll('div.page-item').length - 1
- ].textContent
+ ].textContent,
).toBe('page-30')
})
@@ -521,15 +521,15 @@ describe('Infinity scroller', () => {
expect(document.querySelectorAll('div.page-item').length).toBe(20)
expect(document.querySelectorAll('div.page-item')[0].textContent).toBe(
- 'page-1'
+ 'page-1',
)
expect(
document.querySelectorAll('div.page-item')[
document.querySelectorAll('div.page-item').length - 1
- ].textContent
+ ].textContent,
).toBe('page-20')
expect(
- document.querySelector('div.dnb-pagination__loadbar')
+ document.querySelector('div.dnb-pagination__loadbar'),
).not.toBeInTheDocument()
})
@@ -544,7 +544,7 @@ describe('Infinity scroller', () => {
const clickOnLoadMore = async () => {
fireEvent.click(
- document.querySelector('div.dnb-pagination__loadbar button')
+ document.querySelector('div.dnb-pagination__loadbar button'),
)
await waitForComponent()
@@ -557,7 +557,7 @@ describe('Infinity scroller', () => {
on_startup={on_startup}
on_change={on_change}
on_load={on_load}
- />
+ />,
)
await waitForComponent()
@@ -568,17 +568,17 @@ describe('Infinity scroller', () => {
expect(document.querySelectorAll('div.page-item').length).toBe(2)
expect(document.querySelectorAll('div.page-item')[0].textContent).toBe(
- '2'
+ '2',
)
await clickOnLoadMore()
expect(document.querySelectorAll('div.page-item').length).toBe(3)
expect(document.querySelectorAll('div.page-item')[0].textContent).toBe(
- '1'
+ '1',
)
expect(
- document.querySelector('div.dnb-pagination__loadbar')
+ document.querySelector('div.dnb-pagination__loadbar'),
).not.toBeInTheDocument()
expect(on_startup).toHaveBeenCalledTimes(1)
@@ -590,7 +590,7 @@ describe('Infinity scroller', () => {
render(
content
-
+ ,
)
expect(document.querySelector('div#page-content')).toBeInTheDocument()
@@ -600,11 +600,11 @@ describe('Infinity scroller', () => {
const { rerender } = render(
-
+ ,
)
const element = document.querySelector(
- '.dnb-pagination__bar__skip button'
+ '.dnb-pagination__bar__skip button',
)
expect(element.textContent).toContain(nb.prev_title)
@@ -612,7 +612,7 @@ describe('Infinity scroller', () => {
rerender(
-
+ ,
)
expect(element.textContent).toContain(en.prev_title)
@@ -620,7 +620,7 @@ describe('Infinity scroller', () => {
rerender(
-
+ ,
)
expect(element.textContent).toContain(nb.prev_title)
@@ -631,7 +631,7 @@ describe('Infinity scroller', () => {
const element = document.querySelector('.dnb-pagination')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -640,7 +640,7 @@ describe('Infinity scroller', () => {
'dnb-pagination',
'dnb-space__top--large',
'dnb-pagination--left',
- ])
+ ]),
)
})
@@ -694,26 +694,26 @@ describe('Infinity scroller', () => {
const clickOnLoadMore = async () => {
fireEvent.click(
- document.querySelector('div.dnb-pagination__loadbar button')
+ document.querySelector('div.dnb-pagination__loadbar button'),
)
await waitForComponent()
}
expect(document.querySelector('div#page-content').textContent).toBe(
- 'page-3'
+ 'page-3',
)
await clickOnLoadMore()
expect(document.querySelector('div#page-content').textContent).toBe(
- 'page-2'
+ 'page-2',
)
await clickOnLoadMore()
expect(document.querySelector('div#page-content').textContent).toBe(
- 'page-1'
+ 'page-1',
)
expect(on_startup).toHaveBeenCalledTimes(1)
@@ -726,7 +726,7 @@ describe('Infinity scroller', () => {
await waitForComponent()
expect(document.querySelector('div#page-content').textContent).toBe(
- 'page-3'
+ 'page-3',
)
expect(on_startup).toHaveBeenCalledTimes(2)
@@ -739,10 +739,10 @@ describe('Infinity scroller', () => {
render( )
expect(
- document.querySelector('.dnb-pagination__bar')
+ document.querySelector('.dnb-pagination__bar'),
).toBeInTheDocument()
expect(
- document.querySelector('.dnb-pagination__indicator')
+ document.querySelector('.dnb-pagination__indicator'),
).not.toBeInTheDocument()
})
})
@@ -765,7 +765,7 @@ describe('Pagination ARIA', () => {
page_count={5}
current_page={3}
min_wait_time={0}
- />
+ />,
)
await wait(1)
expect(await axeComponent(CheckComponent)).toHaveNoViolations()
@@ -780,7 +780,7 @@ describe('Pagination scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-pagination-theme-ui.scss')
+ require.resolve('../style/themes/dnb-pagination-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/pagination/stories/Pagination.stories.tsx b/packages/dnb-eufemia/src/components/pagination/stories/Pagination.stories.tsx
index 215fe178c46..0aff39c8ef4 100644
--- a/packages/dnb-eufemia/src/components/pagination/stories/Pagination.stories.tsx
+++ b/packages/dnb-eufemia/src/components/pagination/stories/Pagination.stories.tsx
@@ -25,7 +25,9 @@ const LargePage = styled.div`
background-color: ${(props) => props.color || 'hotpink'};
font-size: 15vw;
font-weight: var(--font-weight-bold);
- font-feature-settings: 'pnum' on, 'lnum' on;
+ font-feature-settings:
+ 'pnum' on,
+ 'lnum' on;
color: var(--color-white);
`
@@ -49,7 +51,7 @@ export const InfinitySandbox = () => {
setTimeout(() => {
setContent(
pageNumber,
- {pageNumber}
+ {pageNumber} ,
)
}, 100)
}
@@ -131,9 +133,12 @@ export const PaginationSandbox = () => (
{({ pageNumber, setContent }) => {
// simulate server communication delay
- const timeout = setTimeout(() => {
- setContent(pageNumber, {pageNumber} )
- }, Math.ceil(Math.random() * 500))
+ const timeout = setTimeout(
+ () => {
+ setContent(pageNumber, {pageNumber} )
+ },
+ Math.ceil(Math.random() * 500),
+ )
return () => clearTimeout(timeout)
}}
@@ -216,7 +221,7 @@ export const PaginationSandbox = () => (
console.log('on_end: ', pageNumber)
setContent(
pageNumber,
- End
+ End ,
)
}}
/>
@@ -281,9 +286,12 @@ const InfinityPagination = ({ children, ...props }) => {
on_load={({ pageNumber, setContent }) => {
console.log('InfinityPagination on_load:', pageNumber)
- setTimeout(() => {
- setContent(pageNumber, children(pageNumber))
- }, Math.ceil(Math.random() * 1e3))
+ setTimeout(
+ () => {
+ setContent(pageNumber, children(pageNumber))
+ },
+ Math.ceil(Math.random() * 1e3),
+ )
}}
on_end={({ pageNumber, setContent }) => {
console.log('InfinityPagination on_end:', pageNumber)
diff --git a/packages/dnb-eufemia/src/components/pagination/stories/PaginationTable.stories.tsx b/packages/dnb-eufemia/src/components/pagination/stories/PaginationTable.stories.tsx
index 18dea4aca2a..01dd4c50055 100644
--- a/packages/dnb-eufemia/src/components/pagination/stories/PaginationTable.stories.tsx
+++ b/packages/dnb-eufemia/src/components/pagination/stories/PaginationTable.stories.tsx
@@ -65,7 +65,7 @@ const InfinityPaginationTable = ({ tableItems, ...props }) => {
const onToggleExpanded = (
{ ssn: _ssn },
- { pageNumber = 0, element = null, onExpanded = null } = {}
+ { pageNumber = 0, element = null, onExpanded = null } = {},
) => {
const index = tableItems.findIndex(({ ssn }) => ssn === _ssn)
if (index > -1) {
@@ -95,7 +95,7 @@ const InfinityPaginationTable = ({ tableItems, ...props }) => {
// set the startup height
const onMounted = (items) => {
items.forEach(({ element: { current: element }, expanded }) =>
- setHeight({ element, expanded, animation: false })
+ setHeight({ element, expanded, animation: false }),
)
}
@@ -120,15 +120,18 @@ const InfinityPaginationTable = ({ tableItems, ...props }) => {
// simulate server delay
clearTimeout(serverDelayTimeout)
- serverDelayTimeout = setTimeout(() => {
- if (pageNumber === currentPage) {
- // once we set current page, we force a re-render, and sync of data
- // but only if we are on the same page
- forceRerender(new Date().getTime())
- } else {
- setLocalPage(pageNumber)
- }
- }, Math.ceil(Math.random() * 1e3)) // simulate random delay
+ serverDelayTimeout = setTimeout(
+ () => {
+ if (pageNumber === currentPage) {
+ // once we set current page, we force a re-render, and sync of data
+ // but only if we are on the same page
+ forceRerender(new Date().getTime())
+ } else {
+ setLocalPage(pageNumber)
+ }
+ },
+ Math.ceil(Math.random() * 1e3),
+ ) // simulate random delay
}
return (
@@ -333,7 +336,9 @@ const TableRow = styled.tr`
transform: translateY(-10px);
opacity: 0;
- transition: height 400ms ease-out, opacity 600ms ease-out,
+ transition:
+ height 400ms ease-out,
+ opacity 600ms ease-out,
transform 400ms ease-out;
td {
@@ -372,7 +377,9 @@ const TableData = styled.td`
.dnb-p {
cursor: text;
- font-feature-settings: 'pnum' on, 'lnum' on;
+ font-feature-settings:
+ 'pnum' on,
+ 'lnum' on;
font-weight: var(--font-weight-bold);
font-size: var(--font-size-large);
@@ -412,7 +419,7 @@ const setHeight = ({
element.style.height = '1px'
}
window.requestAnimationFrame(
- () => (element.style.height = newHeight)
+ () => (element.style.height = newHeight),
)
})
}
diff --git a/packages/dnb-eufemia/src/components/pagination/stories/PaginationTableMarker.stories.tsx b/packages/dnb-eufemia/src/components/pagination/stories/PaginationTableMarker.stories.tsx
index 54b5aafbe82..644bf765dab 100644
--- a/packages/dnb-eufemia/src/components/pagination/stories/PaginationTableMarker.stories.tsx
+++ b/packages/dnb-eufemia/src/components/pagination/stories/PaginationTableMarker.stories.tsx
@@ -94,7 +94,7 @@ const InfinityPaginationTable = ({ tableItems, ...props }) => {
// set the startup height
const onMounted = (items) => {
items.forEach(({ element: { current: element }, expanded }) =>
- setHeight({ element, expanded, animation: false })
+ setHeight({ element, expanded, animation: false }),
)
}
@@ -171,10 +171,13 @@ const InfinityPaginationTable = ({ tableItems, ...props }) => {
} else {
// simulate server delay
clearTimeout(serverDelayTimeout)
- serverDelayTimeout = setTimeout(() => {
- // once we set current page, we force a rerender, and sync of data
- setCurrentPage(pageNumber)
- }, Math.ceil(Math.random() * 1e3)) // simulate random delay
+ serverDelayTimeout = setTimeout(
+ () => {
+ // once we set current page, we force a rerender, and sync of data
+ setCurrentPage(pageNumber)
+ },
+ Math.ceil(Math.random() * 1e3),
+ ) // simulate random delay
}
}}
on_startup={({ pageNumber }) => {
@@ -288,7 +291,9 @@ const TableData = styled.td`
.dnb-p {
cursor: text;
- font-feature-settings: 'pnum' on, 'lnum' on;
+ font-feature-settings:
+ 'pnum' on,
+ 'lnum' on;
font-weight: var(--font-weight-bold);
font-size: var(--font-size-large);
@@ -328,7 +333,7 @@ const setHeight = ({
element.style.height = '1px'
}
window.requestAnimationFrame(
- () => (element.style.height = newHeight)
+ () => (element.style.height = newHeight),
)
})
}
diff --git a/packages/dnb-eufemia/src/components/progress-indicator/ProgressIndicator.js b/packages/dnb-eufemia/src/components/progress-indicator/ProgressIndicator.js
index 3450194e94f..471dfcea27d 100644
--- a/packages/dnb-eufemia/src/components/progress-indicator/ProgressIndicator.js
+++ b/packages/dnb-eufemia/src/components/progress-indicator/ProgressIndicator.js
@@ -108,7 +108,7 @@ export default class ProgressIndicator extends React.PureComponent {
this.props,
ProgressIndicator.defaultProps,
this.context.getTranslation(this.props).ProgressIndicator,
- this.context.ProgressIndicator
+ this.context.ProgressIndicator,
)
const {
@@ -152,7 +152,7 @@ export default class ProgressIndicator extends React.PureComponent {
isTrue(no_animation) && 'dnb-progress-indicator--no-animation',
createSpacingClasses(props),
className,
- _className
+ _className,
)}
{...params}
>
diff --git a/packages/dnb-eufemia/src/components/progress-indicator/ProgressIndicatorCircular.js b/packages/dnb-eufemia/src/components/progress-indicator/ProgressIndicatorCircular.js
index f7e4782b044..e007e3af0e2 100644
--- a/packages/dnb-eufemia/src/components/progress-indicator/ProgressIndicatorCircular.js
+++ b/packages/dnb-eufemia/src/components/progress-indicator/ProgressIndicatorCircular.js
@@ -68,7 +68,7 @@ export default class ProgressIndicatorCircular extends React.PureComponent {
this.animate(
this._refDark.current,
true,
- this.props.callOnCompleteHandler
+ this.props.callOnCompleteHandler,
)
}
if (this._refLight.current) {
@@ -179,7 +179,7 @@ export default class ProgressIndicatorCircular extends React.PureComponent {
'dnb-progress-indicator__circular',
size && `dnb-progress-indicator__circular--${size}`,
hasProgressValue &&
- 'dnb-progress-indicator__circular--has-progress-value'
+ 'dnb-progress-indicator__circular--has-progress-value',
)}
{...params}
>
@@ -188,7 +188,7 @@ export default class ProgressIndicatorCircular extends React.PureComponent {
className={classnames(
'dnb-progress-indicator__circular__line',
'light',
- 'paused'
+ 'paused',
)}
/>
diff --git a/packages/dnb-eufemia/src/components/progress-indicator/ProgressIndicatorLinear.js b/packages/dnb-eufemia/src/components/progress-indicator/ProgressIndicatorLinear.js
index 133263a46be..11726a37ea7 100644
--- a/packages/dnb-eufemia/src/components/progress-indicator/ProgressIndicatorLinear.js
+++ b/packages/dnb-eufemia/src/components/progress-indicator/ProgressIndicatorLinear.js
@@ -90,7 +90,7 @@ export default class ProgressIndicatorLinear extends React.PureComponent {
@@ -100,7 +100,7 @@ export default class ProgressIndicatorLinear extends React.PureComponent {
hasProgressValue &&
'dnb-progress-indicator__linear__bar-transition',
!hasProgressValue &&
- 'dnb-progress-indicator__linear__bar1-animation'
+ 'dnb-progress-indicator__linear__bar1-animation',
)}
style={hasProgressValue ? { transform } : {}}
/>
@@ -108,7 +108,7 @@ export default class ProgressIndicatorLinear extends React.PureComponent {
)}
diff --git a/packages/dnb-eufemia/src/components/progress-indicator/__tests__/ProgressIndicator.test.tsx b/packages/dnb-eufemia/src/components/progress-indicator/__tests__/ProgressIndicator.test.tsx
index 464db4a9f33..822279fc0d4 100644
--- a/packages/dnb-eufemia/src/components/progress-indicator/__tests__/ProgressIndicator.test.tsx
+++ b/packages/dnb-eufemia/src/components/progress-indicator/__tests__/ProgressIndicator.test.tsx
@@ -20,7 +20,7 @@ describe('Circular ProgressIndicator component', () => {
it('has to have a stroke-dashoffset of 44 on 50%', () => {
render( )
expect(
- document.querySelector(mainLineSelector).getAttribute('style')
+ document.querySelector(mainLineSelector).getAttribute('style'),
).toBe('stroke-dashoffset: 44;')
})
@@ -31,18 +31,22 @@ describe('Circular ProgressIndicator component', () => {
format(50, {
decimals: 2,
percent: true,
- })
+ }),
)
})
it('has role of alert or progressbar depending if progress has a value', () => {
const { rerender } = render(
-
+ ,
)
expect(screen.queryByRole('alert')).toBeInTheDocument()
rerender(
-
+ ,
)
expect(screen.queryByRole('progressbar')).toBeInTheDocument()
})
@@ -54,10 +58,10 @@ describe('Circular ProgressIndicator component', () => {
format(80, {
decimals: 2,
percent: true,
- })
+ }),
)
expect(
- document.querySelector(mainLineSelector).getAttribute('style')
+ document.querySelector(mainLineSelector).getAttribute('style'),
).toBe('stroke-dashoffset: 17.599999999999994;')
})
@@ -69,7 +73,7 @@ describe('Circular ProgressIndicator component', () => {
format(1, {
decimals: 2,
percent: true,
- })
+ }),
)
})
@@ -81,7 +85,7 @@ describe('Circular ProgressIndicator component', () => {
format(1, {
decimals: 2,
percent: true,
- })
+ }),
)
})
@@ -92,7 +96,7 @@ describe('Circular ProgressIndicator component', () => {
type="circular"
progress={null}
title={null}
- />
+ />,
)
const indicator = screen.getByRole('alert')
@@ -106,7 +110,7 @@ describe('Circular ProgressIndicator component', () => {
type="circular"
progress={null}
title={null}
- />
+ />,
)
const indicator = screen.getByRole('alert')
@@ -121,7 +125,7 @@ describe('Circular ProgressIndicator component', () => {
type="circular"
progress={1}
title={title}
- />
+ />,
)
const indicator = screen.getByRole('progressbar')
@@ -136,7 +140,7 @@ describe('Circular ProgressIndicator component', () => {
type="circular"
progress={1}
title={title}
- />
+ />,
)
const indicator = screen.getByRole('progressbar')
@@ -150,7 +154,7 @@ describe('Linear ProgressIndicator component', () => {
it('has to have a transform of translateX(-50%) on 50%', () => {
render( )
expect(
- document.querySelector(mainLineSelector).getAttribute('style')
+ document.querySelector(mainLineSelector).getAttribute('style'),
).toBe('transform: translateX(-50%);')
})
@@ -161,7 +165,7 @@ describe('Linear ProgressIndicator component', () => {
format(50, {
decimals: 2,
percent: true,
- })
+ }),
)
})
@@ -173,13 +177,13 @@ describe('Linear ProgressIndicator component', () => {
format(50, {
decimals: 2,
percent: true,
- })
+ }),
)
})
it('has role of alert or progressbar depending if progress has a value', () => {
const { rerender } = render(
-
+ ,
)
expect(screen.queryByRole('alert')).toBeInTheDocument()
@@ -194,10 +198,10 @@ describe('Linear ProgressIndicator component', () => {
format(80, {
decimals: 2,
percent: true,
- })
+ }),
)
expect(
- document.querySelector(mainLineSelector).getAttribute('style')
+ document.querySelector(mainLineSelector).getAttribute('style'),
).toBe('transform: translateX(-20%);')
})
@@ -209,7 +213,7 @@ describe('Linear ProgressIndicator component', () => {
format(1, {
decimals: 2,
percent: true,
- })
+ }),
)
})
@@ -221,7 +225,7 @@ describe('Linear ProgressIndicator component', () => {
format(1, {
decimals: 2,
percent: true,
- })
+ }),
)
})
@@ -232,7 +236,7 @@ describe('Linear ProgressIndicator component', () => {
type="linear"
progress={null}
title={null}
- />
+ />,
)
const indicator = screen.getByRole('alert')
@@ -246,7 +250,7 @@ describe('Linear ProgressIndicator component', () => {
type="linear"
progress={null}
title={null}
- />
+ />,
)
const indicator = screen.getByRole('alert')
@@ -261,7 +265,7 @@ describe('Linear ProgressIndicator component', () => {
type="linear"
progress={1}
title={title}
- />
+ />,
)
const indicator = screen.getByRole('progressbar')
@@ -276,7 +280,7 @@ describe('Linear ProgressIndicator component', () => {
type="linear"
progress={1}
title={title}
- />
+ />,
)
const indicator = screen.getByRole('progressbar')
@@ -287,14 +291,14 @@ describe('Linear ProgressIndicator component', () => {
describe('ProgressIndicator ARIA', () => {
it('should validate with ARIA rules', async () => {
const Comp = render(
-
+ ,
)
expect(await axeComponent(Comp)).toHaveNoViolations()
})
it('should validate with ARIA rules', async () => {
const Comp = render(
-
+ ,
)
expect(await axeComponent(Comp)).toHaveNoViolations()
})
@@ -309,8 +313,8 @@ describe('ProgressIndicator scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
require.resolve(
- '../style/themes/dnb-progress-indicator-theme-ui.scss'
- )
+ '../style/themes/dnb-progress-indicator-theme-ui.scss',
+ ),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/radio/Radio.js b/packages/dnb-eufemia/src/components/radio/Radio.js
index 2b5eea7ee54..954b0e8b29a 100644
--- a/packages/dnb-eufemia/src/components/radio/Radio.js
+++ b/packages/dnb-eufemia/src/components/radio/Radio.js
@@ -204,7 +204,7 @@ export default class Radio extends React.PureComponent {
// then we have to use a delay, to overwrite the uncontrolled state
setTimeout(() => {
this.setState({ checked, _listenForPropChanges: false }, () =>
- this.callOnChange({ value, checked, event })
+ this.callOnChange({ value, checked, event }),
)
}, 1)
} else {
@@ -264,7 +264,7 @@ export default class Radio extends React.PureComponent {
const contextProps = extendPropsWithContextInClassComponent(
this.props,
Radio.defaultProps,
- this.context
+ this.context,
)
// use only the props from context, who are available here anyway
@@ -274,7 +274,7 @@ export default class Radio extends React.PureComponent {
contextProps,
{ skeleton: context?.skeleton },
includeValidProps(context.FormRow),
- context.Radio
+ context.Radio,
)
const {
@@ -335,7 +335,7 @@ export default class Radio extends React.PureComponent {
`dnb-radio--label-position-${label_position || 'right'}`,
createSpacingClasses(props),
className,
- _className
+ _className,
),
}
@@ -353,7 +353,7 @@ export default class Radio extends React.PureComponent {
inputParams['aria-describedby'] = combineDescribedBy(
inputParams,
showStatus ? id + '-status' : null,
- suffix ? id + '-suffix' : null
+ suffix ? id + '-suffix' : null,
)
}
if (readOnly) {
@@ -428,8 +428,8 @@ export default class Radio extends React.PureComponent {
createSkeletonClass(
'shape',
skeleton,
- this.context
- )
+ this.context,
+ ),
)}
aria-hidden
/>
diff --git a/packages/dnb-eufemia/src/components/radio/RadioGroup.js b/packages/dnb-eufemia/src/components/radio/RadioGroup.js
index 9f14923ba1e..f528842865b 100644
--- a/packages/dnb-eufemia/src/components/radio/RadioGroup.js
+++ b/packages/dnb-eufemia/src/components/radio/RadioGroup.js
@@ -158,7 +158,7 @@ export default class RadioGroup extends React.PureComponent {
this.props,
RadioGroup.defaultProps,
includeValidProps(this.context.FormRow),
- this.context.RadioGroup
+ this.context.RadioGroup,
)
const {
@@ -202,7 +202,7 @@ export default class RadioGroup extends React.PureComponent {
'dnb-form-component',
createSpacingClasses(props),
className,
- _className
+ _className,
)
const params = {
@@ -213,7 +213,7 @@ export default class RadioGroup extends React.PureComponent {
params['aria-describedby'] = combineDescribedBy(
params,
showStatus ? id + '-status' : null,
- suffix ? id + '-suffix' : null
+ suffix ? id + '-suffix' : null,
)
}
if (label) {
diff --git a/packages/dnb-eufemia/src/components/radio/__tests__/Radio.test.tsx b/packages/dnb-eufemia/src/components/radio/__tests__/Radio.test.tsx
index b62b16203e7..60945d712f1 100644
--- a/packages/dnb-eufemia/src/components/radio/__tests__/Radio.test.tsx
+++ b/packages/dnb-eufemia/src/components/radio/__tests__/Radio.test.tsx
@@ -32,7 +32,7 @@ describe('Radio component', () => {
const value = 'new value'
rerender( )
expect(document.querySelector('input').getAttribute('value')).toBe(
- value
+ value,
)
})
@@ -45,7 +45,7 @@ describe('Radio component', () => {
onChange={myEvent}
checked={false}
group={null}
- />
+ />,
)
fireEvent.click(document.querySelector('input'))
expect(my_event.mock.calls.length).toBe(1)
@@ -112,7 +112,7 @@ describe('Radio component', () => {
TestStates(
-
+ ,
)
})
@@ -124,7 +124,7 @@ describe('Radio component', () => {
rerender( )
expect(
- document.querySelector('input[disabled]')
+ document.querySelector('input[disabled]'),
).not.toBeInTheDocument()
})
@@ -143,16 +143,16 @@ describe('Radio component', () => {
render(
-
+ ,
)
const element = document.querySelector('.dnb-radio')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
const inputElement = document.querySelector('.dnb-radio input')
const inputAttributes = Array.from(inputElement.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -186,7 +186,7 @@ describe('Radio group component', () => {
>
-
+ ,
)
fireEvent.click(document.querySelectorAll('input')[0])
expect(my_event.mock.calls.length).toBe(1)
@@ -201,7 +201,7 @@ describe('Radio group component', () => {
render(
-
+ ,
)
expect(document.querySelector('input[disabled]')).toBeInTheDocument()
@@ -211,7 +211,7 @@ describe('Radio group component', () => {
render(
-
+ ,
)
expect(document.querySelector('input[disabled]')).toBeInTheDocument()
@@ -222,14 +222,14 @@ describe('Radio group component', () => {
-
+ ,
)
expect(document.querySelectorAll('input')[0]).not.toHaveAttribute(
- 'disabled'
+ 'disabled',
)
expect(document.querySelectorAll('input')[1]).toHaveAttribute(
- 'disabled'
+ 'disabled',
)
})
@@ -238,7 +238,7 @@ describe('Radio group component', () => {
-
+ ,
)
const element = document.querySelector('.dnb-radio-group')
@@ -258,12 +258,12 @@ describe('Radio group component', () => {
-
+ ,
)
const element = document.querySelector('.dnb-radio-group')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -274,8 +274,8 @@ describe('Radio group component', () => {
])
expect(
Array.from(
- document.querySelector('.dnb-radio-group .dnb-form-row').classList
- )
+ document.querySelector('.dnb-radio-group .dnb-form-row').classList,
+ ),
).toEqual([
'dnb-section',
'dnb-section--transparent',
@@ -285,7 +285,7 @@ describe('Radio group component', () => {
'dnb-form-row--nested',
])
expect(
- Array.from(document.querySelector('.dnb-form-row').classList)
+ Array.from(document.querySelector('.dnb-form-row').classList),
).toEqual([
'dnb-section',
'dnb-section--transparent',
@@ -305,7 +305,7 @@ describe('Radio ARIA', () => {
// because of the role="radio", we have to allow this
'aria-allowed-role': { enabled: false },
},
- })
+ }),
).toHaveNoViolations()
})
@@ -320,7 +320,7 @@ describe('Radio ARIA', () => {
>
-
+ ,
)
expect(
await axeComponent(Comp, {
@@ -329,7 +329,7 @@ describe('Radio ARIA', () => {
// because of the role="radio", we have to allow this
'aria-allowed-role': { enabled: false },
},
- })
+ }),
).toHaveNoViolations()
})
@@ -355,7 +355,7 @@ describe('Radio scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-radio-theme-ui.scss')
+ require.resolve('../style/themes/dnb-radio-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/radio/stories/Radio.stories.tsx b/packages/dnb-eufemia/src/components/radio/stories/Radio.stories.tsx
index 9bbe34bd421..bc9a5124991 100644
--- a/packages/dnb-eufemia/src/components/radio/stories/Radio.stories.tsx
+++ b/packages/dnb-eufemia/src/components/radio/stories/Radio.stories.tsx
@@ -274,7 +274,7 @@ const RadioGroupsWithStatus = () => {
+ ,
)
const tableElement = document.querySelector('table')
const trElem = document.querySelector('tr')
const barElem: HTMLElement = document.querySelector(
- '.dnb-modal__header__bar'
+ '.dnb-modal__header__bar',
)
const scrollElem: HTMLElement =
document.querySelector('.dnb-scroll-view')
@@ -278,7 +278,7 @@ describe('useStickyHeader', () => {
// Should set correct value (320-(160-40)=200)
simulateScroll(320, scrollElem)
expect(trElem.style.getPropertyValue('--table-offset')).toEqual(
- '200px'
+ '200px',
)
simulateScroll(0, scrollElem)
@@ -287,13 +287,13 @@ describe('useStickyHeader', () => {
// Should set correct value (300-(160-40)=180)
simulateScroll(300, scrollElem)
expect(trElem.style.getPropertyValue('--table-offset')).toEqual(
- '180px'
+ '180px',
)
// Should keep the previous value (300-(160-40)=180)
simulateScroll(3000, scrollElem)
expect(trElem.style.getPropertyValue('--table-offset')).toEqual(
- '180px'
+ '180px',
)
// change the table offset
@@ -303,7 +303,7 @@ describe('useStickyHeader', () => {
// Should set correct value (320-(80-40)=280)
simulateScroll(320, scrollElem)
expect(trElem.style.getPropertyValue('--table-offset')).toEqual(
- '280px'
+ '280px',
)
rerender(
@@ -314,7 +314,7 @@ describe('useStickyHeader', () => {
-
+
,
)
setSizes()
@@ -322,7 +322,7 @@ describe('useStickyHeader', () => {
// Should set correct value (320-(160-64)=224)
simulateScroll(320, scrollElem)
expect(trElem.style.getPropertyValue('--table-offset')).toEqual(
- '224px'
+ '224px',
)
rerender(
@@ -333,7 +333,7 @@ describe('useStickyHeader', () => {
-
+ ,
)
setSizes()
@@ -341,7 +341,7 @@ describe('useStickyHeader', () => {
// Should set correct value (320-(160-40)=200)
simulateScroll(320, scrollElem)
expect(trElem.style.getPropertyValue('--table-offset')).toEqual(
- '200px'
+ '200px',
)
})
})
@@ -351,7 +351,7 @@ describe('Table aria', () => {
const Component = render(
-
+ ,
)
expect(await axeComponent(Component)).toHaveNoViolations()
})
diff --git a/packages/dnb-eufemia/src/components/table/__tests__/TableTd.test.tsx b/packages/dnb-eufemia/src/components/table/__tests__/TableTd.test.tsx
index 56e8e3bf9c3..3e219d7484a 100644
--- a/packages/dnb-eufemia/src/components/table/__tests__/TableTd.test.tsx
+++ b/packages/dnb-eufemia/src/components/table/__tests__/TableTd.test.tsx
@@ -14,7 +14,7 @@ describe('TableTd', () => {
-
+ ,
)
expect(document.querySelector('td')).toBeInTheDocument()
})
@@ -27,7 +27,7 @@ describe('TableTd', () => {
td content
-
+ ,
)
const element = document.querySelector('td')
@@ -43,12 +43,12 @@ describe('TableTd', () => {
td content
-
+ ,
)
const element = document.querySelector('td')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['role', 'class', 'aria-label'])
@@ -62,7 +62,7 @@ describe('TableTd', () => {
td content
-
+ ,
)
const element = document.querySelector('td')
@@ -78,7 +78,7 @@ describe('TableTd', () => {
td content
-
+ ,
)
const element = document.querySelector('td')
@@ -96,12 +96,12 @@ describe('TableTd', () => {
td content
-
+ ,
)
const element = document.querySelector('td')
expect(Array.from(element.classList)).toContain(
- 'dnb-table__td--no-spacing'
+ 'dnb-table__td--no-spacing',
)
})
@@ -113,12 +113,12 @@ describe('TableTd', () => {
td content
-
+ ,
)
const element = document.querySelector('td')
expect(Array.from(element.classList)).toContain(
- 'dnb-table__td--spacing-horizontal'
+ 'dnb-table__td--spacing-horizontal',
)
})
diff --git a/packages/dnb-eufemia/src/components/table/__tests__/TableTh.test.tsx b/packages/dnb-eufemia/src/components/table/__tests__/TableTh.test.tsx
index c3337162fcd..4ed6994812c 100644
--- a/packages/dnb-eufemia/src/components/table/__tests__/TableTh.test.tsx
+++ b/packages/dnb-eufemia/src/components/table/__tests__/TableTh.test.tsx
@@ -15,7 +15,7 @@ describe('TableTh', () => {
-
+ ,
)
expect(document.querySelector('th')).toBeInTheDocument()
})
@@ -28,7 +28,7 @@ describe('TableTh', () => {
th content
-
+ ,
)
const element = document.querySelector('th')
@@ -44,12 +44,12 @@ describe('TableTh', () => {
th content
-
+ ,
)
const element = document.querySelector('th')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['role', 'scope', 'class', 'align'])
@@ -63,7 +63,7 @@ describe('TableTh', () => {
th content
-
+ ,
)
const element = document.querySelector('th')
@@ -79,7 +79,7 @@ describe('TableTh', () => {
th content
-
+ ,
)
const element = document.querySelector('th')
@@ -96,7 +96,7 @@ describe('TableTh', () => {
th content
-
+ ,
)
const element = document.querySelector('th')
@@ -113,7 +113,7 @@ describe('TableTh', () => {
th content
-
+ ,
)
const element = document.querySelector('th')
@@ -130,7 +130,7 @@ describe('TableTh', () => {
th content
-
+ ,
)
const element = document.querySelector('th')
@@ -148,7 +148,7 @@ describe('TableTh', () => {
-
+ ,
)
const element = document.querySelector('th')
@@ -166,7 +166,7 @@ describe('TableTh', () => {
-
+ ,
)
const element = document.querySelector('th')
@@ -182,7 +182,7 @@ describe('TableTh', () => {
th content
-
+ ,
)
const element = document.querySelector('th')
@@ -197,7 +197,7 @@ describe('TableTh', () => {
th content
-
+ ,
)
const element = document.querySelector('th')
diff --git a/packages/dnb-eufemia/src/components/table/__tests__/TableTr.test.tsx b/packages/dnb-eufemia/src/components/table/__tests__/TableTr.test.tsx
index 22876e3be32..6abe4a839fa 100644
--- a/packages/dnb-eufemia/src/components/table/__tests__/TableTr.test.tsx
+++ b/packages/dnb-eufemia/src/components/table/__tests__/TableTr.test.tsx
@@ -12,7 +12,7 @@ describe('TableTr', () => {
-
+ ,
)
expect(document.querySelector('tr')).toBeInTheDocument()
})
@@ -25,7 +25,7 @@ describe('TableTr', () => {
content
-
+ ,
)
const element = document.querySelector('tr')
@@ -41,7 +41,7 @@ describe('TableTr', () => {
content
-
+ ,
)
const element = document.querySelector('tr')
@@ -57,7 +57,7 @@ describe('TableTr', () => {
content
-
+ ,
)
const element = document.querySelector('tr')
@@ -73,12 +73,12 @@ describe('TableTr', () => {
content
-
+ ,
)
const element = document.querySelector('tr')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['role', 'class', 'aria-label'])
@@ -92,7 +92,7 @@ describe('TableTr', () => {
content
-
+ ,
)
const element = document.querySelector('tr')
@@ -108,7 +108,7 @@ describe('TableTr', () => {
content
-
+ ,
)
const element = document.querySelector('tr')
@@ -123,7 +123,7 @@ describe('TableTr', () => {
content
-
+ ,
)
const element = document.querySelector('tr')
@@ -139,7 +139,7 @@ describe('TableTr', () => {
content
-
+ ,
)
const element = document.querySelector('tr')
@@ -163,21 +163,21 @@ describe('TableTr', () => {
content
-
+ ,
)
const elements = document.querySelectorAll('tbody tr')
expect(Array.from(elements[0].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
expect(Array.from(elements[1].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
expect(Array.from(elements[2].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
expect(Array.from(elements[3].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
})
@@ -198,21 +198,21 @@ describe('TableTr', () => {
content
-
+ ,
)
const elements = document.querySelectorAll('tbody tr')
expect(Array.from(elements[0].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
expect(Array.from(elements[1].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
expect(Array.from(elements[2].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
expect(Array.from(elements[3].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
})
@@ -269,22 +269,22 @@ describe('TableTr', () => {
content
-
+ ,
)
let elements = document.querySelectorAll('tbody tr')
expect(elements).toHaveLength(4)
expect(Array.from(elements[0].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
expect(Array.from(elements[1].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
expect(Array.from(elements[2].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
expect(Array.from(elements[3].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
rerender(
@@ -300,19 +300,19 @@ describe('TableTr', () => {
content
-
+ ,
)
elements = document.querySelectorAll('tbody tr')
expect(elements).toHaveLength(3)
expect(Array.from(elements[0].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
expect(Array.from(elements[1].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
expect(Array.from(elements[2].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
rerender(
@@ -331,23 +331,23 @@ describe('TableTr', () => {
content
-
+ ,
)
elements = document.querySelectorAll('tbody tr')
expect(elements).toHaveLength(4)
// console.log('document.body', document.body.innerHTML)
expect(Array.from(elements[0].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
expect(Array.from(elements[1].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
expect(Array.from(elements[2].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
expect(Array.from(elements[3].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
})
@@ -358,15 +358,15 @@ describe('TableTr', () => {
expect(elements).toHaveLength(3)
expect(elements[0].textContent).toBe('content cab')
expect(Array.from(elements[0].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
expect(elements[1].textContent).toBe('content abc')
expect(Array.from(elements[1].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
expect(elements[2].textContent).toBe('content bac')
expect(Array.from(elements[2].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
fireEvent.click(screen.queryByText('re-order'))
@@ -375,15 +375,15 @@ describe('TableTr', () => {
expect(elements).toHaveLength(3)
expect(elements[0].textContent).toBe('content abc')
expect(Array.from(elements[0].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
expect(elements[1].textContent).toBe('content bac')
expect(Array.from(elements[1].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
expect(elements[2].textContent).toBe('content cab')
expect(Array.from(elements[2].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
})
@@ -391,22 +391,22 @@ describe('TableTr', () => {
render(
-
+ ,
)
let elements = document.querySelectorAll('tbody tr')
expect(elements).toHaveLength(3)
expect(elements[0].textContent).toBe('content cab')
expect(Array.from(elements[0].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
expect(elements[1].textContent).toBe('content abc')
expect(Array.from(elements[1].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
expect(elements[2].textContent).toBe('content bac')
expect(Array.from(elements[2].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
fireEvent.click(screen.queryByText('re-order'))
@@ -415,15 +415,15 @@ describe('TableTr', () => {
expect(elements).toHaveLength(3)
expect(elements[0].textContent).toBe('content abc')
expect(Array.from(elements[0].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
expect(elements[1].textContent).toBe('content bac')
expect(Array.from(elements[1].classList)).toContain(
- 'dnb-table__tr--odd'
+ 'dnb-table__tr--odd',
)
expect(elements[2].textContent).toBe('content cab')
expect(Array.from(elements[2].classList)).toContain(
- 'dnb-table__tr--even'
+ 'dnb-table__tr--even',
)
})
})
diff --git a/packages/dnb-eufemia/src/components/table/style/table-accordion.scss b/packages/dnb-eufemia/src/components/table/style/table-accordion.scss
index a23f8d7a6ec..7faf1dd0a67 100644
--- a/packages/dnb-eufemia/src/components/table/style/table-accordion.scss
+++ b/packages/dnb-eufemia/src/components/table/style/table-accordion.scss
@@ -135,7 +135,9 @@
&--outline
tbody
- &__tr--has-accordion-content:not(#{&}__tr--expanded):not(:nth-last-child(2))
+ &__tr--has-accordion-content:not(#{&}__tr--expanded):not(
+ :nth-last-child(2)
+ )
&__td::before {
bottom: -0.0625rem;
}
@@ -145,7 +147,9 @@
background-color: var(--color-white);
}
- &__tr--has-accordion-content#{&}__tr:not(&__tr--disabled):not(:active):not(:hover):focus {
+ &__tr--has-accordion-content#{&}__tr:not(&__tr--disabled):not(
+ :active
+ ):not(:hover):focus {
td::before {
@include whatInput(keyboard) {
top: 0;
@@ -175,7 +179,9 @@
@include tableAccordionActiveColor();
}
- &__tr--has-accordion-content#{&}__tr--expanded:not(&__tr--disabled)#{&}__tr--hover:not(:active):hover
+ &__tr--has-accordion-content#{&}__tr--expanded:not(
+ &__tr--disabled
+ )#{&}__tr--hover:not(:active):hover
&__td {
background-color: var(--accordion-background);
@@ -185,7 +191,9 @@
}
}
- &__tr--has-accordion-content#{&}__tr#{&}__tr--expanded:not(&__tr--disabled):not(:active):not(:hover) {
+ &__tr--has-accordion-content#{&}__tr#{&}__tr--expanded:not(
+ &__tr--disabled
+ ):not(:active):not(:hover) {
@include whatInputNot('keyboard') {
background-color: var(--accordion-background);
@@ -294,7 +302,9 @@
&--outline
tbody
- &__tr#{&}__tr--has-accordion-content:not(#{&}__tr--expanded):nth-last-child(2)
+ &__tr#{&}__tr--has-accordion-content:not(
+ #{&}__tr--expanded
+ ):nth-last-child(2)
&__td:first-of-type {
&,
&::before,
@@ -305,7 +315,9 @@
&--outline tbody &__tr:last-of-type &__td:last-of-type,
&--outline
tbody
- &__tr#{&}__tr--has-accordion-content:not(#{&}__tr--expanded):nth-last-child(2)
+ &__tr#{&}__tr--has-accordion-content:not(
+ #{&}__tr--expanded
+ ):nth-last-child(2)
&__td:last-of-type {
&,
&::before,
diff --git a/packages/dnb-eufemia/src/components/table/style/table-header-buttons.scss b/packages/dnb-eufemia/src/components/table/style/table-header-buttons.scss
index 6b7e125d314..a03dc98437d 100644
--- a/packages/dnb-eufemia/src/components/table/style/table-header-buttons.scss
+++ b/packages/dnb-eufemia/src/components/table/style/table-header-buttons.scss
@@ -20,7 +20,9 @@
.dnb-table__sort-button.dnb-button {
> .dnb-icon {
opacity: 0;
- transition: opacity 200ms ease-out, transform 500ms ease-out;
+ transition:
+ opacity 200ms ease-out,
+ transform 500ms ease-out;
html[data-visual-test] & {
transition: none;
diff --git a/packages/dnb-eufemia/src/components/table/style/table-tr.scss b/packages/dnb-eufemia/src/components/table/style/table-tr.scss
index 8f4b3478a47..25a8d6daaeb 100644
--- a/packages/dnb-eufemia/src/components/table/style/table-tr.scss
+++ b/packages/dnb-eufemia/src/components/table/style/table-tr.scss
@@ -23,7 +23,9 @@
&--outline thead &__tr:first-of-type,
&--outline
tbody
- &__tr#{&}__tr--has-accordion-content:not(#{&}__tr--expanded):nth-last-child(2) {
+ &__tr#{&}__tr--has-accordion-content:not(
+ #{&}__tr--expanded
+ ):nth-last-child(2) {
// use clip-path, because border-radius does not clip on tr's
// use "-1rem" to add room for sticky shadow
clip-path: inset(0 0 -1rem 0 round 0.5rem 0.5rem 0 0);
@@ -31,7 +33,9 @@
&--outline tbody &__tr:last-of-type,
&--outline
tbody
- &__tr#{&}__tr--has-accordion-content:not(#{&}__tr--expanded):nth-last-child(2) {
+ &__tr#{&}__tr--has-accordion-content:not(
+ #{&}__tr--expanded
+ ):nth-last-child(2) {
// use clip-path, because border-radius does not clip on tr's
clip-path: inset(0 round 0 0 0.5rem 0.5rem);
}
diff --git a/packages/dnb-eufemia/src/components/table/style/themes/dnb-table-theme-ui.scss b/packages/dnb-eufemia/src/components/table/style/themes/dnb-table-theme-ui.scss
index c996b00c47f..ddbdbb123da 100644
--- a/packages/dnb-eufemia/src/components/table/style/themes/dnb-table-theme-ui.scss
+++ b/packages/dnb-eufemia/src/components/table/style/themes/dnb-table-theme-ui.scss
@@ -101,7 +101,9 @@
&:not(&--outline) > tbody > &__tr:last-of-type > &__th::after,
&:not(&--outline)
> tbody
- > &__tr#{&}__tr--has-accordion-content:not(#{&}__tr--expanded):nth-last-child(2)
+ > &__tr#{&}__tr--has-accordion-content:not(
+ #{&}__tr--expanded
+ ):nth-last-child(2)
td::after {
@include tableBorder();
diff --git a/packages/dnb-eufemia/src/components/table/useHandleSortState.tsx b/packages/dnb-eufemia/src/components/table/useHandleSortState.tsx
index 93e06e2160f..c0be55377bf 100644
--- a/packages/dnb-eufemia/src/components/table/useHandleSortState.tsx
+++ b/packages/dnb-eufemia/src/components/table/useHandleSortState.tsx
@@ -60,7 +60,7 @@ export function useHandleSortState(
defaults: useHandleSortStateOptions = {
direction: 'off',
modes: ['asc', 'desc', 'off'],
- }
+ },
) {
const initialState = React.useMemo(() => {
return Object.entries(config).reduce((acc, [name, opts]) => {
@@ -127,7 +127,7 @@ export function useHandleSortState(
return acc
},
- {}
+ {},
)
return { sortState, sortHandler, activeSortName }
diff --git a/packages/dnb-eufemia/src/components/tabs/Tabs.js b/packages/dnb-eufemia/src/components/tabs/Tabs.js
index 51885f1ab3c..d82bfa78afe 100644
--- a/packages/dnb-eufemia/src/components/tabs/Tabs.js
+++ b/packages/dnb-eufemia/src/components/tabs/Tabs.js
@@ -51,14 +51,14 @@ export default class Tabs extends React.PureComponent {
.isRequired,
selected: PropTypes.bool,
disabled: PropTypes.bool,
- })
+ }),
),
PropTypes.objectOf(
PropTypes.shape({
title: PropTypes.string.isRequired,
selected: PropTypes.bool,
disabled: PropTypes.bool,
- })
+ }),
),
]),
content: PropTypes.oneOfType([
@@ -157,7 +157,7 @@ export default class Tabs extends React.PureComponent {
useKey =
data.reduce(
(acc, { selected, key }) => (selected ? key : acc),
- null
+ null,
) ||
(data[0] && data[0].key)
} else {
@@ -299,7 +299,7 @@ export default class Tabs extends React.PureComponent {
let selected_key = Tabs.getSelectedKeyOrFallback(
props.selected_key,
- data
+ data,
)
// check if we have to open a different tab
@@ -415,7 +415,7 @@ export default class Tabs extends React.PureComponent {
if (typeof window !== 'undefined') {
try {
const pos = parseFloat(
- window.localStorage.getItem(`tabs-pos-${this._id}`)
+ window.localStorage.getItem(`tabs-pos-${this._id}`),
)
window.localStorage.removeItem(`tabs-pos-${this._id}`)
return isNaN(pos) ? -1 : pos
@@ -445,7 +445,7 @@ export default class Tabs extends React.PureComponent {
try {
window.localStorage.setItem(
`tabs-last-${this._id}`,
- this.state.selected_key
+ this.state.selected_key,
) // gets removed right afterwards
} catch (e) {
warn(e)
@@ -599,15 +599,15 @@ export default class Tabs extends React.PureComponent {
try {
if (this.state.hasScrollbar && this._tablistRef.current) {
const first = this._tablistRef.current.querySelector(
- '.dnb-tabs__button__snap:first-of-type'
+ '.dnb-tabs__button__snap:first-of-type',
)
const isFirst = first.classList.contains(type)
const last = this._tablistRef.current.querySelector(
- '.dnb-tabs__button__snap:last-of-type'
+ '.dnb-tabs__button__snap:last-of-type',
)
const isLast = last.classList.contains(type)
const elem = this._tablistRef.current.querySelector(
- `.dnb-tabs__button.${type}`
+ `.dnb-tabs__button.${type}`,
)
const style = window.getComputedStyle(this._tabsRef.current)
@@ -617,7 +617,7 @@ export default class Tabs extends React.PureComponent {
// Add the extra padding when we go from 1 to 2 tab so the nav button
if (!isFirst && !isLast && parseFloat(style.paddingLeft) < 16) {
const navButton = this._tabsRef.current.querySelector(
- '.dnb-tabs__scroll-nav-button:first-of-type'
+ '.dnb-tabs__scroll-nav-button:first-of-type',
)
const additionalSpace =
parseFloat(window.getComputedStyle(navButton).width) * 1.5
@@ -689,7 +689,7 @@ export default class Tabs extends React.PureComponent {
dispatchCustomElementEvent(
this,
'on_mouse_enter',
- this.getEventArgs({ event, selected_key })
+ this.getEventArgs({ event, selected_key }),
)
}
}
@@ -700,7 +700,7 @@ export default class Tabs extends React.PureComponent {
const ret = dispatchCustomElementEvent(
this,
'on_click',
- this.getEventArgs({ event, selected_key })
+ this.getEventArgs({ event, selected_key }),
)
if (ret !== false) {
@@ -727,7 +727,7 @@ export default class Tabs extends React.PureComponent {
getCurrentTitle = (selected_key = this.state.selected_key) => {
const current = this.state.data.filter(
- ({ key }) => key == selected_key
+ ({ key }) => key == selected_key,
)[0]
return (current && current.title) || null
}
@@ -736,7 +736,7 @@ export default class Tabs extends React.PureComponent {
const currentData = this.state.data.filter(({ disabled }) => !disabled)
const currentIndex = currentData.reduce(
(acc, { key }, i) => (key == stateKey ? i : acc),
- -1
+ -1,
)
let nextIndex = currentIndex + useKey
if (nextIndex < 0) {
@@ -747,7 +747,7 @@ export default class Tabs extends React.PureComponent {
}
return currentData.reduce(
(acc, { key }, i) => (i === nextIndex ? key : acc),
- null
+ null,
)
}
@@ -762,13 +762,13 @@ export default class Tabs extends React.PureComponent {
focus_key,
_listenForPropChanges: false,
},
- this.setFocusOnTabButton
+ this.setFocusOnTabButton,
)
dispatchCustomElementEvent(
this,
'on_focus',
- this.getEventArgs({ event, focus_key })
+ this.getEventArgs({ event, focus_key }),
)
this.setWhatInput()
@@ -785,7 +785,7 @@ export default class Tabs extends React.PureComponent {
setFocusOnTabButton = () => {
try {
const elem = this._tablistRef.current.querySelector(
- '.dnb-tabs__button.focus'
+ '.dnb-tabs__button.focus',
)
elem.focus({ preventScroll: true })
@@ -803,7 +803,7 @@ export default class Tabs extends React.PureComponent {
warnAboutMissingContainer() {
warn(
- `Could not find the required that provides role="tabpanel"`
+ `Could not find the required that provides role="tabpanel"`,
)
}
@@ -825,14 +825,14 @@ export default class Tabs extends React.PureComponent {
focus_key: selected_key,
_listenForPropChanges: false,
},
- this.handleVerticalScroll
+ this.handleVerticalScroll,
)
}
dispatchCustomElementEvent(
this,
'on_change',
- this.getEventArgs({ event, selected_key })
+ this.getEventArgs({ event, selected_key }),
)
if (this.props.use_hash && typeof window !== 'undefined') {
@@ -840,7 +840,7 @@ export default class Tabs extends React.PureComponent {
window.history.replaceState(
undefined,
undefined,
- `#${selected_key}`
+ `#${selected_key}`,
)
} catch (e) {
warn('Tabs Error:', e)
@@ -889,7 +889,7 @@ export default class Tabs extends React.PureComponent {
}
return acc
},
- {}
+ {},
)
} else if (isTrue(prevent_rerender)) {
this._cache = {
@@ -907,13 +907,13 @@ export default class Tabs extends React.PureComponent {
aria-hidden={hide ? true : undefined}
className={classnames(
'dnb-tabs__cached',
- hide && 'dnb-tabs__cached--hidden'
+ hide && 'dnb-tabs__cached--hidden',
)}
>
{content}
)
- }
+ },
)
return cachedContent
@@ -988,7 +988,7 @@ export default class Tabs extends React.PureComponent {
'dnb-tabs',
createSpacingClasses(this.props),
className,
- _className
+ _className,
),
}
@@ -1021,7 +1021,7 @@ export default class Tabs extends React.PureComponent {
hasScrollbar && 'dnb-tabs--has-scrollbar',
nav_button_edge && 'dnb-tabs--at-edge',
no_border && 'dnb-tabs__tabs--no-border',
- className
+ className,
)}
ref={this._tabsRef}
{...rest}
@@ -1034,7 +1034,7 @@ export default class Tabs extends React.PureComponent {
(typeof this.state.isFirst !== 'undefined' ||
this.hasLastPosition()) &&
'dnb-tabs__scroll-nav-button--visible',
- this.state.isFirst && 'dnb-tabs__scroll-nav-button--hide'
+ this.state.isFirst && 'dnb-tabs__scroll-nav-button--hide',
)}
/>
@@ -1048,7 +1048,7 @@ export default class Tabs extends React.PureComponent {
(typeof this.state.isLast !== 'undefined' ||
this.hasLastPosition()) &&
'dnb-tabs__scroll-nav-button--visible',
- this.state.isLast && 'dnb-tabs__scroll-nav-button--hide'
+ this.state.isLast && 'dnb-tabs__scroll-nav-button--hide',
)}
/>
@@ -1112,7 +1112,7 @@ Tip: Check out other solutions like Your content, outs
className={classnames(
'dnb-tabs__button__snap',
isFocus && 'focus',
- isSelected && 'selected'
+ isSelected && 'selected',
)}
key={`tab-${key}`}
>
@@ -1124,7 +1124,7 @@ Tip: Check out other solutions like Your content, outs
className={classnames(
'dnb-tabs__button',
isFocus && 'focus',
- isSelected && 'selected'
+ isSelected && 'selected',
)}
onMouseEnter={this.onMouseEnterHandler}
onClick={this.onClickHandler}
@@ -1136,7 +1136,7 @@ Tip: Check out other solutions like Your content, outs
{title}
@@ -1145,7 +1145,7 @@ Tip: Check out other solutions like Your content, outs
)
- }
+ },
)
const params = {}
@@ -1155,7 +1155,7 @@ Tip: Check out other solutions like Your content, outs
if (selected_key) {
params['aria-labelledby'] = combineLabelledBy(
params,
- `${this._id}-tab-${selected_key}`
+ `${this._id}-tab-${selected_key}`,
)
}
return (
@@ -1176,7 +1176,7 @@ Tip: Check out other solutions like Your content, outs
const props = (this._props = extendPropsWithContextInClassComponent(
this.props,
Tabs.defaultProps,
- { skeleton: this.context?.skeleton }
+ { skeleton: this.context?.skeleton },
))
const { render: customRenderer } = props
@@ -1247,7 +1247,7 @@ const ScrollNavButton = (props) => {
{...props}
className={classnames(
'dnb-tabs__scroll-nav-button',
- props.className
+ props.className,
)}
/>
)
diff --git a/packages/dnb-eufemia/src/components/tabs/TabsContentWrapper.js b/packages/dnb-eufemia/src/components/tabs/TabsContentWrapper.js
index 089be3f8ab8..8f3fcc0f1de 100644
--- a/packages/dnb-eufemia/src/components/tabs/TabsContentWrapper.js
+++ b/packages/dnb-eufemia/src/components/tabs/TabsContentWrapper.js
@@ -79,7 +79,7 @@ export default class ContentWrapper extends React.PureComponent {
if (key) {
params['aria-labelledby'] = combineLabelledBy(
params,
- `${id}-tab-${key}`
+ `${id}-tab-${key}`,
)
}
@@ -107,7 +107,7 @@ export default class ContentWrapper extends React.PureComponent {
isTrue(content_spacing) ? 'large' : content_spacing
}`
: null,
- createSpacingClasses(rest)
+ createSpacingClasses(rest),
)}
{...params}
>
diff --git a/packages/dnb-eufemia/src/components/tabs/TabsCustomContent.js b/packages/dnb-eufemia/src/components/tabs/TabsCustomContent.js
index 208264726bd..02a188d2b5f 100644
--- a/packages/dnb-eufemia/src/components/tabs/TabsCustomContent.js
+++ b/packages/dnb-eufemia/src/components/tabs/TabsCustomContent.js
@@ -65,7 +65,7 @@ export default class CustomContent extends React.PureComponent {
'dnb-tabs__content__inner',
createSpacingClasses(rest),
className,
- _className
+ _className,
)}
>
{this.props.children}
diff --git a/packages/dnb-eufemia/src/components/tabs/__tests__/Tabs.test.tsx b/packages/dnb-eufemia/src/components/tabs/__tests__/Tabs.test.tsx
index 662e8fa329c..e60f01e5241 100644
--- a/packages/dnb-eufemia/src/components/tabs/__tests__/Tabs.test.tsx
+++ b/packages/dnb-eufemia/src/components/tabs/__tests__/Tabs.test.tsx
@@ -37,14 +37,14 @@ describe('Tabs component', () => {
selected_key={startup_selected_key}
>
{contentWrapperData}
-
+ ,
)
expect(
document
.querySelector('.dnb-tabs__button.selected')
- .querySelectorAll('span')[0].textContent
+ .querySelectorAll('span')[0].textContent,
).toBe(
- tablistData.find(({ key }) => key === startup_selected_key).title
+ tablistData.find(({ key }) => key === startup_selected_key).title,
)
})
@@ -71,7 +71,7 @@ describe('Tabs component', () => {
on_click={on_click}
>
{contentWrapperData}
-
+ ,
)
fireEvent.click(document.querySelectorAll('.dnb-tabs__button')[1])
@@ -95,7 +95,7 @@ describe('Tabs component', () => {
render(
{contentWrapperData}
-
+ ,
)
fireEvent.keyDown(document.querySelector('.dnb-tabs__tabs__tablist'), {
@@ -123,15 +123,15 @@ describe('Tabs component', () => {
render(
{contentWrapperData}
-
+ ,
)
expect(
document
.querySelector('.dnb-tabs__tabs__tablist')
- .querySelectorAll('a')[1].outerHTML
+ .querySelectorAll('a')[1].outerHTML,
).toMatchInlineSnapshot(
- `" "`
+ `" "`,
)
})
@@ -139,7 +139,7 @@ describe('Tabs component', () => {
render(
{contentWrapperData}
-
+ ,
)
const element = document.querySelector('.dnb-tabs__tabs')
@@ -154,7 +154,7 @@ describe('Tabs component', () => {
render(
{contentWrapperData}
-
+ ,
)
const element = document.querySelector('.dnb-tabs__tabs')
@@ -170,7 +170,7 @@ describe('Tabs component', () => {
render(
{contentWrapperData}
-
+ ,
)
const element = document.querySelector('.dnb-tabs__content')
@@ -180,7 +180,7 @@ describe('Tabs component', () => {
'dnb-tabs__content',
'dnb-height-animation--is-in-dom',
'dnb-height-animation--show-overflow',
- ])
+ ]),
)
})
@@ -188,7 +188,7 @@ describe('Tabs component', () => {
render(
{contentWrapperData}
-
+ ,
)
const element = document.querySelector('.dnb-tabs__tabs')
@@ -204,7 +204,7 @@ describe('Tabs component', () => {
render(
{contentWrapperData}
-
+ ,
)
const element = document.querySelector('.dnb-tabs')
@@ -219,7 +219,7 @@ describe('Tabs component', () => {
render(
{contentWrapperData}
-
+ ,
)
const element = document.querySelector('.dnb-tabs__tabs')
@@ -231,7 +231,7 @@ describe('Tabs component', () => {
'dnb-tabs__tabs--left',
'dnb-section',
'dnb-section--black-3',
- ])
+ ]),
)
})
@@ -239,7 +239,7 @@ describe('Tabs component', () => {
render(
{contentWrapperData}
-
+ ,
)
const element = document.querySelector('.dnb-tabs__content')
@@ -257,7 +257,7 @@ describe('Tabs component', () => {
'dnb-height-animation--is-in-dom',
'dnb-height-animation--parallax',
'dnb-height-animation--show-overflow',
- ])
+ ]),
)
})
})
@@ -271,14 +271,14 @@ describe('TabList component', () => {
selected_key={startup_selected_key}
>
{contentWrapperData}
-
+ ,
)
expect(
- document.querySelectorAll('.dnb-tabs__button__snap').length
+ document.querySelectorAll('.dnb-tabs__button__snap').length,
).toBe(tablistData.length)
expect(document.querySelectorAll('div[role="tabpanel"]').length).toBe(
- 1
+ 1,
)
})
@@ -290,13 +290,13 @@ describe('TabList component', () => {
selected_key={startup_selected_key}
>
{contentWrapperData}
-
+ ,
)
fireEvent.click(document.querySelector('button[data-tab-key="third"]'))
expect(
- document.querySelector('button[data-tab-key="third"]').classList
+ document.querySelector('button[data-tab-key="third"]').classList,
).toContain('selected')
const content = document.querySelector('div[role="tabpanel"]')
@@ -314,16 +314,16 @@ describe('A single Tab component', () => {
selected_key={startup_selected_key}
>
{contentWrapperData}
-
+ ,
)
expect(
document
.querySelector('button[data-tab-key="second"]')
- .getAttribute('role')
+ .getAttribute('role'),
).toBe('tab')
expect(
- document.querySelector('button[data-tab-key="second"]').classList
+ document.querySelector('button[data-tab-key="second"]').classList,
).toContain('selected')
})
@@ -335,12 +335,12 @@ describe('A single Tab component', () => {
selected_key={startup_selected_key}
>
{contentWrapperData}
-
+ ,
)
// reset the state
fireEvent.click(
- document.querySelector('button[data-tab-key="second"]')
+ document.querySelector('button[data-tab-key="second"]'),
)
fireEvent.keyDown(document.querySelector('div[role="tablist"]'), {
@@ -359,17 +359,17 @@ describe('A single Tab component', () => {
expect(
document
.querySelectorAll('.dnb-tabs__button__snap')[0]
- .querySelector('button').classList
+ .querySelector('button').classList,
).toContain('selected')
expect(
- document.querySelector('div.dnb-tabs__content').textContent
+ document.querySelector('div.dnb-tabs__content').textContent,
).toBe('First')
// then click on tab two
// also test the ability of having a integer only as the key
fireEvent.click(document.querySelector('button[data-tab-key="2"]'))
expect(
- document.querySelector('div.dnb-tabs__content').textContent
+ document.querySelector('div.dnb-tabs__content').textContent,
).toBe('Second')
})
@@ -388,11 +388,11 @@ describe('A single Tab component', () => {
},
{ title: 'Two', key: 'two', content: 'Content two' },
]}
- />
+ />,
)
expect(
- document.querySelector('div.dnb-tabs__cached')
+ document.querySelector('div.dnb-tabs__cached'),
).toBeInTheDocument()
// also check a real live rerender scenario
@@ -408,7 +408,7 @@ describe('A single Tab component', () => {
expect(
document
.querySelectorAll('div.dnb-tabs__cached')[0]
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('true')
// and on tab one again
@@ -417,18 +417,18 @@ describe('A single Tab component', () => {
// the entered value should still be the same
expect(
(document.querySelector('.dnb-input__input') as HTMLInputElement)
- .value
+ .value,
).toBe(value)
expect(
document
.querySelectorAll('div.dnb-tabs__cached')[0]
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).not.toBe('true')
expect(
document
.querySelectorAll('div.dnb-tabs__cached')[1]
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('true')
})
@@ -445,27 +445,27 @@ describe('A single Tab component', () => {
},
{ title: 'Two', key: 2, content: 'Content two' },
]}
- />
+ />,
)
expect(
- document.querySelector('div.dnb-tabs__cached')
+ document.querySelector('div.dnb-tabs__cached'),
).toBeInTheDocument()
expect(
- document.querySelectorAll('div.dnb-tabs__cached')[0]
+ document.querySelectorAll('div.dnb-tabs__cached')[0],
).not.toHaveAttribute('aria-hidden')
expect(
document
.querySelectorAll('div.dnb-tabs__cached')[1]
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('true')
expect(
- document.querySelectorAll('div.dnb-tabs__cached')[0].textContent
+ document.querySelectorAll('div.dnb-tabs__cached')[0].textContent,
).toBe('Content one')
expect(
- document.querySelectorAll('div.dnb-tabs__cached')[1].textContent
+ document.querySelectorAll('div.dnb-tabs__cached')[1].textContent,
).toBe('Content two')
})
@@ -476,25 +476,25 @@ describe('A single Tab component', () => {
second
-
+ ,
)
expect(
document
.querySelector('button.selected')
- .getAttribute('data-tab-key')
+ .getAttribute('data-tab-key'),
).toBe('second-title')
expect(
document
.querySelectorAll('.dnb-tabs__button__snap button')[1]
- .getAttribute('data-tab-key')
+ .getAttribute('data-tab-key'),
).toBe('second-title')
expect(
- document.querySelector('div.dnb-tabs__content').textContent
+ document.querySelector('div.dnb-tabs__content').textContent,
).toBe('second')
expect(
document.querySelector(
- 'button[aria-selected=true] span.dnb-tabs__button__title'
- ).textContent
+ 'button[aria-selected=true] span.dnb-tabs__button__title',
+ ).textContent,
).toBe('second title')
})
@@ -522,7 +522,7 @@ describe('A single Tab component', () => {
expect(
document
.querySelector('button.selected')
- .getAttribute('data-tab-key')
+ .getAttribute('data-tab-key'),
).toBe('first')
expect(testKey).toBe('first')
expect(testTitle).toBe('First')
@@ -532,7 +532,7 @@ describe('A single Tab component', () => {
expect(
document
.querySelector('button.selected')
- .getAttribute('data-tab-key')
+ .getAttribute('data-tab-key'),
).toBe('second')
expect(testKey).toBe('second')
@@ -541,7 +541,7 @@ describe('A single Tab component', () => {
expect(
document
.querySelector('button.selected')
- .getAttribute('data-tab-key')
+ .getAttribute('data-tab-key'),
).toBe('third')
expect(testKey).toBe('third')
})
@@ -552,15 +552,15 @@ describe('A single Tab component', () => {
single
-
+ ,
)
expect(
- document.querySelector('div.dnb-tabs__content__inner').textContent
+ document.querySelector('div.dnb-tabs__content__inner').textContent,
).toBe('single')
expect(
document.querySelector('button span.dnb-tabs__button__title')
- .textContent
+ .textContent,
).toBe('single title')
})
@@ -570,15 +570,15 @@ describe('A single Tab component', () => {
data={[
{ title: 'single title', key: 1, content: single },
]}
- />
+ />,
)
expect(
- document.querySelector('div.dnb-tabs__content').textContent
+ document.querySelector('div.dnb-tabs__content').textContent,
).toBe('single')
expect(
document.querySelector('button span.dnb-tabs__button__title')
- .textContent
+ .textContent,
).toBe('single title')
})
@@ -605,7 +605,7 @@ describe('A single Tab component', () => {
},
]}
/>
-
+ ,
)
expect(document.querySelector('.dnb-tabs')).toBeInTheDocument()
@@ -620,7 +620,7 @@ describe('Tabs scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-tabs-theme-ui.scss')
+ require.resolve('../style/themes/dnb-tabs-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
@@ -635,7 +635,7 @@ describe('Tabs ARIA', () => {
selected_key={startup_selected_key}
>
{contentWrapperData}
-
+ ,
)
expect(await axeComponent(Comp)).toHaveNoViolations()
})
diff --git a/packages/dnb-eufemia/src/components/tag/Tag.tsx b/packages/dnb-eufemia/src/components/tag/Tag.tsx
index 65f8d9153ac..a295d53f3ee 100644
--- a/packages/dnb-eufemia/src/components/tag/Tag.tsx
+++ b/packages/dnb-eufemia/src/components/tag/Tag.tsx
@@ -98,7 +98,7 @@ const Tag = (localProps: TagProps & SpacingProps) => {
defaultProps,
context?.translation?.Tag,
context?.Tag,
- tagGroupContext
+ tagGroupContext,
)
const {
@@ -124,7 +124,7 @@ const Tag = (localProps: TagProps & SpacingProps) => {
className,
spacingClasses,
isInteractive && 'dnb-tag--interactive',
- isRemovable && 'dnb-tag--removable'
+ isRemovable && 'dnb-tag--removable',
)
const buttonAttr: typeof props & Pick =
props
@@ -152,7 +152,7 @@ const Tag = (localProps: TagProps & SpacingProps) => {
if (!tagGroupContext && !hasLabel) {
warn(
- `Tag group required: A Tag requires a Tag.Group with label description as a parent component. This is to ensure correct semantic and accessibility.`
+ `Tag group required: A Tag requires a Tag.Group with label description as a parent component. This is to ensure correct semantic and accessibility.`,
)
}
diff --git a/packages/dnb-eufemia/src/components/tag/__tests__/Tag.test.tsx b/packages/dnb-eufemia/src/components/tag/__tests__/Tag.test.tsx
index d818ee4cf88..4988e4ebad1 100644
--- a/packages/dnb-eufemia/src/components/tag/__tests__/Tag.test.tsx
+++ b/packages/dnb-eufemia/src/components/tag/__tests__/Tag.test.tsx
@@ -43,7 +43,7 @@ describe('Tag Group', () => {
-
+ ,
)
expect(document.querySelectorAll('.dnb-tag')).toHaveLength(4)
@@ -55,10 +55,10 @@ describe('Tag Group', () => {
render(
ClassName
-
+ ,
)
expect(document.getElementsByClassName(customClassName)).toHaveLength(
- 1
+ 1,
)
})
@@ -68,11 +68,11 @@ describe('Tag Group', () => {
render(
skeleton
-
+ ,
)
expect(
- document.getElementsByClassName(skeletonClassName)
+ document.getElementsByClassName(skeletonClassName),
).toHaveLength(1)
})
@@ -80,12 +80,12 @@ describe('Tag Group', () => {
render(
Tag
-
+ ,
)
const element = document.querySelector('.dnb-tag__group')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -103,7 +103,7 @@ describe('Tag', () => {
render(
-
+ ,
)
expect(document.querySelector('.dnb-tag')).toBeInTheDocument()
})
@@ -112,7 +112,7 @@ describe('Tag', () => {
render(
-
+ ,
)
expect(document.querySelector('.dnb-tag')).toBeInTheDocument()
@@ -124,7 +124,7 @@ describe('Tag', () => {
render(
-
+ ,
)
expect(screen.queryByText(text)).toBeInTheDocument()
@@ -136,7 +136,7 @@ describe('Tag', () => {
render(
{text}
-
+ ,
)
expect(screen.queryByText(text)).toBeInTheDocument()
@@ -148,7 +148,7 @@ describe('Tag', () => {
render(
{text}
-
+ ,
)
expect(screen.queryByText(text)).toBeInTheDocument()
@@ -160,11 +160,11 @@ describe('Tag', () => {
render(
skeleton
-
+ ,
)
expect(
- document.getElementsByClassName(skeletonClassName)
+ document.getElementsByClassName(skeletonClassName),
).toHaveLength(1)
})
@@ -176,11 +176,11 @@ describe('Tag', () => {
skeleton
-
+ ,
)
expect(
- document.getElementsByClassName(skeletonClassName)
+ document.getElementsByClassName(skeletonClassName),
).toHaveLength(1)
})
@@ -190,7 +190,7 @@ describe('Tag', () => {
render(
-
+ ,
)
expect(screen.queryByRole('button')).not.toBeInTheDocument()
@@ -201,7 +201,7 @@ describe('Tag', () => {
render(
-
+ ,
)
expect(document.querySelector('.dnb-icon')).toBeInTheDocument()
@@ -211,12 +211,12 @@ describe('Tag', () => {
render(
Tag
-
+ ,
)
const element = document.querySelector('.dnb-tag')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -243,11 +243,11 @@ describe('Tag', () => {
>
Clickable
-
+ ,
)
expect(
- document.getElementsByClassName(clickableClassName)
+ document.getElementsByClassName(clickableClassName),
).toHaveLength(1)
expect(screen.queryByRole('button')).toBeInTheDocument()
})
@@ -257,7 +257,7 @@ describe('Tag', () => {
render(
onClick
-
+ ,
)
fireEvent.click(screen.getByRole('button'))
@@ -268,7 +268,7 @@ describe('Tag', () => {
render(
-
+ ,
)
expect(document.querySelector('.dnb-icon')).toBeInTheDocument()
@@ -289,14 +289,14 @@ describe('Tag', () => {
>
Removable
-
+ ,
)
expect(
- document.getElementsByClassName(removableClassName)
+ document.getElementsByClassName(removableClassName),
).toHaveLength(1)
expect(
- document.getElementsByClassName(clickableClassName)
+ document.getElementsByClassName(clickableClassName),
).toHaveLength(1)
expect(screen.queryByRole('button')).toBeInTheDocument()
})
@@ -306,7 +306,7 @@ describe('Tag', () => {
render(
onDelete
-
+ ,
)
fireEvent.click(screen.getByRole('button'))
@@ -317,21 +317,21 @@ describe('Tag', () => {
const { container, rerender } = render(
Tag
-
+ ,
)
expect(
- container.querySelectorAll('.dnb-space__top--small').length
+ container.querySelectorAll('.dnb-space__top--small').length,
).toBe(1)
rerender(
Tag
-
+ ,
)
expect(
- container.querySelectorAll('.dnb-space__top--small').length
+ container.querySelectorAll('.dnb-space__top--small').length,
).toBe(2)
})
@@ -339,7 +339,7 @@ describe('Tag', () => {
render(
-
+ ,
)
expect(document.querySelector('.dnb-icon')).toBeInTheDocument()
@@ -349,7 +349,7 @@ describe('Tag', () => {
render(
-
+ ,
)
expect(document.querySelector('.dnb-icon')).toBeInTheDocument()
@@ -360,7 +360,7 @@ describe('Tag', () => {
render(
-
+ ,
)
expect(screen.getByTitle(nb.removeIconTitle)).toBeInTheDocument()
@@ -375,7 +375,7 @@ describe('Tag', () => {
onClick
-
+ ,
)
fireEvent.click(screen.getByRole('button'))
@@ -389,7 +389,7 @@ describe('Tag', () => {
render(
Keyboard
-
+ ,
)
fireEvent.keyUp(screen.getByRole('button'), {
@@ -426,10 +426,10 @@ describe('Tag', () => {
render(
ClassName
-
+ ,
)
expect(document.getElementsByClassName(customClassName)).toHaveLength(
- 1
+ 1,
)
})
@@ -439,7 +439,7 @@ describe('Tag', () => {
-
+ ,
)
expect(document.querySelector('.dnb-button__text')).toBeInTheDocument()
@@ -451,7 +451,7 @@ describe('Tag aria', () => {
const Component = render(
-
+ ,
)
expect(await axeComponent(Component)).toHaveNoViolations()
})
diff --git a/packages/dnb-eufemia/src/components/textarea/Textarea.js b/packages/dnb-eufemia/src/components/textarea/Textarea.js
index c425f22f04e..3c381d93316 100644
--- a/packages/dnb-eufemia/src/components/textarea/Textarea.js
+++ b/packages/dnb-eufemia/src/components/textarea/Textarea.js
@@ -340,7 +340,7 @@ export default class Textarea extends React.PureComponent {
{ skeleton: this.context?.skeleton },
this.context.getTranslation(this.props).Textarea,
includeValidProps(this.context.FormRow),
- this.context.Textarea
+ this.context.Textarea,
)
const {
@@ -411,7 +411,7 @@ export default class Textarea extends React.PureComponent {
textareaParams['aria-describedby'] = combineDescribedBy(
textareaParams,
showStatus ? id + '-status' : null,
- suffix ? id + '-suffix' : null
+ suffix ? id + '-suffix' : null,
)
}
if (readOnly) {
@@ -432,14 +432,14 @@ export default class Textarea extends React.PureComponent {
createSkeletonClass(null, skeleton),
createSpacingClasses(props),
_className,
- className
+ className,
),
}
const innerParams = {
className: classnames(
'dnb-textarea__inner',
- createSkeletonClass('shape', skeleton, this.context)
+ createSkeletonClass('shape', skeleton, this.context),
),
}
@@ -514,7 +514,7 @@ export default class Textarea extends React.PureComponent {
aria-hidden
className={classnames(
'dnb-textarea__placeholder',
- align ? `dnb-textarea__align--${align}` : null
+ align ? `dnb-textarea__align--${align}` : null,
)}
style={placeholderStyle}
>
diff --git a/packages/dnb-eufemia/src/components/textarea/__tests__/Textarea.test.tsx b/packages/dnb-eufemia/src/components/textarea/__tests__/Textarea.test.tsx
index 5d9b4f6e087..801559d99a4 100644
--- a/packages/dnb-eufemia/src/components/textarea/__tests__/Textarea.test.tsx
+++ b/packages/dnb-eufemia/src/components/textarea/__tests__/Textarea.test.tsx
@@ -23,12 +23,12 @@ describe('Textarea component', () => {
render(
+ ,
)
fireEvent.focus(document.querySelector('textarea'))
expect(document.querySelector('.dnb-textarea').classList).toContain(
- 'dnb-textarea--focus'
+ 'dnb-textarea--focus',
)
})
@@ -36,10 +36,10 @@ describe('Textarea component', () => {
render(
+ ,
)
expect(
- document.querySelector('.dnb-textarea').classList
+ document.querySelector('.dnb-textarea').classList,
).not.toContain('dnb-textarea--has-content')
const value = 'new value'
@@ -49,7 +49,7 @@ describe('Textarea component', () => {
})
expect(document.querySelector('.dnb-textarea').classList).toContain(
- 'dnb-textarea--has-content'
+ 'dnb-textarea--has-content',
)
expect(document.querySelector('textarea').value).toBe(value)
})
@@ -59,7 +59,7 @@ describe('Textarea component', () => {
const { rerender } = render(
+ ,
)
const initValue = 'new prop value'
const emptyValue = null
@@ -67,14 +67,14 @@ describe('Textarea component', () => {
rerender(
+ ,
)
expect(document.querySelector('textarea').value).toBe(initValue)
rerender(
+ ,
)
expect(document.querySelector('textarea').value).toBe('')
})
@@ -92,7 +92,7 @@ describe('Textarea component', () => {
value={initValue}
on_change={on_change}
on_key_down={on_key_down} // additional native event test
- />
+ />,
)
expect(document.querySelector('textarea').value).toBe(initValue)
@@ -100,7 +100,7 @@ describe('Textarea component', () => {
await waitFor(() => {
expect(on_change.mock.calls.length).toBe(9)
expect(document.querySelector('textarea').value).toBe(
- initValue + newValue
+ initValue + newValue,
)
})
@@ -136,7 +136,7 @@ describe('Textarea component', () => {
rerender()
expect(document.querySelector('textarea').value).toBe(
- String(zeroValue)
+ String(zeroValue),
)
})
@@ -148,7 +148,7 @@ describe('Textarea component', () => {
it('has correct size attribute (chars length) on textarea by using textarea_attributes', () => {
render()
expect(document.querySelector('textarea').getAttribute('size')).toBe(
- '2'
+ '2',
)
})
@@ -156,13 +156,13 @@ describe('Textarea component', () => {
const { rerender } = render(
+ ,
)
const value = 'new value'
rerender(
+ ,
)
expect(document.querySelector('textarea').value).toBe(value)
})
@@ -175,7 +175,7 @@ describe('Textarea component', () => {
it('has to to have a status value as defined in the prop', () => {
render()
expect(
- document.querySelector('.dnb-form-status__text').textContent
+ document.querySelector('.dnb-form-status__text').textContent,
).toBe('status')
})
@@ -238,12 +238,12 @@ describe('Textarea component', () => {
render(
-
+ ,
)
const element = document.querySelector('.dnb-textarea')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -260,7 +260,7 @@ describe('Textarea component', () => {
<>
- >
+ >,
)
expect(await axeComponent(Comp)).toHaveNoViolations()
@@ -275,7 +275,7 @@ describe('Textarea scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-textarea-theme-ui.scss')
+ require.resolve('../style/themes/dnb-textarea-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/timeline/Timeline.tsx b/packages/dnb-eufemia/src/components/timeline/Timeline.tsx
index 4a9c85014b9..b2f987f1720 100644
--- a/packages/dnb-eufemia/src/components/timeline/Timeline.tsx
+++ b/packages/dnb-eufemia/src/components/timeline/Timeline.tsx
@@ -60,7 +60,7 @@ const Timeline = (localProps: TimelineAllProps) => {
context?.Timeline,
{
skeleton: context?.skeleton,
- }
+ },
)
const {
className,
@@ -91,7 +91,7 @@ const Timeline = (localProps: TimelineAllProps) => {
'dnb-timeline',
'dnb-space__reset',
spacingClasses,
- className
+ className,
)}
{...props}
>
diff --git a/packages/dnb-eufemia/src/components/timeline/TimelineItem.tsx b/packages/dnb-eufemia/src/components/timeline/TimelineItem.tsx
index 5d20f9144a1..34f81d2f538 100644
--- a/packages/dnb-eufemia/src/components/timeline/TimelineItem.tsx
+++ b/packages/dnb-eufemia/src/components/timeline/TimelineItem.tsx
@@ -82,7 +82,7 @@ const TimelineItem = (localProps: TimelineItemAllProps) => {
localProps,
defaultProps,
context?.TimelineItem,
- { skeleton: context?.skeleton }
+ { skeleton: context?.skeleton },
)
const {
@@ -100,7 +100,7 @@ const TimelineItem = (localProps: TimelineItemAllProps) => {
const classes = classnames(
'dnb-timeline__item',
skeletonClasses,
- `dnb-timeline__item--${state}`
+ `dnb-timeline__item--${state}`,
)
return (
diff --git a/packages/dnb-eufemia/src/components/timeline/__tests__/Timeline.test.tsx b/packages/dnb-eufemia/src/components/timeline/__tests__/Timeline.test.tsx
index 2d392de48b8..621a65c6c1c 100644
--- a/packages/dnb-eufemia/src/components/timeline/__tests__/Timeline.test.tsx
+++ b/packages/dnb-eufemia/src/components/timeline/__tests__/Timeline.test.tsx
@@ -38,11 +38,11 @@ describe('Timeline', () => {
{ title: 'Current', state: 'current' },
{ title: 'Completed', state: 'completed' },
]}
- />
+ />,
)
expect(document.querySelectorAll('.dnb-timeline__item')).toHaveLength(
- 3
+ 3,
)
})
@@ -52,11 +52,11 @@ describe('Timeline', () => {
-
+ ,
)
expect(document.querySelectorAll('.dnb-timeline__item')).toHaveLength(
- 3
+ 3,
)
})
@@ -71,12 +71,12 @@ describe('Timeline', () => {
{ title: 'Completed', state: 'completed' },
{ title: 'Current', state: 'current' },
]}
- />
+ />,
)
const currentItem = screen.getByText('Current')
expect(
- currentItem.parentElement.parentElement.getAttribute('aria-current')
+ currentItem.parentElement.parentElement.getAttribute('aria-current'),
).toBe('step')
})
@@ -91,7 +91,7 @@ describe('Timeline', () => {
{ title: 'Completed', state: 'completed' },
{ title: 'Current', state: 'current' },
]}
- />
+ />,
)
const element = document.querySelector('.dnb-timeline')
@@ -116,11 +116,11 @@ describe('Timeline', () => {
},
]}
/>
-
+ ,
)
expect(
- document.getElementsByClassName(skeletonClassName)
+ document.getElementsByClassName(skeletonClassName),
).toHaveLength(1)
})
@@ -134,12 +134,12 @@ describe('Timeline', () => {
state: 'upcoming',
},
]}
- />
+ />,
)
const element = document.querySelector('.dnb-timeline')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -162,7 +162,7 @@ describe('Timeline', () => {
{ title: 'Completed', state: 'completed' },
{ title: 'Current', state: 'current' },
]}
- />
+ />,
)
const element = document.querySelector('.dnb-timeline')
@@ -180,7 +180,7 @@ describe('Timeline', () => {
render( )
expect(
- document.querySelector('.dnb-timeline__item')
+ document.querySelector('.dnb-timeline__item'),
).toBeInTheDocument()
})
@@ -197,7 +197,7 @@ describe('Timeline', () => {
subtitle={subtitle}
title="Complete"
state="completed"
- />
+ />,
)
expect(screen.queryByText(subtitle)).toBeInTheDocument()
})
@@ -209,7 +209,7 @@ describe('Timeline', () => {
subtitle={subtitles}
title="Complete"
state="completed"
- />
+ />,
)
expect(screen.queryByText(subtitles[0])).toBeInTheDocument()
@@ -223,7 +223,7 @@ describe('Timeline', () => {
infoMessage={infoMessage}
title="Complete"
state="completed"
- />
+ />,
)
expect(screen.queryByText(infoMessage)).toBeInTheDocument()
})
@@ -235,7 +235,7 @@ describe('Timeline', () => {
icon={CustomIcon}
title="Complete"
state="completed"
- />
+ />,
)
const element = screen.queryByTestId('bell icon')
@@ -249,7 +249,7 @@ describe('Timeline', () => {
title="Complete"
state="completed"
iconAlt={iconAlt}
- />
+ />,
)
expect(screen.queryByRole('img').getAttribute('alt')).toBe(iconAlt)
@@ -261,7 +261,7 @@ describe('Timeline', () => {
render( )
expect(
- document.getElementsByClassName(skeletonClassName)
+ document.getElementsByClassName(skeletonClassName),
).toHaveLength(1)
})
@@ -271,11 +271,11 @@ describe('Timeline', () => {
render(
-
+ ,
)
expect(
- document.getElementsByClassName(skeletonClassName)
+ document.getElementsByClassName(skeletonClassName),
).toHaveLength(1)
})
@@ -337,42 +337,42 @@ describe('Timeline', () => {
it('renders check icon when state is completed', () => {
render( )
expect(screen.queryByRole('img').getAttribute('aria-label')).toBe(
- 'check icon'
+ 'check icon',
)
})
it('renders pin icon when state is current', () => {
render( )
expect(screen.queryByRole('img').getAttribute('aria-label')).toBe(
- 'pin icon'
+ 'pin icon',
)
})
it('renders calendar icon when state is upcoming', () => {
render( )
expect(screen.queryByRole('img').getAttribute('aria-label')).toBe(
- 'calendar icon'
+ 'calendar icon',
)
})
it('renders alt label "UtfĆør"t when state is completed', () => {
render( )
expect(screen.queryByRole('img').getAttribute('alt')).toBe(
- 'UtfĆørt'
+ 'UtfĆørt',
)
})
it('renders alt label "NƄvƦrende" when state is current', () => {
render( )
expect(screen.queryByRole('img').getAttribute('alt')).toBe(
- 'NƄvƦrende'
+ 'NƄvƦrende',
)
})
it('renders alt label "Kommende" when state is upcoming', () => {
render( )
expect(screen.queryByRole('img').getAttribute('alt')).toBe(
- 'Kommende'
+ 'Kommende',
)
})
})
@@ -403,7 +403,7 @@ describe('Timeline aria', () => {
infoMessage: 'Info message',
},
]}
- />
+ />,
)
expect(await axeComponent(Component)).toHaveNoViolations()
})
@@ -417,7 +417,7 @@ describe('Timeline scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-timeline-theme-ui.scss')
+ require.resolve('../style/themes/dnb-timeline-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/timeline/__tests__/__snapshots__/Timeline.test.tsx.snap b/packages/dnb-eufemia/src/components/timeline/__tests__/__snapshots__/Timeline.test.tsx.snap
index d5d29718a1c..fabf5e4d60e 100644
--- a/packages/dnb-eufemia/src/components/timeline/__tests__/__snapshots__/Timeline.test.tsx.snap
+++ b/packages/dnb-eufemia/src/components/timeline/__tests__/__snapshots__/Timeline.test.tsx.snap
@@ -77,8 +77,9 @@ exports[`Timeline scss have to match default theme snapshot 1`] = `
);
--timeline-icon-width-diff: calc(
(
- var(--timeline-icon-width--medium) -
- var(--timeline-icon-width--small)
+ var(--timeline-icon-width--medium) - var(
+ --timeline-icon-width--small
+ )
) / 2
);
--timeline-border-spacing: var(--spacing-small);
diff --git a/packages/dnb-eufemia/src/components/timeline/style/themes/dnb-timeline-theme-ui.scss b/packages/dnb-eufemia/src/components/timeline/style/themes/dnb-timeline-theme-ui.scss
index 651d8cebf97..b7e2356b7c3 100644
--- a/packages/dnb-eufemia/src/components/timeline/style/themes/dnb-timeline-theme-ui.scss
+++ b/packages/dnb-eufemia/src/components/timeline/style/themes/dnb-timeline-theme-ui.scss
@@ -27,8 +27,9 @@
);
--timeline-icon-width-diff: calc(
(
- var(--timeline-icon-width--medium) -
- var(--timeline-icon-width--small)
+ var(--timeline-icon-width--medium) - var(
+ --timeline-icon-width--small
+ )
) / 2
);
--timeline-border-spacing: var(--spacing-small);
diff --git a/packages/dnb-eufemia/src/components/toggle-button/ToggleButton.js b/packages/dnb-eufemia/src/components/toggle-button/ToggleButton.js
index d4fbaea29f1..e5d6d978279 100644
--- a/packages/dnb-eufemia/src/components/toggle-button/ToggleButton.js
+++ b/packages/dnb-eufemia/src/components/toggle-button/ToggleButton.js
@@ -277,7 +277,7 @@ export default class ToggleButton extends React.PureComponent {
const contextProps = extendPropsWithContextInClassComponent(
this.props,
ToggleButton.defaultProps,
- this.context
+ this.context,
)
// use only the props from context, who are available here anyway
@@ -287,7 +287,7 @@ export default class ToggleButton extends React.PureComponent {
contextProps,
context.translation.ToggleButton,
includeValidProps(context.FormRow),
- context.ToggleButton
+ context.ToggleButton,
)
const {
@@ -361,7 +361,7 @@ export default class ToggleButton extends React.PureComponent {
label_direction && `dnb-toggle-button--${label_direction}`,
createSpacingClasses(props),
className,
- _className
+ _className,
),
}
@@ -406,7 +406,7 @@ export default class ToggleButton extends React.PureComponent {
buttonParams['aria-describedby'] = combineDescribedBy(
buttonParams,
showStatus ? id + '-status' : null,
- suffix ? id + '-suffix' : null
+ suffix ? id + '-suffix' : null,
)
}
if (readOnly) {
diff --git a/packages/dnb-eufemia/src/components/toggle-button/ToggleButtonGroup.js b/packages/dnb-eufemia/src/components/toggle-button/ToggleButtonGroup.js
index 3a62a377e64..ee87ec73962 100644
--- a/packages/dnb-eufemia/src/components/toggle-button/ToggleButtonGroup.js
+++ b/packages/dnb-eufemia/src/components/toggle-button/ToggleButtonGroup.js
@@ -195,7 +195,7 @@ export default class ToggleButtonGroup extends React.PureComponent {
ToggleButtonGroup.defaultProps,
this.context.getTranslation(this.props).ToggleButton,
includeValidProps(this.context.FormRow),
- this.context.ToggleButtonGroup
+ this.context.ToggleButtonGroup,
)
const {
@@ -248,7 +248,7 @@ export default class ToggleButtonGroup extends React.PureComponent {
'dnb-form-component',
createSpacingClasses(props),
className,
- _className
+ _className,
)
const params = {
@@ -259,7 +259,7 @@ export default class ToggleButtonGroup extends React.PureComponent {
params['aria-describedby'] = combineDescribedBy(
params,
showStatus ? id + '-status' : null,
- suffix ? id + '-suffix' : null
+ suffix ? id + '-suffix' : null,
)
}
if (label) {
diff --git a/packages/dnb-eufemia/src/components/toggle-button/__tests__/ToggleButton.test.tsx b/packages/dnb-eufemia/src/components/toggle-button/__tests__/ToggleButton.test.tsx
index 17dc1400091..83a4c595fc4 100644
--- a/packages/dnb-eufemia/src/components/toggle-button/__tests__/ToggleButton.test.tsx
+++ b/packages/dnb-eufemia/src/components/toggle-button/__tests__/ToggleButton.test.tsx
@@ -23,21 +23,21 @@ describe('ToggleButton component', () => {
expect(
document
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('false')
fireEvent.click(document.querySelector('button')) // we could send inn the event data structure like this: , { target: { checked: true } }
expect(
document
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('true')
fireEvent.click(document.querySelector('button'))
expect(
document
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('false')
// also check if getDerivedStateFromProps sets the state as expected
@@ -45,48 +45,48 @@ describe('ToggleButton component', () => {
expect(
document
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('true')
})
it('has correct variant', () => {
const { rerender } = render(
-
+ ,
)
// default checked value has to be false
expect(
document
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('false')
fireEvent.click(document.querySelector('button')) // we could send inn the event data structure like this: , { target: { checked: true } }
expect(
document
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('true')
expect(
- document.querySelector('.dnb-checkbox__button')
+ document.querySelector('.dnb-checkbox__button'),
).toBeInTheDocument()
rerender( )
expect(
- document.querySelector('.dnb-radio__button')
+ document.querySelector('.dnb-radio__button'),
).toBeInTheDocument()
expect(
document
.querySelector('.dnb-radio__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('true')
fireEvent.click(document.querySelector('button')) // we could send inn the event data structure like this: , { target: { checked: true } }
expect(
document
.querySelector('.dnb-radio__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('false')
})
@@ -98,7 +98,7 @@ describe('ToggleButton component', () => {
on_change={my_event}
onChange={myEvent}
checked={false}
- />
+ />,
)
// first click
@@ -146,27 +146,27 @@ describe('ToggleButton component', () => {
expect(
document
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('true')
expect(
document
.querySelector('button.dnb-toggle-button__button')
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
// change it to false
fireEvent.click(
- document.querySelector('button.dnb-toggle-button__button')
+ document.querySelector('button.dnb-toggle-button__button'),
)
expect(
document
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('false')
expect(
document
.querySelector('button.dnb-toggle-button__button')
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('false')
// set it to true
@@ -174,12 +174,12 @@ describe('ToggleButton component', () => {
expect(
document
.querySelector('button.dnb-toggle-button__button')
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
expect(
document
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('true')
// reset it with undefined to false
@@ -187,7 +187,7 @@ describe('ToggleButton component', () => {
expect(
document
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('false')
// set it to true + reset it with null to false
@@ -196,7 +196,7 @@ describe('ToggleButton component', () => {
expect(
document
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('false')
// re-render + still false
@@ -204,7 +204,7 @@ describe('ToggleButton component', () => {
expect(
document
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('false')
cleanup()
@@ -214,7 +214,7 @@ describe('ToggleButton component', () => {
TestStates(
-
+ ,
)
})
@@ -252,12 +252,12 @@ describe('ToggleButton component', () => {
render(
-
+ ,
)
const element = document.querySelector('.dnb-toggle-button')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -289,10 +289,10 @@ describe('ToggleButton group component', () => {
variant="radio"
checked
/>
-
+ ,
)
expect(
- document.querySelector('.dnb-radio__button')
+ document.querySelector('.dnb-radio__button'),
).toBeInTheDocument()
})
@@ -310,10 +310,10 @@ describe('ToggleButton group component', () => {
variant="radio"
checked
/>
-
+ ,
)
expect(
- document.querySelector('button#toggle-button-2')
+ document.querySelector('button#toggle-button-2'),
).toHaveAttribute('aria-pressed')
})
@@ -342,7 +342,7 @@ describe('ToggleButton group component', () => {
data-prop="value-2"
attributes={{ 'data-attr': 'value' }}
/>
-
+ ,
)
// first click
@@ -386,7 +386,7 @@ describe('ToggleButton group component', () => {
text="ToggleButton 2"
value="second"
/>
-
+ ,
)
// first click
@@ -399,12 +399,12 @@ describe('ToggleButton group component', () => {
expect(
document
.querySelector('#toggle-button-1')
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
expect(
document
.querySelector('#toggle-button-2')
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
// second click
@@ -413,12 +413,12 @@ describe('ToggleButton group component', () => {
expect(
document
.querySelector('#toggle-button-1')
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('false')
expect(
document
.querySelector('#toggle-button-2')
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
// third click
@@ -427,12 +427,12 @@ describe('ToggleButton group component', () => {
expect(
document
.querySelector('#toggle-button-1')
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('false')
expect(
document
.querySelector('#toggle-button-2')
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('false')
})
@@ -517,7 +517,7 @@ describe('ToggleButton group component', () => {
document
.querySelector(sel)
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('false')
fireEvent.click(document.querySelector(sel))
@@ -525,24 +525,24 @@ describe('ToggleButton group component', () => {
document
.querySelector(sel)
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('true')
expect(
- document.querySelector(sel).getAttribute('aria-pressed')
+ document.querySelector(sel).getAttribute('aria-pressed'),
).toBe('true')
fireEvent.click(document.querySelector(sel))
expect(
- document.querySelector(sel).getAttribute('aria-pressed')
+ document.querySelector(sel).getAttribute('aria-pressed'),
).toBe('false')
expect(
- document.querySelector('.dnb-toggle-button--checked')
+ document.querySelector('.dnb-toggle-button--checked'),
).not.toBeInTheDocument()
expect(
document
.querySelector(sel)
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('false')
fireEvent.click(document.querySelector(sel))
@@ -550,7 +550,7 @@ describe('ToggleButton group component', () => {
document
.querySelector(sel)
.querySelector('.dnb-checkbox__input')
- .getAttribute('data-checked')
+ .getAttribute('data-checked'),
).toBe('true')
cleanup()
@@ -576,7 +576,7 @@ describe('ToggleButton group component', () => {
text="ToggleButton 2"
value="second"
/>
-
+ ,
)
const element = document.querySelector('.dnb-toggle-button-group')
@@ -607,12 +607,12 @@ describe('ToggleButton group component', () => {
value="second"
/>
-
+ ,
)
const element = document.querySelector('.dnb-toggle-button-group')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -625,8 +625,8 @@ describe('ToggleButton group component', () => {
expect(
Array.from(
document.querySelector('.dnb-toggle-button-group .dnb-form-row')
- .classList
- )
+ .classList,
+ ),
).toEqual([
'dnb-section',
'dnb-section--transparent',
@@ -636,7 +636,7 @@ describe('ToggleButton group component', () => {
'dnb-form-row--nested',
])
expect(
- Array.from(document.querySelector('.dnb-form-row').classList)
+ Array.from(document.querySelector('.dnb-form-row').classList),
).toEqual([
'dnb-section',
'dnb-section--transparent',
@@ -660,7 +660,7 @@ describe('ToggleButton group component', () => {
variant="radio"
checked
/>
-
+ ,
)
expect(await axeComponent(Comp)).toHaveNoViolations()
})
@@ -674,7 +674,7 @@ describe('ToggleButton scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-toggle-button-theme-ui.scss')
+ require.resolve('../style/themes/dnb-toggle-button-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/toggle-button/style/themes/dnb-toggle-button-theme-ui.scss b/packages/dnb-eufemia/src/components/toggle-button/style/themes/dnb-toggle-button-theme-ui.scss
index 76bb909cb8d..70f232dac13 100644
--- a/packages/dnb-eufemia/src/components/toggle-button/style/themes/dnb-toggle-button-theme-ui.scss
+++ b/packages/dnb-eufemia/src/components/toggle-button/style/themes/dnb-toggle-button-theme-ui.scss
@@ -205,7 +205,9 @@
}
}
.dnb-checkbox
- .dnb-checkbox__input:not([disabled]):not(:focus):not(:active):not(:hover)
+ .dnb-checkbox__input:not([disabled]):not(:focus):not(:active):not(
+ :hover
+ )
~ .dnb-checkbox__gfx {
color: var(--color-fire-red);
}
diff --git a/packages/dnb-eufemia/src/components/tooltip/Tooltip.tsx b/packages/dnb-eufemia/src/components/tooltip/Tooltip.tsx
index 912561dd6c1..b5d6a025048 100644
--- a/packages/dnb-eufemia/src/components/tooltip/Tooltip.tsx
+++ b/packages/dnb-eufemia/src/components/tooltip/Tooltip.tsx
@@ -72,7 +72,7 @@ function Tooltip(localProps: TooltipAllProps) {
'dnb-tooltip',
size === 'large' && 'dnb-tooltip--large',
createSpacingClasses(props),
- className
+ className,
)
const attributes = {
diff --git a/packages/dnb-eufemia/src/components/tooltip/TooltipContainer.tsx b/packages/dnb-eufemia/src/components/tooltip/TooltipContainer.tsx
index 56faa130a3e..bfef126c744 100644
--- a/packages/dnb-eufemia/src/components/tooltip/TooltipContainer.tsx
+++ b/packages/dnb-eufemia/src/components/tooltip/TooltipContainer.tsx
@@ -18,7 +18,7 @@ type TooltipContainerProps = {
}
export default function TooltipContainer(
- props: TooltipProps & TooltipContainerProps
+ props: TooltipProps & TooltipContainerProps,
) {
const {
internalId,
@@ -72,7 +72,7 @@ export default function TooltipContainer(
clearTimers()
debounceTimeout.current = setTimeout(
() => forceRerender(getBodySize()),
- 100
+ 100,
)
})
@@ -111,7 +111,7 @@ export default function TooltipContainer(
clearTimeout(debounceTimeout.current)
debounceTimeout.current = setTimeout(
() => setStyle(null),
- hideDelay
+ hideDelay,
)
}
return // stop here
@@ -279,7 +279,7 @@ export default function TooltipContainer(
isTrue(noAnimation) && 'dnb-tooltip--no-animation',
isTrue(fixedPosition) && 'dnb-tooltip--fixed',
isActive && 'dnb-tooltip--active',
- !isActive && wasActive && 'dnb-tooltip--hide'
+ !isActive && wasActive && 'dnb-tooltip--hide',
)}
style={{ ...style, ...attributes.style }}
>
@@ -288,7 +288,7 @@ export default function TooltipContainer(
className={classnames(
'dnb-tooltip__arrow',
`dnb-tooltip__arrow__arrow--${arrow}`,
- `dnb-tooltip__arrow__position--${position}`
+ `dnb-tooltip__arrow__position--${position}`,
)}
/>
)}
diff --git a/packages/dnb-eufemia/src/components/tooltip/TooltipHelpers.tsx b/packages/dnb-eufemia/src/components/tooltip/TooltipHelpers.tsx
index 90923dfd207..cf6a527fcf7 100644
--- a/packages/dnb-eufemia/src/components/tooltip/TooltipHelpers.tsx
+++ b/packages/dnb-eufemia/src/components/tooltip/TooltipHelpers.tsx
@@ -12,7 +12,7 @@ export function injectTooltipSemantic(params) {
params.className = classnames(
'dnb-tooltip__wrapper',
'dnb-tab-focus',
- params.className
+ params.className,
)
return params
}
@@ -47,7 +47,7 @@ export function getTargetElement(target: HTMLElement) {
export function useHandleAria(
targetElement: HTMLElement,
- internalId: string
+ internalId: string,
) {
React.useEffect(() => {
try {
@@ -57,7 +57,7 @@ export function useHandleAria(
}
targetElement.setAttribute(
'aria-describedby',
- combineDescribedBy(existing, internalId)
+ combineDescribedBy(existing, internalId),
)
} catch (e) {
//
diff --git a/packages/dnb-eufemia/src/components/tooltip/TooltipPortal.tsx b/packages/dnb-eufemia/src/components/tooltip/TooltipPortal.tsx
index c70dac54fb5..87152931a04 100644
--- a/packages/dnb-eufemia/src/components/tooltip/TooltipPortal.tsx
+++ b/packages/dnb-eufemia/src/components/tooltip/TooltipPortal.tsx
@@ -34,7 +34,7 @@ type TooltipPortalProps = {
}
function TooltipPortal(
- props: TooltipProps & TooltipPortalProps
+ props: TooltipProps & TooltipPortalProps,
): JSX.Element {
const {
active,
@@ -115,7 +115,7 @@ function TooltipPortal(
tooltipPortal[id].delayTimeout = setTimeout(delayRender, delay)
tooltipPortal[id].hiddenTimeout = setTimeout(
delayHidden,
- delay + 300
+ delay + 300,
)
}
}
@@ -151,7 +151,7 @@ function TooltipPortal(
{children}
) : null,
- root
+ root,
)
}
@@ -178,7 +178,7 @@ const createRootElement = (theme: ThemeProps, className = null) => {
if (theme) {
elem.classList.add.call(
elem.classList,
- ...getThemeClasses(theme).split(' ')
+ ...getThemeClasses(theme).split(' '),
)
}
diff --git a/packages/dnb-eufemia/src/components/tooltip/TooltipWithEvents.tsx b/packages/dnb-eufemia/src/components/tooltip/TooltipWithEvents.tsx
index 41d62103178..e05735133f8 100644
--- a/packages/dnb-eufemia/src/components/tooltip/TooltipWithEvents.tsx
+++ b/packages/dnb-eufemia/src/components/tooltip/TooltipWithEvents.tsx
@@ -72,7 +72,7 @@ function TooltipWithEvents(props: TooltipProps & TooltipWithEventsProps) {
const handleSemanticElement = () => {
try {
const targetElement = document.querySelector(
- `*[aria-describedby*="${internalId}"]`
+ `*[aria-describedby*="${internalId}"]`,
)
if (targetElement) {
const role = targetElement.getAttribute('role')
@@ -150,7 +150,7 @@ function TooltipWithEvents(props: TooltipProps & TooltipWithEventsProps) {
clearTimers()
delayTimeout.current = setTimeout(
run,
- parseFloat(String(showDelay)) || 1
+ parseFloat(String(showDelay)) || 1,
) // have min 1 to make sure we are after onMouseLeave
}
}
diff --git a/packages/dnb-eufemia/src/components/tooltip/__tests__/Tooltip.test.tsx b/packages/dnb-eufemia/src/components/tooltip/__tests__/Tooltip.test.tsx
index c9826a7d27c..53c3f15dc53 100644
--- a/packages/dnb-eufemia/src/components/tooltip/__tests__/Tooltip.test.tsx
+++ b/packages/dnb-eufemia/src/components/tooltip/__tests__/Tooltip.test.tsx
@@ -53,11 +53,11 @@ describe('Tooltip', () => {
render(
With snake_case props
-
+ ,
)
expect(document.body.querySelector('.dnb-tooltip').textContent).toBe(
- 'With snake_case props'
+ 'With snake_case props',
)
})
@@ -77,11 +77,11 @@ describe('Tooltip', () => {
render(
Tooltip
-
+ ,
)
expect(
- Array.from(document.querySelector('.dnb-tooltip').classList)
+ Array.from(document.querySelector('.dnb-tooltip').classList),
).toEqual(expect.arrayContaining(['dnb-tooltip--large']))
})
@@ -124,11 +124,11 @@ describe('Tooltip', () => {
render(
Tooltip
-
+ ,
)
expect(
- Array.from(document.querySelector('.dnb-tooltip').classList)
+ Array.from(document.querySelector('.dnb-tooltip').classList),
).toEqual(expect.arrayContaining(['dnb-tooltip--fixed']))
})
@@ -136,16 +136,16 @@ describe('Tooltip', () => {
render(
Tooltip
-
+ ,
)
expect(
- Array.from(document.querySelector('.dnb-tooltip__arrow').classList)
+ Array.from(document.querySelector('.dnb-tooltip__arrow').classList),
).toEqual(
expect.arrayContaining([
'dnb-tooltip__arrow__arrow--center',
'dnb-tooltip__arrow__position--right',
- ])
+ ]),
)
})
@@ -153,16 +153,16 @@ describe('Tooltip', () => {
render(
Tooltip
-
+ ,
)
expect(
- Array.from(document.querySelector('.dnb-tooltip__arrow').classList)
+ Array.from(document.querySelector('.dnb-tooltip__arrow').classList),
).toEqual(
expect.arrayContaining([
'dnb-tooltip__arrow__arrow--right',
'dnb-tooltip__arrow__position--top',
- ])
+ ]),
)
})
@@ -188,11 +188,11 @@ describe('Tooltip', () => {
render(
Tooltip
-
+ ,
)
expect(
- document.querySelector('.dnb-tooltip').getAttribute('style')
+ document.querySelector('.dnb-tooltip').getAttribute('style'),
).toBe('z-index: 10; left: 0px; top: 0px;')
})
})
@@ -211,7 +211,7 @@ describe('Tooltip', () => {
render( )
expect(
- document.querySelector('.dnb-tooltip').getAttribute('style')
+ document.querySelector('.dnb-tooltip').getAttribute('style'),
).not.toBeInTheDocument()
})
@@ -219,10 +219,10 @@ describe('Tooltip', () => {
render( )
expect(
- document.body.querySelectorAll('.dnb-tooltip__portal')
+ document.body.querySelectorAll('.dnb-tooltip__portal'),
).toHaveLength(1)
expect(document.body.querySelectorAll('.dnb-tooltip')).toHaveLength(
- 1
+ 1,
)
})
@@ -231,7 +231,7 @@ describe('Tooltip', () => {
render( )
expect(
- document.body.querySelectorAll('.dnb-tooltip__portal')
+ document.body.querySelectorAll('.dnb-tooltip__portal'),
).toHaveLength(0)
})
@@ -263,7 +263,7 @@ describe('Tooltip', () => {
await wait(1)
expect(getMainElem().classList).not.toContain(
- 'dnb-tooltip--active'
+ 'dnb-tooltip--active',
)
})
})
@@ -348,7 +348,7 @@ describe('Tooltip', () => {
'dnb-tooltip',
'dnb-tooltip--active',
'dnb-tooltip--fixed',
- ])
+ ]),
)
})
@@ -369,15 +369,15 @@ describe('Tooltip', () => {
}
>
5678
-
+ ,
)
const wrapperElement = document.querySelector(
- '.dnb-tooltip__wrapper'
+ '.dnb-tooltip__wrapper',
)
const tooltipElement = document.querySelector('.dnb-tooltip')
const numberFormatElement = wrapperElement.querySelector(
- '.dnb-number-format__visible'
+ '.dnb-number-format__visible',
)
const id = numberFormatElement.getAttribute('aria-describedby')
@@ -403,7 +403,7 @@ describe('Tooltip', () => {
}
>
1234
-
+ ,
)
fireEvent.focus(document.querySelector('.dnb-tooltip__wrapper'))
@@ -411,12 +411,12 @@ describe('Tooltip', () => {
await wait(200) // because of visibility delay
const wrapperElement = document.querySelector(
- '.dnb-tooltip__wrapper'
+ '.dnb-tooltip__wrapper',
)
const id = wrapperElement.getAttribute('aria-describedby')
expect(
- document.body.querySelector('#' + id).parentElement.classList
+ document.body.querySelector('#' + id).parentElement.classList,
).toContain('dnb-tooltip--active')
})
})
@@ -426,7 +426,7 @@ describe('Tooltip', () => {
render(
text
-
+ ,
)
const id = document
@@ -439,7 +439,7 @@ describe('Tooltip', () => {
render(
text
-
+ ,
)
const getContentElement = () => {
@@ -473,7 +473,7 @@ describe('Tooltip', () => {
render(
text
-
+ ,
)
const element = document.querySelector('a')
@@ -483,7 +483,7 @@ describe('Tooltip', () => {
const id = element.getAttribute('aria-describedby')
expect(
- document.body.querySelector('#' + id).parentElement.classList
+ document.body.querySelector('#' + id).parentElement.classList,
).toContain('dnb-tooltip--active')
})
})
@@ -497,7 +497,7 @@ describe('Tooltip scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-tooltip-theme-ui.scss')
+ require.resolve('../style/themes/dnb-tooltip-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/upload/Upload.tsx b/packages/dnb-eufemia/src/components/upload/Upload.tsx
index 6ba2d22e9a8..b589e00b286 100644
--- a/packages/dnb-eufemia/src/components/upload/Upload.tsx
+++ b/packages/dnb-eufemia/src/components/upload/Upload.tsx
@@ -31,7 +31,7 @@ const Upload = (localProps: UploadAllProps) => {
defaultProps,
{ skeleton: context?.skeleton },
context.getTranslation(localProps).Upload,
- context.Upload
+ context.Upload,
)
const {
@@ -115,7 +115,7 @@ const Upload = (localProps: UploadAllProps) => {
acceptedFileTypes,
errorUnsupportedFile,
errorLargeFile,
- }
+ },
)
const validFiles = [...verifiedFiles].slice(0, filesAmountLimit)
diff --git a/packages/dnb-eufemia/src/components/upload/UploadFileInput.tsx b/packages/dnb-eufemia/src/components/upload/UploadFileInput.tsx
index a3efb090548..fa54e97ad68 100644
--- a/packages/dnb-eufemia/src/components/upload/UploadFileInput.tsx
+++ b/packages/dnb-eufemia/src/components/upload/UploadFileInput.tsx
@@ -69,7 +69,7 @@ const UploadFileInput = () => {
onInputUpload(
Array.from(files).map((file) => {
return { file }
- })
+ }),
)
}
diff --git a/packages/dnb-eufemia/src/components/upload/UploadFileList.tsx b/packages/dnb-eufemia/src/components/upload/UploadFileList.tsx
index db875c4d838..84daf3f1ca2 100644
--- a/packages/dnb-eufemia/src/components/upload/UploadFileList.tsx
+++ b/packages/dnb-eufemia/src/components/upload/UploadFileList.tsx
@@ -31,7 +31,7 @@ function UploadFileList() {
}
const cleanedFiles = files.filter(
- (fileListElement) => fileListElement.file != uploadFile.file
+ (fileListElement) => fileListElement.file != uploadFile.file,
)
setFiles(cleanedFiles)
diff --git a/packages/dnb-eufemia/src/components/upload/UploadFileListCell.tsx b/packages/dnb-eufemia/src/components/upload/UploadFileListCell.tsx
index 0649fa26e92..6f7d80233b9 100644
--- a/packages/dnb-eufemia/src/components/upload/UploadFileListCell.tsx
+++ b/packages/dnb-eufemia/src/components/upload/UploadFileListCell.tsx
@@ -79,9 +79,9 @@ const UploadFileListCell = ({
const cellElement = cellRef.current
const focusElement = getPreviousSibling(
'.dnb-upload',
- cellElement
+ cellElement,
).querySelector(
- '.dnb-upload__file-input-button'
+ '.dnb-upload__file-input-button',
) as HTMLButtonElement
focusElement.focus()
} catch (e) {
@@ -100,7 +100,7 @@ const UploadFileListCell = ({
className={classnames(
'dnb-upload__file-cell',
hasWarning && 'dnb-upload__file-cell--warning',
- exists && 'dnb-upload__file-cell--highlight'
+ exists && 'dnb-upload__file-cell--highlight',
)}
ref={cellRef}
>
@@ -151,7 +151,7 @@ const UploadFileListCell = ({
{loadingText}
@@ -163,7 +163,7 @@ const UploadFileListCell = ({
href={imageUrl}
className={classnames(
'dnb-anchor',
- 'dnb-upload__file-cell__title'
+ 'dnb-upload__file-cell__title',
)}
rel="noopener noreferrer"
>
diff --git a/packages/dnb-eufemia/src/components/upload/UploadInfo.tsx b/packages/dnb-eufemia/src/components/upload/UploadInfo.tsx
index 7e8aa2f720e..05526f85f9c 100644
--- a/packages/dnb-eufemia/src/components/upload/UploadInfo.tsx
+++ b/packages/dnb-eufemia/src/components/upload/UploadInfo.tsx
@@ -52,7 +52,7 @@ const UploadInfo = () => {
{String(fileSizeContent).replace(
'%size',
- format(fileMaxSize).toString()
+ format(fileMaxSize).toString(),
)}
diff --git a/packages/dnb-eufemia/src/components/upload/UploadStatus.tsx b/packages/dnb-eufemia/src/components/upload/UploadStatus.tsx
index e61ee84be30..29ef81fd1db 100644
--- a/packages/dnb-eufemia/src/components/upload/UploadStatus.tsx
+++ b/packages/dnb-eufemia/src/components/upload/UploadStatus.tsx
@@ -16,7 +16,7 @@ const UploadStatus = () => {
{String(errorAmountLimit).replace(
'%amount',
- String(filesAmountLimit)
+ String(filesAmountLimit),
)}
diff --git a/packages/dnb-eufemia/src/components/upload/UploadVerify.tsx b/packages/dnb-eufemia/src/components/upload/UploadVerify.tsx
index a2aa9fbcdee..658b6d14141 100644
--- a/packages/dnb-eufemia/src/components/upload/UploadVerify.tsx
+++ b/packages/dnb-eufemia/src/components/upload/UploadVerify.tsx
@@ -15,7 +15,7 @@ export function verifyFiles(
| 'errorLargeFile'
| 'acceptedFileTypes'
| 'fileMaxSize'
- >
+ >,
) {
const {
fileMaxSize,
@@ -30,7 +30,7 @@ export function verifyFiles(
file.size / BYTES_IN_A_MEGA_BYTE > fileMaxSize
? String(errorLargeFile).replace(
'%size',
- format(fileMaxSize).toString()
+ format(fileMaxSize).toString(),
)
: null
)
@@ -49,7 +49,7 @@ export function verifyFiles(
* "file.type" can be e.g. "images/png"
*/
return fileType.includes(type)
- }
+ },
)
return !foundType ? errorUnsupportedFile : null
}
@@ -77,7 +77,7 @@ export function getFileTypeFromExtension(file: File) {
}
export function getAcceptedFileTypes(
- acceptedFileTypes: UploadAcceptedFileTypes
+ acceptedFileTypes: UploadAcceptedFileTypes,
) {
return extendWithAbbreviation(acceptedFileTypes)
.map((type) => (type.includes('/') ? type : `.${type}`))
@@ -86,20 +86,20 @@ export function getAcceptedFileTypes(
export function hasPreferredMimeType(
acceptedFileTypes: UploadAcceptedFileTypes,
- file: File
+ file: File,
) {
return (
file.type.split('/')[1] &&
(!acceptedFileTypes?.length ||
acceptedFileTypes?.some(
- (type) => type.toLowerCase() === file.type.toLowerCase()
+ (type) => type.toLowerCase() === file.type.toLowerCase(),
))
)
}
export function extendWithAbbreviation(
acceptedFileTypes: UploadAcceptedFileTypes,
- abbreviations = { jpg: 'jpeg' }
+ abbreviations = { jpg: 'jpeg' },
) {
const list = [...acceptedFileTypes]
diff --git a/packages/dnb-eufemia/src/components/upload/__tests__/Upload.test.tsx b/packages/dnb-eufemia/src/components/upload/__tests__/Upload.test.tsx
index c3bb8d98f42..e2470870af1 100644
--- a/packages/dnb-eufemia/src/components/upload/__tests__/Upload.test.tsx
+++ b/packages/dnb-eufemia/src/components/upload/__tests__/Upload.test.tsx
@@ -40,7 +40,7 @@ describe('Upload', () => {
render( )
expect(
- document.querySelector('.dnb-upload__file-input')
+ document.querySelector('.dnb-upload__file-input'),
).toBeInTheDocument()
})
@@ -77,7 +77,7 @@ describe('Upload', () => {
render( )
expect(
- screen.queryByText(nb.fileTypeDescription)
+ screen.queryByText(nb.fileTypeDescription),
).toBeInTheDocument()
})
@@ -88,11 +88,11 @@ describe('Upload', () => {
+ />,
)
expect(
- screen.queryByText(customFormatDescription)
+ screen.queryByText(customFormatDescription),
).toBeInTheDocument()
})
@@ -100,11 +100,11 @@ describe('Upload', () => {
const acceptedFileTypes = []
render(
-
+ ,
)
expect(
- screen.queryByText(nb.fileTypeDescription)
+ screen.queryByText(nb.fileTypeDescription),
).not.toBeInTheDocument()
})
@@ -112,7 +112,7 @@ describe('Upload', () => {
const acceptedFileTypes = ['png', 'jpg']
render(
-
+ ,
)
const formattedFileTypes = acceptedFileTypes.join(', ').toUpperCase()
@@ -124,7 +124,7 @@ describe('Upload', () => {
render( )
expect(
- screen.queryByText(nb.fileSizeDescription)
+ screen.queryByText(nb.fileSizeDescription),
).toBeInTheDocument()
})
@@ -135,7 +135,7 @@ describe('Upload', () => {
+ />,
)
expect(screen.queryByText(fileSizeDescription)).toBeInTheDocument()
@@ -149,9 +149,9 @@ describe('Upload', () => {
screen.queryByText(
String(nb.fileSizeContent).replace(
'%size',
- fileMaxSize.toString()
- )
- )
+ fileMaxSize.toString(),
+ ),
+ ),
).toBeInTheDocument()
})
@@ -164,27 +164,27 @@ describe('Upload', () => {
{...defaultProps}
fileMaxSize={fileMaxSize}
fileSizeContent={fileSizeContent}
- />
+ />,
)
expect(
screen.queryByText(
- String(fileSizeContent).replace('%size', `${fileMaxSize}`)
- )
+ String(fileSizeContent).replace('%size', `${fileMaxSize}`),
+ ),
).toBeInTheDocument()
})
it('renders the file amount limit description', () => {
const filesAmountLimit = 2
render(
-
+ ,
)
expect(
- screen.queryByText(nb.fileAmountDescription)
+ screen.queryByText(nb.fileAmountDescription),
).toBeInTheDocument()
expect(
- screen.queryByText(String(filesAmountLimit))
+ screen.queryByText(String(filesAmountLimit)),
).toBeInTheDocument()
})
@@ -216,7 +216,7 @@ describe('Upload', () => {
const { rerender } = render(
-
+ ,
)
expect(screen.queryByText(nb.title)).toBeInTheDocument()
@@ -224,7 +224,7 @@ describe('Upload', () => {
rerender(
-
+ ,
)
expect(screen.queryByText(en.title)).toBeInTheDocument()
@@ -232,7 +232,7 @@ describe('Upload', () => {
rerender(
-
+ ,
)
expect(screen.queryByText(nb.title)).toBeInTheDocument()
@@ -243,12 +243,12 @@ describe('Upload', () => {
const element = document.querySelector('.dnb-upload')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class', 'style'])
expect(Array.from(element.classList)).toEqual(
- expect.arrayContaining(['dnb-space', 'dnb-space__top--large'])
+ expect.arrayContaining(['dnb-space', 'dnb-space__top--large']),
)
})
})
@@ -269,13 +269,13 @@ describe('Upload', () => {
await waitFor(() =>
fireEvent.drop(element, {
dataTransfer: { files: [file1, file2] },
- })
+ }),
)
await waitFor(() =>
fireEvent.drop(element, {
dataTransfer: { files: [file2, file2] },
- })
+ }),
)
expect(result.current.files.length).toBe(1)
@@ -283,7 +283,7 @@ describe('Upload', () => {
{ file: file1, id: expect.any(String), exists: false },
])
expect(
- screen.queryByText(nb.errorAmountLimit.replace('%amount', '1'))
+ screen.queryByText(nb.errorAmountLimit.replace('%amount', '1')),
).toBeInTheDocument()
expect(result.current.internalFiles.length).toBe(3)
@@ -294,13 +294,13 @@ describe('Upload', () => {
fireEvent.click(deleteButton)
expect(
- element.querySelector('.dnb-form-status')
+ element.querySelector('.dnb-form-status'),
).not.toBeInTheDocument()
expect(
screen.queryByRole('button', {
name: nb.buttonText,
- })
+ }),
).not.toHaveAttribute('disabled')
})
@@ -320,13 +320,13 @@ describe('Upload', () => {
await waitFor(() =>
fireEvent.drop(element, {
dataTransfer: { files: [file1] },
- })
+ }),
)
await waitFor(() =>
fireEvent.drop(element, {
dataTransfer: { files: [file1, file2] },
- })
+ }),
)
expect(result.current.files.length).toBe(2)
@@ -358,22 +358,22 @@ describe('Upload', () => {
await waitFor(() =>
fireEvent.drop(element, {
dataTransfer: { files: [file1] },
- })
+ }),
)
await waitFor(() =>
fireEvent.drop(element, {
dataTransfer: { files: [file1, file2] },
- })
+ }),
)
expect(
- element.querySelectorAll('.dnb-upload__file-cell--highlight')
+ element.querySelectorAll('.dnb-upload__file-cell--highlight'),
).toHaveLength(1)
expect(
Array.from(
- element.querySelectorAll('.dnb-upload__file-cell')[0].classList
- )
+ element.querySelectorAll('.dnb-upload__file-cell')[0].classList,
+ ),
).toEqual(expect.arrayContaining(['dnb-upload__file-cell--highlight']))
})
@@ -392,13 +392,13 @@ describe('Upload', () => {
render( )
const inputElement = document.querySelector(
- '.dnb-upload__file-input'
+ '.dnb-upload__file-input',
)
await waitFor(() =>
fireEvent.change(inputElement, {
target: { files: [file] },
- })
+ }),
)
const MockComponent = () => {
@@ -456,7 +456,7 @@ describe('Upload', () => {
render( )
const emptyFileCell = document.querySelector(
- '.dnb-upload__file-cell'
+ '.dnb-upload__file-cell',
)
expect(emptyFileCell).not.toBeInTheDocument()
@@ -480,7 +480,7 @@ describe('Upload', () => {
}
const emptyFileCell = document.querySelector(
- '.dnb-upload__file-cell'
+ '.dnb-upload__file-cell',
)
expect(emptyFileCell).not.toBeInTheDocument()
@@ -521,7 +521,7 @@ describe('Upload', () => {
fireEvent.click(deleteButton)
expect(
- document.querySelector('.dnb-upload__file-cell')
+ document.querySelector('.dnb-upload__file-cell'),
).not.toBeInTheDocument()
})
@@ -552,7 +552,7 @@ describe('Upload', () => {
expect(document.activeElement).toBe(
screen.queryByRole('button', {
name: nb.buttonText,
- })
+ }),
)
})
@@ -567,21 +567,21 @@ describe('Upload', () => {
{...defaultProps}
fileMaxSize={fileMaxSize}
errorLargeFile={errorMessage}
- />
+ />,
)
const inputElement = document.querySelector(
- '.dnb-upload__file-input'
+ '.dnb-upload__file-input',
)
await waitFor(() =>
fireEvent.change(inputElement, {
target: { files: [file1] },
- })
+ }),
)
expect(
- screen.queryByText(`error message ${fileMaxSize}`)
+ screen.queryByText(`error message ${fileMaxSize}`),
).toBeInTheDocument()
})
})
@@ -594,14 +594,14 @@ describe('Upload', () => {
render( )
const inputElement = document.querySelector(
- '.dnb-upload__file-input'
+ '.dnb-upload__file-input',
)
const file1 = createMockFile('fileName-1.png', 100, 'image/png')
await waitFor(() =>
fireEvent.change(inputElement, {
target: { files: [file1] },
- })
+ }),
)
expect(onChange).toHaveBeenCalledTimes(1)
@@ -624,18 +624,18 @@ describe('Upload', () => {
const onFileDelete = jest.fn()
render(
-
+ ,
)
const inputElement = document.querySelector(
- '.dnb-upload__file-input'
+ '.dnb-upload__file-input',
)
const file1 = createMockFile('fileName-1.png', 100, 'image/png')
await waitFor(() =>
fireEvent.change(inputElement, {
target: { files: [file1] },
- })
+ }),
)
const deleteButton = screen.queryByRole('button', {
@@ -667,7 +667,7 @@ describe('Upload scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-upload-theme-ui.scss')
+ require.resolve('../style/themes/dnb-upload-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/components/upload/__tests__/UploadDropzone.test.tsx b/packages/dnb-eufemia/src/components/upload/__tests__/UploadDropzone.test.tsx
index d2a522d06d2..dec273e9333 100644
--- a/packages/dnb-eufemia/src/components/upload/__tests__/UploadDropzone.test.tsx
+++ b/packages/dnb-eufemia/src/components/upload/__tests__/UploadDropzone.test.tsx
@@ -48,7 +48,7 @@ describe('UploadDropzone', () => {
'upload-drop-zone',
'dnb-height-animation--is-in-dom',
'dnb-height-animation--parallax',
- ])
+ ]),
)
})
@@ -77,7 +77,7 @@ describe('UploadDropzone', () => {
fireEvent.dragOver(dropZone)
expect(Array.from(getRootElement().classList)).toEqual(
- expect.arrayContaining(['dnb-upload--active'])
+ expect.arrayContaining(['dnb-upload--active']),
)
})
@@ -89,15 +89,15 @@ describe('UploadDropzone', () => {
fireEvent.dragOver(dropZone)
expect(Array.from(getRootElement().classList)).toEqual(
- expect.arrayContaining(['dnb-upload--active'])
+ expect.arrayContaining(['dnb-upload--active']),
)
fireEvent.dragLeave(dropZone)
await waitFor(() =>
expect(Array.from(getRootElement().classList)).not.toContain(
- 'dnb-upload--active'
- )
+ 'dnb-upload--active',
+ ),
)
})
@@ -113,8 +113,8 @@ describe('UploadDropzone', () => {
await waitFor(() =>
expect(document.body.getAttribute('data-upload-drop-zone')).toBe(
- 'unique-id'
- )
+ 'unique-id',
+ ),
)
unmount()
@@ -153,7 +153,7 @@ describe('UploadDropzone', () => {
fireEvent.dragOver(bodyDropZone)
expect(Array.from(getRootElement().classList)).toEqual(
- expect.arrayContaining(['dnb-upload--active'])
+ expect.arrayContaining(['dnb-upload--active']),
)
})
@@ -167,15 +167,15 @@ describe('UploadDropzone', () => {
fireEvent.dragOver(bodyDropZone)
expect(Array.from(getRootElement().classList)).toEqual(
- expect.arrayContaining(['dnb-upload--active'])
+ expect.arrayContaining(['dnb-upload--active']),
)
fireEvent.dragLeave(bodyDropZone)
await waitFor(() =>
expect(Array.from(getRootElement().classList)).not.toContain(
- 'dnb-upload--active'
- )
+ 'dnb-upload--active',
+ ),
)
})
})
diff --git a/packages/dnb-eufemia/src/components/upload/__tests__/UploadFileInput.test.tsx b/packages/dnb-eufemia/src/components/upload/__tests__/UploadFileInput.test.tsx
index 692bbbd8392..93c9186fcbc 100644
--- a/packages/dnb-eufemia/src/components/upload/__tests__/UploadFileInput.test.tsx
+++ b/packages/dnb-eufemia/src/components/upload/__tests__/UploadFileInput.test.tsx
@@ -54,7 +54,7 @@ describe('UploadFileInput', () => {
})
expect(
- document.querySelector('.dnb-upload__file-input')
+ document.querySelector('.dnb-upload__file-input'),
).toBeInTheDocument()
})
@@ -121,7 +121,7 @@ describe('UploadFileInput', () => {
await waitFor(() =>
fireEvent.change(inputElement, {
target: { files: [file] },
- })
+ }),
)
expect(onInputUpload).toHaveBeenCalledWith([{ file }])
@@ -137,7 +137,7 @@ describe('UploadFileInput', () => {
})
const inputElement = document.querySelector(
- '.dnb-upload__file-input'
+ '.dnb-upload__file-input',
) as HTMLInputElement
Object.defineProperty(inputElement, 'value', {
@@ -154,7 +154,7 @@ describe('UploadFileInput', () => {
await waitFor(() =>
fireEvent.change(inputElement, {
target: { files: [file] },
- })
+ }),
)
expect(onInputUpload).toHaveBeenCalledWith([{ file }])
})
@@ -167,7 +167,7 @@ describe('UploadFileInput', () => {
})
const inputElement = document.querySelector(
- '.dnb-upload__file-input'
+ '.dnb-upload__file-input',
) as HTMLInputElement
expect(inputElement.accept).toBe('.png,.pdf')
@@ -181,7 +181,7 @@ describe('UploadFileInput', () => {
})
const inputElement = document.querySelector(
- '.dnb-upload__file-input'
+ '.dnb-upload__file-input',
) as HTMLInputElement
expect(inputElement.accept).toBe('.png,.jpg,.jpeg')
@@ -202,7 +202,7 @@ describe('UploadFileInput', () => {
await waitFor(() =>
fireEvent.change(inputElement, {
target: { files: [file1, file2] },
- })
+ }),
)
expect(onInputUpload).toHaveBeenCalledWith([
diff --git a/packages/dnb-eufemia/src/components/upload/__tests__/UploadFileListCell.test.tsx b/packages/dnb-eufemia/src/components/upload/__tests__/UploadFileListCell.test.tsx
index 3da15c7c38b..8db2ed4c86b 100644
--- a/packages/dnb-eufemia/src/components/upload/__tests__/UploadFileListCell.test.tsx
+++ b/packages/dnb-eufemia/src/components/upload/__tests__/UploadFileListCell.test.tsx
@@ -36,7 +36,7 @@ describe('UploadFileListCell', () => {
render( )
expect(
- document.querySelector('.dnb-upload__file-cell')
+ document.querySelector('.dnb-upload__file-cell'),
).toBeInTheDocument()
})
@@ -48,7 +48,7 @@ describe('UploadFileListCell', () => {
file: createMockFile('file.png', 100, 'image/png'),
errorMessage: 'error message',
}}
- />
+ />,
)
const element = document.querySelector('.dnb-upload__file-cell')
@@ -61,7 +61,7 @@ describe('UploadFileListCell', () => {
+ />,
)
const element = document.querySelector('.dnb-upload__file-cell__title')
@@ -74,7 +74,7 @@ describe('UploadFileListCell', () => {
+ />,
)
const element = document.querySelector('.dnb-upload__file-cell')
@@ -88,7 +88,7 @@ describe('UploadFileListCell', () => {
+ />,
)
expect(screen.queryByText('PNG')).toBeInTheDocument()
@@ -99,7 +99,7 @@ describe('UploadFileListCell', () => {
+ />,
)
expect(screen.queryByText('PNG')).toBeInTheDocument()
@@ -113,7 +113,7 @@ describe('UploadFileListCell', () => {
/>,
{
wrapper: makeWrapper({ acceptedFileTypes: ['png'] }),
- }
+ },
)
expect(screen.queryByText('PNG')).toBeInTheDocument()
@@ -127,7 +127,7 @@ describe('UploadFileListCell', () => {
/>,
{
wrapper: makeWrapper({ acceptedFileTypes: ['image/png'] }),
- }
+ },
)
expect(screen.queryByText('PNG')).toBeInTheDocument()
@@ -143,7 +143,7 @@ describe('UploadFileListCell', () => {
file: createMockFile('file.png', 100, 'image/png'),
errorMessage: errorMessage,
}}
- />
+ />,
)
expect(screen.queryByText(errorMessage)).toBeInTheDocument()
@@ -158,11 +158,11 @@ describe('UploadFileListCell', () => {
file: createMockFile('file.png', 100, 'image/png'),
errorMessage: 'error message',
}}
- />
+ />,
)
expect(
- screen.queryByTestId('exclamation medium icon')
+ screen.queryByTestId('exclamation medium icon'),
).toBeInTheDocument()
})
@@ -173,11 +173,11 @@ describe('UploadFileListCell', () => {
uploadFile={{
file: createMockFile('file.pdf', 100, 'application/pdf'),
}}
- />
+ />,
)
expect(
- screen.queryByTestId('file pdf medium icon')
+ screen.queryByTestId('file pdf medium icon'),
).toBeInTheDocument()
})
@@ -188,11 +188,11 @@ describe('UploadFileListCell', () => {
uploadFile={{
file: createMockFile('file.xls', 100, 'application/xls'),
}}
- />
+ />,
)
expect(
- screen.queryByTestId('file xls medium icon')
+ screen.queryByTestId('file xls medium icon'),
).toBeInTheDocument()
})
@@ -203,11 +203,11 @@ describe('UploadFileListCell', () => {
uploadFile={{
file: createMockFile('file.ppt', 100, 'application/ppt'),
}}
- />
+ />,
)
expect(
- screen.queryByTestId('file ppt medium icon')
+ screen.queryByTestId('file ppt medium icon'),
).toBeInTheDocument()
})
@@ -218,11 +218,11 @@ describe('UploadFileListCell', () => {
uploadFile={{
file: createMockFile('file.csv', 100, 'image/csv'),
}}
- />
+ />,
)
expect(
- screen.queryByTestId('file csv medium icon')
+ screen.queryByTestId('file csv medium icon'),
).toBeInTheDocument()
})
@@ -233,11 +233,11 @@ describe('UploadFileListCell', () => {
uploadFile={{
file: createMockFile('file.txt', 100, 'text/txt'),
}}
- />
+ />,
)
expect(
- screen.queryByTestId('file txt medium icon')
+ screen.queryByTestId('file txt medium icon'),
).toBeInTheDocument()
})
@@ -248,11 +248,11 @@ describe('UploadFileListCell', () => {
uploadFile={{
file: createMockFile('file.xml', 100, 'application/xml'),
}}
- />
+ />,
)
expect(
- screen.queryByTestId('file xml medium icon')
+ screen.queryByTestId('file xml medium icon'),
).toBeInTheDocument()
})
@@ -263,7 +263,7 @@ describe('UploadFileListCell', () => {
uploadFile={{
file: createMockFile('file.custom', 100, 'application/custom'),
}}
- />
+ />,
)
expect(screen.queryByTestId('file medium icon')).toBeInTheDocument()
@@ -278,7 +278,7 @@ describe('UploadFileListCell', () => {
+ />,
)
expect(screen.queryByText(fileName)).toBeInTheDocument()
})
@@ -295,10 +295,10 @@ describe('UploadFileListCell', () => {
uploadFile={{
file: createMockFile(fileName, 100, 'image/png'),
}}
- />
+ />,
)
const anchorElement = screen.queryByText(
- fileName
+ fileName,
) as HTMLAnchorElement
expect(anchorElement.href).toMatch(mockUrl)
})
@@ -312,13 +312,13 @@ describe('UploadFileListCell', () => {
uploadFile={{
file: createMockFile(fileName, 100, 'image/png'),
}}
- />
+ />,
)
const anchorElement = screen.queryByText(fileName)
expect(anchorElement.className).not.toMatch(
- 'dnb-upload__file-cell--error'
+ 'dnb-upload__file-cell--error',
)
})
})
@@ -339,7 +339,7 @@ describe('UploadFileListCell', () => {
+ />,
)
const element = screen.getByRole('button')
@@ -363,11 +363,11 @@ describe('UploadFileListCell', () => {
file: createMockFile('file.png', 100, 'image/png'),
isLoading: true,
}}
- />
+ />,
)
expect(
- document.querySelector('.dnb-progress-indicator')
+ document.querySelector('.dnb-progress-indicator'),
).toBeInTheDocument()
})
@@ -379,11 +379,11 @@ describe('UploadFileListCell', () => {
file: createMockFile('file.png', 100, 'image/png'),
isLoading: false,
}}
- />
+ />,
)
expect(
- document.querySelector('.dnb-progress-indicator')
+ document.querySelector('.dnb-progress-indicator'),
).not.toBeInTheDocument()
})
})
diff --git a/packages/dnb-eufemia/src/components/upload/useUpload.ts b/packages/dnb-eufemia/src/components/upload/useUpload.ts
index a8166c9ce0f..cc000db1e53 100644
--- a/packages/dnb-eufemia/src/components/upload/useUpload.ts
+++ b/packages/dnb-eufemia/src/components/upload/useUpload.ts
@@ -28,7 +28,7 @@ function useUpload(id: string): useUploadReturn {
const getExistingFile = (
file: File,
- fileItems: UploadFile[] = files
+ fileItems: UploadFile[] = files,
) => {
return fileItems.find(({ file: f }) => {
return (
diff --git a/packages/dnb-eufemia/src/components/visually-hidden/VisuallyHidden.tsx b/packages/dnb-eufemia/src/components/visually-hidden/VisuallyHidden.tsx
index 3f533b06e0d..2eb317d91bc 100644
--- a/packages/dnb-eufemia/src/components/visually-hidden/VisuallyHidden.tsx
+++ b/packages/dnb-eufemia/src/components/visually-hidden/VisuallyHidden.tsx
@@ -37,13 +37,13 @@ const VisuallyHidden = (localProps: VisuallyHiddenAllProps) => {
extendPropsWithContext(
localProps,
defaultProps,
- context?.VisuallyHidden
+ context?.VisuallyHidden,
)
const visuallyHiddenClassNames = classnames(
'dnb-visually-hidden',
focusable ? 'dnb-visually-hidden--focusable' : 'dnb-sr-only',
- className
+ className,
)
const Element = element || 'span'
diff --git a/packages/dnb-eufemia/src/components/visually-hidden/__tests__/VisuallyHidden.test.tsx b/packages/dnb-eufemia/src/components/visually-hidden/__tests__/VisuallyHidden.test.tsx
index 4ff00cd2a87..c3aabd2d562 100644
--- a/packages/dnb-eufemia/src/components/visually-hidden/__tests__/VisuallyHidden.test.tsx
+++ b/packages/dnb-eufemia/src/components/visually-hidden/__tests__/VisuallyHidden.test.tsx
@@ -10,7 +10,7 @@ describe('VisuallyHidden', () => {
render( )
expect(
- document.querySelector('.dnb-visually-hidden')
+ document.querySelector('.dnb-visually-hidden'),
).toBeInTheDocument()
})
@@ -18,7 +18,7 @@ describe('VisuallyHidden', () => {
render( )
expect(
- document.querySelector('.dnb-visually-hidden')
+ document.querySelector('.dnb-visually-hidden'),
).toBeInTheDocument()
})
@@ -26,7 +26,7 @@ describe('VisuallyHidden', () => {
render(children )
expect(
- document.querySelector('.dnb-visually-hidden')
+ document.querySelector('.dnb-visually-hidden'),
).toBeInTheDocument()
})
@@ -35,7 +35,7 @@ describe('VisuallyHidden', () => {
render(ClassName )
expect(
- document.querySelector('.dnb-visually-hidden').className
+ document.querySelector('.dnb-visually-hidden').className,
).toMatch(defaultClassName)
})
@@ -45,10 +45,10 @@ describe('VisuallyHidden', () => {
render(
ClassName
-
+ ,
)
expect(
- document.querySelector('.dnb-visually-hidden').className
+ document.querySelector('.dnb-visually-hidden').className,
).toMatch(customClassName)
})
@@ -57,14 +57,14 @@ describe('VisuallyHidden', () => {
render(focusable )
expect(
- document.querySelector('.dnb-visually-hidden').className
+ document.querySelector('.dnb-visually-hidden').className,
).toMatch(focusableClassName)
})
it('renders with span as the default element', () => {
render(I'm a span )
expect(document.querySelector('span') instanceof HTMLElement).toBe(
- true
+ true,
)
})
@@ -77,11 +77,11 @@ describe('VisuallyHidden', () => {
render(
Provider
-
+ ,
)
expect(
- document.querySelector('.dnb-visually-hidden')
+ document.querySelector('.dnb-visually-hidden'),
).toBeInTheDocument()
})
diff --git a/packages/dnb-eufemia/src/core/jest/jestPuppeteerEnvironment.js b/packages/dnb-eufemia/src/core/jest/jestPuppeteerEnvironment.js
index 338f27134d0..97609174533 100644
--- a/packages/dnb-eufemia/src/core/jest/jestPuppeteerEnvironment.js
+++ b/packages/dnb-eufemia/src/core/jest/jestPuppeteerEnvironment.js
@@ -51,7 +51,7 @@ class JestEnvironment extends PlaywrightEnvironment {
: ''
console.log(
`${cliColors.yellow}URL:`,
- `${cliColors.reset}${themeName}${this.global.pageUrl}`
+ `${cliColors.reset}${themeName}${this.global.pageUrl}`,
)
}
@@ -71,8 +71,8 @@ class JestEnvironment extends PlaywrightEnvironment {
const retryAttempt = state.currentlyRunningTest.invocations
console.log(
chalk.yellow(
- `Retry attempt #${retryAttempt}: ${currentTestName}`
- )
+ `Retry attempt #${retryAttempt}: ${currentTestName}`,
+ ),
)
}
@@ -107,6 +107,6 @@ function getParents(item) {
}
return names.filter(
- (name) => name !== 'ROOT_DESCRIBE_BLOCK' && name !== 'Error'
+ (name) => name !== 'ROOT_DESCRIBE_BLOCK' && name !== 'Error',
)
}
diff --git a/packages/dnb-eufemia/src/core/jest/jestSetup.js b/packages/dnb-eufemia/src/core/jest/jestSetup.js
index ca2d9bc787e..44a1690a227 100644
--- a/packages/dnb-eufemia/src/core/jest/jestSetup.js
+++ b/packages/dnb-eufemia/src/core/jest/jestSetup.js
@@ -128,7 +128,7 @@ export const axeComponent = async (...components) => {
return await axe(
`${html} `,
- typeof components[1] === 'object' ? components[1] : null
+ typeof components[1] === 'object' ? components[1] : null,
)
}
diff --git a/packages/dnb-eufemia/src/core/jest/jestSetupScreenshots.js b/packages/dnb-eufemia/src/core/jest/jestSetupScreenshots.js
index 2a9a3c951f0..c77b5543ace 100644
--- a/packages/dnb-eufemia/src/core/jest/jestSetupScreenshots.js
+++ b/packages/dnb-eufemia/src/core/jest/jestSetupScreenshots.js
@@ -219,12 +219,12 @@ async function handleElement({
const countSelectorElements = await page.evaluate(
({ selector }) => {
const mainSelector = selector.match(
- /(data-visual-test="([^"]*)")/
+ /(data-visual-test="([^"]*)")/,
)?.[0]
try {
return document.querySelectorAll(
- mainSelector ? `[${mainSelector}]` : selector
+ mainSelector ? `[${mainSelector}]` : selector,
).length
} catch (e) {
console.error(e)
@@ -232,12 +232,12 @@ async function handleElement({
},
{
selector,
- }
+ },
)
if (countSelectorElements > 1) {
throw new Error(
- `Ensure the selector '${selector}' exists only once! Found ${countSelectorElements}.`
+ `Ensure the selector '${selector}' exists only once! Found ${countSelectorElements}.`,
)
} else if (isNaN(parseFloat(countSelectorElements))) {
log.warn(`Count not extract main selector from '${selector}'!`)
@@ -254,7 +254,7 @@ async function handleElement({
node.setAttribute('style', style)
return node
},
- makeStyles(style)
+ makeStyles(style),
)
}
@@ -340,7 +340,7 @@ async function handleRootClassName({ page, rootClassName }) {
},
{
rootClassName: global.rootClassName,
- }
+ },
)
global.rootClassName = null
}
@@ -359,7 +359,7 @@ async function handleRootClassName({ page, rootClassName }) {
}
})
},
- { rootClassName }
+ { rootClassName },
)
global.rootClassName = rootClassName
}
@@ -378,7 +378,7 @@ async function handleMeasureOfElement({ page, measureElement, selector }) {
},
{
measureElement,
- }
+ },
)
const heightInPixelsFloat = parseFloat(heightInPixels)
const isInEightSeries = (num) => num % pixelGrid
@@ -392,7 +392,7 @@ async function handleMeasureOfElement({ page, measureElement, selector }) {
log.warn(
`"${measureElement}" is <${off}px off to ${
heightInPixelsFloat + off
- }rem (${heightInPixels}) which corresponds to a rem value of ${inRem}rem.`
+ }rem (${heightInPixels}) which corresponds to a rem value of ${inRem}rem.`,
)
}
}
@@ -517,7 +517,7 @@ async function wrapperCleanup({ page, selector, addWrapper }) {
({ selector }) => {
const element = document.querySelector(selector)
const wrapperElement = element.closest(
- '[data-visual-test-wrapper]'
+ '[data-visual-test-wrapper]',
)
if (wrapperElement) {
@@ -528,7 +528,7 @@ async function wrapperCleanup({ page, selector, addWrapper }) {
},
{
selector,
- }
+ },
)
}
}
@@ -568,7 +568,7 @@ async function handleWrapper({
},
{
selector,
- }
+ },
)
// get the height we want to have on the wrapper
@@ -603,7 +603,7 @@ async function handleWrapper({
throw new Error(
`Top of element is ${
wrRec.top - elRec.top
- }px above the screenshot area.`
+ }px above the screenshot area.`,
)
}
@@ -611,7 +611,7 @@ async function handleWrapper({
throw new Error(
`Bottom of element is ${
elRec.bottom - wrRec.bottom
- }px below the screenshot area.`
+ }px below the screenshot area.`,
)
}
@@ -620,7 +620,7 @@ async function handleWrapper({
{
id: wrapperId,
style,
- }
+ },
)
await page.waitForSelector(`[data-visual-test-id="${wrapperId}"]`)
@@ -637,7 +637,7 @@ module.exports.loadImage = async (imagePath) =>
const createUrl = (url, fullscreen = true, themeName = null) => {
const newURL = new URL(
url,
- `http://${config.testScreenshotOnHost}:${config.testScreenshotOnPort}`
+ `http://${config.testScreenshotOnHost}:${config.testScreenshotOnPort}`,
)
newURL.searchParams.append('data-visual-test', 'true')
diff --git a/packages/dnb-eufemia/src/core/jest/setupJestScreenshot.js b/packages/dnb-eufemia/src/core/jest/setupJestScreenshot.js
index 294dea685df..9edbb2b3b19 100644
--- a/packages/dnb-eufemia/src/core/jest/setupJestScreenshot.js
+++ b/packages/dnb-eufemia/src/core/jest/setupJestScreenshot.js
@@ -13,7 +13,7 @@ jest.setTimeout(
? config.delayDuringNonheadless
: config.timeout > 0
? config.timeout
- : 30e3
+ : 30e3,
)
setMatchConfig(config.matchConfig)
diff --git a/packages/dnb-eufemia/src/elements/Element.tsx b/packages/dnb-eufemia/src/elements/Element.tsx
index 98221d78c09..e8b4bd7c62a 100644
--- a/packages/dnb-eufemia/src/elements/Element.tsx
+++ b/packages/dnb-eufemia/src/elements/Element.tsx
@@ -78,8 +78,8 @@ function ElementInstance(localProps: ElementAllProps) {
createSkeletonClass(skeletonMethod, skeleton, context),
createSpacingClasses(
attributes,
- typeof Tag === 'string' ? `dnb-${Tag}` : null
- )
+ typeof Tag === 'string' ? `dnb-${Tag}` : null,
+ ),
)
validateDOMAttributes(null, attributes)
diff --git a/packages/dnb-eufemia/src/elements/__tests__/Element.test.tsx b/packages/dnb-eufemia/src/elements/__tests__/Element.test.tsx
index d609be788a7..ba949ecc21e 100644
--- a/packages/dnb-eufemia/src/elements/__tests__/Element.test.tsx
+++ b/packages/dnb-eufemia/src/elements/__tests__/Element.test.tsx
@@ -20,11 +20,11 @@ describe('Element', () => {
const { container } = render(
text
-
+ ,
)
expect(container.querySelector('p').getAttribute('class')).toBe(
- 'extra dnb-skeleton dnb-skeleton--font dnb-p'
+ 'extra dnb-skeleton dnb-skeleton--font dnb-p',
)
})
@@ -32,7 +32,7 @@ describe('Element', () => {
render(
text
-
+ ,
)
const element = document.querySelector('.dnb-p')
@@ -43,7 +43,7 @@ describe('Element', () => {
])
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class'])
@@ -53,7 +53,7 @@ describe('Element', () => {
render(
text
-
+ ,
)
const element = document.querySelector('.dnb-p')
@@ -65,21 +65,21 @@ describe('Element', () => {
const { container, rerender } = render(
text
-
+ ,
)
expect(container.querySelector('p').getAttribute('class')).toBe(
- 'dnb-skeleton dnb-skeleton--font dnb-p'
+ 'dnb-skeleton dnb-skeleton--font dnb-p',
)
rerender(
text
-
+ ,
)
expect(container.querySelector('p').getAttribute('class')).toBe(
- 'dnb-skeleton dnb-skeleton--shape dnb-p'
+ 'dnb-skeleton dnb-skeleton--shape dnb-p',
)
})
@@ -89,17 +89,17 @@ describe('Element', () => {
text
-
+ ,
)
const element = container.querySelector('.my-p')
expect(element.getAttribute('class')).toBe(
- 'my-p dnb-skeleton dnb-skeleton--font dnb-p'
+ 'my-p dnb-skeleton dnb-skeleton--font dnb-p',
)
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual([
diff --git a/packages/dnb-eufemia/src/elements/blockquote/Blockquote.tsx b/packages/dnb-eufemia/src/elements/blockquote/Blockquote.tsx
index f86359e4f38..b4112cee47b 100644
--- a/packages/dnb-eufemia/src/elements/blockquote/Blockquote.tsx
+++ b/packages/dnb-eufemia/src/elements/blockquote/Blockquote.tsx
@@ -29,7 +29,7 @@ const Blockquote = React.forwardRef(
className,
...props
}: BlockquoteProps,
- ref
+ ref,
) => (
- )
+ ),
)
export default Blockquote
diff --git a/packages/dnb-eufemia/src/elements/hr/Hr.tsx b/packages/dnb-eufemia/src/elements/hr/Hr.tsx
index c1d71a8075b..ea5803a75d5 100644
--- a/packages/dnb-eufemia/src/elements/hr/Hr.tsx
+++ b/packages/dnb-eufemia/src/elements/hr/Hr.tsx
@@ -29,7 +29,7 @@ const Hr = ({
className,
light && 'dnb-hr--light',
medium && 'dnb-hr--medium',
- fullscreen && 'dnb-hr--fullscreen'
+ fullscreen && 'dnb-hr--fullscreen',
)}
{...props}
/>
diff --git a/packages/dnb-eufemia/src/elements/lists/Dl.tsx b/packages/dnb-eufemia/src/elements/lists/Dl.tsx
index 76bb901fb08..d70e31501cd 100644
--- a/packages/dnb-eufemia/src/elements/lists/Dl.tsx
+++ b/packages/dnb-eufemia/src/elements/lists/Dl.tsx
@@ -23,7 +23,7 @@ const Dl = ({ direction, ...props }: DlAllProps) => {
if (direction) {
props.className = classnames(
props.className,
- `dnb-dl__direction--${direction}`
+ `dnb-dl__direction--${direction}`,
)
}
return
diff --git a/packages/dnb-eufemia/src/elements/lists/Ol.tsx b/packages/dnb-eufemia/src/elements/lists/Ol.tsx
index cd1574c00f0..80718918868 100644
--- a/packages/dnb-eufemia/src/elements/lists/Ol.tsx
+++ b/packages/dnb-eufemia/src/elements/lists/Ol.tsx
@@ -37,7 +37,7 @@ const Ol = ({ nested, inside, outside, ...p }: OlAllProps = {}) => {
p.className,
nested && 'dnb-ol--nested',
inside && 'dnb-ol--inside',
- outside && 'dnb-ol--outside'
+ outside && 'dnb-ol--outside',
)}
skeleton={false}
/>
diff --git a/packages/dnb-eufemia/src/elements/lists/Ul.tsx b/packages/dnb-eufemia/src/elements/lists/Ul.tsx
index 6390dfdc358..24384fb6204 100644
--- a/packages/dnb-eufemia/src/elements/lists/Ul.tsx
+++ b/packages/dnb-eufemia/src/elements/lists/Ul.tsx
@@ -37,7 +37,7 @@ const Ul = ({ nested, inside, outside, ...p }: UlAllProps = {}) => {
p.className,
nested && 'dnb-ol--nested',
inside && 'dnb-ol--inside',
- outside && 'dnb-ol--outside'
+ outside && 'dnb-ol--outside',
)}
skeleton={false}
/>
diff --git a/packages/dnb-eufemia/src/elements/lists/__tests__/Lists.test.tsx b/packages/dnb-eufemia/src/elements/lists/__tests__/Lists.test.tsx
index 859fa7b5474..9643e7eba14 100644
--- a/packages/dnb-eufemia/src/elements/lists/__tests__/Lists.test.tsx
+++ b/packages/dnb-eufemia/src/elements/lists/__tests__/Lists.test.tsx
@@ -25,7 +25,7 @@ describe('Dl', () => {
Term
Description
-
+ ,
)
const element = document.querySelector('.dnb-dl')
@@ -44,7 +44,7 @@ describe('Dl', () => {
'dnb-dd',
])
expect(
- Array.from(element.querySelector('.dnb-dl__item').classList)
+ Array.from(element.querySelector('.dnb-dl__item').classList),
).toEqual(['dnb-dl__item', 'dnb-space__top--medium', 'dnb-dd'])
})
@@ -60,7 +60,7 @@ describe('Dl', () => {
Term
Description
-
+ ,
)
expect(await axeComponent(Component)).toHaveNoViolations()
})
@@ -72,10 +72,12 @@ describe('Dl', () => {
Term
Description
-
+ ,
)
expect(
- document.querySelector('.dnb-dl__item').getAttribute('aria-hidden')
+ document
+ .querySelector('.dnb-dl__item')
+ .getAttribute('aria-hidden'),
).toBe('true')
})
})
@@ -92,7 +94,7 @@ describe('Dl', () => {
Description
-
+ ,
)
expect(await axeComponent(Component)).toHaveNoViolations()
})
diff --git a/packages/dnb-eufemia/src/elements/typography/P.tsx b/packages/dnb-eufemia/src/elements/typography/P.tsx
index cc9dd23e2ac..ff9b5decc2c 100644
--- a/packages/dnb-eufemia/src/elements/typography/P.tsx
+++ b/packages/dnb-eufemia/src/elements/typography/P.tsx
@@ -80,7 +80,7 @@ const P = ({
'dnb-p',
modifierString,
className,
- size && `dnb-p__size--${size}`
+ size && `dnb-p__size--${size}`,
)}
/>
)
diff --git a/packages/dnb-eufemia/src/elements/typography/__tests__/Heading.screenshot.test.ts b/packages/dnb-eufemia/src/elements/typography/__tests__/Heading.screenshot.test.ts
index caf11955443..9869997da9c 100644
--- a/packages/dnb-eufemia/src/elements/typography/__tests__/Heading.screenshot.test.ts
+++ b/packages/dnb-eufemia/src/elements/typography/__tests__/Heading.screenshot.test.ts
@@ -29,7 +29,7 @@ describe.each(['ui', 'sbanken', 'eiendom'])(
})
expect(screenshot).toMatchImageSnapshot()
})
- }
+ },
)
describe.each(['ui', 'sbanken', 'eiendom'])(
@@ -46,5 +46,5 @@ describe.each(['ui', 'sbanken', 'eiendom'])(
})
expect(screenshot).toMatchImageSnapshot()
})
- }
+ },
)
diff --git a/packages/dnb-eufemia/src/elements/typography/__tests__/Heading.test.tsx b/packages/dnb-eufemia/src/elements/typography/__tests__/Heading.test.tsx
index 94b78f7662b..5406a22dc88 100644
--- a/packages/dnb-eufemia/src/elements/typography/__tests__/Heading.test.tsx
+++ b/packages/dnb-eufemia/src/elements/typography/__tests__/Heading.test.tsx
@@ -58,7 +58,7 @@ describe('Heading', () => {
'custom-class',
selector.replace(/^\./, ''),
])
- }
+ },
)
it.each(headings)(
@@ -69,9 +69,9 @@ describe('Heading', () => {
const element = document.querySelector(selector)
expect(Array.from(element.classList)).toContain(
- 'dnb-space__top--large'
+ 'dnb-space__top--large',
)
- }
+ },
)
it.each(headings)(
@@ -88,7 +88,7 @@ describe('Heading', () => {
} else {
expect(element.tagName).toEqual(Component.name)
}
- }
+ },
)
it.each(headings)(
@@ -98,10 +98,10 @@ describe('Heading', () => {
const element = document.querySelector(selector)
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class', 'aria-label'])
- }
+ },
)
})
diff --git a/packages/dnb-eufemia/src/elements/typography/__tests__/Typography.screenshot.test.ts b/packages/dnb-eufemia/src/elements/typography/__tests__/Typography.screenshot.test.ts
index dee0c178180..517f5ebb5c2 100644
--- a/packages/dnb-eufemia/src/elements/typography/__tests__/Typography.screenshot.test.ts
+++ b/packages/dnb-eufemia/src/elements/typography/__tests__/Typography.screenshot.test.ts
@@ -22,5 +22,5 @@ describe.each(['ui', 'sbanken', 'eiendom'])(
})
expect(screenshot).toMatchImageSnapshot()
})
- }
+ },
)
diff --git a/packages/dnb-eufemia/src/elements/typography/style/typography-mixins.scss b/packages/dnb-eufemia/src/elements/typography/style/typography-mixins.scss
index 242aa2892b9..634740a22f6 100644
--- a/packages/dnb-eufemia/src/elements/typography/style/typography-mixins.scss
+++ b/packages/dnb-eufemia/src/elements/typography/style/typography-mixins.scss
@@ -6,9 +6,11 @@
$selectors: &;
@at-root {
@include headingTags() {
+ // prettier-ignore
$selectors: #{$selectors}, &;
@at-root {
@include otherSelectos() {
+ // prettier-ignore
$selectors: #{$selectors}, &;
@at-root #{$selectors} {
diff --git a/packages/dnb-eufemia/src/extensions/forms/DataContext/At.tsx b/packages/dnb-eufemia/src/extensions/forms/DataContext/At.tsx
index 2b6c7453363..e4e72b0e8dd 100644
--- a/packages/dnb-eufemia/src/extensions/forms/DataContext/At.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/DataContext/At.tsx
@@ -28,7 +28,7 @@ function At(props: Props) {
contextHandlePathChange(`${path}${changePath}`, value)
}
: undefined,
- [contextHandlePathChange, path]
+ [contextHandlePathChange, path],
)
if (iterate) {
diff --git a/packages/dnb-eufemia/src/extensions/forms/DataContext/Provider.tsx b/packages/dnb-eufemia/src/extensions/forms/DataContext/Provider.tsx
index 039695a21d1..a219bd6304f 100644
--- a/packages/dnb-eufemia/src/extensions/forms/DataContext/Provider.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/DataContext/Provider.tsx
@@ -49,7 +49,7 @@ export default function Provider({
}: Props) {
const ajvSchemaValidator = useMemo(
() => (schema ? ajv.compile(schema) : undefined),
- [schema]
+ [schema],
)
const [internalData, setInternalData] =
useState>(externalData)
@@ -67,10 +67,10 @@ export default function Provider({
mountedFieldPathsRef.current.find(
(mountedFieldPath) =>
errorsRef.current[mountedFieldPath] !== undefined ||
- pathsWithErrorRef.current.includes(mountedFieldPath)
- )
+ pathsWithErrorRef.current.includes(mountedFieldPath),
+ ),
),
- []
+ [],
)
useEffect(() => {
@@ -93,14 +93,14 @@ export default function Provider({
return
}
},
- [ajvSchemaValidator]
+ [ajvSchemaValidator],
)
const validateBySchemaAndUpdateState = useCallback(
(data: Partial) => {
errorsRef.current = validateBySchema(data) ?? {}
},
- [validateBySchema]
+ [validateBySchema],
)
const setPathWithError = useCallback(
@@ -109,7 +109,7 @@ export default function Provider({
? addListPath(pathsWithErrorRef.current, path)
: removeListPath(pathsWithErrorRef.current, path)
},
- []
+ [],
)
const handlePathChange = useCallback(
@@ -128,21 +128,21 @@ export default function Provider({
setShowAllErrors(false)
},
- [internalData, onChange, onPathChange, validateBySchemaAndUpdateState]
+ [internalData, onChange, onPathChange, validateBySchemaAndUpdateState],
)
// Mounted fields
const handleMountField = useCallback((path: string) => {
mountedFieldPathsRef.current = addListPath(
mountedFieldPathsRef.current,
- path
+ path,
)
}, [])
const handleUnMountField = useCallback((path: string) => {
mountedFieldPathsRef.current = removeListPath(
mountedFieldPathsRef.current,
- path
+ path,
)
}, [])
diff --git a/packages/dnb-eufemia/src/extensions/forms/DataContext/index.ts b/packages/dnb-eufemia/src/extensions/forms/DataContext/index.ts
index 1efae835621..363e53b0314 100644
--- a/packages/dnb-eufemia/src/extensions/forms/DataContext/index.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/DataContext/index.ts
@@ -12,4 +12,3 @@ const DataContext = {
export type { ContextState }
export default DataContext
-
diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/ArraySelection.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/ArraySelection.tsx
index 0ae739cd5c9..a52673a1ecb 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Field/ArraySelection.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/Field/ArraySelection.tsx
@@ -33,7 +33,7 @@ function ArraySelection(props: Props) {
} = useField(props)
const options = React.Children.toArray(children).filter(
- (child) => React.isValidElement(child) && child.type === Option
+ (child) => React.isValidElement(child) && child.type === Option,
) as React.ReactElement[]
switch (variant) {
diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/Number.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/Number.tsx
index f947647c227..88aaad12fb4 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Field/Number.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/Field/Number.tsx
@@ -117,7 +117,7 @@ function NumberComponent(props: Props) {
id={id}
className={classnames(
'dnb-forms-field-number__input',
- inputClassName
+ inputClassName,
)}
placeholder={placeholder}
value={value}
diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/PhoneNumber.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/PhoneNumber.tsx
index 6b312be53f4..1f6547671bf 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Field/PhoneNumber.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/Field/PhoneNumber.tsx
@@ -55,7 +55,7 @@ function PhoneNumber(props: Props) {
selected_value: `${country.iso} (+${country.code})`,
content: `+${country.code} ${country.name}`,
})),
- []
+ [],
)
const handleCountryCodeChange = useCallback(
@@ -70,7 +70,7 @@ function PhoneNumber(props: Props) {
onChange?.(`${changedData?.selected_key || ''} ${phoneNumber}`)
},
- [phoneNumber, emptyValue, onChange]
+ [phoneNumber, emptyValue, onChange],
)
const handleNumberChange = useCallback(
@@ -82,7 +82,7 @@ function PhoneNumber(props: Props) {
onChange?.([countryCode, value].filter(Boolean).join(' '))
},
- [countryCode, emptyValue, onChange]
+ [countryCode, emptyValue, onChange],
)
return (
@@ -91,14 +91,14 @@ function PhoneNumber(props: Props) {
'dnb-forms-field-phone-number',
width !== undefined &&
`dnb-forms-field-phone-number--width-${width}`,
- className
+ className,
)}
{...forwardSpaceProps(preparedProps)}
>
@@ -31,7 +31,7 @@ function PostalCodeAndCity(props: Props) {
className={classnames(
'dnb-forms-field-postal-code-and-city__fields',
width !== undefined &&
- `dnb-forms-field-postal-code-and-city--width-${width}`
+ `dnb-forms-field-postal-code-and-city--width-${width}`,
)}
>
{
onChange?.(!selected_key ? emptyValue : selected_key)
},
- [onChange, emptyValue]
+ [onChange, emptyValue],
)
const handleRadioChange = useCallback(
({ value }) => {
onChange?.(value === undefined ? emptyValue : value)
},
- [onChange, emptyValue]
+ [onChange, emptyValue],
)
const handleHide = useCallback(
@@ -53,7 +53,7 @@ function Selection(props: Props) {
// Provide a value because selecting an option will lead to onChange and onBlur called in parallel, so onBlur might receive the old value
onBlur?.({ onBlurValue: data?.selected_key })
},
- [onBlur]
+ [onBlur],
)
switch (variant) {
@@ -66,7 +66,7 @@ function Selection(props: Props) {
{React.Children.toArray(children)
.filter(
(child) =>
- React.isValidElement(child) && child.type === Option
+ React.isValidElement(child) && child.type === Option,
)
.map((child: React.ReactElement, i) => (
- React.isValidElement(child) && child.type === Option
+ React.isValidElement(child) && child.type === Option,
)
.map((child: React.ReactElement, i) => (
{
onChange?.(checked ? valueOn : valueOff)
},
- [onChange, valueOn, valueOff]
+ [onChange, valueOn, valueOff],
)
const setOn = useCallback(() => {
diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/Boolean.test.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/Boolean.test.tsx
index bbca193cc93..83275cfbb21 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/Boolean.test.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/Boolean.test.tsx
@@ -16,10 +16,10 @@ describe('Field.Boolean', () => {
+ />,
)
expect(
- screen.getByText('This is what went wrong')
+ screen.getByText('This is what went wrong'),
).toBeInTheDocument()
})
@@ -30,7 +30,7 @@ describe('Field.Boolean', () => {
variant="checkbox"
value={false}
onChange={onChange}
- />
+ />,
)
const input = screen.getByRole('checkbox')
await userEvent.click(input)
@@ -46,7 +46,7 @@ describe('Field.Boolean', () => {
it('should show error when no value is given', () => {
render(
-
+ ,
)
expect(screen.getByRole('alert')).toBeInTheDocument()
})
@@ -58,7 +58,7 @@ describe('Field.Boolean', () => {
value={true}
validateInitially
required
- />
+ />,
)
expect(screen.queryByRole('alert')).not.toBeInTheDocument()
})
@@ -70,7 +70,7 @@ describe('Field.Boolean', () => {
value={false}
validateInitially
required
- />
+ />,
)
expect(screen.queryByRole('alert')).not.toBeInTheDocument()
})
@@ -87,10 +87,10 @@ describe('Field.Boolean', () => {
+ />,
)
expect(
- screen.getByText('This is what went wrong')
+ screen.getByText('This is what went wrong'),
).toBeInTheDocument()
})
@@ -106,7 +106,7 @@ describe('Field.Boolean', () => {
value={true}
validateInitially
required
- />
+ />,
)
expect(screen.queryByRole('alert')).not.toBeInTheDocument()
})
@@ -118,7 +118,7 @@ describe('Field.Boolean', () => {
value={false}
validateInitially
required
- />
+ />,
)
expect(screen.queryByRole('alert')).not.toBeInTheDocument()
})
@@ -127,7 +127,7 @@ describe('Field.Boolean', () => {
describe('variant: checkbox-button', () => {
it('renders label', () => {
render(
-
+ ,
)
expect(screen.getByText('Boolean label')).toBeInTheDocument()
})
@@ -137,10 +137,10 @@ describe('Field.Boolean', () => {
+ />,
)
expect(
- screen.getByText('This is what went wrong')
+ screen.getByText('This is what went wrong'),
).toBeInTheDocument()
})
@@ -150,7 +150,7 @@ describe('Field.Boolean', () => {
variant="checkbox-button"
required
validateInitially
- />
+ />,
)
expect(screen.getByRole('alert')).toBeInTheDocument()
})
@@ -162,7 +162,7 @@ describe('Field.Boolean', () => {
value={true}
validateInitially
required
- />
+ />,
)
expect(screen.queryByRole('alert')).not.toBeInTheDocument()
})
@@ -174,7 +174,7 @@ describe('Field.Boolean', () => {
value={false}
validateInitially
required
- />
+ />,
)
expect(screen.queryByRole('alert')).not.toBeInTheDocument()
})
@@ -191,16 +191,16 @@ describe('Field.Boolean', () => {
+ />,
)
expect(
- screen.getByText('This is what went wrong')
+ screen.getByText('This is what went wrong'),
).toBeInTheDocument()
})
it('should show error when no value is given', () => {
render(
-
+ ,
)
expect(screen.getByRole('alert')).toBeInTheDocument()
})
@@ -212,7 +212,7 @@ describe('Field.Boolean', () => {
value={true}
validateInitially
required
- />
+ />,
)
expect(screen.queryByRole('alert')).not.toBeInTheDocument()
})
@@ -224,7 +224,7 @@ describe('Field.Boolean', () => {
value={false}
validateInitially
required
- />
+ />,
)
expect(screen.queryByRole('alert')).not.toBeInTheDocument()
})
diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/Number.test.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/Number.test.tsx
index d5d596a0364..3c9a017ec60 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/Number.test.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/Number.test.tsx
@@ -16,7 +16,7 @@ describe('Field.Number', () => {
render( )
expect(
// getByText instead of getByPlaceholderText since eufemia adds placeholder as tag, not placeholder-attribute
- screen.getByText('Enter some number')
+ screen.getByText('Enter some number'),
).toBeInTheDocument()
})
@@ -28,13 +28,13 @@ describe('Field.Number', () => {
it('renders error', () => {
render( )
expect(
- screen.getByText('This is what went wrong')
+ screen.getByText('This is what went wrong'),
).toBeInTheDocument()
})
it('formats with given thousandSeparator', () => {
const { rerender } = render(
-
+ ,
)
expect(screen.getByDisplayValue('12 345')).toBeInTheDocument()
rerender( )
diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/Selection.test.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/Selection.test.tsx
index b3cd78c62d0..c66194b44bf 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/Selection.test.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/Selection.test.tsx
@@ -11,7 +11,7 @@ describe('Select', () => {
Fooo
Baar
-
+ ,
)
expect(screen.getByText('Baar')).toBeInTheDocument()
@@ -26,7 +26,7 @@ describe('Select', () => {
Two
Three o'clock
Four o'clock rock
-
+ ,
)
const selectionButton = screen.getByRole('button')
@@ -44,7 +44,7 @@ describe('Select', () => {
Fooo
Baar
-
+ ,
)
// getByText instead of getByPlaceholderText since eufemia adds placeholder as tag, not placeholder-attribute
expect(screen.getByText('Select something')).toBeInTheDocument()
@@ -58,7 +58,7 @@ describe('Select', () => {
Fooo
Baar
-
+ ,
)
const selectionButton = screen.getByRole('button')
@@ -85,7 +85,7 @@ describe('Select', () => {
Fooo
Baar
-
+ ,
)
const selectionButton = screen.getByRole('button')
@@ -101,7 +101,7 @@ describe('Select', () => {
Fooo
Baar
-
+ ,
)
const selectionButton = screen.getByRole('button')
@@ -122,7 +122,7 @@ describe('Select', () => {
Fooo
Baar
-
+ ,
)
const selectionButton = screen.getByRole('button')
await userEvent.click(selectionButton)
@@ -135,7 +135,7 @@ describe('Select', () => {
Fooo
Baar
-
+ ,
)
const selectionButton = screen.getByRole('button')
await userEvent.click(selectionButton)
diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/String.test.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/String.test.tsx
index 7b516521812..f90c7932e60 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/String.test.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/Field/__tests__/String.test.tsx
@@ -17,14 +17,14 @@ const syncValidatorReturningError = () =>
const asyncValidatorResolvingWithUndefined = () =>
new Promise((resolve) =>
- setTimeout(() => resolve(undefined), 1)
+ setTimeout(() => resolve(undefined), 1),
)
const asyncValidatorResolvingWithError = () =>
new Promise((resolve) =>
setTimeout(
() => resolve(new Error('Whats left when nothing is right?')),
- 1
- )
+ 1,
+ ),
)
describe('Field.String', () => {
@@ -38,16 +38,16 @@ describe('Field.String', () => {
render( )
expect(
// getByText instead of getByPlaceholderText since eufemia adds placeholder as tag, not placeholder-attribute
- screen.getByText('Enter something')
+ screen.getByText('Enter something'),
).toBeInTheDocument()
})
it('does not render placeholder when value is given', () => {
render(
-
+ ,
)
expect(
- screen.queryByText('placeholder-text')
+ screen.queryByText('placeholder-text'),
).not.toBeInTheDocument()
})
@@ -59,7 +59,7 @@ describe('Field.String', () => {
it('renders error', () => {
render( )
expect(
- screen.getByText('This is what went wrong')
+ screen.getByText('This is what went wrong'),
).toBeInTheDocument()
})
})
@@ -115,7 +115,7 @@ describe('Field.String', () => {
+ />,
)
expect(screen.queryByRole('alert')).not.toBeInTheDocument()
})
@@ -125,7 +125,7 @@ describe('Field.String', () => {
+ />,
)
const input = document.querySelector('input')
expect(screen.queryByRole('alert')).not.toBeInTheDocument()
@@ -140,7 +140,7 @@ describe('Field.String', () => {
+ />,
)
const input = document.querySelector('input')
await userEvent.type(input, 'd')
@@ -155,7 +155,7 @@ describe('Field.String', () => {
+ />,
)
const input = document.querySelector('input')
await userEvent.type(input, 'd')
@@ -172,7 +172,7 @@ describe('Field.String', () => {
+ />,
)
const input = document.querySelector('input')
await userEvent.type(input, 'd')
@@ -195,7 +195,7 @@ describe('Field.String', () => {
value="abc"
schema={{ type: 'string', minLength: 6 }}
validateInitially
- />
+ />,
)
expect(screen.getByRole('alert')).toBeInTheDocument()
})
@@ -208,7 +208,7 @@ describe('Field.String', () => {
value="abc"
schema={{ type: 'string', minLength: 6 }}
validateUnchanged
- />
+ />,
)
const input = document.querySelector('input')
expect(screen.queryByRole('alert')).not.toBeInTheDocument()
@@ -321,14 +321,14 @@ describe('Field.String', () => {
value="abc"
validator={validator}
validateInitially
- />
+ />,
)
await waitFor(() => {
// Wait for since external validators are processed asynchronously
expect(validator.mock.calls).toHaveLength(1)
expect((validator.mock.calls[0] as unknown[])[0]).toEqual('abc')
expect(
- screen.getByText('I think this is wrong')
+ screen.getByText('I think this is wrong'),
).toBeInTheDocument()
})
@@ -342,13 +342,13 @@ describe('Field.String', () => {
expect(validator.mock.calls).toHaveLength(4)
expect((validator.mock.calls[1] as unknown[])[0]).toEqual('abcd')
expect((validator.mock.calls[2] as unknown[])[0]).toEqual(
- 'abcde'
+ 'abcde',
)
expect((validator.mock.calls[3] as unknown[])[0]).toEqual(
- 'abcdef'
+ 'abcdef',
)
expect(
- screen.getByText('I think this is wrong')
+ screen.getByText('I think this is wrong'),
).toBeInTheDocument()
})
})
@@ -360,7 +360,7 @@ describe('Field.String', () => {
value="abc"
validator={validator}
validateInitially
- />
+ />,
)
await expectNever(() => {
// Can't just waitFor and expect not to be in the document, it would approve the first render before the error might appear async.
@@ -377,14 +377,14 @@ describe('Field.String', () => {
value="abc"
validator={validator}
validateInitially
- />
+ />,
)
await waitFor(() => {
// Wait for since external validators are processed asynchronously
expect(validator.mock.calls).toHaveLength(1)
expect((validator.mock.calls[0] as unknown[])[0]).toEqual('abc')
expect(
- screen.getByText('Whats left when nothing is right?')
+ screen.getByText('Whats left when nothing is right?'),
).toBeInTheDocument()
})
@@ -402,7 +402,7 @@ describe('Field.String', () => {
expect((validator.mock.calls[2] as unknown[])[0]).toEqual('abcde')
expect((validator.mock.calls[3] as unknown[])[0]).toEqual('abcdef')
expect(
- screen.getByText('Whats left when nothing is right?')
+ screen.getByText('Whats left when nothing is right?'),
).toBeInTheDocument()
})
@@ -413,7 +413,7 @@ describe('Field.String', () => {
value="foo"
validator={validator}
validateInitially
- />
+ />,
)
await expectNever(() => {
@@ -431,7 +431,7 @@ describe('Field.String', () => {
value="abc"
onBlurValidator={validator}
validateInitially
- />
+ />,
)
await waitFor(() => {
@@ -449,11 +449,11 @@ describe('Field.String', () => {
// Wait for since external validators are processed asynchronously
expect(validator.mock.calls).toHaveLength(1)
expect((validator.mock.calls[0] as unknown[])[0]).toEqual(
- 'abcdef'
+ 'abcdef',
)
expect(
- screen.getByText('I think this is wrong')
+ screen.getByText('I think this is wrong'),
).toBeInTheDocument()
})
})
@@ -465,7 +465,7 @@ describe('Field.String', () => {
value="abc"
onBlurValidator={validator}
validateInitially
- />
+ />,
)
const input = document.querySelector('input')
await userEvent.type(input, 'd')
@@ -487,7 +487,7 @@ describe('Field.String', () => {
value="abc"
onBlurValidator={validator}
validateInitially
- />
+ />,
)
await waitFor(() => {
@@ -505,11 +505,11 @@ describe('Field.String', () => {
// Wait for since external validators are processed asynchronously
expect(validator.mock.calls).toHaveLength(1)
expect((validator.mock.calls[0] as unknown[])[0]).toEqual(
- 'abcdef'
+ 'abcdef',
)
expect(
- screen.getByText('Whats left when nothing is right?')
+ screen.getByText('Whats left when nothing is right?'),
).toBeInTheDocument()
})
})
@@ -521,7 +521,7 @@ describe('Field.String', () => {
value="abc"
onBlurValidator={validator}
validateInitially
- />
+ />,
)
const input = document.querySelector('input')
await userEvent.type(input, 'd')
@@ -541,10 +541,10 @@ describe('Field.String', () => {
render(
-
+ ,
)
expect(
- screen.getByDisplayValue('data-context-value')
+ screen.getByDisplayValue('data-context-value'),
).toBeInTheDocument()
})
@@ -552,7 +552,7 @@ describe('Field.String', () => {
render(
-
+ ,
)
expect(screen.getByDisplayValue('direct-prop')).toBeInTheDocument()
})
@@ -571,7 +571,7 @@ describe('Field.String', () => {
onPathChange={dataContextOnPathChange}
>
-
+ ,
)
const input = document.querySelector('input')
await userEvent.type(input, 'O!')
diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/hooks/useField.ts b/packages/dnb-eufemia/src/extensions/forms/Field/hooks/useField.ts
index 59d74ac669c..d3b9c017f24 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Field/hooks/useField.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/Field/hooks/useField.ts
@@ -11,7 +11,7 @@ import { FormError } from '../../types'
import ajv, { ajvErrorsToOneFormError } from '../../utils/ajv'
import DataContext from '../../DataContext'
import type { FieldProps } from '../../field-types'
-import { FieldGroupContext } from '../../FieldGroup';
+import { FieldGroupContext } from '../../FieldGroup'
import { makeUniqueId } from '../../../../shared/component-helper'
interface ReturnPropOverrides {
@@ -20,7 +20,7 @@ interface ReturnPropOverrides {
}
export default function useField>(
- props: Props
+ props: Props,
): Omit & ReturnPropOverrides {
const {
path,
@@ -39,11 +39,14 @@ export default function useField>(
toInput = (value) => value,
fromInput = (value) => value,
} = props
- const id = useMemo(() => props.id ?? makeUniqueId(), [props.id]);
+ const id = useMemo(() => props.id ?? makeUniqueId(), [props.id])
const dataContext = useContext(DataContext.Context)
- const fieldGroupContext = useContext(FieldGroupContext);
- const inFieldGroup = Boolean(fieldGroupContext);
- const { setFieldError: setFieldGroupError, setShowFieldError: setShowFieldGroupError } = fieldGroupContext ?? {};
+ const fieldGroupContext = useContext(FieldGroupContext)
+ const inFieldGroup = Boolean(fieldGroupContext)
+ const {
+ setFieldError: setFieldGroupError,
+ setShowFieldError: setShowFieldGroupError,
+ } = fieldGroupContext ?? {}
const {
handlePathChange: dataContextHandlePathChange,
setPathWithError: dataContextSetPathWithError,
@@ -52,7 +55,7 @@ export default function useField>(
if (path && path.substring(0, 1) !== '/') {
throw new Error(
- 'Invalid path. Input path JSON Pointers must be from root (starting with a /).'
+ 'Invalid path. Input path JSON Pointers must be from root (starting with a /).',
)
}
@@ -81,35 +84,41 @@ export default function useField>(
// Error handling
const [error, setError] = useState()
const [showError, setShowError] = useState(
- Boolean(validateInitially || errorProp)
+ Boolean(validateInitially || errorProp),
)
const schemaValidator = useMemo(
() =>
schema && Object.keys(schema).length > 0
? ajv.compile(schema)
: undefined,
- [schema]
+ [schema],
)
const setErrorAndUpdateDataContext = useCallback(
(error: FormError | undefined) => {
- const errorWithCorrectMessage =
- (error instanceof FormError &&
- typeof error.validationRule === 'string' &&
- errorMessages?.[error.validationRule] !== undefined
- ? new FormError(errorMessages[error.validationRule])
- : error);
-
- setError(errorWithCorrectMessage);
+ const errorWithCorrectMessage =
+ error instanceof FormError &&
+ typeof error.validationRule === 'string' &&
+ errorMessages?.[error.validationRule] !== undefined
+ ? new FormError(errorMessages[error.validationRule])
+ : error
+
+ setError(errorWithCorrectMessage)
if (path) {
// Tell the data context about the error, so it can stop the user from submitting the form until the error has been fixed
dataContextSetPathWithError?.(path, Boolean(error))
}
- setFieldGroupError?.(path ?? id, errorWithCorrectMessage);
+ setFieldGroupError?.(path ?? id, errorWithCorrectMessage)
},
- [path, id, errorMessages, dataContextSetPathWithError, setFieldGroupError]
+ [
+ path,
+ id,
+ errorMessages,
+ dataContextSetPathWithError,
+ setFieldGroupError,
+ ],
)
const validateValue = useCallback(
@@ -155,7 +164,7 @@ export default function useField>(
required,
setErrorAndUpdateDataContext,
validatorProp,
- ]
+ ],
)
useEffect(() => {
@@ -170,7 +179,7 @@ export default function useField>(
// If showError on a surrounding data context was changed and set to true, it is because the user clicked next, submit or
// something else that should lead to showing the user all errors.
setShowError(true)
- setShowFieldGroupError?.(path ?? id, true);
+ setShowFieldGroupError?.(path ?? id, true)
}
}, [id, path, dataContext.showAllErrors, setShowFieldGroupError])
@@ -178,7 +187,7 @@ export default function useField>(
({ onFocusValue }) => {
onFocusProp?.(onFocusValue ?? value)
},
- [value, onFocusProp]
+ [value, onFocusProp],
)
const onBlur = useCallback(
@@ -204,7 +213,7 @@ export default function useField>(
// Since the user left the field, show error (if any)
setShowError(true)
- setShowFieldGroupError?.(path ?? id, true);
+ setShowFieldGroupError?.(path ?? id, true)
},
[
id,
@@ -215,7 +224,7 @@ export default function useField>(
onBlurValidatorProp,
setErrorAndUpdateDataContext,
setShowFieldGroupError,
- ]
+ ],
)
const onChange = useCallback(
@@ -225,7 +234,7 @@ export default function useField>(
changedRef.current = true
// When changing the value, hide errors to avoid annoying the user before they are finished filling in that value
setShowError(false)
- setShowFieldGroupError?.(path ?? id, false);
+ setShowFieldGroupError?.(path ?? id, false)
// Always validate the value immediately when it is changed
validateValue(newValue)
@@ -243,13 +252,10 @@ export default function useField>(
dataContextHandlePathChange,
setShowFieldGroupError,
fromInput,
- ]
+ ],
)
- const exportError = useMemo(() =>
- errorProp ??
- error
- , [errorProp, error]);
+ const exportError = useMemo(() => errorProp ?? error, [errorProp, error])
useEffect(() => {
// Mount procedure
@@ -271,7 +277,7 @@ export default function useField>(
...props,
id,
value: toInput(value),
- error: inFieldGroup ? undefined : (showError ? exportError : undefined),
+ error: inFieldGroup ? undefined : showError ? exportError : undefined,
onFocus,
onBlur,
onChange,
diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/index.ts b/packages/dnb-eufemia/src/extensions/forms/Field/index.ts
index e963f277e3f..5d5d8ab1076 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Field/index.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/Field/index.ts
@@ -12,7 +12,7 @@ import PhoneNumber from './PhoneNumber'
import OrganizationNumber from './OrganizationNumber'
import PostalCodeAndCity from './PostalCodeAndCity'
import Selection from './Selection'
-import ArraySelection from './ArraySelection';
+import ArraySelection from './ArraySelection'
import Option from './Option'
import SelectCountry from './SelectCountry'
import BankAccountNumber from './BankAccountNumber'
diff --git a/packages/dnb-eufemia/src/extensions/forms/FieldBlock/FieldBlock.tsx b/packages/dnb-eufemia/src/extensions/forms/FieldBlock/FieldBlock.tsx
index c46acb70045..9e2decfacc5 100644
--- a/packages/dnb-eufemia/src/extensions/forms/FieldBlock/FieldBlock.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/FieldBlock/FieldBlock.tsx
@@ -45,7 +45,7 @@ function FieldBlock(props: Props) {
const cn = classnames(
'dnb-forms-field-block',
width !== undefined && `dnb-forms-field-block--width-${width}`,
- className
+ className,
)
return (
@@ -90,7 +90,7 @@ function FieldBlock(props: Props) {
className={classnames(
'dnb-forms-field-block__contents',
contentsWidth !== undefined &&
- `dnb-forms-field-block__contents--width-${contentsWidth}`
+ `dnb-forms-field-block__contents--width-${contentsWidth}`,
)}
>
{children}
diff --git a/packages/dnb-eufemia/src/extensions/forms/FieldBlock/index.ts b/packages/dnb-eufemia/src/extensions/forms/FieldBlock/index.ts
index 817fd81e4f6..622fec46de3 100644
--- a/packages/dnb-eufemia/src/extensions/forms/FieldBlock/index.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/FieldBlock/index.ts
@@ -1 +1 @@
-export { default } from './FieldBlock';
+export { default } from './FieldBlock'
diff --git a/packages/dnb-eufemia/src/extensions/forms/FieldBlock/style/dnb-field-block.scss b/packages/dnb-eufemia/src/extensions/forms/FieldBlock/style/dnb-field-block.scss
index c405a962e60..42c2040269a 100644
--- a/packages/dnb-eufemia/src/extensions/forms/FieldBlock/style/dnb-field-block.scss
+++ b/packages/dnb-eufemia/src/extensions/forms/FieldBlock/style/dnb-field-block.scss
@@ -35,11 +35,9 @@
&--width-large {
width: $forms-field-width-large;
}
-
+
&--width-medium {
width: $forms-field-width-medium;
}
}
-
-
}
diff --git a/packages/dnb-eufemia/src/extensions/forms/FieldGroup/index.ts b/packages/dnb-eufemia/src/extensions/forms/FieldGroup/index.ts
index 3469b43286e..f933d8316af 100644
--- a/packages/dnb-eufemia/src/extensions/forms/FieldGroup/index.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/FieldGroup/index.ts
@@ -1,2 +1,2 @@
-export { default } from './FieldGroup';
-export * from './FieldGroup';
+export { default } from './FieldGroup'
+export * from './FieldGroup'
diff --git a/packages/dnb-eufemia/src/extensions/forms/Layout/FlexContainer.tsx b/packages/dnb-eufemia/src/extensions/forms/Layout/FlexContainer.tsx
index 28df0680788..19e09cac876 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Layout/FlexContainer.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/Layout/FlexContainer.tsx
@@ -14,7 +14,7 @@ export function isHeadingElement(element): boolean {
}
const getSpaceTop = (
- element: React.ReactChild | React.ReactFragment | React.ReactPortal
+ element: React.ReactChild | React.ReactFragment | React.ReactPortal,
): SpaceType | undefined => {
if (!React.isValidElement(element)) {
return
@@ -28,7 +28,7 @@ const getSpaceTop = (
}
const getSpaceBottom = (
- element: React.ReactChild | React.ReactFragment | React.ReactPortal
+ element: React.ReactChild | React.ReactFragment | React.ReactPortal,
): SpaceType | undefined => {
if (!React.isValidElement(element)) {
return
@@ -43,7 +43,7 @@ const getSpaceBottom = (
export const isEufemiaElement = (element): boolean => {
return Object.values(EufemiaElements).some(
- (eufemiaElement) => element?.type === eufemiaElement
+ (eufemiaElement) => element?.type === eufemiaElement,
)
}
@@ -51,7 +51,7 @@ export const isEufemiaElement = (element): boolean => {
* Is the requested element a component that can receive Eufemia space props (space, top, bottom, left and right)?
*/
export const isSpacePropsComponent = (
- element: React.ReactNode
+ element: React.ReactNode,
): boolean => {
return (
(React.isValidElement(element) &&
@@ -115,7 +115,7 @@ function FlexContainer(props: Props) {
wrap && `dnb-forms-flex-container--wrap`,
divider && `dnb-forms-flex-container--divider-${divider}`,
spacing && `dnb-forms-flex-container--spacing-${spacing}`,
- className
+ className,
)
const childrenArray = React.Children.toArray(children)
diff --git a/packages/dnb-eufemia/src/extensions/forms/Layout/FlexItem.tsx b/packages/dnb-eufemia/src/extensions/forms/Layout/FlexItem.tsx
index 14f23116634..575772d7573 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Layout/FlexItem.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/Layout/FlexItem.tsx
@@ -16,7 +16,7 @@ function FlexItem(props: Props) {
'dnb-forms-flex-item',
grow && 'dnb-forms-flex-item--grow',
shrink && 'dnb-forms-flex-item--shrink',
- className
+ className,
)
return (
diff --git a/packages/dnb-eufemia/src/extensions/forms/StepsLayout/StepsContext.ts b/packages/dnb-eufemia/src/extensions/forms/StepsLayout/StepsContext.ts
index f4f60b29e7f..dea276c62f8 100644
--- a/packages/dnb-eufemia/src/extensions/forms/StepsLayout/StepsContext.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/StepsLayout/StepsContext.ts
@@ -7,7 +7,7 @@ interface StepsContextState {
}
const StepsContext = React.createContext(
- undefined
+ undefined,
)
export default StepsContext
diff --git a/packages/dnb-eufemia/src/extensions/forms/StepsLayout/StepsLayout.tsx b/packages/dnb-eufemia/src/extensions/forms/StepsLayout/StepsLayout.tsx
index 422203eea57..2f8eab8aafe 100644
--- a/packages/dnb-eufemia/src/extensions/forms/StepsLayout/StepsLayout.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/StepsLayout/StepsLayout.tsx
@@ -102,7 +102,7 @@ function StepsLayout(props: Props) {
child as React.ReactElement,
{
index: i,
- }
+ },
)
}
return child
diff --git a/packages/dnb-eufemia/src/extensions/forms/Value/hooks/useValue.ts b/packages/dnb-eufemia/src/extensions/forms/Value/hooks/useValue.ts
index f913d25a80a..c424cd0320e 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Value/hooks/useValue.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/Value/hooks/useValue.ts
@@ -4,14 +4,14 @@ import DataContext from '../../DataContext'
import type { ValueProps } from '../../value-types'
export default function useValue>(
- props: Props
+ props: Props,
): Props {
const { path } = props
const dataContext = useContext(DataContext.Context)
if (path && path.substring(0, 1) !== '/') {
throw new Error(
- 'Invalid path. Input path JSON Pointers must be from root (starting with a /).'
+ 'Invalid path. Input path JSON Pointers must be from root (starting with a /).',
)
}
diff --git a/packages/dnb-eufemia/src/extensions/forms/ValueBlock/ValueBlock.tsx b/packages/dnb-eufemia/src/extensions/forms/ValueBlock/ValueBlock.tsx
index 945d9e231b4..914a4a9156b 100644
--- a/packages/dnb-eufemia/src/extensions/forms/ValueBlock/ValueBlock.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/ValueBlock/ValueBlock.tsx
@@ -27,7 +27,7 @@ function ValueBlock(props: Props) {
className={classnames(
'dnb-forms-value',
inline && 'dnb-forms-value-block--inline',
- className
+ className,
)}
{...forwardSpaceProps(props)}
>
diff --git a/packages/dnb-eufemia/src/extensions/forms/ValueBlock/index.ts b/packages/dnb-eufemia/src/extensions/forms/ValueBlock/index.ts
index 94a78716d78..22f0380f37c 100644
--- a/packages/dnb-eufemia/src/extensions/forms/ValueBlock/index.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/ValueBlock/index.ts
@@ -1 +1 @@
-export { default } from './ValueBlock';
+export { default } from './ValueBlock'
diff --git a/packages/dnb-eufemia/src/extensions/forms/Visibility/__tests__/Visibility.test.tsx b/packages/dnb-eufemia/src/extensions/forms/Visibility/__tests__/Visibility.test.tsx
index 0097b3214ca..0e4a9088165 100644
--- a/packages/dnb-eufemia/src/extensions/forms/Visibility/__tests__/Visibility.test.tsx
+++ b/packages/dnb-eufemia/src/extensions/forms/Visibility/__tests__/Visibility.test.tsx
@@ -27,7 +27,7 @@ describe('Visibility', () => {
render(
Child
-
+ ,
)
expect(screen.getByText('Child')).toBeInTheDocument()
})
@@ -36,7 +36,7 @@ describe('Visibility', () => {
render(
Child
-
+ ,
)
expect(screen.queryByText('Child')).not.toBeInTheDocument()
})
@@ -47,7 +47,7 @@ describe('Visibility', () => {
render(
Child
-
+ ,
)
expect(screen.queryByText('Child')).not.toBeInTheDocument()
})
@@ -56,7 +56,7 @@ describe('Visibility', () => {
render(
Child
-
+ ,
)
expect(screen.getByText('Child')).toBeInTheDocument()
})
@@ -67,7 +67,7 @@ describe('Visibility', () => {
render(
Child
-
+ ,
)
expect(screen.getByText('Child')).toBeInTheDocument()
})
@@ -76,7 +76,7 @@ describe('Visibility', () => {
render(
Child
-
+ ,
)
expect(screen.queryByText('Child')).not.toBeInTheDocument()
})
@@ -85,7 +85,7 @@ describe('Visibility', () => {
render(
Child
-
+ ,
)
expect(screen.queryByText('Child')).not.toBeInTheDocument()
})
@@ -96,7 +96,7 @@ describe('Visibility', () => {
render(
Child
-
+ ,
)
expect(screen.getByText('Child')).toBeInTheDocument()
})
@@ -105,7 +105,7 @@ describe('Visibility', () => {
render(
Child
-
+ ,
)
expect(screen.getByText('Child')).toBeInTheDocument()
})
@@ -114,7 +114,7 @@ describe('Visibility', () => {
render(
Child
-
+ ,
)
expect(screen.queryByText('Child')).not.toBeInTheDocument()
})
@@ -127,7 +127,7 @@ describe('Visibility', () => {
render(
Child
-
+ ,
)
expect(screen.getByText('Child')).toBeInTheDocument()
})
@@ -138,7 +138,7 @@ describe('Visibility', () => {
render(
Child
-
+ ,
)
expect(screen.queryByText('Child')).not.toBeInTheDocument()
expect(inferData.mock.calls).toHaveLength(1)
diff --git a/packages/dnb-eufemia/src/extensions/forms/field-types.ts b/packages/dnb-eufemia/src/extensions/forms/field-types.ts
index 915febc326b..7106bb2499d 100644
--- a/packages/dnb-eufemia/src/extensions/forms/field-types.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/field-types.ts
@@ -7,7 +7,7 @@ interface DefaultErrorMessages {
export interface FieldProps<
Value = unknown,
EmptyValue = undefined,
- ErrorMessages extends { required?: string } = DefaultErrorMessages
+ ErrorMessages extends { required?: string } = DefaultErrorMessages,
> {
/** ID added to the actual field component, and linked to the label via for-attribute */
id?: string
@@ -35,10 +35,10 @@ export interface FieldProps<
required?: boolean
schema?: JSONSchema7
validator?: (
- value: Value | EmptyValue
+ value: Value | EmptyValue,
) => Error | undefined | Promise
onBlurValidator?: (
- value: Value | EmptyValue
+ value: Value | EmptyValue,
) => Error | undefined | Promise
/**
* Should error messages based on validation be shown initially (from given value-prop or source data)
diff --git a/packages/dnb-eufemia/src/extensions/forms/utils/__tests__/numbers.test.ts b/packages/dnb-eufemia/src/extensions/forms/utils/__tests__/numbers.test.ts
index df8a55c6a63..bef5d257ea3 100644
--- a/packages/dnb-eufemia/src/extensions/forms/utils/__tests__/numbers.test.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/utils/__tests__/numbers.test.ts
@@ -10,16 +10,16 @@ describe('numbers util', () => {
it('should format correctly with thousandSeparator', () => {
expect(formatNumber(5432, { thousandSeparator: ' ' })).toEqual(
- '5 432'
+ '5 432',
)
expect(formatNumber(64976, { thousandSeparator: "'" })).toEqual(
- "64'976"
+ "64'976",
)
expect(formatNumber(836512, { thousandSeparator: '--' })).toEqual(
- '836--512'
+ '836--512',
)
expect(formatNumber(1234567890, { thousandSeparator: '.' })).toEqual(
- '1.234.567.890'
+ '1.234.567.890',
)
})
@@ -27,7 +27,7 @@ describe('numbers util', () => {
expect(formatNumber(75, { decimalSymbol: '.' })).toEqual('75')
expect(formatNumber(32.56, { decimalSymbol: '.' })).toEqual('32.56')
expect(formatNumber(12345.6789, { decimalSymbol: '?' })).toEqual(
- '12345?6789'
+ '12345?6789',
)
})
@@ -44,13 +44,13 @@ describe('numbers util', () => {
expect(formatNumber(87.6543, { fixedDecimals: 2 })).toEqual('87,65')
expect(formatNumber(87.6543, { fixedDecimals: 3 })).toEqual('87,654')
expect(formatNumber(87.6543, { fixedDecimals: 4 })).toEqual(
- '87,6543'
+ '87,6543',
)
expect(formatNumber(87.6543, { fixedDecimals: 5 })).toEqual(
- '87,65430'
+ '87,65430',
)
expect(formatNumber(87.6543, { fixedDecimals: 6 })).toEqual(
- '87,654300'
+ '87,654300',
)
})
@@ -76,7 +76,7 @@ describe('numbers util', () => {
magnitude: 6,
fixedDecimals: 0,
prefix: 'the answer is ',
- })
+ }),
).toEqual('the answer is 42')
expect(
formatNumber(12345678, {
@@ -84,10 +84,10 @@ describe('numbers util', () => {
decimalSymbol: 'x',
decimalLimit: 2,
magnitude: 3,
- })
+ }),
).toEqual('12 345x68')
expect(
- formatNumber(120000000, { magnitude: 6, suffix: ' MNOK' })
+ formatNumber(120000000, { magnitude: 6, suffix: ' MNOK' }),
).toEqual('120 MNOK')
})
})
@@ -101,50 +101,50 @@ describe('numbers util', () => {
it('should parse based on thousandSeparator', () => {
expect(
- parseFormattedNumber('1 234', { thousandSeparator: ' ' })
+ parseFormattedNumber('1 234', { thousandSeparator: ' ' }),
).toEqual(1234)
expect(
- parseFormattedNumber('12 345', { thousandSeparator: ' ' })
+ parseFormattedNumber('12 345', { thousandSeparator: ' ' }),
).toEqual(12345)
expect(
- parseFormattedNumber('123 456', { thousandSeparator: ' ' })
+ parseFormattedNumber('123 456', { thousandSeparator: ' ' }),
).toEqual(123456)
expect(
parseFormattedNumber("123'456'789'101'112", {
thousandSeparator: "'",
- })
+ }),
).toEqual(123456789101112)
})
it('should parse based on decimalSymbol', () => {
expect(parseFormattedNumber('99', { decimalSymbol: '.' })).toEqual(
- 99
+ 99,
)
expect(
- parseFormattedNumber('45.44', { decimalSymbol: '.' })
+ parseFormattedNumber('45.44', { decimalSymbol: '.' }),
).toEqual(45.44)
expect(
- parseFormattedNumber('9876x5432', { decimalSymbol: 'x' })
+ parseFormattedNumber('9876x5432', { decimalSymbol: 'x' }),
).toEqual(9876.5432)
})
it('should recalculate correctly based on magnitude', () => {
expect(parseFormattedNumber('85,3', { magnitude: 3 })).toEqual(85300)
expect(parseFormattedNumber('123,4', { magnitude: 6 })).toEqual(
- 123400000
+ 123400000,
)
})
it('should parse formatted values with prefix', () => {
expect(parseFormattedNumber('Kr 200', { prefix: 'Kr ' })).toEqual(
- 200
+ 200,
)
expect(parseFormattedNumber('ā¬5000', { prefix: 'ā¬' })).toEqual(5000)
})
it('should parse formatted values with suffix', () => {
expect(parseFormattedNumber('2500 NOK', { suffix: ' NOK' })).toEqual(
- 2500
+ 2500,
)
expect(parseFormattedNumber('300kg', { suffix: 'kg' })).toEqual(300)
})
@@ -154,7 +154,7 @@ describe('numbers util', () => {
parseFormattedNumber('This is a number: 35.8', {
prefix: 'This is a number: ',
magnitude: 2,
- })
+ }),
).toEqual(3580)
expect(
parseFormattedNumber('1 350.00MRD', {
@@ -162,7 +162,7 @@ describe('numbers util', () => {
decimalSymbol: '.',
thousandSeparator: ' ',
magnitude: 1,
- })
+ }),
).toEqual(13500)
})
})
diff --git a/packages/dnb-eufemia/src/extensions/forms/utils/ajv.ts b/packages/dnb-eufemia/src/extensions/forms/utils/ajv.ts
index fbfebeec134..34fbbc975b2 100644
--- a/packages/dnb-eufemia/src/extensions/forms/utils/ajv.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/utils/ajv.ts
@@ -47,7 +47,7 @@ function ajvErrorToFormError(ajvError: ErrorObject): FormError {
* Transform errors from ajv-validation into one error object (i.e for validating a flat value)
*/
export function ajvErrorsToOneFormError(
- errors?: ErrorObject[] | null
+ errors?: ErrorObject[] | null,
): FormError | undefined {
if (!errors || errors.length === 0) {
return
@@ -68,7 +68,7 @@ export function ajvErrorsToOneFormError(
* @returns
*/
export const ajvErrorsToFormErrors = (
- errors?: ErrorObject[] | null
+ errors?: ErrorObject[] | null,
): Record =>
(errors ?? []).reduce((errors, ajvError) => {
return {
diff --git a/packages/dnb-eufemia/src/extensions/forms/utils/components.ts b/packages/dnb-eufemia/src/extensions/forms/utils/components.ts
index b86095429da..aa1eece07a2 100644
--- a/packages/dnb-eufemia/src/extensions/forms/utils/components.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/utils/components.ts
@@ -1,7 +1,7 @@
import { SpacingProps } from '../../../components/space/types'
export const forwardSpaceProps = (
- props: Props
+ props: Props,
): SpacingProps => {
return {
space: props?.space,
@@ -13,7 +13,7 @@ export const forwardSpaceProps = (
}
export const omitSpaceProps = (
- props: Props
+ props: Props,
): Omit => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { space, top, bottom, left, right, ...restProps } = props
diff --git a/packages/dnb-eufemia/src/extensions/forms/utils/numbers.ts b/packages/dnb-eufemia/src/extensions/forms/utils/numbers.ts
index 9f151f2179a..46a587229dd 100644
--- a/packages/dnb-eufemia/src/extensions/forms/utils/numbers.ts
+++ b/packages/dnb-eufemia/src/extensions/forms/utils/numbers.ts
@@ -15,7 +15,7 @@ interface FormatNumberOptions {
export function formatNumber(
value: number,
- options?: FormatNumberOptions
+ options?: FormatNumberOptions,
): string {
const {
thousandSeparator,
@@ -49,7 +49,7 @@ export function formatNumber(
thousandSeparator !== undefined
? withDecimalSymbol.replace(
/\B(?=(\d{3})+(?!\d))/g,
- thousandSeparator
+ thousandSeparator,
)
: withDecimalSymbol
@@ -66,7 +66,7 @@ export function formatNumber(
export function parseFormattedNumber(
formattedValue: string,
- options?: FormatNumberOptions
+ options?: FormatNumberOptions,
): number {
const {
thousandSeparator,
diff --git a/packages/dnb-eufemia/src/extensions/payment-card/PaymentCard.js b/packages/dnb-eufemia/src/extensions/payment-card/PaymentCard.js
index e58fe97fdde..d4e926a3981 100644
--- a/packages/dnb-eufemia/src/extensions/payment-card/PaymentCard.js
+++ b/packages/dnb-eufemia/src/extensions/payment-card/PaymentCard.js
@@ -59,7 +59,12 @@ export default class PaymentCard extends React.PureComponent {
static propTypes = {
product_code: PropTypes.string.isRequired,
card_number: PropTypes.string.isRequired,
- card_status: PropTypes.oneOf(['active', 'blocked', 'expired', 'not_active']),
+ card_status: PropTypes.oneOf([
+ 'active',
+ 'blocked',
+ 'expired',
+ 'not_active',
+ ]),
variant: PropTypes.oneOf(['normal', 'compact']),
digits: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
raw_data: cardDataPropTypes,
@@ -102,7 +107,7 @@ export default class PaymentCard extends React.PureComponent {
this.props,
PaymentCard.defaultProps,
{ locale: this.context.locale },
- { skeleton: this.context?.skeleton }
+ { skeleton: this.context?.skeleton },
)
const {
@@ -130,7 +135,7 @@ export default class PaymentCard extends React.PureComponent {
createSkeletonClass(null, skeleton, this.context),
createSpacingClasses(props),
className,
- _className
+ _className,
),
...attributes,
}
@@ -147,7 +152,7 @@ export default class PaymentCard extends React.PureComponent {
const translations = extendPropsWithContextInClassComponent(
this.props,
translationDefaultPropsProps,
- translation.PaymentCard
+ translation.PaymentCard,
)
return (
@@ -161,7 +166,7 @@ export default class PaymentCard extends React.PureComponent {
cardStatus={card_status}
cardNumber={formatCardNumber(
card_number,
- parseFloat(digits)
+ parseFloat(digits),
)}
translations={translations}
/>
@@ -185,7 +190,7 @@ export const formatCardNumber = (cardNumber, digits) =>
export const getCardData = (productCode) => {
const card = cardProducts.find(
- (item) => item.productCode === productCode
+ (item) => item.productCode === productCode,
)
return card || defaultCard(productCode)
}
@@ -216,7 +221,7 @@ function StatusOverlay({ cardStatus, translations, skeleton }) {
@@ -230,7 +235,7 @@ function StatusOverlay({ cardStatus, translations, skeleton }) {
@@ -245,7 +250,7 @@ function StatusOverlay({ cardStatus, translations, skeleton }) {
@@ -272,7 +277,7 @@ function CardText({ cardNumber, translations, skeleton }) {
{
raw_data={customData}
variant="compact"
card_number="************1337"
- />
+ />,
)
expect(screen.queryByText(customData.productName)).toBeInTheDocument()
expect(screen.queryByText(customData.productName).tagName).toEqual(
- 'FIGCAPTION'
+ 'FIGCAPTION',
)
expect(
- document.querySelector('div.dnb-payment-card__card--design-gold')
+ document.querySelector('div.dnb-payment-card__card--design-gold'),
).toBeInTheDocument()
})
@@ -134,7 +134,7 @@ describe('PaymentCard scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-payment-card-theme-ui.scss')
+ require.resolve('../style/themes/dnb-payment-card-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/extensions/payment-card/utils/Types.js b/packages/dnb-eufemia/src/extensions/payment-card/utils/Types.js
index 0b85fc04af1..accdcd4b680 100644
--- a/packages/dnb-eufemia/src/extensions/payment-card/utils/Types.js
+++ b/packages/dnb-eufemia/src/extensions/payment-card/utils/Types.js
@@ -132,7 +132,7 @@ function createDaggy() {
tag = tags[idx]
if (!fs[tag]) {
throw new TypeError(
- "Constructors given to cata didn't include: " + tag
+ "Constructors given to cata didn't include: " + tag,
)
}
}
@@ -187,7 +187,7 @@ function createDaggy() {
function makeValue(fields, proto, values, argumentsLength) {
if (argumentsLength !== fields.length) {
throw new TypeError(
- 'Expected ' + fields.length + ' arguments, got ' + argumentsLength
+ 'Expected ' + fields.length + ' arguments, got ' + argumentsLength,
)
}
const obj = Object.create(proto)
@@ -247,7 +247,7 @@ function createDaggy() {
fields,
proto,
[a, b, c, d, e],
- arguments.length
+ arguments.length,
)
}
case 6:
@@ -256,7 +256,7 @@ function createDaggy() {
fields,
proto,
[a, b, c, d, e, f],
- arguments.length
+ arguments.length,
)
}
case 7:
@@ -265,7 +265,7 @@ function createDaggy() {
fields,
proto,
[a, b, c, d, e, f, g],
- arguments.length
+ arguments.length,
)
}
case 8:
@@ -274,7 +274,7 @@ function createDaggy() {
fields,
proto,
[a, b, c, d, e, f, g, h],
- arguments.length
+ arguments.length,
)
}
case 9:
@@ -283,7 +283,7 @@ function createDaggy() {
fields,
proto,
[a, b, c, d, e, f, g, h, i],
- arguments.length
+ arguments.length,
)
}
case 10:
@@ -292,7 +292,7 @@ function createDaggy() {
fields,
proto,
[a, b, c, d, e, f, g, h, i, j],
- arguments.length
+ arguments.length,
)
}
/* eslint-enable max-len */
@@ -302,7 +302,7 @@ function createDaggy() {
return makeValue(fields, proto, arguments, arguments.length)
},
'length',
- { value: fields.length }
+ { value: fields.length },
)
}
}
diff --git a/packages/dnb-eufemia/src/extensions/payment-card/utils/backgrounds/ung.ts b/packages/dnb-eufemia/src/extensions/payment-card/utils/backgrounds/ung.ts
index 5f39d2379db..1fd8d97b731 100644
--- a/packages/dnb-eufemia/src/extensions/payment-card/utils/backgrounds/ung.ts
+++ b/packages/dnb-eufemia/src/extensions/payment-card/utils/backgrounds/ung.ts
@@ -1,4 +1,4 @@
const base64EncodedImage =
- "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAQEBAQEBAQEBAQGBgUGBggHBwcHCAwJCQkJCQwTDA4MDA4MExEUEA8QFBEeFxUVFx4iHRsdIiolJSo0MjRERFwBBAQEBAQEBAQEBAYGBQYGCAcHBwcIDAkJCQkJDBMMDgwMDgwTERQQDxAUER4XFRUXHiIdGx0iKiUlKjQyNEREXP/CABEIANgBVwMBIgACEQEDEQH/xAAbAAEBAQEBAQEBAAAAAAAAAAAAAQIDBAUGCP/aAAgBAQAAAAD+/GmdEoSwpx7IqFITSLFlSwWC559glSwsWV5+5ULAzoce1Ss+X12JqSblxuLKhZjdIoBPD7dQqJbz6GNKhZZRLKmbazVSglM6iNRUmoLKElsqKgsWBjWksCUsBy6gqVLCyyyosCoFJSAVFlhUssUxoqFILJb5u9sqLjn3cOukpM6pjRm6nwPvqIKioqeb0gVAqVOE9FlioE1EVRJoixUsWUSaizO/g79vtRbOPeBYPJn3HPpHHsWC8estEqWCxZFolJKVnUWKJRAKZtEoIAAsmhhqwVFgzdMtJQlZ0ebvolJRFZazLpKSpSLAssqUzpKRLUsoIsUk1KJZ8D9BCys0qLDj2KikLCxx66lQsRQFJUuNzl2iUvPpLKiakm4mpcblzVZtRSFDNWRqWLJaEY6ZoqUis0irFSiJqLnTNVFASahc0WKlgCpLZZYMbCaRx7xUlMdCLJoJSBYFAgBZUM6rE6JU+d9FSWSjh3sVm0//xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/2gAIAQIQAAAAAAAAABrIAAAAAAAAAAFhYAAABUALAAAAAAWAAAAVAAAAWAAAAAAAAAsCwWWA/8QAFwEBAQEBAAAAAAAAAAAAAAAAAQACA//aAAgBAxAAAADOhikpEkRoqpGufQSmKmoShRJqJokkqqaiqSYrOxxpJHOrOhoLRIZug51CZ0jlpGoSYmhKRhzqqGKaoRhINIkkaEqpEcsiMVNQlUiTVDRI0MI0GinKwazoRv/EACwQAAECBQMEAQQCAwAAAAAAAAECEQAQICExEjBBA1FhcSITQEKBMlIjkbH/2gAIAQEAAT8COLQgrLhaGbnvMvwJ53XEvkCbWoDzw52sycDb5h7Q63/jaAAHYZl+qTZ4SG97b3EOeBHufFLa1eBUbNAgTcYgeJlQTSFPGYFXTWVJDm4JSYORRZwaAdWKFq0ywfdYvw0AaZcwU0MIsLUJ/LYUr6awNHxV+XYwU3BkYaBa1DDLUHj3QUkxcDvDzbNTvg7YBSfEP3gXnpYqIOYGpvkz+KMHOafFQDSbEjqcNzNrg7LYhz/WhrgzHiSSrmY42ceYHrYPeWopy0w+wS0yHqHMHU7ho1ZtLtsgu8wG+wvxJnzttX5Eg/MmA3nm4oCjYHMNJqDa5jNeZOBQpWh1H+IEJOpLszxiWJ92mU31PCnBe0+rgQgTIekAh3jzQSAzmGfVquk8SIeACEkQk8Wn03+p1EqNgbGhmmoagUnBgg2aPG6U6bgmp3jFD52up0h1AOCOYTqw7gZel2tSS0XeYIUARQA1ApUl/dPqtnIOy0JGl+1X5e5db6yBq6Q5vCup1umgKKdR5aOl1CsF0kHzO7QmzzOLQHSb0swhgbxiSmgXhUA9S8BasNQRdz3oKVObwMUNd4zaNIE9J02kkvVjYzIh+ZtcQHDvDsr3V5qzmkBufuH+wvNxq0nJkRahpm0y7ECGs0A5mHa/eGP9qh8Xm1ALzu5MXH7M7uIbsYv3qNqhietuonpgO/MAu9APigBqBzTzmZtBUfjbNBPihrvM2EZ2OIAA3NVyNlrvuhuJlufsOgrqrUtSiPp8SZPagMLDb/5QolwE7ANAFrwwnaPNHVRqQUjnPqAwAADCpxaO1F3EMKPE3kMl81G8kGxeXLRd/NCkqOC0e6EZVsAcPzCn1JkYPuA/NCUqGaOoMf6oKmpbS7U43Ap7UEYPMarqcMBzAIUHBffF+IZ4zplqAzPkCge6ez08iTNaBiQIOJYgY9z/AHTfaIFng4gETekz0pmXs1SW4jUxudkWmABiYfmkyUlxAGw8lXDDZHMtPesrZTKYDgvLMkgh3+1fn7Jgcze7UX5qKmIDWoJIZhHyI7Xmyhg0fT/yg/iE48195G12gFxRqUW+Mz7gPzNQyeYxHE//xAAoEAACAgICAwACAgIDAQAAAAABEQAhEDFBUSBhcYGhMLGRwdHh8fD/2gAIAQEAAT8hEty9S87oBY+MGwgVCDkyQAIM9Lieh4NC8f1Nx7dQABnvAIUCMW285tm4RNhZQQFme/F7m4+DvqH5CtuDg7BWQ+cn1A1e/Ch7GArm/nMYKH3JSmlDM/cbvh3OUqxb9YNHFce5bKt+sF0vC368CAQjqcHRcNgsHeptJg9TRV8U9q4XxgviES12fcF8eBkj4aM5W7hsEumVklPxFS0Gdx+AJdmvUAq8mp1CBtCY3qv8YBPWTYIhrEPdJEMpBGSQNmB0L1k6nO88y36yQhfGsBCsryKrh3BZzFjbZeEWLrqNK49QWHkk2JoAbcrnIEEjya/gawOZ4e2Ma1gGNqGnuAHBs34JoAgLAMrjAl/InwuAdCvsoU3MIBDk5Qj2l0vAhjagAOjwIHPkWioYBtP3OSJQkY1ghwO613YCn/kjwYs9Qn58KFP1jrwRTrCUKrWDBltroT7g/A8ULOCVxjopQqCLBuECn3DsEsEW/UAAQWR1CAx/5wbBgEAK9+BD3kF8KINq4HS/aETtMK3AAKGEG81CGxDYIEIaDoFASXSwkFsl5D5wsAIJuLvFsaUAj4wQ6PgVgS0YAFsLcDIHDWCC+k7wXxlUhURYLw+C1PkDV7gBQljX7lEr853ggEIjwJAXvHcIYRgeqrUOlPbweADki2K7ifMdM+C55wgL8AXNa7wQQUBneKNX6l3r1AwgsEOjA9Es+HKmmQL8GGucEBzys3J5LRW4uN7vqFiL1xggSCePAgB0AMygB2Nzk14bvAI0ODs8xg6yw/dKhwlQe3RgAHAABDO7Li5wdQt1xCC4hzkGZojiBAfd3HgAI+ATfMNGVGC9F4IggSQAzsw1CQVNYUIajBj6YYi1FrInUoRaLmsgGXOQ9JIbeAAQxDdhsZYa8qsj54EYcOoB34gdYANMhWhzO7gryK0efAIkkpgdiAF4Qs3CJNECQd9ZKqpQ+xWE0NZ1tnLEu/XPzkDbX48N0YK7QcwNBp4oYLNEPcAQAww14EOqh9HJFjXil1vcKYOPWGDzCQLJwCAm/wDhg1ANOW+YB0JQWHkUC3koV24AUH9yxL+kAC5B/Rw7WDYIgBVoQnUuAAEIhKLOrhID3BJAQ/6hxBArjUZbWjihORcIScVQevAkgIAaZhPRQ0DlfalCmISgRScIB2MelLcLW7hRsHyAAIZKV4/qIWe94BFhg1KZLE65g3buoSVsB+R5IPt4DZwQijncJAIHeSM2wSBvPHUH2/4gN3D0m4XxLxwrgIIYwAOsczndfxEPRWB2lFax9xy5zRDHRw8Q7bcdrKC1eSCUbrGxKIvUaw2twhLBIwgHAEX2EA+wby3qH1OYCG6bmxrBAt4WEGjjRfcF9Q0oSUcgH4wABqHV1zCbBKLP7gCYesXgkaxbFVkkCzAGpf3LmPaWoCFIUkag+ZIWyH3wQXgT/LA95o9w4yW3XXMSLk/U6yQEIj4Gjpk7E4CAYwSg41vBAOxC1W8EHkj6g1D+C2X+PAMRsf1l2fUYOAANCWyxXGOeSeuh/AXwPAgEIxLPL/WQIPhN5Vuc+oCDYjGnLh1uHYRHuf3A1e4ha3vBIAJYq4fa6xR4rBcAQZv/AB4AY5CGFC1W5TXJjA2Z0saZcGrMRe9NQrnjIuy8iQwO4CDqMforJfEJXY7iuMjYPXcCNB8x7gIOoSr1bmB6BA68mN3qEoh34cq0P3DcTzNawUETCr7bygKicEvC3PCwn4AgXBBg5O+oQoK/mHa0Khz0Gh7gCzwI/uBrTwHm1WAFzhevAgp2fiGCBWCQaP4jJhAoJcgtZL4hmzB34M32R/lghkHrD6AfJgLAPgDBVcCMV78NOTHTyrBeoXSWQAGvuSUHHCQRAfg8g0MBJSwR2/8AIuIPWeXHZCPgKAED536wQCj14EhacGEARERYCPYwwqfck/Tz4AQ20tnrPyMih9rAChoal1UJIAqPOEIhQNwSLbhKm0Y0KEJgSciCSDQCF8eG3CgLGlFrDL1A+Ri36lv1N8QQk6B/coR6hXIrceA3BH3LB5wDUfEBYa/zDQCP3hhp3CCjB9Y6c0KiQR+cQg6MkogI3kkDZyCf/GOwEYgZoE1Zm7jhRR914WC7xoED/cALSeEElWaFCWBVmAv/AHCATO5q4Kvrlo/Y/XizLgze4FJ2DYPj7IXGNjHZsesAiwMYv1HFGTxjioCw8cvN35ENXj5ipRwAIHAwk0AHgukMKlrJfHmAuSfuSggNu8a1E9qeASdhYDCmXuW3woQ6hXMdpbFVhWC5uASYNh/2ZLBcXr1ndTZjhFpjv7i368SWg3ioixj0q+oGg940IOlQAjZeAJ6TZ7V8yEoGqcAAfIbpn//EACQQAQEAAgICAwEBAQEBAQAAAAERACEQMUFRIGFxgZGxwdGh/9oACAEBAAE/EGlXWVM6uGQE3fkffBUoPkwk2G/x++TCo6c0MqHbx+Z0Q6NB8EWWjFCVC6MVI67VXrBAIiZrQQMrihG1Xhc0nYPAC09FS/p9cgFUj0esuJ9Qe/vnYRhZ2zIX2nee78AKDwxwQUR/MOiGtQ4pImswNNpP9OJiddXBuzgeY7euaj5TWaGvtPgyLJQ34MZEwvTYHUMSLnLSHnUa5SAln5Xl4rBD00iOKzuRtwAIAHoz6DTii0g7bThFQd8/4420Ju5457+tSex+CDau8NBiKfw85uWw3ovxyQho03ZwnQNtmqf3NyEhpgBjBMc0MC/fCBrXADRCnt9M6gYhACr7ms3un5yBHYF+9Yl3MI14+nGSKtT1eQNC068GAyIiFx0LOGAdpobwZJR49f7mwbL3x7mMra7X+pMMlaaJ4cIiqlXSvBBY79+ORsEolOzBhFiaWmtH7gDBqo9oeuT1IMoKUQTo43XWKJsm1wRJQVHZ5mI9pHU7uffAWaVAdvXfAOAR09XvDr4tRC944kPXzkxs+hwFTVNvH5gItHcXm3eICHfvXIjF3d4VibCGsURj6vJ3IRD6PhDnd71jy9UsQ+3V1M27LsnCyGqNMZEiSC4uhbK8oMvjNVIVoYAA7LvBiRDWuHRHTHoN7+D2jSPf2y10c07xsED1erykNnvch3Ceb3MUCrxvGQFXkzubQLPXwREGtl8YR2NHgbdJGb5KJRSXOmUS/wClwoa/em/vDSHp7/vARTpuJHvruyghrvzmr0F3VF0x6wRsemcsFrBiCW1X4B1h5mnCxEWvwsBtavg9cFH7KPOusbqGb241FP4eMsLJwzZoNH78mF3ZyAdGAIG2XhIifzEERNJkwNKsOp6wCJVaUJwISpfJ3npkobNuXA129J6eE0y0NzZWmt/cAVdWs9GORHYERfxyj04IBlJcg3Q5Q7mAIKUeWqv9Z41pL5mQjlt/+MGVvUUeA0lb78YR4R93jwO5LmrYUwId3KeEa0pMNx2d42VNLRt93EjbOl2cBPZtKGr4mJZ9N4T3Brr7wRKYhRTZ1kbbqdYwJr24Vu973MLBcet0794tuis++ACFE3jJHrrJsnQSY7Exo1avcTziKrRKsMcpAlHejC7r+YlhQWyYKtE3r7wITNrBJ25Sh74I8EQzsGBEmnjSCOUaY2Ol8XNDUjc6ubQe2vbkgJSxrxjAhpwpUu8Q0v6ezAAA6MVCRwIAX+8idkUpvEEl8j/mbUJrU3gIGnCRZABV6yeqb/D6xsZLhkCCannlZY8NOzHsEa8dZQhk9bwANfuKG1nABdK7ZwKEim58DNB/pMj7LTX3wpUgUvXG9ArEvaIdM1jprOACFMID2Rk4SzikeSXEizFh2uXRdcpC9hTgIXt9m+EEjhd4GL4tk5YYWNZuBRejthMVPA6f3KKnr6wFKqnITFsjk9BhqAkGCoUBI+8o8KAr0GCAHSUymt4YtgU43C2uu1cKKsZm7wpCs+1nrCjMhDAaaaudgXe1qq8GDgck0PgvccinlJeLSwlm+nswhNrCryhFink52MsLtH1iDRt1T94jjVutb+AS10B+sK+pqG4esIi6k36+E+VkBp0e81tADACb35udaM26ryY1GlDSR/Fxw4EG/U++HHhIuQh1elxQVQMG3U4eZlV5bCEKO2uz+5NIVD05osTYmjDgRXsBcLvefhy7JhbAvb+chAO4ecuO2vbFj5oCjHXtOG6nveN8e86q4duinSRwyALz5gbXUr7wBepubxHUZvIaZ8B40f8As5m7gYF63ZuIiWY4BYG1dbIu19rgBXe/t4L5w9tbf8wKqKW+DOuYNu5zstLdMsyTXTHS+L4wZ+MA+/eNjO8NG/W8vBOlI/0eUEFBesEE7UnI1enrKe8diYDRs34EAhRySdXBlVoe3/swR2OL2IXCOxuSpiIL0Z2Bom83XZMkX2l50HoMAKI3zgUkH3ih28IoEWtN/FUL0z7YcSvZexw1NPoPWM850gP9wWAMWFyd1SzwA4GUxVOqIT/uTKyeijpQMn+zL06784g9g4I2YIyfMHtxUSNN7uIMp1wRm1NKmUmab7UN746Y7Fty9mCh0iYTFdHlwQu4bm9Eqh6rgFQCtcSdAYodhmlYCxzaPHUYrw43TvdHbJsRsg6rxNABXEVCAtPeAQxeERNnuXgAIEMpZd5tLAQS/mTmvCOKj0ZdC8J73ALEhHfTg6xKJ9+MBhIPnhsUOYPo6wJhCNPpwWCWizWvkY6jnd8OBVEej+3Jp6Yr8wkEaOxwx6LOAQI/RvDROHQCbe35jkIawEloAHQf+4bB6+Kx8Anwip7L+zF8HaMwQC7F/TNUdu5ij7qa5sFrtdBPXEVUrD9y8CuxWPUQjT8YVfigrYWg+MmUho4IPXx7PWEdyToMLN5Iz0Ib252D4GW0s0euKwTUa4qBRWo+/ig/FIohvEtunTSOsAh+hH/5M3T1idFsmT0UCjA7j1TycVHWRE2OTO9lyFvmTEomCp6JfMxLNpgBo9r/ALm8JRpxBzZaenLLCwfiG8I06CO8LesH2ZApY046YvQejCQWGqdnq4Xy04AKhMqdL94ihui6w0JbE8D6zW5ROnTvjR1oCLrAmjAatUu3HCQAVN/WXYRxFAKoHDXKwfQ85IhANenAMEPWeIh2v/MjKiI7MDHZq1O+KCJK9HBC3e9fRwkFbB/FnCwFK1vXIKgHtwRFLsV7w+8/MdhCfprog71j36P7BkbdN8+bJpEvw7mSshPgmwkjGxmJQRHyciaKbQ6wGvpn7eCFrtYt4AtAFO5h70u/85DxHuHXwoJKE698qx0TVmsMLR4tQsOjECqEua7w2EnpxhSMaHNz7xsGh2LkXwqvtXzgS7Xh2aU4povfIqAAfgLUk0Xv25KGPTbhQCPv+8KKBWswZw6V7zd+sQqN6usEs2m+Qd7XgRKNOISTsv58HQienAwZW0GXF6OJwoVwQCdPMfZJjVCGp+3AaUzcwp4uHazvWBYI+zEwF5D3MfpCGXAAMfJDDRcTW68OrQqsA9udQda8ezdymx4LQD9L+MtLzoCQFOQZdOb0j4XKRUo/sxBQD24q9Eu/zjo2ne+jGmkvlNGAFB4IwaPmue24oFXEqBIvlfv8MLC94obWZrkSO9DCmYCiSbMDW9i/TnaK0Wk7xz10UPlcECGki964u0zTvVv0XfnB2xkS9nGixud4bcLYahbQdh9prIPQgkjij5NPLq6wcX7TDYe8464m7A9etsQkrojswAQAfWLMaMTcPSuVRBfBrWBNAAGsQSJTEBu5cRolMM3pr0OgeERQQbs84EujbyDelTrQ7xsoBbHrKVIe5T5s4N4CBGacZBCIaqPbebBVqu8QRHOtGaSIxBdMOrZ9evhN1Kyv1Xh7BIq7++AgAO7zdhiOpFLvfDOu91ov3xpibMPQthU2XqWYUMrgu0nbxCrNuaJour6ykFlpaTriULxRckT9d8bSRr8bxITAp4AwzekpcWCsA5Zalte8khY9B51/XPSQP1cYEO5+75aqdtHTcF1Bd31zpTtV+vJM+gw0ECPpz8yjS9cR97Howr9CWhSuvGmCHGlVNcM85PI9SXWFSEm/Dg2/TOEomDYLCVyJ1a4KMbVPg+5NhhyoOsVGNzuJ5/5DhUR3g9HBEEROHAaQv8eDBGxGM5D2q3qTDsTpOWx0s1cigSxdDgKnluKiJ+jL1BrvfRjovUjw5CrNuK1CtfZko7Tv6Os1NLsNZsxeGK6awwwnyP8A4cnahsneautp38Nfq/25ulLqOIVPhpwIigPL5/MSLJ+m8fhp/bnRE02TbmoXo6pjSRG+P1jkdi4GxouEAr0cEVgGaTG6hd8DIBZeNMmhbtH+TIEh6vTkqh9COIKQOhXCQYooZDA13eg4qOl8XGxkswpGzNs1kEDPQYHhtSuxxN4h29uU2CXBGh4zaA+ho4FTZMrQJHfIKpvzF/xn3EWzWLBbQTSmnLYRe5igUgYIANHExJLo+sOoFfeN1C7z+8FUsdB9OFhe81G5Gzwyrtdi3jehTU4VDRdmENGvBjR7CXDFpQ0GzNGCoXy4oFdG8ZWViU8fWAABkNM2Yzia6Su/vFCbJOzBEo3NpvTeRt+jT2JrEBAJ95oMdA1tInEFFNmAFQla8EsCqHNrb1lJzCQeyHzwdEnVM3C7Av8AcRraXBpBNdGEQsfZMQezIxT6l1+8brvDapPHyXsEbrV4SVBXiCsC9uSFB9YoCvRh+Z0XWHU68+DhFIJdq9cIUO3rDGzTHOjTs79fOWfoVxB7MLu+9YQBACLE2P6ZSp5wAQAZr+X/AAxYKbmEX6R5nEhIZ0eOWBJo37zY/wAXmuAFFEjmwhn85ZgateFbCA68OMnwx9BjQGOnscmKt2QNuj75QCijj3IcKNbS+AbcpQ852+576fg3wXEGmDS9Vw6M2r0CHaGObprWvwzoEguJRLMCAqw78uO9NdjCOEItK14mgh5nnGZJpVeQm0QGAToGXTvKbnP/xAAeEQACAAcBAQAAAAAAAAAAAAABEQAhMDFAUGAgUf/aAAgBAgEBPwDRn7wgF8YFUAVNOGFbXyyhBLPID0Cq3//EACYRAAIBBAICAgEFAAAAAAAAAAEREAACITEgQWFxEjBRAxMiQoH/2gAIAQMBAT8AIyCz64scNUGs0AoEvgSRrfDuhoOi4LWJGs8LDg2t3WoGO4Li5rErvRhtjk5S1XVYKKrSH1oveOJaQ4qg+zxyxAksaFA5IolAmh5ovqDsZoeo1WfximXqgWKuv+JsCfyKjMfyFxLYWvPBjXABGQ3kf7zutFwNtwYNAKM9UPSg+xReEKvt+YNvyNpOiKFlwuB/cJtS+JhZEEMuSMajukzsigCNlwAnACZjBpZ1S5PxHih6kPvfF+IfiPUeOIF3Z71y3wP09znHC4kWk2hlV+nabLALrjcdkmQoNZ4F6hhqO6Gk6XmCGFICCrVBdRrGs1sYNLMEaMEMLi91vR4+uIOA/oHBBviUccgANSX0Y3n8cbsBiDqhRDi60XJ9Hj/YDxB2A4WXCG5//9k=";
+ 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAQEBAQEBAQEBAQGBgUGBggHBwcHCAwJCQkJCQwTDA4MDA4MExEUEA8QFBEeFxUVFx4iHRsdIiolJSo0MjRERFwBBAQEBAQEBAQEBAYGBQYGCAcHBwcIDAkJCQkJDBMMDgwMDgwTERQQDxAUER4XFRUXHiIdGx0iKiUlKjQyNEREXP/CABEIANgBVwMBIgACEQEDEQH/xAAbAAEBAQEBAQEBAAAAAAAAAAAAAQIDBAUGCP/aAAgBAQAAAAD+/GmdEoSwpx7IqFITSLFlSwWC559glSwsWV5+5ULAzoce1Ss+X12JqSblxuLKhZjdIoBPD7dQqJbz6GNKhZZRLKmbazVSglM6iNRUmoLKElsqKgsWBjWksCUsBy6gqVLCyyyosCoFJSAVFlhUssUxoqFILJb5u9sqLjn3cOukpM6pjRm6nwPvqIKioqeb0gVAqVOE9FlioE1EVRJoixUsWUSaizO/g79vtRbOPeBYPJn3HPpHHsWC8estEqWCxZFolJKVnUWKJRAKZtEoIAAsmhhqwVFgzdMtJQlZ0ebvolJRFZazLpKSpSLAssqUzpKRLUsoIsUk1KJZ8D9BCys0qLDj2KikLCxx66lQsRQFJUuNzl2iUvPpLKiakm4mpcblzVZtRSFDNWRqWLJaEY6ZoqUis0irFSiJqLnTNVFASahc0WKlgCpLZZYMbCaRx7xUlMdCLJoJSBYFAgBZUM6rE6JU+d9FSWSjh3sVm0//xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/2gAIAQIQAAAAAAAAABrIAAAAAAAAAAFhYAAABUALAAAAAAWAAAAVAAAAWAAAAAAAAAsCwWWA/8QAFwEBAQEBAAAAAAAAAAAAAAAAAQACA//aAAgBAxAAAADOhikpEkRoqpGufQSmKmoShRJqJokkqqaiqSYrOxxpJHOrOhoLRIZug51CZ0jlpGoSYmhKRhzqqGKaoRhINIkkaEqpEcsiMVNQlUiTVDRI0MI0GinKwazoRv/EACwQAAECBQMEAQQCAwAAAAAAAAECEQAQICExEjBBA1FhcSITQEKBMlIjkbH/2gAIAQEAAT8COLQgrLhaGbnvMvwJ53XEvkCbWoDzw52sycDb5h7Q63/jaAAHYZl+qTZ4SG97b3EOeBHufFLa1eBUbNAgTcYgeJlQTSFPGYFXTWVJDm4JSYORRZwaAdWKFq0ywfdYvw0AaZcwU0MIsLUJ/LYUr6awNHxV+XYwU3BkYaBa1DDLUHj3QUkxcDvDzbNTvg7YBSfEP3gXnpYqIOYGpvkz+KMHOafFQDSbEjqcNzNrg7LYhz/WhrgzHiSSrmY42ceYHrYPeWopy0w+wS0yHqHMHU7ho1ZtLtsgu8wG+wvxJnzttX5Eg/MmA3nm4oCjYHMNJqDa5jNeZOBQpWh1H+IEJOpLszxiWJ92mU31PCnBe0+rgQgTIekAh3jzQSAzmGfVquk8SIeACEkQk8Wn03+p1EqNgbGhmmoagUnBgg2aPG6U6bgmp3jFD52up0h1AOCOYTqw7gZel2tSS0XeYIUARQA1ApUl/dPqtnIOy0JGl+1X5e5db6yBq6Q5vCup1umgKKdR5aOl1CsF0kHzO7QmzzOLQHSb0swhgbxiSmgXhUA9S8BasNQRdz3oKVObwMUNd4zaNIE9J02kkvVjYzIh+ZtcQHDvDsr3V5qzmkBufuH+wvNxq0nJkRahpm0y7ECGs0A5mHa/eGP9qh8Xm1ALzu5MXH7M7uIbsYv3qNqhietuonpgO/MAu9APigBqBzTzmZtBUfjbNBPihrvM2EZ2OIAA3NVyNlrvuhuJlufsOgrqrUtSiPp8SZPagMLDb/5QolwE7ANAFrwwnaPNHVRqQUjnPqAwAADCpxaO1F3EMKPE3kMl81G8kGxeXLRd/NCkqOC0e6EZVsAcPzCn1JkYPuA/NCUqGaOoMf6oKmpbS7U43Ap7UEYPMarqcMBzAIUHBffF+IZ4zplqAzPkCge6ez08iTNaBiQIOJYgY9z/AHTfaIFng4gETekz0pmXs1SW4jUxudkWmABiYfmkyUlxAGw8lXDDZHMtPesrZTKYDgvLMkgh3+1fn7Jgcze7UX5qKmIDWoJIZhHyI7Xmyhg0fT/yg/iE48195G12gFxRqUW+Mz7gPzNQyeYxHE//xAAoEAACAgICAwACAgIDAQAAAAABEQAhEDFBUSBhcYGhMLGRwdHh8fD/2gAIAQEAAT8hEty9S87oBY+MGwgVCDkyQAIM9Lieh4NC8f1Nx7dQABnvAIUCMW285tm4RNhZQQFme/F7m4+DvqH5CtuDg7BWQ+cn1A1e/Ch7GArm/nMYKH3JSmlDM/cbvh3OUqxb9YNHFce5bKt+sF0vC368CAQjqcHRcNgsHeptJg9TRV8U9q4XxgviES12fcF8eBkj4aM5W7hsEumVklPxFS0Gdx+AJdmvUAq8mp1CBtCY3qv8YBPWTYIhrEPdJEMpBGSQNmB0L1k6nO88y36yQhfGsBCsryKrh3BZzFjbZeEWLrqNK49QWHkk2JoAbcrnIEEjya/gawOZ4e2Ma1gGNqGnuAHBs34JoAgLAMrjAl/InwuAdCvsoU3MIBDk5Qj2l0vAhjagAOjwIHPkWioYBtP3OSJQkY1ghwO613YCn/kjwYs9Qn58KFP1jrwRTrCUKrWDBltroT7g/A8ULOCVxjopQqCLBuECn3DsEsEW/UAAQWR1CAx/5wbBgEAK9+BD3kF8KINq4HS/aETtMK3AAKGEG81CGxDYIEIaDoFASXSwkFsl5D5wsAIJuLvFsaUAj4wQ6PgVgS0YAFsLcDIHDWCC+k7wXxlUhURYLw+C1PkDV7gBQljX7lEr853ggEIjwJAXvHcIYRgeqrUOlPbweADki2K7ifMdM+C55wgL8AXNa7wQQUBneKNX6l3r1AwgsEOjA9Es+HKmmQL8GGucEBzys3J5LRW4uN7vqFiL1xggSCePAgB0AMygB2Nzk14bvAI0ODs8xg6yw/dKhwlQe3RgAHAABDO7Li5wdQt1xCC4hzkGZojiBAfd3HgAI+ATfMNGVGC9F4IggSQAzsw1CQVNYUIajBj6YYi1FrInUoRaLmsgGXOQ9JIbeAAQxDdhsZYa8qsj54EYcOoB34gdYANMhWhzO7gryK0efAIkkpgdiAF4Qs3CJNECQd9ZKqpQ+xWE0NZ1tnLEu/XPzkDbX48N0YK7QcwNBp4oYLNEPcAQAww14EOqh9HJFjXil1vcKYOPWGDzCQLJwCAm/wDhg1ANOW+YB0JQWHkUC3koV24AUH9yxL+kAC5B/Rw7WDYIgBVoQnUuAAEIhKLOrhID3BJAQ/6hxBArjUZbWjihORcIScVQevAkgIAaZhPRQ0DlfalCmISgRScIB2MelLcLW7hRsHyAAIZKV4/qIWe94BFhg1KZLE65g3buoSVsB+R5IPt4DZwQijncJAIHeSM2wSBvPHUH2/4gN3D0m4XxLxwrgIIYwAOsczndfxEPRWB2lFax9xy5zRDHRw8Q7bcdrKC1eSCUbrGxKIvUaw2twhLBIwgHAEX2EA+wby3qH1OYCG6bmxrBAt4WEGjjRfcF9Q0oSUcgH4wABqHV1zCbBKLP7gCYesXgkaxbFVkkCzAGpf3LmPaWoCFIUkag+ZIWyH3wQXgT/LA95o9w4yW3XXMSLk/U6yQEIj4Gjpk7E4CAYwSg41vBAOxC1W8EHkj6g1D+C2X+PAMRsf1l2fUYOAANCWyxXGOeSeuh/AXwPAgEIxLPL/WQIPhN5Vuc+oCDYjGnLh1uHYRHuf3A1e4ha3vBIAJYq4fa6xR4rBcAQZv/AB4AY5CGFC1W5TXJjA2Z0saZcGrMRe9NQrnjIuy8iQwO4CDqMforJfEJXY7iuMjYPXcCNB8x7gIOoSr1bmB6BA68mN3qEoh34cq0P3DcTzNawUETCr7bygKicEvC3PCwn4AgXBBg5O+oQoK/mHa0Khz0Gh7gCzwI/uBrTwHm1WAFzhevAgp2fiGCBWCQaP4jJhAoJcgtZL4hmzB34M32R/lghkHrD6AfJgLAPgDBVcCMV78NOTHTyrBeoXSWQAGvuSUHHCQRAfg8g0MBJSwR2/8AIuIPWeXHZCPgKAED536wQCj14EhacGEARERYCPYwwqfck/Tz4AQ20tnrPyMih9rAChoal1UJIAqPOEIhQNwSLbhKm0Y0KEJgSciCSDQCF8eG3CgLGlFrDL1A+Ri36lv1N8QQk6B/coR6hXIrceA3BH3LB5wDUfEBYa/zDQCP3hhp3CCjB9Y6c0KiQR+cQg6MkogI3kkDZyCf/GOwEYgZoE1Zm7jhRR914WC7xoED/cALSeEElWaFCWBVmAv/AHCATO5q4Kvrlo/Y/XizLgze4FJ2DYPj7IXGNjHZsesAiwMYv1HFGTxjioCw8cvN35ENXj5ipRwAIHAwk0AHgukMKlrJfHmAuSfuSggNu8a1E9qeASdhYDCmXuW3woQ6hXMdpbFVhWC5uASYNh/2ZLBcXr1ndTZjhFpjv7i368SWg3ioixj0q+oGg940IOlQAjZeAJ6TZ7V8yEoGqcAAfIbpn//EACQQAQEAAgICAwEBAQEBAQAAAAERACEQMUFRIGFxgZGxwdGh/9oACAEBAAE/EGlXWVM6uGQE3fkffBUoPkwk2G/x++TCo6c0MqHbx+Z0Q6NB8EWWjFCVC6MVI67VXrBAIiZrQQMrihG1Xhc0nYPAC09FS/p9cgFUj0esuJ9Qe/vnYRhZ2zIX2nee78AKDwxwQUR/MOiGtQ4pImswNNpP9OJiddXBuzgeY7euaj5TWaGvtPgyLJQ34MZEwvTYHUMSLnLSHnUa5SAln5Xl4rBD00iOKzuRtwAIAHoz6DTii0g7bThFQd8/4420Ju5457+tSex+CDau8NBiKfw85uWw3ovxyQho03ZwnQNtmqf3NyEhpgBjBMc0MC/fCBrXADRCnt9M6gYhACr7ms3un5yBHYF+9Yl3MI14+nGSKtT1eQNC068GAyIiFx0LOGAdpobwZJR49f7mwbL3x7mMra7X+pMMlaaJ4cIiqlXSvBBY79+ORsEolOzBhFiaWmtH7gDBqo9oeuT1IMoKUQTo43XWKJsm1wRJQVHZ5mI9pHU7uffAWaVAdvXfAOAR09XvDr4tRC944kPXzkxs+hwFTVNvH5gItHcXm3eICHfvXIjF3d4VibCGsURj6vJ3IRD6PhDnd71jy9UsQ+3V1M27LsnCyGqNMZEiSC4uhbK8oMvjNVIVoYAA7LvBiRDWuHRHTHoN7+D2jSPf2y10c07xsED1erykNnvch3Ceb3MUCrxvGQFXkzubQLPXwREGtl8YR2NHgbdJGb5KJRSXOmUS/wClwoa/em/vDSHp7/vARTpuJHvruyghrvzmr0F3VF0x6wRsemcsFrBiCW1X4B1h5mnCxEWvwsBtavg9cFH7KPOusbqGb241FP4eMsLJwzZoNH78mF3ZyAdGAIG2XhIifzEERNJkwNKsOp6wCJVaUJwISpfJ3npkobNuXA129J6eE0y0NzZWmt/cAVdWs9GORHYERfxyj04IBlJcg3Q5Q7mAIKUeWqv9Z41pL5mQjlt/+MGVvUUeA0lb78YR4R93jwO5LmrYUwId3KeEa0pMNx2d42VNLRt93EjbOl2cBPZtKGr4mJZ9N4T3Brr7wRKYhRTZ1kbbqdYwJr24Vu973MLBcet0794tuis++ACFE3jJHrrJsnQSY7Exo1avcTziKrRKsMcpAlHejC7r+YlhQWyYKtE3r7wITNrBJ25Sh74I8EQzsGBEmnjSCOUaY2Ol8XNDUjc6ubQe2vbkgJSxrxjAhpwpUu8Q0v6ezAAA6MVCRwIAX+8idkUpvEEl8j/mbUJrU3gIGnCRZABV6yeqb/D6xsZLhkCCannlZY8NOzHsEa8dZQhk9bwANfuKG1nABdK7ZwKEim58DNB/pMj7LTX3wpUgUvXG9ArEvaIdM1jprOACFMID2Rk4SzikeSXEizFh2uXRdcpC9hTgIXt9m+EEjhd4GL4tk5YYWNZuBRejthMVPA6f3KKnr6wFKqnITFsjk9BhqAkGCoUBI+8o8KAr0GCAHSUymt4YtgU43C2uu1cKKsZm7wpCs+1nrCjMhDAaaaudgXe1qq8GDgck0PgvccinlJeLSwlm+nswhNrCryhFink52MsLtH1iDRt1T94jjVutb+AS10B+sK+pqG4esIi6k36+E+VkBp0e81tADACb35udaM26ryY1GlDSR/Fxw4EG/U++HHhIuQh1elxQVQMG3U4eZlV5bCEKO2uz+5NIVD05osTYmjDgRXsBcLvefhy7JhbAvb+chAO4ecuO2vbFj5oCjHXtOG6nveN8e86q4duinSRwyALz5gbXUr7wBepubxHUZvIaZ8B40f8As5m7gYF63ZuIiWY4BYG1dbIu19rgBXe/t4L5w9tbf8wKqKW+DOuYNu5zstLdMsyTXTHS+L4wZ+MA+/eNjO8NG/W8vBOlI/0eUEFBesEE7UnI1enrKe8diYDRs34EAhRySdXBlVoe3/swR2OL2IXCOxuSpiIL0Z2Bom83XZMkX2l50HoMAKI3zgUkH3ih28IoEWtN/FUL0z7YcSvZexw1NPoPWM850gP9wWAMWFyd1SzwA4GUxVOqIT/uTKyeijpQMn+zL06784g9g4I2YIyfMHtxUSNN7uIMp1wRm1NKmUmab7UN746Y7Fty9mCh0iYTFdHlwQu4bm9Eqh6rgFQCtcSdAYodhmlYCxzaPHUYrw43TvdHbJsRsg6rxNABXEVCAtPeAQxeERNnuXgAIEMpZd5tLAQS/mTmvCOKj0ZdC8J73ALEhHfTg6xKJ9+MBhIPnhsUOYPo6wJhCNPpwWCWizWvkY6jnd8OBVEej+3Jp6Yr8wkEaOxwx6LOAQI/RvDROHQCbe35jkIawEloAHQf+4bB6+Kx8Anwip7L+zF8HaMwQC7F/TNUdu5ij7qa5sFrtdBPXEVUrD9y8CuxWPUQjT8YVfigrYWg+MmUho4IPXx7PWEdyToMLN5Iz0Ib252D4GW0s0euKwTUa4qBRWo+/ig/FIohvEtunTSOsAh+hH/5M3T1idFsmT0UCjA7j1TycVHWRE2OTO9lyFvmTEomCp6JfMxLNpgBo9r/ALm8JRpxBzZaenLLCwfiG8I06CO8LesH2ZApY046YvQejCQWGqdnq4Xy04AKhMqdL94ihui6w0JbE8D6zW5ROnTvjR1oCLrAmjAatUu3HCQAVN/WXYRxFAKoHDXKwfQ85IhANenAMEPWeIh2v/MjKiI7MDHZq1O+KCJK9HBC3e9fRwkFbB/FnCwFK1vXIKgHtwRFLsV7w+8/MdhCfprog71j36P7BkbdN8+bJpEvw7mSshPgmwkjGxmJQRHyciaKbQ6wGvpn7eCFrtYt4AtAFO5h70u/85DxHuHXwoJKE698qx0TVmsMLR4tQsOjECqEua7w2EnpxhSMaHNz7xsGh2LkXwqvtXzgS7Xh2aU4povfIqAAfgLUk0Xv25KGPTbhQCPv+8KKBWswZw6V7zd+sQqN6usEs2m+Qd7XgRKNOISTsv58HQienAwZW0GXF6OJwoVwQCdPMfZJjVCGp+3AaUzcwp4uHazvWBYI+zEwF5D3MfpCGXAAMfJDDRcTW68OrQqsA9udQda8ezdymx4LQD9L+MtLzoCQFOQZdOb0j4XKRUo/sxBQD24q9Eu/zjo2ne+jGmkvlNGAFB4IwaPmue24oFXEqBIvlfv8MLC94obWZrkSO9DCmYCiSbMDW9i/TnaK0Wk7xz10UPlcECGki964u0zTvVv0XfnB2xkS9nGixud4bcLYahbQdh9prIPQgkjij5NPLq6wcX7TDYe8464m7A9etsQkrojswAQAfWLMaMTcPSuVRBfBrWBNAAGsQSJTEBu5cRolMM3pr0OgeERQQbs84EujbyDelTrQ7xsoBbHrKVIe5T5s4N4CBGacZBCIaqPbebBVqu8QRHOtGaSIxBdMOrZ9evhN1Kyv1Xh7BIq7++AgAO7zdhiOpFLvfDOu91ov3xpibMPQthU2XqWYUMrgu0nbxCrNuaJour6ykFlpaTriULxRckT9d8bSRr8bxITAp4AwzekpcWCsA5Zalte8khY9B51/XPSQP1cYEO5+75aqdtHTcF1Bd31zpTtV+vJM+gw0ECPpz8yjS9cR97Howr9CWhSuvGmCHGlVNcM85PI9SXWFSEm/Dg2/TOEomDYLCVyJ1a4KMbVPg+5NhhyoOsVGNzuJ5/5DhUR3g9HBEEROHAaQv8eDBGxGM5D2q3qTDsTpOWx0s1cigSxdDgKnluKiJ+jL1BrvfRjovUjw5CrNuK1CtfZko7Tv6Os1NLsNZsxeGK6awwwnyP8A4cnahsneautp38Nfq/25ulLqOIVPhpwIigPL5/MSLJ+m8fhp/bnRE02TbmoXo6pjSRG+P1jkdi4GxouEAr0cEVgGaTG6hd8DIBZeNMmhbtH+TIEh6vTkqh9COIKQOhXCQYooZDA13eg4qOl8XGxkswpGzNs1kEDPQYHhtSuxxN4h29uU2CXBGh4zaA+ho4FTZMrQJHfIKpvzF/xn3EWzWLBbQTSmnLYRe5igUgYIANHExJLo+sOoFfeN1C7z+8FUsdB9OFhe81G5Gzwyrtdi3jehTU4VDRdmENGvBjR7CXDFpQ0GzNGCoXy4oFdG8ZWViU8fWAABkNM2Yzia6Su/vFCbJOzBEo3NpvTeRt+jT2JrEBAJ95oMdA1tInEFFNmAFQla8EsCqHNrb1lJzCQeyHzwdEnVM3C7Av8AcRraXBpBNdGEQsfZMQezIxT6l1+8brvDapPHyXsEbrV4SVBXiCsC9uSFB9YoCvRh+Z0XWHU68+DhFIJdq9cIUO3rDGzTHOjTs79fOWfoVxB7MLu+9YQBACLE2P6ZSp5wAQAZr+X/AAxYKbmEX6R5nEhIZ0eOWBJo37zY/wAXmuAFFEjmwhn85ZgateFbCA68OMnwx9BjQGOnscmKt2QNuj75QCijj3IcKNbS+AbcpQ852+576fg3wXEGmDS9Vw6M2r0CHaGObprWvwzoEguJRLMCAqw78uO9NdjCOEItK14mgh5nnGZJpVeQm0QGAToGXTvKbnP/xAAeEQACAAcBAQAAAAAAAAAAAAABEQAhMDFAUGAgUf/aAAgBAgEBPwDRn7wgF8YFUAVNOGFbXyyhBLPID0Cq3//EACYRAAIBBAICAgEFAAAAAAAAAAEREAACITEgQWFxEjBRAxMiQoH/2gAIAQMBAT8AIyCz64scNUGs0AoEvgSRrfDuhoOi4LWJGs8LDg2t3WoGO4Li5rErvRhtjk5S1XVYKKrSH1oveOJaQ4qg+zxyxAksaFA5IolAmh5ovqDsZoeo1WfximXqgWKuv+JsCfyKjMfyFxLYWvPBjXABGQ3kf7zutFwNtwYNAKM9UPSg+xReEKvt+YNvyNpOiKFlwuB/cJtS+JhZEEMuSMajukzsigCNlwAnACZjBpZ1S5PxHih6kPvfF+IfiPUeOIF3Z71y3wP09znHC4kWk2hlV+nabLALrjcdkmQoNZ4F6hhqO6Gk6XmCGFICCrVBdRrGs1sYNLMEaMEMLi91vR4+uIOA/oHBBviUccgANSX0Y3n8cbsBiDqhRDi60XJ9Hj/YDxB2A4WXCG5//9k='
export default base64EncodedImage
diff --git a/packages/dnb-eufemia/src/extensions/payment-card/utils/backgrounds/youth.ts b/packages/dnb-eufemia/src/extensions/payment-card/utils/backgrounds/youth.ts
index 5cdcd98422b..47d58adf97a 100644
--- a/packages/dnb-eufemia/src/extensions/payment-card/utils/backgrounds/youth.ts
+++ b/packages/dnb-eufemia/src/extensions/payment-card/utils/backgrounds/youth.ts
@@ -1,4 +1,4 @@
const base64EncodedImage =
- "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAQEBAQEBAQEBAQGBgUGBggHBwcHCAwJCQkJCQwTDA4MDA4MExEUEA8QFBEeFxUVFx4iHRsdIiolJSo0MjRERFwBBAQEBAQEBAQEBAYGBQYGCAcHBwcIDAkJCQkJDBMMDgwMDgwTERQQDxAUER4XFRUXHiIdGx0iKiUlKjQyNEREXP/CABEIANgBVwMBIgACEQEDEQH/xAAbAAADAQEBAQEAAAAAAAAAAAAAAwQCAQgFB//aAAgBAQAAAAD1FhM8kccMccqcdfTZd9D6H0fo/Rvvtsoc4AAAA/IcKnkjjijkmRjTqrLr/ofQ+j9H6F9tdL99AAAA/H8KnljjjklmUpjqq7rvofQ+h9D6F1tlNOgAAAD8bWpE0kkksyFY26mu26/6F/0L7rbKXb70AAAPxTKkzTSyzTpWabTXZddfffddbXQ5ndAAAB+G5UpE086EJz3Taaq7rb7r7bbKqHM33oAAB+DZWpKUISpXOsa+my222662yumhzN6O9AADz/nClpSpWMHWtfTXZZbbbZZVS9zd90aAADzxnC8LUvGeGmOfTXXZbZZXXVS9rd6700AAecOZxjGMZ4d211FNVddldldNVD3M3s0aAAPNBzOOZzw7pjX0U1VV2VV1VUUvYxmzR3oAHmLJzJwO6Yxr6KaqqrKq6aqKHMZvfe90AAeWjgAa1trXPoprprqrqppoc5jGa7o0AAeUw707rTNtc+iimumuqqmqh7nMZvuzvegAeTQ7rutsYxr6KKaaq6qaqaaHuY3e+76aAAPI53utbYxrXvooqqqqqqpppoc1rN71oNAAHkA1rW2Ma5z301U1V1VVVU0Pc1rN67o70AA8dd7vbGMc976aaqqq66qaqaHuY3et97oAADxp3etsc5z30U1VV1111VVUve1jN61o0AAB4v1re2uc+iimqqquuuyqqql7nbZrXdd6AAB4q7pjGuofRTVVVZXXXZVVXRQ1rd61070AADxLrTGOe+immuquuyuyuuuql7ms1rujoAAB4iNsa59FFNdVddllldlVdVL3NZ3WtAAAAeHu72576Kaa667LLLK7K6qqXtazW+9AAAA8N63tr6KaaqrK7LLa7K7KqqHubvfdgAAAHhru9ufRRVVXZXZbZXZZXXTQ97N77roAAAHhnWmOe+mmuqyy2yyyu2umqh7mM33XQAAAP//EABsBAAMBAQEBAQAAAAAAAAAAAAADBAIBBwUG/9oACAECEAAAAHOptsrdxE0sciFcAA22quyp+VIlklnXwADLaK6qnC0zzToXkACVtFFVLdcWlCFLzwAPmMdTTQ7ZxalqxnnAD4G30Uve3RzGMYzzgB+T26imihzNnM5znnAD8Ixz6aqKHN2c5nnOAHmrHUVV000uZs5zmQA8mY+mq2uqqhrNGecADxlj6rLba66aG64ZAA8OY+y2622yqh2znAAPB2UWW33W210O33gAB4Iyiy66+62uhzAAAP/EABsBAAMBAQEBAQAAAAAAAAAAAAADBAIBBwgG/9oACAEDEAAAAPwLaKrK6H773nOcAAPwDKKq66Ws105wAAPPWPqqroezeu8AAA85Y6mqql7Wb10AADzTb6Kaanvazfe9AAPLWOfVTTS9zt710AA8l26imqqqh72b33oAHju20VVV1VUUO3vXQAPFNuoqrsrrpoe3ewADwpjqa7K7bKqaGs10ADwLb6q7bbbLKqGs1oAD5826uy6262yqlze6AA+dmPrtuuutsrpezfQAPnRlFVt191ttdD276AB//8QAHRAAAwEAAwEBAQAAAAAAAAAAAAECAxESMBAgQP/aAAgBAQABAgBjKLLLNDQsssfxEkGZmZGRkZGRmZkEkiJ9m2U7LdmhoWWrH8SlQs1mszMyMjIyMzMgkQvdtuy3ZZoWWUmuJUqFms1ksjIyMzIzIJIJ9+W6q3bt2WWUqVJSlKhQs1mslkZmRmZkEECZPr2dVVO3bsstUqXHVTKhQoWazWazMzMzMySRC9nTp1VVVOyiilS69VMzMwoWazWazWazMyCSRC+J+fZ06bp06KKKTXHCmZmYULNZrNZrMzIIJJJaF69nTp1Tp0UMaa4SlSpmFChZrNZkGZBBJIhC/Cfg6dOnTpttj+8JJTMqFEws1ChQoUEEkkiF69uzptttj+8JJSpmFChQoUKFBBBBJJIhCEL4vDt27N88tjOBJKVKlSoUKFChQQpJUkkiEIX1eHZ1255555+ISSlSpUKFChQoUKCCSREiEL4vLt27c888/EIRKlSoUqFChQoUKCVJIviEL07dlXbnkQhCJJJUqVChQoUKFBChSSIQhCF9Xh27c9k0000IRJJKhSoUKFChQpIUkiEL4henbsq5TTTTQhEkkkEKFChQoUqFKlSkIQvi+Ly7du3KaaaaJJJJIJUKFChQoUKFKlJJISXxfUvDt2TTTTTTkkkkkggghQoUKFChSpUpCEIXxLy55TTTTlySSSSQoIUKCCFChQpUqUkkvwhefPPKaacuXLkggggghQoUKFChSpUpJJfF9nz7c8py5cuXLggggggggghQQoUqUhCSF+F588pppy5JckkEEEEEEEEEKCFJJKQhIQjjz55TTTly5JIIIIIIMyCCCCCCCRCF/DzymnLly4IIIIIIIIUEEEEKCSRCEIQvdCE5ckEEEEEEEEEEEEEEEkkkiF8XuviE5JJIIIIIIIIMyCCCCCCSSRC+IX8CESSSQQQQQQZmZmQQQQQQSSIQviF7f//EACAQAAECBQUAAAAAAAAAAAAAADEhUAEQQGBwESAwUYD/2gAIAQEAAz8ApBINAcxl5b7RrRvSOLtbAh15THCNwpf/xAAdEQEBAQEAAwEBAQAAAAAAAAACAQMAERIwECAT/9oACAECAQECAJx4XOii+bVXz58+XX4Smi5oIL2qSddfPl1+ERQQYZcddSSr5devwjLLDDOk0960lVV16/CMssMaHSOP3qttvX4zSaHQ6HQ6HSP39rbbb+3+ppNDodBodC44/bz5v5fh/odDodDoNCyyopfP5fh/pNDoNBoGGGUVL589fhNDodAwwwwgjZZ/F/uaFjQPN5rNBCimy+fj7FhBZrNZ0UUU9PnEaLnc7nc7nRRx6fOceHZ9n2fZ9nw4cePz/8QAFhEAAwAAAAAAAAAAAAAAAAAAMUCA/9oACAECAQM/AIhCf//EABsRAQEBAQEBAQEAAAAAAAAAAAIBAAMwERIQ/9oACAEDAQECAMcMMMMdNP7fOY4UUUU2WX76fZRRQggopZZfvlKaUEEEUVLLL5xRFBBBFFGyyy6eMURQQQQRRRUss8ooywwgggjTTZp5fuIsIIIIIU02aaaeEUZYQQQQQopx008f2UUEEEFzoopx008Yoiggua53nRRhTpp4xRCi87zvO87zwwx008ZTRRRed57nhhhjjpp4TTDc9z3Pctz3PDDHHTx//8QAFhEAAwAAAAAAAAAAAAAAAAAAMUCA/9oACAEDAQM/AIjCP//Z";
+ 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAQEBAQEBAQEBAQGBgUGBggHBwcHCAwJCQkJCQwTDA4MDA4MExEUEA8QFBEeFxUVFx4iHRsdIiolJSo0MjRERFwBBAQEBAQEBAQEBAYGBQYGCAcHBwcIDAkJCQkJDBMMDgwMDgwTERQQDxAUER4XFRUXHiIdGx0iKiUlKjQyNEREXP/CABEIANgBVwMBIgACEQEDEQH/xAAbAAADAQEBAQEAAAAAAAAAAAAAAwQCAQgFB//aAAgBAQAAAAD1FhM8kccMccqcdfTZd9D6H0fo/Rvvtsoc4AAAA/IcKnkjjijkmRjTqrLr/ofQ+j9H6F9tdL99AAAA/H8KnljjjklmUpjqq7rvofQ+h9D6F1tlNOgAAAD8bWpE0kkksyFY26mu26/6F/0L7rbKXb70AAAPxTKkzTSyzTpWabTXZddfffddbXQ5ndAAAB+G5UpE086EJz3Taaq7rb7r7bbKqHM33oAAB+DZWpKUISpXOsa+my222662yumhzN6O9AADz/nClpSpWMHWtfTXZZbbbZZVS9zd90aAADzxnC8LUvGeGmOfTXXZbZZXXVS9rd6700AAecOZxjGMZ4d211FNVddldldNVD3M3s0aAAPNBzOOZzw7pjX0U1VV2VV1VUUvYxmzR3oAHmLJzJwO6Yxr6KaqqrKq6aqKHMZvfe90AAeWjgAa1trXPoprprqrqppoc5jGa7o0AAeUw707rTNtc+iimumuqqmqh7nMZvuzvegAeTQ7rutsYxr6KKaaq6qaqaaHuY3e+76aAAPI53utbYxrXvooqqqqqqpppoc1rN71oNAAHkA1rW2Ma5z301U1V1VVVU0Pc1rN67o70AA8dd7vbGMc976aaqqq66qaqaHuY3et97oAADxp3etsc5z30U1VV1111VVUve1jN61o0AAB4v1re2uc+iimqqquuuyqqql7nbZrXdd6AAB4q7pjGuofRTVVVZXXXZVVXRQ1rd61070AADxLrTGOe+immuquuyuyuuuql7ms1rujoAAB4iNsa59FFNdVddllldlVdVL3NZ3WtAAAAeHu72576Kaa667LLLK7K6qqXtazW+9AAAA8N63tr6KaaqrK7LLa7K7KqqHubvfdgAAAHhru9ufRRVVXZXZbZXZZXXTQ97N77roAAAHhnWmOe+mmuqyy2yyyu2umqh7mM33XQAAAP//EABsBAAMBAQEBAQAAAAAAAAAAAAADBAIBBwUG/9oACAECEAAAAHOptsrdxE0sciFcAA22quyp+VIlklnXwADLaK6qnC0zzToXkACVtFFVLdcWlCFLzwAPmMdTTQ7ZxalqxnnAD4G30Uve3RzGMYzzgB+T26imihzNnM5znnAD8Ixz6aqKHN2c5nnOAHmrHUVV000uZs5zmQA8mY+mq2uqqhrNGecADxlj6rLba66aG64ZAA8OY+y2622yqh2znAAPB2UWW33W210O33gAB4Iyiy66+62uhzAAAP/EABsBAAMBAQEBAQAAAAAAAAAAAAADBAIBBwgG/9oACAEDEAAAAPwLaKrK6H773nOcAAPwDKKq66Ws105wAAPPWPqqroezeu8AAA85Y6mqql7Wb10AADzTb6Kaanvazfe9AAPLWOfVTTS9zt710AA8l26imqqqh72b33oAHju20VVV1VUUO3vXQAPFNuoqrsrrpoe3ewADwpjqa7K7bKqaGs10ADwLb6q7bbbLKqGs1oAD5826uy6262yqlze6AA+dmPrtuuutsrpezfQAPnRlFVt191ttdD276AB//8QAHRAAAwEAAwEBAQAAAAAAAAAAAAECAxESMBAgQP/aAAgBAQABAgBjKLLLNDQsssfxEkGZmZGRkZGRmZkEkiJ9m2U7LdmhoWWrH8SlQs1mszMyMjIyMzMgkQvdtuy3ZZoWWUmuJUqFms1ksjIyMzIzIJIJ9+W6q3bt2WWUqVJSlKhQs1mslkZmRmZkEECZPr2dVVO3bsstUqXHVTKhQoWazWazMzMzMySRC9nTp1VVVOyiilS69VMzMwoWazWazWazMyCSRC+J+fZ06bp06KKKTXHCmZmYULNZrNZrMzIIJJJaF69nTp1Tp0UMaa4SlSpmFChZrNZkGZBBJIhC/Cfg6dOnTpttj+8JJTMqFEws1ChQoUEEkkiF69uzptttj+8JJSpmFChQoUKFBBBBJJIhCEL4vDt27N88tjOBJKVKlSoUKFChQQpJUkkiEIX1eHZ1255555+ISSlSpUKFChQoUKCCSREiEL4vLt27c888/EIRKlSoUqFChQoUKCVJIviEL07dlXbnkQhCJJJUqVChQoUKFBChSSIQhCF9Xh27c9k0000IRJJKhSoUKFChQpIUkiEL4henbsq5TTTTQhEkkkEKFChQoUqFKlSkIQvi+Ly7du3KaaaaJJJJIJUKFChQoUKFKlJJISXxfUvDt2TTTTTTkkkkkggghQoUKFChSpUpCEIXxLy55TTTTlySSSSQoIUKCCFChQpUqUkkvwhefPPKaacuXLkggggghQoUKFChSpUpJJfF9nz7c8py5cuXLggggggggghQQoUqUhCSF+F588pppy5JckkEEEEEEEEEKCFJJKQhIQjjz55TTTly5JIIIIIIMyCCCCCCCRCF/DzymnLly4IIIIIIIIUEEEEKCSRCEIQvdCE5ckEEEEEEEEEEEEEEEkkkiF8XuviE5JJIIIIIIIIMyCCCCCCSSRC+IX8CESSSQQQQQQZmZmQQQQQQSSIQviF7f//EACAQAAECBQUAAAAAAAAAAAAAADEhUAEQQGBwESAwUYD/2gAIAQEAAz8ApBINAcxl5b7RrRvSOLtbAh15THCNwpf/xAAdEQEBAQEAAwEBAQAAAAAAAAACAQMAERIwECAT/9oACAECAQECAJx4XOii+bVXz58+XX4Smi5oIL2qSddfPl1+ERQQYZcddSSr5devwjLLDDOk0960lVV16/CMssMaHSOP3qttvX4zSaHQ6HQ6HSP39rbbb+3+ppNDodBodC44/bz5v5fh/odDodDoNCyyopfP5fh/pNDoNBoGGGUVL589fhNDodAwwwwgjZZ/F/uaFjQPN5rNBCimy+fj7FhBZrNZ0UUU9PnEaLnc7nc7nRRx6fOceHZ9n2fZ9nw4cePz/8QAFhEAAwAAAAAAAAAAAAAAAAAAMUCA/9oACAECAQM/AIhCf//EABsRAQEBAQEBAQEAAAAAAAAAAAIBAAMwERIQ/9oACAEDAQECAMcMMMMdNP7fOY4UUUU2WX76fZRRQggopZZfvlKaUEEEUVLLL5xRFBBBFFGyyy6eMURQQQQRRRUss8ooywwgggjTTZp5fuIsIIIIIU02aaaeEUZYQQQQQopx008f2UUEEEFzoopx008Yoiggua53nRRhTpp4xRCi87zvO87zwwx008ZTRRRed57nhhhjjpp4TTDc9z3Pctz3PDDHHTx//8QAFhEAAwAAAAAAAAAAAAAAAAAAMUCA/9oACAEDAQM/AIjCP//Z'
export default base64EncodedImage
diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerList.js b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerList.js
index 903f4e3e84c..9fe0ca95a9b 100644
--- a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerList.js
+++ b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerList.js
@@ -95,7 +95,7 @@ class DrawerListInstance extends React.PureComponent {
acc[key] = props[key]
}
return acc
- }, {})
+ }, {}),
)
context.drawerList.setState({
@@ -126,7 +126,7 @@ class DrawerListInstance extends React.PureComponent {
// return // stop
// }
const selected_item = parseFloat(
- event.currentTarget.getAttribute('data-item')
+ event.currentTarget.getAttribute('data-item'),
)
if (selected_item > -1) {
this.context.drawerList.selectItemAndClose(selected_item, {
@@ -141,7 +141,7 @@ class DrawerListInstance extends React.PureComponent {
const props = extendPropsWithContextInClassComponent(
this.props,
DrawerList.defaultProps,
- this.context.getTranslation(this.props).DrawerList
+ this.context.getTranslation(this.props).DrawerList,
)
const {
@@ -223,7 +223,7 @@ class DrawerListInstance extends React.PureComponent {
'dnb-drawer-list--no-scroll-animation',
createSpacingClasses(props),
_className,
- className
+ className,
),
...attributes,
}
@@ -238,7 +238,7 @@ class DrawerListInstance extends React.PureComponent {
className: classnames(
'dnb-drawer-list__list',
isTrue(no_animation) && 'dnb-drawer-list__list--no-animation',
- list_class
+ list_class,
),
}
@@ -283,7 +283,7 @@ class DrawerListInstance extends React.PureComponent {
// make it possible to grab the rest attributes and return it with all events
Object.assign(
this.context.drawerList.attributes,
- validateDOMAttributes(null, attributes)
+ validateDOMAttributes(null, attributes),
)
const ignoreEvents = isTrue(ignore_events)
@@ -304,7 +304,7 @@ class DrawerListInstance extends React.PureComponent {
i === 0 && 'first-of-type', // because of the triangle element
i === data.length - 1 && 'last-of-type', // because of the triangle element
ignoreEvents || (dataItem.ignore_events && 'ignore-events'),
- dataItem.class_name
+ dataItem.class_name,
),
active: _id == active_item,
selected: !dataItem.ignore_events && _id == selected_item,
@@ -319,7 +319,7 @@ class DrawerListInstance extends React.PureComponent {
liParams.onKeyDown = null
liParams.className = classnames(
liParams.className,
- 'dnb-drawer-list__option--ignore'
+ 'dnb-drawer-list__option--ignore',
)
}
@@ -379,7 +379,7 @@ class DrawerListInstance extends React.PureComponent {
@@ -422,7 +422,7 @@ DrawerList.Options = React.memo(
'dnb-drawer-list__options',
showFocusRing && 'dnb-drawer-list__options--focusring',
className,
- _className
+ _className,
)}
{...rest}
ref={ref}
@@ -441,7 +441,7 @@ DrawerList.Options = React.memo(
return null
}
return prevProps.cache_hash === nextProps.cache_hash
- }
+ },
)
DrawerList.Options.displayName = 'DrawerList.Options'
DrawerList.Options.propTypes = {
@@ -482,7 +482,7 @@ DrawerList.Item = React.forwardRef((props, ref) => {
_className,
'dnb-drawer-list__option',
selected && 'dnb-drawer-list__option--selected',
- active && 'dnb-drawer-list__option--focus'
+ active && 'dnb-drawer-list__option--focus',
),
role,
tabIndex: selected ? '0' : '-1',
@@ -503,7 +503,7 @@ DrawerList.Item = React.forwardRef((props, ref) => {
selected,
value,
...rest,
- }
+ },
)
}
diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListHelpers.js b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListHelpers.js
index af28cf715de..6639117171a 100644
--- a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListHelpers.js
+++ b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListHelpers.js
@@ -86,7 +86,7 @@ export const drawerListPropTypes = {
PropTypes.arrayOf(PropTypes.string),
]),
}),
- ])
+ ]),
),
]),
prepared_data: PropTypes.array,
@@ -190,7 +190,7 @@ export const parseContentTitle = (
separator = '\n',
removeNumericOnlyValues = false,
preferSelectedValue = false,
- } = {}
+ } = {},
) => {
let ret = ''
const onlyNumericRegex = /[0-9.,-\s]+/
@@ -224,7 +224,7 @@ export const parseContentTitle = (
} else {
ret = convertJsxToString(
(dataItem && dataItem.content) || dataItem,
- ' '
+ ' ',
)
}
@@ -323,7 +323,7 @@ export const getCurrentIndex = (value, data) => {
export const getSelectedItemValue = (value, state) => {
if (hasObjectKeyAsValue(state)) {
return parseCurrentValue(
- state.data.filter((_, i) => i === parseFloat(value))[0]
+ state.data.filter((_, i) => i === parseFloat(value))[0],
)
}
@@ -370,7 +370,7 @@ export const getCurrentData = (item_index, data) => {
export const prepareStartupState = (props) => {
const selected_item = null
const raw_data = preSelectData(
- props.raw_data || props.data || props.children
+ props.raw_data || props.data || props.children,
)
const data = getData(props)
const opened = props.opened !== null ? isTrue(props.opened) : null
@@ -397,12 +397,12 @@ export const prepareStartupState = (props) => {
) {
state.selected_item = state.active_item = getCurrentIndex(
props.value,
- data
+ data,
)
} else if (props.default_value !== null) {
state.selected_item = state.active_item = getCurrentIndex(
props.default_value,
- data
+ data,
)
state._value = props.value
}
@@ -471,7 +471,7 @@ export const prepareDerivedState = (props, state) => {
if (parseFloat(state.selected_item) > -1) {
state.current_title = getCurrentDataTitle(
state.selected_item,
- state.data
+ state.data,
)
}
@@ -492,5 +492,5 @@ export const getCurrentDataTitle = (selected_item, data) => {
export const findClosest = (arr, val) =>
Math.max.apply(
null,
- arr.filter((v) => v <= val)
+ arr.filter((v) => v <= val),
)
diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListPortal.js b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListPortal.js
index 6becac01dab..97c6e042d57 100644
--- a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListPortal.js
+++ b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListPortal.js
@@ -148,7 +148,7 @@ export class DrawerListPortal extends React.PureComponent {
parseFloat(
window
.getComputedStyle(document.documentElement)
- .getPropertyValue('--drawer-list-width')
+ .getPropertyValue('--drawer-list-width'),
) || 0
width = minWidth * 16
}
@@ -265,14 +265,14 @@ export class DrawerListPortal extends React.PureComponent {
className={classnames(
'dnb-drawer-list__portal__style',
fixed_position && 'dnb-drawer-list__portal__style--fixed',
- className
+ className,
)}
style={style}
ref={this.ref}
>
{children}
,
- this.portalElem
+ this.portalElem,
)
}
diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListProvider.js b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListProvider.js
index 1d870cf9f06..d430c731c13 100644
--- a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListProvider.js
+++ b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListProvider.js
@@ -127,7 +127,7 @@ export default class DrawerListProvider extends React.PureComponent {
this.itemSpots = this.state.data.reduce((acc, cur, i) => {
const element = this._refUl.current?.querySelector(
- `li.dnb-drawer-list__option:nth-of-type(${i + 1})`
+ `li.dnb-drawer-list__option:nth-of-type(${i + 1})`,
)
if (element) {
acc[element.offsetTop] = {
@@ -167,7 +167,7 @@ export default class DrawerListProvider extends React.PureComponent {
const counts = Object.keys(this.itemSpots)
closestToBottom = findClosest(
counts,
- this._refUl.current.scrollTop + this._refUl.current.offsetHeight
+ this._refUl.current.scrollTop + this._refUl.current.offsetHeight,
)
closestToTop = findClosest(counts, this._refUl.current.scrollTop)
if (this.itemSpots[closestToTop] && closestToTop !== tmpToTop) {
@@ -298,7 +298,7 @@ export default class DrawerListProvider extends React.PureComponent {
} else {
vh = Math.max(
document.documentElement.clientHeight,
- window.innerHeight || 0
+ window.innerHeight || 0,
)
}
@@ -396,7 +396,7 @@ export default class DrawerListProvider extends React.PureComponent {
// correct left side
if (spaceToLeft < 0) {
shellStyle.transform = `translateX(${Math.abs(
- spaceToLeft / 16
+ spaceToLeft / 16,
)}rem)`
triangleStyle.right = `${Math.abs(spaceToLeft / 16)}rem`
@@ -442,7 +442,7 @@ export default class DrawerListProvider extends React.PureComponent {
parseContentTitle(itemData, {
separator: ' ',
removeNumericOnlyValues: true,
- })
+ }),
)
// take the first letter
@@ -472,7 +472,7 @@ export default class DrawerListProvider extends React.PureComponent {
scrollToItem = (
active_item,
- { scrollTo = true, element = null } = {}
+ { scrollTo = true, element = null } = {},
) => {
clearTimeout(this._scrollTimeout)
this._scrollTimeout = setTimeout(() => {
@@ -527,7 +527,7 @@ export default class DrawerListProvider extends React.PureComponent {
*/
setActiveItemAndScrollToIt = (
active_item,
- { fireSelectEvent = false, scrollTo = true, event = null } = {}
+ { fireSelectEvent = false, scrollTo = true, event = null } = {},
) => {
this.setState({ active_item }, () => {
if (parseFloat(active_item) === -1) {
@@ -578,11 +578,11 @@ export default class DrawerListProvider extends React.PureComponent {
if (typeof window.visualViewport !== 'undefined') {
window.visualViewport.removeEventListener(
'scroll',
- this.setDirection
+ this.setDirection,
)
window.visualViewport.removeEventListener(
'resize',
- this.setDirection
+ this.setDirection,
)
} else {
window.removeEventListener('resize', this.setDirection)
@@ -661,7 +661,7 @@ export default class DrawerListProvider extends React.PureComponent {
try {
const ulElem = getPreviousSibling(
'dnb-drawer-list__options',
- document.activeElement
+ document.activeElement,
)
isSameDrawer =
@@ -790,7 +790,7 @@ export default class DrawerListProvider extends React.PureComponent {
// we make it possible to tab inside it (to an anchor) instead of closing the list
const activeElement = this.getActiveElement()
const hasFocusOnElement = Boolean(
- this.getAnchorElem(activeElement)
+ this.getAnchorElem(activeElement),
)
this.setState({ hasFocusOnElement })
@@ -802,7 +802,7 @@ export default class DrawerListProvider extends React.PureComponent {
// Also, set the focus actively into the active element, if it is not from beforehand
const currentActiveElement = getPreviousSibling(
'dnb-drawer-list__option',
- document.activeElement
+ document.activeElement,
)
if (currentActiveElement !== activeElement) {
@@ -845,7 +845,7 @@ export default class DrawerListProvider extends React.PureComponent {
activeElement.appendChild(after)
activeElement.insertBefore(
before,
- activeElement.firstChild
+ activeElement.firstChild,
)
} catch (e) {
//
@@ -887,7 +887,7 @@ export default class DrawerListProvider extends React.PureComponent {
) {
const ulElem = getPreviousSibling(
'dnb-drawer-list__options',
- document.activeElement
+ document.activeElement,
)
if (ulElem === this._refUl.current) {
@@ -916,7 +916,7 @@ export default class DrawerListProvider extends React.PureComponent {
getSelectedElement = () => {
return (
this._refUl.current?.querySelector(
- 'li.dnb-drawer-list__option--selected'
+ 'li.dnb-drawer-list__option--selected',
) ||
this._refUl.current || {
getAttribute: () => null,
@@ -932,7 +932,7 @@ export default class DrawerListProvider extends React.PureComponent {
getActiveElement = () => {
return (
this._refUl.current?.querySelector(
- 'li.dnb-drawer-list__option--focus'
+ 'li.dnb-drawer-list__option--focus',
) || this.getSelectedElement()
)
}
@@ -954,14 +954,14 @@ export default class DrawerListProvider extends React.PureComponent {
getFirstItem = () => {
const elem = this._refUl.current?.querySelector(
- 'li.dnb-drawer-list__option.first-of-type' // because of the triangle element
+ 'li.dnb-drawer-list__option.first-of-type', // because of the triangle element
)
return parseFloat(elem && elem.getAttribute('data-item'))
}
getLastItem = () => {
const elem = this._refUl.current?.querySelector(
- 'li.dnb-drawer-list__option.last-of-type' // because of the triangle element
+ 'li.dnb-drawer-list__option.last-of-type', // because of the triangle element
)
return parseFloat(elem && elem.getAttribute('data-item'))
}
@@ -976,7 +976,7 @@ export default class DrawerListProvider extends React.PureComponent {
this._refUl.current,
],
() => this.setHidden({ preventHideFocus: true }),
- { includedKeys: ['tab'] }
+ { includedKeys: ['tab'] },
)
if (typeof document !== 'undefined') {
@@ -1057,7 +1057,7 @@ export default class DrawerListProvider extends React.PureComponent {
clearTimeout(this._showTimeout)
this._showTimeout = setTimeout(
animationDelayHandler,
- DrawerListProvider.blurDelay
+ DrawerListProvider.blurDelay,
) // wait until animation is over
}
@@ -1066,7 +1066,7 @@ export default class DrawerListProvider extends React.PureComponent {
...args,
data: getEventData(
parseFloat(selected_item) > -1 ? selected_item : active_item,
- this.state.data
+ this.state.data,
),
attributes: this.attributes,
ulElement: this._refUl.current,
@@ -1074,7 +1074,7 @@ export default class DrawerListProvider extends React.PureComponent {
this.setActiveItemAndScrollToIt(
parseFloat(active_item) > -1 ? active_item : -1,
- { scrollTo: false }
+ { scrollTo: false },
)
}
@@ -1084,7 +1084,7 @@ export default class DrawerListProvider extends React.PureComponent {
clearTimeout(this._hideTimeout)
this._hideTimeout = setTimeout(
handleSingleComponentCheck,
- DrawerListProvider.blurDelay
+ DrawerListProvider.blurDelay,
)
} else {
handleSingleComponentCheck()
@@ -1107,7 +1107,7 @@ export default class DrawerListProvider extends React.PureComponent {
...args,
data: getEventData(
parseFloat(selected_item) > -1 ? selected_item : active_item,
- this.state.data
+ this.state.data,
),
attributes: this.attributes,
})
@@ -1138,7 +1138,7 @@ export default class DrawerListProvider extends React.PureComponent {
clearTimeout(this._hideTimeout)
this._hideTimeout = setTimeout(
delayHandler,
- DrawerListProvider.blurDelay
+ DrawerListProvider.blurDelay,
) // wait until animation is over
}
}
@@ -1150,17 +1150,17 @@ export default class DrawerListProvider extends React.PureComponent {
if (active) {
document.documentElement.setAttribute(
'data-dnb-drawer-list-active',
- String(this.props.id)
+ String(this.props.id),
)
} else {
document.documentElement.removeAttribute(
- 'data-dnb-drawer-list-active'
+ 'data-dnb-drawer-list-active',
)
}
} catch (e) {
warn(
'DrawerList: Error on set "data-dnb-drawer-list-active" by using element.setAttribute()',
- e
+ e,
)
}
}
@@ -1169,7 +1169,7 @@ export default class DrawerListProvider extends React.PureComponent {
setDataHandler = (
data,
cb = null,
- { overwriteOriginalData = false } = {}
+ { overwriteOriginalData = false } = {},
) => {
if (!data) {
return
@@ -1191,7 +1191,7 @@ export default class DrawerListProvider extends React.PureComponent {
() => {
this.refreshScrollObserver()
typeof cb === 'function' && cb(data)
- }
+ },
)
return this
@@ -1202,7 +1202,7 @@ export default class DrawerListProvider extends React.PureComponent {
{
...state,
},
- cb
+ cb,
)
return this
@@ -1219,7 +1219,7 @@ export default class DrawerListProvider extends React.PureComponent {
fireSelectEvent = false,
event = null,
closeOnSelection = false,
- } = {}
+ } = {},
) => {
// because of our delay on dispatching the event
// make a copy of it, so we don't break the synthetic event
@@ -1246,7 +1246,7 @@ export default class DrawerListProvider extends React.PureComponent {
const res = dispatchCustomElementEvent(
this.state,
'on_pre_change',
- attr
+ attr,
)
if (res === false) {
@@ -1290,7 +1290,7 @@ export default class DrawerListProvider extends React.PureComponent {
selected_item: itemToSelect,
active_item: itemToSelect,
},
- onSelectionIsComplete
+ onSelectionIsComplete,
)
}
}
diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerList.test.tsx b/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerList.test.tsx
index 84ee4dd1a18..3d653733cac 100644
--- a/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerList.test.tsx
+++ b/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerList.test.tsx
@@ -58,7 +58,7 @@ describe('DrawerList component', () => {
it('has correct state at startup', () => {
render( )
expect(
- document.querySelector('.dnb-drawer-list--opened')
+ document.querySelector('.dnb-drawer-list--opened'),
).toBeInTheDocument()
})
@@ -66,17 +66,17 @@ describe('DrawerList component', () => {
const { rerender } = render( )
expect(
- document.querySelector('.dnb-drawer-list--opened')
+ document.querySelector('.dnb-drawer-list--opened'),
).toBeInTheDocument()
rerender( )
expect(
- document.querySelector('.dnb-drawer-list--opened')
+ document.querySelector('.dnb-drawer-list--opened'),
).not.toBeInTheDocument()
rerender( )
expect(
- document.querySelector('.dnb-drawer-list--opened')
+ document.querySelector('.dnb-drawer-list--opened'),
).toBeInTheDocument()
})
@@ -88,7 +88,7 @@ describe('DrawerList component', () => {
data={mockData}
default_value={props.value}
{...mockProps}
- />
+ />,
)
let elem
@@ -108,7 +108,7 @@ describe('DrawerList component', () => {
default_value={props.value}
{...mockProps}
title={title}
- />
+ />,
)
expect(screen.getByTitle(title)).toBeInTheDocument()
@@ -122,7 +122,7 @@ describe('DrawerList component', () => {
{...mockProps}
title={title}
value={(props.value as number) + 1}
- />
+ />,
)
// the selected option got a new position
@@ -142,7 +142,7 @@ describe('DrawerList component', () => {
const { rerender } = render( )
expect(
- document.querySelector('.dnb-drawer-list__option--focus')
+ document.querySelector('.dnb-drawer-list__option--focus'),
).toBeInTheDocument()
keydown(83) // S
@@ -151,8 +151,8 @@ describe('DrawerList component', () => {
expect(
Array.from(
document.querySelectorAll('.dnb-drawer-list__option')[1]
- .classList
- )
+ .classList,
+ ),
).toEqual([
'dnb-drawer-list__option',
'dnb-drawer-list__option--focus',
@@ -168,8 +168,8 @@ describe('DrawerList component', () => {
expect(
Array.from(
document.querySelectorAll('.dnb-drawer-list__option')[2]
- .classList
- )
+ .classList,
+ ),
).toEqual([
'dnb-drawer-list__option',
'dnb-drawer-list__option--selected',
@@ -186,7 +186,7 @@ describe('DrawerList component', () => {
{...props}
data={Object.freeze(mockData) as DrawerListDataObjectUnion}
on_select={on_select}
- />
+ />,
)
// select the current
@@ -206,7 +206,7 @@ describe('DrawerList component', () => {
data={Object.freeze(mockData) as DrawerListDataObjectUnion}
on_select={on_select}
opened={null}
- />
+ />,
)
// then open again
@@ -216,7 +216,7 @@ describe('DrawerList component', () => {
data={Object.freeze(mockData) as DrawerListDataObjectUnion}
on_select={on_select}
opened={true}
- />
+ />,
)
keydown(40) // down
await waitFor(() => {
@@ -230,37 +230,37 @@ describe('DrawerList component', () => {
it('will set data-dnb-drawer-list-active with id', () => {
const { rerender } = render(
-
+ ,
)
rerender( )
expect(
- document.documentElement.getAttribute('data-dnb-drawer-list-active')
+ document.documentElement.getAttribute('data-dnb-drawer-list-active'),
).toBe(props.id)
rerender( )
expect(document.documentElement).not.toHaveAttribute(
- 'data-dnb-drawer-list-active'
+ 'data-dnb-drawer-list-active',
)
})
it('will unset data-dnb-drawer-list-active on unmount', () => {
const { rerender, unmount } = render(
-
+ ,
)
rerender( )
expect(
- document.documentElement.getAttribute('data-dnb-drawer-list-active')
+ document.documentElement.getAttribute('data-dnb-drawer-list-active'),
).toBe(props.id)
unmount()
expect(document.documentElement).not.toHaveAttribute(
- 'data-dnb-drawer-list-active'
+ 'data-dnb-drawer-list-active',
)
})
@@ -276,7 +276,7 @@ describe('DrawerList component', () => {
rerender( )
expect(document.body.getAttribute('style')).toBe(
- 'overflow: hidden; height: auto; box-sizing: border-box; margin-right: 0px;'
+ 'overflow: hidden; height: auto; box-sizing: border-box; margin-right: 0px;',
)
rerender( )
@@ -294,7 +294,7 @@ describe('DrawerList component', () => {
data={mockData}
on_change={on_change}
on_select={on_select}
- />
+ />,
)
// then simulate changes
@@ -314,7 +314,7 @@ describe('DrawerList component', () => {
on_change={on_change}
on_select={on_select}
opened={null}
- />
+ />,
)
// then open again
@@ -325,7 +325,7 @@ describe('DrawerList component', () => {
on_change={on_change}
on_select={on_select}
opened={true}
- />
+ />,
)
// then simulate changes
@@ -343,25 +343,29 @@ describe('DrawerList component', () => {
const directionTop = 'top'
const { rerender } = render(
-
+ ,
)
expect(
- document.querySelector(`.dnb-drawer-list--${directionTop}`)
+ document.querySelector(`.dnb-drawer-list--${directionTop}`),
).toBeInTheDocument()
const directionBottom = 'bottom'
rerender(
-
+ ,
)
expect(
- document.querySelector(`.dnb-drawer-list--${directionBottom}`)
+ document.querySelector(`.dnb-drawer-list--${directionBottom}`),
).toBeInTheDocument()
expect(
document
.querySelector('.dnb-drawer-list__options')
- .getAttribute('style')
+ .getAttribute('style'),
).toBe('max-height: 33.5rem;')
})
@@ -376,7 +380,7 @@ describe('DrawerList component', () => {
render( )
expect(
- Array.from(document.querySelector('span.dnb-drawer-list').classList)
+ Array.from(document.querySelector('span.dnb-drawer-list').classList),
).toEqual([
'dnb-drawer-list',
'dnb-drawer-list--top',
@@ -393,8 +397,8 @@ describe('DrawerList component', () => {
await waitFor(() => {
expect(
Array.from(
- document.querySelector('span.dnb-drawer-list').classList
- )
+ document.querySelector('span.dnb-drawer-list').classList,
+ ),
).toEqual([
'dnb-drawer-list',
'dnb-drawer-list--top',
@@ -420,7 +424,7 @@ describe('DrawerList component', () => {
render( )
expect(
- document.querySelectorAll('li.dnb-drawer-list__option').length
+ document.querySelectorAll('li.dnb-drawer-list__option').length,
).toBe(mockData.length)
})
@@ -436,7 +440,7 @@ describe('DrawerList component', () => {
on_select={on_select}
data={() => ({ a: 'A', b: 'B', c: 'C' })}
{...mockProps}
- />
+ />,
)
// then simulate changes
@@ -470,7 +474,7 @@ describe('DrawerList component', () => {
on_hide={on_hide}
{...params}
data={mockData}
- />
+ />,
)
expect(on_show.mock.calls.length).toBe(1)
@@ -495,7 +499,7 @@ describe('DrawerList markup', () => {
}
const CheckComponent = render(
-
+ ,
)
expect(
await axeComponent(CheckComponent, {
@@ -503,7 +507,7 @@ describe('DrawerList markup', () => {
'aria-input-field-name': { enabled: false },
'aria-required-children': { enabled: false },
},
- })
+ }),
).toHaveNoViolations()
})
})
@@ -516,7 +520,7 @@ describe('DrawerList scss', () => {
it('have to match default theme snapshot', () => {
const css = loadScss(
- require.resolve('../style/themes/dnb-drawer-list-theme-ui.scss')
+ require.resolve('../style/themes/dnb-drawer-list-theme-ui.scss'),
)
expect(css).toMatchSnapshot()
})
diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerListTestMocks.js b/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerListTestMocks.js
index 7200578c530..89b0672556b 100644
--- a/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerListTestMocks.js
+++ b/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerListTestMocks.js
@@ -37,12 +37,12 @@ export function mockImplementationForDirectionObserver() {
export async function testDirectionObserver() {
// the setDirectionObserver fn is changing this
expect(
- document.querySelector('.dnb-drawer-list--bottom')
+ document.querySelector('.dnb-drawer-list--bottom'),
).toBeInTheDocument()
expect(
document
.querySelector('.dnb-drawer-list__options')
- .getAttribute('style')
+ .getAttribute('style'),
).toBe('max-height: 33.5rem;') // jsdom default is 768 innerHeight
window.resizeTo({
@@ -51,12 +51,12 @@ export async function testDirectionObserver() {
await wait(100)
expect(
- document.querySelector('.dnb-drawer-list--bottom')
+ document.querySelector('.dnb-drawer-list--bottom'),
).toBeInTheDocument()
expect(
document
.querySelector('.dnb-drawer-list__options')
- .getAttribute('style')
+ .getAttribute('style'),
).toBe('max-height: 28rem;')
window.scrollTo({
@@ -65,12 +65,12 @@ export async function testDirectionObserver() {
await wait(100)
expect(
- document.querySelector('.dnb-drawer-list--top')
+ document.querySelector('.dnb-drawer-list--top'),
).toBeInTheDocument()
expect(
document
.querySelector('.dnb-drawer-list__options')
- .getAttribute('style')
+ .getAttribute('style'),
).toBe('max-height: 28rem;') // is now min_height
}
diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/style/dnb-drawer-list.scss b/packages/dnb-eufemia/src/fragments/drawer-list/style/dnb-drawer-list.scss
index 90066293c70..12f3591cb18 100644
--- a/packages/dnb-eufemia/src/fragments/drawer-list/style/dnb-drawer-list.scss
+++ b/packages/dnb-eufemia/src/fragments/drawer-list/style/dnb-drawer-list.scss
@@ -120,7 +120,9 @@
background-color: transparent;
transform: translateY(0);
- transition: transform 200ms, opacity 160ms ease-out;
+ transition:
+ transform 200ms,
+ opacity 160ms ease-out;
}
// ul element
diff --git a/packages/dnb-eufemia/src/fragments/scroll-view/ScrollView.tsx b/packages/dnb-eufemia/src/fragments/scroll-view/ScrollView.tsx
index d4ec5cdd0ac..766398e7a62 100644
--- a/packages/dnb-eufemia/src/fragments/scroll-view/ScrollView.tsx
+++ b/packages/dnb-eufemia/src/fragments/scroll-view/ScrollView.tsx
@@ -42,7 +42,7 @@ function ScrollView(localProps: ScrollViewAllProps) {
const props = extendPropsWithContext(
localProps,
defaultProps,
- context.ScrollView
+ context.ScrollView,
)
const {
@@ -60,7 +60,7 @@ function ScrollView(localProps: ScrollViewAllProps) {
className: classnames(
'dnb-scroll-view',
createSpacingClasses(props),
- className
+ className,
),
...(attributes as React.HTMLAttributes),
}
@@ -83,7 +83,7 @@ function ScrollView(localProps: ScrollViewAllProps) {
function useInteractive({ interactive, children, ref }) {
const [isInteractive, setAsInteractive] = React.useState(
- Boolean(interactive)
+ Boolean(interactive),
)
useLayoutEffect(() => {
diff --git a/packages/dnb-eufemia/src/fragments/scroll-view/__tests__/ScrollView.test.tsx b/packages/dnb-eufemia/src/fragments/scroll-view/__tests__/ScrollView.test.tsx
index 11c2b8cda09..08dbeda8c36 100644
--- a/packages/dnb-eufemia/src/fragments/scroll-view/__tests__/ScrollView.test.tsx
+++ b/packages/dnb-eufemia/src/fragments/scroll-view/__tests__/ScrollView.test.tsx
@@ -34,7 +34,7 @@ describe('ScrollView', () => {
const { rerender } = render(
overflow content
-
+ ,
)
const element = document.querySelector('.dnb-scroll-view')
@@ -47,7 +47,7 @@ describe('ScrollView', () => {
rerender(
new content to force hook re-render
-
+ ,
)
})
@@ -60,7 +60,7 @@ describe('ScrollView', () => {
rerender(
again, new content to force hook re-render
-
+ ,
)
})
@@ -80,7 +80,7 @@ describe('ScrollView', () => {
render(
overflow content
-
+ ,
)
const element = document.querySelector('.dnb-scroll-view')
@@ -111,7 +111,7 @@ describe('ScrollView', () => {
it('should include custom classes', () => {
render(
- overflow content
+ overflow content ,
)
const element = document.querySelector('.dnb-scroll-view')
diff --git a/packages/dnb-eufemia/src/shared/Context.tsx b/packages/dnb-eufemia/src/shared/Context.tsx
index be6328712f7..d988c6dfadf 100644
--- a/packages/dnb-eufemia/src/shared/Context.tsx
+++ b/packages/dnb-eufemia/src/shared/Context.tsx
@@ -172,7 +172,7 @@ export type TranslationConsumer = Record<
>
export function prepareContext(
- props: ContextProps = {}
+ props: ContextProps = {},
): Props & ContextProps {
const locales: Locales = props.locales
? extend(defaultLocales, props.locales)
@@ -242,14 +242,14 @@ const Context = React.createContext(
locale: LOCALE,
currency: CURRENCY,
currency_display: CURRENCY_DISPLAY,
- })
+ }),
)
export default Context
function destruct(
source: TranslationConsumer,
- validKeys: Record
+ validKeys: Record,
): TranslationConsumer {
for (const k in source) {
if (String(k).includes('.')) {
diff --git a/packages/dnb-eufemia/src/shared/MediaQuery.tsx b/packages/dnb-eufemia/src/shared/MediaQuery.tsx
index ed4b010dabf..3e3de5d45e5 100644
--- a/packages/dnb-eufemia/src/shared/MediaQuery.tsx
+++ b/packages/dnb-eufemia/src/shared/MediaQuery.tsx
@@ -40,7 +40,7 @@ export default class MediaQuery extends React.PureComponent<
if (isMatchMediaSupported()) {
this.state.mediaQueryList = makeMediaQueryList(
props,
- context?.breakpoints
+ context?.breakpoints,
)
if (this.state.mediaQueryList?.matches) {
@@ -70,14 +70,14 @@ export default class MediaQuery extends React.PureComponent<
) {
const mediaQueryList = makeMediaQueryList(
this.props,
- this.context.breakpoints
+ this.context.breakpoints,
)
this.setState(
{
match: mediaQueryList?.matches,
mediaQueryList,
},
- this.bindListener
+ this.bindListener,
)
}
}
@@ -89,7 +89,7 @@ export default class MediaQuery extends React.PureComponent<
this.state.mediaQueryList,
(match) => {
this.setState({ match })
- }
+ },
)
}
}
diff --git a/packages/dnb-eufemia/src/shared/MediaQueryUtils.ts b/packages/dnb-eufemia/src/shared/MediaQueryUtils.ts
index 3295615d298..a19ebdc3baa 100644
--- a/packages/dnb-eufemia/src/shared/MediaQueryUtils.ts
+++ b/packages/dnb-eufemia/src/shared/MediaQueryUtils.ts
@@ -91,7 +91,7 @@ export type MediaQueryState = {
export function onMediaQueryChange(
property: MediaQueryProperties | string,
callback?: (matches: boolean, mediaQueryList: MediaQueryList) => void,
- { runOnInit = false } = {}
+ { runOnInit = false } = {},
): MediaQueryListener {
let query = property
let when = null
@@ -140,7 +140,7 @@ export function makeMediaQueryList(
log = false,
disabled = false,
}: MediaQueryProperties = {},
- breakpoints: MediaQueryBreakpoints = null
+ breakpoints: MediaQueryBreakpoints = null,
): MediaQueryList {
const isSupported = isMatchMediaSupported()
@@ -171,7 +171,10 @@ export function makeMediaQueryList(
*/
export function createMediaQueryListener(
mediaQueryList: MediaQueryList,
- callback: (matches: boolean, event: Partial) => void
+ callback: (
+ matches: boolean,
+ event: Partial,
+ ) => void,
): MediaQueryListener {
if (!mediaQueryList) {
return () => null
@@ -204,7 +207,7 @@ export function createMediaQueryListener(
*/
export function buildQuery(
{ query = null, when = null, not = null }: MediaQueryProperties = {},
- breakpoints?: MediaQueryBreakpoints
+ breakpoints?: MediaQueryBreakpoints,
) {
if (when) {
if (typeof when === 'string') {
@@ -215,7 +218,7 @@ export function buildQuery(
if (Array.isArray(when)) {
listOfQueries = listOfQueries.concat(
- combineQueries(when, breakpoints)
+ combineQueries(when, breakpoints),
)
} else if (when && typeof when === 'object') {
const query = convertToMediaQuery(when, breakpoints)
@@ -263,7 +266,7 @@ function reverseQuery(query: string) {
*/
function combineQueries(
queries: Array,
- breakpoints: MediaQueryBreakpoints = null
+ breakpoints: MediaQueryBreakpoints = null,
) {
return queries
.reduce((listOfQueries, when, i, arr) => {
@@ -319,7 +322,7 @@ function mergeBreakpoints(breakpoints: MediaQueryBreakpoints) {
*/
export function convertToMediaQuery(
query: MediaQueryCondition | Array,
- breakpoints: MediaQueryBreakpoints = null
+ breakpoints: MediaQueryBreakpoints = null,
): string {
if (typeof query === 'string') {
return query
@@ -348,7 +351,7 @@ export function convertToMediaQuery(
*/
function objToMediaQuery(
obj: MediaQueryCondition,
- breakpoints: MediaQueryBreakpoints = null
+ breakpoints: MediaQueryBreakpoints = null,
): string {
let hasNot = false
let query: string | Array = Object.keys(obj).reduce(
@@ -383,7 +386,7 @@ function objToMediaQuery(
return acc
},
- []
+ [],
)
if (Array.isArray(query)) {
@@ -406,7 +409,7 @@ function objToMediaQuery(
*/
function getValueByFeature(
value: string,
- types: MediaQueryBreakpoints = null
+ types: MediaQueryBreakpoints = null,
) {
types = types || defaultBreakpoints
if (Object.prototype.hasOwnProperty.call(types, value)) {
diff --git a/packages/dnb-eufemia/src/shared/Provider.tsx b/packages/dnb-eufemia/src/shared/Provider.tsx
index f0db8edf4c5..8bf17de0e2f 100644
--- a/packages/dnb-eufemia/src/shared/Provider.tsx
+++ b/packages/dnb-eufemia/src/shared/Provider.tsx
@@ -21,7 +21,7 @@ export type ProviderProps = {
} & ContextProps
export default function Provider(
- localProps: ProviderProps & Props
+ localProps: ProviderProps & Props,
) {
const { children, ...props } = localProps
@@ -72,7 +72,7 @@ type MergeContextProps = {
function mergeContext(
context: ContextT & ContextProps,
- props: PropsT & MergeContextProps
+ props: PropsT & MergeContextProps,
) {
// When value is given as so:
const { value, ...rest } = props
diff --git a/packages/dnb-eufemia/src/shared/Theme.tsx b/packages/dnb-eufemia/src/shared/Theme.tsx
index 6ece34bb6b5..c587d137fdb 100644
--- a/packages/dnb-eufemia/src/shared/Theme.tsx
+++ b/packages/dnb-eufemia/src/shared/Theme.tsx
@@ -54,7 +54,7 @@ export default function Theme(themeProps: ThemeAllProps) {
darkMode,
},
null,
- context?.theme
+ context?.theme,
)
return (
@@ -114,6 +114,6 @@ export function getThemeClasses(theme: ThemeProps, className = null) {
propMapping && `eufemia-theme__prop-mapping--${propMapping}`,
contrastMode && 'eufemia-theme__contrast-mode',
darkMode && 'eufemia-theme__dark-mode',
- size && `eufemia-theme__size--${size}`
+ size && `eufemia-theme__size--${size}`,
)
}
diff --git a/packages/dnb-eufemia/src/shared/__tests__/Context.test.tsx b/packages/dnb-eufemia/src/shared/__tests__/Context.test.tsx
index db595667e6f..a769468ff0d 100644
--- a/packages/dnb-eufemia/src/shared/__tests__/Context.test.tsx
+++ b/packages/dnb-eufemia/src/shared/__tests__/Context.test.tsx
@@ -71,14 +71,14 @@ describe('Context', () => {
const helpButtonNb = screen.getByLabelText(title_nb)
expect(helpButtonNb.getAttribute('aria-label')).toBe(title_nb)
expect(helpButtonNb.getAttribute('aria-roledescription')).toBe(
- 'Hjelp-knapp'
+ 'Hjelp-knapp',
)
render(content )
const helpButtonGb = screen.getByLabelText(title_gb)
expect(helpButtonGb.getAttribute('aria-label')).toBe(title_gb)
expect(helpButtonGb.getAttribute('aria-roledescription')).toBe(
- 'Help button'
+ 'Help button',
)
})
diff --git a/packages/dnb-eufemia/src/shared/__tests__/MediaQuery.test.tsx b/packages/dnb-eufemia/src/shared/__tests__/MediaQuery.test.tsx
index 176c2d70104..9bc4a9692b0 100644
--- a/packages/dnb-eufemia/src/shared/__tests__/MediaQuery.test.tsx
+++ b/packages/dnb-eufemia/src/shared/__tests__/MediaQuery.test.tsx
@@ -58,14 +58,14 @@ describe('MediaQuery', () => {
render(
medium
-
+ ,
)
expect(screen.queryByText('medium')).toBeInTheDocument()
})
it('should match for query when different breakpoints are given', () => {
matchMedia.useMediaQuery(
- '(min-width: 40em) and (max-width: 80em), (min-width: 0) and (max-width: 30rem), (max-width: 90em)'
+ '(min-width: 40em) and (max-width: 80em), (min-width: 0) and (max-width: 30rem), (max-width: 90em)',
)
render(
@@ -86,7 +86,7 @@ describe('MediaQuery', () => {
>
medium
-
+ ,
)
expect(screen.queryByText('medium')).toBeInTheDocument()
@@ -94,7 +94,7 @@ describe('MediaQuery', () => {
it('should match for query when custom breakpoints are given', () => {
matchMedia.useMediaQuery(
- '(min-width: 0) and (max-width: 20rem), (max-width: 90rem)'
+ '(min-width: 0) and (max-width: 20rem), (max-width: 90rem)',
)
render(
@@ -109,7 +109,7 @@ describe('MediaQuery', () => {
xsmall
-
+ ,
)
expect(screen.queryByText('xsmall')).toBeInTheDocument()
@@ -117,7 +117,7 @@ describe('MediaQuery', () => {
it('should match for query when breakpoint is got removed', () => {
matchMedia.useMediaQuery(
- '(min-width: 0) and (max-width: 20rem), (min-width: 71rem)'
+ '(min-width: 0) and (max-width: 20rem), (min-width: 71rem)',
)
render(
@@ -138,7 +138,7 @@ describe('MediaQuery', () => {
>
xsmall
-
+ ,
)
expect(screen.queryByText('xsmall')).toBeInTheDocument()
@@ -150,7 +150,7 @@ describe('MediaQuery', () => {
render(
medium
-
+ ,
)
expect(screen.queryByText('medium')).toBeInTheDocument()
@@ -158,7 +158,7 @@ describe('MediaQuery', () => {
it('should match for query with medium and large width', () => {
matchMedia.useMediaQuery(
- '(min-width: 60em) and (max-width: 72em), (min-width: 72em) and (max-width: 80em)'
+ '(min-width: 60em) and (max-width: 72em), (min-width: 72em) and (max-width: 80em)',
)
render(
@@ -169,14 +169,14 @@ describe('MediaQuery', () => {
]}
>
medium large
-
+ ,
)
expect(screen.queryByText('medium large')).toBeInTheDocument()
})
it('should handle media query changes', () => {
matchMedia.useMediaQuery(
- 'not screen and (min-width: 0) and (max-width: 72em)'
+ 'not screen and (min-width: 0) and (max-width: 72em)',
)
const Playground = () => {
diff --git a/packages/dnb-eufemia/src/shared/__tests__/MediaQueryUtils.test.tsx b/packages/dnb-eufemia/src/shared/__tests__/MediaQueryUtils.test.tsx
index a36b7a366ef..58702dee5a6 100644
--- a/packages/dnb-eufemia/src/shared/__tests__/MediaQueryUtils.test.tsx
+++ b/packages/dnb-eufemia/src/shared/__tests__/MediaQueryUtils.test.tsx
@@ -51,7 +51,7 @@ describe('onMediaQueryChange', () => {
false,
expect.objectContaining({
matches: false,
- })
+ }),
)
matchMedia.useMediaQuery('(min-width: 72em)')
@@ -60,7 +60,7 @@ describe('onMediaQueryChange', () => {
true,
expect.objectContaining({
matches: true,
- })
+ }),
)
})
@@ -92,13 +92,13 @@ describe('buildQuery', () => {
it('should return query string for media type with orientation', () => {
expect(buildQuery({ when: { orientation: 'landscape' } })).toBe(
- '(orientation: landscape)'
+ '(orientation: landscape)',
)
})
it('should return query string for media features', () => {
expect(buildQuery({ when: { minWidth: 10, maxWidth: 20 } })).toBe(
- '(min-width: 10em) and (max-width: 20em)'
+ '(min-width: 10em) and (max-width: 20em)',
)
})
@@ -115,7 +115,7 @@ describe('buildQuery', () => {
minWidth: 10,
maxWidth: 20,
},
- })
+ }),
).toBe('screen and (min-width: 10em) and (max-width: 20em)')
})
@@ -126,7 +126,7 @@ describe('buildQuery', () => {
minWidth: 'small',
maxWidth: 'large',
},
- })
+ }),
).toBe('(min-width: 40em) and (max-width: 72em)')
})
@@ -137,7 +137,7 @@ describe('buildQuery', () => {
min: 'small',
max: 'large',
},
- })
+ }),
).toBe('(min-width: 40em) and (max-width: 72em)')
})
@@ -149,7 +149,7 @@ describe('buildQuery', () => {
min: 'small',
max: 'large',
},
- })
+ }),
).toBe('not all and (min-width: 40em) and (max-width: 72em)')
})
@@ -161,7 +161,7 @@ describe('buildQuery', () => {
min: 'small',
max: 'large',
},
- })
+ }),
).toBe('not all and (min-width: 40em) and (max-width: 72em)')
})
@@ -171,7 +171,7 @@ describe('buildQuery', () => {
when: {
min: 'small',
},
- })
+ }),
).toBe('(min-width: 40em)')
expect(
@@ -179,7 +179,7 @@ describe('buildQuery', () => {
when: {
minWidth: 'small',
},
- })
+ }),
).toBe('(min-width: 40em)')
})
@@ -190,7 +190,7 @@ describe('buildQuery', () => {
min: 10,
max: '72em',
},
- })
+ }),
).toBe('(min-width: 10em) and (max-width: 72em)')
})
@@ -203,7 +203,7 @@ describe('buildQuery', () => {
min: 'small',
max: 'large',
},
- })
+ }),
).toBe('all and (min-width: 40em) and (max-width: 72em)')
})
@@ -215,7 +215,7 @@ describe('buildQuery', () => {
min: 'small',
max: 'large',
},
- })
+ }),
).toBe('not all and (min-width: 40em) and (max-width: 72em)')
})
@@ -223,7 +223,7 @@ describe('buildQuery', () => {
expect(
buildQuery({
when: [{ max: 'small' }, { min: 'large', max: 'x-large' }],
- })
+ }),
).toBe('(max-width: 40em), (min-width: 72em) and (max-width: 80em)')
})
@@ -231,7 +231,7 @@ describe('buildQuery', () => {
expect(
buildQuery({
when: [{ max: 'small' }, { min: 'x-large', max: 'xx-large' }],
- })
+ }),
).toBe('(max-width: 40em), (min-width: 80em) and (max-width: 90em)')
})
@@ -242,13 +242,13 @@ describe('buildQuery', () => {
{ minWidth: 10 },
{ handheld: true, orientation: 'landscape' },
],
- })
+ }),
).toBe('(min-width: 10em), handheld and (orientation: landscape)')
})
it('should only return feature if its value is true', () => {
expect(buildQuery({ when: { all: true, monochrome: true } })).toBe(
- 'all and monochrome'
+ 'all and monochrome',
)
})
})
@@ -295,13 +295,13 @@ describe('convertToMediaQuery', () => {
it('should return query string for media type with orientation', () => {
expect(convertToMediaQuery({ orientation: 'landscape' })).toBe(
- '(orientation: landscape)'
+ '(orientation: landscape)',
)
})
it('should return query string for media features', () => {
expect(convertToMediaQuery({ minWidth: 10, maxWidth: 20 })).toBe(
- '(min-width: 10em) and (max-width: 20em)'
+ '(min-width: 10em) and (max-width: 20em)',
)
})
@@ -311,7 +311,7 @@ describe('convertToMediaQuery', () => {
screen: true,
minWidth: 10,
maxWidth: 20,
- })
+ }),
).toBe('screen and (min-width: 10em) and (max-width: 20em)')
})
@@ -320,7 +320,7 @@ describe('convertToMediaQuery', () => {
convertToMediaQuery({
minWidth: 'small',
maxWidth: 'large',
- })
+ }),
).toBe('(min-width: 40em) and (max-width: 72em)')
})
@@ -329,7 +329,7 @@ describe('convertToMediaQuery', () => {
convertToMediaQuery({
min: 'small',
max: 'large',
- })
+ }),
).toBe('(min-width: 40em) and (max-width: 72em)')
})
@@ -339,7 +339,7 @@ describe('convertToMediaQuery', () => {
not: true,
min: 'small',
max: 'large',
- })
+ }),
).toBe('not all and (min-width: 40em) and (max-width: 72em)')
})
@@ -348,7 +348,7 @@ describe('convertToMediaQuery', () => {
convertToMediaQuery({
minWidth: 10,
aspectRatio: '3/4',
- })
+ }),
).toBe('(min-width: 10em) and (aspect-ratio: 3/4)')
})
@@ -357,7 +357,7 @@ describe('convertToMediaQuery', () => {
convertToMediaQuery({
minWidth: '10em',
aspectRatio: '3/4',
- })
+ }),
).toBe('(min-width: 10em) and (aspect-ratio: 3/4)')
})
@@ -366,13 +366,13 @@ describe('convertToMediaQuery', () => {
convertToMediaQuery([
{ minWidth: 10 },
{ handheld: true, orientation: 'landscape' },
- ])
+ ]),
).toBe('(min-width: 10em), handheld and (orientation: landscape)')
})
it('should only return feature if its value is true', () => {
expect(convertToMediaQuery({ all: true, monochrome: true })).toBe(
- 'all and monochrome'
+ 'all and monochrome',
)
})
})
diff --git a/packages/dnb-eufemia/src/shared/__tests__/Provider.test.tsx b/packages/dnb-eufemia/src/shared/__tests__/Provider.test.tsx
index c2ea4f6edd7..c19d6e8e60e 100644
--- a/packages/dnb-eufemia/src/shared/__tests__/Provider.test.tsx
+++ b/packages/dnb-eufemia/src/shared/__tests__/Provider.test.tsx
@@ -90,35 +90,35 @@ describe('Provider', () => {
const { rerender } = render(
content
-
+ ,
)
expect(
document
.querySelector('button.dnb-help-button')
- .getAttribute('aria-label')
+ .getAttribute('aria-label'),
).toBe(title_nb)
expect(
document
.querySelector('button.dnb-help-button')
- .getAttribute('aria-roledescription')
+ .getAttribute('aria-roledescription'),
).toBe('Hjelp-knapp')
rerender(
content
-
+ ,
)
expect(
document
.querySelector('button.dnb-help-button')
- .getAttribute('aria-label')
+ .getAttribute('aria-label'),
).toBe(title_gb)
expect(
document
.querySelector('button.dnb-help-button')
- .getAttribute('aria-roledescription')
+ .getAttribute('aria-roledescription'),
).toBe('Help button')
})
@@ -154,7 +154,7 @@ describe('Provider', () => {
render(
-
+ ,
)
const getRootElement = () => document.querySelectorAll('p')[0]
@@ -175,7 +175,7 @@ describe('Provider', () => {
expect(
document
.querySelectorAll('.nb-NO button')[1]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
// should not have changed
@@ -186,7 +186,7 @@ describe('Provider', () => {
expect(
document
.querySelectorAll('.en-GB button')[0]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
expect(getRootElement().textContent).toBe(title_gb)
@@ -195,7 +195,7 @@ describe('Provider', () => {
expect(
document
.querySelectorAll('.en-US button')[0]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
expect(getRootElement().textContent).toBe(title_gb)
@@ -217,7 +217,7 @@ describe('Provider', () => {
-
+ ,
)
expect(receivedLocale).toBe(locale)
@@ -257,7 +257,7 @@ describe('Provider', () => {
-
+ ,
)
const getRootLocale = () =>
@@ -312,7 +312,7 @@ describe('Provider', () => {
-
+ ,
)
const getRootLocale = () =>
@@ -366,7 +366,7 @@ describe('Provider', () => {
-
+ ,
)
const getRootLocale = () =>
@@ -385,7 +385,7 @@ describe('Provider', () => {
-
+ ,
)
expect(getRootLocale()).toBe('changed')
@@ -396,7 +396,7 @@ describe('Provider', () => {
render(
-
+ ,
)
const getRootElement = () => document.querySelectorAll('p')[0]
@@ -412,13 +412,13 @@ describe('Provider', () => {
expect(
document
.querySelectorAll('.en-GB button')[0]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
expect(getNestedElement().textContent).toBe(title_nb)
expect(
document
.querySelectorAll('.nb-NO button')[1]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
// First, let's change the inner
@@ -428,13 +428,13 @@ describe('Provider', () => {
expect(
document
.querySelectorAll('.en-GB button')[0]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
expect(getNestedElement().textContent).toBe(title_nb)
expect(
document
.querySelectorAll('.nb-NO button')[1]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
switchNestedTo('en-GB')
@@ -443,13 +443,13 @@ describe('Provider', () => {
expect(
document
.querySelectorAll('.en-GB button')[0]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
expect(getNestedElement().textContent).toBe(title_gb)
expect(
document
.querySelectorAll('.en-GB button')[1]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
switchNestedTo('nb-NO')
@@ -458,13 +458,13 @@ describe('Provider', () => {
expect(
document
.querySelectorAll('.nb-NO button')[0]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
expect(getNestedElement().textContent).toBe(title_nb)
expect(
document
.querySelectorAll('.nb-NO button')[1]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
// Now, let's change the outer
@@ -474,13 +474,13 @@ describe('Provider', () => {
expect(
document
.querySelectorAll('.en-GB button')[0]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
expect(getNestedElement().textContent).toBe(title_nb)
expect(
document
.querySelectorAll('.nb-NO button')[1]
- .getAttribute('aria-pressed')
+ .getAttribute('aria-pressed'),
).toBe('true')
})
})
diff --git a/packages/dnb-eufemia/src/shared/__tests__/Theme.test.tsx b/packages/dnb-eufemia/src/shared/__tests__/Theme.test.tsx
index cb032365ab2..7513b7fc61a 100644
--- a/packages/dnb-eufemia/src/shared/__tests__/Theme.test.tsx
+++ b/packages/dnb-eufemia/src/shared/__tests__/Theme.test.tsx
@@ -21,7 +21,7 @@ describe('Theme', () => {
render(
content
-
+ ,
)
const element = document.querySelector('.eufemia-theme')
@@ -38,7 +38,7 @@ describe('Theme', () => {
content
-
+ ,
)
const element1 = document.querySelector('#theme-1')
@@ -98,12 +98,12 @@ describe('Theme', () => {
render(
content
-
+ ,
)
const element = document.querySelector('.eufemia-theme')
const attributes = Array.from(element.attributes).map(
- (attr) => attr.name
+ (attr) => attr.name,
)
expect(attributes).toEqual(['class', 'aria-label'])
})
@@ -119,12 +119,12 @@ describe('Theme', () => {
const Component = React.forwardRef(
(
{ children, ...rest }: { children: React.ReactNode },
- ref: React.LegacyRef
+ ref: React.LegacyRef,
) => (
{children}
- )
+ ),
)
render(content )
@@ -136,13 +136,13 @@ describe('Theme', () => {
const { rerender } = render(content )
expect(
- document.querySelector('.eufemia-theme')
+ document.querySelector('.eufemia-theme'),
).not.toBeInTheDocument()
rerender(content )
expect(
- document.querySelector('.eufemia-theme')
+ document.querySelector('.eufemia-theme'),
).not.toBeInTheDocument()
rerender(content )
@@ -158,7 +158,7 @@ describe('Portals', () => {
-
+ ,
)
const element = document.querySelector('.eufemia-theme')
@@ -169,7 +169,7 @@ describe('Portals', () => {
'eufemia-theme',
'eufemia-theme__eiendom',
'eufemia-theme__eiendom--soft',
- ])
+ ]),
)
expect(document.querySelectorAll('.eufemia-theme')).toHaveLength(1)
})
@@ -180,7 +180,7 @@ describe('Portals', () => {
content
-
+ ,
)
const element = document.querySelector('.eufemia-theme')
@@ -192,7 +192,7 @@ describe('Portals', () => {
'eufemia-theme',
'eufemia-theme__eiendom',
'eufemia-theme__eiendom--soft',
- ])
+ ]),
)
expect(document.querySelectorAll('.eufemia-theme')).toHaveLength(1)
})
@@ -201,7 +201,7 @@ describe('Portals', () => {
render(
-
+ ,
)
const element = document.querySelector('.eufemia-theme')
@@ -211,7 +211,7 @@ describe('Portals', () => {
'eufemia-theme',
'eufemia-theme__eiendom',
'eufemia-theme__eiendom--soft',
- ])
+ ]),
)
expect(document.querySelectorAll('.eufemia-theme')).toHaveLength(1)
})
@@ -220,7 +220,7 @@ describe('Portals', () => {
render(
-
+ ,
)
const element = document.querySelector('.eufemia-theme')
@@ -230,7 +230,7 @@ describe('Portals', () => {
'eufemia-theme',
'eufemia-theme__eiendom',
'eufemia-theme__eiendom--soft',
- ])
+ ]),
)
expect(document.querySelectorAll('.eufemia-theme')).toHaveLength(1)
})
@@ -239,7 +239,7 @@ describe('Portals', () => {
render(
-
+ ,
)
const element = document.querySelector('.eufemia-theme')
@@ -249,7 +249,7 @@ describe('Portals', () => {
'eufemia-theme',
'eufemia-theme__eiendom',
'eufemia-theme__eiendom--soft',
- ])
+ ]),
)
expect(document.querySelectorAll('.eufemia-theme')).toHaveLength(1)
})
diff --git a/packages/dnb-eufemia/src/shared/__tests__/component-helper.test.js b/packages/dnb-eufemia/src/shared/__tests__/component-helper.test.js
index 3499c877f0f..939162658e5 100644
--- a/packages/dnb-eufemia/src/shared/__tests__/component-helper.test.js
+++ b/packages/dnb-eufemia/src/shared/__tests__/component-helper.test.js
@@ -206,12 +206,12 @@ describe('"validateDOMAttributes" should', () => {
const props = {}
const res1 = validateDOMAttributes(
props,
- Object.assign({}, { disabled: 'false' })
+ Object.assign({}, { disabled: 'false' }),
)
expect(res1).not.toHaveProperty('disabled')
const res2 = validateDOMAttributes(
props,
- Object.assign({}, { disabled: 'disabled' })
+ Object.assign({}, { disabled: 'disabled' }),
)
expect(res2).toHaveProperty('disabled')
})
@@ -299,20 +299,20 @@ describe('"extend" should', () => {
})
it('extend an object recursively and have correct object shape', () => {
expect(
- extend({ key1: { key2: null } }, { key1: { key2: 'value' } })
+ extend({ key1: { key2: null } }, { key1: { key2: 'value' } }),
).toEqual({
key1: { key2: 'value' },
})
expect(
- extend({ key1: { key2: 'value' } }, { key1: { key2: null } })
+ extend({ key1: { key2: 'value' } }, { key1: { key2: null } }),
).toEqual({
key1: { key2: 'value' },
})
expect(
extend(
{ key1: { key2: 'value' } },
- { key1: { key2: null, foo: 'bar' } }
- )
+ { key1: { key2: null, foo: 'bar' } },
+ ),
).toEqual({
key1: { key2: 'value', foo: 'bar' },
})
@@ -413,7 +413,7 @@ describe('"dispatchCustomElementEvent" should', () => {
expect.objectContaining({
attr: 'value',
prop: 'value',
- })
+ }),
)
})
})
@@ -429,8 +429,8 @@ describe('"findElementInChildren" should', () => {
React.createElement(
'span',
null,
- React.createElement('h2', null, 'and this')
- )
+ React.createElement('h2', null, 'and this'),
+ ),
)
const HeadingElement = findElementInChildren(children, (cur) => {
@@ -498,7 +498,7 @@ describe('"filterProps" should', () => {
describe('"makeUniqueId" should', () => {
it('have prepended "id-" by default', () => {
expect(makeUniqueId()).toEqual(
- expect.stringMatching(/^id-[a-z0-9]{8}/g)
+ expect.stringMatching(/^id-[a-z0-9]{8}/g),
)
})
@@ -515,7 +515,7 @@ describe('"makeUniqueId" should', () => {
it('have a prepended string', () => {
expect(makeUniqueId('string-', 10)).toEqual(
- expect.stringMatching(/^string-[a-z0-9]{10}/g)
+ expect.stringMatching(/^string-[a-z0-9]{10}/g),
)
})
})
@@ -563,7 +563,7 @@ describe('"matchAll" should', () => {
expect.arrayContaining([
expect.arrayContaining(['var(--color-one)', '--color-one']),
expect.arrayContaining(['var(--color-two)', '--color-two']),
- ])
+ ]),
)
})
})
@@ -577,7 +577,7 @@ describe('"convertJsxToString" should', () => {
reachable B,
]
expect(convertJsxToString(Content, '|')).toBe(
- 'reachable A|reachable B'
+ 'reachable A|reachable B',
)
})
@@ -590,7 +590,7 @@ describe('"convertJsxToString" should', () => {
reachable B,
]
expect(convertJsxToString(Content, ' ')).toBe(
- 'reachable A reachable B'
+ 'reachable A reachable B',
)
})
})
@@ -600,7 +600,7 @@ describe('"escapeRegexChars" should', () => {
it('escape regex chars', () => {
expect(escapeRegexChars(text)).toBe(
- '\\-\\\\\\{\\}\\(\\)\\*\\+\\?\\.\\,\\^\\$\\|\\#'
+ '\\-\\\\\\{\\}\\(\\)\\*\\+\\?\\.\\,\\^\\$\\|\\#',
)
})
})
diff --git a/packages/dnb-eufemia/src/shared/__tests__/helpers.test.js b/packages/dnb-eufemia/src/shared/__tests__/helpers.test.js
index e71f60dc46e..f4be77e87ff 100644
--- a/packages/dnb-eufemia/src/shared/__tests__/helpers.test.js
+++ b/packages/dnb-eufemia/src/shared/__tests__/helpers.test.js
@@ -46,7 +46,7 @@ describe('"applyPageFocus" should', () => {
`
My Content
- `
+ `,
)
setPageFocusElement('.focus-content', 'content')
@@ -104,7 +104,7 @@ describe('"applyPageFocus" should', () => {
fireEvent.blur(focusElement)
expect(focusElement.getAttribute('class')).not.toContain(
- 'dnb-no-focus'
+ 'dnb-no-focus',
)
})
})
@@ -116,7 +116,7 @@ describe('"scrollToLocationHashId" should', () => {
const bodyElement = document.body
bodyElement.insertAdjacentHTML(
'afterbegin',
- `My Content`
+ `My Content`,
)
scrollElement = document.querySelector('#scroll-hash')
@@ -273,7 +273,7 @@ describe('selection related methods', () => {
insertElementBeforeSelection(elem)
expect(
window.getSelection().getRangeAt(1).getElement() instanceof
- HTMLElement
+ HTMLElement,
).toBe(true)
})
})
@@ -311,7 +311,7 @@ describe('"debounce" should', () => {
expect(this.property).toBe(instance.property)
},
1,
- { instance }
+ { instance },
)
debounced()
@@ -329,7 +329,7 @@ describe('"debounce" should', () => {
expect(outside).toBe('two')
},
1,
- { immediate: true }
+ { immediate: true },
)
debounced({ inside: 'two' })
@@ -351,7 +351,7 @@ describe('"debounce" should', () => {
return inside
},
1,
- { immediate: true }
+ { immediate: true },
)
const immediateResult = debounced({ inside: 'two' })
@@ -403,7 +403,7 @@ describe('"warn" should', () => {
'%cEufemia',
'padding: 0.125rem 0.5rem 0;font-weight: bold;color: #00343E;background: #A5E1D2',
'message-1',
- 'message-2'
+ 'message-2',
)
process.env.NODE_ENV = env
@@ -419,7 +419,7 @@ describe('"warn" should', () => {
expect(global.console.log).toHaveBeenCalledWith(
'\u001b[0m\u001b[1m\u001b[38;5;23m\u001b[48;5;152mEufemia\u001b[49m\u001b[39m\u001b[22m\u001b[0m',
'message-1',
- 'message-2'
+ 'message-2',
)
process.env.NODE_ENV = env
diff --git a/packages/dnb-eufemia/src/shared/__tests__/useMedia.test.tsx b/packages/dnb-eufemia/src/shared/__tests__/useMedia.test.tsx
index de20aedb393..d19e153024c 100644
--- a/packages/dnb-eufemia/src/shared/__tests__/useMedia.test.tsx
+++ b/packages/dnb-eufemia/src/shared/__tests__/useMedia.test.tsx
@@ -39,7 +39,7 @@ describe('useMedia', () => {
isSmall: false,
isMedium: false,
isLarge: false,
- })
+ }),
)
})
@@ -53,7 +53,7 @@ describe('useMedia', () => {
isSmall: true,
isMedium: false,
isLarge: false,
- })
+ }),
)
act(() => {
@@ -66,7 +66,7 @@ describe('useMedia', () => {
isSmall: false,
isMedium: false,
isLarge: true,
- })
+ }),
)
})
})
@@ -81,7 +81,7 @@ describe('useMedia', () => {
isSmall: false,
isMedium: true,
isLarge: false,
- })
+ }),
)
act(() => {
@@ -94,7 +94,7 @@ describe('useMedia', () => {
isSmall: false,
isMedium: false,
isLarge: true,
- })
+ }),
)
})
})
@@ -109,7 +109,7 @@ describe('useMedia', () => {
isSmall: false,
isMedium: false,
isLarge: true,
- })
+ }),
)
act(() => {
@@ -122,7 +122,7 @@ describe('useMedia', () => {
isSmall: true,
isMedium: false,
isLarge: false,
- })
+ }),
)
})
})
@@ -137,7 +137,7 @@ describe('useMedia', () => {
isSmall: false,
isMedium: false,
isLarge: true,
- })
+ }),
)
const queries = [
@@ -213,7 +213,7 @@ describe('useMedia', () => {
isSmall: false,
isMedium: false,
isLarge: true,
- })
+ }),
)
rerender({ disabled: true })
@@ -231,7 +231,7 @@ describe('useMedia', () => {
isSmall: false,
isMedium: false,
isLarge: true,
- })
+ }),
)
})
@@ -247,7 +247,7 @@ describe('useMedia', () => {
isSmall: true,
isMedium: false,
isLarge: false,
- })
+ }),
)
/**
@@ -271,7 +271,7 @@ describe('useMedia', () => {
isSmall: false,
isMedium: false,
isLarge: true,
- })
+ }),
)
})
})
@@ -289,7 +289,7 @@ describe('useMedia', () => {
isMedium: false,
isLarge: false,
isSSR: true,
- })
+ }),
)
})
@@ -325,7 +325,7 @@ describe('useMedia', () => {
isMedium: true,
isLarge: false,
isSSR: false,
- })
+ }),
)
act(() => {
@@ -400,7 +400,7 @@ describe('useMedia', () => {
isMedium: true,
isLarge: false,
isSSR: false,
- })
+ }),
)
act(() => {
@@ -412,7 +412,7 @@ describe('useMedia', () => {
isMedium: false,
isLarge: true,
isSSR: false,
- })
+ }),
)
expect(count).toBe(10)
@@ -445,7 +445,7 @@ describe('useMedia', () => {
isSmall: false,
isMedium: false,
isLarge: true,
- })
+ }),
)
const queries = [
@@ -533,7 +533,7 @@ describe('useMedia', () => {
isSmall: true,
isMedium: false,
isLarge: false,
- })
+ }),
)
})
@@ -548,7 +548,7 @@ describe('useMedia', () => {
isSmall: false,
isMedium: true,
isLarge: false,
- })
+ }),
)
})
@@ -563,7 +563,7 @@ describe('useMedia', () => {
isSmall: false,
isMedium: false,
isLarge: true,
- })
+ }),
)
})
})
diff --git a/packages/dnb-eufemia/src/shared/__tests__/useMediaQuery.test.tsx b/packages/dnb-eufemia/src/shared/__tests__/useMediaQuery.test.tsx
index 65017da0b89..c7949700c3c 100644
--- a/packages/dnb-eufemia/src/shared/__tests__/useMediaQuery.test.tsx
+++ b/packages/dnb-eufemia/src/shared/__tests__/useMediaQuery.test.tsx
@@ -55,7 +55,7 @@ describe('useMediaQuery', () => {
const { rerender } = render(
medium
-
+ ,
)
expect(document.getElementById('mq-mock').textContent).toBe('medium')
@@ -63,7 +63,7 @@ describe('useMediaQuery', () => {
rerender(
medium
-
+ ,
)
expect(document.getElementById('mq-mock').textContent).toBe('')
@@ -84,7 +84,7 @@ describe('useMediaQuery', () => {
medium
-
+ ,
)
expect(document.getElementById('mq-mock').textContent).toBe('medium')
@@ -96,7 +96,7 @@ describe('useMediaQuery', () => {
render(
matches
-
+ ,
)
expect(document.getElementById('mq-mock').textContent).toBe('matches')
@@ -104,7 +104,7 @@ describe('useMediaQuery', () => {
it('should handle media query changes', () => {
matchMedia.useMediaQuery(
- 'not screen and (min-width: 40em) and (max-width: 72em)'
+ 'not screen and (min-width: 40em) and (max-width: 72em)',
)
const match1Handler = jest.fn()
@@ -173,7 +173,7 @@ describe('useMediaQuery', () => {
const { result: resultA } = renderHook(() =>
useMediaQuery({
when,
- })
+ }),
)
expect(window.matchMedia).toBeCalledTimes(2)
@@ -187,7 +187,7 @@ describe('useMediaQuery', () => {
useMediaQuery({
disabled: true,
when,
- })
+ }),
)
expect(window.matchMedia).toBeCalledTimes(2)
diff --git a/packages/dnb-eufemia/src/shared/__tests__/useTranslation.test.tsx b/packages/dnb-eufemia/src/shared/__tests__/useTranslation.test.tsx
index df61ba77de2..118bc5ea2c1 100644
--- a/packages/dnb-eufemia/src/shared/__tests__/useTranslation.test.tsx
+++ b/packages/dnb-eufemia/src/shared/__tests__/useTranslation.test.tsx
@@ -93,11 +93,11 @@ describe('Translation', () => {
max: 'max',
})}
-
+ ,
)
expect(document.querySelector('span.getTranslation').textContent).toBe(
- expected_nbNO
+ expected_nbNO,
)
})
@@ -113,14 +113,14 @@ describe('Translation', () => {
other.string
-
+ ,
)
expect(document.querySelector('span.Translation').textContent).toBe(
- expected_nbNO
+ expected_nbNO,
)
expect(
- document.querySelector('span.TranslationIdAsChildren').textContent
+ document.querySelector('span.TranslationIdAsChildren').textContent,
).toBe(expected_nbNO)
})
@@ -130,11 +130,11 @@ describe('Translation', () => {
-
+ ,
)
expect(document.querySelector('span.useTranslation').textContent).toBe(
- expected_nbNO
+ expected_nbNO,
)
})
@@ -145,17 +145,17 @@ describe('Translation', () => {
-
+ ,
)
expect(document.querySelector('span.useTranslation').textContent).toBe(
- expected_nbNO
+ expected_nbNO,
)
fireEvent.click(document.querySelector('button.en-GB'))
expect(document.querySelector('span.useTranslation').textContent).toBe(
- expected_enGB
+ expected_enGB,
)
})
@@ -175,32 +175,32 @@ describe('Translation', () => {
-
+ ,
)
expect(document.querySelector('span.root').textContent).toBe(
- expected_nbNO
+ expected_nbNO,
)
expect(document.querySelector('span.nested').textContent).toBe(
- expected_nbNO_nested
+ expected_nbNO_nested,
)
fireEvent.click(document.querySelector('div.root button.en-GB'))
expect(document.querySelector('span.root').textContent).toBe(
- expected_enGB
+ expected_enGB,
)
expect(document.querySelector('span.nested').textContent).toBe(
- expected_enGB_nested
+ expected_enGB_nested,
)
fireEvent.click(document.querySelector('div.nested button.en-GB'))
expect(document.querySelector('span.root').textContent).toBe(
- expected_enGB
+ expected_enGB,
)
expect(document.querySelector('span.nested').textContent).toBe(
- expected_enGB_nested
+ expected_enGB_nested,
)
// if we change the nested locale ...
@@ -208,10 +208,10 @@ describe('Translation', () => {
// ... we also change the root
expect(document.querySelector('span.root').textContent).toBe(
- expected_nbNO
+ expected_nbNO,
)
expect(document.querySelector('span.nested').textContent).toBe(
- expected_nbNO_nested
+ expected_nbNO_nested,
)
})
})
@@ -249,19 +249,19 @@ describe('Context.getTranslation', () => {
const { rerender } = render( )
expect(document.querySelector('p.title').textContent).toBe(
- nbNO['nb-NO'].HelpButton.title
+ nbNO['nb-NO'].HelpButton.title,
)
expect(document.querySelector('p.locale').textContent).toBe('nb-NO')
rerender( )
expect(document.querySelector('p.title').textContent).toBe(
- enGB['en-GB'].HelpButton.title
+ enGB['en-GB'].HelpButton.title,
)
// locale should not be changed
expect(document.querySelector('p.locale').textContent).not.toBe(
- 'en-GB'
+ 'en-GB',
)
expect(document.querySelector('p.locale').textContent).toBe('nb-NO')
})
@@ -270,13 +270,13 @@ describe('Context.getTranslation', () => {
const { rerender } = render( )
expect(document.querySelector('p.other-string').textContent).toBe(
- given_nbNO
+ given_nbNO,
)
rerender( )
expect(document.querySelector('p.other-string').textContent).toBe(
- given_enGB
+ given_enGB,
)
})
})
diff --git a/packages/dnb-eufemia/src/shared/component-helper.js b/packages/dnb-eufemia/src/shared/component-helper.js
index de5c00164c8..0000e221d94 100644
--- a/packages/dnb-eufemia/src/shared/component-helper.js
+++ b/packages/dnb-eufemia/src/shared/component-helper.js
@@ -274,7 +274,7 @@ export const extend = (...objects) => {
}
}
return acc2
- }, {})
+ }, {}),
)
}
return acc1
@@ -296,7 +296,7 @@ export const isTrue = (value) => {
export const dispatchCustomElementEvent = (
src,
eventName,
- eventObjectOrig
+ eventObjectOrig,
) => {
let ret = undefined
@@ -390,9 +390,9 @@ export const toCamelCase = (s) =>
? cur
: cur.replace(
/(\w)(\w*)/g,
- (g0, g1, g2) => g1.toUpperCase() + g2.toLowerCase()
+ (g0, g1, g2) => g1.toUpperCase() + g2.toLowerCase(),
)),
- ''
+ '',
)
// TODO: Test if this solution is faster
@@ -410,9 +410,9 @@ export const toPascalCase = (s) =>
acc +
cur.replace(
/(\w)(\w*)/g,
- (g0, g1, g2) => g1.toUpperCase() + g2.toLowerCase()
+ (g0, g1, g2) => g1.toUpperCase() + g2.toLowerCase(),
),
- ''
+ '',
)
// transform MyComponent to my_component
@@ -449,7 +449,7 @@ export class DetectOutsideClickClass {
event,
ignoreElements,
},
- () => typeof onSuccess === 'function' && onSuccess({ event })
+ () => typeof onSuccess === 'function' && onSuccess({ event }),
)
}
document.addEventListener('mousedown', this.handleClickOutside)
@@ -556,7 +556,7 @@ const overflowIsScrollable = (elem) => {
return /scroll|auto/i.test(
(style.overflow || '') +
(style.overflowX || '') +
- (style.overflowY || '')
+ (style.overflowY || ''),
)
}
@@ -587,7 +587,7 @@ export const filterProps = (props, remove = null, allowed = null) => {
export const makeUniqueId = (prefix = 'id-', length = 8) =>
prefix +
String(
- Math.random().toString(36).substr(2, length) + idIncrement++
+ Math.random().toString(36).substr(2, length) + idIncrement++,
).slice(-length)
let idIncrement = 0
diff --git a/packages/dnb-eufemia/src/shared/error-helper.js b/packages/dnb-eufemia/src/shared/error-helper.js
index 9a1afcd1cbf..e2e2126463d 100644
--- a/packages/dnb-eufemia/src/shared/error-helper.js
+++ b/packages/dnb-eufemia/src/shared/error-helper.js
@@ -9,7 +9,7 @@ export const ERROR_FATAL = 500
export function ErrorHandler(
error,
{ message } = { message: null },
- code = ERROR_HARMLESS
+ code = ERROR_HARMLESS,
) {
if (typeof error === 'object') {
message = error.message
diff --git a/packages/dnb-eufemia/src/shared/helpers.js b/packages/dnb-eufemia/src/shared/helpers.js
index 8e6b4268a90..9d3053c8257 100644
--- a/packages/dnb-eufemia/src/shared/helpers.js
+++ b/packages/dnb-eufemia/src/shared/helpers.js
@@ -188,7 +188,7 @@ export function scrollToLocationHashId({
onCompletion(elem)
}
}
- }
+ },
)
// start observing
intersectionObserver.observe(elem)
@@ -218,7 +218,7 @@ export function scrollToLocationHashId({
const elem = document.getElementById(id)
if (elem instanceof HTMLElement) {
window.addEventListener('beforeunload', () =>
- clearTimeout(_timeout)
+ clearTimeout(_timeout),
)
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', handleScroll)
@@ -253,7 +253,7 @@ export function scrollToLocationHashId({
export function debounce(
func,
wait = 250,
- { immediate = false, instance = null } = {}
+ { immediate = false, instance = null } = {},
) {
let timeout
let recall
@@ -482,7 +482,7 @@ export const warn = (...params) => {
console.log(
// How to generate it: JSON.stringify(chalk.reset.bold.hex('#00343E').bgHex('#A5E1D2')('Eufemia'))
'\u001b[0m\u001b[1m\u001b[38;5;23m\u001b[48;5;152mEufemia\u001b[49m\u001b[39m\u001b[22m\u001b[0m',
- ...params
+ ...params,
)
}
}
diff --git a/packages/dnb-eufemia/src/shared/helpers/InteractionInvalidation.ts b/packages/dnb-eufemia/src/shared/helpers/InteractionInvalidation.ts
index 0477e5192aa..528c8b4d65a 100644
--- a/packages/dnb-eufemia/src/shared/helpers/InteractionInvalidation.ts
+++ b/packages/dnb-eufemia/src/shared/helpers/InteractionInvalidation.ts
@@ -38,7 +38,7 @@ export class InteractionInvalidation {
}
setBypassSelector(
- bypassSelector: TargetSelector | Array
+ bypassSelector: TargetSelector | Array,
) {
if (!Array.isArray(bypassSelector)) {
bypassSelector = [bypassSelector]
@@ -125,7 +125,7 @@ export class InteractionInvalidation {
}
getNodesToInvalidate(
- targetElement: TargetElement | TargetSelector = null
+ targetElement: TargetElement | TargetSelector = null,
): Array {
if (typeof document === 'undefined') {
return [] // stop here
@@ -133,7 +133,7 @@ export class InteractionInvalidation {
if (typeof targetElement === 'string') {
targetElement = document.querySelector(
- targetElement
+ targetElement,
) as TargetElement
}
@@ -162,8 +162,8 @@ export class InteractionInvalidation {
(
(targetElement as TargetElement) ||
document.documentElement
- ).querySelectorAll(localSel.match(/\(([^)]*)\)/)[1])
- )
+ ).querySelectorAll(localSel.match(/\(([^)]*)\)/)[1]),
+ ),
)
localSel = localSel.replace(' *', '')
}
@@ -174,17 +174,17 @@ export class InteractionInvalidation {
return Array.from(
(targetElement || document.documentElement).querySelectorAll(
- testSelector
- )
+ testSelector,
+ ),
).filter(
- (node) => !excludeSelectors.includes(node)
+ (node) => !excludeSelectors.includes(node),
) as Array
}
return Array.from(
(targetElement || document.documentElement).querySelectorAll(
- selector
- )
+ selector,
+ ),
)
}
}
diff --git a/packages/dnb-eufemia/src/shared/helpers/Suffix.tsx b/packages/dnb-eufemia/src/shared/helpers/Suffix.tsx
index 4fdf842ec71..f2b542d0b82 100644
--- a/packages/dnb-eufemia/src/shared/helpers/Suffix.tsx
+++ b/packages/dnb-eufemia/src/shared/helpers/Suffix.tsx
@@ -33,7 +33,7 @@ const Suffix = ({
'dnb-suffix',
!React.isValidElement(children) &&
createSkeletonClass('font', skeleton, context),
- className
+ className,
)}
{...props}
>
diff --git a/packages/dnb-eufemia/src/shared/helpers/__tests__/EventEmitter.test.ts b/packages/dnb-eufemia/src/shared/helpers/__tests__/EventEmitter.test.ts
index 8ccfed38240..2a1c9093601 100644
--- a/packages/dnb-eufemia/src/shared/helpers/__tests__/EventEmitter.test.ts
+++ b/packages/dnb-eufemia/src/shared/helpers/__tests__/EventEmitter.test.ts
@@ -38,18 +38,18 @@ describe('EventEmitter', () => {
it('should merge data at once dimention', () => {
instanceA.set({ foo: 'bar' })
expect(instanceA.get()).toMatchObject(
- expect.objectContaining({ foo: 'bar' })
+ expect.objectContaining({ foo: 'bar' }),
)
expect(instanceB.get()).toMatchObject(
- expect.objectContaining({ foo: 'bar' })
+ expect.objectContaining({ foo: 'bar' }),
)
instanceA.set({ foo: 'z' })
expect(instanceA.get()).toMatchObject(
- expect.objectContaining({ foo: 'z' })
+ expect.objectContaining({ foo: 'z' }),
)
expect(instanceB.get()).toMatchObject(
- expect.objectContaining({ foo: 'z' })
+ expect.objectContaining({ foo: 'z' }),
)
})
diff --git a/packages/dnb-eufemia/src/shared/helpers/__tests__/InteractionInvalidation.test.ts b/packages/dnb-eufemia/src/shared/helpers/__tests__/InteractionInvalidation.test.ts
index a73b509e4df..5542d388b83 100644
--- a/packages/dnb-eufemia/src/shared/helpers/__tests__/InteractionInvalidation.test.ts
+++ b/packages/dnb-eufemia/src/shared/helpers/__tests__/InteractionInvalidation.test.ts
@@ -29,33 +29,33 @@ describe('InteractionInvalidation', () => {
expect(
document
.querySelector(`${selector} h1`)
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('true')
expect(
- document.querySelector(`${selector} h1`).getAttribute('tabindex')
+ document.querySelector(`${selector} h1`).getAttribute('tabindex'),
).toBe('0')
expect(
document
.querySelector(`${selector} h2`)
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('false')
expect(
- document.querySelector(`${selector} h2`).getAttribute('tabindex')
+ document.querySelector(`${selector} h2`).getAttribute('tabindex'),
).toBe('-1')
expect(document.querySelector(`${selector} h3`)).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(document.querySelector(`${selector} h3`)).not.toHaveAttribute(
- 'tabindex'
+ 'tabindex',
)
expect(
- document.querySelector(`${selector} path`)
+ document.querySelector(`${selector} path`),
).not.toHaveAttribute('aria-hidden')
expect(
- document.querySelector(`${selector} path`)
+ document.querySelector(`${selector} path`),
).not.toHaveAttribute('tabindex')
}
@@ -63,35 +63,35 @@ describe('InteractionInvalidation', () => {
expect(
document
.querySelector(`${selector} h1`)
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('true')
expect(
- document.querySelector(`${selector} h1`).getAttribute('tabindex')
+ document.querySelector(`${selector} h1`).getAttribute('tabindex'),
).toBe('-1')
expect(
document
.querySelector(`${selector} h2`)
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('true')
expect(
- document.querySelector(`${selector} h2`).getAttribute('tabindex')
+ document.querySelector(`${selector} h2`).getAttribute('tabindex'),
).toBe('-1')
expect(
document
.querySelector(`${selector} h3`)
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('true')
expect(
- document.querySelector(`${selector} h3`).getAttribute('tabindex')
+ document.querySelector(`${selector} h3`).getAttribute('tabindex'),
).toBe('-1')
expect(
- document.querySelector(`${selector} path`)
+ document.querySelector(`${selector} path`),
).not.toHaveAttribute('aria-hidden')
expect(
- document.querySelector(`${selector} path`)
+ document.querySelector(`${selector} path`),
).not.toHaveAttribute('tabindex')
}
@@ -150,33 +150,33 @@ describe('InteractionInvalidation', () => {
expect(
document
.querySelector(`${selector} h1`)
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('true')
expect(
- document.querySelector(`${selector} h1`).getAttribute('tabindex')
+ document.querySelector(`${selector} h1`).getAttribute('tabindex'),
).toBe('0')
expect(
document
.querySelector(`${selector} h2`)
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('false')
expect(
- document.querySelector(`${selector} h2`).getAttribute('tabindex')
+ document.querySelector(`${selector} h2`).getAttribute('tabindex'),
).toBe('-1')
expect(document.querySelector(`${selector} h3`)).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(document.querySelector(`${selector} h3`)).not.toHaveAttribute(
- 'tabindex'
+ 'tabindex',
)
expect(
- document.querySelector(`${selector} path`)
+ document.querySelector(`${selector} path`),
).not.toHaveAttribute('aria-hidden')
expect(
- document.querySelector(`${selector} path`)
+ document.querySelector(`${selector} path`),
).not.toHaveAttribute('tabindex')
}
@@ -184,27 +184,27 @@ describe('InteractionInvalidation', () => {
expect(
document
.querySelector(`${selector} h1`)
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('true')
expect(
document
.querySelector(`${selector} h2`)
- .getAttribute('aria-hidden')
+ .getAttribute('aria-hidden'),
).toBe('false')
expect(
- document.querySelector(`${selector} h2`).getAttribute('tabindex')
+ document.querySelector(`${selector} h2`).getAttribute('tabindex'),
).toBe('-1')
expect(document.querySelector(`${selector} h3`)).not.toHaveAttribute(
- 'aria-hidden'
+ 'aria-hidden',
)
expect(
- document.querySelector(`${selector} path`)
+ document.querySelector(`${selector} path`),
).not.toHaveAttribute('aria-hidden')
expect(
- document.querySelector(`${selector} path`)
+ document.querySelector(`${selector} path`),
).not.toHaveAttribute('tabindex')
}
diff --git a/packages/dnb-eufemia/src/shared/helpers/__tests__/Suffix.test.tsx b/packages/dnb-eufemia/src/shared/helpers/__tests__/Suffix.test.tsx
index b33d56426b8..f6ed1a370f7 100644
--- a/packages/dnb-eufemia/src/shared/helpers/__tests__/Suffix.test.tsx
+++ b/packages/dnb-eufemia/src/shared/helpers/__tests__/Suffix.test.tsx
@@ -29,13 +29,13 @@ describe('Suffix', () => {
)
}}
-
+ ,
)
expect(
document
.querySelector('button.dnb-modal__trigger')
- .getAttribute('aria-label')
+ .getAttribute('aria-label'),
).toBe(more_info)
})
@@ -45,14 +45,14 @@ describe('Suffix', () => {
render(
Input Value
-
+ ,
)
expect(document.querySelector('.dnb-suffix').textContent).toBe(
- suffixContent
+ suffixContent,
)
expect(
- Array.from(document.querySelector('.dnb-suffix').classList)
+ Array.from(document.querySelector('.dnb-suffix').classList),
).toEqual([
'dnb-suffix',
'dnb-input__suffix',
@@ -65,14 +65,14 @@ describe('Suffix', () => {
render(
} skeleton>
Input Value
-
+ ,
)
expect(
- Array.from(document.querySelector('.dnb-suffix').classList)
+ Array.from(document.querySelector('.dnb-suffix').classList),
).toEqual(['dnb-suffix', 'dnb-input__suffix'])
expect(
- Array.from(document.querySelector('.dnb-help-button').classList)
+ Array.from(document.querySelector('.dnb-help-button').classList),
).toEqual(
expect.arrayContaining([
'dnb-button',
@@ -80,7 +80,7 @@ describe('Suffix', () => {
'dnb-skeleton',
'dnb-skeleton--shape',
'dnb-help-button',
- ])
+ ]),
)
})
})
diff --git a/packages/dnb-eufemia/src/shared/helpers/__tests__/extendPropsWithContext.test.ts b/packages/dnb-eufemia/src/shared/helpers/__tests__/extendPropsWithContext.test.ts
index 0a071908005..297af31e6cc 100644
--- a/packages/dnb-eufemia/src/shared/helpers/__tests__/extendPropsWithContext.test.ts
+++ b/packages/dnb-eufemia/src/shared/helpers/__tests__/extendPropsWithContext.test.ts
@@ -81,7 +81,7 @@ describe('extendPropsWithContext', () => {
props,
defaultProps,
context1,
- context2
+ context2,
)
expect(result).toEqual({
@@ -113,7 +113,7 @@ describe('extendPropsWithContextInClassComponent', () => {
const result = extendPropsWithContextInClassComponent(
props,
defaultProps,
- context1
+ context1,
)
expect(result).toEqual({
@@ -129,7 +129,7 @@ describe('extendPropsWithContextInClassComponent', () => {
const result = extendPropsWithContextInClassComponent(
props,
defaultProps,
- context1
+ context1,
)
expect(result).toEqual({
@@ -145,7 +145,7 @@ describe('extendPropsWithContextInClassComponent', () => {
const result = extendPropsWithContextInClassComponent(
props,
defaultProps,
- context1
+ context1,
)
expect(result).toEqual({
diff --git a/packages/dnb-eufemia/src/shared/helpers/__tests__/withCamelCaseProps.test.tsx b/packages/dnb-eufemia/src/shared/helpers/__tests__/withCamelCaseProps.test.tsx
index e0cc7815ece..1fde24819e4 100644
--- a/packages/dnb-eufemia/src/shared/helpers/__tests__/withCamelCaseProps.test.tsx
+++ b/packages/dnb-eufemia/src/shared/helpers/__tests__/withCamelCaseProps.test.tsx
@@ -56,7 +56,7 @@ describe('withCamelCaseProps', () => {
it('will render', () => {
const { rerender, asFragment } = render(
-
+ ,
)
rerender(
@@ -65,11 +65,11 @@ describe('withCamelCaseProps', () => {
camelCase={2}
custom_type={{ foo_bar: 1 }}
customType={{ fooBar: 1 }}
- />
+ />,
)
expect(screen.queryByTestId('props').textContent).toMatch(
- '{"snake_case":false,"custom_type":{"fooBar":1},"camel_case":2}'
+ '{"snake_case":false,"custom_type":{"fooBar":1},"camel_case":2}',
)
expect(asFragment()).toMatchInlineSnapshot(`
@@ -98,13 +98,13 @@ describe('withCamelCaseProps', () => {
const Component = withCamelCaseProps(
(props: IncludeCamelCase & ExtraTypes) => {
return
- }
+ },
)
const { asFragment } = render( )
expect(screen.queryByTestId('props').textContent).toMatch(
- '{"className":"value"}'
+ '{"className":"value"}',
)
expect(asFragment()).toMatchInlineSnapshot(`
@@ -130,11 +130,11 @@ describe('withCamelCaseProps', () => {
const { asFragment } = render(
-
+ ,
)
expect(screen.queryByTestId('context').textContent).toMatch(
- '{"contextProp":"context value"}'
+ '{"contextProp":"context value"}',
)
expect(asFragment()).toMatchInlineSnapshot(`
@@ -235,13 +235,13 @@ describe('classWithCamelCaseProps', () => {
const Component = classWithCamelCaseProps(Original)
const { rerender, asFragment } = render(
-
+ ,
)
rerender( )
expect(screen.queryByTestId('props').textContent).toMatch(
- '{"snake_case":false,"camel_case":2}'
+ '{"snake_case":false,"camel_case":2}',
)
expect(asFragment()).toMatchInlineSnapshot(`
@@ -280,7 +280,7 @@ describe('classWithCamelCaseProps', () => {
const Component = classWithCamelCaseProps(CopyOfOriginal)
const { rerender } = render(
-
+ ,
)
rerender( )
@@ -294,11 +294,11 @@ describe('classWithCamelCaseProps', () => {
const { asFragment } = render(
-
+ ,
)
expect(screen.queryByTestId('context').textContent).toMatch(
- '{"contextProp":"context value"}'
+ '{"contextProp":"context value"}',
)
expect(asFragment()).toMatchInlineSnapshot(`
@@ -335,7 +335,7 @@ describe('classWithCamelCaseProps', () => {
rerender( )
expect(
- document.querySelector('[data-testid="props"]').textContent
+ document.querySelector('[data-testid="props"]').textContent,
).toBe('{"new_prop":"hello"}')
})
@@ -349,7 +349,7 @@ describe('classWithCamelCaseProps', () => {
snake_case={false}
camelCase={1}
update_comp={on_update}
- />
+ />,
)
rerender(
@@ -357,12 +357,16 @@ describe('classWithCamelCaseProps', () => {
snake_case={false}
camelCase={1}
update_comp={on_update}
- />
+ />,
)
expect(on_update).toHaveBeenCalledTimes(0)
rerender(
-
+ ,
)
expect(on_update).toHaveBeenCalledTimes(2)
})
diff --git a/packages/dnb-eufemia/src/shared/helpers/__tests__/withSnakeCaseProps.test.tsx b/packages/dnb-eufemia/src/shared/helpers/__tests__/withSnakeCaseProps.test.tsx
index 51766f54ca2..c318c398ffc 100644
--- a/packages/dnb-eufemia/src/shared/helpers/__tests__/withSnakeCaseProps.test.tsx
+++ b/packages/dnb-eufemia/src/shared/helpers/__tests__/withSnakeCaseProps.test.tsx
@@ -57,7 +57,7 @@ describe('withSnakeCaseProps', () => {
it('will render', () => {
const { rerender, asFragment } = render(
-
+ ,
)
rerender(
@@ -66,11 +66,11 @@ describe('withSnakeCaseProps', () => {
snake_case={2}
customType={{ fooBar: 1 }}
custom_type={{ foo_bar: 1 }}
- />
+ />,
)
expect(screen.queryByTestId('props').textContent).toMatch(
- '{"camelCase":false,"customType":{"foo_bar":1},"snakeCase":2}'
+ '{"camelCase":false,"customType":{"foo_bar":1},"snakeCase":2}',
)
expect(asFragment()).toMatchInlineSnapshot(`
@@ -96,11 +96,11 @@ describe('withSnakeCaseProps', () => {
const { asFragment } = render(
-
+ ,
)
expect(screen.queryByTestId('context').textContent).toMatch(
- '{"contextProp":"context value"}'
+ '{"contextProp":"context value"}',
)
expect(asFragment()).toMatchInlineSnapshot(`
@@ -201,13 +201,13 @@ describe('classWithSnakeCaseProps', () => {
const Component = classWithSnakeCaseProps(Original)
const { rerender, asFragment } = render(
-
+ ,
)
rerender( )
expect(screen.queryByTestId('props').textContent).toMatch(
- '{"camelCase":false,"snakeCase":2}'
+ '{"camelCase":false,"snakeCase":2}',
)
expect(asFragment()).toMatchInlineSnapshot(`
@@ -246,7 +246,7 @@ describe('classWithSnakeCaseProps', () => {
const Component = classWithSnakeCaseProps(CopyOfOriginal)
const { rerender } = render(
-
+ ,
)
rerender( )
@@ -260,11 +260,11 @@ describe('classWithSnakeCaseProps', () => {
const { asFragment } = render(
-
+ ,
)
expect(screen.queryByTestId('context').textContent).toMatch(
- '{"contextProp":"context value"}'
+ '{"contextProp":"context value"}',
)
expect(asFragment()).toMatchInlineSnapshot(`
@@ -300,7 +300,7 @@ describe('classWithSnakeCaseProps', () => {
rerender( )
expect(
- document.querySelector('[data-testid="props"]').textContent
+ document.querySelector('[data-testid="props"]').textContent,
).toBe('{"newProp":"hello"}')
})
@@ -310,16 +310,16 @@ describe('classWithSnakeCaseProps', () => {
const onUpdate = jest.fn()
const { rerender } = render(
-
+ ,
)
rerender(
-
+ ,
)
expect(onUpdate).toHaveBeenCalledTimes(0)
rerender(
-
+ ,
)
expect(onUpdate).toHaveBeenCalledTimes(2)
})
diff --git a/packages/dnb-eufemia/src/shared/helpers/extendPropsWithContext.ts b/packages/dnb-eufemia/src/shared/helpers/extendPropsWithContext.ts
index e5ae5fdef54..60971f11f9d 100644
--- a/packages/dnb-eufemia/src/shared/helpers/extendPropsWithContext.ts
+++ b/packages/dnb-eufemia/src/shared/helpers/extendPropsWithContext.ts
@@ -48,7 +48,7 @@ function reduceContextWithValue(
props: Props,
defaults: DefaultsProps,
contexts: Contexts,
- { checkPropKey = false } = {}
+ { checkPropKey = false } = {},
) {
const context = reduceContext(contexts)
return Object.entries(context).reduce((acc, [key, value]) => {
diff --git a/packages/dnb-eufemia/src/shared/helpers/filterValidProps.tsx b/packages/dnb-eufemia/src/shared/helpers/filterValidProps.tsx
index 7ef831a67d5..4c4dafc0218 100644
--- a/packages/dnb-eufemia/src/shared/helpers/filterValidProps.tsx
+++ b/packages/dnb-eufemia/src/shared/helpers/filterValidProps.tsx
@@ -10,7 +10,7 @@
function filterValidProps(
props: Props,
validKeys?: Record,
- excludeKeys?: Record
+ excludeKeys?: Record,
) {
const res = {} as Props,
o = Object.prototype.hasOwnProperty
diff --git a/packages/dnb-eufemia/src/shared/helpers/getPreviousSibling.ts b/packages/dnb-eufemia/src/shared/helpers/getPreviousSibling.ts
index 8322e6dcddb..754c13792a5 100644
--- a/packages/dnb-eufemia/src/shared/helpers/getPreviousSibling.ts
+++ b/packages/dnb-eufemia/src/shared/helpers/getPreviousSibling.ts
@@ -12,7 +12,7 @@ export type RootElement = Element
*/
export const getPreviousSibling = (
selector: TargetSelector,
- element: RootElement
+ element: RootElement,
): Element | null => {
try {
const tagName = /[A-Z]/.test(selector) ? selector : null
diff --git a/packages/dnb-eufemia/src/shared/helpers/withCamelCaseProps.tsx b/packages/dnb-eufemia/src/shared/helpers/withCamelCaseProps.tsx
index 7988a89ec9a..f0a688f73d4 100644
--- a/packages/dnb-eufemia/src/shared/helpers/withCamelCaseProps.tsx
+++ b/packages/dnb-eufemia/src/shared/helpers/withCamelCaseProps.tsx
@@ -12,7 +12,7 @@ import { toSnakeCase } from '../component-helper'
* @returns extended function or class
*/
export function withCamelCaseProps(
- Base: React.FunctionComponent & TBase
+ Base: React.FunctionComponent
& TBase,
): typeof Base {
const Component: React.ComponentType = Base
@@ -44,7 +44,7 @@ export function withCamelCaseProps(
* @returns extended function or class
*/
export function classWithCamelCaseProps<
- TBase extends React.ComponentClass
+ TBase extends React.ComponentClass,
>(Base: TBase): typeof Base {
const Component: React.ComponentClass = Base
diff --git a/packages/dnb-eufemia/src/shared/helpers/withSnakeCaseProps.tsx b/packages/dnb-eufemia/src/shared/helpers/withSnakeCaseProps.tsx
index 45ae47bacfd..d1daed6b789 100644
--- a/packages/dnb-eufemia/src/shared/helpers/withSnakeCaseProps.tsx
+++ b/packages/dnb-eufemia/src/shared/helpers/withSnakeCaseProps.tsx
@@ -12,7 +12,7 @@ import { toCamelCase } from '../component-helper'
* @returns extended function or class
*/
export function withSnakeCaseProps(
- Base: React.FunctionComponent & TBase
+ Base: React.FunctionComponent
& TBase,
): typeof Base {
const Component: React.ComponentType = Base
@@ -44,7 +44,7 @@ export function withSnakeCaseProps(
* @returns extended function or class
*/
export function classWithSnakeCaseProps<
- TBase extends React.ComponentClass
+ TBase extends React.ComponentClass,
>(Base: TBase): typeof Base {
const Component: React.ComponentClass = Base
diff --git a/packages/dnb-eufemia/src/shared/libs/HashSum.js b/packages/dnb-eufemia/src/shared/libs/HashSum.js
index 881ade9e5fe..390166115c9 100644
--- a/packages/dnb-eufemia/src/shared/libs/HashSum.js
+++ b/packages/dnb-eufemia/src/shared/libs/HashSum.js
@@ -60,7 +60,7 @@ function foldValue(input, value, key, seen, deep) {
} catch (err) {
return fold(
objHash,
- '[valueOf exception]' + (err.stack || err.message)
+ '[valueOf exception]' + (err.stack || err.message),
)
}
}
diff --git a/packages/dnb-eufemia/src/shared/libs/Shortcuts.js b/packages/dnb-eufemia/src/shared/libs/Shortcuts.js
index e386d412bc4..c48adb38321 100644
--- a/packages/dnb-eufemia/src/shared/libs/Shortcuts.js
+++ b/packages/dnb-eufemia/src/shared/libs/Shortcuts.js
@@ -115,9 +115,8 @@ export class createShortcut {
shortcut = shortcut.toLowerCase()
if (this.eventTracker[shortcut]) {
- const { timeout, element, keyDown, keyUp } = this.eventTracker[
- shortcut
- ]
+ const { timeout, element, keyDown, keyUp } =
+ this.eventTracker[shortcut]
element.removeEventListener('keydown', keyDown, false)
element.removeEventListener('keyup', keyUp, false)
diff --git a/packages/dnb-eufemia/src/shared/stories/MediaQuery.stories.tsx b/packages/dnb-eufemia/src/shared/stories/MediaQuery.stories.tsx
index 524ef6ea828..7d862a21d16 100644
--- a/packages/dnb-eufemia/src/shared/stories/MediaQuery.stories.tsx
+++ b/packages/dnb-eufemia/src/shared/stories/MediaQuery.stories.tsx
@@ -15,7 +15,7 @@ export default {
const useWindowWidth = () => {
const [innerWidth, setWidth] = React.useState(
- typeof window !== 'undefined' ? window.innerWidth : 0
+ typeof window !== 'undefined' ? window.innerWidth : 0,
)
React.useEffect(() => {
@@ -40,7 +40,7 @@ export const UseMediaHook = () => {
{JSON.stringify(
{ isSmall, isMedium, isLarge, isSSR, innerWidth },
null,
- 2
+ 2,
)}
)
diff --git a/packages/dnb-eufemia/src/shared/useMedia.tsx b/packages/dnb-eufemia/src/shared/useMedia.tsx
index 546e27bde8b..1f7ec821388 100644
--- a/packages/dnb-eufemia/src/shared/useMedia.tsx
+++ b/packages/dnb-eufemia/src/shared/useMedia.tsx
@@ -56,7 +56,7 @@ type UseMediaQueryProps = {
}
export default function useMedia(
- props: UseMediaProps = {}
+ props: UseMediaProps = {},
): UseMediaResult {
const { disabled, log } = props
@@ -83,7 +83,7 @@ export default function useMedia(
return acc
},
- { isSSR: !isMatchMediaSupported() }
+ { isSSR: !isMatchMediaSupported() },
) as UseMediaResult
}
@@ -99,7 +99,7 @@ export default function useMedia(
log,
},
- context.breakpoints
+ context.breakpoints,
)
const event = createMediaQueryListener(mediaQueryList, (match) => {
@@ -135,7 +135,7 @@ export default function useMedia(
React.useState(makeResult)
const removeListeners = () => {
Object.values(refs.current).forEach(
- (item: UseMediaItem) => item?.event && item.event()
+ (item: UseMediaItem) => item?.event && item.event(),
)
}
diff --git a/packages/dnb-eufemia/src/shared/useMediaQuery.tsx b/packages/dnb-eufemia/src/shared/useMediaQuery.tsx
index efc9b783a87..00875c7e5c9 100644
--- a/packages/dnb-eufemia/src/shared/useMediaQuery.tsx
+++ b/packages/dnb-eufemia/src/shared/useMediaQuery.tsx
@@ -26,7 +26,7 @@ export default function useMediaQuery(props: MediaQueryProps) {
}, [disabled, matchOnSSR])
const mediaQueryList = React.useRef(
- makeMediaQueryList(props, context.breakpoints)
+ makeMediaQueryList(props, context.breakpoints),
)
if (mediaQueryList.current?.matches) {
matches = true
@@ -45,14 +45,14 @@ export default function useMediaQuery(props: MediaQueryProps) {
mediaQueryList.current = makeMediaQueryList(
props,
- context.breakpoints
+ context.breakpoints,
)
matchUpdate(mediaQueryList.current?.matches)
}
listenerRef.current = createMediaQueryListener(
mediaQueryList.current,
- (match) => matchUpdate(match)
+ (match) => matchUpdate(match),
)
return listenerRef.current
diff --git a/packages/dnb-eufemia/src/style/core/reset.scss b/packages/dnb-eufemia/src/style/core/reset.scss
index 31f359bc956..7fdbd675fdb 100644
--- a/packages/dnb-eufemia/src/style/core/reset.scss
+++ b/packages/dnb-eufemia/src/style/core/reset.scss
@@ -16,9 +16,19 @@
html {
cursor: default; /* 1 */
- font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu,
- Cantarell, 'Noto Sans', sans-serif, 'Apple Color Emoji',
- 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; /* 2 */
+ font-family:
+ system-ui,
+ -apple-system,
+ 'Segoe UI',
+ Roboto,
+ Ubuntu,
+ Cantarell,
+ 'Noto Sans',
+ sans-serif,
+ 'Apple Color Emoji',
+ 'Segoe UI Emoji',
+ 'Segoe UI Symbol',
+ 'Noto Color Emoji'; /* 2 */
line-height: var(--line-height-basis); /* 3 */ /* 4 */
tab-size: 4; /* 4 */ /* 5 */
diff --git a/packages/dnb-eufemia/src/style/core/utilities.scss b/packages/dnb-eufemia/src/style/core/utilities.scss
index a8632fb6736..6d749d0cef2 100644
--- a/packages/dnb-eufemia/src/style/core/utilities.scss
+++ b/packages/dnb-eufemia/src/style/core/utilities.scss
@@ -148,7 +148,9 @@
$width: 0.0625rem /*1px*/
) {
$second: 0 0 0 calc(var(--focus-ring-width) + #{$width}) $second-color;
- box-shadow: 0 0 0 $width $first-color, $second;
+ box-shadow:
+ 0 0 0 $width $first-color,
+ $second;
}
@mixin dummySpacing() {
diff --git a/packages/dnb-eufemia/src/style/themes/theme-sbanken/sbanken-theme-components.scss b/packages/dnb-eufemia/src/style/themes/theme-sbanken/sbanken-theme-components.scss
index 791e49abcac..831711d07df 100644
--- a/packages/dnb-eufemia/src/style/themes/theme-sbanken/sbanken-theme-components.scss
+++ b/packages/dnb-eufemia/src/style/themes/theme-sbanken/sbanken-theme-components.scss
@@ -22,8 +22,8 @@ $fonts-path: '../../../../assets/fonts/dnb' !default;
@import '../../../components/button/style/themes/dnb-button-theme-sbanken.scss';
@import '../../../components/form-label/style/themes/dnb-form-label-theme-sbanken.scss';
@import '../../../components/form-row/style/themes/dnb-form-row-theme-sbanken.scss';
-@import '../../../components/input/style/themes/dnb-input-theme-sbanken.scss';
@import '../../../components/global-status/style/themes/dnb-global-status-theme-sbanken.scss';
+@import '../../../components/input/style/themes/dnb-input-theme-sbanken.scss';
@import '../../../components/logo/style/themes/dnb-logo-theme-sbanken.scss';
@import '../../../components/pagination/style/themes/dnb-pagination-theme-sbanken.scss';
@import '../../../components/section/style/themes/dnb-section-theme-sbanken.scss';
diff --git a/packages/dnb-eufemia/src/style/themes/theme-ui/fonts.scss b/packages/dnb-eufemia/src/style/themes/theme-ui/fonts.scss
index d30e7ffd45e..4ddcfc6e2cc 100644
--- a/packages/dnb-eufemia/src/style/themes/theme-ui/fonts.scss
+++ b/packages/dnb-eufemia/src/style/themes/theme-ui/fonts.scss
@@ -36,7 +36,8 @@ $fonts-path: '../../../../assets/fonts/dnb' !default;
// Std and Regular
@font-face {
font-family: DNB;
- src: url('#{$fonts-path}/DNB-Regular.woff2') format('woff2'),
+ src:
+ url('#{$fonts-path}/DNB-Regular.woff2') format('woff2'),
url('#{$fonts-path}/DNB-Regular.woff') format('woff'),
url('#{$fonts-path}/DNB-Regular.ttf') format('truetype');
font-weight: normal; // have to be the same as: --font-weight-regular
@@ -47,7 +48,8 @@ $fonts-path: '../../../../assets/fonts/dnb' !default;
// Medium
@font-face {
font-family: DNB;
- src: url('#{$fonts-path}/DNB-Medium.woff2') format('woff2'),
+ src:
+ url('#{$fonts-path}/DNB-Medium.woff2') format('woff2'),
url('#{$fonts-path}/DNB-Medium.woff') format('woff'),
url('#{$fonts-path}/DNB-Medium.ttf') format('truetype');
font-weight: 500; // have to be the same as: --font-weight-medium
@@ -58,7 +60,8 @@ $fonts-path: '../../../../assets/fonts/dnb' !default;
// Bold
@font-face {
font-family: DNB;
- src: url('#{$fonts-path}/DNB-Bold.woff2') format('woff2'),
+ src:
+ url('#{$fonts-path}/DNB-Bold.woff2') format('woff2'),
url('#{$fonts-path}/DNB-Bold.woff') format('woff'),
url('#{$fonts-path}/DNB-Bold.ttf') format('truetype');
font-weight: 600; // have to be the same as: --font-weight-bold
@@ -69,7 +72,8 @@ $fonts-path: '../../../../assets/fonts/dnb' !default;
// Mono-Regular
@font-face {
font-family: DNBMono;
- src: url('#{$fonts-path}/DNBMono-Regular.woff2') format('woff2'),
+ src:
+ url('#{$fonts-path}/DNBMono-Regular.woff2') format('woff2'),
url('#{$fonts-path}/DNBMono-Regular.woff') format('woff'),
url('#{$fonts-path}/DNBMono-Regular.ttf') format('truetype');
font-weight: normal; // have to be the same as: --font-weight-regular
diff --git a/packages/dnb-eufemia/src/style/themes/theme-ui/ui-theme-tags.scss b/packages/dnb-eufemia/src/style/themes/theme-ui/ui-theme-tags.scss
index e78b439bfe3..66b41135904 100644
--- a/packages/dnb-eufemia/src/style/themes/theme-ui/ui-theme-tags.scss
+++ b/packages/dnb-eufemia/src/style/themes/theme-ui/ui-theme-tags.scss
@@ -15,11 +15,16 @@
// Import themes
@use '../../../components/anchor/style/themes/dnb-anchor-theme-ui.scss'
- with ($useClasses: false);
+ with (
+ $useClasses: false
+);
@use '../../../elements/typography/style/themes/dnb-typography-theme-ui.scss'
- with ($useClasses: false);
-@use '../../../elements/img/style/themes/dnb-img-theme-ui.scss' with
- ($useClasses: false);
+ with (
+ $useClasses: false
+);
+@use '../../../elements/img/style/themes/dnb-img-theme-ui.scss' with (
+ $useClasses: false
+);
.dnb-core-style {
// div
diff --git a/yarn.lock b/yarn.lock
index 269a6ec78d7..f279bc7df89 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2629,7 +2629,7 @@ __metadata:
eslint: 8.17.0
eslint-plugin-import: 2.26.0
eslint-plugin-jsx-a11y: 6.5.1
- eslint-plugin-prettier: 4.0.0
+ eslint-plugin-prettier: 5.0.0
eslint-plugin-react: 7.30.0
eslint-plugin-react-hooks: 4.5.0
eslint-plugin-security: 1.5.0
@@ -2668,8 +2668,8 @@ __metadata:
postcss: 8.3.11
postcss-calc: 8.0.0
postcss-preset-env: 6.7.0
- prettier: 2.4.1
- prettier-package-json: 2.6.0
+ prettier: 3.0.3
+ prettier-package-json: 2.8.0
process: 0.11.10
prop-types: 15.7.2
react: 18.2.0
@@ -5034,6 +5034,20 @@ __metadata:
languageName: node
linkType: hard
+"@pkgr/utils@npm:^2.3.1":
+ version: 2.4.2
+ resolution: "@pkgr/utils@npm:2.4.2"
+ dependencies:
+ cross-spawn: ^7.0.3
+ fast-glob: ^3.3.0
+ is-glob: ^4.0.3
+ open: ^9.1.0
+ picocolors: ^1.0.0
+ tslib: ^2.6.0
+ checksum: 24e04c121269317d259614cd32beea3af38277151c4002df5883c4be920b8e3490bb897748e844f9d46bf68230f86dabd4e8f093773130e7e60529a769a132fc
+ languageName: node
+ linkType: hard
+
"@playwright/test@npm:1.35.1":
version: 1.35.1
resolution: "@playwright/test@npm:1.35.1"
@@ -7036,6 +7050,13 @@ __metadata:
languageName: node
linkType: hard
+"@types/parse-author@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "@types/parse-author@npm:2.0.1"
+ checksum: a1329d0a9c87317c1ba526943ea94aff009760f0b517cabb55a07818ef9df2983b411ba2f25124c3aadb20738e30a38a95c99fea2ad6002def1a1c7e8a9ef43e
+ languageName: node
+ linkType: hard
+
"@types/parse-json@npm:^4.0.0":
version: 4.0.0
resolution: "@types/parse-json@npm:4.0.0"
@@ -9891,6 +9912,15 @@ __metadata:
languageName: node
linkType: hard
+"bundle-name@npm:^3.0.0":
+ version: 3.0.0
+ resolution: "bundle-name@npm:3.0.0"
+ dependencies:
+ run-applescript: ^5.0.0
+ checksum: edf2b1fbe6096ed32e7566947ace2ea937ee427391744d7510a2880c4b9a5b3543d3f6c551236a29e5c87d3195f8e2912516290e638c15bcbede7b37cc375615
+ languageName: node
+ linkType: hard
+
"busboy@npm:^1.0.0":
version: 1.6.0
resolution: "busboy@npm:1.6.0"
@@ -12138,7 +12168,7 @@ __metadata:
languageName: node
linkType: hard
-"default-browser-id@npm:3.0.0":
+"default-browser-id@npm:3.0.0, default-browser-id@npm:^3.0.0":
version: 3.0.0
resolution: "default-browser-id@npm:3.0.0"
dependencies:
@@ -12148,6 +12178,18 @@ __metadata:
languageName: node
linkType: hard
+"default-browser@npm:^4.0.0":
+ version: 4.0.0
+ resolution: "default-browser@npm:4.0.0"
+ dependencies:
+ bundle-name: ^3.0.0
+ default-browser-id: ^3.0.0
+ execa: ^7.1.1
+ titleize: ^3.0.0
+ checksum: 40c5af984799042b140300be5639c9742599bda76dc9eba5ac9ad5943c83dd36cebc4471eafcfddf8e0ec817166d5ba89d56f08e66a126c7c7908a179cead1a7
+ languageName: node
+ linkType: hard
+
"default-compare@npm:^1.0.0":
version: 1.0.0
resolution: "default-compare@npm:1.0.0"
@@ -12203,6 +12245,13 @@ __metadata:
languageName: node
linkType: hard
+"define-lazy-prop@npm:^3.0.0":
+ version: 3.0.0
+ resolution: "define-lazy-prop@npm:3.0.0"
+ checksum: 54884f94caac0791bf6395a3ec530ce901cf71c47b0196b8754f3fd17edb6c0e80149c1214429d851873bb0d689dbe08dcedbb2306dc45c8534a5934723851b6
+ languageName: node
+ linkType: hard
+
"define-properties@npm:^1.1.3, define-properties@npm:^1.1.4, define-properties@npm:^1.2.0":
version: 1.2.0
resolution: "define-properties@npm:1.2.0"
@@ -12564,6 +12613,8 @@ __metadata:
ora: 5.4.1
postcss: 8.3.11
postcss-preset-env: 6.7.0
+ prettier: 3.0.3
+ prettier-package-json: 2.8.0
prism-react-renderer: 1.3.3
process: 0.11.10
prop-types: 15.7.2
@@ -13602,18 +13653,22 @@ __metadata:
languageName: node
linkType: hard
-"eslint-plugin-prettier@npm:4.0.0":
- version: 4.0.0
- resolution: "eslint-plugin-prettier@npm:4.0.0"
+"eslint-plugin-prettier@npm:5.0.0":
+ version: 5.0.0
+ resolution: "eslint-plugin-prettier@npm:5.0.0"
dependencies:
prettier-linter-helpers: ^1.0.0
+ synckit: ^0.8.5
peerDependencies:
- eslint: ">=7.28.0"
- prettier: ">=2.0.0"
+ "@types/eslint": ">=8.0.0"
+ eslint: ">=8.0.0"
+ prettier: ">=3.0.0"
peerDependenciesMeta:
+ "@types/eslint":
+ optional: true
eslint-config-prettier:
optional: true
- checksum: 03d69177a3c21fa2229c7e427ce604429f0b20ab7f411e2e824912f572a207c7f5a41fd1f0a95b9b8afe121e291c1b1f1dc1d44c7aad4b0837487f9c19f5210d
+ checksum: 84e88744b9050f2d5ef31b94e85294dda16f3a53c2449f9d33eac8ae6264889b459bf35a68e438fb6b329c2a1d6491aac4bfa00d86317e7009de3dad0311bec6
languageName: node
linkType: hard
@@ -14251,6 +14306,23 @@ __metadata:
languageName: node
linkType: hard
+"execa@npm:^7.1.1":
+ version: 7.2.0
+ resolution: "execa@npm:7.2.0"
+ dependencies:
+ cross-spawn: ^7.0.3
+ get-stream: ^6.0.1
+ human-signals: ^4.3.0
+ is-stream: ^3.0.0
+ merge-stream: ^2.0.0
+ npm-run-path: ^5.1.0
+ onetime: ^6.0.0
+ signal-exit: ^3.0.7
+ strip-final-newline: ^3.0.0
+ checksum: 14fd17ba0ca8c87b277584d93b1d9fc24f2a65e5152b31d5eb159a3b814854283eaae5f51efa9525e304447e2f757c691877f7adff8fde5746aae67eb1edd1cc
+ languageName: node
+ linkType: hard
+
"exit@npm:^0.1.2":
version: 0.1.2
resolution: "exit@npm:0.1.2"
@@ -14499,6 +14571,19 @@ __metadata:
languageName: node
linkType: hard
+"fast-glob@npm:^3.3.0":
+ version: 3.3.1
+ resolution: "fast-glob@npm:3.3.1"
+ dependencies:
+ "@nodelib/fs.stat": ^2.0.2
+ "@nodelib/fs.walk": ^1.2.3
+ glob-parent: ^5.1.2
+ merge2: ^1.3.0
+ micromatch: ^4.0.4
+ checksum: b6f3add6403e02cf3a798bfbb1183d0f6da2afd368f27456010c0bc1f9640aea308243d4cb2c0ab142f618276e65ecb8be1661d7c62a7b4e5ba774b9ce5432e5
+ languageName: node
+ linkType: hard
+
"fast-json-parse@npm:^1.0.3":
version: 1.0.3
resolution: "fast-json-parse@npm:1.0.3"
@@ -17600,6 +17685,13 @@ __metadata:
languageName: node
linkType: hard
+"human-signals@npm:^4.3.0":
+ version: 4.3.1
+ resolution: "human-signals@npm:4.3.1"
+ checksum: 6f12958df3f21b6fdaf02d90896c271df00636a31e2bbea05bddf817a35c66b38a6fdac5863e2df85bd52f34958997f1f50350ff97249e1dff8452865d5235d1
+ languageName: node
+ linkType: hard
+
"humanize-ms@npm:^1.2.1":
version: 1.2.1
resolution: "humanize-ms@npm:1.2.1"
@@ -18220,6 +18312,15 @@ __metadata:
languageName: node
linkType: hard
+"is-docker@npm:^3.0.0":
+ version: 3.0.0
+ resolution: "is-docker@npm:3.0.0"
+ bin:
+ is-docker: cli.js
+ checksum: b698118f04feb7eaf3338922bd79cba064ea54a1c3db6ec8c0c8d8ee7613e7e5854d802d3ef646812a8a3ace81182a085dfa0a71cc68b06f3fa794b9783b3c90
+ languageName: node
+ linkType: hard
+
"is-extendable@npm:^0.1.0, is-extendable@npm:^0.1.1":
version: 0.1.1
resolution: "is-extendable@npm:0.1.1"
@@ -18347,6 +18448,17 @@ __metadata:
languageName: node
linkType: hard
+"is-inside-container@npm:^1.0.0":
+ version: 1.0.0
+ resolution: "is-inside-container@npm:1.0.0"
+ dependencies:
+ is-docker: ^3.0.0
+ bin:
+ is-inside-container: cli.js
+ checksum: c50b75a2ab66ab3e8b92b3bc534e1ea72ca25766832c0623ac22d134116a98bcf012197d1caabe1d1c4bd5f84363d4aa5c36bb4b585fbcaf57be172cd10a1a03
+ languageName: node
+ linkType: hard
+
"is-installed-globally@npm:^0.4.0":
version: 0.4.0
resolution: "is-installed-globally@npm:0.4.0"
@@ -23866,6 +23978,18 @@ __metadata:
languageName: node
linkType: hard
+"open@npm:^9.1.0":
+ version: 9.1.0
+ resolution: "open@npm:9.1.0"
+ dependencies:
+ default-browser: ^4.0.0
+ define-lazy-prop: ^3.0.0
+ is-inside-container: ^1.0.0
+ is-wsl: ^2.2.0
+ checksum: 3993c0f61d51fed8ac290e99c9c3cf45d3b6cfb3e2aa2b74cafd312c3486c22fd81df16ac8f3ab91dd8a4e3e729a16fc2480cfc406c4833416cf908acf1ae7c9
+ languageName: node
+ linkType: hard
+
"opener@npm:^1.5.2":
version: 1.5.2
resolution: "opener@npm:1.5.2"
@@ -25791,10 +25915,11 @@ __metadata:
languageName: node
linkType: hard
-"prettier-package-json@npm:2.6.0":
- version: 2.6.0
- resolution: "prettier-package-json@npm:2.6.0"
+"prettier-package-json@npm:2.8.0":
+ version: 2.8.0
+ resolution: "prettier-package-json@npm:2.8.0"
dependencies:
+ "@types/parse-author": ^2.0.0
commander: ^4.0.1
cosmiconfig: ^7.0.0
fs-extra: ^10.0.0
@@ -25805,16 +25930,7 @@ __metadata:
sort-order: ^1.0.1
bin:
prettier-package-json: bin/prettier-package-json
- checksum: 37e9e343e43943d6bfdd10bcab7daabfa4f4e70cac789991f749d82361581a8c30429f692b5bcaba3b55ceaafc41b1de51a2cdef24ecbc63ba4bac327f23cb0e
- languageName: node
- linkType: hard
-
-"prettier@npm:2.4.1":
- version: 2.4.1
- resolution: "prettier@npm:2.4.1"
- bin:
- prettier: bin-prettier.js
- checksum: cc6830588b401b0d742862fe9c46bc9118204fb307c3abe0e49e95b35ed23629573807ffdf9cdd65289c252a0bb51fc0171437f6626ee36378dea80f0ee80b91
+ checksum: 61fb0b23738d4b4eec4ba85f1d6429e29db4a281a1e5fbc7925c1c7aa51efa703b82e70f865068dbfc74ee46c99f0739eaf11773be5f53e1c92b8b2c130dfea4
languageName: node
linkType: hard
@@ -25827,6 +25943,15 @@ __metadata:
languageName: node
linkType: hard
+"prettier@npm:3.0.3":
+ version: 3.0.3
+ resolution: "prettier@npm:3.0.3"
+ bin:
+ prettier: bin/prettier.cjs
+ checksum: e10b9af02b281f6c617362ebd2571b1d7fc9fb8a3bd17e371754428cda992e5e8d8b7a046e8f7d3e2da1dcd21aa001e2e3c797402ebb6111b5cd19609dd228e0
+ languageName: node
+ linkType: hard
+
"prettier@npm:^2.8.0":
version: 2.8.8
resolution: "prettier@npm:2.8.8"
@@ -27588,6 +27713,15 @@ __metadata:
languageName: node
linkType: hard
+"run-applescript@npm:^5.0.0":
+ version: 5.0.0
+ resolution: "run-applescript@npm:5.0.0"
+ dependencies:
+ execa: ^5.0.0
+ checksum: d00c2dbfa5b2d774de7451194b8b125f40f65fc183de7d9dcae97f57f59433586d3c39b9001e111c38bfa24c3436c99df1bb4066a2a0c90d39a8c4cd6889af77
+ languageName: node
+ linkType: hard
+
"run-async@npm:^2.4.0":
version: 2.4.1
resolution: "run-async@npm:2.4.1"
@@ -29725,6 +29859,16 @@ __metadata:
languageName: node
linkType: hard
+"synckit@npm:^0.8.5":
+ version: 0.8.5
+ resolution: "synckit@npm:0.8.5"
+ dependencies:
+ "@pkgr/utils": ^2.3.1
+ tslib: ^2.5.0
+ checksum: 8a9560e5d8f3d94dc3cf5f7b9c83490ffa30d320093560a37b88f59483040771fd1750e76b9939abfbb1b5a23fd6dfbae77f6b338abffe7cae7329cd9b9bb86b
+ languageName: node
+ linkType: hard
+
"table@npm:^6.0.9, table@npm:^6.8.1":
version: 6.8.1
resolution: "table@npm:6.8.1"
@@ -30011,6 +30155,13 @@ __metadata:
languageName: node
linkType: hard
+"titleize@npm:^3.0.0":
+ version: 3.0.0
+ resolution: "titleize@npm:3.0.0"
+ checksum: 71fbbeabbfb36ccd840559f67f21e356e1d03da2915b32d2ae1a60ddcc13a124be2739f696d2feb884983441d159a18649e8d956648d591bdad35c430a6b6d28
+ languageName: node
+ linkType: hard
+
"tmp@npm:^0.0.33":
version: 0.0.33
resolution: "tmp@npm:0.0.33"
@@ -30293,6 +30444,13 @@ __metadata:
languageName: node
linkType: hard
+"tslib@npm:^2.5.0, tslib@npm:^2.6.0":
+ version: 2.6.2
+ resolution: "tslib@npm:2.6.2"
+ checksum: 329ea56123005922f39642318e3d1f0f8265d1e7fcb92c633e0809521da75eeaca28d2cf96d7248229deb40e5c19adf408259f4b9640afd20d13aecc1430f3ad
+ languageName: node
+ linkType: hard
+
"tslib@npm:~2.4.0":
version: 2.4.1
resolution: "tslib@npm:2.4.1"