lecom-ui 5.3.17 → 5.3.19
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.
|
@@ -2,35 +2,38 @@ import * as React from 'react';
|
|
|
2
2
|
import opacity from 'hex-color-opacity';
|
|
3
3
|
import { Button } from './Button.js';
|
|
4
4
|
|
|
5
|
-
const SHADOW_SM_TAILWIND = "0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgb(0, 0, 0, 0.05)";
|
|
6
5
|
const CustomButton = React.forwardRef(
|
|
7
6
|
({ customStyles, isActive, children, ...props }, ref) => {
|
|
8
7
|
const { normal, hover, focus } = customStyles;
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const [styleState, setStyleState] = React.useState(() => getStyle(normal));
|
|
8
|
+
const [backgroundColor, setBackgroundColor] = React.useState(
|
|
9
|
+
opacity(normal.bgColor, normal.opacity)
|
|
10
|
+
);
|
|
11
|
+
const [color, setColor] = React.useState(normal.textColor);
|
|
14
12
|
React.useEffect(() => {
|
|
15
|
-
|
|
13
|
+
setBackgroundColor(opacity(normal.bgColor, normal.opacity));
|
|
14
|
+
setColor(normal.textColor);
|
|
16
15
|
}, [normal]);
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
const handleOver = () => {
|
|
17
|
+
setBackgroundColor(opacity(hover.bgColor, hover.opacity));
|
|
18
|
+
setColor(hover.textColor);
|
|
19
|
+
};
|
|
20
|
+
const handleOut = () => {
|
|
21
|
+
setBackgroundColor(opacity(normal.bgColor, normal.opacity));
|
|
22
|
+
setColor(normal.textColor);
|
|
23
|
+
};
|
|
24
|
+
const shadowSmTailwind = "0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgb(0, 0, 0, 0.05)";
|
|
25
|
+
const mappedCustomStyles = {
|
|
26
|
+
backgroundColor: isActive ? opacity(focus.bgColor, focus.opacity) : backgroundColor,
|
|
27
|
+
color: isActive ? focus.textColor : color,
|
|
28
|
+
boxShadow: shadowSmTailwind
|
|
29
|
+
};
|
|
27
30
|
return /* @__PURE__ */ React.createElement(
|
|
28
31
|
Button,
|
|
29
32
|
{
|
|
30
|
-
|
|
33
|
+
onMouseOver: handleOver,
|
|
34
|
+
onMouseOut: handleOut,
|
|
31
35
|
style: mappedCustomStyles,
|
|
32
|
-
|
|
33
|
-
onMouseOut: handleMouseOut,
|
|
36
|
+
ref,
|
|
34
37
|
...props
|
|
35
38
|
},
|
|
36
39
|
children
|
|
@@ -7,25 +7,43 @@ import { ChevronDown, ChevronUp, Check } from 'lucide-react';
|
|
|
7
7
|
const Select = SelectPrimitive.Root;
|
|
8
8
|
const SelectGroup = SelectPrimitive.Group;
|
|
9
9
|
const SelectValue = SelectPrimitive.Value;
|
|
10
|
-
const SHADOW_SM_TAILWIND = "0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgb(0, 0, 0, 0.05)";
|
|
11
10
|
const SelectTrigger = React.forwardRef(({ className, children, customStyles, ...props }, ref) => {
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
const normal = customStyles?.normal;
|
|
12
|
+
const hover = customStyles?.hover;
|
|
13
|
+
const focus = customStyles?.focus;
|
|
14
|
+
const [backgroundColor, setBackgroundColor] = React.useState(
|
|
15
|
+
normal ? opacity(normal.bgColor, normal.opacity) : void 0
|
|
16
|
+
);
|
|
17
|
+
const [color, setColor] = React.useState(normal?.textColor ?? void 0);
|
|
18
|
+
const [isActive, setIsActive] = React.useState(false);
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
if (normal) {
|
|
21
|
+
setBackgroundColor(opacity(normal.bgColor, normal.opacity));
|
|
22
|
+
setColor(normal.textColor);
|
|
23
|
+
}
|
|
24
|
+
}, [normal]);
|
|
25
|
+
const handleOver = React.useCallback(() => {
|
|
26
|
+
if (!isActive && hover) {
|
|
27
|
+
setBackgroundColor(opacity(hover.bgColor, hover.opacity));
|
|
28
|
+
setColor(hover.textColor);
|
|
29
|
+
}
|
|
30
|
+
}, [hover, isActive]);
|
|
31
|
+
const handleOut = React.useCallback(() => {
|
|
32
|
+
if (!isActive && normal) {
|
|
33
|
+
setBackgroundColor(opacity(normal.bgColor, normal.opacity));
|
|
34
|
+
setColor(normal.textColor);
|
|
35
|
+
}
|
|
36
|
+
}, [normal, isActive]);
|
|
37
|
+
const handleFocus = React.useCallback(() => setIsActive(true), []);
|
|
38
|
+
const handleBlur = React.useCallback(() => setIsActive(false), []);
|
|
39
|
+
const mappedCustomStyles = React.useMemo(() => {
|
|
40
|
+
const shadowSmTailwind = "0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgb(0, 0, 0, 0.05)";
|
|
41
|
+
return customStyles ? {
|
|
42
|
+
backgroundColor: isActive ? opacity(focus?.bgColor || "", focus?.opacity || 1) : backgroundColor,
|
|
43
|
+
color: isActive ? focus?.textColor : color,
|
|
44
|
+
boxShadow: shadowSmTailwind
|
|
45
|
+
} : {};
|
|
46
|
+
}, [customStyles, isActive, focus, backgroundColor, color]);
|
|
29
47
|
return /* @__PURE__ */ React.createElement(
|
|
30
48
|
SelectPrimitive.Trigger,
|
|
31
49
|
{
|
|
@@ -39,11 +57,11 @@ const SelectTrigger = React.forwardRef(({ className, children, customStyles, ...
|
|
|
39
57
|
!customStyles && "border border-grey-400 bg-background",
|
|
40
58
|
className
|
|
41
59
|
),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
onMouseOut: handleMouseOut,
|
|
60
|
+
onMouseOver: handleOver,
|
|
61
|
+
onMouseOut: handleOut,
|
|
45
62
|
onFocus: handleFocus,
|
|
46
63
|
onBlur: handleBlur,
|
|
64
|
+
style: mappedCustomStyles,
|
|
47
65
|
...props
|
|
48
66
|
},
|
|
49
67
|
children,
|
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?: "
|
|
742
|
-
radius?: "
|
|
741
|
+
size?: "default" | "small" | "large" | null | undefined;
|
|
742
|
+
radius?: "default" | "small" | "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<
|
|
901
|
+
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"> & {
|
|
902
902
|
className?: string;
|
|
903
903
|
collapsedSize?: number | undefined;
|
|
904
904
|
collapsible?: boolean | undefined;
|
|
@@ -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?: "
|
|
1057
|
+
radius?: "default" | "small" | "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';
|