lecom-ui 5.4.55 → 5.4.56

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/README.md CHANGED
@@ -1 +1 @@
1
- lecom-ui
1
+ lecom-ui
@@ -0,0 +1,94 @@
1
+ import * as React from 'react';
2
+ import { cn } from '../../lib/utils.js';
3
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
4
+ import { cva } from 'class-variance-authority';
5
+ import { ChevronRight } from 'lucide-react';
6
+
7
+ const collapseTriggerVariants = cva(
8
+ "flex items-center justify-between w-full transition-all text-left outline-none data-[state=open]:font-semibold",
9
+ {
10
+ variants: {
11
+ size: {
12
+ small: "text-sm py-1.5 px-4 min-h-8",
13
+ medium: "text-base py-2.5 px-4 min-h-10",
14
+ large: "text-lg py-3 px-4 min-h-12"
15
+ },
16
+ ghost: {
17
+ true: "bg-transparent border-none",
18
+ false: "border-t-none border-grey-400"
19
+ }
20
+ },
21
+ defaultVariants: {
22
+ size: "large",
23
+ ghost: false
24
+ }
25
+ }
26
+ );
27
+ const CollapseRoot = AccordionPrimitive.Root;
28
+ const CollapseItem = AccordionPrimitive.Item;
29
+ const CollapsePanel = React.forwardRef(
30
+ ({
31
+ header,
32
+ children,
33
+ extra,
34
+ expandIconPosition = "start",
35
+ size = "large",
36
+ ghost = false,
37
+ disabled = false,
38
+ className,
39
+ ...props
40
+ }, ref) => /* @__PURE__ */ React.createElement(
41
+ CollapseItem,
42
+ {
43
+ ref,
44
+ ...props,
45
+ className: cn(
46
+ "group w-full",
47
+ disabled && "pointer-events-none opacity-50",
48
+ className
49
+ )
50
+ },
51
+ /* @__PURE__ */ React.createElement(AccordionPrimitive.Header, { asChild: true }, /* @__PURE__ */ React.createElement(
52
+ AccordionPrimitive.Trigger,
53
+ {
54
+ disabled,
55
+ className: cn(
56
+ collapseTriggerVariants({ size, ghost }),
57
+ "flex gap-2 items-center text-left font-normal"
58
+ )
59
+ },
60
+ /* @__PURE__ */ React.createElement(
61
+ "div",
62
+ {
63
+ className: cn(
64
+ "flex flex-1 items-center justify-between gap-4 w-full",
65
+ expandIconPosition === "end" ? "flex-row-reverse" : ""
66
+ )
67
+ },
68
+ /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 truncate" }, /* @__PURE__ */ React.createElement(
69
+ "span",
70
+ {
71
+ className: "flex items-center justify-center flex-shrink-0 min-w-4 min-h-4 transition-transform duration-300 group-data-[state=open]:rotate-90 text-grey-700 text-lg select-none font-normal"
72
+ },
73
+ /* @__PURE__ */ React.createElement(ChevronRight, { className: "size-4" })
74
+ ), /* @__PURE__ */ React.createElement("span", { className: "font-normal" }, header)),
75
+ extra && /* @__PURE__ */ React.createElement("div", { className: "text-sm text-grey-500" }, extra)
76
+ )
77
+ )),
78
+ /* @__PURE__ */ React.createElement(
79
+ AccordionPrimitive.Content,
80
+ {
81
+ className: cn(
82
+ "overflow-hidden data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up"
83
+ )
84
+ },
85
+ /* @__PURE__ */ React.createElement("div", { className: "text-sm text-grey-800 pt-2 pb-4 px-4" }, children)
86
+ )
87
+ )
88
+ );
89
+ CollapsePanel.displayName = "CollapsePanel";
90
+ const Collapse = Object.assign(CollapseRoot, {
91
+ Panel: CollapsePanel
92
+ });
93
+
94
+ export { Collapse, collapseTriggerVariants };
@@ -0,0 +1,99 @@
1
+ import * as React from 'react';
2
+ import { ReactSVG } from 'react-svg';
3
+ import { cn } from '../../lib/utils.js';
4
+
5
+ const isUrl = (str) => {
6
+ try {
7
+ new URL(str);
8
+ return true;
9
+ } catch {
10
+ return false;
11
+ }
12
+ };
13
+ const isImage = (str) => {
14
+ return /\.(svg|png|jpg|jpeg|gif|webp)$/i.test(str);
15
+ };
16
+ const IconHandler = React.forwardRef(
17
+ ({
18
+ icon,
19
+ colorType = "color",
20
+ variantsColors,
21
+ className,
22
+ setAttribute,
23
+ style = {},
24
+ ...props
25
+ }, ref) => {
26
+ if (typeof icon === "string") {
27
+ if (isUrl(icon)) {
28
+ return /* @__PURE__ */ React.createElement(
29
+ "img",
30
+ {
31
+ src: icon,
32
+ alt: "\xCDcone",
33
+ className: cn("w-[24px] h-[24px]", className),
34
+ style: {
35
+ ...style,
36
+ ...variantsColors && {
37
+ color: variantsColors
38
+ }
39
+ }
40
+ }
41
+ );
42
+ } else if (isImage(icon)) {
43
+ return /* @__PURE__ */ React.createElement(
44
+ ReactSVG,
45
+ {
46
+ src: icon,
47
+ className: cn("w-[24px] h-[24px]", className),
48
+ beforeInjection: (svg) => {
49
+ if (variantsColors && setAttribute) {
50
+ svg.setAttribute(
51
+ "style",
52
+ `fill: ${variantsColors}${setAttribute ? `; ${setAttribute}` : ""}`
53
+ );
54
+ } else if (setAttribute) {
55
+ svg.setAttribute("style", `${setAttribute}`);
56
+ } else if (variantsColors) {
57
+ svg.setAttribute("style", `fill: ${variantsColors}`);
58
+ }
59
+ },
60
+ style
61
+ }
62
+ );
63
+ } else {
64
+ return /* @__PURE__ */ React.createElement(
65
+ "span",
66
+ {
67
+ className: cn("flex items-center w-auto h-[24px]", className),
68
+ style: {
69
+ ...style,
70
+ ...variantsColors && {
71
+ color: variantsColors
72
+ }
73
+ }
74
+ },
75
+ icon
76
+ );
77
+ }
78
+ } else {
79
+ const IconComponent = icon;
80
+ const setColor = colorType === "color" ? { color: variantsColors } : {};
81
+ return /* @__PURE__ */ React.createElement(
82
+ IconComponent,
83
+ {
84
+ ref,
85
+ fill: colorType === "fill" ? variantsColors : "none",
86
+ className: cn("hover:bg-transparent", className),
87
+ style: {
88
+ ...style,
89
+ ...variantsColors && setColor
90
+ },
91
+ ...props
92
+ }
93
+ );
94
+ }
95
+ }
96
+ );
97
+ IconHandler.displayName = "IconHandler";
98
+
99
+ export { IconHandler };
@@ -10,7 +10,8 @@ const usePagination = ({
10
10
  hidePrevButton = false,
11
11
  showFirstButton = true,
12
12
  showLastButton = true,
13
- onChange
13
+ onChange,
14
+ compact = false
14
15
  } = {}) => {
15
16
  const [page, setPage] = useState(defaultPage);
16
17
  const handleClick = (value) => {
@@ -36,6 +37,12 @@ const usePagination = ({
36
37
  count - boundaryCount - 1
37
38
  );
38
39
  const startEllipsis = () => {
40
+ if (compact && count > 7) {
41
+ if (siblingsStart > boundaryCount + 1) {
42
+ return ["start-ellipsis"];
43
+ }
44
+ return [];
45
+ }
39
46
  if (siblingsStart > boundaryCount + 2) {
40
47
  return ["start-ellipsis"];
41
48
  }
@@ -45,6 +52,12 @@ const usePagination = ({
45
52
  return [];
46
53
  };
47
54
  const endEllipsis = () => {
55
+ if (compact && count > 7) {
56
+ if (siblingsEnd < count - boundaryCount) {
57
+ return ["end-ellipsis"];
58
+ }
59
+ return [];
60
+ }
48
61
  if (siblingsEnd < count - boundaryCount - 1) {
49
62
  return ["end-ellipsis"];
50
63
  }
@@ -26,7 +26,7 @@ const language = {
26
26
  multiSelect: {
27
27
  search: "Escriba para buscar",
28
28
  empty: "No se han encontrado resultados",
29
- selectAll: "Seleccionar todo",
29
+ selectAll: "Seleccionar todas",
30
30
  placeholder: "Seleccionar",
31
31
  create: "Crear"
32
32
  },
package/dist/index.d.ts CHANGED
@@ -270,6 +270,7 @@ type UsePaginationProps = {
270
270
  showFirstButton?: boolean;
271
271
  showLastButton?: boolean;
272
272
  onChange?: (value: number) => void;
273
+ compact?: boolean;
273
274
  };
274
275
  type UsePaginationItem = {
275
276
  id: string;
@@ -280,7 +281,7 @@ type UsePaginationItem = {
280
281
  disabled: boolean;
281
282
  'aria-current'?: 'page';
282
283
  };
283
- declare const usePagination: ({ count, defaultPage, boundaryCount, siblingCount, disabled, hideNextButton, hidePrevButton, showFirstButton, showLastButton, onChange, }?: UsePaginationProps) => {
284
+ declare const usePagination: ({ count, defaultPage, boundaryCount, siblingCount, disabled, hideNextButton, hidePrevButton, showFirstButton, showLastButton, onChange, compact, }?: UsePaginationProps) => {
284
285
  page: number;
285
286
  setPage: React$1.Dispatch<React$1.SetStateAction<number>>;
286
287
  items: UsePaginationItem[];
@@ -792,8 +793,8 @@ interface HeaderProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<
792
793
 
793
794
  declare const inputVariants: (props?: ({
794
795
  variant?: "default" | "filled" | "borderless" | null | undefined;
795
- size?: "small" | "default" | "large" | null | undefined;
796
- radius?: "small" | "default" | "large" | "full" | null | undefined;
796
+ size?: "default" | "small" | "large" | null | undefined;
797
+ radius?: "default" | "small" | "large" | "full" | null | undefined;
797
798
  status?: "default" | "error" | null | undefined;
798
799
  } & class_variance_authority_types.ClassProp) | undefined) => string;
799
800
  interface InputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'size' | 'sufix' | 'prefix'>, VariantProps<typeof inputVariants> {
@@ -1008,7 +1009,7 @@ declare const RadioGroup: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimi
1008
1009
  declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
1009
1010
 
1010
1011
  declare const ResizablePanelGroup: ({ className, ...props }: React$1.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => React$1.JSX.Element;
1011
- declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | HTMLDivElement | HTMLButtonElement | HTMLHeadingElement | HTMLParagraphElement | HTMLLabelElement | HTMLInputElement | HTMLUListElement | HTMLObjectElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableCaptionElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLLegendElement | HTMLLinkElement | HTMLMapElement | HTMLMenuElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPictureElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLSourceElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement>, "id" | "onResize"> & {
1012
+ declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement | HTMLElement | HTMLButtonElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | HTMLHeadingElement | HTMLParagraphElement | HTMLLabelElement | HTMLInputElement | HTMLUListElement | HTMLObjectElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableCaptionElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLLegendElement | HTMLLinkElement | HTMLMapElement | HTMLMenuElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPictureElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLSourceElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement>, "id" | "onResize"> & {
1012
1013
  className?: string;
1013
1014
  collapsedSize?: number | undefined;
1014
1015
  collapsible?: boolean | undefined;
@@ -1176,8 +1177,8 @@ declare const TabsContent: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.
1176
1177
 
1177
1178
  declare const textareaVariants: (props?: ({
1178
1179
  variant?: "default" | "filled" | "borderless" | null | undefined;
1179
- size?: "small" | "default" | "large" | null | undefined;
1180
- radius?: "small" | "default" | "large" | "full" | null | undefined;
1180
+ size?: "default" | "small" | "large" | null | undefined;
1181
+ radius?: "default" | "small" | "large" | "full" | null | undefined;
1181
1182
  resize?: "default" | "both" | "horizontal" | "vertical" | "vertical-limited" | null | undefined;
1182
1183
  status?: "default" | "error" | null | undefined;
1183
1184
  } & class_variance_authority_types.ClassProp) | undefined) => string;
@@ -1,79 +1,79 @@
1
- const extend = {
2
- colors: {
3
- background: 'hsl(var(--background))',
4
- foreground: 'hsl(var(--foreground))',
5
- card: {
6
- DEFAULT: 'hsl(var(--card))',
7
- foreground: 'hsl(var(--card-foreground))',
8
- },
9
- popover: {
10
- DEFAULT: 'hsl(var(--popover))',
11
- foreground: 'hsl(var(--popover-foreground))',
12
- },
13
- primary: {
14
- DEFAULT: 'hsl(var(--primary))',
15
- foreground: 'hsl(var(--primary-foreground))',
16
- },
17
- secondary: {
18
- DEFAULT: 'hsl(var(--secondary))',
19
- foreground: 'hsl(var(--secondary-foreground))',
20
- },
21
- muted: {
22
- DEFAULT: 'hsl(var(--muted))',
23
- foreground: 'hsl(var(--muted-foreground))',
24
- },
25
- accent: {
26
- DEFAULT: 'hsl(var(--accent))',
27
- foreground: 'hsl(var(--accent-foreground))',
28
- },
29
- destructive: {
30
- DEFAULT: 'hsl(var(--destructive))',
31
- foreground: 'hsl(var(--destructive-foreground))',
32
- },
33
- border: 'hsl(var(--border))',
34
- input: 'hsl(var(--input))',
35
- ring: 'hsl(var(--ring))',
36
- chart: {
37
- 1: 'hsl(var(--chart-1))',
38
- 2: 'hsl(var(--chart-2))',
39
- 3: 'hsl(var(--chart-3))',
40
- 4: 'hsl(var(--chart-4))',
41
- 5: 'hsl(var(--chart-5))',
42
- 6: 'hsl(var(--chart-6))',
43
- 7: 'hsl(var(--chart-7))',
44
- 8: 'hsl(var(--chart-8))',
45
- },
46
- sidebar: {
47
- DEFAULT: 'hsl(var(--sidebar-background))',
48
- foreground: 'hsl(var(--sidebar-foreground))',
49
- primary: 'hsl(var(--sidebar-primary))',
50
- 'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
51
- accent: 'hsl(var(--sidebar-accent))',
52
- 'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
53
- border: 'hsl(var(--sidebar-border))',
54
- ring: 'hsl(var(--sidebar-ring))',
55
- },
56
- },
57
- borderRadius: {
58
- lg: 'var(--radius)',
59
- md: 'calc(var(--radius) - 2px)',
60
- sm: 'calc(var(--radius) - 4px)',
61
- },
62
- keyframes: {
63
- 'accordion-down': {
64
- from: { height: '0' },
65
- to: { height: 'var(--radix-accordion-content-height)' },
66
- },
67
- 'accordion-up': {
68
- from: { height: 'var(--radix-accordion-content-height)' },
69
- to: { height: '0' },
70
- },
71
- },
72
- animation: {
73
- 'accordion-down': 'accordion-down 0.2s ease-out',
74
- 'accordion-up': 'accordion-up 0.2s ease-out',
75
- 'spin-slow': 'spin 2s linear infinite',
76
- },
77
- };
78
-
79
- export { extend };
1
+ const extend = {
2
+ colors: {
3
+ background: 'hsl(var(--background))',
4
+ foreground: 'hsl(var(--foreground))',
5
+ card: {
6
+ DEFAULT: 'hsl(var(--card))',
7
+ foreground: 'hsl(var(--card-foreground))',
8
+ },
9
+ popover: {
10
+ DEFAULT: 'hsl(var(--popover))',
11
+ foreground: 'hsl(var(--popover-foreground))',
12
+ },
13
+ primary: {
14
+ DEFAULT: 'hsl(var(--primary))',
15
+ foreground: 'hsl(var(--primary-foreground))',
16
+ },
17
+ secondary: {
18
+ DEFAULT: 'hsl(var(--secondary))',
19
+ foreground: 'hsl(var(--secondary-foreground))',
20
+ },
21
+ muted: {
22
+ DEFAULT: 'hsl(var(--muted))',
23
+ foreground: 'hsl(var(--muted-foreground))',
24
+ },
25
+ accent: {
26
+ DEFAULT: 'hsl(var(--accent))',
27
+ foreground: 'hsl(var(--accent-foreground))',
28
+ },
29
+ destructive: {
30
+ DEFAULT: 'hsl(var(--destructive))',
31
+ foreground: 'hsl(var(--destructive-foreground))',
32
+ },
33
+ border: 'hsl(var(--border))',
34
+ input: 'hsl(var(--input))',
35
+ ring: 'hsl(var(--ring))',
36
+ chart: {
37
+ 1: 'hsl(var(--chart-1))',
38
+ 2: 'hsl(var(--chart-2))',
39
+ 3: 'hsl(var(--chart-3))',
40
+ 4: 'hsl(var(--chart-4))',
41
+ 5: 'hsl(var(--chart-5))',
42
+ 6: 'hsl(var(--chart-6))',
43
+ 7: 'hsl(var(--chart-7))',
44
+ 8: 'hsl(var(--chart-8))',
45
+ },
46
+ sidebar: {
47
+ DEFAULT: 'hsl(var(--sidebar-background))',
48
+ foreground: 'hsl(var(--sidebar-foreground))',
49
+ primary: 'hsl(var(--sidebar-primary))',
50
+ 'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
51
+ accent: 'hsl(var(--sidebar-accent))',
52
+ 'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
53
+ border: 'hsl(var(--sidebar-border))',
54
+ ring: 'hsl(var(--sidebar-ring))',
55
+ },
56
+ },
57
+ borderRadius: {
58
+ lg: 'var(--radius)',
59
+ md: 'calc(var(--radius) - 2px)',
60
+ sm: 'calc(var(--radius) - 4px)',
61
+ },
62
+ keyframes: {
63
+ 'accordion-down': {
64
+ from: { height: '0' },
65
+ to: { height: 'var(--radix-accordion-content-height)' },
66
+ },
67
+ 'accordion-up': {
68
+ from: { height: 'var(--radix-accordion-content-height)' },
69
+ to: { height: '0' },
70
+ },
71
+ },
72
+ animation: {
73
+ 'accordion-down': 'accordion-down 0.2s ease-out',
74
+ 'accordion-up': 'accordion-up 0.2s ease-out',
75
+ 'spin-slow': 'spin 2s linear infinite',
76
+ },
77
+ };
78
+
79
+ export { extend };