Socket
Socket
Sign inDemoInstall

@rescui/dropdown-menu

Package Overview
Dependencies
34
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.0 to 0.8.0

lib/height-observer.d.ts

23

lib/dropdown-menu.js

@@ -9,2 +9,3 @@ import "core-js/modules/es.object.to-string.js";

import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";

@@ -18,6 +19,7 @@ var _excluded = ["maxVisibleItems", "size", "children", "iconPlacement", "itemTag", "tag", "theme", "mode", "activateFirstItemOnOpen", "wrapItemsWithLi"],

import React from 'react';
import React, { useState } from 'react';
import { useTheme, getInverseTheme } from '@rescui/ui-contexts';
import { Dropdown } from '@rescui/dropdown';
import { Menu } from '@rescui/menu';
import { HeightObserver } from './height-observer.js';
import styles from './index.p.module.css.js';

@@ -52,6 +54,15 @@ var ITEM_HEIGHT_BY_SIZE = {

var itemHeight = ITEM_HEIGHT_BY_SIZE[size]; // half of item added to show that there is more items even if scroll bar hidden
var itemHeight = ITEM_HEIGHT_BY_SIZE[size];
var maxHeight = (Math.ceil(maxVisibleItems) + 0.5) * itemHeight;
var _useState = useState(0),
_useState2 = _slicedToArray(_useState, 2),
height = _useState2[0],
setHeight = _useState2[1]; // a little buffer of 10% here
var isMoreThanPlusOne = height > (Math.ceil(maxVisibleItems) + 1.1) * itemHeight; // half of item added to show that there is more items even if scroll bar hidden
// in case there are only 1 more item than maxVisibleItems, show it without truncating
var maxHeight = (Math.ceil(maxVisibleItems) + (isMoreThanPlusOne ? 0.5 : 1.5)) * itemHeight;
var cleanMaxHeight = restProps.maxHeight,

@@ -70,3 +81,5 @@ leastMaxHeight = restProps.leastMaxHeight,

className: SIZE_TO_CLASS[size]
}), /*#__PURE__*/React.createElement(Menu, {
}), /*#__PURE__*/React.createElement(HeightObserver, {
onHeightUpdate: setHeight
}, /*#__PURE__*/React.createElement(Menu, {
size: size,

@@ -84,5 +97,5 @@ iconPlacement: iconPlacement,

wrapItemsWithLi: wrapItemsWithLi
}, children));
}, children)));
};
export { DropdownMenu, DropdownMenu as default };
var styles = {
"sizeS": "_sizeS_1b6ux3g_8",
"sizeL": "_sizeL_1b6ux3g_13",
"sizeM": "_sizeM_1b6ux3g_14",
"menu": "_menu_1b6ux3g_19"
"sizeS": "_sizeS_4v1u8o_8",
"sizeL": "_sizeL_4v1u8o_13",
"sizeM": "_sizeM_4v1u8o_14",
"menu": "_menu_4v1u8o_19"
};
export { styles as default };
{
"name": "@rescui/dropdown-menu",
"version": "0.7.0",
"version": "0.8.0",
"description": "",

@@ -20,2 +20,3 @@ "license": "Apache-2.0",

"@rescui/menu": "^0.9.4",
"@rescui/use-resize-observer": "^0.1.6",
"classnames": "^2.2.6",

@@ -38,3 +39,3 @@ "core-js": "^3.9.1"

},
"gitHead": "2a57f292fde136628c5ed31a9da9149fd41d404f"
"gitHead": "93f675b336b9570682c0e2cb0eee0bf661ec99be"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc