@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.
@@ -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(null);
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));
@@ -56,6 +56,7 @@ export declare const Place: import("styled-components").StyledComponent<"div", a
56
56
  } & {
57
57
  $color?: string;
58
58
  $width: number | null;
59
+ $fitContent?: boolean;
59
60
  $zIndex?: number;
60
61
  $scrollable?: boolean;
61
62
  }, "$gridAutoFlow">;
@@ -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
- }) => $width ? `${$width}px` : 'auto', ({
16
+ $width,
17
+ $fitContent
18
+ }) => getWidth($width, $fitContent), ({
13
19
  $scrollable
14
20
  }) => $scrollable && scrollableCss, ShapeRadius.CONTROL, Shadow.REGULAR, ({
15
21
  $zIndex
@@ -13,6 +13,7 @@ export type DropdownMenuProps = {
13
13
  menuZIndex?: number;
14
14
  menuPlacement?: Placement;
15
15
  fullWidth?: boolean;
16
+ windowWidth?: number;
16
17
  onClose?: () => void;
17
18
  renderHandler: (args: HandlerProps) => ReactNode;
18
19
  children: (() => ReactNode) | ReactNode;
@@ -62,7 +62,9 @@ export function StatisticCard(props) {
62
62
  key: a.id,
63
63
  onClick: a.onClick,
64
64
  disabled: a.disabled
65
- }, a.label)))) : null);
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.1.71",
3
+ "version": "1.1.73",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",