@kadoui/react 1.0.0 → 1.0.1
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.jsx +1 -1
- package/dist/components/Affix/Affix.jsx +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsItem.jsx +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsRoot.jsx +1 -1
- package/dist/components/Carousel/CarouselContainer.jsx +1 -1
- package/dist/components/Carousel/CarouselRoot.jsx +1 -1
- package/dist/components/ContextMenu/ContextMenuContent.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenuContent.jsx +2 -1
- package/dist/components/ContextMenu/ContextMenuRoot.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenuRoot.jsx +1 -1
- package/dist/components/Drawer/DrawerBody.jsx +1 -1
- package/dist/components/Drawer/DrawerPortal.jsx +1 -1
- package/dist/components/Drawer/DrawerRoot.jsx +1 -1
- package/dist/components/Dropdown/DropdownMenu.d.ts.map +1 -1
- package/dist/components/Dropdown/DropdownMenu.jsx +1 -1
- package/dist/components/Dropdown/DropdownRoot.d.ts.map +1 -1
- package/dist/components/Dropdown/DropdownRoot.jsx +2 -1
- package/dist/components/LinkLoader/LinkLoader.jsx +1 -1
- package/dist/components/Modal/ModalBody.jsx +1 -1
- package/dist/components/Modal/ModalContent.jsx +1 -1
- package/dist/components/Modal/ModalHeader.jsx +1 -1
- package/dist/components/Modal/ModalPortal.jsx +1 -1
- package/dist/components/Modal/ModalRoot.d.ts.map +1 -1
- package/dist/components/Modal/ModalRoot.jsx +1 -1
- package/dist/components/Otp/OtpInputs.jsx +1 -1
- package/dist/components/Otp/OtpRoot.jsx +1 -1
- package/dist/components/Progress/ProgressBar.jsx +1 -1
- package/dist/components/Progress/ProgressRoot.jsx +1 -1
- package/dist/components/Rating/RatingItems.jsx +1 -1
- package/dist/components/Rating/RatingRoot.jsx +1 -1
- package/dist/components/Sheet/SheetBody.jsx +1 -1
- package/dist/components/Sheet/SheetContent.jsx +1 -1
- package/dist/components/Sheet/SheetHeader.jsx +1 -1
- package/dist/components/Sheet/SheetPortal.jsx +1 -1
- package/dist/components/ShowMore/ShowMoreContent.jsx +1 -1
- package/dist/components/ShowMore/ShowMoreFade.jsx +1 -1
- package/dist/components/ShowMore/ShowMoreRoot.jsx +1 -1
- package/dist/components/ShowMore/ShowMoreTrigger.jsx +1 -1
- package/dist/components/Slide/SlideContent.jsx +1 -1
- package/dist/components/Slide/SlideHeader.jsx +1 -1
- package/dist/components/Slide/SlidePortal.jsx +1 -1
- package/dist/components/Spoiler/Spoiler.jsx +1 -1
- package/dist/components/Steps/StepsControls.jsx +1 -1
- package/dist/components/Tabs/TabsList.jsx +1 -1
- package/dist/components/Tabs/TabsPanel.jsx +1 -1
- package/dist/components/Toast/ToastBox.jsx +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- 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/package.json +4 -3
- 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/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
### Kadoui primitive components for React
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessNavigation.d.ts","sourceRoot":"","sources":["../../../src/components/AccessNavigation/AccessNavigation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAiB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AccessNavigation.d.ts","sourceRoot":"","sources":["../../../src/components/AccessNavigation/AccessNavigation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAiB,MAAM,OAAO,CAAC;AAItD,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACpE,SAAS,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;CACvB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAAE,SAAe,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,EAAE,sBAAsB,+BAoCjG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { selectAccessibleChildren } from "
|
|
2
|
+
import { selectAccessibleChildren } from "../../utils/browser";
|
|
3
3
|
export function AccessNavigation({ direction = "y", dir, onKeyDown, ...p }) {
|
|
4
4
|
const handleKeyDown = (ev) => {
|
|
5
5
|
const focusableChildren = selectAccessibleChildren(ev.currentTarget);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "
|
|
2
|
+
import { cn } from "../../utils/cn";
|
|
3
3
|
import { ChevronUpIcon } from "lucide-react";
|
|
4
4
|
import { useState, useEffect } from "react";
|
|
5
5
|
export const Affix = ({ className, onClick, "aria-label": ariaLabel, children, ...props }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "
|
|
2
|
+
import { cn } from "../../utils/cn";
|
|
3
3
|
import { BreadcrumbsContext } from "./BreadcrumbsContext";
|
|
4
4
|
export function BreadcrumbsRoot({ separator = "/", className, ...p }) {
|
|
5
5
|
return (<BreadcrumbsContext value={{ separator }}>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuContent.d.ts","sourceRoot":"","sources":["../../../src/components/ContextMenu/ContextMenuContent.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAkB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextMenuContent.d.ts","sourceRoot":"","sources":["../../../src/components/ContextMenu/ContextMenuContent.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAkB,MAAM,OAAO,CAAC;AAOvD,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEtE,wBAAgB,kBAAkB,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,EAAE,wBAAwB,+BAyC9F"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { use, useEffect } from "react";
|
|
3
|
-
import { cn
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
|
+
import { selectAccessibleChildren } from "../../utils/browser";
|
|
4
5
|
import { ContextMenuContext } from "./ContextMenuContext";
|
|
5
6
|
export function ContextMenuContent({ onContextMenu, className, ...p }) {
|
|
6
7
|
const { contentRef, position, isOpen } = use(ContextMenuContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuRoot.d.ts","sourceRoot":"","sources":["../../../src/components/ContextMenu/ContextMenuRoot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContextMenuRoot.d.ts","sourceRoot":"","sources":["../../../src/components/ContextMenu/ContextMenuRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAwD,MAAM,OAAO,CAAC;AAK7F,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEnE,wBAAgB,eAAe,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,EAAE,qBAAqB,+BAqE7E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getBrowserScrollbarWith } from "kadoui-utils";
|
|
3
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { getBrowserScrollbarWith } from "../../utils/browser";
|
|
4
4
|
import { ContextMenuContext } from "./ContextMenuContext";
|
|
5
5
|
export function ContextMenuRoot({ onContextMenu, ...p }) {
|
|
6
6
|
const [position, setPosition] = useState(undefined);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { use } from "react";
|
|
3
|
-
import { cn } from "
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
4
|
import { motion, AnimatePresence } from "framer-motion";
|
|
5
5
|
import { Portal } from "../Portal/Portal";
|
|
6
6
|
import { DrawerContext } from "./DrawerContext";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getBrowserScrollbarWith } from "
|
|
2
|
+
import { getBrowserScrollbarWith } from "../../utils/browser";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
4
|
import { DrawerContext } from "./DrawerContext";
|
|
5
5
|
export function DrawerRoot({ children }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/components/Dropdown/DropdownMenu.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/components/Dropdown/DropdownMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAO,MAAM,OAAO,CAAC;AAK5C,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAChE,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAA;AAED,wBAAgB,YAAY,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,EAAE,kBAAkB,sCAsB1F"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "kadoui-utils";
|
|
3
2
|
import { use } from "react";
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
4
|
import { DropdownContext } from "./DropdownContext";
|
|
5
5
|
export function DropdownMenu({ preventClose, onClick, className, ...p }) {
|
|
6
6
|
const { menuRef, isOpen } = use(DropdownContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Dropdown/DropdownRoot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DropdownRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Dropdown/DropdownRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAA8C,MAAM,OAAO,CAAC;AAQnF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAChE,sBAAsB,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACrD,CAAA;AAED,wBAAgB,YAAY,CAAC,EAAE,sBAAsB,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,EAAE,kBAAkB,+BA6EtG"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn, selectAccessibleChildren } from "kadoui-utils";
|
|
3
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
|
+
import { selectAccessibleChildren } from "../../utils/browser";
|
|
4
5
|
import { DropdownContext } from "./DropdownContext";
|
|
5
6
|
export function DropdownRoot({ accessHorizontalArrows, onKeyDown, className, ...p }) {
|
|
6
7
|
const [isOpen, setOpen] = useState(false);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn } from "
|
|
1
|
+
import { cn } from "../../utils/cn";
|
|
2
2
|
export function ModalHeader({ className, ...props }) {
|
|
3
3
|
return (<div className={cn("h-16 f-align px-3 bg-background rounded-t-2xl border-b border-separator sticky top-0", className)} {...props}/>);
|
|
4
4
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { use } from "react";
|
|
3
|
-
import { cn } from "
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
4
|
import { motion, AnimatePresence } from "framer-motion";
|
|
5
5
|
import { Portal } from "../Portal/Portal";
|
|
6
6
|
import { ModalContext } from "./ModalContext";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ModalRoot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ModalRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ModalRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuB,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAM/D,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAA;AAED,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,WAAmB,EAAE,EAAE,eAAe,+BAmC3E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getBrowserScrollbarWith } from "kadoui-utils";
|
|
3
2
|
import { useState, useEffect } from "react";
|
|
3
|
+
import { getBrowserScrollbarWith } from "../../utils/browser";
|
|
4
4
|
import { ModalContext } from "./ModalContext";
|
|
5
5
|
export function ModalRoot({ children, defaultOpen = false }) {
|
|
6
6
|
const [isOpen, setOpen] = useState(defaultOpen);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { use } from "react";
|
|
3
|
-
import { cn } from "
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
4
|
import { motion } from "framer-motion";
|
|
5
5
|
import { ProgressContext } from "./ProgressContext";
|
|
6
6
|
export function ProgressBar({ className, duration, children, ...p }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "
|
|
2
|
+
import { cn } from "../../utils/cn";
|
|
3
3
|
import { ProgressContext } from "./ProgressContext";
|
|
4
4
|
export function ProgressRoot({ value, maxValue = 100, className, ...p }) {
|
|
5
5
|
return (<ProgressContext value={{ value, maxValue }}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { use } from "react";
|
|
3
|
-
import { cn } from "
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
4
|
import { AnimatePresence, motion } from "framer-motion";
|
|
5
5
|
import { Portal } from "../Portal/Portal";
|
|
6
6
|
import { SheetContext } from "./SheetContext";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "
|
|
2
|
+
import { cn } from "../../utils/cn";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { ShowMoreContext } from "./ShowMoreContext";
|
|
5
5
|
export function ShowMoreRoot({ maxLines, defaultExpanded = false, className, ...p }) {
|
package/dist/index.d.ts
CHANGED
|
@@ -26,4 +26,7 @@ export * from "./components/Swap/Swap";
|
|
|
26
26
|
export * from "./components/Tabs/Tabs";
|
|
27
27
|
export * from "./components/Toast/Toast";
|
|
28
28
|
export * from "./components/Toggle/Toggle";
|
|
29
|
+
export * from "./utils/browser";
|
|
30
|
+
export * from "./utils/cn";
|
|
31
|
+
export * from "./utils/form";
|
|
29
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Components
|
|
1
2
|
export * from "./components/AccessNavigation/AccessNavigation";
|
|
2
3
|
export * from "./components/Accordion/Accordion";
|
|
3
4
|
export * from "./components/Affix/Affix";
|
|
@@ -26,3 +27,7 @@ export * from "./components/Swap/Swap";
|
|
|
26
27
|
export * from "./components/Tabs/Tabs";
|
|
27
28
|
export * from "./components/Toast/Toast";
|
|
28
29
|
export * from "./components/Toggle/Toggle";
|
|
30
|
+
// Utils
|
|
31
|
+
export * from "./utils/browser";
|
|
32
|
+
export * from "./utils/cn";
|
|
33
|
+
export * from "./utils/form";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/utils/browser.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,cAenC,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,QAAQ,WAAW,kBAY3D,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const getBrowserScrollbarWith = () => {
|
|
2
|
+
const outer = document.createElement("div");
|
|
3
|
+
outer.style.visibility = "hidden";
|
|
4
|
+
outer.style.overflow = "scroll";
|
|
5
|
+
document.body.appendChild(outer);
|
|
6
|
+
const inner = document.createElement("div");
|
|
7
|
+
outer.appendChild(inner);
|
|
8
|
+
const scrollbarWidth = (outer.offsetWidth - inner.offsetWidth);
|
|
9
|
+
outer.parentNode?.removeChild(outer);
|
|
10
|
+
return scrollbarWidth;
|
|
11
|
+
};
|
|
12
|
+
export const selectAccessibleChildren = (parent) => {
|
|
13
|
+
const children = Array.from(parent.querySelectorAll(`
|
|
14
|
+
a:not([tabindex="-1"]),
|
|
15
|
+
input:not([disabled],[tabindex="-1"]),
|
|
16
|
+
select:not([disabled],[tabindex="-1"]),
|
|
17
|
+
textarea:not([disabled],[tabindex="-1"]),
|
|
18
|
+
button:not([disabled],[tabindex="-1"])
|
|
19
|
+
`));
|
|
20
|
+
return children;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAE7C,eAAO,MAAM,EAAE,GAAI,GAAG,QAAQ,UAAU,EAAE,WAA0B,CAAC"}
|
package/dist/utils/cn.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/utils/form.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,WAUvD,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kadoui/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Kadoui primitive components for React",
|
|
5
5
|
"author": "Jstation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"component"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@kadoui/utils": "workspace:*",
|
|
25
24
|
"react": "19.1.0",
|
|
26
25
|
"react-dom": "19.1.0",
|
|
27
26
|
"next": "15.4.5",
|
|
@@ -30,7 +29,9 @@
|
|
|
30
29
|
"lucide-react": "^0.525.0",
|
|
31
30
|
"qrcode": "^1.5.4",
|
|
32
31
|
"zustand": "^5.0.6",
|
|
33
|
-
"nanoid": "^5.1.5"
|
|
32
|
+
"nanoid": "^5.1.5",
|
|
33
|
+
"clsx": "^2.1.1",
|
|
34
|
+
"tailwind-merge": "^3.3.1"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@repo/tsconfig": "workspace:*",
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { HTMLAttributes, KeyboardEvent } from "react";
|
|
4
|
-
import { selectAccessibleChildren } from "@kadoui/utils";
|
|
5
|
-
|
|
6
|
-
export type AccessNavigationPropsT = HTMLAttributes<HTMLDivElement> & {
|
|
7
|
-
direction?: "y" | "x";
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function AccessNavigation({ direction = "y", dir, onKeyDown, ...p }: AccessNavigationPropsT) {
|
|
11
|
-
const handleKeyDown = (ev: KeyboardEvent<HTMLDivElement>) => {
|
|
12
|
-
const focusableChildren = selectAccessibleChildren(ev.currentTarget);
|
|
13
|
-
|
|
14
|
-
if (!focusableChildren.length) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const currentDir: "ltr" | "rtl" = (dir || document.documentElement.getAttribute("dir") || "ltr") as ("ltr" | "rtl");
|
|
19
|
-
|
|
20
|
-
const currentIndex = focusableChildren.findIndex((item) => item === document.activeElement);
|
|
21
|
-
|
|
22
|
-
if (ev.key === (direction === "y" ? "ArrowDown" : (currentDir === "ltr" ? "ArrowRight" : "ArrowLeft"))) {
|
|
23
|
-
ev.preventDefault();
|
|
24
|
-
const nextIndex =
|
|
25
|
-
currentIndex === -1 || currentIndex === focusableChildren.length - 1 ? 0 : currentIndex + 1;
|
|
26
|
-
focusableChildren[nextIndex]?.focus();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (ev.key === (direction === "y" ? "ArrowUp" : (currentDir === "ltr" ? "ArrowLeft" : "ArrowRight"))) {
|
|
30
|
-
ev.preventDefault();
|
|
31
|
-
const prevIndex = currentIndex <= 0 ? focusableChildren.length - 1 : currentIndex - 1;
|
|
32
|
-
focusableChildren[prevIndex]?.focus();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<div
|
|
38
|
-
dir={dir}
|
|
39
|
-
onKeyDown={ev => {
|
|
40
|
-
onKeyDown?.(ev);
|
|
41
|
-
handleKeyDown(ev);
|
|
42
|
-
}}
|
|
43
|
-
{...p}
|
|
44
|
-
/>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AccordionBody } from "./AccordionBody";
|
|
2
|
-
import { AccordionRoot } from "./AccordionRoot";
|
|
3
|
-
import { AccordionToggle } from "./AccordionToggle";
|
|
4
|
-
|
|
5
|
-
export const Accordion = Object.assign(AccordionRoot, {
|
|
6
|
-
Toggle: AccordionToggle,
|
|
7
|
-
Body: AccordionBody
|
|
8
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { cn } from "@kadoui/utils";
|
|
4
|
-
import { ReactNode, use } from "react";
|
|
5
|
-
import { AnimatePresence, HTMLMotionProps, motion } from "framer-motion";
|
|
6
|
-
|
|
7
|
-
import { AccordionContext } from "./AccordionContext";
|
|
8
|
-
|
|
9
|
-
export type AccordionBodyPropsT = HTMLMotionProps<"div">;
|
|
10
|
-
|
|
11
|
-
export function AccordionBody({ children, className, ...props }: AccordionBodyPropsT) {
|
|
12
|
-
const { isOpen } = use(AccordionContext);
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<AnimatePresence>
|
|
16
|
-
{isOpen ?
|
|
17
|
-
<motion.div
|
|
18
|
-
className={cn("overflow-hidden", className)}
|
|
19
|
-
initial={{ height: 0, opacity: 0 }}
|
|
20
|
-
animate={{ height: "auto", opacity: 1 }}
|
|
21
|
-
exit={{ height: 0, opacity: 0 }}
|
|
22
|
-
{...props}
|
|
23
|
-
>
|
|
24
|
-
<div className="m-3">
|
|
25
|
-
{children as ReactNode}
|
|
26
|
-
</div>
|
|
27
|
-
</motion.div>
|
|
28
|
-
: null}
|
|
29
|
-
</AnimatePresence>
|
|
30
|
-
)
|
|
31
|
-
}
|