diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/global-status/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/components/global-status/Examples.tsx
index f6804911bd1..792e739862b 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/global-status/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/global-status/Examples.tsx
@@ -11,6 +11,7 @@ import {
Input,
Section,
ToggleButton,
+ FormSet,
} from '@dnb/eufemia/src'
export const GlobalStatusError = () => (
@@ -294,3 +295,133 @@ export const GlobalStatusUpdate = () => (
}}
)
+
+export const GlobalStatusInfoExample1 = () => (
+
+
+
+)
+
+export const GlobalStatusInfoExample2 = () => (
+
+
+
+
+)
+
+export const GlobalStatusInfoExample3 = () => (
+
+
+
+
+
+
+)
+
+export const GlobalStatusInfoExampleManipulate1 = () => (
+
+ {() => {
+ // 1. Update / extend the the status like so:
+
+ const statusOne = GlobalStatus.create({
+ id: 'other-global-status', // or main
+ status_id: 'custom-id-1',
+ text: 'New Text',
+ item: 'Item from status #1',
+ title: 'New Title',
+ show: true,
+ })
+
+ // 2. and removes "custom-id-1" again if needed
+
+ statusOne.update({
+ text: 'Updated Text',
+ })
+
+ // 3. and removes "custom-id-1" again if needed
+ statusOne.remove()
+
+ return
+ }}
+
+)
+
+export const GlobalStatusInfoExampleManipulate2 = () => (
+
+ {/* 1. Place it under the header bar */}
+
+ {/* 2. later on, you can show a message */}
+ {
+ console.log('on_close', status_id)
+ }}
+ />
+ {/* 3. and remove it again */}
+
+
+)
+
+export const GlobalStatusInfoExampleManipulate3 = () => (
+
+ {/* 1. Place it somewhere in your application */}
+
+ {/* 2. later on, you can show a message */}
+ {
+ console.log('on_close', status_id)
+ }}
+ />
+ {/* 3. and remove it again */}
+
+
+)
+
+export const GlobalStatusExampleControllers = () => (
+
+ {/* Place the status where ever you have to.*/}
+
+ {/* Manipulate the status later on. Every property is optional.*/}
+ {
+ console.log('on_close', status_id)
+ }}
+ />
+ {
+ console.log('on_close', status_id)
+ }}
+ />
+ {
+ console.log('on_close', status_id)
+ }}
+ />
+ {/* or update the status.*/}
+
+ {/* Later you can remove a resolved item.*/}
+
+
+)
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/global-status/info.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/global-status/info.mdx
index 349329bad43..b2d112492b1 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/global-status/info.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/global-status/info.mdx
@@ -2,6 +2,15 @@
showTabs: true
---
+import {
+ GlobalStatusInfoExample1,
+ GlobalStatusInfoExample2,
+ GlobalStatusInfoExample3,
+ GlobalStatusInfoExampleManipulate1,
+ GlobalStatusInfoExampleManipulate2,
+ GlobalStatusInfoExampleManipulate3,
+} from 'Docs/uilib/components/global-status/Examples'
+
## Description
The GlobalStatus is a complex component meant for displaying global Application notifications or a summary of a form ( displaying form errors, messages etc. ).
@@ -18,31 +27,18 @@ By default, the `GlobalStatus` is automatically connected together with the [For
Normally, you only want to have **one** `GlobalStatus` inside your application. But you can have several in parallel. But make sure you give every other a new ID:
-```jsx
-
-```
+
### Where to put it
- The `GlobalStatus` component should be positioned right under the header. By default, it uses `main` as the ID.
- Or as a secondary summary of errors in a submit form. Keep in mind, by default, form components like [Input](/uilib/components/input) are using the ID `main`. To make sure the build in [FormStatus](/uilib/components/form-status) is sending along the message to another `GlobalStatus`, you have to set the `global_status_id`, like:
-```jsx
-
-...
-
-```
+
But you can also make use of the [FormSet](/uilib/components/form-set) or [FormRow](/uilib/components/form-row) which will send along the `global_status_id` the underlying/wrapped components, like:
-```jsx
-
-...
-
-
- ...
-
-```
+
### Manually updates
@@ -56,69 +52,16 @@ You can access and manipulate an existing GlobalStatus from outside of the React
1. Given you have already defined a GlobalStatus in JSX:
-```jsx
-
-```
+
2. Then you can control it from within a JavaScript context whenever you need to:
-```js
-import { GlobalStatus } from '@dnb/eufemia/components'
-
-// 1. Update / extend the the status like so:
-const statusOne = GlobalStatus.create({
- id: 'other-global-status', // or main
- status_id: 'custom-id-1',
- text: 'New Text',
- item: 'Item from status #1',
-})
-
-// 2. and removes "custom-id-1" again if needed
-statusOne.update({
- text: 'Updated Text',
-})
-
-// 3. and removes "custom-id-1" again if needed
-statusOne.remove()
-```
+
### JSX
-```jsx
-import { GlobalStatus } from '@dnb/eufemia/components'
-
-// 1. Place it under the header bar
-
-
-// 2. later on, you can show a message
-
-
-// 3. and remove it again
-
-```
+
If you need an additional `GlobalStatus`, define a custom ID (custom-status):
-```jsx
-import { GlobalStatus } from '@dnb/eufemia/components'
-
-// 1. Place it somewhere in your application
-
-
-// 2. later on, you can show a message
-
-
-// 3. and remove it again
-
-```
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/global-status/properties.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/global-status/properties.mdx
index 71c1ebad46e..bf63ff12f87 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/global-status/properties.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/global-status/properties.mdx
@@ -2,6 +2,8 @@
showTabs: true
---
+import { GlobalStatusExampleControllers } from 'Docs/uilib/components/global-status/Examples'
+
## Properties
| Properties | Description |
@@ -50,21 +52,7 @@ const items = [
In React, you can make use of the helper components, the function as a kind of a controller component.
The goal is to update the content (properties/events) of the target GlobalStatus.
-```jsx
-// Place the status where ever you have to.
-
-
-// Manipulate the status later on. Every property is optional.
-
-
-
-
-// or update the status.
-
-
-// Later you can remove a resolved item.
-
-```
+
| Controller Properties | Description |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
diff --git a/packages/dnb-eufemia/src/components/global-status/GlobalStatus.d.ts b/packages/dnb-eufemia/src/components/global-status/GlobalStatus.d.ts
index b98abebe605..04d3aa05d26 100644
--- a/packages/dnb-eufemia/src/components/global-status/GlobalStatus.d.ts
+++ b/packages/dnb-eufemia/src/components/global-status/GlobalStatus.d.ts
@@ -7,7 +7,7 @@ export type GlobalStatusText =
| string
| ((...args: any[]) => any)
| React.ReactNode;
-export type GlobalStatusItems = string | ((...args: any[]) => any) | any[];
+export type GlobalStatusItem = string | ((...args: any[]) => any) | any;
export type GlobalStatusState = 'error' | 'info';
export type GlobalStatusShow = 'auto' | any | any | 'true' | 'false';
export type GlobalStatusDelay = string | number;
@@ -38,7 +38,7 @@ export interface GlobalStatusProps
/**
* The items (list items) appear as a part of the status content. you can both use an JSON array, or a vanilla array with a string or an object content. See "Item Object" example below.
*/
- items?: GlobalStatusItems;
+ items?: GlobalStatusItem[];
/**
* The icon shown before the status title. Defaults to `exclamation`.
@@ -197,6 +197,7 @@ export type GlobalStatusInterceptorProps = {
* Set to `true` or `false` to manually make the global status visible. Defaults to `true`.
*/
show: boolean;
+ item?: GlobalStatusItem;
};
export type GlobalStatusInterceptorUpdateEvents = {
/**
@@ -218,6 +219,7 @@ export type GlobalStatusInterceptorUpdateEvents = {
* Set to `true` or `false` to manually make the global status visible. Defaults to `true`.
*/
show?: boolean;
+ text?: string;
};
export type GlobalStatusInterceptor = {
update: (props: GlobalStatusInterceptorUpdateEvents) => void;
@@ -234,7 +236,7 @@ export default class GlobalStatus extends React.Component<
static Add: (props: GlobalStatusAddProps) => JSX.Element;
static Update: (
props: GlobalStatusUpdateProps
- ) => GlobalStatusInterceptor;
+ ) => JSX.Element & GlobalStatusInterceptor;
static Remove: (props: GlobalStatusRemoveProps) => JSX.Element;
render(): JSX.Element;
}
diff --git a/packages/dnb-eufemia/src/components/global-status/stories/GlobalStatus.stories.tsx b/packages/dnb-eufemia/src/components/global-status/stories/GlobalStatus.stories.tsx
index 97ab0b35ce7..fee3eb27fbe 100644
--- a/packages/dnb-eufemia/src/components/global-status/stories/GlobalStatus.stories.tsx
+++ b/packages/dnb-eufemia/src/components/global-status/stories/GlobalStatus.stories.tsx
@@ -461,7 +461,7 @@ const DemoAnimation = () => {