diff --git a/packages/dnb-design-system-portal/src/docs/quickguide-designer/logos.md b/packages/dnb-design-system-portal/src/docs/quickguide-designer/logos.md
index 405c695edfd..ba1af8fb8fc 100644
--- a/packages/dnb-design-system-portal/src/docs/quickguide-designer/logos.md
+++ b/packages/dnb-design-system-portal/src/docs/quickguide-designer/logos.md
@@ -8,13 +8,17 @@ import { Logo } from 'dnb-ui-lib/src'
# Logos
-NB! Brand guidelines for logos can be found **here**.
-From the Brandbook, digital media should use the 3rd level logos (page 9).
+## Brand Center
-| Description | Format | Location | Owner/Contact |
-| ---------------- | ------------ | -------- | ----------------- |
-| DNB logo - green | Vector - eps | Location | Anotherguy Inoslo |
-| DNB logo - white | Vector - eps | Location | Anotherguy Inoslo |
+**NB!** If you have access to the DNB's Brand Center, [you find the logos under "Visuell identitet"](https://bc.dnb.no/brandcenter/no/dnbvisualguidelines/component/default/761).
+
+## Brandbook
+
+From the Brandbook PDF file, digital media should use the 3rd level logos (page 9).
+
+## Developers
+
+The DNB Logo can easily be used and [integrated in digital web products as a component](/uilib/components/logo).
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/about-the-lib/releases.md b/packages/dnb-design-system-portal/src/docs/uilib/about-the-lib/releases.md
index c4827c6bae9..e098dbd8000 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/about-the-lib/releases.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/about-the-lib/releases.md
@@ -1,14 +1,21 @@
---
title: 'Releases'
+developers: 'Articles giving a periodically overview of the changes lately released.'
draft: false
---
+import WelcomeAdvice from 'Pages/welcome-advice.md'
import GithubLogo from 'Pages/uilib/development/assets/github-logo.js'
import { Icon } from 'dnb-ui-lib/src'
# Releases
+Here you find small articles and notes giving you a periodically overview of the changes lately released.
+
You may also have a look at the [ **GitHub Releases**](https://github.com/dnbexperience/eufemia/releases) for versioning of the [dnb-ui-lib](/uilib/).
+- [**v4.18**](/uilib/about-the-lib/releases/v4.18-info) _September, 28. 2019_
- [**v4.10**](/uilib/about-the-lib/releases/v4.10-info) _August, 24. 2019_
- [**v4.0**](/uilib/about-the-lib/releases/v4-info) _July, 21. 2019_
+
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/about-the-lib/releases/v4.10-info.md b/packages/dnb-design-system-portal/src/docs/uilib/about-the-lib/releases/v4.10-info.md
index 7a7f6618f9f..77881383f3f 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/about-the-lib/releases/v4.10-info.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/about-the-lib/releases/v4.10-info.md
@@ -18,7 +18,7 @@ redirect_from:
## GlobalStatus
-This component is made to be used for mainly three UI cases:
+This component is made to be used for mainly three UX situations:
- Global application error messages
- User generated error messages
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/about-the-lib/releases/v4.18-info.md b/packages/dnb-design-system-portal/src/docs/uilib/about-the-lib/releases/v4.18-info.md
new file mode 100644
index 00000000000..f5e6b5c2539
--- /dev/null
+++ b/packages/dnb-design-system-portal/src/docs/uilib/about-the-lib/releases/v4.18-info.md
@@ -0,0 +1,44 @@
+# v4.18
+
+## Since last release info
+
+- In the Customization section you find now ready to use and optimized [favicons](/uilib/usage/customisation#favicon-and-manifest).
+- New icons: `upload`
+- Added layout [CSS properties](https://eufemia.dnb.no/uilib/usage/layout#sizing) (`--layout-*`), like: `--layout-large: 60em;`
+
+### [Modal](/uilib/components/modal)
+
+- `fullscreen` and `max_width` and a default max width of `60rem`
+
+### [Dropdown](/uilib/components/dropdown)
+
+- `data` can now be given by a function
+- Now you can use `value` and `default_value` instead of `selected_item`
+- A custom `width` is now easier to customize
+
+## New: [GlobalError](/uilib/components/global-error)
+
+The GlobalError is a simple component to integrate where a `404` or `500` has to be shown
+
+You have a couple of options / properties to change the texts if needed.
+
+```jsx
+import { GlobalError } from 'dnb-ui-lib/components'
+
+render()
+```
+
+## Install
+
+To upgrade to v4.18 with NPM, use:
+
+```bash
+$ npm i dnb-ui-lib@4.18
+
+# In case the NPM mirroring is not up to date
+$ npm i https://github.com/dnbexperience/eufemia/releases/download/v4.18.0/dnb-ui-lib-4.18.0.tgz
+```
+
+More details you find in the [Releases section on GitHub](https://github.com/dnbexperience/eufemia/releases)
+
+_September, 28. 2019_
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/button/button-info.md b/packages/dnb-design-system-portal/src/docs/uilib/components/button/button-info.md
index 0b18e71099b..fb4bada37fb 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/button/button-info.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/button/button-info.md
@@ -6,7 +6,7 @@ import Examples from 'Pages/uilib/components/button/Examples'
## Description
-The Button component should be used as the primary call-to-action in a form, or as a user interaction mechanism. Generally speaking, a button should not be used when a link would suffice. Exceptions are made at times when it is used as a navigation element in the `action-nav` element.
+The Button component should be used as the **primary call-to-action** in a form, or as a user interaction mechanism. There should never be more than one primary button in a given context (e.g. a [action-nav](/uilib/patterns/action-nav)); `secondary` and `tertiary` button variants does not have this constraint. Generally speaking, a button should not be used when a link would suffice.
## Demos
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/Examples.js b/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/Examples.js
index 36d7572cfbe..d51cf8643ed 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/Examples.js
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/Examples.js
@@ -56,14 +56,14 @@ const scrollableData = [
render(
)
`}
{
console.log('on_change', selectedDataItem)
}}
@@ -159,8 +159,8 @@ render(
align_dropdown="right"
title="Choose an item"
data={['Go this this Link', 'Or press on me', <>Custom component>]}
- on_change={({ selected_item }) => {
- console.log('on_change', selected_item)
+ on_change={({ value }) => {
+ console.log('on_change', value)
}}
on_select={({ active_item }) => {
console.log('on_select', active_item)
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/dropdown-events.md b/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/dropdown-events.md
index bf27c47aac6..c117a6fe1f8 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/dropdown-events.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/dropdown-events.md
@@ -11,10 +11,10 @@ The difference between `on_change` and `on_select` is:
## Dropdown Events
-| Events | Description |
-| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `on_change` | _(optional)_ will be called on state changes made by the user. Returns an object with the new selected `data` item `{ data, event, attributes, selected_item }`. The **selected_item** property is the selected item by number, starting by 0. |
-| `on_select` | _(optional)_ will be called once the users selects an item by a click or keyboard navigation. Returns an object with the new selected `data` item `{ data, event, attributes, selected_item, active_item }`. The **active_item** property is the currently selected one by keyboard navigation, starting by 0. |
-| `on_show` | _(optional)_ will be called once the user presses the dropdown. Returns the data item `{ data, attributes }`. |
-| `on_hide` | _(optional)_ will be called once the user presses the dropdown again, or clicks somewhere else. Returns the data item `{ data, attributes }`. |
-| `on_state_update` | _(optional)_ will be called once the parameter `selected_value` changes its value. |
+| Events | Description |
+| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `on_change` | _(optional)_ will be called on state changes made by the user. Returns an object with the new selected `data` item `{ data, event, attributes, value }`. |
+| `on_select` | _(optional)_ will be called once the users selects an item by a click or keyboard navigation. Returns an object with the new selected `data` item `{ data, event, attributes, value, active_item }`. The **active_item** property is the currently selected item by keyboard navigation |
+| `on_show` | _(optional)_ will be called once the user presses the dropdown. Returns the data item `{ data, attributes }`. |
+| `on_hide` | _(optional)_ will be called once the user presses the dropdown again, or clicks somewhere else. Returns the data item `{ data, attributes }`. |
+| `on_state_update` | _(optional)_ will be called once the parameter `value` changes its state. |
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/dropdown-info.md b/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/dropdown-info.md
index 5a2cce7c997..fcad9457333 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/dropdown-info.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/dropdown-info.md
@@ -26,7 +26,7 @@ _This pattern can be constructed in a number of ways to achieve a similar effect
## Custom size
-Changing the **width** of the Dropdown component by CSS is easiest done by doing:
+Changing the **width** of the Dropdown component by CSS is easy done by doing:
```css
.dnb-dropdown {
@@ -34,14 +34,14 @@ Changing the **width** of the Dropdown component by CSS is easiest done by doing
}
```
-You may else end up having to calculation the correct width to get the arrows aligned:
+You can also set the width directly, but then it has to be defined like so (including `min-width`):
```css
-.dnb-dropdown__list {
- width: 8rem;
+.dnb-dropdown__shell {
+ width: 20rem; /* custom width */
}
-.dnb-dropdown__text__inner {
- width: 4.5rem; /* has to be calculated */
+.dnb-dropdown__list {
+ min-width: 20rem; /* custom width */
}
```
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/dropdown-properties.md b/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/dropdown-properties.md
index 2dfe72e8e6e..f96f96bc095 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/dropdown-properties.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/dropdown-properties.md
@@ -7,7 +7,8 @@ import { Data } from 'Pages/uilib/components/dropdown/Examples'
| Properties | Description |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data` | _(mandatory)_ the data we want to fill the list with. Provide the data as a `JSON string` or data `array` structure. If You don't have to define a `selected_item`, You can also send in a `function` witch will be called once the user opens the Dropdown. |
-| `selected_item` | _(optional)_ a number as a string or integer, defines the active item in the data array. Defaults to `null` and the `title` is shown. |
+| `value, selected_item` | _(optional)_ a number as a string or integer, defines the selected item. Defaults to `null` and the `title` will be shown. **NB:** In case the Dropdown will be re-rendered, this value will be used again. Use `default_value` instead. |
+| `default_value` | _(optional)_ if you want to define only a startup value (integer) or have to handle a re-render without handling the state during the re-render by yourself, then using `default_value` is a good choice . Defaults to `null`. |
| `title` | _(optional)_ give a title to let the user know what they has to do. Defaults to `Option Menu` . |
| `icon` | _(optional)_ name of icon to be included in the dropdown. |
| `icon_position` | _(optional)_ position of icon inside the dropdown. Set to `left` or `right`. Defaults to `right` if not set. |
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/development/changes.md b/packages/dnb-design-system-portal/src/docs/uilib/development/changes.md
index 71ca962a944..ab0430b725b 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/development/changes.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/development/changes.md
@@ -26,15 +26,24 @@ $ git checkout -b ftr/my-feature
$ git checkout -b wip/working-on-it
```
-### What happens on calling `yarn build`?
+### Create a local build
-There are a lot of different things going on, like:
+In case You have to create a local build of the package (for various reasons) you can do so:
+
+```bash
+# In the `dnb-ui-lib` directory, run:
+$ yarn build
+```
+
+#### What happens then
+
+During the package build are a lot of different things going on, like:
- Assets are getting generated
-- All the lib code gets compiled down to ECMAScript 5.1
+- All the lib code gets compiled (ECMAScript 6 and ECMAScript 5.1)
- UMD bundle gets created
-- All SASS styles are validated and compiled
-- Code gets minified
+- All SASS styles are validated and compiled (to support IE)
+- All bundles gets minified
- Icons are getting converted
-A couple of folders and files are generated in the `dnb-ui-lib` root. They are ignored in the .gitignore file, so they not get a part of the git repo.
+A couple of folders and files will be generated in the `dnb-ui-lib` directory. They are ignored in the `.gitignore` file, so they not get a part of the git repo.
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/development/naming.md b/packages/dnb-design-system-portal/src/docs/uilib/development/naming.md
index 520543466f4..65ef5111aab 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/development/naming.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/development/naming.md
@@ -38,7 +38,7 @@ The DNB Design System Eufemia uses the following naming conventions.
- `Classes` use **pascal case**.
- Other Javascript files use **lisp case**.
-## Events
+## Events and Properties
- Event names use **snake case**.
- They have to describe what they are aiming to do. Like: `on_click`
@@ -55,4 +55,16 @@ The DNB Design System Eufemia uses the following naming conventions.
---
-More info about the cases can be found at [Wikipedia Special case styles](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles)
+## Why `snake_case`
+
+The decision to use `snake_case` was made to not just adopt React terms (`PascalCase`), because we wanted to be open for future changes in the front end world.
+
+But also the technical limitation that **Web Components** do not support `PascalCase` made us more confident to use another case style.
+
+HTML attributes uses `lisp-case`, so we needed something between.
+
+The aspect to distinguish between case styles will also make code easier to read and support future code changes and refactoring we assume.
+
+```jsx
+
+```
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/development/portal.md b/packages/dnb-design-system-portal/src/docs/uilib/development/portal.md
index 099208adee3..250eabad06f 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/development/portal.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/development/portal.md
@@ -18,22 +18,22 @@ You can either do changes directly on GitHub with a fork of the Repository, or Y
$ yarn start
```
-This will start the Portal. You can view the website by visiting [localhost:8000](http://localhost:8000/).
+This will start the Portal. You can view the portal website by visiting [localhost:8000](http://localhost:8000/).
Content changes to both Markdown files and styles (SCSS) and code changes will be reflected immediately.
-### Build Pages
+### Local build
-In case You make changes witch effects the content of the [/uilib](/uilib) pages, You have to **regenerate** the Portal pages by running:
+In case You have to create a local static build of the portal website (for various reasons), you can do so by:
```bash
# In the `dnb-design-system-portal` directory, run:
$ yarn build
-
-# You can also start a "watch" mode with:
-$ yarn build:dev
```
-This will update/create all the needed [pages](/uilib).
+The build will be exported to the `/public` directory. You can now also run a local static server to view it at the given port [localhost:8000](http://localhost:8000/):
-Fore sure, this applies to change to Markdown files in the `dnb-ui-lib` - but also changes to the Component Code Examples.
+```bash
+# In the `dnb-design-system-portal` directory, run:
+$ yarn serve
+```
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/getting-started.md b/packages/dnb-design-system-portal/src/docs/uilib/getting-started.md
index 1b3cddf5600..b0d84b093d2 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/getting-started.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/getting-started.md
@@ -1,5 +1,6 @@
---
title: 'Getting Started'
+description: 'The quick intro is meant to give developers a first guide through all the elementary parts of Eufemia.'
icon: 'getting_started'
draft: false
order: 2
@@ -16,13 +17,13 @@ Do you want to...
- simply use the HTML Elements right away?
- customize the core DNB brand style and behavior?
-- create a new global theme?
+- use the basis and create theme on top?
- make changes to the overall `ui-lib`?
-- change texts and content of the Eufemia Design System Portal (website)?
+- change contents of the Eufemia Design System Portal (website)?
## So, how do I get started?
-You can follow a [Quick Intro](/uilib/intro), guiding You through all the elementary elements of Eufemia.
+You can [follow an intro](/uilib/intro), guiding You through all the elementary parts of Eufemia.
And for sure, check out the code in the [**Demo Apps**](/uilib/getting-started/demos)
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/getting-started/demos.md b/packages/dnb-design-system-portal/src/docs/uilib/getting-started/demos.md
index a86a3a9a58f..d25e15cab31 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/getting-started/demos.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/getting-started/demos.md
@@ -2,7 +2,7 @@
title: 'Demos'
description: 'The purpose of having Eufemia Demos is that You as a developer can see the code and understand Eufemia and be inspired and give You a good start.'
draft: false
-order: 2
+order: 3
---
import { Button } from 'dnb-ui-lib/src'
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/getting-started/maintainability.md b/packages/dnb-design-system-portal/src/docs/uilib/getting-started/maintainability.md
new file mode 100644
index 00000000000..a6469a84449
--- /dev/null
+++ b/packages/dnb-design-system-portal/src/docs/uilib/getting-started/maintainability.md
@@ -0,0 +1,13 @@
+---
+title: 'Maintainability'
+description: 'The hard part of a living design system, like Eufemia, is not to create black holes and choosing ways to make maintainability hard and complex.'
+draft: false
+status: 'wip'
+order: 2
+---
+
+# Maintainability
+
+The hard part of a living design system, like Eufemia, is not to create black holes and choosing ways to make maintainability hard and complex.
+
+To make this more understandable, we want to create a detailed explanation about the hard part of DNB UX vision of maintaining future changes to accessibility, includness in design, diversity of thinking, future component updates and fixes, alongside with brand changes.
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/getting-started/requirements.md b/packages/dnb-design-system-portal/src/docs/uilib/getting-started/requirements.md
index 44c580eb782..64a896cf524 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/getting-started/requirements.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/getting-started/requirements.md
@@ -13,13 +13,19 @@ Beside the peer dependencies, there are no specific technical requirements only
Eufemia (`dnb-ui-lib`) can be used with an UMD, ES5, ES6 or TypeScript environment. The purpose is to use it on top (or inside) of modern JavaScript frontend framework and setups. But we strongly recommend to use Eufemia with a **React stack**, as this makes including the Eufemia tools and components most productive. All the components internal states are handled with React to only keep the most necessary in the DOM (HTML elements and event bindings).
+## The hard part of a living design system
+
+The hard part of a living design system, like Eufemia, is not to create black holes and choosing ways to make **maintainability of user experience** hard and complex. To address this challenge and give more insight and thoughts, read the [**article about maintainability**](/uilib/getting-started/maintainability).
+
## React
Why is React a good choice:
- Declarative and functional
- Immutable structure
-- Can be used both with a JAM stack, CSR and SSR (SPA) with same code base (App)
+- Lightweight
+- Centralization of code that should work in context (Concepts like, write code like **reading a book**)
+- Can be used both with a JAM stack, CSR and SSR (SPA) with the same code base (App)
- Flexible frontend stack to create the best user experience, depending on the solution and their needs
- Can be tailored to different conventions and guidelines
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/intro/02-common-patterns.md b/packages/dnb-design-system-portal/src/docs/uilib/intro/02-common-patterns.md
index 792ff3d7154..ea8bcdc09ce 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/intro/02-common-patterns.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/intro/02-common-patterns.md
@@ -22,6 +22,6 @@ Both UX designers and frontend web developers will have a huge benefit of **"tal
---
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/intro/13-accessibility.md b/packages/dnb-design-system-portal/src/docs/uilib/intro/03-accessibility.md
similarity index 93%
rename from packages/dnb-design-system-portal/src/docs/uilib/intro/13-accessibility.md
rename to packages/dnb-design-system-portal/src/docs/uilib/intro/03-accessibility.md
index a9952cd84a1..5fa6ce67d92 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/intro/13-accessibility.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/intro/03-accessibility.md
@@ -56,6 +56,6 @@ Example usage of HTML5 `landmarks`.
---
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/intro/03-ux-handover.md b/packages/dnb-design-system-portal/src/docs/uilib/intro/04-ux-handover.md
similarity index 95%
rename from packages/dnb-design-system-portal/src/docs/uilib/intro/03-ux-handover.md
rename to packages/dnb-design-system-portal/src/docs/uilib/intro/04-ux-handover.md
index a42b8a304b4..aec952f1392 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/intro/03-ux-handover.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/intro/04-ux-handover.md
@@ -42,6 +42,6 @@ Remember, everything should be in the **8px grid** (0.5rem) spacing - even it th
![What color is uses](./assets/ux-handover-color.png)
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/intro/04-eufemia-for-developers.md b/packages/dnb-design-system-portal/src/docs/uilib/intro/05-eufemia-for-developers.md
similarity index 86%
rename from packages/dnb-design-system-portal/src/docs/uilib/intro/04-eufemia-for-developers.md
rename to packages/dnb-design-system-portal/src/docs/uilib/intro/05-eufemia-for-developers.md
index a6ad8c38fbe..35d398d7475 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/intro/04-eufemia-for-developers.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/intro/05-eufemia-for-developers.md
@@ -23,6 +23,6 @@ What Eufemia offers for Developers? NPM Package including:
---
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/intro/05-css-packages.md b/packages/dnb-design-system-portal/src/docs/uilib/intro/06-css-packages.md
similarity index 93%
rename from packages/dnb-design-system-portal/src/docs/uilib/intro/05-css-packages.md
rename to packages/dnb-design-system-portal/src/docs/uilib/intro/06-css-packages.md
index 2380663f8d4..c9444a7db11 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/intro/05-css-packages.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/intro/06-css-packages.md
@@ -29,6 +29,6 @@ On [legacy code projects](!/uilib/usage/customisation/styling#how-to-deal-with-e
---
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/intro/06-typography.md b/packages/dnb-design-system-portal/src/docs/uilib/intro/07-typography.md
similarity index 93%
rename from packages/dnb-design-system-portal/src/docs/uilib/intro/06-typography.md
rename to packages/dnb-design-system-portal/src/docs/uilib/intro/07-typography.md
index dbe67c65649..47916cc1719 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/intro/06-typography.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/intro/07-typography.md
@@ -28,6 +28,6 @@ Read [more about Typography](!/uilib/typography)
---
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/intro/07-color-usage.md b/packages/dnb-design-system-portal/src/docs/uilib/intro/08-color-usage.md
similarity index 91%
rename from packages/dnb-design-system-portal/src/docs/uilib/intro/07-color-usage.md
rename to packages/dnb-design-system-portal/src/docs/uilib/intro/08-color-usage.md
index 25647c76654..093e4174a5a 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/intro/07-color-usage.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/intro/08-color-usage.md
@@ -35,6 +35,6 @@ See the [Color Table](!/uilib/usage/customisation/colors#colors-table).
---
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/intro/08-icons.md b/packages/dnb-design-system-portal/src/docs/uilib/intro/09-icons.md
similarity index 91%
rename from packages/dnb-design-system-portal/src/docs/uilib/intro/08-icons.md
rename to packages/dnb-design-system-portal/src/docs/uilib/intro/09-icons.md
index f5baf993a10..ef906726253 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/intro/08-icons.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/intro/09-icons.md
@@ -29,6 +29,6 @@ It is recommended to use the [Icon Component](!/uilib/components/icon) to displa
---
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/intro/09-layout.md b/packages/dnb-design-system-portal/src/docs/uilib/intro/10-layout.md
similarity index 94%
rename from packages/dnb-design-system-portal/src/docs/uilib/intro/09-layout.md
rename to packages/dnb-design-system-portal/src/docs/uilib/intro/10-layout.md
index d93c23ce978..55e20d3f275 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/intro/09-layout.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/intro/10-layout.md
@@ -37,6 +37,6 @@ But there is also support for basic spacing in every component:
---
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/intro/10-components-elements-patterns.md b/packages/dnb-design-system-portal/src/docs/uilib/intro/11-components-elements-patterns.md
similarity index 92%
rename from packages/dnb-design-system-portal/src/docs/uilib/intro/10-components-elements-patterns.md
rename to packages/dnb-design-system-portal/src/docs/uilib/intro/11-components-elements-patterns.md
index 33c20569748..b230123baab 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/intro/10-components-elements-patterns.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/intro/11-components-elements-patterns.md
@@ -32,6 +32,6 @@ Patterns are larger components, less strictly defined, but with a more flexible
---
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/intro/11-usage-of-components-elements.md b/packages/dnb-design-system-portal/src/docs/uilib/intro/12-usage-of-components-elements.md
similarity index 95%
rename from packages/dnb-design-system-portal/src/docs/uilib/intro/11-usage-of-components-elements.md
rename to packages/dnb-design-system-portal/src/docs/uilib/intro/12-usage-of-components-elements.md
index 2ac10d28a5d..b284e7a2c85 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/intro/11-usage-of-components-elements.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/intro/12-usage-of-components-elements.md
@@ -53,6 +53,6 @@ Read more about using elements as [React JSX](!/uilib/elements#react-jsx)
---
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/intro/12-quality-and-tests.md b/packages/dnb-design-system-portal/src/docs/uilib/intro/13-quality-and-tests.md
similarity index 79%
rename from packages/dnb-design-system-portal/src/docs/uilib/intro/12-quality-and-tests.md
rename to packages/dnb-design-system-portal/src/docs/uilib/intro/13-quality-and-tests.md
index dcb8d49fff3..c25df7d0db5 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/intro/12-quality-and-tests.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/intro/13-quality-and-tests.md
@@ -18,6 +18,6 @@ Read [more about tests](!/uilib/usage/best-practices/for-testing).
---
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/usage/customisation.md b/packages/dnb-design-system-portal/src/docs/uilib/usage/customisation.md
index db9ab5f6941..9208be48524 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/usage/customisation.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/usage/customisation.md
@@ -22,16 +22,16 @@ For details, have a look at the submenu for all the customizations topics:
## Favicon and manifest
-To make a good looking browser icon, you need more than just one `favicon.ico` file. To get the default DNB brand look, you can use the following setup and [optimized files on GitHub](https://github.com/dnbexperience/eufemia/tree/develop/packages/dnb-ui-lib/assets/browser):
+To make a good looking browser icon, you need more than just one `favicon.ico` file. To get the default DNB brand look, you can use the following setup.
+
+You find the [optimized files on GitHub](https://github.com/dnbexperience/eufemia/tree/develop/packages/dnb-ui-lib/assets/browser).
+
+The `favicon.ico` file you don't need to specify, as long as it is placed in the server root.
+The other tags you place inside the head tag. But make sure to customize it, depending on your setup.
+
+### Good to have
```html
-
-
-
+
+
+
+
+
+```
+
+### Nice to have
+
+```html
+
+
+
+
+
```
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/usage/first-steps/web-components.md b/packages/dnb-design-system-portal/src/docs/uilib/usage/first-steps/web-components.md
index 8fc4ed1ec5c..d0f10e608d2 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/usage/first-steps/web-components.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/usage/first-steps/web-components.md
@@ -11,14 +11,6 @@ import ComponentBox from 'Tags/ComponentBox'
So called [Custom Elements](https://www.w3.org/TR/custom-elements/), running as a [Web Component](https://github.com/w3c/webcomponents/) can be used to run the `dnb-ui-lib` components in all other frameworks like Dojo.
-## Web Components and their negative trade offs
-
-The usage of the UMD version in combination with Web Components is **not recommended** because:
-
-- Accessibility and screen reader support due to ID referencing
-- Lack of native HTML support, like submit inside a form
-- Will involve too much imperative code
-
## Example usage
```jsx
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/usage/layout.md b/packages/dnb-design-system-portal/src/docs/uilib/usage/layout.md
index f942e56a8c1..3756430378e 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/usage/layout.md
+++ b/packages/dnb-design-system-portal/src/docs/uilib/usage/layout.md
@@ -49,12 +49,12 @@ UX designers are using a 12 column system during their design processes. But we
+## Media Queries and Breakpoints
+
+Use `em` for media query sizing for best overall browser support. Read [more abouts units](/uilib/usage/best-practices/for-styling#units)
+
```css
@media (max-width: 40em) {
/* mobile selectors */
}
```
-
-## Media Queries and Breakpoints
-
-Use `em` for media query sizing for best overall browser support. Read [more abouts units](/uilib/usage/best-practices/for-styling#units)
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 06fbe63ca58..362de4fbd59 100644
--- a/packages/dnb-design-system-portal/src/shared/menu/Card.js
+++ b/packages/dnb-design-system-portal/src/shared/menu/Card.js
@@ -107,6 +107,11 @@ const linkStyle = css`
background-color: var(--color-white);
transition: background-color 0.5s ease;
+
+ &:focus {
+ outline: none;
+ box-shadow: 0 0 0 0.125rem var(--color-mint-green);
+ }
`
const LinkInner = styled.span`
display: flex;
diff --git a/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.js b/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.js
index 6ba45442803..0e2faaf937c 100644
--- a/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.js
+++ b/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.js
@@ -147,6 +147,14 @@ const StyledListItem = styled.li`
}
}
+ a:focus:not(:active) {
+ color: var(--color-white);
+ svg {
+ color: var(--color-white);
+ }
+ background-color: var(--color-emerald-green);
+ }
+
@keyframes show-mobile-menu {
0% {
opacity: 0;
diff --git a/packages/dnb-design-system-portal/static/favicon-16x16.png b/packages/dnb-design-system-portal/static/favicon-16x16.png
index 487be1f17a9..71780279059 100644
Binary files a/packages/dnb-design-system-portal/static/favicon-16x16.png and b/packages/dnb-design-system-portal/static/favicon-16x16.png differ
diff --git a/packages/dnb-design-system-portal/static/favicon-32x32.png b/packages/dnb-design-system-portal/static/favicon-32x32.png
index 192b375c747..5c9ad6bf03b 100644
Binary files a/packages/dnb-design-system-portal/static/favicon-32x32.png and b/packages/dnb-design-system-portal/static/favicon-32x32.png differ
diff --git a/packages/dnb-design-system-portal/static/favicon.ico b/packages/dnb-design-system-portal/static/favicon.ico
index 6fa1e4a6eb4..5d75a399838 100644
Binary files a/packages/dnb-design-system-portal/static/favicon.ico and b/packages/dnb-design-system-portal/static/favicon.ico differ
diff --git a/packages/dnb-ui-lib/assets/browser/favicon-16x16.png b/packages/dnb-ui-lib/assets/browser/favicon-16x16.png
index 487be1f17a9..71780279059 100644
Binary files a/packages/dnb-ui-lib/assets/browser/favicon-16x16.png and b/packages/dnb-ui-lib/assets/browser/favicon-16x16.png differ
diff --git a/packages/dnb-ui-lib/assets/browser/favicon-32x32.png b/packages/dnb-ui-lib/assets/browser/favicon-32x32.png
index 192b375c747..5c9ad6bf03b 100644
Binary files a/packages/dnb-ui-lib/assets/browser/favicon-32x32.png and b/packages/dnb-ui-lib/assets/browser/favicon-32x32.png differ
diff --git a/packages/dnb-ui-lib/assets/browser/favicon.ico b/packages/dnb-ui-lib/assets/browser/favicon.ico
index 6fa1e4a6eb4..5d75a399838 100644
Binary files a/packages/dnb-ui-lib/assets/browser/favicon.ico and b/packages/dnb-ui-lib/assets/browser/favicon.ico differ
diff --git a/packages/dnb-ui-lib/scripts/figma/version.lock b/packages/dnb-ui-lib/scripts/figma/version.lock
index 1faf783b9f1..ded5e14109f 100644
--- a/packages/dnb-ui-lib/scripts/figma/version.lock
+++ b/packages/dnb-ui-lib/scripts/figma/version.lock
@@ -1 +1 @@
-{"1a3caba565dddc0a936aaddc29a82887":"175646935"}
\ No newline at end of file
+{"1a3caba565dddc0a936aaddc29a82887":"178606979"}
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/src/components/dropdown/Dropdown.js b/packages/dnb-ui-lib/src/components/dropdown/Dropdown.js
index 4b41db90606..7664c622e85 100644
--- a/packages/dnb-ui-lib/src/components/dropdown/Dropdown.js
+++ b/packages/dnb-ui-lib/src/components/dropdown/Dropdown.js
@@ -92,7 +92,9 @@ export const propTypes = {
])
)
]).isRequired,
- selected_item: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
+ default_value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
+ selected_item: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), // deprecated
open_on_focus: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
opened: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
disabled: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
@@ -134,7 +136,9 @@ export const defaultProps = {
size: null,
align_dropdown: null,
data: null,
- selected_item: null,
+ default_value: null,
+ value: 'initval',
+ selected_item: 'initval', // deprecated
open_on_focus: false,
opened: false,
disabled: null,
@@ -226,14 +230,12 @@ export default class Dropdown extends PureComponent {
return res || []
}
- static getOptionData(selected_item, data) {
+ static getOptionData(value, data) {
if (typeof data === 'function') {
data = data()
}
return (
- (data &&
- data.filter((data, i) => i === parseFloat(selected_item))[0]) ||
- []
+ (data && data.filter((data, i) => i === parseFloat(value))[0]) || []
)
}
@@ -245,20 +247,40 @@ export default class Dropdown extends PureComponent {
if (props.data && typeof props.data !== 'function') {
state.data = Dropdown.getData(props)
}
+
+ let hasChanged = false
+
+ // deprecated, use value instad
if (
- !state._isNewActiveItem &&
+ props.selected_item !== 'initval' &&
state.selected_item !== props.selected_item
) {
- state.selected_item = props.selected_item
- if (typeof props.on_state_update === 'function') {
- dispatchCustomElementEvent({ props }, 'on_state_update', {
- data: Dropdown.getOptionData(props.selected_item, state.data)
- })
- }
+ state.selected_item =
+ parseFloat(props.selected_item) > -1
+ ? parseFloat(props.selected_item)
+ : props.selected_item
+ hasChanged = true
+ }
+
+ if (
+ props.value !== 'initval' &&
+ state.selected_item !== props.value
+ ) {
+ state.selected_item =
+ parseFloat(props.value) > -1
+ ? parseFloat(props.value)
+ : props.value
+ hasChanged = true
+ }
+ if (hasChanged && typeof props.on_state_update === 'function') {
+ dispatchCustomElementEvent({ props }, 'on_state_update', {
+ data: Dropdown.getOptionData(state.selected_item, state.data),
+ value: state.selected_item,
+ selected_item: state.selected_item // deprecated
+ })
}
}
state._listenForPropChanges = true
- state._isNewActiveItem = false
return state
}
@@ -276,7 +298,12 @@ export default class Dropdown extends PureComponent {
max_height: props.max_height,
active_item: props.selected_item,
// send selected_item in here, so we dont trigger on_state_update
- selected_item: props.selected_item,
+ selected_item:
+ parseFloat(props.default_value) > -1
+ ? parseFloat(props.default_value)
+ : parseFloat(props.value) > -1
+ ? parseFloat(props.value)
+ : props.selected_item,
selectedItemHasChanged: false
}
@@ -320,7 +347,7 @@ export default class Dropdown extends PureComponent {
clearTimeout(this._hideTimeout)
clearTimeout(this._showTimeout)
this.searchCache = null
- const { selected_item, opened, hidden } = this.state
+ const { selected_item, active_item, opened, hidden } = this.state
if (!opened && hidden) {
this.blockDoubleClick = true
}
@@ -331,14 +358,16 @@ export default class Dropdown extends PureComponent {
_listenForPropChanges: false
},
() => {
- this._showTimeout = setTimeout(() => {
- this.blockDoubleClick = false
- }, 1e3) // wait until animation is over
+ this._showTimeout = setTimeout(
+ () => (this.blockDoubleClick = false),
+ 1e3
+ ) // wait until animation is over
this.setDirectionObserver()
this.setScrollObserver()
this.setOutsideClickObserver()
- this.scrollToItem(selected_item, {
+
+ this.scrollToItem(active_item > -1 ? active_item : selected_item, {
scrollTo: false
})
}
@@ -458,7 +487,8 @@ export default class Dropdown extends PureComponent {
if (fireSelectEvent) {
const attributes = this.attributes || {}
const ret = dispatchCustomElementEvent(this, 'on_select', {
- selected_item,
+ value: selected_item,
+ selected_item, // deprecated
active_item,
data: Dropdown.getOptionData(active_item, this.state.data),
event,
@@ -469,7 +499,7 @@ export default class Dropdown extends PureComponent {
}
}
- if (!selected_item) {
+ if (!(selected_item > -1)) {
return
}
@@ -636,7 +666,7 @@ export default class Dropdown extends PureComponent {
}
selectItem = (
- selected_item,
+ itemToSelect,
{ fireSelectEvent = false, event = null } = {}
) => {
// because of our delay on despatching the event
@@ -645,27 +675,28 @@ export default class Dropdown extends PureComponent {
event.persist()
}
- if (
- this.state.selected_item !== selected_item ||
+ const doCallOnChange =
+ this.state.selected_item !== itemToSelect ||
// to make sure we call "on_change" on startup
this.state.selectedItemHasChanged === false
- ) {
- const attributes = this.attributes || {}
- dispatchCustomElementEvent(this, 'on_change', {
- selected_item,
- data: Dropdown.getOptionData(selected_item, this.state.data),
- event,
- attributes
- })
- }
const onSelectionIsComplete = () => {
+ const attributes = this.attributes || {}
+ if (doCallOnChange) {
+ dispatchCustomElementEvent(this, 'on_change', {
+ value: itemToSelect,
+ selected_item: itemToSelect, // deprecated
+ data: Dropdown.getOptionData(itemToSelect, this.state.data),
+ event,
+ attributes
+ })
+ }
if (fireSelectEvent) {
- const attributes = this.attributes || {}
dispatchCustomElementEvent(this, 'on_select', {
- selected_item,
- active_item: selected_item,
- data: Dropdown.getOptionData(selected_item, this.state.data),
+ value: itemToSelect,
+ selected_item: itemToSelect, // deprecated
+ active_item: itemToSelect,
+ data: Dropdown.getOptionData(itemToSelect, this.state.data),
event,
attributes
})
@@ -687,11 +718,10 @@ export default class Dropdown extends PureComponent {
} else {
this.setState(
{
- // Do not set "_listenForPropChanges" to false here, as it will block instant component rerender
- _isNewActiveItem: true,
+ _listenForPropChanges: false,
selectedItemHasChanged: true,
- selected_item,
- active_item: selected_item
+ selected_item: itemToSelect,
+ active_item: itemToSelect
},
onSelectionIsComplete
)
@@ -794,7 +824,8 @@ export default class Dropdown extends PureComponent {
this.setState({
direction,
- max_height
+ max_height,
+ _listenForPropChanges: false
})
}
diff --git a/packages/dnb-ui-lib/src/components/dropdown/__tests__/Dropdown.test.js b/packages/dnb-ui-lib/src/components/dropdown/__tests__/Dropdown.test.js
index 862f61d3309..abd03d019b4 100644
--- a/packages/dnb-ui-lib/src/components/dropdown/__tests__/Dropdown.test.js
+++ b/packages/dnb-ui-lib/src/components/dropdown/__tests__/Dropdown.test.js
@@ -27,7 +27,7 @@ const snapshotProps = {
status_state: 'error',
direction: 'bottom',
label_direction: 'horizontal',
- selected_item: 2,
+ value: 2,
more_menu: null,
prevent_selection: null,
align_dropdown: null,
@@ -35,7 +35,7 @@ const snapshotProps = {
size: null
}
-const props = { id: 'dropdown-id', selected_item: 2 }
+const props = { id: 'dropdown-id', value: 2 }
const mockData = [
{
@@ -79,23 +79,36 @@ describe('Dropdown component', () => {
expect(Comp.state().hidden).toBe(false)
})
- it('has correct selected_item on keydown "ArrowDown" and "Enter"', () => {
- expect(Comp.state().selected_item).toBe(props.selected_item)
+ it('has correct value on keydown "ArrowDown" and "Enter"', async () => {
+ expect(Comp.state().selected_item).toBe(props.value)
+
+ expect(Comp.find('.dnb-dropdown__text__inner').text()).toBe(
+ mockData[props.value].selected_value
+ )
+
+ // open
Comp.find('button').simulate('mousedown')
- expect(Comp.state().active_item).toBe(props.selected_item)
+
+ expect(Comp.state().active_item).toBe(props.value)
+
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 40 })) // down
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 13 })) // enter
- expect(Comp.state().active_item).toBe(props.selected_item + 1)
- expect(Comp.state().selected_item).toBe(props.selected_item + 1)
+
+ expect(Comp.state().active_item).toBe(props.value + 1)
+ expect(Comp.state().selected_item).toBe(props.value + 1)
+
+ expect(Comp.find('.dnb-dropdown__text__inner').text()).toBe(
+ mockData[props.value + 1].selected_value
+ )
})
- it('has correct selected_item after forcing rerender with null as value', () => {
+ it('has correct value after forcing rerender', async () => {
const title = 'Make a selection'
const Comp = mount(
-
+
)
- expect(Comp.state().selected_item).toBe(props.selected_item)
+ expect(Comp.state().selected_item).toBe(props.value)
// open
Comp.find('button').simulate('mousedown')
@@ -103,18 +116,29 @@ describe('Dropdown component', () => {
// make first selection
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 40 })) // down
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 13 })) // enter
- expect(Comp.state().selected_item).toBe(props.selected_item + 1)
+
+ expect(Comp.state().selected_item).toBe(props.value + 1)
// force rerender by prop change
Comp.setProps({
- selected_item: null
+ title
+ })
+
+ expect(Comp.state().selected_item).toBe(props.value + 1)
+ expect(Comp.find('.dnb-dropdown__text__inner').text()).toBe(
+ mockData[props.value + 1].selected_value
+ )
+
+ // force rerender with null as value by prop change
+ Comp.setProps({
+ value: null
})
expect(Comp.state().selected_item).toBe(null)
expect(Comp.find('.dnb-dropdown__text__inner').text()).toBe(title)
})
- it('has correct selected_item on key search', () => {
+ it('has correct value on key search', () => {
Comp.find('button').simulate('mousedown')
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 66 })) // B
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 70 })) // F
@@ -139,7 +163,7 @@ describe('Dropdown component', () => {
// then simulate changes
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 32 })) // space
- const notChangedItem = mockData[props.selected_item]
+ const notChangedItem = mockData[props.value]
expect(on_change.mock.calls[0][0].data).toBe(notChangedItem)
// open again
@@ -147,7 +171,7 @@ describe('Dropdown component', () => {
// then simulate changes
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 40 })) // down
- const selectedItem = mockData[props.selected_item + 1]
+ const selectedItem = mockData[props.value + 1]
expect(on_select.mock.calls[1][0].data).toBe(selectedItem) // second call!
})
@@ -164,7 +188,7 @@ describe('Dropdown component', () => {
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 40 })) // down
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 13 })) // enter
- const selectedItem = mockData[props.selected_item + 1]
+ const selectedItem = mockData[props.value + 1]
expect(on_change.mock.calls[0][0].data).toBe(selectedItem)
})
@@ -240,7 +264,7 @@ describe('Dropdown component', () => {
it('has correct selected value', () => {
const Comp = mount()
expect(Comp.find('.dnb-dropdown__text__inner').text()).toBe(
- mockData[props.selected_item].selected_value
+ mockData[props.value].selected_value
)
})
@@ -248,14 +272,14 @@ describe('Dropdown component', () => {
Comp.find('button').simulate('mousedown')
Comp.find('li.dnb-dropdown__option')
.find('.dnb-dropdown__option__inner')
- .at(props.selected_item)
+ .at(props.value)
.simulate('mousedown')
expect(Comp.find('.dnb-dropdown__text__inner').text()).toBe(
- mockData[props.selected_item].selected_value
+ mockData[props.value].selected_value
)
})
- it('has a default title if no selected_item is given', () => {
+ it('has a default title if no value is given', () => {
const title = 'Make a selection'
const Comp = mount()
expect(
@@ -263,11 +287,11 @@ describe('Dropdown component', () => {
).toBe(title)
})
- it('has a corret selected_item content if we send in a React component', () => {
+ it('has a corret value content if we send in a React component', () => {
const aStringOf = 'Custom content 123'
- const Comp1 = mount()
- const Comp2 = mount()
- const Comp3 = mount()
+ const Comp1 = mount()
+ const Comp2 = mount()
+ const Comp3 = mount()
expect(
Comp1.find('.dnb-dropdown__text__inner').instance().innerHTML
).toBe(aStringOf)
diff --git a/packages/dnb-ui-lib/src/components/dropdown/__tests__/__snapshots__/Dropdown.test.js.snap b/packages/dnb-ui-lib/src/components/dropdown/__tests__/__snapshots__/Dropdown.test.js.snap
index 5a8c144d69c..fca5efdeb58 100644
--- a/packages/dnb-ui-lib/src/components/dropdown/__tests__/__snapshots__/Dropdown.test.js.snap
+++ b/packages/dnb-ui-lib/src/components/dropdown/__tests__/__snapshots__/Dropdown.test.js.snap
@@ -55,6 +55,7 @@ exports[`Dropdown component have to match snapshot 1`] = `
],
]
}
+ default_value="default_value"
direction="bottom"
disabled="disabled"
global_status_id="global_status_id"
@@ -76,13 +77,14 @@ exports[`Dropdown component have to match snapshot 1`] = `
opened="opened"
prevent_selection={null}
scrollable={true}
- selected_item={2}
+ selected_item="selected_item"
size={null}
status="status"
status_animation="status_animation"
status_state="error"
title="title"
trigger_component={null}
+ value={2}
>