lecom-ui 5.3.14 → 5.3.15
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.
|
@@ -10,29 +10,33 @@ const CustomButton = React.forwardRef(
|
|
|
10
10
|
);
|
|
11
11
|
const [color, setColor] = React.useState(normal.textColor);
|
|
12
12
|
React.useEffect(() => {
|
|
13
|
-
setBackgroundColor(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, [
|
|
18
|
-
customStyles.normal.bgColor,
|
|
19
|
-
customStyles.normal.opacity,
|
|
20
|
-
customStyles.normal.textColor
|
|
21
|
-
]);
|
|
22
|
-
const handleOver = () => {
|
|
13
|
+
setBackgroundColor(opacity(normal.bgColor, normal.opacity));
|
|
14
|
+
setColor(normal.textColor);
|
|
15
|
+
}, [normal.bgColor, normal.opacity, normal.textColor]);
|
|
16
|
+
const handleOver = React.useCallback(() => {
|
|
23
17
|
setBackgroundColor(opacity(hover.bgColor, hover.opacity));
|
|
24
18
|
setColor(hover.textColor);
|
|
25
|
-
};
|
|
26
|
-
const handleOut = () => {
|
|
19
|
+
}, [hover.bgColor, hover.opacity, hover.textColor]);
|
|
20
|
+
const handleOut = React.useCallback(() => {
|
|
27
21
|
setBackgroundColor(opacity(normal.bgColor, normal.opacity));
|
|
28
22
|
setColor(normal.textColor);
|
|
29
|
-
};
|
|
23
|
+
}, [normal.bgColor, normal.opacity, normal.textColor]);
|
|
30
24
|
const shadowSmTailwind = "0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgb(0, 0, 0, 0.05)";
|
|
31
|
-
const mappedCustomStyles =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
const mappedCustomStyles = React.useMemo(
|
|
26
|
+
() => ({
|
|
27
|
+
backgroundColor: isActive ? opacity(focus.bgColor, focus.opacity) : backgroundColor,
|
|
28
|
+
color: isActive ? focus.textColor : color,
|
|
29
|
+
boxShadow: shadowSmTailwind
|
|
30
|
+
}),
|
|
31
|
+
[
|
|
32
|
+
isActive,
|
|
33
|
+
focus.bgColor,
|
|
34
|
+
focus.opacity,
|
|
35
|
+
focus.textColor,
|
|
36
|
+
backgroundColor,
|
|
37
|
+
color
|
|
38
|
+
]
|
|
39
|
+
);
|
|
36
40
|
return /* @__PURE__ */ React.createElement(
|
|
37
41
|
Button,
|
|
38
42
|
{
|
|
@@ -11,46 +11,50 @@ const SelectTrigger = React.forwardRef(({ className, children, customStyles, ...
|
|
|
11
11
|
const normal = customStyles?.normal;
|
|
12
12
|
const hover = customStyles?.hover;
|
|
13
13
|
const focus = customStyles?.focus;
|
|
14
|
-
const [
|
|
15
|
-
normal
|
|
14
|
+
const [state, setState] = React.useState(
|
|
15
|
+
"normal"
|
|
16
16
|
);
|
|
17
|
-
const [color, setColor] = React.useState(normal?.textColor ?? void 0);
|
|
18
17
|
React.useEffect(() => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
setState("normal");
|
|
19
|
+
}, [customStyles]);
|
|
20
|
+
const getCurrentStyles = React.useCallback(() => {
|
|
21
|
+
const shadowSmTailwind = "0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgb(0, 0, 0, 0.05)";
|
|
22
|
+
if (!customStyles) return {};
|
|
23
|
+
if (state === "hover" && hover) {
|
|
24
|
+
return {
|
|
25
|
+
backgroundColor: opacity(hover.bgColor, hover.opacity),
|
|
26
|
+
color: hover.textColor,
|
|
27
|
+
boxShadow: shadowSmTailwind
|
|
28
|
+
};
|
|
24
29
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const [isActive, setIsActive] = React.useState(false);
|
|
32
|
-
const handleOver = React.useCallback(() => {
|
|
33
|
-
if (hover) {
|
|
34
|
-
setBackgroundColor(opacity(hover.bgColor, hover.opacity));
|
|
35
|
-
setColor(hover.textColor);
|
|
30
|
+
if (state === "focus" && focus) {
|
|
31
|
+
return {
|
|
32
|
+
backgroundColor: opacity(focus.bgColor, focus.opacity),
|
|
33
|
+
color: focus.textColor,
|
|
34
|
+
boxShadow: shadowSmTailwind
|
|
35
|
+
};
|
|
36
36
|
}
|
|
37
|
-
}, [hover]);
|
|
38
|
-
const handleOut = React.useCallback(() => {
|
|
39
37
|
if (normal) {
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
return {
|
|
39
|
+
backgroundColor: opacity(normal.bgColor, normal.opacity),
|
|
40
|
+
color: normal.textColor,
|
|
41
|
+
boxShadow: shadowSmTailwind
|
|
42
|
+
};
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, [
|
|
44
|
+
return {};
|
|
45
|
+
}, [customStyles, state, normal, hover, focus]);
|
|
46
|
+
const handleOver = React.useCallback(() => {
|
|
47
|
+
if (hover) setState("hover");
|
|
48
|
+
}, [hover]);
|
|
49
|
+
const handleOut = React.useCallback(() => {
|
|
50
|
+
setState("normal");
|
|
51
|
+
}, []);
|
|
52
|
+
const handleFocus = React.useCallback(() => {
|
|
53
|
+
if (focus) setState("focus");
|
|
54
|
+
}, [focus]);
|
|
55
|
+
const handleBlur = React.useCallback(() => {
|
|
56
|
+
setState("normal");
|
|
57
|
+
}, []);
|
|
54
58
|
return /* @__PURE__ */ React.createElement(
|
|
55
59
|
SelectPrimitive.Trigger,
|
|
56
60
|
{
|
|
@@ -68,7 +72,7 @@ const SelectTrigger = React.forwardRef(({ className, children, customStyles, ...
|
|
|
68
72
|
onMouseOut: handleOut,
|
|
69
73
|
onFocus: handleFocus,
|
|
70
74
|
onBlur: handleBlur,
|
|
71
|
-
style:
|
|
75
|
+
style: getCurrentStyles(),
|
|
72
76
|
...props
|
|
73
77
|
},
|
|
74
78
|
children,
|
package/dist/index.d.ts
CHANGED
|
@@ -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<
|
|
901
|
+
declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | HTMLDivElement | HTMLButtonElement | HTMLLabelElement | HTMLParagraphElement | HTMLHeadingElement | 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?: "
|
|
986
|
+
color?: "black" | "white" | 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> {
|