@kadoui/react 2.1.6 → 2.2.7
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 -1
- package/dist/react-components/AccessNavigation/AccessNavigation.d.ts +2 -2
- package/dist/react-components/AccessNavigation/AccessNavigation.d.ts.map +1 -1
- package/dist/react-components/AccessNavigation/AccessNavigation.js +8 -7
- package/dist/react-components/Accordion/Accordion.d.ts +4 -0
- package/dist/react-components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/react-components/Accordion/Accordion.js +5 -1
- package/dist/react-components/Accordion/AccordionBody.d.ts +1 -1
- package/dist/react-components/Accordion/AccordionBody.d.ts.map +1 -1
- package/dist/react-components/Accordion/AccordionBody.js +6 -3
- package/dist/react-components/Accordion/AccordionContent.d.ts +3 -0
- package/dist/react-components/Accordion/AccordionContent.d.ts.map +1 -0
- package/dist/react-components/Accordion/AccordionContent.js +5 -0
- package/dist/react-components/Accordion/AccordionContext.d.ts +9 -2
- package/dist/react-components/Accordion/AccordionContext.d.ts.map +1 -1
- package/dist/react-components/Accordion/AccordionContext.js +1 -0
- package/dist/react-components/Accordion/AccordionItem.d.ts +3 -0
- package/dist/react-components/Accordion/AccordionItem.d.ts.map +1 -0
- package/dist/react-components/Accordion/AccordionItem.js +5 -0
- package/dist/react-components/Accordion/AccordionItemContext.d.ts +3 -0
- package/dist/react-components/Accordion/AccordionItemContext.d.ts.map +1 -0
- package/dist/react-components/Accordion/AccordionItemContext.js +3 -0
- package/dist/react-components/Accordion/AccordionRoot.d.ts +1 -1
- package/dist/react-components/Accordion/AccordionRoot.d.ts.map +1 -1
- package/dist/react-components/Accordion/AccordionRoot.js +3 -4
- package/dist/react-components/Accordion/AccordionToggle.d.ts +1 -1
- package/dist/react-components/Accordion/AccordionToggle.d.ts.map +1 -1
- package/dist/react-components/Accordion/AccordionToggle.js +23 -5
- package/dist/react-components/Accordion/accordionTypes.d.ts +21 -6
- package/dist/react-components/Accordion/accordionTypes.d.ts.map +1 -1
- package/dist/react-components/Affix/Affix.d.ts +1 -1
- package/dist/react-components/Affix/Affix.d.ts.map +1 -1
- package/dist/react-components/Affix/Affix.js +3 -2
- package/dist/react-components/Affix/affixTypes.d.ts +3 -1
- package/dist/react-components/Affix/affixTypes.d.ts.map +1 -1
- package/dist/react-components/Carousel/CarouselNextBtn.d.ts +1 -1
- package/dist/react-components/Carousel/CarouselNextBtn.d.ts.map +1 -1
- package/dist/react-components/Carousel/CarouselNextBtn.js +2 -2
- package/dist/react-components/Carousel/CarouselPrevBtn.d.ts +1 -1
- package/dist/react-components/Carousel/CarouselPrevBtn.d.ts.map +1 -1
- package/dist/react-components/Carousel/CarouselPrevBtn.js +2 -2
- package/dist/react-components/Choice/Choice.d.ts +0 -2
- package/dist/react-components/Choice/Choice.d.ts.map +1 -1
- package/dist/react-components/Choice/Choice.js +0 -2
- package/dist/react-components/Choice/ChoiceRoot.d.ts +1 -1
- package/dist/react-components/Choice/ChoiceRoot.d.ts.map +1 -1
- package/dist/react-components/Choice/ChoiceRoot.js +3 -2
- package/dist/react-components/Choice/ChoiceThumb.d.ts.map +1 -1
- package/dist/react-components/Choice/ChoiceThumb.js +1 -0
- package/dist/react-components/Choice/ChoiceToggle.d.ts.map +1 -1
- package/dist/react-components/Choice/ChoiceToggle.js +9 -9
- package/dist/react-components/Choice/choiceTypes.d.ts +9 -10
- package/dist/react-components/Choice/choiceTypes.d.ts.map +1 -1
- package/dist/react-components/Clipboard/Clipboard.d.ts +1 -1
- package/dist/react-components/Clipboard/Clipboard.d.ts.map +1 -1
- package/dist/react-components/Clipboard/Clipboard.js +2 -2
- package/dist/react-components/ContextMenu/ContextMenu.d.ts +0 -2
- package/dist/react-components/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/react-components/ContextMenu/ContextMenu.js +0 -2
- package/dist/react-components/ContextMenu/ContextMenuBody.d.ts.map +1 -1
- package/dist/react-components/ContextMenu/ContextMenuBody.js +5 -1
- package/dist/react-components/ContextMenu/ContextMenuContent.d.ts +3 -0
- package/dist/react-components/ContextMenu/ContextMenuContent.d.ts.map +1 -0
- package/dist/react-components/ContextMenu/ContextMenuContent.js +8 -0
- package/dist/react-components/ContextMenu/ContextMenuContext.d.ts.map +1 -1
- package/dist/react-components/ContextMenu/ContextMenuContext.js +1 -0
- package/dist/react-components/ContextMenu/ContextMenuRoot.d.ts.map +1 -1
- package/dist/react-components/ContextMenu/ContextMenuRoot.js +13 -2
- package/dist/react-components/ContextMenu/contextMenuTypes.d.ts +1 -2
- package/dist/react-components/ContextMenu/contextMenuTypes.d.ts.map +1 -1
- package/dist/react-components/Drawer/DrawerBody.js +1 -1
- package/dist/react-components/Drawer/DrawerContext.d.ts.map +1 -1
- package/dist/react-components/Drawer/DrawerContext.js +1 -0
- package/dist/react-components/Drawer/DrawerPortal.js +1 -1
- package/dist/react-components/Drawer/DrawerRoot.d.ts.map +1 -1
- package/dist/react-components/Drawer/DrawerRoot.js +1 -1
- package/dist/react-components/Drawer/DrawerToggle.d.ts +1 -1
- package/dist/react-components/Drawer/DrawerToggle.d.ts.map +1 -1
- package/dist/react-components/Drawer/DrawerToggle.js +5 -5
- package/dist/react-components/Drawer/drawerTypes.d.ts +3 -3
- package/dist/react-components/Drawer/drawerTypes.d.ts.map +1 -1
- package/dist/react-components/Modal/ModalPortal.d.ts.map +1 -1
- package/dist/react-components/Modal/ModalPortal.js +1 -1
- package/dist/react-components/Modal/ModalRoot.d.ts.map +1 -1
- package/dist/react-components/Modal/ModalRoot.js +2 -2
- package/dist/react-components/Modal/ModalToggle.d.ts +1 -1
- package/dist/react-components/Modal/ModalToggle.d.ts.map +1 -1
- package/dist/react-components/Modal/ModalToggle.js +5 -5
- package/dist/react-components/Modal/modalTypes.d.ts +3 -3
- package/dist/react-components/Modal/modalTypes.d.ts.map +1 -1
- package/dist/react-components/Otp/OtpInputs.d.ts +1 -1
- package/dist/react-components/Otp/OtpInputs.d.ts.map +1 -1
- package/dist/react-components/Otp/OtpInputs.js +2 -2
- package/dist/react-components/PasswordInput/PasswordInputContext.d.ts.map +1 -1
- package/dist/react-components/PasswordInput/PasswordInputContext.js +1 -0
- package/dist/react-components/PasswordInput/PasswordInputField.d.ts +1 -1
- package/dist/react-components/PasswordInput/PasswordInputField.d.ts.map +1 -1
- package/dist/react-components/PasswordInput/PasswordInputField.js +2 -2
- package/dist/react-components/PasswordInput/PasswordInputRoot.d.ts +1 -1
- package/dist/react-components/PasswordInput/PasswordInputRoot.d.ts.map +1 -1
- package/dist/react-components/PasswordInput/PasswordInputRoot.js +2 -2
- package/dist/react-components/PasswordInput/PasswordInputToggle.d.ts +1 -1
- package/dist/react-components/PasswordInput/PasswordInputToggle.d.ts.map +1 -1
- package/dist/react-components/PasswordInput/PasswordInputToggle.js +4 -4
- package/dist/react-components/PasswordInput/passwordInputTypes.d.ts +3 -3
- package/dist/react-components/PasswordInput/passwordInputTypes.d.ts.map +1 -1
- package/dist/react-components/Popover/Popover.d.ts +0 -2
- package/dist/react-components/Popover/Popover.d.ts.map +1 -1
- package/dist/react-components/Popover/Popover.js +0 -2
- package/dist/react-components/Popover/PopoverBody.d.ts +1 -1
- package/dist/react-components/Popover/PopoverBody.d.ts.map +1 -1
- package/dist/react-components/Popover/PopoverBody.js +2 -2
- package/dist/react-components/Popover/PopoverContext.d.ts.map +1 -1
- package/dist/react-components/Popover/PopoverContext.js +1 -0
- package/dist/react-components/Popover/PopoverRoot.d.ts.map +1 -1
- package/dist/react-components/Popover/PopoverRoot.js +3 -2
- package/dist/react-components/Popover/PopoverToggle.d.ts +1 -1
- package/dist/react-components/Popover/PopoverToggle.d.ts.map +1 -1
- package/dist/react-components/Popover/PopoverToggle.js +4 -4
- package/dist/react-components/Popover/popoverTypes.d.ts +4 -5
- package/dist/react-components/Popover/popoverTypes.d.ts.map +1 -1
- package/dist/react-components/SelectBox/SelectBoxInput.d.ts.map +1 -1
- package/dist/react-components/SelectBox/SelectBoxInput.js +1 -0
- package/dist/react-components/SelectBox/SelectBoxList.d.ts +1 -1
- package/dist/react-components/SelectBox/SelectBoxList.d.ts.map +1 -1
- package/dist/react-components/SelectBox/SelectBoxList.js +1 -2
- package/dist/react-components/SelectBox/SelectBoxRoot.d.ts.map +1 -1
- package/dist/react-components/SelectBox/SelectBoxRoot.js +12 -2
- package/dist/react-components/SelectBox/SelectBoxSearchInput.d.ts.map +1 -1
- package/dist/react-components/SelectBox/SelectBoxSearchInput.js +1 -0
- package/dist/react-components/SelectBox/selectBoxTypes.d.ts +7 -7
- package/dist/react-components/SelectBox/selectBoxTypes.d.ts.map +1 -1
- package/dist/react-components/Sheet/SheetBody.d.ts.map +1 -1
- package/dist/react-components/Sheet/SheetBody.js +1 -1
- package/dist/react-components/Sheet/SheetContext.d.ts.map +1 -1
- package/dist/react-components/Sheet/SheetContext.js +1 -0
- package/dist/react-components/Sheet/SheetPortal.js +1 -1
- package/dist/react-components/Sheet/SheetRoot.d.ts.map +1 -1
- package/dist/react-components/Sheet/SheetRoot.js +2 -2
- package/dist/react-components/Sheet/SheetToggle.d.ts +1 -1
- package/dist/react-components/Sheet/SheetToggle.d.ts.map +1 -1
- package/dist/react-components/Sheet/SheetToggle.js +5 -5
- package/dist/react-components/Sheet/sheetTypes.d.ts +3 -3
- package/dist/react-components/Sheet/sheetTypes.d.ts.map +1 -1
- package/dist/react-components/ShowMore/ShowMore.d.ts +1 -1
- package/dist/react-components/ShowMore/ShowMore.d.ts.map +1 -1
- package/dist/react-components/ShowMore/ShowMore.js +1 -1
- package/dist/react-components/ShowMore/ShowMoreContent.d.ts +1 -1
- package/dist/react-components/ShowMore/ShowMoreContent.d.ts.map +1 -1
- package/dist/react-components/ShowMore/ShowMoreContent.js +2 -2
- package/dist/react-components/ShowMore/ShowMoreContext.d.ts.map +1 -1
- package/dist/react-components/ShowMore/ShowMoreContext.js +1 -0
- package/dist/react-components/ShowMore/ShowMoreToggle.d.ts.map +1 -1
- package/dist/react-components/ShowMore/ShowMoreToggle.js +3 -3
- package/dist/react-components/ShowMore/showMoreTypes.d.ts +3 -3
- package/dist/react-components/ShowMore/showMoreTypes.d.ts.map +1 -1
- package/dist/react-components/Spoiler/SpoilerContext.d.ts.map +1 -1
- package/dist/react-components/Spoiler/SpoilerContext.js +1 -0
- package/dist/react-components/Spoiler/SpoilerRoot.js +1 -1
- package/dist/react-components/Spoiler/spoilerTypes.d.ts +2 -2
- package/dist/react-components/Spoiler/spoilerTypes.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/browser.d.ts +1 -1
- package/dist/utils/browser.d.ts.map +1 -1
- package/dist/utils/browser.js +32 -9
- package/package.json +48 -49
package/README.md
CHANGED
|
@@ -93,7 +93,7 @@ Add keyboard navigation (arrow keys) to your UI elements.
|
|
|
93
93
|
|
|
94
94
|
**Props:**
|
|
95
95
|
- `direction: "x" | "y"` - Navigation direction
|
|
96
|
-
- `
|
|
96
|
+
- `focusTrap?: boolean` - Auto-focus first element on mount
|
|
97
97
|
- `dir?: "ltr" | "rtl"` - Text direction (defaults to document direction)
|
|
98
98
|
|
|
99
99
|
**Example:**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, RefObject } from "react";
|
|
2
2
|
export type AccessNavigationPropsT = ComponentPropsWithoutRef<"div"> & {
|
|
3
3
|
direction: "y" | "x";
|
|
4
|
-
|
|
4
|
+
focusTrap?: any;
|
|
5
5
|
ref?: RefObject<HTMLDivElement | null>;
|
|
6
6
|
};
|
|
7
|
-
export declare function AccessNavigation({ ref,
|
|
7
|
+
export declare function AccessNavigation({ ref, focusTrap, direction, dir, onKeyDown, ...p }: AccessNavigationPropsT): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
//# sourceMappingURL=AccessNavigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessNavigation.d.ts","sourceRoot":"","sources":["../../../src/react-components/AccessNavigation/AccessNavigation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAiB,SAAS,EAAqB,MAAM,OAAO,CAAC;AAI9F,MAAM,MAAM,sBAAsB,GAAG,wBAAwB,CAAC,KAAK,CAAC,GAAG;IACrE,SAAS,EAAE,GAAG,GAAG,GAAG,CAAC;IACrB,
|
|
1
|
+
{"version":3,"file":"AccessNavigation.d.ts","sourceRoot":"","sources":["../../../src/react-components/AccessNavigation/AccessNavigation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAiB,SAAS,EAAqB,MAAM,OAAO,CAAC;AAI9F,MAAM,MAAM,sBAAsB,GAAG,wBAAwB,CAAC,KAAK,CAAC,GAAG;IACrE,SAAS,EAAE,GAAG,GAAG,GAAG,CAAC;IACrB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,GAAG,CAAC,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CACxC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,SAAS,EACT,SAAS,EACT,GAAG,EACH,SAAS,EACT,GAAG,CAAC,EACL,EAAE,sBAAsB,2CAyExB"}
|
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useRef } from "react";
|
|
4
4
|
import { selectAccessibleChildren } from "../../utils-exports";
|
|
5
|
-
export function AccessNavigation({ ref,
|
|
5
|
+
export function AccessNavigation({ ref, focusTrap, direction, dir, onKeyDown, ...p }) {
|
|
6
6
|
const accessNavigationRef = ref || useRef(null);
|
|
7
7
|
useEffect(() => {
|
|
8
|
-
if (
|
|
9
|
-
return;
|
|
10
|
-
const focusableChildren = selectAccessibleChildren(accessNavigationRef.current);
|
|
11
|
-
if (focusOnMount) {
|
|
8
|
+
if (focusTrap) {
|
|
12
9
|
setTimeout(() => {
|
|
10
|
+
if (!accessNavigationRef.current)
|
|
11
|
+
return;
|
|
12
|
+
const focusableChildren = selectAccessibleChildren(accessNavigationRef.current);
|
|
13
13
|
focusableChildren[0]?.focus();
|
|
14
14
|
}, 150);
|
|
15
15
|
}
|
|
16
|
-
}, []);
|
|
16
|
+
}, [focusTrap]);
|
|
17
17
|
const handleKeyDown = (ev) => {
|
|
18
18
|
const focusableChildren = selectAccessibleChildren(ev.currentTarget);
|
|
19
|
-
|
|
19
|
+
console.log(focusableChildren);
|
|
20
|
+
if (focusableChildren.length < 2) {
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
22
23
|
const currentDir = (dir ||
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { AccordionBody } from "./AccordionBody";
|
|
2
2
|
import { AccordionRoot } from "./AccordionRoot";
|
|
3
|
+
import { AccordionItem } from "./AccordionItem";
|
|
3
4
|
import { AccordionToggle } from "./AccordionToggle";
|
|
5
|
+
import { AccordionContent } from "./AccordionContent";
|
|
4
6
|
export declare const Accordion: typeof AccordionRoot & {
|
|
7
|
+
Item: typeof AccordionItem;
|
|
5
8
|
Toggle: typeof AccordionToggle;
|
|
6
9
|
Body: typeof AccordionBody;
|
|
10
|
+
Content: typeof AccordionContent;
|
|
7
11
|
};
|
|
8
12
|
export * from "./accordionTypes";
|
|
9
13
|
//# sourceMappingURL=Accordion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/Accordion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/Accordion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,eAAO,MAAM,SAAS;;;;;CAKpB,CAAC;AAEH,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { AccordionBody } from "./AccordionBody";
|
|
2
2
|
import { AccordionRoot } from "./AccordionRoot";
|
|
3
|
+
import { AccordionItem } from "./AccordionItem";
|
|
3
4
|
import { AccordionToggle } from "./AccordionToggle";
|
|
5
|
+
import { AccordionContent } from "./AccordionContent";
|
|
4
6
|
export const Accordion = Object.assign(AccordionRoot, {
|
|
7
|
+
Item: AccordionItem,
|
|
5
8
|
Toggle: AccordionToggle,
|
|
6
|
-
Body: AccordionBody
|
|
9
|
+
Body: AccordionBody,
|
|
10
|
+
Content: AccordionContent,
|
|
7
11
|
});
|
|
8
12
|
export * from "./accordionTypes";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AccordionBodyPropsT } from "./accordionTypes";
|
|
2
|
-
export declare function AccordionBody({ children, ...
|
|
2
|
+
export declare function AccordionBody({ children, ...p }: AccordionBodyPropsT): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=AccordionBody.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionBody.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/AccordionBody.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"AccordionBody.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/AccordionBody.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,EAAE,mBAAmB,2CAoBpE"}
|
|
@@ -3,9 +3,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { use } from "react";
|
|
4
4
|
import { AnimatePresence, motion } from "framer-motion";
|
|
5
5
|
import { AccordionContext } from "./AccordionContext";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { AccordionItemContext } from "./AccordionItemContext";
|
|
7
|
+
export function AccordionBody({ children, ...p }) {
|
|
8
|
+
const { multiple, accordionState } = use(AccordionContext);
|
|
9
|
+
const { itemName } = use(AccordionItemContext);
|
|
10
|
+
const isOpen = multiple ? accordionState.includes(itemName) : accordionState === itemName;
|
|
8
11
|
return (_jsx(AnimatePresence, { children: isOpen ?
|
|
9
|
-
_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, ...
|
|
12
|
+
_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, ...p, children: children })
|
|
10
13
|
: null }));
|
|
11
14
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionContent.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/AccordionContent.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,sBAAsB,2CAIzD"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const AccordionContext: import("react").Context<{
|
|
2
|
+
multiple: true;
|
|
3
|
+
accordionState: string[];
|
|
4
|
+
onAccordionChange: (newItems: string[]) => void;
|
|
5
|
+
} | {
|
|
6
|
+
multiple?: false;
|
|
7
|
+
accordionState: string | null;
|
|
8
|
+
onAccordionChange: (newItems: string | null) => void;
|
|
9
|
+
}>;
|
|
3
10
|
//# sourceMappingURL=AccordionContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionContext.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/AccordionContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AccordionContext.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/AccordionContext.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB;;;;;;;;EAA4D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionItem.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/AccordionItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CAMxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionItemContext.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/AccordionItemContext.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,eAAO,MAAM,oBAAoB,gDAAoE,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AccordionRootPropsT } from "./accordionTypes";
|
|
2
|
-
export declare function AccordionRoot({
|
|
2
|
+
export declare function AccordionRoot({ multiple, accordionState, onAccordionChange, ...p }: AccordionRootPropsT): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=AccordionRoot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionRoot.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/AccordionRoot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AccordionRoot.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/AccordionRoot.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAqB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE/E,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,iBAAiB,EAAE,GAAG,CAAC,EAAE,EAAE,mBAAmB,2CAMvG"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
3
|
import { AccordionContext } from "./AccordionContext";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return (_jsx(AccordionContext, { value: {
|
|
4
|
+
import { AccessNavigation } from "../AccessNavigation/AccessNavigation";
|
|
5
|
+
export function AccordionRoot({ multiple, accordionState, onAccordionChange, ...p }) {
|
|
6
|
+
return (_jsx(AccordionContext, { value: { multiple, accordionState, onAccordionChange }, children: _jsx(AccessNavigation, { ...p }) }));
|
|
8
7
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AccordionTogglePropsT } from "./accordionTypes";
|
|
2
|
-
export declare function AccordionToggle({ onClick, ...
|
|
2
|
+
export declare function AccordionToggle({ onClick, ...p }: AccordionTogglePropsT): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=AccordionToggle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionToggle.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/AccordionToggle.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"AccordionToggle.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/AccordionToggle.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAG9D,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,EAAE,qBAAqB,2CA6BvE"}
|
|
@@ -2,10 +2,28 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { use } from "react";
|
|
4
4
|
import { AccordionContext } from "./AccordionContext";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { AccordionItemContext } from "./AccordionItemContext";
|
|
6
|
+
export function AccordionToggle({ onClick, ...p }) {
|
|
7
|
+
const { multiple, accordionState, onAccordionChange } = use(AccordionContext);
|
|
8
|
+
const { itemName } = use(AccordionItemContext);
|
|
9
|
+
const isOpen = multiple ? accordionState.includes(itemName) : accordionState === itemName;
|
|
10
|
+
return (_jsx("button", { type: "button", "data-state": isOpen, onClick: (ev) => {
|
|
8
11
|
onClick?.(ev);
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
if (isOpen) {
|
|
13
|
+
if (multiple) {
|
|
14
|
+
onAccordionChange(accordionState.filter(item => item !== itemName));
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
onAccordionChange(null);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
if (multiple) {
|
|
22
|
+
onAccordionChange([...accordionState, itemName]);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
onAccordionChange(itemName);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}, ...p }));
|
|
11
29
|
}
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import type { HTMLMotionProps } from "framer-motion";
|
|
2
|
-
import type { ComponentProps,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { ComponentProps, PropsWithChildren, ReactNode } from "react";
|
|
3
|
+
import { AccessNavigationPropsT } from "../AccessNavigation/AccessNavigation";
|
|
4
|
+
type MultipleModeT = {
|
|
5
|
+
multiple: true;
|
|
6
|
+
accordionState: string[];
|
|
7
|
+
onAccordionChange: (newItems: string[]) => void;
|
|
6
8
|
};
|
|
7
|
-
|
|
9
|
+
type SingleModeT = {
|
|
10
|
+
multiple?: false;
|
|
11
|
+
accordionState: string | null;
|
|
12
|
+
onAccordionChange: (newItems: string | null) => void;
|
|
13
|
+
};
|
|
14
|
+
type MergedModeT = SingleModeT | MultipleModeT;
|
|
15
|
+
export type AccordionContextT = MergedModeT;
|
|
16
|
+
export type AccordionRootPropsT = AccordionContextT & AccessNavigationPropsT;
|
|
17
|
+
export type AccordionItemContextT = {
|
|
18
|
+
itemName: string;
|
|
19
|
+
};
|
|
20
|
+
export type AccordionItemPropsT = AccordionItemContextT & PropsWithChildren;
|
|
8
21
|
export type AccordionBodyPropsT = HTMLMotionProps<"div">;
|
|
9
|
-
export type
|
|
22
|
+
export type AccordionContentPropsT = ComponentProps<"div">;
|
|
23
|
+
export type AccordionTogglePropsT = Omit<ComponentProps<"button">, "type"> & {
|
|
10
24
|
icon?: ReactNode;
|
|
11
25
|
};
|
|
26
|
+
export {};
|
|
12
27
|
//# sourceMappingURL=accordionTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordionTypes.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/accordionTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"accordionTypes.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/accordionTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,IAAI,CAAC;IACf,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACjD,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,KAAK,WAAW,GAAG,WAAW,GAAG,aAAa,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG,sBAAsB,CAAC;AAE7E,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,GAAG,iBAAiB,CAAC;AAE5E,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;AAEzD,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE3D,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAAG;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AffixPropsT } from "./affixTypes";
|
|
2
|
-
export declare const Affix: ({ onClick, ...p }: AffixPropsT) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Affix: ({ viewportOffset, onClick, ...p }: AffixPropsT) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=Affix.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Affix.d.ts","sourceRoot":"","sources":["../../../src/react-components/Affix/Affix.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,KAAK,GAAI,
|
|
1
|
+
{"version":3,"file":"Affix.d.ts","sourceRoot":"","sources":["../../../src/react-components/Affix/Affix.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,KAAK,GAAI,mCAAmC,WAAW,4CA6CnE,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
|
-
export const Affix = ({ onClick, ...p }) => {
|
|
4
|
+
export const Affix = ({ viewportOffset, onClick, ...p }) => {
|
|
5
5
|
const [isVisible, setIsVisible] = useState(false);
|
|
6
6
|
const [lastScrollY, setLastScrollY] = useState(0);
|
|
7
|
+
const VIEWPORT_OFFSET = viewportOffset || 0.5;
|
|
7
8
|
useEffect(() => {
|
|
8
9
|
const handleScroll = () => {
|
|
9
10
|
const currentScrollY = window.scrollY;
|
|
10
11
|
const viewportHeight = window.innerHeight;
|
|
11
|
-
const scrollThreshold = viewportHeight *
|
|
12
|
+
const scrollThreshold = viewportHeight * VIEWPORT_OFFSET;
|
|
12
13
|
if (currentScrollY > scrollThreshold && currentScrollY > lastScrollY) {
|
|
13
14
|
setIsVisible(true);
|
|
14
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affixTypes.d.ts","sourceRoot":"","sources":["../../../src/react-components/Affix/affixTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"affixTypes.d.ts","sourceRoot":"","sources":["../../../src/react-components/Affix/affixTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CarouselNextBtnPropsT } from "./carouselTypes";
|
|
2
|
-
export declare function CarouselNextBtn({ onClick, ...
|
|
2
|
+
export declare function CarouselNextBtn({ onClick, ...p }: CarouselNextBtnPropsT): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=CarouselNextBtn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselNextBtn.d.ts","sourceRoot":"","sources":["../../../src/react-components/Carousel/CarouselNextBtn.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"CarouselNextBtn.d.ts","sourceRoot":"","sources":["../../../src/react-components/Carousel/CarouselNextBtn.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,EAAE,qBAAqB,2CAYvE"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { use } from "react";
|
|
4
4
|
import { CarouselContext } from "./CarouselContext";
|
|
5
|
-
export function CarouselNextBtn({ onClick, ...
|
|
5
|
+
export function CarouselNextBtn({ onClick, ...p }) {
|
|
6
6
|
const { scrollRef, childrenWidth } = use(CarouselContext);
|
|
7
7
|
return (_jsx("button", { onClick: (ev) => {
|
|
8
8
|
onClick?.(ev);
|
|
9
9
|
scrollRef.current?.scrollTo(scrollRef.current.scrollLeft + childrenWidth, 0);
|
|
10
|
-
}, ...
|
|
10
|
+
}, ...p }));
|
|
11
11
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CarouselPrevBtnPropsT } from "./carouselTypes";
|
|
2
|
-
export declare function CarouselPrevBtn({ onClick, ...
|
|
2
|
+
export declare function CarouselPrevBtn({ onClick, ...p }: CarouselPrevBtnPropsT): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=CarouselPrevBtn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselPrevBtn.d.ts","sourceRoot":"","sources":["../../../src/react-components/Carousel/CarouselPrevBtn.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"CarouselPrevBtn.d.ts","sourceRoot":"","sources":["../../../src/react-components/Carousel/CarouselPrevBtn.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,EAAE,qBAAqB,2CAYvE"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { use } from "react";
|
|
4
4
|
import { CarouselContext } from "./CarouselContext";
|
|
5
|
-
export function CarouselPrevBtn({ onClick, ...
|
|
5
|
+
export function CarouselPrevBtn({ onClick, ...p }) {
|
|
6
6
|
const { scrollRef, childrenWidth } = use(CarouselContext);
|
|
7
7
|
return (_jsx("button", { onClick: (ev) => {
|
|
8
8
|
onClick?.(ev);
|
|
9
9
|
scrollRef.current?.scrollTo(scrollRef.current.scrollLeft - childrenWidth, 0);
|
|
10
|
-
}, ...
|
|
10
|
+
}, ...p }));
|
|
11
11
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ChoiceRoot } from "./ChoiceRoot";
|
|
2
2
|
import { ChoiceThumb } from "./ChoiceThumb";
|
|
3
3
|
import { ChoiceToggle } from "./ChoiceToggle";
|
|
4
|
-
import { ChoiceNavigation } from "./ChoiceNavigation";
|
|
5
4
|
export declare const Choice: typeof ChoiceRoot & {
|
|
6
|
-
Navigation: typeof ChoiceNavigation;
|
|
7
5
|
Toggle: typeof ChoiceToggle;
|
|
8
6
|
Thumb: typeof ChoiceThumb;
|
|
9
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Choice.d.ts","sourceRoot":"","sources":["../../../src/react-components/Choice/Choice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Choice.d.ts","sourceRoot":"","sources":["../../../src/react-components/Choice/Choice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,eAAO,MAAM,MAAM;;;CAGjB,CAAC;AAEH,cAAc,eAAe,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ChoiceRoot } from "./ChoiceRoot";
|
|
2
2
|
import { ChoiceThumb } from "./ChoiceThumb";
|
|
3
3
|
import { ChoiceToggle } from "./ChoiceToggle";
|
|
4
|
-
import { ChoiceNavigation } from "./ChoiceNavigation";
|
|
5
4
|
export const Choice = Object.assign(ChoiceRoot, {
|
|
6
|
-
Navigation: ChoiceNavigation,
|
|
7
5
|
Toggle: ChoiceToggle,
|
|
8
6
|
Thumb: ChoiceThumb
|
|
9
7
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ChoiceRootPropsT } from "./choiceTypes";
|
|
2
|
-
export declare function ChoiceRoot({ multiple,
|
|
2
|
+
export declare function ChoiceRoot({ multiple, choiceState, onChoiceChange, requiredOne, ...p }: ChoiceRootPropsT): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=ChoiceRoot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChoiceRoot.d.ts","sourceRoot":"","sources":["../../../src/react-components/Choice/ChoiceRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ChoiceRoot.d.ts","sourceRoot":"","sources":["../../../src/react-components/Choice/ChoiceRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtE,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,WAAW,EACX,GAAG,CAAC,EACL,EAAE,gBAAgB,2CAOlB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { ChoiceContext } from "./ChoiceContext";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { AccessNavigation } from "../AccessNavigation/AccessNavigation";
|
|
5
|
+
export function ChoiceRoot({ multiple, choiceState, onChoiceChange, requiredOne, ...p }) {
|
|
6
|
+
return (_jsx(ChoiceContext, { value: { multiple, choiceState, onChoiceChange, requiredOne }, children: _jsx(AccessNavigation, { ...p }) }));
|
|
6
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChoiceThumb.d.ts","sourceRoot":"","sources":["../../../src/react-components/Choice/ChoiceThumb.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChoiceThumb.d.ts","sourceRoot":"","sources":["../../../src/react-components/Choice/ChoiceThumb.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,wBAAgB,WAAW,CAAC,CAAC,EAAE,iBAAiB,2CAI/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChoiceToggle.d.ts","sourceRoot":"","sources":["../../../src/react-components/Choice/ChoiceToggle.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD,wBAAgB,YAAY,CAAC,EAC3B,UAAU,EACV,OAAO,EACP,GAAG,CAAC,EACL,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ChoiceToggle.d.ts","sourceRoot":"","sources":["../../../src/react-components/Choice/ChoiceToggle.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD,wBAAgB,YAAY,CAAC,EAC3B,UAAU,EACV,OAAO,EACP,GAAG,CAAC,EACL,EAAE,kBAAkB,2CAkCpB"}
|
|
@@ -3,30 +3,30 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { use } from "react";
|
|
4
4
|
import { ChoiceContext } from "./ChoiceContext";
|
|
5
5
|
export function ChoiceToggle({ choiceName, onClick, ...p }) {
|
|
6
|
-
const { multiple,
|
|
6
|
+
const { multiple, choiceState, onChoiceChange, requiredOne } = use(ChoiceContext);
|
|
7
7
|
const isActive = multiple
|
|
8
|
-
?
|
|
9
|
-
:
|
|
10
|
-
return (_jsx("button", { "data-state": isActive, onClick: (ev) => {
|
|
8
|
+
? choiceState.includes(choiceName)
|
|
9
|
+
: choiceState === choiceName;
|
|
10
|
+
return (_jsx("button", { type: "button", "data-state": isActive, onClick: (ev) => {
|
|
11
11
|
onClick?.(ev);
|
|
12
12
|
if (isActive) {
|
|
13
13
|
if (multiple) {
|
|
14
|
-
if (!requiredOne ||
|
|
15
|
-
|
|
14
|
+
if (!requiredOne || choiceState.length > 1) {
|
|
15
|
+
onChoiceChange(choiceState.filter((item) => item !== choiceName));
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
19
|
if (!requiredOne) {
|
|
20
|
-
|
|
20
|
+
onChoiceChange(null);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
25
|
if (multiple) {
|
|
26
|
-
|
|
26
|
+
onChoiceChange([...choiceState, choiceName]);
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
|
|
29
|
+
onChoiceChange(choiceName);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}, ...p }));
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import type { ComponentProps
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
2
|
import type { AccessNavigationPropsT } from "../AccessNavigation/AccessNavigation";
|
|
3
|
-
type
|
|
3
|
+
type MultipleModeT = {
|
|
4
4
|
multiple: true;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
choiceState: string[];
|
|
6
|
+
onChoiceChange: (activeChoice: string[]) => void;
|
|
7
7
|
};
|
|
8
8
|
type SingleModeT = {
|
|
9
9
|
multiple?: false;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
choiceState: string | null;
|
|
11
|
+
onChoiceChange: (activeChoice: string | null) => void;
|
|
12
12
|
};
|
|
13
|
-
type MergedModeT = SingleModeT |
|
|
13
|
+
type MergedModeT = SingleModeT | MultipleModeT;
|
|
14
14
|
export type ChoiceContextT = MergedModeT & {
|
|
15
15
|
requiredOne?: boolean;
|
|
16
16
|
};
|
|
17
|
-
export type ChoiceRootPropsT =
|
|
18
|
-
export type ChoiceTogglePropsT = ComponentProps<"button"> & {
|
|
17
|
+
export type ChoiceRootPropsT = AccessNavigationPropsT & ChoiceContextT;
|
|
18
|
+
export type ChoiceTogglePropsT = Omit<ComponentProps<"button">, "type"> & {
|
|
19
19
|
choiceName: string;
|
|
20
20
|
};
|
|
21
|
-
export type ChoiceNavigationPropsT = AccessNavigationPropsT;
|
|
22
21
|
export type ChoiceThumbPropsT = ComponentProps<"span">;
|
|
23
22
|
export {};
|
|
24
23
|
//# sourceMappingURL=choiceTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choiceTypes.d.ts","sourceRoot":"","sources":["../../../src/react-components/Choice/choiceTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"choiceTypes.d.ts","sourceRoot":"","sources":["../../../src/react-components/Choice/choiceTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAEnF,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,IAAI,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAClD,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACvD,CAAC;AAEF,KAAK,WAAW,GAAG,WAAW,GAAG,aAAa,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,GAAG,cAAc,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAAG;IACxE,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ClipboardPropsT } from "./clipboardTypes";
|
|
2
|
-
export declare function Clipboard({ copiedChildren, onClick, children, text, title, "aria-label": ariaLabel, timeout, ...
|
|
2
|
+
export declare function Clipboard({ copiedChildren, onClick, children, text, title, "aria-label": ariaLabel, timeout, ...p }: ClipboardPropsT): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=Clipboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clipboard.d.ts","sourceRoot":"","sources":["../../../src/react-components/Clipboard/Clipboard.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,wBAAgB,SAAS,CAAC,EACxB,cAAc,EACd,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,OAAe,EACf,GAAG,
|
|
1
|
+
{"version":3,"file":"Clipboard.d.ts","sourceRoot":"","sources":["../../../src/react-components/Clipboard/Clipboard.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,wBAAgB,SAAS,CAAC,EACxB,cAAc,EACd,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,OAAe,EACf,GAAG,CAAC,EACL,EAAE,eAAe,2CAiBjB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useClipboard } from "@mantine/hooks";
|
|
4
|
-
export function Clipboard({ copiedChildren, onClick, children, text, title, "aria-label": ariaLabel, timeout = 3_000, ...
|
|
4
|
+
export function Clipboard({ copiedChildren, onClick, children, text, title, "aria-label": ariaLabel, timeout = 3_000, ...p }) {
|
|
5
5
|
const { copy, copied } = useClipboard({ timeout });
|
|
6
6
|
const handleClick = (ev) => {
|
|
7
7
|
onClick?.(ev);
|
|
8
8
|
copy(text.trim());
|
|
9
9
|
};
|
|
10
|
-
return (_jsx("button", { "aria-label": ariaLabel || text, title: title || text, onClick: handleClick, ...
|
|
10
|
+
return (_jsx("button", { "aria-label": ariaLabel || text, title: title || text, onClick: handleClick, ...p, children: copiedChildren && copied ? copiedChildren : children }));
|
|
11
11
|
}
|