diff --git a/packages/dnb-design-system-portal/src/docs/EUFEMIA_CHANGELOG.mdx b/packages/dnb-design-system-portal/src/docs/EUFEMIA_CHANGELOG.mdx index 84b9a8813a3..900c7e014c2 100644 --- a/packages/dnb-design-system-portal/src/docs/EUFEMIA_CHANGELOG.mdx +++ b/packages/dnb-design-system-portal/src/docs/EUFEMIA_CHANGELOG.mdx @@ -1,8 +1,11 @@ +## January, 18. 2024 + +- New component: [AriaLive](/uilib/components/aria-live) + ## May, 31. 2023 - [New major version 10](/uilib/about-the-lib/releases/eufemia/v10-info/) -- New components released: - - [SkipContent](/uilib/components/skip-content) +- New component: [SkipContent](/uilib/components/skip-content) - [GlobalError](/uilib/components/global-error) got new styles (without illustrations). - New [Icons](/icons/secondary): - `handshake` diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/aria-live.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/aria-live.mdx new file mode 100644 index 00000000000..d966b2d928b --- /dev/null +++ b/packages/dnb-design-system-portal/src/docs/uilib/components/aria-live.mdx @@ -0,0 +1,15 @@ +--- +title: 'AriaLive' +description: 'AriaLive is a React component and hook that helps make your web app more accessible by announcing dynamic changes to screen readers.' +showTabs: true +hideTabs: + - title: Events +theme: 'sbanken' +status: 'new' +--- + +import AriaLiveInfo from 'Docs/uilib/components/aria-live/info' +import AriaLiveDemos from 'Docs/uilib/components/aria-live/demos' + + + diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/aria-live/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/components/aria-live/Examples.tsx new file mode 100644 index 00000000000..13208a0181e --- /dev/null +++ b/packages/dnb-design-system-portal/src/docs/uilib/components/aria-live/Examples.tsx @@ -0,0 +1,154 @@ +/** + * UI lib Component Example + * + */ + +import React from 'react' +import { Field, FieldBlock, Form } from '@dnb/eufemia/src/extensions/forms' +import ComponentBox from '../../../../shared/tags/ComponentBox' +import { AriaLive, Button, Flex, P } from '@dnb/eufemia/src' + +export const AriaLivePlayground = () => ( + + {() => { + const priorities = ['low', 'high'] + const contents = { + default: 'This is a default announcement', + second: 'And a second one', + third: 'A third one', + fourth: 'And a fourth one', + } + const priority: 'low' | 'high' = 'low' + const defaultData = { + enabled: false, + content: contents.default, + priority, + } + + function AriaLiveExample() { + const { data } = Form.useData('aria-live-playground', defaultData) + + return ( + + + + + {priorities.map((content) => { + return ( + + ) + })} + + + + {Object.entries(contents).map(([key, value]) => { + return ( + + ) + })} + + + + + + Output:{' '} + + Message: {data.content} + + + + + ) + } + + return + }} + +) + +export const AriaLiveAdditions = () => ( + + {() => { + const defaultData = { + enabled: false, + content: [

Line 1

], + } + + function AriaLiveExample() { + const { data, update } = Form.useData( + 'aria-live-additions', + defaultData, + ) + + return ( + + + + + + +