@kadoui/react 1.0.0 → 1.1.2
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 +1 -0
- package/dist/components/AccessNavigation/AccessNavigation.d.ts.map +1 -1
- package/dist/components/AccessNavigation/AccessNavigation.jsx +1 -1
- package/dist/components/Accordion/AccordionBody.d.ts +1 -1
- package/dist/components/Accordion/AccordionBody.d.ts.map +1 -1
- package/dist/components/Accordion/AccordionBody.jsx +3 -6
- package/dist/components/Accordion/AccordionToggle.d.ts +1 -1
- package/dist/components/Accordion/AccordionToggle.d.ts.map +1 -1
- package/dist/components/Accordion/AccordionToggle.jsx +3 -8
- package/dist/components/Affix/Affix.d.ts +1 -1
- package/dist/components/Affix/Affix.d.ts.map +1 -1
- package/dist/components/Affix/Affix.jsx +3 -6
- package/dist/components/Breadcrumbs/BreadcrumbsItem.d.ts +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsItem.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsItem.jsx +2 -3
- package/dist/components/Breadcrumbs/BreadcrumbsRoot.d.ts +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsRoot.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsRoot.jsx +2 -3
- package/dist/components/Carousel/Carousel.d.ts +4 -0
- package/dist/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.js +5 -1
- package/dist/components/Carousel/CarouselContainer.d.ts +1 -1
- package/dist/components/Carousel/CarouselContainer.d.ts.map +1 -1
- package/dist/components/Carousel/CarouselContainer.jsx +2 -3
- package/dist/components/Carousel/CarouselContext.d.ts +2 -0
- package/dist/components/Carousel/CarouselContext.d.ts.map +1 -1
- package/dist/components/Carousel/CarouselLeftFade.d.ts +5 -0
- package/dist/components/Carousel/CarouselLeftFade.d.ts.map +1 -0
- package/dist/components/Carousel/CarouselLeftFade.jsx +10 -0
- package/dist/components/Carousel/CarouselRightFade.d.ts +5 -0
- package/dist/components/Carousel/CarouselRightFade.d.ts.map +1 -0
- package/dist/components/Carousel/CarouselRightFade.jsx +10 -0
- package/dist/components/Carousel/CarouselRoot.d.ts +1 -1
- package/dist/components/Carousel/CarouselRoot.d.ts.map +1 -1
- package/dist/components/Carousel/CarouselRoot.jsx +3 -16
- package/dist/components/Clipboard/Clipboard.d.ts +3 -2
- package/dist/components/Clipboard/Clipboard.d.ts.map +1 -1
- package/dist/components/Clipboard/Clipboard.jsx +2 -5
- package/dist/components/ContextMenu/ContextMenuContent.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenuContent.jsx +3 -2
- package/dist/components/ContextMenu/ContextMenuRoot.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenuRoot.jsx +1 -1
- package/dist/components/Drawer/DrawerBody.d.ts +1 -1
- package/dist/components/Drawer/DrawerBody.d.ts.map +1 -1
- package/dist/components/Drawer/DrawerBody.jsx +3 -4
- package/dist/components/Drawer/DrawerPortal.d.ts +1 -1
- package/dist/components/Drawer/DrawerPortal.d.ts.map +1 -1
- package/dist/components/Drawer/DrawerPortal.jsx +2 -3
- package/dist/components/Drawer/DrawerRoot.jsx +1 -1
- package/dist/components/Dropdown/DropdownMenu.d.ts +1 -1
- package/dist/components/Dropdown/DropdownMenu.d.ts.map +1 -1
- package/dist/components/Dropdown/DropdownMenu.jsx +2 -3
- package/dist/components/Dropdown/DropdownRoot.d.ts +1 -1
- package/dist/components/Dropdown/DropdownRoot.d.ts.map +1 -1
- package/dist/components/Dropdown/DropdownRoot.jsx +4 -6
- package/dist/components/LoaderLink/LoaderLink.d.ts +6 -0
- package/dist/components/LoaderLink/LoaderLink.d.ts.map +1 -0
- package/dist/components/LoaderLink/LoaderLink.jsx +6 -0
- package/dist/components/Modal/Modal.d.ts +3 -3
- package/dist/components/Modal/Modal.js +3 -3
- package/dist/components/Modal/ModalBody.d.ts +3 -3
- package/dist/components/Modal/ModalBody.d.ts.map +1 -1
- package/dist/components/Modal/ModalBody.jsx +20 -5
- package/dist/components/Modal/ModalContent.d.ts +3 -3
- package/dist/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/components/Modal/ModalContent.jsx +2 -21
- package/dist/components/Modal/ModalHeader.d.ts +1 -1
- package/dist/components/Modal/ModalHeader.d.ts.map +1 -1
- package/dist/components/Modal/ModalHeader.jsx +2 -3
- package/dist/components/Modal/ModalPortal.d.ts +1 -1
- package/dist/components/Modal/ModalPortal.d.ts.map +1 -1
- package/dist/components/Modal/ModalPortal.jsx +2 -3
- package/dist/components/Modal/ModalRoot.d.ts.map +1 -1
- package/dist/components/Modal/ModalRoot.jsx +1 -1
- package/dist/components/Otp/OtpInputs.d.ts +1 -1
- package/dist/components/Otp/OtpInputs.d.ts.map +1 -1
- package/dist/components/Otp/OtpInputs.jsx +2 -3
- package/dist/components/Otp/OtpRoot.d.ts +1 -1
- package/dist/components/Otp/OtpRoot.d.ts.map +1 -1
- package/dist/components/Otp/OtpRoot.jsx +2 -3
- package/dist/components/Pagination/PaginationNextBtn.d.ts +1 -1
- package/dist/components/Pagination/PaginationNextBtn.d.ts.map +1 -1
- package/dist/components/Pagination/PaginationNextBtn.jsx +2 -5
- package/dist/components/Pagination/PaginationPrevBtn.d.ts +1 -1
- package/dist/components/Pagination/PaginationPrevBtn.d.ts.map +1 -1
- package/dist/components/Pagination/PaginationPrevBtn.jsx +2 -5
- package/dist/components/PasswordInput/PasswordInputToggle.d.ts +5 -3
- package/dist/components/PasswordInput/PasswordInputToggle.d.ts.map +1 -1
- package/dist/components/PasswordInput/PasswordInputToggle.jsx +2 -10
- package/dist/components/Progress/ProgressBar.d.ts +1 -1
- package/dist/components/Progress/ProgressBar.d.ts.map +1 -1
- package/dist/components/Progress/ProgressBar.jsx +2 -3
- package/dist/components/Progress/ProgressRoot.d.ts +1 -1
- package/dist/components/Progress/ProgressRoot.d.ts.map +1 -1
- package/dist/components/Progress/ProgressRoot.jsx +2 -3
- package/dist/components/Rating/Rating.d.ts +1 -1
- package/dist/components/Rating/RatingItems.d.ts +3 -3
- package/dist/components/Rating/RatingItems.d.ts.map +1 -1
- package/dist/components/Rating/RatingItems.jsx +3 -7
- package/dist/components/Rating/RatingRoot.d.ts +1 -1
- package/dist/components/Rating/RatingRoot.d.ts.map +1 -1
- package/dist/components/Rating/RatingRoot.jsx +2 -3
- package/dist/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/components/Sheet/SheetBody.d.ts +1 -1
- package/dist/components/Sheet/SheetBody.d.ts.map +1 -1
- package/dist/components/Sheet/SheetBody.jsx +5 -6
- package/dist/components/Sheet/SheetContent.d.ts +1 -1
- package/dist/components/Sheet/SheetContent.d.ts.map +1 -1
- package/dist/components/Sheet/SheetContent.jsx +2 -3
- package/dist/components/Sheet/SheetContext.d.ts +1 -2
- package/dist/components/Sheet/SheetContext.d.ts.map +1 -1
- package/dist/components/Sheet/SheetHeader.d.ts +1 -1
- package/dist/components/Sheet/SheetHeader.d.ts.map +1 -1
- package/dist/components/Sheet/SheetHeader.jsx +5 -5
- package/dist/components/Sheet/SheetPortal.d.ts +1 -1
- package/dist/components/Sheet/SheetPortal.d.ts.map +1 -1
- package/dist/components/Sheet/SheetPortal.jsx +2 -3
- package/dist/components/Sheet/SheetRoot.d.ts.map +1 -1
- package/dist/components/Sheet/SheetRoot.jsx +6 -7
- package/dist/components/ShowMore/ShowMoreContent.d.ts +1 -1
- package/dist/components/ShowMore/ShowMoreContent.d.ts.map +1 -1
- package/dist/components/ShowMore/ShowMoreContent.jsx +6 -4
- package/dist/components/ShowMore/ShowMoreFade.d.ts +1 -1
- package/dist/components/ShowMore/ShowMoreFade.d.ts.map +1 -1
- package/dist/components/ShowMore/ShowMoreFade.jsx +2 -3
- package/dist/components/ShowMore/ShowMoreRoot.d.ts +1 -1
- package/dist/components/ShowMore/ShowMoreRoot.d.ts.map +1 -1
- package/dist/components/ShowMore/ShowMoreRoot.jsx +2 -3
- package/dist/components/ShowMore/ShowMoreTrigger.d.ts +1 -1
- package/dist/components/ShowMore/ShowMoreTrigger.d.ts.map +1 -1
- package/dist/components/ShowMore/ShowMoreTrigger.jsx +5 -3
- package/dist/components/Slide/Slide.d.ts +2 -2
- package/dist/components/Slide/Slide.d.ts.map +1 -1
- package/dist/components/Slide/Slide.js +2 -2
- package/dist/components/Slide/SlideBody.d.ts +4 -0
- package/dist/components/Slide/SlideBody.d.ts.map +1 -0
- package/dist/components/Slide/SlideBody.jsx +3 -0
- package/dist/components/Slide/SlideHeader.d.ts +1 -1
- package/dist/components/Slide/SlideHeader.d.ts.map +1 -1
- package/dist/components/Slide/SlideHeader.jsx +2 -3
- package/dist/components/Slide/SlidePortal.d.ts.map +1 -1
- package/dist/components/Slide/SlidePortal.jsx +2 -2
- package/dist/components/Slide/SlideRoot.d.ts +4 -2
- package/dist/components/Slide/SlideRoot.d.ts.map +1 -1
- package/dist/components/Slide/SlideRoot.jsx +12 -7
- package/dist/components/Spoiler/Spoiler.d.ts +4 -4
- package/dist/components/Spoiler/Spoiler.d.ts.map +1 -1
- package/dist/components/Spoiler/Spoiler.js +5 -0
- package/dist/components/Spoiler/SpoilerBlur.d.ts +4 -0
- package/dist/components/Spoiler/SpoilerBlur.d.ts.map +1 -0
- package/dist/components/Spoiler/SpoilerBlur.jsx +8 -0
- package/dist/components/Spoiler/SpoilerContext.d.ts +7 -0
- package/dist/components/Spoiler/SpoilerContext.d.ts.map +1 -0
- package/dist/components/Spoiler/SpoilerContext.js +2 -0
- package/dist/components/Spoiler/SpoilerRoot.d.ts +4 -0
- package/dist/components/Spoiler/SpoilerRoot.d.ts.map +1 -0
- package/dist/components/Spoiler/SpoilerRoot.jsx +10 -0
- package/dist/components/Steps/Steps.d.ts +6 -3
- package/dist/components/Steps/Steps.d.ts.map +1 -1
- package/dist/components/Steps/Steps.js +4 -2
- package/dist/components/Steps/StepsContext.d.ts.map +1 -1
- package/dist/components/Steps/StepsContext.js +2 -0
- package/dist/components/Steps/StepsControls.jsx +1 -1
- package/dist/components/Steps/StepsIndexBtn.d.ts +6 -0
- package/dist/components/Steps/StepsIndexBtn.d.ts.map +1 -0
- package/dist/components/Steps/StepsIndexBtn.jsx +10 -0
- package/dist/components/Steps/StepsNextBtn.d.ts +1 -1
- package/dist/components/Steps/StepsNextBtn.d.ts.map +1 -1
- package/dist/components/Steps/StepsNextBtn.jsx +2 -5
- package/dist/components/Steps/StepsPrevBtn.d.ts +1 -1
- package/dist/components/Steps/StepsPrevBtn.d.ts.map +1 -1
- package/dist/components/Steps/StepsPrevBtn.jsx +2 -5
- package/dist/components/Steps/StepsRender.d.ts +2 -0
- package/dist/components/Steps/StepsRender.d.ts.map +1 -0
- package/dist/components/Steps/StepsRender.jsx +7 -0
- package/dist/components/Tabs/TabsList.d.ts +1 -1
- package/dist/components/Tabs/TabsList.d.ts.map +1 -1
- package/dist/components/Tabs/TabsList.jsx +2 -3
- package/dist/components/Tabs/TabsPanel.d.ts +1 -1
- package/dist/components/Tabs/TabsPanel.d.ts.map +1 -1
- package/dist/components/Tabs/TabsPanel.jsx +2 -3
- package/dist/components/Toast/ToastBox.jsx +1 -1
- package/dist/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/utils/browser.d.ts +3 -0
- package/dist/utils/browser.d.ts.map +1 -0
- package/dist/utils/browser.js +21 -0
- package/dist/utils/cn.d.ts +3 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +3 -0
- package/dist/utils/form.d.ts +2 -0
- package/dist/utils/form.d.ts.map +1 -0
- package/dist/utils/form.js +8 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +3 -0
- package/package.json +6 -4
- package/dist/components/LinkLoader/LinkLoader.d.ts +0 -6
- package/dist/components/LinkLoader/LinkLoader.d.ts.map +0 -1
- package/dist/components/LinkLoader/LinkLoader.jsx +0 -8
- package/dist/components/Slide/SlideContent.d.ts +0 -4
- package/dist/components/Slide/SlideContent.d.ts.map +0 -1
- package/dist/components/Slide/SlideContent.jsx +0 -4
- package/dist/components/Spoiler/Spoiler.jsx +0 -11
- package/src/components/AccessNavigation/AccessNavigation.tsx +0 -46
- package/src/components/Accordion/Accordion.ts +0 -8
- package/src/components/Accordion/AccordionBody.tsx +0 -31
- package/src/components/Accordion/AccordionContext.ts +0 -8
- package/src/components/Accordion/AccordionRoot.tsx +0 -17
- package/src/components/Accordion/AccordionToggle.tsx +0 -29
- package/src/components/Affix/Affix.tsx +0 -59
- package/src/components/Breadcrumbs/Breadcrumbs.ts +0 -6
- package/src/components/Breadcrumbs/BreadcrumbsContext.ts +0 -7
- package/src/components/Breadcrumbs/BreadcrumbsItem.tsx +0 -24
- package/src/components/Breadcrumbs/BreadcrumbsRoot.tsx +0 -21
- package/src/components/Carousel/Carousel.ts +0 -6
- package/src/components/Carousel/CarouselContainer.tsx +0 -18
- package/src/components/Carousel/CarouselContext.ts +0 -7
- package/src/components/Carousel/CarouselRoot.tsx +0 -75
- package/src/components/ClientOnly/ClientOnly.tsx +0 -12
- package/src/components/Clipboard/Clipboard.tsx +0 -36
- package/src/components/ContextMenu/ContextMenu.ts +0 -6
- package/src/components/ContextMenu/ContextMenuContent.tsx +0 -51
- package/src/components/ContextMenu/ContextMenuContext.ts +0 -9
- package/src/components/ContextMenu/ContextMenuRoot.tsx +0 -79
- package/src/components/Drawer/Drawer.ts +0 -10
- package/src/components/Drawer/DrawerBody.tsx +0 -67
- package/src/components/Drawer/DrawerContext.ts +0 -8
- package/src/components/Drawer/DrawerPortal.tsx +0 -40
- package/src/components/Drawer/DrawerRoot.tsx +0 -45
- package/src/components/Drawer/DrawerToggle.tsx +0 -21
- package/src/components/Dropdown/Dropdown.ts +0 -8
- package/src/components/Dropdown/DropdownContext.ts +0 -10
- package/src/components/Dropdown/DropdownMenu.tsx +0 -34
- package/src/components/Dropdown/DropdownRoot.tsx +0 -90
- package/src/components/Dropdown/DropdownToggle.tsx +0 -23
- package/src/components/LinkLoader/LinkLoader.tsx +0 -16
- package/src/components/Modal/Modal.ts +0 -14
- package/src/components/Modal/ModalBody.tsx +0 -12
- package/src/components/Modal/ModalContent.tsx +0 -44
- package/src/components/Modal/ModalContext.ts +0 -8
- package/src/components/Modal/ModalHeader.tsx +0 -10
- package/src/components/Modal/ModalPortal.tsx +0 -40
- package/src/components/Modal/ModalRoot.tsx +0 -47
- package/src/components/Modal/ModalTrigger.tsx +0 -21
- package/src/components/Otp/Otp.ts +0 -8
- package/src/components/Otp/OtpContext.ts +0 -10
- package/src/components/Otp/OtpHiddenInput.tsx +0 -15
- package/src/components/Otp/OtpInputs.tsx +0 -86
- package/src/components/Otp/OtpRoot.tsx +0 -26
- package/src/components/Pagination/Pagination.ts +0 -15
- package/src/components/Pagination/PaginationContext.tsx +0 -10
- package/src/components/Pagination/PaginationCounts.tsx +0 -17
- package/src/components/Pagination/PaginationNextBtn.tsx +0 -27
- package/src/components/Pagination/PaginationPrevBtn.tsx +0 -27
- package/src/components/Pagination/PaginationSearchParamsRoot.tsx +0 -45
- package/src/components/Pagination/PaginationStateRoot.tsx +0 -23
- package/src/components/PasswordInput/PasswordInput.ts +0 -8
- package/src/components/PasswordInput/PasswordInputContext.tsx +0 -8
- package/src/components/PasswordInput/PasswordInputField.tsx +0 -15
- package/src/components/PasswordInput/PasswordInputRoot.tsx +0 -17
- package/src/components/PasswordInput/PasswordInputToggle.tsx +0 -52
- package/src/components/Portal/Portal.tsx +0 -17
- package/src/components/Progress/Progress.ts +0 -6
- package/src/components/Progress/ProgressBar.tsx +0 -29
- package/src/components/Progress/ProgressContext.ts +0 -8
- package/src/components/Progress/ProgressRoot.tsx +0 -22
- package/src/components/QrCode/QrCode.tsx +0 -22
- package/src/components/Rating/Rating.ts +0 -6
- package/src/components/Rating/RatingContext.ts +0 -8
- package/src/components/Rating/RatingItems.tsx +0 -50
- package/src/components/Rating/RatingRoot.tsx +0 -22
- package/src/components/Sheet/Sheet.tsx +0 -14
- package/src/components/Sheet/SheetBody.tsx +0 -49
- package/src/components/Sheet/SheetContent.tsx +0 -8
- package/src/components/Sheet/SheetContext.ts +0 -14
- package/src/components/Sheet/SheetHeader.tsx +0 -24
- package/src/components/Sheet/SheetPortal.tsx +0 -35
- package/src/components/Sheet/SheetRoot.tsx +0 -56
- package/src/components/Sheet/SheetToggle.tsx +0 -21
- package/src/components/ShowMore/ShowMore.ts +0 -10
- package/src/components/ShowMore/ShowMoreContent.tsx +0 -31
- package/src/components/ShowMore/ShowMoreContext.ts +0 -11
- package/src/components/ShowMore/ShowMoreFade.tsx +0 -18
- package/src/components/ShowMore/ShowMoreRoot.tsx +0 -37
- package/src/components/ShowMore/ShowMoreTrigger.tsx +0 -23
- package/src/components/Slide/Slide.ts +0 -12
- package/src/components/Slide/SlideContent.tsx +0 -8
- package/src/components/Slide/SlideContext.ts +0 -11
- package/src/components/Slide/SlideHeader.tsx +0 -10
- package/src/components/Slide/SlidePortal.tsx +0 -26
- package/src/components/Slide/SlideRoot.tsx +0 -39
- package/src/components/Slide/SlideToggle.tsx +0 -21
- package/src/components/Spoiler/Spoiler.tsx +0 -28
- package/src/components/Steps/Steps.ts +0 -15
- package/src/components/Steps/StepsContext.tsx +0 -16
- package/src/components/Steps/StepsControls.tsx +0 -56
- package/src/components/Steps/StepsNextBtn.tsx +0 -27
- package/src/components/Steps/StepsPrevBtn.tsx +0 -27
- package/src/components/Steps/StepsSearchParamsRoot.tsx +0 -45
- package/src/components/Steps/StepsStateRoot.tsx +0 -23
- package/src/components/Swap/Swap.ts +0 -8
- package/src/components/Swap/SwapContext.ts +0 -9
- package/src/components/Swap/SwapItem.tsx +0 -16
- package/src/components/Swap/SwapRoot.tsx +0 -29
- package/src/components/Swap/SwapTrigger.tsx +0 -31
- package/src/components/Tabs/Tabs.ts +0 -10
- package/src/components/Tabs/TabsContext.ts +0 -11
- package/src/components/Tabs/TabsList.tsx +0 -12
- package/src/components/Tabs/TabsPanel.tsx +0 -23
- package/src/components/Tabs/TabsRoot.tsx +0 -18
- package/src/components/Tabs/TabsTab.tsx +0 -23
- package/src/components/Toast/Toast.ts +0 -3
- package/src/components/Toast/ToastBox.tsx +0 -50
- package/src/components/Toast/ToastRoot.tsx +0 -71
- package/src/components/Toast/toastStore.ts +0 -22
- package/src/components/Toggle/Toggle.ts +0 -6
- package/src/components/Toggle/ToggleContext.ts +0 -9
- package/src/components/Toggle/ToggleRoot.tsx +0 -26
- package/src/components/Toggle/ToggleSwitch.tsx +0 -41
- package/src/index.ts +0 -28
- /package/dist/components/Sheet/{Sheet.jsx → Sheet.js} +0 -0
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { cn } from "@kadoui/utils";
|
|
2
|
-
import type { HTMLAttributes } from "react";
|
|
3
|
-
|
|
4
|
-
export type ModalBodyPropsT = HTMLAttributes<HTMLDivElement>;
|
|
5
|
-
|
|
6
|
-
export function ModalBody({ children, className, ...props }: ModalBodyPropsT) {
|
|
7
|
-
return (
|
|
8
|
-
<div className={cn("py-3 px-1.5 mx-1.5 max-h-[calc(100%-4rem)] overflow-y-auto", className)} {...props}>
|
|
9
|
-
{children}
|
|
10
|
-
</div>
|
|
11
|
-
);
|
|
12
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { cn } from "@kadoui/utils";
|
|
4
|
-
import { use, useEffect, useRef } from "react";
|
|
5
|
-
import { AnimatePresence, HTMLMotionProps, motion } from "framer-motion";
|
|
6
|
-
|
|
7
|
-
import { ModalContext } from "./ModalContext";
|
|
8
|
-
|
|
9
|
-
export type ModalContentPropsT = HTMLMotionProps<"div">;
|
|
10
|
-
|
|
11
|
-
export function ModalContent({ onClick, className, ...props }: ModalContentPropsT) {
|
|
12
|
-
const { isOpen } = use(ModalContext);
|
|
13
|
-
const contentRef = useRef<HTMLDivElement>(null);
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
if (isOpen) {
|
|
17
|
-
const indexElement = contentRef.current?.querySelector("[data-modal='index']") as HTMLElement | null | undefined;
|
|
18
|
-
indexElement?.focus();
|
|
19
|
-
};
|
|
20
|
-
}, [isOpen]);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<AnimatePresence>
|
|
24
|
-
{isOpen ? (
|
|
25
|
-
<motion.div
|
|
26
|
-
ref={contentRef}
|
|
27
|
-
initial={{ opacity: 0, scale: 0.9 }}
|
|
28
|
-
animate={{ opacity: 1, scale: 1 }}
|
|
29
|
-
exit={{ opacity: 0, scale: 0.9 }}
|
|
30
|
-
transition={{ ease: "easeInOut" }}
|
|
31
|
-
onClick={ev => {
|
|
32
|
-
onClick?.(ev);
|
|
33
|
-
ev.stopPropagation();
|
|
34
|
-
}}
|
|
35
|
-
className={cn(
|
|
36
|
-
"bg-background rounded-2xl w-max max-w-[90%] h-full max-h-[90%]",
|
|
37
|
-
className,
|
|
38
|
-
)}
|
|
39
|
-
{...props}
|
|
40
|
-
/>
|
|
41
|
-
) : null}
|
|
42
|
-
</AnimatePresence>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { cn } from "@kadoui/utils";
|
|
2
|
-
import type { HTMLAttributes } from "react";
|
|
3
|
-
|
|
4
|
-
export type ModalHeaderPropsT = HTMLAttributes<HTMLDivElement>;
|
|
5
|
-
|
|
6
|
-
export function ModalHeader({ className, ...props }: ModalHeaderPropsT) {
|
|
7
|
-
return (
|
|
8
|
-
<div className={cn("h-16 f-align px-3 bg-background rounded-t-2xl border-b border-separator sticky top-0", className)} {...props} />
|
|
9
|
-
);
|
|
10
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { use } from "react";
|
|
4
|
-
import { cn } from "@kadoui/utils";
|
|
5
|
-
import { motion, AnimatePresence, HTMLMotionProps } from "framer-motion";
|
|
6
|
-
|
|
7
|
-
import { Portal } from "../Portal/Portal";
|
|
8
|
-
import { ModalContext } from "./ModalContext";
|
|
9
|
-
import { ClientOnly } from "../ClientOnly/ClientOnly";
|
|
10
|
-
|
|
11
|
-
export type ModalPortalPropsT = HTMLMotionProps<"div">;
|
|
12
|
-
|
|
13
|
-
export function ModalPortal({ onClick, className, ...props }: ModalPortalPropsT) {
|
|
14
|
-
const { isOpen, setOpen } = use(ModalContext);
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<ClientOnly>
|
|
18
|
-
<Portal>
|
|
19
|
-
<AnimatePresence>
|
|
20
|
-
{isOpen ? (
|
|
21
|
-
<motion.div
|
|
22
|
-
initial={{ opacity: 0 }}
|
|
23
|
-
animate={{ opacity: 1 }}
|
|
24
|
-
exit={{ opacity: 0 }}
|
|
25
|
-
onClick={ev => {
|
|
26
|
-
onClick?.(ev);
|
|
27
|
-
setOpen(false);
|
|
28
|
-
}}
|
|
29
|
-
className={cn(
|
|
30
|
-
"fixed inset-0 z-50 f-center bg-foreground/10",
|
|
31
|
-
className
|
|
32
|
-
)}
|
|
33
|
-
{...props}
|
|
34
|
-
/>
|
|
35
|
-
) : null}
|
|
36
|
-
</AnimatePresence>
|
|
37
|
-
</Portal>
|
|
38
|
-
</ClientOnly>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { getBrowserScrollbarWith } from "@kadoui/utils";
|
|
4
|
-
import { useState, useEffect, PropsWithChildren } from "react";
|
|
5
|
-
|
|
6
|
-
import { ModalContext } from "./ModalContext";
|
|
7
|
-
|
|
8
|
-
export type ModalRootPropsT = PropsWithChildren & {
|
|
9
|
-
defaultOpen?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function ModalRoot({ children, defaultOpen = false }: ModalRootPropsT) {
|
|
13
|
-
const [isOpen, setOpen] = useState(defaultOpen);
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
const handleEscape = (e: KeyboardEvent) => {
|
|
17
|
-
if (e.key === "Escape") {
|
|
18
|
-
setOpen(false);
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
document.addEventListener("keydown", handleEscape);
|
|
23
|
-
|
|
24
|
-
return () => {
|
|
25
|
-
document.removeEventListener("keydown", handleEscape);
|
|
26
|
-
document.body.style.overflow = "unset";
|
|
27
|
-
};
|
|
28
|
-
}, [])
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
const scrollbarWidth = getBrowserScrollbarWith();
|
|
32
|
-
|
|
33
|
-
if (isOpen) {
|
|
34
|
-
document.body.style.overflow = "hidden";
|
|
35
|
-
document.body.style.paddingRight = `${scrollbarWidth}px`;
|
|
36
|
-
} else {
|
|
37
|
-
document.body.style.overflow = "unset";
|
|
38
|
-
document.body.style.paddingRight = "0px";
|
|
39
|
-
};
|
|
40
|
-
}, [isOpen]);
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<ModalContext value={{ isOpen, setOpen }}>
|
|
44
|
-
{children}
|
|
45
|
-
</ModalContext>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { ButtonHTMLAttributes, use } from "react";
|
|
4
|
-
|
|
5
|
-
import { ModalContext } from "./ModalContext";
|
|
6
|
-
|
|
7
|
-
export type ModalTogglePropsT = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
8
|
-
|
|
9
|
-
export function ModalToggle({ onClick, ...props }: ModalTogglePropsT) {
|
|
10
|
-
const { setOpen } = use(ModalContext);
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<button
|
|
14
|
-
onClick={(ev) => {
|
|
15
|
-
onClick?.(ev);
|
|
16
|
-
setOpen(prev => !prev);
|
|
17
|
-
}}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createContext, RefObject } from "react";
|
|
2
|
-
|
|
3
|
-
export type createContextT = {
|
|
4
|
-
inputs?: RefObject<(HTMLInputElement | null)[]>;
|
|
5
|
-
getInputsValue: () => string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const OtpContext = createContext<createContextT>({
|
|
9
|
-
getInputsValue: () => ""
|
|
10
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { InputHTMLAttributes, use } from "react";
|
|
4
|
-
|
|
5
|
-
import { OtpContext } from "./OtpContext";
|
|
6
|
-
|
|
7
|
-
export type OtpHiddenInputPropsT = InputHTMLAttributes<HTMLInputElement>;
|
|
8
|
-
|
|
9
|
-
export function OtpHiddenInput({ name, ...p }: OtpHiddenInputPropsT) {
|
|
10
|
-
const { getInputsValue } = use(OtpContext);
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<input type="hidden" tabIndex={-1} name={name || "otp"} value={getInputsValue()} {...p} />
|
|
14
|
-
)
|
|
15
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { cn } from "@kadoui/utils";
|
|
4
|
-
import { ClipboardEvent, InputHTMLAttributes, KeyboardEvent, use } from "react";
|
|
5
|
-
|
|
6
|
-
import { OtpContext } from "./OtpContext";
|
|
7
|
-
|
|
8
|
-
export type OtpInputsPropsT = InputHTMLAttributes<HTMLInputElement> & {
|
|
9
|
-
length: number;
|
|
10
|
-
onLastChange?: (otp: string) => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function OtpInputs({ className, name, length, onLastChange, ...props }: OtpInputsPropsT) {
|
|
14
|
-
const { inputs, getInputsValue } = use(OtpContext);
|
|
15
|
-
|
|
16
|
-
const handlePaste = (ev: ClipboardEvent<HTMLInputElement>, startIndex: number) => {
|
|
17
|
-
ev.preventDefault();
|
|
18
|
-
|
|
19
|
-
const pastedData = ev.clipboardData.getData("text").replace(/\s/g, ""); // Remove whitespace
|
|
20
|
-
if (!pastedData) return;
|
|
21
|
-
|
|
22
|
-
for (let i = 0; i < pastedData.length; i++) {
|
|
23
|
-
const inputIndex = startIndex + i;
|
|
24
|
-
if (inputIndex >= length) break; // Don't exceed OTP length
|
|
25
|
-
|
|
26
|
-
const input = inputs?.current[inputIndex];
|
|
27
|
-
const indexedPastedData = pastedData[i];
|
|
28
|
-
if (input && indexedPastedData) {
|
|
29
|
-
input.value = indexedPastedData;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const nextIndex = Math.min(startIndex + pastedData.length, length - 1);
|
|
34
|
-
inputs?.current[nextIndex]?.focus();
|
|
35
|
-
|
|
36
|
-
const otpValue = getInputsValue();
|
|
37
|
-
if (otpValue.length === length) {
|
|
38
|
-
onLastChange?.(otpValue);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const handleInputChange = (value: string, index: number) => {
|
|
43
|
-
if (value) {
|
|
44
|
-
const currentInput = inputs?.current[index];
|
|
45
|
-
const currentValue = currentInput?.value[currentInput.value.length - 1];
|
|
46
|
-
if (currentValue) {
|
|
47
|
-
currentInput.value = currentValue;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const nextInput = inputs?.current[index + 1]
|
|
51
|
-
if (nextInput) {
|
|
52
|
-
nextInput.value = "";
|
|
53
|
-
nextInput.focus();
|
|
54
|
-
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
onLastChange?.(getInputsValue());
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const handleBackspace = (e: KeyboardEvent<HTMLInputElement>, index: number) => {
|
|
63
|
-
if (e.key === "Backspace" && !e.currentTarget.value && index > 0) {
|
|
64
|
-
inputs?.current[index - 1]?.focus();
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return Array.from({ length }).map((_, index) => (
|
|
69
|
-
<input
|
|
70
|
-
key={index}
|
|
71
|
-
autoComplete="off"
|
|
72
|
-
name={`${name || "otp"}-${index}`}
|
|
73
|
-
onPaste={ev => handlePaste(ev, index)}
|
|
74
|
-
onKeyDown={ev => handleBackspace(ev, index)}
|
|
75
|
-
onChange={ev => handleInputChange(ev.target.value, index)}
|
|
76
|
-
className={cn("input-outline input-square text-center", className)}
|
|
77
|
-
ref={el => {
|
|
78
|
-
if (inputs) {
|
|
79
|
-
inputs.current[index] = el;
|
|
80
|
-
}
|
|
81
|
-
}}
|
|
82
|
-
{...props}
|
|
83
|
-
/>
|
|
84
|
-
)
|
|
85
|
-
);
|
|
86
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { cn } from "@kadoui/utils";
|
|
4
|
-
import { HTMLAttributes, useEffect, useRef } from "react";
|
|
5
|
-
|
|
6
|
-
import { OtpContext } from "./OtpContext";
|
|
7
|
-
|
|
8
|
-
export type OtpRootPropsT = HTMLAttributes<HTMLDivElement>;
|
|
9
|
-
|
|
10
|
-
export function OtpRoot({ className, ...props }: OtpRootPropsT) {
|
|
11
|
-
const inputs = useRef<(HTMLInputElement | null)[]>([]);
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
inputs.current[0]?.focus();
|
|
15
|
-
}, []);
|
|
16
|
-
|
|
17
|
-
const getInputsValue = () => {
|
|
18
|
-
return inputs?.current.map(input => input?.value || "").join("") || "";
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<OtpContext value={{ inputs, getInputsValue }}>
|
|
23
|
-
<div className={cn("f-align gap-1.5", className)} {...props} />
|
|
24
|
-
</OtpContext>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PaginationCounts } from "./PaginationCounts";
|
|
2
|
-
import { PaginationNextBtn } from "./PaginationNextBtn";
|
|
3
|
-
import { PaginationPrevBtn } from "./PaginationPrevBtn";
|
|
4
|
-
import { PaginationStateRoot } from "./PaginationStateRoot";
|
|
5
|
-
import { PaginationSearchParamsRoot } from "./PaginationSearchParamsRoot";
|
|
6
|
-
|
|
7
|
-
const baseComponents = {
|
|
8
|
-
Counts: PaginationCounts,
|
|
9
|
-
NextBtn: PaginationNextBtn,
|
|
10
|
-
PrevBtn: PaginationPrevBtn
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const PaginationWithState = Object.assign(PaginationStateRoot, baseComponents);
|
|
14
|
-
|
|
15
|
-
export const PaginationWithSearchParams = Object.assign(PaginationSearchParamsRoot, baseComponents);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createContext } from 'react';
|
|
2
|
-
|
|
3
|
-
export type PaginationContextT = {
|
|
4
|
-
page: number;
|
|
5
|
-
pageLength: number;
|
|
6
|
-
nextPage: () => void;
|
|
7
|
-
prevPage: () => void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const PaginationContext = createContext<PaginationContextT>({} as PaginationContextT);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { HTMLAttributes, use } from "react";
|
|
4
|
-
|
|
5
|
-
import { PaginationContext } from "./PaginationContext";
|
|
6
|
-
|
|
7
|
-
export type PaginationCountsPropsT = HTMLAttributes<HTMLParagraphElement>;
|
|
8
|
-
|
|
9
|
-
export function PaginationCounts(props: PaginationCountsPropsT) {
|
|
10
|
-
const { page, pageLength } = use(PaginationContext);
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<p {...props}>
|
|
14
|
-
Page {page} / {pageLength}
|
|
15
|
-
</p>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { HTMLAttributes, use } from "react";
|
|
4
|
-
import { ChevronRightIcon } from "lucide-react";
|
|
5
|
-
|
|
6
|
-
import { PaginationContext } from "./PaginationContext";
|
|
7
|
-
|
|
8
|
-
export type PaginationNextBtnPropsT = HTMLAttributes<HTMLButtonElement> & {
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export function PaginationNextBtn({ onClick, disabled, children, ...props }: PaginationNextBtnPropsT) {
|
|
13
|
-
const { page, pageLength, nextPage } = use(PaginationContext);
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<button
|
|
17
|
-
disabled={disabled || page === pageLength}
|
|
18
|
-
onClick={ev => {
|
|
19
|
-
onClick?.(ev);
|
|
20
|
-
nextPage();
|
|
21
|
-
}}
|
|
22
|
-
{...props}
|
|
23
|
-
>
|
|
24
|
-
{children || <ChevronRightIcon className="compatible-icon" />}
|
|
25
|
-
</button>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { HTMLAttributes, use } from "react";
|
|
4
|
-
import { ChevronLeftIcon } from "lucide-react";
|
|
5
|
-
|
|
6
|
-
import { PaginationContext } from "./PaginationContext";
|
|
7
|
-
|
|
8
|
-
export type PaginationPrevBtnPropsT = HTMLAttributes<HTMLButtonElement> & {
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function PaginationPrevBtn({ onClick, disabled, children, ...props }: PaginationPrevBtnPropsT) {
|
|
13
|
-
const { page, prevPage } = use(PaginationContext);
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<button
|
|
17
|
-
disabled={disabled || page === 1}
|
|
18
|
-
onClick={ev => {
|
|
19
|
-
onClick?.(ev);
|
|
20
|
-
prevPage();
|
|
21
|
-
}}
|
|
22
|
-
{...props}
|
|
23
|
-
>
|
|
24
|
-
{children || <ChevronLeftIcon className="compatible-icon" />}
|
|
25
|
-
</button>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useRouter, useSearchParams } from "next/navigation";
|
|
4
|
-
import { PropsWithChildren, useEffect, useState } from "react";
|
|
5
|
-
|
|
6
|
-
import { PaginationContext } from "./PaginationContext";
|
|
7
|
-
|
|
8
|
-
export type PaginationSearchParamsRootPropsT = PropsWithChildren & {
|
|
9
|
-
pageKey?: string;
|
|
10
|
-
pageLength: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function PaginationSearchParamsRoot({ pageKey, pageLength, children }: PaginationSearchParamsRootPropsT) {
|
|
14
|
-
const router = useRouter();
|
|
15
|
-
const searchParams = useSearchParams();
|
|
16
|
-
const [currentPage, setCurrentPage] = useState(1);
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
setCurrentPage(+(searchParams.get(pageKey || "page") || "1"));
|
|
20
|
-
}, [pageKey, searchParams]);
|
|
21
|
-
|
|
22
|
-
const pushRouter = (page: number) => {
|
|
23
|
-
const params = new URLSearchParams(searchParams.toString());
|
|
24
|
-
params.set(pageKey || "page", page.toString());
|
|
25
|
-
router.push("?" + params.toString())
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const nextPage = () => {
|
|
29
|
-
if (currentPage < pageLength) {
|
|
30
|
-
pushRouter(currentPage + 1)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const prevPage = () => {
|
|
35
|
-
if (currentPage > 1) {
|
|
36
|
-
pushRouter(currentPage - 1)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<PaginationContext.Provider value={{ page: currentPage, pageLength, nextPage, prevPage }}>
|
|
42
|
-
{children}
|
|
43
|
-
</PaginationContext.Provider>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { PropsWithChildren, useState } from "react";
|
|
4
|
-
|
|
5
|
-
import { PaginationContext } from "./PaginationContext";
|
|
6
|
-
|
|
7
|
-
export type PaginationStateRootPropsT = PropsWithChildren & {
|
|
8
|
-
pageLength: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function PaginationStateRoot({ pageLength, children }: PaginationStateRootPropsT) {
|
|
12
|
-
const [page, setPage] = useState(1);
|
|
13
|
-
|
|
14
|
-
const nextPage = () => setPage(prev => prev < pageLength ? prev + 1 : prev);
|
|
15
|
-
|
|
16
|
-
const prevPage = () => setPage(prev => prev > 1 ? prev - 1 : prev);
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<PaginationContext.Provider value={{ page, pageLength, nextPage, prevPage }}>
|
|
20
|
-
{children}
|
|
21
|
-
</PaginationContext.Provider>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PasswordInputRoot } from "./PasswordInputRoot";
|
|
2
|
-
import { PasswordInputField } from "./PasswordInputField";
|
|
3
|
-
import { PasswordInputToggle } from "./PasswordInputToggle";
|
|
4
|
-
|
|
5
|
-
export const PasswordInput = Object.assign(PasswordInputRoot, {
|
|
6
|
-
Field: PasswordInputField,
|
|
7
|
-
Toggle: PasswordInputToggle
|
|
8
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createContext, Dispatch, SetStateAction } from "react";
|
|
2
|
-
|
|
3
|
-
export type PasswordInputContextT = {
|
|
4
|
-
isVisible: boolean;
|
|
5
|
-
setIsVisible: Dispatch<SetStateAction<boolean>>;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const PasswordInputContext = createContext<PasswordInputContextT>({} as PasswordInputContextT);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { InputHTMLAttributes, use } from "react";
|
|
4
|
-
|
|
5
|
-
import { PasswordInputContext } from "./PasswordInputContext";
|
|
6
|
-
|
|
7
|
-
export type PasswordInputFieldPropsT = InputHTMLAttributes<HTMLInputElement>;
|
|
8
|
-
|
|
9
|
-
export function PasswordInputField(props: PasswordInputFieldPropsT) {
|
|
10
|
-
const { isVisible } = use(PasswordInputContext);
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<input type={isVisible ? "text" : "password"} {...props} />
|
|
14
|
-
);
|
|
15
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { LabelHTMLAttributes, useState } from "react";
|
|
4
|
-
|
|
5
|
-
import { PasswordInputContext } from "./PasswordInputContext";
|
|
6
|
-
|
|
7
|
-
export type PasswordInputRootPropsT = LabelHTMLAttributes<HTMLLabelElement>;
|
|
8
|
-
|
|
9
|
-
export function PasswordInputRoot(props: PasswordInputRootPropsT) {
|
|
10
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<PasswordInputContext value={{ isVisible, setIsVisible }}>
|
|
14
|
-
<label {...props} />
|
|
15
|
-
</PasswordInputContext>
|
|
16
|
-
)
|
|
17
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { ButtonHTMLAttributes, use } from "react";
|
|
4
|
-
import { EyeClosedIcon, EyeIcon } from "lucide-react";
|
|
5
|
-
import { AnimatePresence, motion } from "framer-motion";
|
|
6
|
-
|
|
7
|
-
import { PasswordInputContext } from "./PasswordInputContext";
|
|
8
|
-
|
|
9
|
-
export type PasswordInputTogglePropsT = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
10
|
-
|
|
11
|
-
export function PasswordInputToggle({ onClick, children, ...props }: PasswordInputTogglePropsT) {
|
|
12
|
-
const { isVisible, setIsVisible } = use(PasswordInputContext);
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<button
|
|
16
|
-
type="button"
|
|
17
|
-
onClick={ev => {
|
|
18
|
-
setIsVisible(prev => !prev);
|
|
19
|
-
onClick?.(ev);
|
|
20
|
-
}}
|
|
21
|
-
{...props}
|
|
22
|
-
>
|
|
23
|
-
{children || (
|
|
24
|
-
<AnimatePresence initial={false} mode="wait">
|
|
25
|
-
{isVisible ? (
|
|
26
|
-
<motion.div
|
|
27
|
-
key="visible"
|
|
28
|
-
className="compatible-icon"
|
|
29
|
-
initial={{ opacity: 0, y: "-25%" }}
|
|
30
|
-
animate={{ opacity: 1, y: 0 }}
|
|
31
|
-
exit={{ opacity: 0, y: "25%" }}
|
|
32
|
-
transition={{ duration: 0.1 }}
|
|
33
|
-
>
|
|
34
|
-
<EyeIcon className="size-full" />
|
|
35
|
-
</motion.div>
|
|
36
|
-
) : (
|
|
37
|
-
<motion.div
|
|
38
|
-
key="hidden"
|
|
39
|
-
className="compatible-icon"
|
|
40
|
-
initial={{ opacity: 0, y: "-25%" }}
|
|
41
|
-
animate={{ opacity: 1, y: 0 }}
|
|
42
|
-
exit={{ opacity: 0, y: "25%" }}
|
|
43
|
-
transition={{ duration: 0.1 }}
|
|
44
|
-
>
|
|
45
|
-
<EyeClosedIcon className="size-full" />
|
|
46
|
-
</motion.div>
|
|
47
|
-
)}
|
|
48
|
-
</AnimatePresence>
|
|
49
|
-
)}
|
|
50
|
-
</button>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
import { PropsWithChildren } from "react";
|
|
5
|
-
|
|
6
|
-
export type PortalPropsT = PropsWithChildren & {
|
|
7
|
-
container?: Element;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function Portal({ children, container }: PortalPropsT) {
|
|
11
|
-
return createPortal(
|
|
12
|
-
<>
|
|
13
|
-
{children}
|
|
14
|
-
</>,
|
|
15
|
-
container || document.body
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { use } from "react";
|
|
4
|
-
import { cn } from "@kadoui/utils";
|
|
5
|
-
import { HTMLMotionProps, motion } from "framer-motion";
|
|
6
|
-
|
|
7
|
-
import { ProgressContext } from "./ProgressContext";
|
|
8
|
-
|
|
9
|
-
export type ProgressBarPropsT = HTMLMotionProps<"div"> & {
|
|
10
|
-
duration?: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function ProgressBar({ className, duration, children, ...p }: ProgressBarPropsT) {
|
|
14
|
-
const { value, maxValue } = use(ProgressContext);
|
|
15
|
-
|
|
16
|
-
const percentage = Math.min(100, Math.max(0, (value / maxValue) * 100));
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<motion.div
|
|
20
|
-
className={cn("f-center h-full bg-palette text-brush max-w-full", className)}
|
|
21
|
-
initial={{ width: 0 }}
|
|
22
|
-
whileInView={{ width: `${percentage}%` }}
|
|
23
|
-
transition={{ duration: duration || 3 }}
|
|
24
|
-
{...p}
|
|
25
|
-
>
|
|
26
|
-
{children || <span className="text-xs">{percentage}%</span>}
|
|
27
|
-
</motion.div>
|
|
28
|
-
)
|
|
29
|
-
}
|