@pushwoosh/dumb-components 1.1.71 → 1.1.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DropdownMenu/components/DropdownMenu/DropdownMenu.js +3 -1
- package/DropdownMenu/components/DropdownMenu/styles.d.ts +1 -0
- package/DropdownMenu/components/DropdownMenu/styles.js +8 -2
- package/DropdownMenu/components/DropdownMenu/types.d.ts +1 -0
- package/StatisticCard/StatisticCard.js +3 -1
- package/package.json +1 -1
|
@@ -10,13 +10,14 @@ export const DropdownMenu = ({
|
|
|
10
10
|
isScrollable,
|
|
11
11
|
menuZIndex,
|
|
12
12
|
menuPlacement,
|
|
13
|
+
windowWidth = null,
|
|
13
14
|
openOnMount = false,
|
|
14
15
|
fullWidth,
|
|
15
16
|
onClose,
|
|
16
17
|
children
|
|
17
18
|
}) => {
|
|
18
19
|
const [isOpen, setIsOpen] = useState(openOnMount);
|
|
19
|
-
const [width, setWidth] = useState(
|
|
20
|
+
const [width, setWidth] = useState(windowWidth);
|
|
20
21
|
const {
|
|
21
22
|
refs,
|
|
22
23
|
floatingStyles
|
|
@@ -77,6 +78,7 @@ export const DropdownMenu = ({
|
|
|
77
78
|
style: floatingStyles,
|
|
78
79
|
"$color": color,
|
|
79
80
|
"$width": width,
|
|
81
|
+
"$fitContent": windowWidth === null && !fullWidth,
|
|
80
82
|
"$scrollable": isScrollable,
|
|
81
83
|
"$zIndex": menuZIndex
|
|
82
84
|
}, typeof children === 'function' ? children() : children));
|
|
@@ -2,14 +2,20 @@ import styled, { css } from 'styled-components';
|
|
|
2
2
|
import { Color, Shadow, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
4
4
|
const scrollableCss = css(["max-height:248px;overflow-y:auto;"]);
|
|
5
|
+
const getWidth = ($width, $fitContent) => {
|
|
6
|
+
if ($fitContent) return 'max-content';
|
|
7
|
+
if ($width) return `${$width}px`;
|
|
8
|
+
return 'auto';
|
|
9
|
+
};
|
|
5
10
|
export const Place = styled(Vertical).withConfig({
|
|
6
11
|
displayName: "Place",
|
|
7
12
|
componentId: "sc-ij8wqc-0"
|
|
8
13
|
})(["border:1px solid ", ";background:", ";width:", ";min-width:140px;max-width:480px;", " border-radius:", ";box-shadow:", ";z-index:", ";"], Color.FORM, ({
|
|
9
14
|
$color
|
|
10
15
|
}) => $color || Color.FROZEN, ({
|
|
11
|
-
$width
|
|
12
|
-
|
|
16
|
+
$width,
|
|
17
|
+
$fitContent
|
|
18
|
+
}) => getWidth($width, $fitContent), ({
|
|
13
19
|
$scrollable
|
|
14
20
|
}) => $scrollable && scrollableCss, ShapeRadius.CONTROL, Shadow.REGULAR, ({
|
|
15
21
|
$zIndex
|
|
@@ -62,7 +62,9 @@ export function StatisticCard(props) {
|
|
|
62
62
|
key: a.id,
|
|
63
63
|
onClick: a.onClick,
|
|
64
64
|
disabled: a.disabled
|
|
65
|
-
},
|
|
65
|
+
}, React.createElement(Text, {
|
|
66
|
+
"$ellipsis": true
|
|
67
|
+
}, a.label))))) : null);
|
|
66
68
|
return React.createElement(Container, {
|
|
67
69
|
"$active": active,
|
|
68
70
|
"$selectable": selectable,
|