fix: update component to latest

This commit is contained in:
p-sw 2024-06-29 12:05:14 +09:00
parent d6544935b4
commit fab5807435
2 changed files with 7 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import React from "react";
import { vcn, VariantProps, Slot, AsChild } from "@pswui-lib"; import { vcn, VariantProps, Slot, AsChild } from "@pswui-lib";
const colors = { const colors = {
disabled: "disabled:brightness-50 disabled:cursor-not-allowed disabled:opacity-50 disabled:saturate-50",
outline: { outline: {
focus: "dark:focus-visible:outline-white/20 focus-visible:outline-black/10", focus: "dark:focus-visible:outline-white/20 focus-visible:outline-black/10",
}, },
@ -26,7 +27,7 @@ const colors = {
}; };
const [buttonVariants, resolveVariants] = vcn({ const [buttonVariants, resolveVariants] = vcn({
base: `w-fit flex flex-row items-center justify-between rounded-md outline outline-1 outline-transparent outline-offset-2 ${colors.outline.focus} transition-all`, base: `w-fit flex flex-row items-center justify-between rounded-md outline outline-1 outline-transparent outline-offset-2 ${colors.outline.focus} ${colors.disabled} transition-all cursor-pointer`,
variants: { variants: {
size: { size: {
link: "p-0 text-base", link: "p-0 text-base",

View File

@ -107,8 +107,11 @@ const PopoverContent = React.forwardRef<HTMLDivElement, PopoverContentProps>(
const internalRef = useRef<HTMLDivElement | null>(null); const internalRef = useRef<HTMLDivElement | null>(null);
useEffect(() => { useEffect(() => {
function handleOutsideClick(e: any) { function handleOutsideClick(e: MouseEvent) {
if (internalRef.current && !internalRef.current.contains(e.target)) { if (
internalRef.current &&
!internalRef.current.contains(e.target as Node | null)
) {
setState((prev) => ({ ...prev, opened: false })); setState((prev) => ({ ...prev, opened: false }));
} }
} }