lecom-ui 2.5.2 → 2.5.5

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.
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import { cn } from '../../lib/utils.js';
2
3
  import { notificationVariants } from './Notification.js';
3
4
 
@@ -1,4 +1,4 @@
1
- import { useState, useRef, useEffect } from 'react';
1
+ import * as React from 'react';
2
2
  import { cn } from '../../lib/utils.js';
3
3
  import { ChevronUpIcon } from 'lucide-react';
4
4
  import { NotificationBase } from './NotificationBase.js';
@@ -6,13 +6,13 @@ import { NotificationContent } from './NotificationContent.js';
6
6
  import { NotificationIcon } from './NotificationIcon.js';
7
7
 
8
8
  const NotificationCallout = ({ ...props }) => {
9
- const [isCollapsed, setIsCollapsed] = useState(false);
10
- const [shouldCollapse, setShouldCollapse] = useState(false);
11
- const [contentHeight, setContentHeight] = useState(0);
12
- const [lineHeight, setLineHeight] = useState(0);
13
- const refCollapse = useRef(null);
14
- const contentRef = useRef(null);
15
- useEffect(() => {
9
+ const [isCollapsed, setIsCollapsed] = React.useState(false);
10
+ const [shouldCollapse, setShouldCollapse] = React.useState(false);
11
+ const [contentHeight, setContentHeight] = React.useState(0);
12
+ const [lineHeight, setLineHeight] = React.useState(0);
13
+ const refCollapse = React.useRef(null);
14
+ const contentRef = React.useRef(null);
15
+ React.useEffect(() => {
16
16
  if (contentRef.current) {
17
17
  const computedStyle = window.getComputedStyle(contentRef.current);
18
18
  const lineHeight2 = parseFloat(computedStyle.lineHeight);
@@ -20,11 +20,11 @@ const NotificationCallout = ({ ...props }) => {
20
20
  setContentHeight(contentRef.current.scrollHeight);
21
21
  }
22
22
  }, [props.content]);
23
- useEffect(() => {
23
+ React.useEffect(() => {
24
24
  const shouldCollapse2 = contentHeight > lineHeight * (props.action ? 3 : 2);
25
25
  setShouldCollapse(shouldCollapse2);
26
26
  }, [contentHeight, lineHeight]);
27
- useEffect(() => {
27
+ React.useEffect(() => {
28
28
  if (isCollapsed) {
29
29
  refCollapse.current?.style.setProperty("transform", "rotate(180deg)");
30
30
  } else {
@@ -1,7 +1,7 @@
1
- import { forwardRef } from 'react';
1
+ import * as React from 'react';
2
2
  import { Typography } from '../Typography/Typography.js';
3
3
 
4
- const NotificationContent = forwardRef(({ title, content, className, children }, ref) => /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-0.5 flex-1" }, title && /* @__PURE__ */ React.createElement(
4
+ const NotificationContent = React.forwardRef(({ title, content, className, children }, ref) => /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-0.5 flex-1" }, title && /* @__PURE__ */ React.createElement(
5
5
  Typography,
6
6
  {
7
7
  variant: "body-medium-500",
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import { CircleCheckIcon, CircleAlertIcon, InfoIcon, TriangleAlertIcon } from 'lucide-react';
2
3
 
3
4
  const iconMap = {
@@ -1,4 +1,4 @@
1
- import { useState } from 'react';
1
+ import * as React from 'react';
2
2
  import { cn } from '../../lib/utils.js';
3
3
  import { NotificationBase } from './NotificationBase.js';
4
4
  import { NotificationCloseButton } from './NotificationCloseButton.js';
@@ -13,7 +13,7 @@ const NotificationInline = ({
13
13
  action,
14
14
  shouldExpand
15
15
  }) => {
16
- const [isVisible, setIsVisible] = useState(true);
16
+ const [isVisible, setIsVisible] = React.useState(true);
17
17
  if (!isVisible) return null;
18
18
  const defaultVariant = variant ?? "information";
19
19
  const getFullWidthColumns = () => {
@@ -1,4 +1,4 @@
1
- import { memo, useState, useRef, useEffect, useMemo } from 'react';
1
+ import * as React from 'react';
2
2
  import { cn } from '../../lib/utils.js';
3
3
  import { NotificationBase } from './NotificationBase.js';
4
4
  import { NotificationCloseButton } from './NotificationCloseButton.js';
@@ -8,12 +8,12 @@ import { useNotificationToast, TOAST_REMOVE_DELAY } from './useNotificationToast
8
8
 
9
9
  const NotificationToast = (props) => {
10
10
  const { toasts, closeNotification, pauseNotification, resumeNotification } = useNotificationToast();
11
- const [progressMap, setProgressMap] = useState({});
12
- const progressMapRef = useRef({});
13
- const isPausedMapRef = useRef({});
14
- const remainingTimeMapRef = useRef({});
15
- const lastUpdateMapRef = useRef({});
16
- useEffect(() => {
11
+ const [progressMap, setProgressMap] = React.useState({});
12
+ const progressMapRef = React.useRef({});
13
+ const isPausedMapRef = React.useRef({});
14
+ const remainingTimeMapRef = React.useRef({});
15
+ const lastUpdateMapRef = React.useRef({});
16
+ React.useEffect(() => {
17
17
  const now = Date.now();
18
18
  const newProgress = { ...progressMapRef.current };
19
19
  const newRemainingTime = { ...remainingTimeMapRef.current };
@@ -30,7 +30,7 @@ const NotificationToast = (props) => {
30
30
  lastUpdateMapRef.current = newLastUpdate;
31
31
  setProgressMap(newProgress);
32
32
  }, [toasts]);
33
- useEffect(() => {
33
+ React.useEffect(() => {
34
34
  if (toasts.length === 0) return;
35
35
  const interval = setInterval(() => {
36
36
  const now = Date.now();
@@ -72,7 +72,7 @@ const NotificationToast = (props) => {
72
72
  return "grid-cols-[1.25rem_minmax(_auto,13.25rem)]";
73
73
  }
74
74
  };
75
- const colorMap = useMemo(
75
+ const colorMap = React.useMemo(
76
76
  () => ({
77
77
  information: "bg-blue-600",
78
78
  success: "bg-green-600",
@@ -123,6 +123,6 @@ const NotificationToast = (props) => {
123
123
  )));
124
124
  };
125
125
  NotificationToast.displayName = "NotificationToast";
126
- const MemoizedNotificationToast = memo(NotificationToast);
126
+ const MemoizedNotificationToast = React.memo(NotificationToast);
127
127
 
128
128
  export { MemoizedNotificationToast };
@@ -1,4 +1,4 @@
1
- import React__default from 'react';
1
+ import * as React from 'react';
2
2
 
3
3
  const TOAST_LIMIT = Infinity;
4
4
  const TOAST_REMOVE_DELAY = 5e3;
@@ -150,8 +150,8 @@ function toast({ ...props }) {
150
150
  dispatch({ type: actionTypes.ADD_TOAST, toast: newToast });
151
151
  }
152
152
  function useNotificationToast() {
153
- const [state, setState] = React__default.useState(memoryState);
154
- React__default.useEffect(() => {
153
+ const [state, setState] = React.useState(memoryState);
154
+ React.useEffect(() => {
155
155
  const id = genId();
156
156
  listeners[id] = setState;
157
157
  return () => {
@@ -0,0 +1,43 @@
1
+ import * as React from 'react';
2
+ import { cn } from '../../lib/utils.js';
3
+ import { cva } from 'class-variance-authority';
4
+
5
+ const tagVariants = cva(
6
+ "h-6 gap-1 py-1 px-2 body-small-400 inline-flex items-center rounded-full transition-colors focus:outline-none focus:ring-4",
7
+ {
8
+ variants: {
9
+ color: {
10
+ grey: "bg-grey-200 text-grey-700 hover:bg-grey-300 active:bg-grey-400 focus:bg-grey-200 focus:ring-grey-50",
11
+ purple: "bg-purple-100 text-purple-600 hover:bg-purple-200 active:bg-purple-300 focus:bg-purple-100 focus:ring-purple-50",
12
+ yellow: "bg-yellow-100 text-yellow-600 hover:bg-yellow-200 active:bg-yellow-300 focus:bg-yellow-100 focus:ring-yellow-50",
13
+ red: "bg-red-100 text-red-600 hover:bg-red-200 active:bg-red-300 focus:bg-red-100 focus:ring-red-50",
14
+ orange: "bg-orange-100 text-orange-600 hover:bg-orange-200 active:bg-orange-300 focus:bg-orange-100 focus:ring-orange-50",
15
+ green: "bg-green-100 text-green-600 hover:bg-green-200 active:bg-green-300 focus:bg-green-100 focus:ring-green-50",
16
+ pink: "bg-pink-100 text-pink-600 hover:bg-pink-200 active:bg-pink-300 focus:bg-pink-100 focus:ring-pink-50",
17
+ turquoise: "bg-turquoise-100 text-turquoise-600 hover:bg-turquoise-200 active:bg-turquoise-300 focus:bg-turquoise-100 focus:ring-turquoise-50",
18
+ blue: "bg-blue-100 text-blue-600 hover:bg-blue-200 active:bg-blue-300 focus:bg-blue-100 focus:ring-blue-50"
19
+ }
20
+ },
21
+ defaultVariants: {
22
+ color: "grey"
23
+ }
24
+ }
25
+ );
26
+ const Tag = React.forwardRef(
27
+ ({ className, color, children, ...props }, ref) => {
28
+ const Comp = "div";
29
+ return /* @__PURE__ */ React.createElement(
30
+ Comp,
31
+ {
32
+ tabIndex: 0,
33
+ className: cn(tagVariants({ color }), className),
34
+ ref,
35
+ ...props
36
+ },
37
+ children
38
+ );
39
+ }
40
+ );
41
+ Tag.displayName = "Tag";
42
+
43
+ export { Tag, tagVariants };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as class_variance_authority_types from 'class-variance-authority/types';
2
2
  import * as React from 'react';
3
- import React__default from 'react';
4
3
  import { VariantProps } from 'class-variance-authority';
5
4
  import { ColumnDef } from '@tanstack/react-table';
6
5
  import * as DialogPrimitive from '@radix-ui/react-dialog';
@@ -392,8 +391,8 @@ declare const Notification: React.ForwardRefExoticComponent<NotificationProps &
392
391
  declare const TOAST_REMOVE_DELAY = 5000;
393
392
  type ToasterToast = {
394
393
  id: string;
395
- title?: React__default.ReactNode;
396
- content: React__default.ReactNode;
394
+ title?: React.ReactNode;
395
+ content: React.ReactNode;
397
396
  variant: 'success' | 'error' | 'warning' | 'information';
398
397
  toastLimit?: number;
399
398
  open: boolean;
@@ -448,6 +447,14 @@ declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimit
448
447
 
449
448
  declare const Skeleton: ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
450
449
 
450
+ declare const tagVariants: (props?: ({
451
+ color?: "blue" | "grey" | "green" | "orange" | "pink" | "purple" | "red" | "turquoise" | "yellow" | null | undefined;
452
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
453
+ interface TagProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, VariantProps<typeof tagVariants> {
454
+ children: React.ReactNode;
455
+ }
456
+ declare const Tag: React.ForwardRefExoticComponent<TagProps & React.RefAttributes<HTMLDivElement>>;
457
+
451
458
  declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
452
459
  declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
453
460
  declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
@@ -481,4 +488,4 @@ declare const fonts: {
481
488
  ibm: string[];
482
489
  };
483
490
 
484
- export { type BgColor, Button, type ButtonProps, CadastroFacil, type CadastroFacilProps, type CalloutNotificationProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type Color, type ColorToken, type CustomStyles$1 as CustomStyles, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type FillColor, type Fonts, type HeaderProps, type InlineNotificationProps, Layout, type LayoutProps, LogoLecom, LogoLecomBrand, type LogoLecomBrandProps, type LogoLecomProps, ModoTeste, type ModoTesteProps, Notification, type NotificationProps, Popover, PopoverContent, PopoverTrigger, Rpa, type RpaProps, type SideBarProps, Skeleton, TOAST_REMOVE_DELAY, type TextColor, type ToastNotificationProps, type ToasterToast, Tooltip, TooltipArrow, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, TypeMessageNotification, Typography, type TypographyProps, buttonVariants, colors, fonts, getPositionClass, notificationVariants, reducer, toast, typographyVariants, useNotificationToast };
491
+ export { type BgColor, Button, type ButtonProps, CadastroFacil, type CadastroFacilProps, type CalloutNotificationProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type Color, type ColorToken, type CustomStyles$1 as CustomStyles, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type FillColor, type Fonts, type HeaderProps, type InlineNotificationProps, Layout, type LayoutProps, LogoLecom, LogoLecomBrand, type LogoLecomBrandProps, type LogoLecomProps, ModoTeste, type ModoTesteProps, Notification, type NotificationProps, Popover, PopoverContent, PopoverTrigger, Rpa, type RpaProps, type SideBarProps, Skeleton, TOAST_REMOVE_DELAY, Tag, type TagProps, type TextColor, type ToastNotificationProps, type ToasterToast, Tooltip, TooltipArrow, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, TypeMessageNotification, Typography, type TypographyProps, buttonVariants, colors, fonts, getPositionClass, notificationVariants, reducer, tagVariants, toast, typographyVariants, useNotificationToast };
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ export { Notification, TypeMessageNotification, getPositionClass, notificationVa
12
12
  export { TOAST_REMOVE_DELAY, reducer, toast, useNotificationToast } from './components/Notification/useNotificationToast.js';
13
13
  export { Popover, PopoverContent, PopoverTrigger } from './components/Popover/Popover.js';
14
14
  export { Skeleton } from './components/Skeleton/Skeleton.js';
15
+ export { Tag, tagVariants } from './components/Tag/Tag.js';
15
16
  export { Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger } from './components/Tooltip/Tooltip.js';
16
17
  export { Typography, typographyVariants } from './components/Typography/Typography.js';
17
18
  export { colors } from './tokens/colors.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "2.5.2",
3
+ "version": "2.5.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",