From d0f553aa06b40648b352b4f885b5411ab01e1c2e Mon Sep 17 00:00:00 2001 From: Joakim Bjerknes Date: Tue, 24 Sep 2024 09:22:40 +0200 Subject: [PATCH] add documentation --- .../src/docs/uilib/components/dropdown/properties.mdx | 1 + .../src/components/autocomplete/Autocomplete.d.ts | 3 +++ .../src/components/autocomplete/AutocompleteDocs.ts | 5 +++++ packages/dnb-eufemia/src/components/dropdown/Dropdown.d.ts | 2 +- .../dnb-eufemia/src/fragments/drawer-list/DrawerList.d.ts | 3 +++ .../dnb-eufemia/src/fragments/drawer-list/DrawerListDocs.ts | 5 +++++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/properties.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/properties.mdx index 57e8a90f4d1..23e33e579cd 100644 --- a/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/properties.mdx +++ b/packages/dnb-design-system-portal/src/docs/uilib/components/dropdown/properties.mdx @@ -40,6 +40,7 @@ You may check out the [DrawerList Properties](#drawerlist-properties) down below | `innerRef` | _(optional)_ by providing a React.ref you can get the internally used main element (DOM). E.g. `innerRef={myRef}` by using `React.createRef()` or `React.useRef()`. | | `buttonRef` | _(optional)_ by providing a React.ref you can get the internally used button element (DOM). E.g. `buttonRef={myRef}` by using `React.createRef()` or `React.useRef()`. | | `skeleton` | _(optional)_ if set to `true`, an overlaying skeleton with animation will be shown. | +| `keepSelectIndexOnDataChange` | _(optional)_ Determines if the selection index should be retained between `data` changes or not. Defaults to `false` | | [DrawerList](/uilib/components/fragments/drawer-list/properties) | _(optional)_ all DrawerList properties. | | [Space](/uilib/layout/space/properties) | _(optional)_ spacing properties like `top` or `bottom` are supported. | diff --git a/packages/dnb-eufemia/src/components/autocomplete/Autocomplete.d.ts b/packages/dnb-eufemia/src/components/autocomplete/Autocomplete.d.ts index 8a38dfdb41e..8679bc0873f 100644 --- a/packages/dnb-eufemia/src/components/autocomplete/Autocomplete.d.ts +++ b/packages/dnb-eufemia/src/components/autocomplete/Autocomplete.d.ts @@ -211,6 +211,9 @@ export interface AutocompleteProps { * Define a custom class for the internal drawer-list. This makes it possible more easily customize the drawer-list style with styled-components and the `css` style method. Defaults to `null`. */ drawer_class?: string; + /** + * Determines if the selection index should retain between `data` changes or not. Default: `false` + */ keepSelectIndexOnDataChange?: boolean; on_type?: (...args: any[]) => any; on_focus?: (...args: any[]) => any; diff --git a/packages/dnb-eufemia/src/components/autocomplete/AutocompleteDocs.ts b/packages/dnb-eufemia/src/components/autocomplete/AutocompleteDocs.ts index f3e63e18783..d3fda5603e2 100644 --- a/packages/dnb-eufemia/src/components/autocomplete/AutocompleteDocs.ts +++ b/packages/dnb-eufemia/src/components/autocomplete/AutocompleteDocs.ts @@ -236,6 +236,11 @@ export const autocompleteProperties: PropertiesTableProps = { type: ['string', 'React.Element'], status: 'optional', }, + keepSelectIndexOnDataChange: { + doc: 'Determines if the selection index should be retained between `data` changes or not. Defaults to `false`', + type: 'boolean', + status: 'optional', + }, '[DrawerList](/uilib/components/fragments/drawer-list/properties)': { doc: 'all DrawerList properties.', type: 'Various', diff --git a/packages/dnb-eufemia/src/components/dropdown/Dropdown.d.ts b/packages/dnb-eufemia/src/components/dropdown/Dropdown.d.ts index 67c7c1303b0..113f2bf8e0c 100644 --- a/packages/dnb-eufemia/src/components/dropdown/Dropdown.d.ts +++ b/packages/dnb-eufemia/src/components/dropdown/Dropdown.d.ts @@ -108,7 +108,7 @@ export interface DropdownProps { on_show_focus?: (...args: any[]) => any; on_hide_focus?: (...args: any[]) => any; /** - * Resets the select index when data prop changes + * Determines if the selection index should retain between `data` changes or not. Default: `false` */ keepSelectIndexOnDataChange?: boolean; } diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerList.d.ts b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerList.d.ts index 4351efb7ece..7fc82b65f46 100644 --- a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerList.d.ts +++ b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerList.d.ts @@ -181,6 +181,9 @@ export interface DrawerListProps { on_resize?: (...args: any[]) => any; on_select?: (...args: any[]) => any; on_state_update?: (...args: any[]) => any; + /** + * Determines if the selection index should retain between `data` changes or not. Default: `false` + */ keepSelectIndexOnDataChange?: boolean; } export type DrawerListOptionsProps = { diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListDocs.ts b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListDocs.ts index caff798721e..05c26e7ccef 100644 --- a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListDocs.ts +++ b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListDocs.ts @@ -146,6 +146,11 @@ export const DrawerListProperties: PropertiesTableProps = { type: 'function', status: 'optional', }, + keepSelectIndexOnDataChange: { + doc: 'Determines if the selection index should be retained between `data` changes or not. Defaults to `false`', + type: 'boolean', + status: 'optional', + }, '[Space](/uilib/layout/space/properties)': { doc: 'Spacing properties like `top` or `bottom` are supported.', type: ['string', 'object'],