@pushwoosh/dumb-components 1.1.116 → 1.1.118

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/Chip/Chip.d.ts CHANGED
@@ -4,6 +4,7 @@ export declare const Chip: React.ForwardRefExoticComponent<{
4
4
  $selected?: boolean;
5
5
  $onClose?: React.HTMLAttributes<HTMLDivElement>["onClick"];
6
6
  $readOnly?: boolean;
7
+ $maxWidth?: string;
7
8
  as?: string;
8
9
  } & {
9
10
  children?: React.ReactNode | undefined;
package/Chip/Chip.js CHANGED
@@ -6,6 +6,7 @@ export const Chip = forwardRef(({
6
6
  $selected,
7
7
  $readOnly,
8
8
  $onClose,
9
+ $maxWidth,
9
10
  children,
10
11
  as,
11
12
  ...rest
@@ -16,9 +17,12 @@ export const Chip = forwardRef(({
16
17
  "$selected": $selected,
17
18
  "$closeable": !!$onClose,
18
19
  "$readOnly": $readOnly,
20
+ "$maxWidth": $maxWidth,
19
21
  as: as,
20
22
  ...rest
21
- }, children, $onClose && React.createElement(CloseIcon, {
23
+ }, React.createElement("span", {
24
+ className: "chipLabel"
25
+ }, children), $onClose && React.createElement(CloseIcon, {
22
26
  size: "small",
23
27
  onClick: $onClose,
24
28
  as: "span",
@@ -5,5 +5,7 @@ export type ChipProps = PropsWithChildren<{
5
5
  $selected?: boolean;
6
6
  $onClose?: HTMLAttributes<HTMLDivElement>['onClick'];
7
7
  $readOnly?: boolean;
8
+ /** CSS max-width value, e.g. "120px", "50%", "10rem". Enables label truncation with ellipsis. */
9
+ $maxWidth?: string;
8
10
  as?: string;
9
11
  }> & HTMLAttributes<HTMLDivElement>;
package/Chip/styles.d.ts CHANGED
@@ -4,4 +4,5 @@ export declare const ChipStyled: import("styled-components").StyledComponent<"di
4
4
  $selected?: boolean;
5
5
  $closeable?: boolean;
6
6
  $readOnly?: boolean;
7
+ $maxWidth?: string;
7
8
  }, never>;
package/Chip/styles.js CHANGED
@@ -4,7 +4,9 @@ import { variants } from './Chip.constants';
4
4
  export const ChipStyled = styled.div.withConfig({
5
5
  displayName: "ChipStyled",
6
6
  componentId: "sc-e2g39l-0"
7
- })(["display:inline-flex;min-height:24px;padding:0 ", " 0 8px;align-items:center;gap:4px;cursor:", ";border-radius:4px;color:", ";background:", ";font-weight:400;line-height:140%;& > .closeIcon{transition:transform 0.2s;&:hover{transform:scale(1.3);}}"], ({
7
+ })(["display:inline-flex;min-height:24px;", " padding:0 ", " 0 8px;align-items:center;gap:4px;cursor:", ";border-radius:4px;color:", ";background:", ";font-weight:400;line-height:140%;& > .chipLabel{", "}& > .closeIcon{transition:transform 0.2s;&:hover{transform:scale(1.3);}}"], ({
8
+ $maxWidth
9
+ }) => $maxWidth !== undefined && `max-width: ${$maxWidth};`, ({
8
10
  $closeable
9
11
  }) => $closeable ? '4px' : '8px', ({
10
12
  $readOnly
@@ -26,4 +28,12 @@ export const ChipStyled = styled.div.withConfig({
26
28
  return Color.SOFT_LIGHT;
27
29
  }
28
30
  return $selected ? Color.MAIN : variants[$variant].background;
29
- });
31
+ }, ({
32
+ $maxWidth
33
+ }) => $maxWidth !== undefined && `
34
+ flex: 1 1 0;
35
+ min-width: 0;
36
+ overflow: hidden;
37
+ text-overflow: ellipsis;
38
+ white-space: nowrap;
39
+ `);
@@ -2,7 +2,7 @@ import { type Placement } from '@floating-ui/react-dom';
2
2
  import { type ReactNode } from 'react';
3
3
  import { type RequiredButtonProps } from '../../../Button';
4
4
  export type DropdownMenuButtonProps = {
5
- label: ReactNode;
5
+ label?: ReactNode;
6
6
  isScrollable?: boolean;
7
7
  isDisabled?: boolean;
8
8
  isLoading?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.1.116",
3
+ "version": "1.1.118",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",