lecom-ui 5.3.12 → 5.3.14

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,9 +6,19 @@ const CustomButton = React.forwardRef(
6
6
  ({ customStyles, isActive, children, ...props }, ref) => {
7
7
  const { normal, hover, focus } = customStyles;
8
8
  const [backgroundColor, setBackgroundColor] = React.useState(
9
- opacity(normal.bgColor, normal.opacity)
9
+ () => opacity(normal.bgColor, normal.opacity)
10
10
  );
11
11
  const [color, setColor] = React.useState(normal.textColor);
12
+ React.useEffect(() => {
13
+ setBackgroundColor(
14
+ opacity(customStyles.normal.bgColor, customStyles.normal.opacity)
15
+ );
16
+ setColor(customStyles.normal.textColor);
17
+ }, [
18
+ customStyles.normal.bgColor,
19
+ customStyles.normal.opacity,
20
+ customStyles.normal.textColor
21
+ ]);
12
22
  const handleOver = () => {
13
23
  setBackgroundColor(opacity(hover.bgColor, hover.opacity));
14
24
  setColor(hover.textColor);
@@ -35,6 +35,32 @@ function buildColumns({
35
35
  columns,
36
36
  size = "middle"
37
37
  }) {
38
+ function renderSortArrow({
39
+ hasSort,
40
+ column,
41
+ externalColumn,
42
+ table
43
+ }) {
44
+ if (!hasSort) {
45
+ return null;
46
+ }
47
+ return /* @__PURE__ */ React.createElement(
48
+ ArrowUpDown,
49
+ {
50
+ size: 16,
51
+ className: "ml-1 text-grey-400 group-hover:text-grey-950 hover:cursor-pointer",
52
+ onClick: (event) => {
53
+ event.stopPropagation();
54
+ const sortingHandler = column.getToggleSortingHandler?.();
55
+ if (externalColumn.onSort) {
56
+ externalColumn.onSort({ table, column });
57
+ } else if (sortingHandler) {
58
+ sortingHandler(event);
59
+ }
60
+ }
61
+ }
62
+ );
63
+ }
38
64
  const mappedColumns = columns.map((externalColumn) => ({
39
65
  accessorKey: externalColumn.key,
40
66
  header: ({ table, column }) => {
@@ -54,26 +80,6 @@ function buildColumns({
54
80
  }
55
81
  const hasSort = !!externalColumn.onSort || !!externalColumn.onSortClient;
56
82
  const title = typeof externalColumn.title === "function" ? externalColumn.title({ table, column }) : externalColumn.title;
57
- function renderSortArrow() {
58
- if (!hasSort) {
59
- return null;
60
- }
61
- return /* @__PURE__ */ React.createElement(
62
- ArrowUpDown,
63
- {
64
- size: 16,
65
- className: "ml-1 text-grey-400 group-hover:text-grey-950 hover:cursor-pointer",
66
- onClick: (e) => {
67
- e.stopPropagation();
68
- const handler = column.getToggleSortingHandler?.();
69
- if (handler) handler(e);
70
- else if (externalColumn.onSort) {
71
- externalColumn.onSort({ table, column });
72
- }
73
- }
74
- }
75
- );
76
- }
77
83
  return /* @__PURE__ */ React.createElement(
78
84
  "div",
79
85
  {
@@ -92,7 +98,12 @@ function buildColumns({
92
98
  },
93
99
  externalColumn.title
94
100
  ) : title,
95
- renderSortArrow()
101
+ renderSortArrow({
102
+ hasSort,
103
+ column,
104
+ externalColumn,
105
+ table
106
+ })
96
107
  );
97
108
  },
98
109
  cell: ({ row }) => {
@@ -56,8 +56,7 @@ function Table({
56
56
  style: {
57
57
  ...styleColumn(header.column.columnDef.meta, "th"),
58
58
  ...header.column.columnDef.meta?.headerStyle
59
- },
60
- onClick: header.column.getToggleSortingHandler()
59
+ }
61
60
  },
62
61
  header.isPlaceholder ? null : flexRender(
63
62
  header.column.columnDef.header,
@@ -15,6 +15,19 @@ const SelectTrigger = React.forwardRef(({ className, children, customStyles, ...
15
15
  normal ? opacity(normal.bgColor, normal.opacity) : void 0
16
16
  );
17
17
  const [color, setColor] = React.useState(normal?.textColor ?? void 0);
18
+ React.useEffect(() => {
19
+ if (customStyles?.normal) {
20
+ setBackgroundColor(
21
+ opacity(customStyles.normal.bgColor, customStyles.normal.opacity)
22
+ );
23
+ setColor(customStyles.normal.textColor);
24
+ }
25
+ }, [
26
+ customStyles?.normal,
27
+ customStyles?.normal?.bgColor,
28
+ customStyles?.normal?.opacity,
29
+ customStyles?.normal?.textColor
30
+ ]);
18
31
  const [isActive, setIsActive] = React.useState(false);
19
32
  const handleOver = React.useCallback(() => {
20
33
  if (hover) {
package/dist/index.d.ts CHANGED
@@ -738,8 +738,8 @@ interface HeaderProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<
738
738
 
739
739
  declare const inputVariants: (props?: ({
740
740
  variant?: "default" | "filled" | "borderless" | null | undefined;
741
- size?: "default" | "small" | "large" | null | undefined;
742
- radius?: "default" | "small" | "large" | "full" | null | undefined;
741
+ size?: "small" | "default" | "large" | null | undefined;
742
+ radius?: "small" | "default" | "large" | "full" | null | undefined;
743
743
  } & class_variance_authority_types.ClassProp) | undefined) => string;
744
744
  interface InputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'size' | 'sufix' | 'prefix'>, VariantProps<typeof inputVariants> {
745
745
  sufix?: React$1.ReactNode;
@@ -898,7 +898,7 @@ declare const RadioGroup: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimi
898
898
  declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
899
899
 
900
900
  declare const ResizablePanelGroup: ({ className, ...props }: React$1.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => React$1.JSX.Element;
901
- declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement | HTMLElement | HTMLButtonElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | HTMLHeadingElement | HTMLParagraphElement | HTMLInputElement | HTMLLabelElement | 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"> & {
901
+ declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement | HTMLElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | 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"> & {
902
902
  className?: string;
903
903
  collapsedSize?: number | undefined;
904
904
  collapsible?: boolean | undefined;
@@ -983,7 +983,7 @@ declare const TooltipTrigger: React$1.ForwardRefExoticComponent<TooltipPrimitive
983
983
  declare const TooltipArrow: React$1.ForwardRefExoticComponent<TooltipPrimitive.TooltipArrowProps & React$1.RefAttributes<SVGSVGElement>>;
984
984
  declare const TooltipPortal: React$1.FC<TooltipPrimitive.TooltipPortalProps>;
985
985
  declare const tooltipContentVariants: (props?: ({
986
- color?: "black" | "white" | null | undefined;
986
+ color?: "white" | "black" | null | undefined;
987
987
  arrow?: boolean | null | undefined;
988
988
  } & class_variance_authority_types.ClassProp) | undefined) => string;
989
989
  interface TooltipContentProps extends React$1.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>, VariantProps<typeof tooltipContentVariants> {
@@ -1054,7 +1054,7 @@ declare const TabsContent: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.
1054
1054
 
1055
1055
  declare const textareaVariants: (props?: ({
1056
1056
  variant?: "default" | "filled" | "borderless" | null | undefined;
1057
- radius?: "default" | "small" | "large" | null | undefined;
1057
+ radius?: "small" | "default" | "large" | null | undefined;
1058
1058
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1059
1059
  interface TextareaProps extends React$1.ComponentProps<'textarea'>, VariantProps<typeof textareaVariants> {
1060
1060
  resize?: 'none' | 'both' | 'horizontal' | 'vertical';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "5.3.12",
3
+ "version": "5.3.14",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",