lecom-ui 4.5.7 → 4.5.8

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.
@@ -6,13 +6,14 @@ import { NotificationContent } from './NotificationContent.js';
6
6
  import { NotificationIcon } from './NotificationIcon.js';
7
7
 
8
8
  const NotificationCallout = ({ ...props }) => {
9
- const defaultCollapsed = props.isCollapsed ?? false;
9
+ const defaultCollapsed = props.defaultCollapsed ?? false;
10
10
  const [isCollapsed, setIsCollapsed] = React.useState(defaultCollapsed);
11
11
  const [shouldCollapse, setShouldCollapse] = React.useState(false);
12
12
  const [contentHeight, setContentHeight] = React.useState(0);
13
13
  const [lineHeight, setLineHeight] = React.useState(0);
14
14
  const refCollapse = React.useRef(null);
15
15
  const contentRef = React.useRef(null);
16
+ const getIsCollapsed = () => props.isCollapsed !== void 0 ? props.isCollapsed : isCollapsed;
16
17
  React.useEffect(() => {
17
18
  if (contentRef.current) {
18
19
  const computedStyle = window.getComputedStyle(contentRef.current);
@@ -42,16 +43,16 @@ const NotificationCallout = ({ ...props }) => {
42
43
  }
43
44
  };
44
45
  const getCollapseClass = () => {
45
- if (isCollapsed && !props.title)
46
+ if (getIsCollapsed() && !props.title)
46
47
  return "max-h-6 overflow-hidden line-clamp-1";
47
- if (isCollapsed && props.title) return "max-h-0 overflow-hidden";
48
+ if (getIsCollapsed() && props.title) return "max-h-0 overflow-hidden";
48
49
  return "no-collapse";
49
50
  };
50
51
  return /* @__PURE__ */ React.createElement(
51
52
  NotificationBase,
52
53
  {
53
54
  variant: defaultVariant,
54
- className: cn(getGridColumns(), isCollapsed && "place-items-center"),
55
+ className: cn(getGridColumns(), getIsCollapsed() && "place-items-center"),
55
56
  dataTestId: "notification-callout"
56
57
  },
57
58
  /* @__PURE__ */ React.createElement(NotificationIcon, { variant: defaultVariant }),
@@ -63,7 +64,7 @@ const NotificationCallout = ({ ...props }) => {
63
64
  ref: contentRef,
64
65
  className: cn(
65
66
  "transition-all duration-300",
66
- isCollapsed && getCollapseClass()
67
+ getIsCollapsed() && getCollapseClass()
67
68
  )
68
69
  }
69
70
  ), props.action),
@@ -11,7 +11,8 @@ const Upload = ({
11
11
  onFilesSelected,
12
12
  className,
13
13
  accept,
14
- multiple
14
+ multiple,
15
+ id
15
16
  }) => {
16
17
  const [files, setFiles] = React.useState([]);
17
18
  const { t } = useTranslation();
@@ -100,7 +101,7 @@ const Upload = ({
100
101
  {
101
102
  type: "file",
102
103
  hidden: true,
103
- id: "browse",
104
+ id,
104
105
  onChange: handleFileChange,
105
106
  accept: accept || "*",
106
107
  multiple: !!multiple
package/dist/index.d.ts CHANGED
@@ -605,6 +605,7 @@ interface CalloutNotificationProps extends BaseNotificationProps {
605
605
  fullWidth?: boolean;
606
606
  isCollapsed?: boolean;
607
607
  action?: React$1.ReactNode;
608
+ defaultCollapsed?: boolean;
608
609
  }
609
610
  interface InlineNotificationProps extends BaseNotificationProps {
610
611
  type: 'inline';
@@ -701,7 +702,7 @@ declare const TooltipTrigger: React$1.ForwardRefExoticComponent<TooltipPrimitive
701
702
  declare const TooltipArrow: React$1.ForwardRefExoticComponent<TooltipPrimitive.TooltipArrowProps & React$1.RefAttributes<SVGSVGElement>>;
702
703
  declare const TooltipPortal: React$1.FC<TooltipPrimitive.TooltipPortalProps>;
703
704
  declare const tooltipContentVariants: (props?: ({
704
- color?: "white" | "black" | null | undefined;
705
+ color?: "black" | "white" | null | undefined;
705
706
  arrow?: boolean | null | undefined;
706
707
  } & class_variance_authority_types.ClassProp) | undefined) => string;
707
708
  interface TooltipContentProps extends React$1.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>, VariantProps<typeof tooltipContentVariants> {
@@ -756,9 +757,10 @@ interface UploadProps {
756
757
  className?: string;
757
758
  accept?: string;
758
759
  multiple?: boolean;
760
+ id?: string;
759
761
  }
760
762
  declare const Upload: {
761
- ({ onFilesSelected, className, accept, multiple, }: UploadProps): React$1.JSX.Element;
763
+ ({ onFilesSelected, className, accept, multiple, id, }: UploadProps): React$1.JSX.Element;
762
764
  displayName: string;
763
765
  };
764
766
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "4.5.7",
3
+ "version": "4.5.8",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",