diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/fragments/drawer-list/properties.md b/packages/dnb-design-system-portal/src/docs/uilib/components/fragments/drawer-list/properties.md index 62dc0398570..b1ab3a38563 100644 --- a/packages/dnb-design-system-portal/src/docs/uilib/components/fragments/drawer-list/properties.md +++ b/packages/dnb-design-system-portal/src/docs/uilib/components/fragments/drawer-list/properties.md @@ -34,6 +34,4 @@ showTabs: true | `cache_hash` | _(optional)_ set a `cache_hash` as a string to enable internal memorizing of the list to enhance rerendering performance. Components like Autocomplete is using this because of the huge data changes due to search and reorder. Defaults to `null`. | | `wrapper_element` | _(optional)_ has to be a HTML Element, ideal a mother element, used to calculate sizes and distances. Also used for the "click outside" detection. Clicking on the `wrapper_element` will not be anymore triggered as an outside click. | | `options_render` | _(optional)_ has to be a function, returning the items again. Se [example](/uilib/components/fragments/drawer-list#example-usage-of-options_render). This can be used to add additional options above the actual rendered list. | -| ~~`use_drawer_on_mobile`~~ | _(deprecated)_ If set to true, the DrawerList will be shown as a drawer with a fixed position, so mobile devices (`max-width: 40em`) can more easily scroll long lists and select the options. Defaults to `false`. | -| ~~`enable_closest_observer`~~ | _(deprecated)_ it set to true, an element class is set for every closest visible top and bottom item, regardless what the height of the drawer is. Defaults to false. | | [Space](/uilib/components/space/properties) | _(optional)_ spacing properties like `top` or `bottom` are supported. | diff --git a/packages/dnb-eufemia/src/components/autocomplete/__tests__/__snapshots__/Autocomplete.test.js.snap b/packages/dnb-eufemia/src/components/autocomplete/__tests__/__snapshots__/Autocomplete.test.js.snap index 803e22afcd4..aa2d68514d4 100644 --- a/packages/dnb-eufemia/src/components/autocomplete/__tests__/__snapshots__/Autocomplete.test.js.snap +++ b/packages/dnb-eufemia/src/components/autocomplete/__tests__/__snapshots__/Autocomplete.test.js.snap @@ -199,7 +199,6 @@ exports[`Autocomplete markup have to match snapshot 1`] = ` tagName="dnb-autocomplete" title="title" triangle_position={null} - use_drawer_on_mobile={null} value={2} wrapper_element={null} > @@ -1129,7 +1128,6 @@ exports[`Autocomplete markup have to match snapshot 1`] = ` skip_keysearch={false} skip_portal={true} triangle_position={null} - use_drawer_on_mobile={false} value={2} wrapper_element={null} > @@ -1180,7 +1178,6 @@ exports[`Autocomplete markup have to match snapshot 1`] = ` skip_keysearch={false} skip_portal={true} triangle_position={null} - use_drawer_on_mobile={false} value={2} wrapper_element={null} > @@ -1201,7 +1198,7 @@ exports[`Autocomplete markup have to match snapshot 1`] = ` aria-activedescendant="option-autocomplete-id-2" aria-expanded={true} aria-labelledby="autocomplete-id-label" - cache_hash="22undefinedundefinedbottom1" + cache_hash="2222bottom1" class={null} className={null} id="autocomplete-id-ul" @@ -1322,7 +1319,7 @@ exports[`Autocomplete markup have to match snapshot 1`] = ` { /> @@ -788,7 +786,6 @@ exports[`Dropdown markup have to match snapshot 1`] = ` skip_keysearch={false} skip_portal={true} triangle_position="right" - use_drawer_on_mobile={null} value={2} wrapper_element={null} > @@ -808,7 +805,7 @@ exports[`Dropdown markup have to match snapshot 1`] = ` aria-activedescendant="option-dropdown-id-2" aria-expanded={true} aria-labelledby="dropdown-id-label" - cache_hash="22undefinedundefinedbottom1" + cache_hash="2277bottom1" class={null} className={null} id="dropdown-id-ul" @@ -1164,7 +1161,7 @@ exports[`Dropdown markup have to match snapshot 1`] = `
  • { - + @@ -224,7 +220,6 @@ const DropdownStory = () => { { - - - @@ -770,33 +762,6 @@ CurrencySelector.defaultProps = { value: null, } -function DropdownStates() { - const [state, setState] = React.useState({}) - - const handleOnChange = (props) => { - console.log('DropdownStates', props) - setState({ state: Math.random() }) - } - - return ( - - <>{JSON.stringify(state)} - - - - ) -} - function DropdownStatesSync() { const [state, setState] = React.useState({}) diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerList.js b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerList.js index 5b3de3ad598..e70c6006cb1 100644 --- a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerList.js +++ b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerList.js @@ -160,7 +160,6 @@ class DrawerListInstance extends React.PureComponent { role, align_drawer, fixed_position, - use_drawer_on_mobile, independent_width, scrollable, focusable, @@ -234,7 +233,6 @@ class DrawerListInstance extends React.PureComponent { isTrue(scrollable) && 'dnb-drawer-list--scroll', isTrue(no_scroll_animation) && 'dnb-drawer-list--no-scroll-animation', - isTrue(use_drawer_on_mobile) && 'dnb-drawer-list--mobile-view', createSpacingClasses(props), _className, className @@ -405,7 +403,6 @@ class DrawerListInstance extends React.PureComponent { include_owner_width={align_drawer === 'right'} independent_width={isTrue(independent_width)} fixed_position={isTrue(fixed_position)} - use_drawer_on_mobile={isTrue(use_drawer_on_mobile)} className={portal_class} > {mainList} diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListHelpers.js b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListHelpers.js index 50dd2cb1269..fcfdb7bb8a6 100644 --- a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListHelpers.js +++ b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListHelpers.js @@ -27,10 +27,7 @@ export const drawerListPropTypes = { PropTypes.string, PropTypes.bool, ]), - use_drawer_on_mobile: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.bool, - ]), + prevent_selection: PropTypes.oneOfType([ PropTypes.string, PropTypes.bool, @@ -136,7 +133,6 @@ export const drawerListDefaultProps = { size: 'default', no_animation: false, no_scroll_animation: false, - use_drawer_on_mobile: false, prevent_selection: false, action_menu: false, is_popup: false, @@ -179,10 +175,6 @@ export const drawerListDefaultProps = { export const drawerListProviderPropTypes = { enable_body_lock: PropTypes.bool, - use_drawer_on_mobile: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.bool, - ]), page_offset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), observer_element: PropTypes.oneOfType([ PropTypes.string, @@ -193,7 +185,6 @@ export const drawerListProviderPropTypes = { export const drawerListProviderDefaultProps = { enable_body_lock: false, - use_drawer_on_mobile: null, page_offset: null, observer_element: null, min_height: 10, // 10rem = 10x16=160, diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListPortal.js b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListPortal.js index 8bb518a271d..7003bd641e4 100644 --- a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListPortal.js +++ b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListPortal.js @@ -26,7 +26,6 @@ class DrawerListPortal extends React.PureComponent { include_owner_width: PropTypes.bool, independent_width: PropTypes.bool, fixed_position: PropTypes.bool, - use_drawer_on_mobile: PropTypes.bool, className: PropTypes.string, } @@ -36,7 +35,6 @@ class DrawerListPortal extends React.PureComponent { include_owner_width: false, independent_width: false, fixed_position: false, - use_drawer_on_mobile: false, className: null, } @@ -245,13 +243,7 @@ class DrawerListPortal extends React.PureComponent { } if (typeof window !== 'undefined' && this.state.isMounted) { - const { - opened, - fixed_position, - use_drawer_on_mobile, - className, - children, - } = this.props + const { opened, fixed_position, className, children } = this.props if (opened) { this.addPositionObserver() @@ -264,8 +256,6 @@ class DrawerListPortal extends React.PureComponent { className={classnames( 'dnb-drawer-list__portal__style', fixed_position && 'dnb-drawer-list__portal__style--fixed', - use_drawer_on_mobile && - 'dnb-drawer-list__portal__style--mobile-view', className )} style={style} diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListProvider.js b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListProvider.js index 1745ce0ffad..9e75c4362bd 100644 --- a/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListProvider.js +++ b/packages/dnb-eufemia/src/fragments/drawer-list/DrawerListProvider.js @@ -141,11 +141,7 @@ export default class DrawerListProvider extends React.PureComponent { } setScrollObserver() { - if ( - !isTrue(this.props.enable_closest_observer) || - typeof window === 'undefined' || - !this._refUl.current - ) { + if (typeof window === 'undefined' || !this._refUl.current) { return } @@ -232,7 +228,6 @@ export default class DrawerListProvider extends React.PureComponent { const { enable_body_lock, - use_drawer_on_mobile, scrollable, min_height, max_height, @@ -243,7 +238,6 @@ export default class DrawerListProvider extends React.PureComponent { // const skipPortal = isTrue(skip_portal) const useBodyLock = isTrue(enable_body_lock) - const useDrawer = isTrue(use_drawer_on_mobile) const isScrollable = isTrue(scrollable) const customMinHeight = parseFloat(min_height) * 16 const customMaxHeight = parseFloat(max_height) || 0 @@ -344,23 +338,9 @@ export default class DrawerListProvider extends React.PureComponent { } // debounce - this.setDirection = (e) => { + this.setDirection = () => { clearTimeout(this._directionTimeout) this._directionTimeout = setTimeout(renderDirection, 50) - - if (e.type === 'resize') { - if (useDrawer) { - if ( - !this._bodyLockIsEnabled && - // Like @media screen and (max-width: 40em) { ... - (window.innerWidth / 16 <= 40 || window.innerHeight / 16 <= 40) - ) { - this.enableBodyLock() - } else if (this._bodyLockIsEnabled && !useBodyLock) { - this.disableBodyLock() - } - } - } } // customElem can be a dnb-scroll-view @@ -375,11 +355,7 @@ export default class DrawerListProvider extends React.PureComponent { window.addEventListener('resize', this.setDirection) } - if ( - useBodyLock || - (useDrawer && // Like @media screen and (max-width: 40em) { ... - (window.innerWidth / 16 <= 40 || window.innerHeight / 16 <= 40)) - ) { + if (useBodyLock) { this.enableBodyLock() } diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/__snapshots__/DrawerList.test.js.snap b/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/__snapshots__/DrawerList.test.js.snap index c6ae386e466..008b7e0d23b 100644 --- a/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/__snapshots__/DrawerList.test.js.snap +++ b/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/__snapshots__/DrawerList.test.js.snap @@ -136,7 +136,6 @@ exports[`DrawerList markup have to match snapshot 1`] = ` skip_keysearch={false} skip_portal={true} triangle_position="left" - use_drawer_on_mobile={false} value={2} wrapper_element={null} > @@ -279,7 +278,6 @@ exports[`DrawerList markup have to match snapshot 1`] = ` skip_keysearch={false} skip_portal={true} triangle_position="left" - use_drawer_on_mobile={false} value={2} wrapper_element={null} > @@ -418,7 +416,6 @@ exports[`DrawerList markup have to match snapshot 1`] = ` skip_keysearch={false} skip_portal={true} triangle_position="left" - use_drawer_on_mobile={false} value={2} wrapper_element={null} > @@ -437,7 +434,7 @@ exports[`DrawerList markup have to match snapshot 1`] = ` aria-activedescendant="option-drawer-list-id-2" aria-expanded={true} aria-labelledby="drawer-list-id-label" - cache_hash="22undefinedundefinedbottom-2" + cache_hash="2266bottom-2" class={null} className={null} id="drawer-list-id-ul" @@ -750,7 +747,7 @@ exports[`DrawerList markup have to match snapshot 1`] = `