@kadoui/react 2.1.7 → 2.3.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.
Files changed (138) hide show
  1. package/README.md +1 -1
  2. package/dist/react-components/AccessNavigation/AccessNavigation.d.ts +2 -2
  3. package/dist/react-components/AccessNavigation/AccessNavigation.d.ts.map +1 -1
  4. package/dist/react-components/AccessNavigation/AccessNavigation.js +8 -7
  5. package/dist/react-components/Accordion/Accordion.d.ts +4 -0
  6. package/dist/react-components/Accordion/Accordion.d.ts.map +1 -1
  7. package/dist/react-components/Accordion/Accordion.js +5 -1
  8. package/dist/react-components/Accordion/AccordionBody.d.ts.map +1 -1
  9. package/dist/react-components/Accordion/AccordionBody.js +4 -1
  10. package/dist/react-components/Accordion/AccordionContent.d.ts +3 -0
  11. package/dist/react-components/Accordion/AccordionContent.d.ts.map +1 -0
  12. package/dist/react-components/Accordion/AccordionContent.js +5 -0
  13. package/dist/react-components/Accordion/AccordionContext.d.ts +9 -2
  14. package/dist/react-components/Accordion/AccordionContext.d.ts.map +1 -1
  15. package/dist/react-components/Accordion/AccordionContext.js +1 -0
  16. package/dist/react-components/Accordion/AccordionItem.d.ts +3 -0
  17. package/dist/react-components/Accordion/AccordionItem.d.ts.map +1 -0
  18. package/dist/react-components/Accordion/AccordionItem.js +5 -0
  19. package/dist/react-components/Accordion/AccordionItemContext.d.ts +3 -0
  20. package/dist/react-components/Accordion/AccordionItemContext.d.ts.map +1 -0
  21. package/dist/react-components/Accordion/AccordionItemContext.js +3 -0
  22. package/dist/react-components/Accordion/AccordionRoot.d.ts +1 -1
  23. package/dist/react-components/Accordion/AccordionRoot.d.ts.map +1 -1
  24. package/dist/react-components/Accordion/AccordionRoot.js +3 -4
  25. package/dist/react-components/Accordion/AccordionToggle.d.ts.map +1 -1
  26. package/dist/react-components/Accordion/AccordionToggle.js +20 -2
  27. package/dist/react-components/Accordion/accordionTypes.d.ts +20 -5
  28. package/dist/react-components/Accordion/accordionTypes.d.ts.map +1 -1
  29. package/dist/react-components/Affix/Affix.d.ts +1 -1
  30. package/dist/react-components/Affix/Affix.d.ts.map +1 -1
  31. package/dist/react-components/Affix/Affix.js +3 -2
  32. package/dist/react-components/Affix/affixTypes.d.ts +3 -1
  33. package/dist/react-components/Affix/affixTypes.d.ts.map +1 -1
  34. package/dist/react-components/Choice/Choice.d.ts +0 -2
  35. package/dist/react-components/Choice/Choice.d.ts.map +1 -1
  36. package/dist/react-components/Choice/Choice.js +0 -2
  37. package/dist/react-components/Choice/ChoiceRoot.d.ts +1 -1
  38. package/dist/react-components/Choice/ChoiceRoot.d.ts.map +1 -1
  39. package/dist/react-components/Choice/ChoiceRoot.js +3 -2
  40. package/dist/react-components/Choice/ChoiceThumb.d.ts.map +1 -1
  41. package/dist/react-components/Choice/ChoiceThumb.js +1 -0
  42. package/dist/react-components/Choice/ChoiceToggle.js +8 -8
  43. package/dist/react-components/Choice/choiceTypes.d.ts +8 -9
  44. package/dist/react-components/Choice/choiceTypes.d.ts.map +1 -1
  45. package/dist/react-components/ContextMenu/ContextMenu.d.ts +0 -2
  46. package/dist/react-components/ContextMenu/ContextMenu.d.ts.map +1 -1
  47. package/dist/react-components/ContextMenu/ContextMenu.js +0 -2
  48. package/dist/react-components/ContextMenu/ContextMenuBody.d.ts.map +1 -1
  49. package/dist/react-components/ContextMenu/ContextMenuBody.js +5 -1
  50. package/dist/react-components/ContextMenu/ContextMenuContent.d.ts +3 -0
  51. package/dist/react-components/ContextMenu/ContextMenuContent.d.ts.map +1 -0
  52. package/dist/react-components/ContextMenu/ContextMenuContent.js +8 -0
  53. package/dist/react-components/ContextMenu/ContextMenuContext.d.ts.map +1 -1
  54. package/dist/react-components/ContextMenu/ContextMenuContext.js +1 -0
  55. package/dist/react-components/ContextMenu/ContextMenuRoot.d.ts.map +1 -1
  56. package/dist/react-components/ContextMenu/ContextMenuRoot.js +13 -2
  57. package/dist/react-components/ContextMenu/contextMenuTypes.d.ts +1 -2
  58. package/dist/react-components/ContextMenu/contextMenuTypes.d.ts.map +1 -1
  59. package/dist/react-components/Drawer/DrawerBody.js +1 -1
  60. package/dist/react-components/Drawer/DrawerContext.d.ts.map +1 -1
  61. package/dist/react-components/Drawer/DrawerContext.js +1 -0
  62. package/dist/react-components/Drawer/DrawerPortal.js +1 -1
  63. package/dist/react-components/Drawer/DrawerRoot.d.ts.map +1 -1
  64. package/dist/react-components/Drawer/DrawerRoot.js +1 -1
  65. package/dist/react-components/Drawer/DrawerToggle.js +2 -2
  66. package/dist/react-components/Drawer/drawerTypes.d.ts +2 -2
  67. package/dist/react-components/Drawer/drawerTypes.d.ts.map +1 -1
  68. package/dist/react-components/Modal/ModalPortal.d.ts.map +1 -1
  69. package/dist/react-components/Modal/ModalPortal.js +1 -1
  70. package/dist/react-components/Modal/ModalRoot.d.ts.map +1 -1
  71. package/dist/react-components/Modal/ModalRoot.js +2 -2
  72. package/dist/react-components/Modal/ModalToggle.js +2 -2
  73. package/dist/react-components/Modal/modalTypes.d.ts +2 -2
  74. package/dist/react-components/Modal/modalTypes.d.ts.map +1 -1
  75. package/dist/react-components/Pagination/PaginationCounts.d.ts +1 -1
  76. package/dist/react-components/Pagination/PaginationCounts.d.ts.map +1 -1
  77. package/dist/react-components/Pagination/PaginationCounts.js +10 -7
  78. package/dist/react-components/Pagination/PaginationTypes.d.ts +4 -2
  79. package/dist/react-components/Pagination/PaginationTypes.d.ts.map +1 -1
  80. package/dist/react-components/PasswordInput/PasswordInputContext.d.ts.map +1 -1
  81. package/dist/react-components/PasswordInput/PasswordInputContext.js +1 -0
  82. package/dist/react-components/PasswordInput/PasswordInputToggle.d.ts.map +1 -1
  83. package/dist/react-components/PasswordInput/PasswordInputToggle.js +2 -2
  84. package/dist/react-components/PasswordInput/passwordInputTypes.d.ts +2 -2
  85. package/dist/react-components/PasswordInput/passwordInputTypes.d.ts.map +1 -1
  86. package/dist/react-components/Popover/Popover.d.ts +0 -2
  87. package/dist/react-components/Popover/Popover.d.ts.map +1 -1
  88. package/dist/react-components/Popover/Popover.js +0 -2
  89. package/dist/react-components/Popover/PopoverBody.d.ts +1 -1
  90. package/dist/react-components/Popover/PopoverBody.d.ts.map +1 -1
  91. package/dist/react-components/Popover/PopoverBody.js +2 -2
  92. package/dist/react-components/Popover/PopoverContext.d.ts.map +1 -1
  93. package/dist/react-components/Popover/PopoverContext.js +1 -0
  94. package/dist/react-components/Popover/PopoverRoot.d.ts.map +1 -1
  95. package/dist/react-components/Popover/PopoverRoot.js +3 -2
  96. package/dist/react-components/Popover/PopoverToggle.js +1 -1
  97. package/dist/react-components/Popover/popoverTypes.d.ts +3 -4
  98. package/dist/react-components/Popover/popoverTypes.d.ts.map +1 -1
  99. package/dist/react-components/SelectBox/SelectBoxInput.d.ts.map +1 -1
  100. package/dist/react-components/SelectBox/SelectBoxInput.js +1 -0
  101. package/dist/react-components/SelectBox/SelectBoxList.d.ts +1 -1
  102. package/dist/react-components/SelectBox/SelectBoxList.d.ts.map +1 -1
  103. package/dist/react-components/SelectBox/SelectBoxList.js +1 -2
  104. package/dist/react-components/SelectBox/SelectBoxRoot.d.ts.map +1 -1
  105. package/dist/react-components/SelectBox/SelectBoxRoot.js +12 -2
  106. package/dist/react-components/SelectBox/SelectBoxSearchInput.d.ts.map +1 -1
  107. package/dist/react-components/SelectBox/SelectBoxSearchInput.js +1 -0
  108. package/dist/react-components/SelectBox/selectBoxTypes.d.ts +7 -7
  109. package/dist/react-components/SelectBox/selectBoxTypes.d.ts.map +1 -1
  110. package/dist/react-components/Sheet/SheetBody.d.ts.map +1 -1
  111. package/dist/react-components/Sheet/SheetBody.js +1 -1
  112. package/dist/react-components/Sheet/SheetContext.d.ts.map +1 -1
  113. package/dist/react-components/Sheet/SheetContext.js +1 -0
  114. package/dist/react-components/Sheet/SheetPortal.js +1 -1
  115. package/dist/react-components/Sheet/SheetRoot.d.ts.map +1 -1
  116. package/dist/react-components/Sheet/SheetRoot.js +2 -2
  117. package/dist/react-components/Sheet/SheetToggle.js +2 -2
  118. package/dist/react-components/Sheet/sheetTypes.d.ts +2 -2
  119. package/dist/react-components/Sheet/sheetTypes.d.ts.map +1 -1
  120. package/dist/react-components/ShowMore/ShowMore.d.ts +1 -1
  121. package/dist/react-components/ShowMore/ShowMore.d.ts.map +1 -1
  122. package/dist/react-components/ShowMore/ShowMore.js +1 -1
  123. package/dist/react-components/ShowMore/ShowMoreContext.d.ts.map +1 -1
  124. package/dist/react-components/ShowMore/ShowMoreContext.js +1 -0
  125. package/dist/react-components/ShowMore/ShowMoreToggle.d.ts.map +1 -1
  126. package/dist/react-components/ShowMore/ShowMoreToggle.js +3 -3
  127. package/dist/react-components/ShowMore/showMoreTypes.d.ts +2 -2
  128. package/dist/react-components/ShowMore/showMoreTypes.d.ts.map +1 -1
  129. package/dist/react-components/Spoiler/SpoilerContext.d.ts.map +1 -1
  130. package/dist/react-components/Spoiler/SpoilerContext.js +1 -0
  131. package/dist/react-components/Spoiler/SpoilerRoot.js +1 -1
  132. package/dist/react-components/Spoiler/spoilerTypes.d.ts +2 -2
  133. package/dist/react-components/Spoiler/spoilerTypes.d.ts.map +1 -1
  134. package/dist/tsconfig.tsbuildinfo +1 -1
  135. package/dist/utils/browser.d.ts +1 -1
  136. package/dist/utils/browser.d.ts.map +1 -1
  137. package/dist/utils/browser.js +32 -9
  138. 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
- - `focusOnMount?: boolean` - Auto-focus first element on mount
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
- focusOnMount?: boolean;
4
+ focusTrap?: any;
5
5
  ref?: RefObject<HTMLDivElement | null>;
6
6
  };
7
- export declare function AccessNavigation({ ref, focusOnMount, direction, dir, onKeyDown, ...p }: AccessNavigationPropsT): import("react/jsx-runtime").JSX.Element;
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,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,GAAG,CAAC,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CACxC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,YAAY,EACZ,SAAS,EACT,GAAG,EACH,SAAS,EACT,GAAG,CAAC,EACL,EAAE,sBAAsB,2CAwExB"}
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, focusOnMount, direction, dir, onKeyDown, ...p }) {
5
+ export function AccessNavigation({ ref, focusTrap, direction, dir, onKeyDown, ...p }) {
6
6
  const accessNavigationRef = ref || useRef(null);
7
7
  useEffect(() => {
8
- if (!accessNavigationRef.current)
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
- if (!focusableChildren.length) {
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;AAEpD,eAAO,MAAM,SAAS;;;CAGpB,CAAC;AAEH,cAAc,kBAAkB,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 +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;AAE5D,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,EAAE,mBAAmB,2CAiBpE"}
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,8 +3,11 @@ 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
+ import { AccordionItemContext } from "./AccordionItemContext";
6
7
  export function AccordionBody({ children, ...p }) {
7
- const { isOpen } = use(AccordionContext);
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
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 }));
@@ -0,0 +1,3 @@
1
+ import { AccordionContentPropsT } from "./accordionTypes";
2
+ export declare function AccordionContent(p: AccordionContentPropsT): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=AccordionContent.d.ts.map
@@ -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"}
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export function AccordionContent(p) {
4
+ return (_jsx("div", { ...p }));
5
+ }
@@ -1,3 +1,10 @@
1
- import type { AccordionContextT } from "./accordionTypes";
2
- export declare const AccordionContext: import("react").Context<AccordionContextT>;
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":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,eAAO,MAAM,gBAAgB,4CAA4D,CAAC"}
1
+ {"version":3,"file":"AccordionContext.d.ts","sourceRoot":"","sources":["../../../src/react-components/Accordion/AccordionContext.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB;;;;;;;;EAA4D,CAAC"}
@@ -1,2 +1,3 @@
1
+ "use client";
1
2
  import { createContext } from "react";
2
3
  export const AccordionContext = createContext({});
@@ -0,0 +1,3 @@
1
+ import { AccordionItemPropsT } from "./accordionTypes";
2
+ export declare function AccordionItem({ itemName, children }: AccordionItemPropsT): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=AccordionItem.d.ts.map
@@ -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,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { AccordionItemContext } from "./AccordionItemContext";
3
+ export function AccordionItem({ itemName, children }) {
4
+ return (_jsx(AccordionItemContext, { value: { itemName }, children: children }));
5
+ }
@@ -0,0 +1,3 @@
1
+ import type { AccordionItemContextT } from "./accordionTypes";
2
+ export declare const AccordionItemContext: import("react").Context<AccordionItemContextT>;
3
+ //# sourceMappingURL=AccordionItemContext.d.ts.map
@@ -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"}
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import { createContext } from "react";
3
+ export const AccordionItemContext = createContext({});
@@ -1,3 +1,3 @@
1
1
  import type { AccordionRootPropsT } from "./accordionTypes";
2
- export declare function AccordionRoot({ children }: AccordionRootPropsT): import("react/jsx-runtime").JSX.Element;
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":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CAQ9D"}
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
- export function AccordionRoot({ children }) {
6
- const [isOpen, setOpen] = useState(false);
7
- return (_jsx(AccordionContext, { value: { isOpen, setOpen }, children: children }));
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 +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;AAE9D,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,EAAE,qBAAqB,2CAcvE"}
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
+ import { AccordionItemContext } from "./AccordionItemContext";
5
6
  export function AccordionToggle({ onClick, ...p }) {
6
- const { isOpen, setOpen } = use(AccordionContext);
7
+ const { multiple, accordionState, onAccordionChange } = use(AccordionContext);
8
+ const { itemName } = use(AccordionItemContext);
9
+ const isOpen = multiple ? accordionState.includes(itemName) : accordionState === itemName;
7
10
  return (_jsx("button", { type: "button", "data-state": isOpen, onClick: (ev) => {
8
11
  onClick?.(ev);
9
- setOpen((prev) => !prev);
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
+ }
10
28
  }, ...p }));
11
29
  }
@@ -1,12 +1,27 @@
1
1
  import type { HTMLMotionProps } from "framer-motion";
2
- import type { ComponentProps, Dispatch, PropsWithChildren, ReactNode, SetStateAction } from "react";
3
- export type AccordionContextT = {
4
- isOpen: boolean;
5
- setOpen: Dispatch<SetStateAction<boolean>>;
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
- export type AccordionRootPropsT = PropsWithChildren;
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">;
22
+ export type AccordionContentPropsT = ComponentProps<"div">;
9
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,QAAQ,EAAE,iBAAiB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEpG,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAEpD,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAAG;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC"}
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,mBAAmB,WAAW,4CA2CnD,CAAC"}
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 * 0.5;
12
+ const scrollThreshold = viewportHeight * VIEWPORT_OFFSET;
12
13
  if (currentScrollY > scrollThreshold && currentScrollY > lastScrollY) {
13
14
  setIsVisible(true);
14
15
  }
@@ -1,3 +1,5 @@
1
1
  import type { ComponentProps } from "react";
2
- export type AffixPropsT = ComponentProps<"button">;
2
+ export type AffixPropsT = ComponentProps<"button"> & {
3
+ viewportOffset?: number;
4
+ };
3
5
  //# sourceMappingURL=affixTypes.d.ts.map
@@ -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,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;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,eAAO,MAAM,MAAM;;;;CAIjB,CAAC;AAEH,cAAc,eAAe,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, activeChoice, setActiveChoice, requiredOne, ...p }: ChoiceRootPropsT): import("react/jsx-runtime").JSX.Element;
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;AAEtE,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,WAAW,EACX,GAAG,CAAC,EACL,EAAE,gBAAgB,2CAOlB"}
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
- export function ChoiceRoot({ multiple, activeChoice, setActiveChoice, requiredOne, ...p }) {
5
- return (_jsx(ChoiceContext, { value: { multiple, activeChoice, setActiveChoice, requiredOne }, children: _jsx("div", { ...p }) }));
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":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,wBAAgB,WAAW,CAAC,CAAC,EAAE,iBAAiB,2CAI/C"}
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,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  export function ChoiceThumb(p) {
3
4
  return (_jsx("span", { ...p }));
@@ -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, activeChoice, setActiveChoice, requiredOne } = use(ChoiceContext);
6
+ const { multiple, choiceState, onChoiceChange, requiredOne } = use(ChoiceContext);
7
7
  const isActive = multiple
8
- ? activeChoice.includes(choiceName)
9
- : activeChoice === choiceName;
8
+ ? choiceState.includes(choiceName)
9
+ : choiceState === choiceName;
10
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 || activeChoice.length > 1) {
15
- setActiveChoice((prev) => prev.filter((item) => item !== choiceName));
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
- setActiveChoice(null);
20
+ onChoiceChange(null);
21
21
  }
22
22
  }
23
23
  }
24
24
  else {
25
25
  if (multiple) {
26
- setActiveChoice((prev) => [...prev, choiceName]);
26
+ onChoiceChange([...choiceState, choiceName]);
27
27
  }
28
28
  else {
29
- setActiveChoice(choiceName);
29
+ onChoiceChange(choiceName);
30
30
  }
31
31
  }
32
32
  }, ...p }));
@@ -1,24 +1,23 @@
1
- import type { ComponentProps, Dispatch, SetStateAction } from "react";
1
+ import type { ComponentProps } from "react";
2
2
  import type { AccessNavigationPropsT } from "../AccessNavigation/AccessNavigation";
3
- type MultiModeT = {
3
+ type MultipleModeT = {
4
4
  multiple: true;
5
- activeChoice: string[];
6
- setActiveChoice: Dispatch<SetStateAction<string[]>>;
5
+ choiceState: string[];
6
+ onChoiceChange: (activeChoice: string[]) => void;
7
7
  };
8
8
  type SingleModeT = {
9
9
  multiple?: false;
10
- activeChoice: string | null;
11
- setActiveChoice: Dispatch<SetStateAction<string | null>>;
10
+ choiceState: string | null;
11
+ onChoiceChange: (activeChoice: string | null) => void;
12
12
  };
13
- type MergedModeT = SingleModeT | MultiModeT;
13
+ type MergedModeT = SingleModeT | MultipleModeT;
14
14
  export type ChoiceContextT = MergedModeT & {
15
15
  requiredOne?: boolean;
16
16
  };
17
- export type ChoiceRootPropsT = ComponentProps<"div"> & ChoiceContextT;
17
+ export type ChoiceRootPropsT = AccessNavigationPropsT & ChoiceContextT;
18
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,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAEnF,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,IAAI,CAAC;IACf,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;CACrD,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;CAC1D,CAAC;AAEF,KAAK,WAAW,GAAG,WAAW,GAAG,UAAU,CAAC;AAE5C,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,cAAc,CAAC;AAEtE,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAAG;IACxE,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAE5D,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC"}
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,10 +1,8 @@
1
1
  import { ContextMenuRoot } from "./ContextMenuRoot";
2
2
  import { ContextMenuBody } from "./ContextMenuBody";
3
3
  import { ContextMenuItem } from "./ContextMenuItem";
4
- import { ContextMenuNavigation } from "./ContextMenuNavigation";
5
4
  export declare const ContextMenu: typeof ContextMenuRoot & {
6
5
  Body: typeof ContextMenuBody;
7
- Navigation: typeof ContextMenuNavigation;
8
6
  Item: typeof ContextMenuItem;
9
7
  };
10
8
  export * from "./contextMenuTypes";
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/react-components/ContextMenu/ContextMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,eAAO,MAAM,WAAW;;;;CAItB,CAAC;AAEH,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/react-components/ContextMenu/ContextMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,WAAW;;;CAGtB,CAAC;AAEH,cAAc,oBAAoB,CAAC"}
@@ -1,10 +1,8 @@
1
1
  import { ContextMenuRoot } from "./ContextMenuRoot";
2
2
  import { ContextMenuBody } from "./ContextMenuBody";
3
3
  import { ContextMenuItem } from "./ContextMenuItem";
4
- import { ContextMenuNavigation } from "./ContextMenuNavigation";
5
4
  export const ContextMenu = Object.assign(ContextMenuRoot, {
6
5
  Body: ContextMenuBody,
7
- Navigation: ContextMenuNavigation,
8
6
  Item: ContextMenuItem
9
7
  });
10
8
  export * from "./contextMenuTypes";
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuBody.d.ts","sourceRoot":"","sources":["../../../src/react-components/ContextMenu/ContextMenuBody.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,wBAAgB,eAAe,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,EAAE,qBAAqB,2CAmB7E"}
1
+ {"version":3,"file":"ContextMenuBody.d.ts","sourceRoot":"","sources":["../../../src/react-components/ContextMenu/ContextMenuBody.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGhE,wBAAgB,eAAe,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,EAAE,qBAAqB,2CAwB7E"}
@@ -2,9 +2,13 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { use } from "react";
4
4
  import { ContextMenuContext } from "./ContextMenuContext";
5
+ import { AccessNavigation } from "../AccessNavigation/AccessNavigation";
5
6
  export function ContextMenuBody({ onContextMenu, ...p }) {
6
7
  const { contentRef, position, isOpen } = use(ContextMenuContext);
7
- return (_jsx("div", { ref: contentRef, "data-state": isOpen, onContextMenu: (ev) => {
8
+ // useEffect(() => {
9
+ // contentRef.current?.focus();
10
+ // }, [isOpen, position])
11
+ return (_jsx(AccessNavigation, { ref: contentRef, "data-state": isOpen, focusTrap: position, onContextMenu: (ev) => {
8
12
  ev.stopPropagation();
9
13
  ev.preventDefault();
10
14
  onContextMenu?.(ev);
@@ -0,0 +1,3 @@
1
+ import { ContextMenuContentPropsT } from "./contextMenuTypes";
2
+ export declare function ContextMenuContent({ focusOnMount, ...p }: ContextMenuContentPropsT): import("react/jsx-runtime").JSX.Element | null;
3
+ //# sourceMappingURL=ContextMenuContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextMenuContent.d.ts","sourceRoot":"","sources":["../../../src/react-components/ContextMenu/ContextMenuContent.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,wBAAgB,kBAAkB,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,EAAE,wBAAwB,kDAMlF"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { use } from "react";
3
+ import { ContextMenuContext } from "./ContextMenuContext";
4
+ import { AccessNavigation } from "../AccessNavigation/AccessNavigation";
5
+ export function ContextMenuContent({ focusOnMount, ...p }) {
6
+ const { isOpen } = use(ContextMenuContext);
7
+ return isOpen ? (_jsx(AccessNavigation, { focusOnMount: focusOnMount || true, ...p })) : null;
8
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuContext.d.ts","sourceRoot":"","sources":["../../../src/react-components/ContextMenu/ContextMenuContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,eAAO,MAAM,kBAAkB,8CAAgE,CAAC"}
1
+ {"version":3,"file":"ContextMenuContext.d.ts","sourceRoot":"","sources":["../../../src/react-components/ContextMenu/ContextMenuContext.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,eAAO,MAAM,kBAAkB,8CAAgE,CAAC"}
@@ -1,2 +1,3 @@
1
+ "use client";
1
2
  import { createContext } from "react";
2
3
  export const ContextMenuContext = createContext({});
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuRoot.d.ts","sourceRoot":"","sources":["../../../src/react-components/ContextMenu/ContextMenuRoot.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAuB,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAErF,wBAAgB,eAAe,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,EAAE,qBAAqB,2CAyE7E"}
1
+ {"version":3,"file":"ContextMenuRoot.d.ts","sourceRoot":"","sources":["../../../src/react-components/ContextMenu/ContextMenuRoot.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAuB,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAErF,wBAAgB,eAAe,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,EAAE,qBAAqB,2CAyF7E"}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useCallback, useEffect, useRef, useState } from "react";
4
- import { getBrowserScrollbarWith } from "../../utils-exports";
5
4
  import { ContextMenuContext } from "./ContextMenuContext";
5
+ import { getBrowserScrollbarWith } from "../../utils-exports";
6
6
  export function ContextMenuRoot({ onContextMenu, ...p }) {
7
7
  const [position, setPosition] = useState(undefined);
8
8
  const [isOpen, setOpen] = useState(false);
@@ -31,6 +31,15 @@ export function ContextMenuRoot({ onContextMenu, ...p }) {
31
31
  document.body.style.paddingRight = "0px";
32
32
  }
33
33
  ;
34
+ const handleEscape = (e) => {
35
+ if (e.key === "Escape") {
36
+ setOpen(false);
37
+ }
38
+ };
39
+ document.addEventListener("keydown", handleEscape);
40
+ return () => {
41
+ document.removeEventListener("keydown", handleEscape);
42
+ };
34
43
  }, [isOpen]);
35
44
  const handleContextMenu = (ev) => {
36
45
  if (!contentRef.current)
@@ -49,7 +58,9 @@ export function ContextMenuRoot({ onContextMenu, ...p }) {
49
58
  y = viewportHeight - menuHeight - 10;
50
59
  }
51
60
  setPosition({ x, y });
52
- setOpen(true);
61
+ if (!isOpen) {
62
+ setOpen(true);
63
+ }
53
64
  };
54
65
  return (_jsx(ContextMenuContext, { value: { contentRef, isOpen, closeHandler, position }, children: _jsx("div", { onContextMenu: ev => {
55
66
  onContextMenu?.(ev);