@studiocubics/components 0.0.3 → 0.0.4

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 (237) hide show
  1. package/README.md +2 -0
  2. package/dist/Cards/Card/Card.js +1 -44
  3. package/dist/Cards/Card/Card.js.map +1 -1
  4. package/dist/Cards/Card/Card.module.css.js +1 -3
  5. package/dist/Cards/Card/Card.module.css.js.map +1 -1
  6. package/dist/Cards/CollectionItemCard/CollectionItemCard.js +1 -47
  7. package/dist/Cards/CollectionItemCard/CollectionItemCard.js.map +1 -1
  8. package/dist/Cards/CollectionItemCard/CollectionItemCard.module.css.js +1 -3
  9. package/dist/Cards/CollectionItemCard/CollectionItemCard.module.css.js.map +1 -1
  10. package/dist/Cards/CollectionItemCard/CollectionItemCardActions.js +1 -33
  11. package/dist/Cards/CollectionItemCard/CollectionItemCardActions.js.map +1 -1
  12. package/dist/Cards/GlassCard/GlassCard.js +1 -51
  13. package/dist/Cards/GlassCard/GlassCard.js.map +1 -1
  14. package/dist/Cards/GlassCard/GlassCard.module.css.js +1 -3
  15. package/dist/Cards/GlassCard/GlassCard.module.css.js.map +1 -1
  16. package/dist/Display/Accordion/Accordion.js +1 -27
  17. package/dist/Display/Accordion/Accordion.js.map +1 -1
  18. package/dist/Display/Accordion/Accordion.module.css.js +1 -3
  19. package/dist/Display/Accordion/Accordion.module.css.js.map +1 -1
  20. package/dist/Display/Accordion/AccordionItem.js +1 -55
  21. package/dist/Display/Accordion/AccordionItem.js.map +1 -1
  22. package/dist/Display/Chip/Chip.js +1 -42
  23. package/dist/Display/Chip/Chip.js.map +1 -1
  24. package/dist/Display/Chip/Chip.module.css.js +1 -3
  25. package/dist/Display/Chip/Chip.module.css.js.map +1 -1
  26. package/dist/Display/IdentityDisplay/IdentityDisplay.js +1 -35
  27. package/dist/Display/IdentityDisplay/IdentityDisplay.js.map +1 -1
  28. package/dist/Display/IdentityDisplay/IdentityDisplay.module.css.js +1 -3
  29. package/dist/Display/IdentityDisplay/IdentityDisplay.module.css.js.map +1 -1
  30. package/dist/Display/InputErrors/InputErrors.js +1 -24
  31. package/dist/Display/InputErrors/InputErrors.js.map +1 -1
  32. package/dist/Display/InputErrors/InputErrors.module.css.js +1 -3
  33. package/dist/Display/InputErrors/InputErrors.module.css.js.map +1 -1
  34. package/dist/Display/Kbd/Kbd.js +1 -18
  35. package/dist/Display/Kbd/Kbd.js.map +1 -1
  36. package/dist/Display/Kbd/Kbd.module.css.js +1 -3
  37. package/dist/Display/Kbd/Kbd.module.css.js.map +1 -1
  38. package/dist/Display/Kbd/buttonList.js +1 -197
  39. package/dist/Display/Kbd/buttonList.js.map +1 -1
  40. package/dist/Display/LabeledValue/LabeledValue.js +1 -10
  41. package/dist/Display/LabeledValue/LabeledValue.js.map +1 -1
  42. package/dist/Display/LabeledValue/LabeledValue.module.css.js +1 -3
  43. package/dist/Display/LabeledValue/LabeledValue.module.css.js.map +1 -1
  44. package/dist/Display/List/List.js +1 -95
  45. package/dist/Display/List/List.js.map +1 -1
  46. package/dist/Display/List/List.module.css.js +1 -3
  47. package/dist/Display/List/List.module.css.js.map +1 -1
  48. package/dist/Display/PasswordStrength/PasswordStrength.js +1 -16
  49. package/dist/Display/PasswordStrength/PasswordStrength.js.map +1 -1
  50. package/dist/Display/PasswordStrength/PasswordStrength.module.css.js +1 -3
  51. package/dist/Display/PasswordStrength/PasswordStrength.module.css.js.map +1 -1
  52. package/dist/Display/PasswordStrength/usePasswordStrength.js +1 -48
  53. package/dist/Display/PasswordStrength/usePasswordStrength.js.map +1 -1
  54. package/dist/Display/Skeleton/Skeleton.js +1 -10
  55. package/dist/Display/Skeleton/Skeleton.js.map +1 -1
  56. package/dist/Display/Skeleton/Skeleton.module.css.js +1 -3
  57. package/dist/Display/Skeleton/Skeleton.module.css.js.map +1 -1
  58. package/dist/Display/Toast/Toaster.js +1 -44
  59. package/dist/Display/Toast/Toaster.js.map +1 -1
  60. package/dist/Display/Toast/toast.js +1 -31
  61. package/dist/Display/Toast/toast.js.map +1 -1
  62. package/dist/Display/Tooltip/Tooltip.js +1 -44
  63. package/dist/Display/Tooltip/Tooltip.js.map +1 -1
  64. package/dist/Display/Tooltip/Tooltip.module.css.js +1 -3
  65. package/dist/Display/Tooltip/Tooltip.module.css.js.map +1 -1
  66. package/dist/Display/Tooltip/getArrowDirection.js +1 -47
  67. package/dist/Display/Tooltip/getArrowDirection.js.map +1 -1
  68. package/dist/Display/Tooltip/useTooltip.js +1 -47
  69. package/dist/Display/Tooltip/useTooltip.js.map +1 -1
  70. package/dist/Display/WIP/WIP.d.ts +5 -0
  71. package/dist/Forms/ConfirmationForm/ConfirmationForm.js +1 -11
  72. package/dist/Forms/ConfirmationForm/ConfirmationForm.js.map +1 -1
  73. package/dist/Forms/ConfirmationForm/ConfirmationForm.module.css.js +1 -3
  74. package/dist/Forms/ConfirmationForm/ConfirmationForm.module.css.js.map +1 -1
  75. package/dist/Inputs/Button/Button.js +1 -55
  76. package/dist/Inputs/Button/Button.js.map +1 -1
  77. package/dist/Inputs/Button/Button.module.css.js +1 -3
  78. package/dist/Inputs/Button/Button.module.css.js.map +1 -1
  79. package/dist/Inputs/Checkbox/Checkbox.js +1 -54
  80. package/dist/Inputs/Checkbox/Checkbox.js.map +1 -1
  81. package/dist/Inputs/Checkbox/Checkbox.module.css.js +1 -3
  82. package/dist/Inputs/Checkbox/Checkbox.module.css.js.map +1 -1
  83. package/dist/Inputs/Checkbox/CheckboxGroup/CheckboxGroup.js +1 -34
  84. package/dist/Inputs/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
  85. package/dist/Inputs/Checkbox/CheckboxGroup/CheckboxGroup.module.css.js +1 -3
  86. package/dist/Inputs/Checkbox/CheckboxGroup/CheckboxGroup.module.css.js.map +1 -1
  87. package/dist/Inputs/Checkbox/CheckboxSelectAll.js +1 -18
  88. package/dist/Inputs/Checkbox/CheckboxSelectAll.js.map +1 -1
  89. package/dist/Inputs/PasswordInput/PasswordInput.js +1 -44
  90. package/dist/Inputs/PasswordInput/PasswordInput.js.map +1 -1
  91. package/dist/Inputs/PasswordInput/PasswordInput.module.css.js +1 -3
  92. package/dist/Inputs/PasswordInput/PasswordInput.module.css.js.map +1 -1
  93. package/dist/Inputs/Select/Select.js +1 -25
  94. package/dist/Inputs/Select/Select.js.map +1 -1
  95. package/dist/Inputs/Select/Select.module.css.js +1 -3
  96. package/dist/Inputs/Select/Select.module.css.js.map +1 -1
  97. package/dist/Inputs/Switch/Switch.js +1 -80
  98. package/dist/Inputs/Switch/Switch.js.map +1 -1
  99. package/dist/Inputs/Switch/Switch.module.css.js +1 -3
  100. package/dist/Inputs/Switch/Switch.module.css.js.map +1 -1
  101. package/dist/Inputs/TextAreaInput/TextAreaInput.js +1 -29
  102. package/dist/Inputs/TextAreaInput/TextAreaInput.js.map +1 -1
  103. package/dist/Inputs/TextAreaInput/TextAreaInput.module.css.js +1 -3
  104. package/dist/Inputs/TextAreaInput/TextAreaInput.module.css.js.map +1 -1
  105. package/dist/Inputs/TextInput/TextInput.js +1 -22
  106. package/dist/Inputs/TextInput/TextInput.js.map +1 -1
  107. package/dist/Inputs/TextInput/TextInput.module.css.js +1 -3
  108. package/dist/Inputs/TextInput/TextInput.module.css.js.map +1 -1
  109. package/dist/Inputs/ThemeToggle/ThemeToggleListItem.js +1 -30
  110. package/dist/Inputs/ThemeToggle/ThemeToggleListItem.js.map +1 -1
  111. package/dist/Layout/Dialog/Dialog.js +1 -74
  112. package/dist/Layout/Dialog/Dialog.js.map +1 -1
  113. package/dist/Layout/Dialog/Dialog.module.css.js +1 -3
  114. package/dist/Layout/Dialog/Dialog.module.css.js.map +1 -1
  115. package/dist/Layout/Drawer/Drawer.d.ts +1 -1
  116. package/dist/Layout/Drawer/Drawer.js +1 -38
  117. package/dist/Layout/Drawer/Drawer.js.map +1 -1
  118. package/dist/Layout/Drawer/Drawer.module.css.js +1 -3
  119. package/dist/Layout/Drawer/Drawer.module.css.js.map +1 -1
  120. package/dist/Layout/PageLayout/PageLayout.js +1 -24
  121. package/dist/Layout/PageLayout/PageLayout.js.map +1 -1
  122. package/dist/Layout/PageLayout/PageLayout.module.css.js +1 -3
  123. package/dist/Layout/PageLayout/PageLayout.module.css.js.map +1 -1
  124. package/dist/Layout/PageLayoutPagination/PageLayoutPagination.js +1 -12
  125. package/dist/Layout/PageLayoutPagination/PageLayoutPagination.js.map +1 -1
  126. package/dist/Layout/PageLayoutPagination/PageLayoutPagination.module.css.js +1 -3
  127. package/dist/Layout/PageLayoutPagination/PageLayoutPagination.module.css.js.map +1 -1
  128. package/dist/Layout/PageLayoutTabs/PageLayoutTabs.js +1 -21
  129. package/dist/Layout/PageLayoutTabs/PageLayoutTabs.js.map +1 -1
  130. package/dist/Layout/PageLayoutTabs/PageLayoutTabs.module.css.js +1 -3
  131. package/dist/Layout/PageLayoutTabs/PageLayoutTabs.module.css.js.map +1 -1
  132. package/dist/Layout/Popover/Popover.js +1 -102
  133. package/dist/Layout/Popover/Popover.js.map +1 -1
  134. package/dist/Layout/Popover/Popover.module.css.js +1 -3
  135. package/dist/Layout/Popover/Popover.module.css.js.map +1 -1
  136. package/dist/Layout/SectionWrapper/SectionWrapper.js +1 -10
  137. package/dist/Layout/SectionWrapper/SectionWrapper.js.map +1 -1
  138. package/dist/Layout/SectionWrapper/SectionWrapper.module.css.js +1 -3
  139. package/dist/Layout/SectionWrapper/SectionWrapper.module.css.js.map +1 -1
  140. package/dist/Layout/Sidebar/Sidebar.js +1 -24
  141. package/dist/Layout/Sidebar/Sidebar.js.map +1 -1
  142. package/dist/Layout/Sidebar/Sidebar.module.css.js +1 -3
  143. package/dist/Layout/Sidebar/Sidebar.module.css.js.map +1 -1
  144. package/dist/Layout/Sidebar/SidebarBody/SidebarBody.js +1 -13
  145. package/dist/Layout/Sidebar/SidebarBody/SidebarBody.js.map +1 -1
  146. package/dist/Layout/Sidebar/SidebarBody/SidebarBody.module.css.js +1 -3
  147. package/dist/Layout/Sidebar/SidebarBody/SidebarBody.module.css.js.map +1 -1
  148. package/dist/Layout/Sidebar/SidebarDrawer/SidebarDrawer.js +1 -13
  149. package/dist/Layout/Sidebar/SidebarDrawer/SidebarDrawer.js.map +1 -1
  150. package/dist/Layout/Sidebar/SidebarDrawer/SidebarDrawer.module.css.js +1 -3
  151. package/dist/Layout/Sidebar/SidebarDrawer/SidebarDrawer.module.css.js.map +1 -1
  152. package/dist/Layout/Sidebar/SidebarFooter/SidebarFooter.js +1 -13
  153. package/dist/Layout/Sidebar/SidebarFooter/SidebarFooter.js.map +1 -1
  154. package/dist/Layout/Sidebar/SidebarFooter/SidebarFooter.module.css.js +1 -3
  155. package/dist/Layout/Sidebar/SidebarFooter/SidebarFooter.module.css.js.map +1 -1
  156. package/dist/Layout/Sidebar/SidebarHeader/SidebarHeader.js +1 -11
  157. package/dist/Layout/Sidebar/SidebarHeader/SidebarHeader.js.map +1 -1
  158. package/dist/Layout/Sidebar/SidebarViewport/SidebarViewport.js +1 -10
  159. package/dist/Layout/Sidebar/SidebarViewport/SidebarViewport.js.map +1 -1
  160. package/dist/Layout/Sidebar/SidebarViewport/SidebarViewport.module.css.js +1 -3
  161. package/dist/Layout/Sidebar/SidebarViewport/SidebarViewport.module.css.js.map +1 -1
  162. package/dist/Layout/Table/Table.js +1 -130
  163. package/dist/Layout/Table/Table.js.map +1 -1
  164. package/dist/Layout/Table/Table.module.css.js +1 -3
  165. package/dist/Layout/Table/Table.module.css.js.map +1 -1
  166. package/dist/Layout/Table/TableFooter.js +1 -8
  167. package/dist/Layout/Table/TableFooter.js.map +1 -1
  168. package/dist/Layout/Table/TableHeader.js +1 -8
  169. package/dist/Layout/Table/TableHeader.js.map +1 -1
  170. package/dist/Layout/Table/tableUtils.js +1 -123
  171. package/dist/Layout/Table/tableUtils.js.map +1 -1
  172. package/dist/Misc/Cursor/Cursor.js +1 -58
  173. package/dist/Misc/Cursor/Cursor.js.map +1 -1
  174. package/dist/Misc/Cursor/Cursor.module.css.js +1 -3
  175. package/dist/Misc/Cursor/Cursor.module.css.js.map +1 -1
  176. package/dist/Misc/Logos.js +1 -28
  177. package/dist/Misc/Logos.js.map +1 -1
  178. package/dist/Misc/PoweredByBanner/PoweredByBanner.js +1 -11
  179. package/dist/Misc/PoweredByBanner/PoweredByBanner.js.map +1 -1
  180. package/dist/Misc/PoweredByBanner/PoweredByBanner.module.css.js +1 -3
  181. package/dist/Misc/PoweredByBanner/PoweredByBanner.module.css.js.map +1 -1
  182. package/dist/Misc/Ripple/Ripple.js +1 -61
  183. package/dist/Misc/Ripple/Ripple.js.map +1 -1
  184. package/dist/Misc/Ripple/Ripple.module.css.js +1 -3
  185. package/dist/Misc/Ripple/Ripple.module.css.js.map +1 -1
  186. package/dist/Misc/Spinner/Spinner.js +1 -11
  187. package/dist/Misc/Spinner/Spinner.js.map +1 -1
  188. package/dist/Misc/Spinner/Spinner.module.css.js +1 -3
  189. package/dist/Misc/Spinner/Spinner.module.css.js.map +1 -1
  190. package/dist/Misc/TransitionAnimation/TransitionAnimation.js +1 -86
  191. package/dist/Misc/TransitionAnimation/TransitionAnimation.js.map +1 -1
  192. package/dist/Misc/TransitionAnimation/TransitionAnimation.module.css.js +1 -3
  193. package/dist/Misc/TransitionAnimation/TransitionAnimation.module.css.js.map +1 -1
  194. package/dist/Navigation/Breadcrumbs/Breadcrumbs.js +1 -35
  195. package/dist/Navigation/Breadcrumbs/Breadcrumbs.js.map +1 -1
  196. package/dist/Navigation/Breadcrumbs/Breadcrumbs.module.css.js +1 -3
  197. package/dist/Navigation/Breadcrumbs/Breadcrumbs.module.css.js.map +1 -1
  198. package/dist/Navigation/Breadcrumbs/BreadcrumbsItem.js +1 -14
  199. package/dist/Navigation/Breadcrumbs/BreadcrumbsItem.js.map +1 -1
  200. package/dist/Navigation/Breadcrumbs/useBreadcrumbs.js +1 -43
  201. package/dist/Navigation/Breadcrumbs/useBreadcrumbs.js.map +1 -1
  202. package/dist/Navigation/Pagination/Pagination.js +1 -60
  203. package/dist/Navigation/Pagination/Pagination.js.map +1 -1
  204. package/dist/Navigation/Pagination/Pagination.module.css.js +1 -3
  205. package/dist/Navigation/Pagination/Pagination.module.css.js.map +1 -1
  206. package/dist/Navigation/Pagination/PaginationItem.js +1 -13
  207. package/dist/Navigation/Pagination/PaginationItem.js.map +1 -1
  208. package/dist/Navigation/Pagination/usePagination.js +1 -37
  209. package/dist/Navigation/Pagination/usePagination.js.map +1 -1
  210. package/dist/Navigation/Tabs/Tab/Tab.js +1 -69
  211. package/dist/Navigation/Tabs/Tab/Tab.js.map +1 -1
  212. package/dist/Navigation/Tabs/Tab/Tab.module.css.js +1 -3
  213. package/dist/Navigation/Tabs/Tab/Tab.module.css.js.map +1 -1
  214. package/dist/Navigation/Tabs/Tabs.js +1 -21
  215. package/dist/Navigation/Tabs/Tabs.js.map +1 -1
  216. package/dist/Navigation/Tabs/TabsBar/TabsBar.d.ts +5 -2
  217. package/dist/Navigation/Tabs/TabsBar/TabsBar.js +1 -43
  218. package/dist/Navigation/Tabs/TabsBar/TabsBar.js.map +1 -1
  219. package/dist/Navigation/Tabs/TabsBar/TabsBar.module.css.js +1 -3
  220. package/dist/Navigation/Tabs/TabsBar/TabsBar.module.css.js.map +1 -1
  221. package/dist/Typography/ClampedText/ClampedText.js +1 -43
  222. package/dist/Typography/ClampedText/ClampedText.js.map +1 -1
  223. package/dist/Typography/ClampedText/ClampedText.module.css.js +1 -3
  224. package/dist/Typography/ClampedText/ClampedText.module.css.js.map +1 -1
  225. package/dist/Typography/CopyableText/CopyableText.js +1 -38
  226. package/dist/Typography/CopyableText/CopyableText.js.map +1 -1
  227. package/dist/Typography/CopyableText/CopyableText.module.css.js +1 -3
  228. package/dist/Typography/CopyableText/CopyableText.module.css.js.map +1 -1
  229. package/dist/Typography/PageTitle/PageTitle.js +1 -9
  230. package/dist/Typography/PageTitle/PageTitle.js.map +1 -1
  231. package/dist/Typography/PageTitle/PageTitle.module.css.js +1 -3
  232. package/dist/Typography/PageTitle/PageTitle.module.css.js.map +1 -1
  233. package/dist/index.css +1 -2398
  234. package/dist/index.js +1 -64
  235. package/dist/index.js.map +1 -1
  236. package/package.json +6 -4
  237. package/rollup.config.js +0 -34
@@ -1,103 +1,2 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { useRef, useEffect } from 'react';
4
- import styles from './Popover.module.css.js';
5
- import { cn } from '@studiocubics/utils';
6
-
7
- function Popover({ children, anchorEl, open, className, onClose, anchorPosition = { vertical: "bottom", horizontal: "center" }, transformOrigin = { vertical: "top", horizontal: "left" }, ...rest }) {
8
- const popoverRef = useRef(null);
9
- // Sync controlled `open` state with native API
10
- useEffect(() => {
11
- const popover = popoverRef.current;
12
- if (!popover)
13
- return;
14
- if (open && !popover.matches(":popover-open")) {
15
- popover.showPopover();
16
- }
17
- else if (!open && popover.matches(":popover-open")) {
18
- popover.hidePopover();
19
- }
20
- }, [open]);
21
- // Handle outside click + escape
22
- useEffect(() => {
23
- const popover = popoverRef.current;
24
- if (!popover)
25
- return;
26
- const handleToggle = () => {
27
- if (!popover.matches(":popover-open")) {
28
- onClose();
29
- }
30
- };
31
- popover.addEventListener("toggle", handleToggle);
32
- return () => {
33
- popover.removeEventListener("toggle", handleToggle);
34
- };
35
- }, [onClose]);
36
- // JS positioning
37
- useEffect(() => {
38
- const popover = popoverRef.current;
39
- if (!popover || !anchorEl || !open)
40
- return;
41
- const anchorRect = anchorEl.getBoundingClientRect();
42
- const popoverRect = popover.getBoundingClientRect();
43
- const margin = 8;
44
- let top = 0;
45
- let left = 0;
46
- // Compute anchor-based position
47
- switch (anchorPosition.vertical) {
48
- case "top":
49
- top = anchorRect.top;
50
- break;
51
- case "center":
52
- top = anchorRect.top + anchorRect.height / 2;
53
- break;
54
- case "bottom":
55
- top = anchorRect.bottom;
56
- break;
57
- }
58
- switch (anchorPosition.horizontal) {
59
- case "left":
60
- left = anchorRect.left;
61
- break;
62
- case "center":
63
- left = anchorRect.left + anchorRect.width / 2;
64
- break;
65
- case "right":
66
- left = anchorRect.right;
67
- break;
68
- }
69
- // Apply transform origin
70
- switch (transformOrigin.vertical) {
71
- case "center":
72
- top -= popoverRect.height / 2;
73
- break;
74
- case "bottom":
75
- top -= popoverRect.height;
76
- break;
77
- // top -> no change
78
- }
79
- switch (transformOrigin.horizontal) {
80
- case "center":
81
- left -= popoverRect.width / 2;
82
- break;
83
- case "right":
84
- left -= popoverRect.width;
85
- break;
86
- // left -> no change
87
- }
88
- // Clamp so the popover stays fully in viewport
89
- const viewportWidth = document.documentElement.clientWidth;
90
- const viewportHeight = document.documentElement.clientHeight;
91
- const maxLeft = viewportWidth - popoverRect.width - margin;
92
- const maxTop = viewportHeight - popoverRect.height - margin;
93
- left = Math.min(Math.max(left, margin), maxLeft);
94
- top = Math.min(Math.max(top, margin), maxTop);
95
- // Apply scroll offset
96
- popover.style.top = `${top + window.scrollY}px`;
97
- popover.style.left = `${left + window.scrollX}px`;
98
- }, [open, anchorEl, anchorPosition, transformOrigin]);
99
- return (jsx("div", { ...rest, className: cn(styles.root, className, open ? styles.open : ""), ref: popoverRef, popover: "auto", children: children }));
100
- }
101
-
102
- export { Popover };
1
+ "use client";import{jsx as t}from"react/jsx-runtime";import{useRef as e,useEffect as o}from"react";import r from"./Popover.module.css.js";import{cn as n}from"@studiocubics/utils";function c({children:c,anchorEl:i,open:s,className:a,onClose:l,anchorPosition:h={vertical:"bottom",horizontal:"center"},transformOrigin:m={vertical:"top",horizontal:"left"},...p}){const u=e(null);return o(()=>{const t=u.current;t&&(s&&!t.matches(":popover-open")?t.showPopover():!s&&t.matches(":popover-open")&&t.hidePopover())},[s]),o(()=>{const t=u.current;if(!t)return;const e=()=>{t.matches(":popover-open")||l()};return t.addEventListener("toggle",e),()=>{t.removeEventListener("toggle",e)}},[l]),o(()=>{const t=u.current;if(!t||!i||!s)return;const e=i.getBoundingClientRect(),o=t.getBoundingClientRect();let r=0,n=0;switch(h.vertical){case"top":r=e.top;break;case"center":r=e.top+e.height/2;break;case"bottom":r=e.bottom}switch(h.horizontal){case"left":n=e.left;break;case"center":n=e.left+e.width/2;break;case"right":n=e.right}switch(m.vertical){case"center":r-=o.height/2;break;case"bottom":r-=o.height}switch(m.horizontal){case"center":n-=o.width/2;break;case"right":n-=o.width}const c=document.documentElement.clientWidth,a=document.documentElement.clientHeight,l=c-o.width-8,p=a-o.height-8;n=Math.min(Math.max(n,8),l),r=Math.min(Math.max(r,8),p),t.style.top=`${r+window.scrollY}px`,t.style.left=`${n+window.scrollX}px`},[s,i,h,m]),t("div",{...p,className:n(r.root,a,s?r.open:""),ref:u,popover:"auto",children:c})}export{c as Popover};
103
2
  //# sourceMappingURL=Popover.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sources":["../../../src/Layout/Popover/Popover.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useRef, useEffect, type ComponentProps } from \"react\";\nimport styles from \"./Popover.module.css\";\nimport { cn } from \"@studiocubics/utils\";\n\nexport interface PositionType {\n vertical: \"top\" | \"center\" | \"bottom\";\n horizontal: \"left\" | \"center\" | \"right\";\n}\n\nexport interface PopoverProps extends ComponentProps<\"div\"> {\n children: ReactNode;\n anchorEl: HTMLElement | null;\n open: boolean;\n onClose: () => void;\n anchorPosition?: PositionType;\n transformOrigin?: PositionType;\n}\n\nexport function Popover({\n children,\n anchorEl,\n open,\n className,\n onClose,\n anchorPosition = { vertical: \"bottom\", horizontal: \"center\" },\n transformOrigin = { vertical: \"top\", horizontal: \"left\" },\n ...rest\n}: PopoverProps) {\n const popoverRef = useRef<HTMLDivElement>(null);\n\n // Sync controlled `open` state with native API\n useEffect(() => {\n const popover = popoverRef.current;\n if (!popover) return;\n\n if (open && !popover.matches(\":popover-open\")) {\n popover.showPopover();\n } else if (!open && popover.matches(\":popover-open\")) {\n popover.hidePopover();\n }\n }, [open]);\n\n // Handle outside click + escape\n useEffect(() => {\n const popover = popoverRef.current;\n if (!popover) return;\n\n const handleToggle = () => {\n if (!popover.matches(\":popover-open\")) {\n onClose();\n }\n };\n\n popover.addEventListener(\"toggle\", handleToggle);\n return () => {\n popover.removeEventListener(\"toggle\", handleToggle);\n };\n }, [onClose]);\n\n // JS positioning\n useEffect(() => {\n const popover = popoverRef.current;\n if (!popover || !anchorEl || !open) return;\n\n const anchorRect = anchorEl.getBoundingClientRect();\n const popoverRect = popover.getBoundingClientRect();\n const margin = 8;\n\n let top = 0;\n let left = 0;\n\n // Compute anchor-based position\n switch (anchorPosition.vertical) {\n case \"top\":\n top = anchorRect.top;\n break;\n case \"center\":\n top = anchorRect.top + anchorRect.height / 2;\n break;\n case \"bottom\":\n top = anchorRect.bottom;\n break;\n }\n\n switch (anchorPosition.horizontal) {\n case \"left\":\n left = anchorRect.left;\n break;\n case \"center\":\n left = anchorRect.left + anchorRect.width / 2;\n break;\n case \"right\":\n left = anchorRect.right;\n break;\n }\n\n // Apply transform origin\n switch (transformOrigin.vertical) {\n case \"center\":\n top -= popoverRect.height / 2;\n break;\n case \"bottom\":\n top -= popoverRect.height;\n break;\n // top -> no change\n }\n\n switch (transformOrigin.horizontal) {\n case \"center\":\n left -= popoverRect.width / 2;\n break;\n case \"right\":\n left -= popoverRect.width;\n break;\n // left -> no change\n }\n\n // Clamp so the popover stays fully in viewport\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n\n const maxLeft = viewportWidth - popoverRect.width - margin;\n const maxTop = viewportHeight - popoverRect.height - margin;\n\n left = Math.min(Math.max(left, margin), maxLeft);\n top = Math.min(Math.max(top, margin), maxTop);\n\n // Apply scroll offset\n popover.style.top = `${top + window.scrollY}px`;\n popover.style.left = `${left + window.scrollX}px`;\n }, [open, anchorEl, anchorPosition, transformOrigin]);\n\n return (\n <div\n {...rest}\n className={cn(styles.root, className, open ? styles.open : \"\")}\n ref={popoverRef}\n popover=\"auto\"\n >\n {children}\n </div>\n );\n}\n"],"names":["_jsx"],"mappings":";;;;;;SAoBgB,OAAO,CAAC,CAAA,CACtB,QAAQ,CAAA,CACR,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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAC,CAAC;AAErD,CAAA,CAAA,CAAA,CAAA,QACEA,CAAAA,CAAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA,GACM,CAAA,CAAA,CAAA,CAAI,CAAA,CACR,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAE,EAAE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAA,CAAA,CAAA,CAAI,CAAA,CAAE,SAAS,CAAA,CAAE,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAG,EAAE,CAAC,CAAA,CAC9D,GAAG,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CACf,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,EAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,WAEb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,EAAA,CACL,CAAA;AAEV;;"}
1
+ {"version":3,"file":"Popover.js","sources":["../../../src/Layout/Popover/Popover.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useRef, useEffect, type ComponentProps } from \"react\";\nimport styles from \"./Popover.module.css\";\nimport { cn } from \"@studiocubics/utils\";\n\nexport interface PositionType {\n vertical: \"top\" | \"center\" | \"bottom\";\n horizontal: \"left\" | \"center\" | \"right\";\n}\n\nexport interface PopoverProps extends ComponentProps<\"div\"> {\n children: ReactNode;\n anchorEl: HTMLElement | null;\n open: boolean;\n onClose: () => void;\n anchorPosition?: PositionType;\n transformOrigin?: PositionType;\n}\n\nexport function Popover({\n children,\n anchorEl,\n open,\n className,\n onClose,\n anchorPosition = { vertical: \"bottom\", horizontal: \"center\" },\n transformOrigin = { vertical: \"top\", horizontal: \"left\" },\n ...rest\n}: PopoverProps) {\n const popoverRef = useRef<HTMLDivElement>(null);\n\n // Sync controlled `open` state with native API\n useEffect(() => {\n const popover = popoverRef.current;\n if (!popover) return;\n\n if (open && !popover.matches(\":popover-open\")) {\n popover.showPopover();\n } else if (!open && popover.matches(\":popover-open\")) {\n popover.hidePopover();\n }\n }, [open]);\n\n // Handle outside click + escape\n useEffect(() => {\n const popover = popoverRef.current;\n if (!popover) return;\n\n const handleToggle = () => {\n if (!popover.matches(\":popover-open\")) {\n onClose();\n }\n };\n\n popover.addEventListener(\"toggle\", handleToggle);\n return () => {\n popover.removeEventListener(\"toggle\", handleToggle);\n };\n }, [onClose]);\n\n // JS positioning\n useEffect(() => {\n const popover = popoverRef.current;\n if (!popover || !anchorEl || !open) return;\n\n const anchorRect = anchorEl.getBoundingClientRect();\n const popoverRect = popover.getBoundingClientRect();\n const margin = 8;\n\n let top = 0;\n let left = 0;\n\n // Compute anchor-based position\n switch (anchorPosition.vertical) {\n case \"top\":\n top = anchorRect.top;\n break;\n case \"center\":\n top = anchorRect.top + anchorRect.height / 2;\n break;\n case \"bottom\":\n top = anchorRect.bottom;\n break;\n }\n\n switch (anchorPosition.horizontal) {\n case \"left\":\n left = anchorRect.left;\n break;\n case \"center\":\n left = anchorRect.left + anchorRect.width / 2;\n break;\n case \"right\":\n left = anchorRect.right;\n break;\n }\n\n // Apply transform origin\n switch (transformOrigin.vertical) {\n case \"center\":\n top -= popoverRect.height / 2;\n break;\n case \"bottom\":\n top -= popoverRect.height;\n break;\n // top -> no change\n }\n\n switch (transformOrigin.horizontal) {\n case \"center\":\n left -= popoverRect.width / 2;\n break;\n case \"right\":\n left -= popoverRect.width;\n break;\n // left -> no change\n }\n\n // Clamp so the popover stays fully in viewport\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n\n const maxLeft = viewportWidth - popoverRect.width - margin;\n const maxTop = viewportHeight - popoverRect.height - margin;\n\n left = Math.min(Math.max(left, margin), maxLeft);\n top = Math.min(Math.max(top, margin), maxTop);\n\n // Apply scroll offset\n popover.style.top = `${top + window.scrollY}px`;\n popover.style.left = `${left + window.scrollX}px`;\n }, [open, anchorEl, anchorPosition, transformOrigin]);\n\n return (\n <div\n {...rest}\n className={cn(styles.root, className, open ? styles.open : \"\")}\n ref={popoverRef}\n popover=\"auto\"\n >\n {children}\n </div>\n );\n}\n"],"names":["Popover","children","anchorEl","open","className","onClose","anchorPosition","vertical","horizontal","transformOrigin","rest","popoverRef","useRef","useEffect","popover","current","matches","showPopover","hidePopover","handleToggle","addEventListener","removeEventListener","anchorRect","getBoundingClientRect","popoverRect","top","left","height","bottom","width","right","viewportWidth","document","documentElement","clientWidth","viewportHeight","clientHeight","maxLeft","maxTop","Math","min","max","style","window","scrollY","scrollX","_jsx","cn","styles","root","ref"],"mappings":"4LAoBgBA,GAAQC,SACtBA,EAAQC,SACRA,EAAQC,KACRA,EAAIC,UACJA,EAASC,QACTA,EAAOC,eACPA,EAAiB,CAAEC,SAAU,SAAUC,WAAY,UAAUC,gBAC7DA,EAAkB,CAAEF,SAAU,MAAOC,WAAY,WAC9CE,IAEH,MAAMC,EAAaC,EAAuB,MAwG1C,OArGAC,EAAU,KACR,MAAMC,EAAUH,EAAWI,QACtBD,IAEDX,IAASW,EAAQE,QAAQ,iBAC3BF,EAAQG,eACEd,GAAQW,EAAQE,QAAQ,kBAClCF,EAAQI,gBAET,CAACf,IAGJU,EAAU,KACR,MAAMC,EAAUH,EAAWI,QAC3B,IAAKD,EAAS,OAEd,MAAMK,EAAe,KACdL,EAAQE,QAAQ,kBACnBX,KAKJ,OADAS,EAAQM,iBAAiB,SAAUD,GAC5B,KACLL,EAAQO,oBAAoB,SAAUF,KAEvC,CAACd,IAGJQ,EAAU,KACR,MAAMC,EAAUH,EAAWI,QAC3B,IAAKD,IAAYZ,IAAaC,EAAM,OAEpC,MAAMmB,EAAapB,E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
1
+ var o={root:"Popover-module_root__HE-kk",open:"Popover-module_open__1aLk-"};export{o as default};
4
2
  //# sourceMappingURL=Popover.module.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"Popover.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,11 +1,2 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import styles from './SectionWrapper.module.css.js';
3
- import { cssSafeString, cn } from '@studiocubics/utils';
4
-
5
- function SectionWrapper(props) {
6
- const { title, subtitle, children, noBorders, slotProps = {}, containerClassname, className, ...rest } = props;
7
- return (jsxs("section", { className: cn(containerClassname, styles.root, noBorders ? styles.noBorders : ""), id: typeof title == "string" ? cssSafeString(title) : undefined, ...rest, children: [jsxs("div", { ...slotProps.header, className: cn(styles.header, slotProps.header?.className), children: [typeof title == "string" ? (jsx("h4", { ...slotProps.title, children: title })) : (title), subtitle && typeof subtitle == "string" ? (jsx("p", { ...slotProps.subtitle, children: subtitle })) : (subtitle)] }), jsx("div", { ...slotProps.content, className: cn(styles.content, slotProps.content?.className, className), children: children })] }));
8
- }
9
-
10
- export { SectionWrapper };
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import r from"./SectionWrapper.module.css.js";import{cssSafeString as s,cn as o}from"@studiocubics/utils";function i(i){const{title:n,subtitle:c,children:a,noBorders:l,slotProps:d={},containerClassname:m,className:p,...h}=i;return e("section",{className:o(m,r.root,l?r.noBorders:""),id:"string"==typeof n?s(n):void 0,...h,children:[e("div",{...d.header,className:o(r.header,d.header?.className),children:["string"==typeof n?t("h4",{...d.title,children:n}):n,c&&"string"==typeof c?t("p",{...d.subtitle,children:c}):c]}),t("div",{...d.content,className:o(r.content,d.content?.className,p),children:a})]})}export{i as SectionWrapper};
11
2
  //# sourceMappingURL=SectionWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SectionWrapper.js","sources":["../../../src/Layout/SectionWrapper/SectionWrapper.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from \"react\";\nimport styles from \"./SectionWrapper.module.css\";\nimport { cn, cssSafeString } from \"@studiocubics/utils\";\n\nexport interface SectionWrapperProps\n extends Omit<ComponentProps<\"section\">, \"title\"> {\n title: ReactNode;\n subtitle?: ReactNode;\n noBorders?: boolean;\n containerClassname?: string;\n slotProps?: {\n header?: ComponentProps<\"div\">;\n title?: ComponentProps<\"h4\">;\n subtitle?: ComponentProps<\"p\">;\n content?: ComponentProps<\"div\">;\n };\n}\nexport function SectionWrapper(props: SectionWrapperProps) {\n const {\n title,\n subtitle,\n children,\n noBorders,\n slotProps = {},\n containerClassname,\n className,\n ...rest\n } = props;\n return (\n <section\n className={cn(\n containerClassname,\n styles.root,\n noBorders ? styles.noBorders : \"\"\n )}\n id={typeof title == \"string\" ? cssSafeString(title) : undefined}\n {...rest}\n >\n <div\n {...slotProps.header}\n className={cn(styles.header, slotProps.header?.className)}\n >\n {typeof title == \"string\" ? (\n <h4 {...slotProps.title}>{title}</h4>\n ) : (\n title\n )}\n {subtitle && typeof subtitle == \"string\" ? (\n <p {...slotProps.subtitle}>{subtitle}</p>\n ) : (\n subtitle\n )}\n </div>\n <div\n {...slotProps.content}\n className={cn(styles.content, slotProps.content?.className, className)}\n >\n {children}\n </div>\n </section>\n );\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;AAiBM,SAAU,cAAc,CAAC,KAA0B,EAAA;IACvD,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,GAAG,EAAE,EACd,kBAAkB,EAClB,SAAS,EACT,GAAG,IAAI,EACR,GAAG,KAAK;AACT,IAAA,QACEA,IAAA,CAAA,SAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,kBAAkB,EAClB,MAAM,CAAC,IAAI,EACX,SAAS,GAAG,MAAM,CAAC,SAAS,GAAG,EAAE,CAClC,EACD,EAAE,EAAE,OAAO,KAAK,IAAI,QAAQ,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,SAAS,EAAA,GAC3D,IAAI,EAAA,QAAA,EAAA,CAERA,IAAA,CAAA,KAAA,EAAA,EAAA,GACM,SAAS,CAAC,MAAM,EACpB,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,EAAA,QAAA,EAAA,CAExD,OAAO,KAAK,IAAI,QAAQ,IACvBC,GAAA,CAAA,IAAA,EAAA,EAAA,GAAQ,SAAS,CAAC,KAAK,EAAA,QAAA,EAAG,KAAK,EAAA,CAAM,KAErC,KAAK,CACN,EACA,QAAQ,IAAI,OAAO,QAAQ,IAAI,QAAQ,IACtCA,GAAA,CAAA,GAAA,EAAA,EAAA,GAAO,SAAS,CAAC,QAAQ,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAK,KAEzC,QAAQ,CACT,IACG,EACNA,GAAA,CAAA,KAAA,EAAA,EAAA,GACM,SAAS,CAAC,OAAO,EACrB,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,EAAA,QAAA,EAErE,QAAQ,EAAA,CACL,CAAA,EAAA,CACE;AAEd;;;;"}
1
+ {"version":3,"file":"SectionWrapper.js","sources":["../../../src/Layout/SectionWrapper/SectionWrapper.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from \"react\";\nimport styles from \"./SectionWrapper.module.css\";\nimport { cn, cssSafeString } from \"@studiocubics/utils\";\n\nexport interface SectionWrapperProps\n extends Omit<ComponentProps<\"section\">, \"title\"> {\n title: ReactNode;\n subtitle?: ReactNode;\n noBorders?: boolean;\n containerClassname?: string;\n slotProps?: {\n header?: ComponentProps<\"div\">;\n title?: ComponentProps<\"h4\">;\n subtitle?: ComponentProps<\"p\">;\n content?: ComponentProps<\"div\">;\n };\n}\nexport function SectionWrapper(props: SectionWrapperProps) {\n const {\n title,\n subtitle,\n children,\n noBorders,\n slotProps = {},\n containerClassname,\n className,\n ...rest\n } = props;\n return (\n <section\n className={cn(\n containerClassname,\n styles.root,\n noBorders ? styles.noBorders : \"\"\n )}\n id={typeof title == \"string\" ? cssSafeString(title) : undefined}\n {...rest}\n >\n <div\n {...slotProps.header}\n className={cn(styles.header, slotProps.header?.className)}\n >\n {typeof title == \"string\" ? (\n <h4 {...slotProps.title}>{title}</h4>\n ) : (\n title\n )}\n {subtitle && typeof subtitle == \"string\" ? (\n <p {...slotProps.subtitle}>{subtitle}</p>\n ) : (\n subtitle\n )}\n </div>\n <div\n {...slotProps.content}\n className={cn(styles.content, slotProps.content?.className, className)}\n >\n {children}\n </div>\n </section>\n );\n}\n"],"names":["SectionWrapper","props","title","subtitle","children","noBorders","slotProps","containerClassname","className","rest","_jsxs","cn","styles","root","id","cssSafeString","undefined","header","_jsx","content"],"mappings":"4JAiBM,SAAUA,EAAeC,GAC7B,MAAMC,MACJA,EAAKC,SACLA,EAAQC,SACRA,EAAQC,UACRA,EAASC,UACTA,EAAY,CAAA,EAAEC,mBACdA,EAAkBC,UAClBA,KACGC,GACDR,EACJ,OACES,EAAA,UAAA,CACEF,UAAWG,EACTJ,EACAK,EAAOC,KACPR,EAAYO,EAAOP,UAAY,IAEjCS,GAAoB,iBAATZ,EAAoBa,EAAcb,QAASc,KAClDP,EAAIL,SAAA,CAERM,EAAA,MAAA,IACMJ,EAAUW,OACdT,UAAWG,EAAGC,EAAOK,OAAQX,EAAUW,QAAQT,WAAUJ,SAAA,CAExC,iBAATF,EACNgB,EAAA,KAAA,IAAQZ,EAAUJ,MAAKE,SAAGF,IAAW,EAItCC,GAA+B,iBAAZA,EAClBe,EAAA,IAAA,IAAOZ,EAAUH,SAAQC,SAAGD,IAAa,KAK7Ce,EAAA,MAAA,IACMZ,EAAUa,QACdX,UAAWG,EAAGC,EAAOO,QAASb,EAAUa,SAASX,UAAWA,GAAUJ,SAErEA,MAIT"}
@@ -1,4 +1,2 @@
1
- var styles = {"root":"SectionWrapper-module_root__K-O4Y","header":"SectionWrapper-module_header__8-h-6","noBorders":"SectionWrapper-module_noBorders__brOqe","content":"SectionWrapper-module_content__Ruu8X"};
2
-
3
- export { styles as default };
1
+ var e={root:"SectionWrapper-module_root__K-O4Y",header:"SectionWrapper-module_header__8-h-6",noBorders:"SectionWrapper-module_noBorders__brOqe",content:"SectionWrapper-module_content__Ruu8X"};export{e as default};
4
2
  //# sourceMappingURL=SectionWrapper.module.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SectionWrapper.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"SectionWrapper.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,25 +1,2 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { createContext, useContext, useState } from 'react';
4
- import styles from './Sidebar.module.css.js';
5
-
6
- const SidebarContext = createContext(null);
7
- function useSidebar() {
8
- const c = useContext(SidebarContext);
9
- if (!c)
10
- throw new Error("Components must be wrapped in <SidebarProvider/>");
11
- return c;
12
- }
13
- const SIDEBAR_COOKIE = "sidebarOpen";
14
- const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
15
- function Sidebar({ children, defaultOpen }) {
16
- const [sidebarOpen, setSidebarOpen] = useState(defaultOpen ?? false);
17
- async function toggleSidebar() {
18
- setSidebarOpen((v) => !v);
19
- document.cookie = `${SIDEBAR_COOKIE}=${!sidebarOpen}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
20
- }
21
- return (jsx(SidebarContext.Provider, { value: { sidebarOpen, toggleSidebar }, children: jsx("div", { className: styles.root, children: children }) }));
22
- }
23
-
24
- export { SIDEBAR_COOKIE, SIDEBAR_COOKIE_MAX_AGE, Sidebar, useSidebar };
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import{createContext as r,useContext as n,useState as o}from"react";import t from"./Sidebar.module.css.js";const i=r(null);function c(){const e=n(i);if(!e)throw new Error("Components must be wrapped in <SidebarProvider/>");return e}const a="sidebarOpen",s=604800;function d({children:r,defaultOpen:n}){const[c,s]=o(n??!1);return e(i.Provider,{value:{sidebarOpen:c,toggleSidebar:async function(){s(e=>!e),document.cookie=`${a}=${!c}; path=/; max-age=604800`}},children:e("div",{className:t.root,children:r})})}export{a as SIDEBAR_COOKIE,s as SIDEBAR_COOKIE_MAX_AGE,d as Sidebar,c as useSidebar};
25
2
  //# sourceMappingURL=Sidebar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.js","sources":["../../../src/Layout/Sidebar/Sidebar.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, type ReactNode, useContext, useState } from \"react\";\nimport styles from \"./Sidebar.module.css\";\n\ninterface SidebarContextProps {\n sidebarOpen: boolean;\n toggleSidebar(): void;\n}\ninterface SidebarProps {\n children: ReactNode;\n defaultOpen?: boolean;\n storageKey?: string;\n}\n\nconst SidebarContext = createContext<SidebarContextProps | null>(null);\n\nexport function useSidebar() {\n const c = useContext(SidebarContext);\n if (!c) throw new Error(\"Components must be wrapped in <SidebarProvider/>\");\n return c;\n}\nexport const SIDEBAR_COOKIE = \"sidebarOpen\";\nexport const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;\n\nexport function Sidebar({ children, defaultOpen }: SidebarProps) {\n const [sidebarOpen, setSidebarOpen] = useState(defaultOpen ?? false);\n\n async function toggleSidebar() {\n setSidebarOpen((v) => !v);\n document.cookie = `${SIDEBAR_COOKIE}=${!sidebarOpen}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;\n }\n\n return (\n <SidebarContext.Provider value={{ sidebarOpen, toggleSidebar }}>\n <div className={styles.root}>{children}</div>\n </SidebarContext.Provider>\n );\n}\n"],"names":["_jsx"],"mappings":";;;;;AAeA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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CAAA,CAAA,CAAA,CAAW,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAC5DA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,QAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAO,EAAA,CACrB,CAAA;AAE9B;;"}
1
+ {"version":3,"file":"Sidebar.js","sources":["../../../src/Layout/Sidebar/Sidebar.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, type ReactNode, useContext, useState } from \"react\";\nimport styles from \"./Sidebar.module.css\";\n\ninterface SidebarContextProps {\n sidebarOpen: boolean;\n toggleSidebar(): void;\n}\ninterface SidebarProps {\n children: ReactNode;\n defaultOpen?: boolean;\n storageKey?: string;\n}\n\nconst SidebarContext = createContext<SidebarContextProps | null>(null);\n\nexport function useSidebar() {\n const c = useContext(SidebarContext);\n if (!c) throw new Error(\"Components must be wrapped in <SidebarProvider/>\");\n return c;\n}\nexport const SIDEBAR_COOKIE = \"sidebarOpen\";\nexport const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;\n\nexport function Sidebar({ children, defaultOpen }: SidebarProps) {\n const [sidebarOpen, setSidebarOpen] = useState(defaultOpen ?? false);\n\n async function toggleSidebar() {\n setSidebarOpen((v) => !v);\n document.cookie = `${SIDEBAR_COOKIE}=${!sidebarOpen}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;\n }\n\n return (\n <SidebarContext.Provider value={{ sidebarOpen, toggleSidebar }}>\n <div className={styles.root}>{children}</div>\n </SidebarContext.Provider>\n );\n}\n"],"names":["SidebarContext","createContext","useSidebar","c","useContext","Error","SIDEBAR_COOKIE","SIDEBAR_COOKIE_MAX_AGE","Sidebar","children","defaultOpen","sidebarOpen","setSidebarOpen","useState","_jsx","Provider","value","toggleSidebar","async","v","document","cookie","className","styles","root"],"mappings":"gKAeA,MAAMA,EAAiBC,EAA0C,eAEjDC,IACd,MAAMC,EAAIC,EAAWJ,GACrB,IAAKG,EAAG,MAAM,IAAIE,MAAM,oDACxB,OAAOF,CACT,CACO,MAAMG,EAAiB,cACjBC,EAAyB,gBAEtBC,GAAQC,SAAEA,EAAQC,YAAEA,IAClC,MAAOC,EAAaC,GAAkBC,EAASH,IAAe,GAO9D,OACEI,EAACd,EAAee,UAASC,MAAO,CAAEL,cAAaM,cANjDC,iBACEN,EAAgBO,IAAOA,GACvBC,SAASC,OAAS,GAAGf,MAAmBK,2BAC1C,GAGgEF,SAC5DK,EAAA,MAAA,CAAKQ,UAAWC,EAAOC,KAAIf,SAAGA,KAGpC"}
@@ -1,4 +1,2 @@
1
- var styles = {"root":"Sidebar-module_root__1stxg"};
2
-
3
- export { styles as default };
1
+ var o={root:"Sidebar-module_root__1stxg"};export{o as default};
4
2
  //# sourceMappingURL=Sidebar.module.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"Sidebar.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,14 +1,2 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import styles from './SidebarBody.module.css.js';
4
- import { cn } from '@studiocubics/utils';
5
- import { useSidebar } from '../Sidebar.js';
6
-
7
- function SidebarBody(props) {
8
- const { children, className, ...rest } = props;
9
- const { sidebarOpen } = useSidebar();
10
- return (jsx("div", { className: cn(styles.root, className, sidebarOpen ? styles.open : ""), ...rest, children: children }));
11
- }
12
-
13
- export { SidebarBody };
1
+ "use client";import{jsx as r}from"react/jsx-runtime";import o from"./SidebarBody.module.css.js";import{cn as e}from"@studiocubics/utils";import{useSidebar as i}from"../Sidebar.js";function s(s){const{children:t,className:m,...c}=s,{sidebarOpen:n}=i();return r("div",{className:e(o.root,m,n?o.open:""),...c,children:t})}export{s as SidebarBody};
14
2
  //# sourceMappingURL=SidebarBody.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarBody.js","sources":["../../../../src/Layout/Sidebar/SidebarBody/SidebarBody.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport styles from \"./SidebarBody.module.css\";\nimport { cn } from \"@studiocubics/utils\";\nimport { useSidebar } from \"../Sidebar\";\nexport function SidebarBody(props: ComponentProps<\"div\">) {\n const { children, className, ...rest } = props;\n const { sidebarOpen } = useSidebar();\n return (\n <div\n className={cn(styles.root, className, sidebarOpen ? styles.open : \"\")}\n {...rest}\n >\n {children}\n </div>\n );\n}\n"],"names":["_jsx"],"mappings":";;;;;;AAMM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAC,CAAA,CAAA,CAAA,CAAA,CAA4B,CAAA,CAAA;IACtD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,EAAE,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAI,CAAA,CAAE,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAK;AAC9C,CAAA,CAAA,CAAA,CAAA,MAAM,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAE,CAAA,CAAA,CAAG,UAAU,CAAA,CAAE;AACpC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACEA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAE,CAAA,CAAE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAA,CAAA,CAAA,CAAI,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAG,EAAE,CAAC,CAAA,CAAA,CAAA,CAAA,CACjE,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAEP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,EAAA,CACL,CAAA;AAEV;;"}
1
+ {"version":3,"file":"SidebarBody.js","sources":["../../../../src/Layout/Sidebar/SidebarBody/SidebarBody.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport styles from \"./SidebarBody.module.css\";\nimport { cn } from \"@studiocubics/utils\";\nimport { useSidebar } from \"../Sidebar\";\nexport function SidebarBody(props: ComponentProps<\"div\">) {\n const { children, className, ...rest } = props;\n const { sidebarOpen } = useSidebar();\n return (\n <div\n className={cn(styles.root, className, sidebarOpen ? styles.open : \"\")}\n {...rest}\n >\n {children}\n </div>\n );\n}\n"],"names":["SidebarBody","props","children","className","rest","sidebarOpen","useSidebar","_jsx","cn","styles","root","open"],"mappings":"oLAMM,SAAUA,EAAYC,GAC1B,MAAMC,SAAEA,EAAQC,UAAEA,KAAcC,GAASH,GACnCI,YAAEA,GAAgBC,IACxB,OACEC,EAAA,MAAA,CACEJ,UAAWK,EAAGC,EAAOC,KAAMP,EAAWE,EAAcI,EAAOE,KAAO,OAC9DP,EAAIF,SAEPA,GAGP"}
@@ -1,4 +1,2 @@
1
- var styles = {"root":"SidebarBody-module_root__yPbfH","open":"SidebarBody-module_open__gtCKF"};
2
-
3
- export { styles as default };
1
+ var o={root:"SidebarBody-module_root__yPbfH",open:"SidebarBody-module_open__gtCKF"};export{o as default};
4
2
  //# sourceMappingURL=SidebarBody.module.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarBody.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"SidebarBody.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,14 +1,2 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import styles from './SidebarDrawer.module.css.js';
4
- import { cn } from '@studiocubics/utils';
5
- import { useSidebar } from '../Sidebar.js';
6
-
7
- function SidebarDrawer(props) {
8
- const { children, className, ...rest } = props;
9
- const { sidebarOpen } = useSidebar();
10
- return (jsx("aside", { className: cn(styles.root, className, sidebarOpen ? styles.open : ""), ...rest, children: children }));
11
- }
12
-
13
- export { SidebarDrawer };
1
+ "use client";import{jsx as r}from"react/jsx-runtime";import e from"./SidebarDrawer.module.css.js";import{cn as i}from"@studiocubics/utils";import{useSidebar as o}from"../Sidebar.js";function s(s){const{children:t,className:m,...c}=s,{sidebarOpen:a}=o();return r("aside",{className:i(e.root,m,a?e.open:""),...c,children:t})}export{s as SidebarDrawer};
14
2
  //# sourceMappingURL=SidebarDrawer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarDrawer.js","sources":["../../../../src/Layout/Sidebar/SidebarDrawer/SidebarDrawer.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport styles from \"./SidebarDrawer.module.css\";\nimport { cn } from \"@studiocubics/utils\";\nimport { useSidebar } from \"../Sidebar\";\n\nexport function SidebarDrawer(props: ComponentProps<\"div\">) {\n const { children, className, ...rest } = props;\n const { sidebarOpen } = useSidebar();\n return (\n <aside\n className={cn(styles.root, className, sidebarOpen ? styles.open : \"\")}\n {...rest}\n >\n {children}\n </aside>\n );\n}\n"],"names":["_jsx"],"mappings":";;;;;;AAOM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAC,CAAA,CAAA,CAAA,CAAA,CAA4B,CAAA,CAAA;IACxD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,EAAE,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAI,CAAA,CAAE,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAK;AAC9C,CAAA,CAAA,CAAA,CAAA,MAAM,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAE,CAAA,CAAA,CAAG,UAAU,CAAA,CAAE;AACpC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACEA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAE,CAAA,CAAE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAA,CAAA,CAAA,CAAI,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAG,EAAE,CAAC,CAAA,CAAA,CAAA,CAAA,CACjE,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAEP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,EAAA,CACH,CAAA;AAEZ;;"}
1
+ {"version":3,"file":"SidebarDrawer.js","sources":["../../../../src/Layout/Sidebar/SidebarDrawer/SidebarDrawer.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport styles from \"./SidebarDrawer.module.css\";\nimport { cn } from \"@studiocubics/utils\";\nimport { useSidebar } from \"../Sidebar\";\n\nexport function SidebarDrawer(props: ComponentProps<\"div\">) {\n const { children, className, ...rest } = props;\n const { sidebarOpen } = useSidebar();\n return (\n <aside\n className={cn(styles.root, className, sidebarOpen ? styles.open : \"\")}\n {...rest}\n >\n {children}\n </aside>\n );\n}\n"],"names":["SidebarDrawer","props","children","className","rest","sidebarOpen","useSidebar","_jsx","cn","styles","root","open"],"mappings":"sLAOM,SAAUA,EAAcC,GAC5B,MAAMC,SAAEA,EAAQC,UAAEA,KAAcC,GAASH,GACnCI,YAAEA,GAAgBC,IACxB,OACEC,EAAA,QAAA,CACEJ,UAAWK,EAAGC,EAAOC,KAAMP,EAAWE,EAAcI,EAAOE,KAAO,OAC9DP,EAAIF,SAEPA,GAGP"}
@@ -1,4 +1,2 @@
1
- var styles = {"root":"SidebarDrawer-module_root__CJch2","open":"SidebarDrawer-module_open__E60Tc"};
2
-
3
- export { styles as default };
1
+ var e={root:"SidebarDrawer-module_root__CJch2",open:"SidebarDrawer-module_open__E60Tc"};export{e as default};
4
2
  //# sourceMappingURL=SidebarDrawer.module.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarDrawer.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"SidebarDrawer.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,14 +1,2 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { cn } from '@studiocubics/utils';
4
- import styles from './SidebarFooter.module.css.js';
5
- import { useSidebar } from '../Sidebar.js';
6
-
7
- function SidebarFooter(props) {
8
- const { children, className, ...rest } = props;
9
- const { sidebarOpen } = useSidebar();
10
- return (jsx("div", { className: cn(styles.root, className, sidebarOpen ? styles.open : ""), ...rest, children: children }));
11
- }
12
-
13
- export { SidebarFooter };
1
+ "use client";import{jsx as r}from"react/jsx-runtime";import{cn as o}from"@studiocubics/utils";import e from"./SidebarFooter.module.css.js";import{useSidebar as i}from"../Sidebar.js";function s(s){const{children:t,className:m,...c}=s,{sidebarOpen:n}=i();return r("div",{className:o(e.root,m,n?e.open:""),...c,children:t})}export{s as SidebarFooter};
14
2
  //# sourceMappingURL=SidebarFooter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarFooter.js","sources":["../../../../src/Layout/Sidebar/SidebarFooter/SidebarFooter.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@studiocubics/utils\";\nimport styles from \"./SidebarFooter.module.css\";\nimport type { ComponentProps } from \"react\";\nimport { useSidebar } from \"../Sidebar\";\n\nexport function SidebarFooter(props: ComponentProps<\"div\">) {\n const { children, className, ...rest } = props;\n const { sidebarOpen } = useSidebar();\n return (\n <div\n className={cn(styles.root, className, sidebarOpen ? styles.open : \"\")}\n {...rest}\n >\n {children}\n </div>\n );\n}\n"],"names":["_jsx"],"mappings":";;;;;;AAOM,CAAA,CAAA,CAAA,CAAA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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAEP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,EAAA,CACL,CAAA;AAEV;;"}
1
+ {"version":3,"file":"SidebarFooter.js","sources":["../../../../src/Layout/Sidebar/SidebarFooter/SidebarFooter.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@studiocubics/utils\";\nimport styles from \"./SidebarFooter.module.css\";\nimport type { ComponentProps } from \"react\";\nimport { useSidebar } from \"../Sidebar\";\n\nexport function SidebarFooter(props: ComponentProps<\"div\">) {\n const { children, className, ...rest } = props;\n const { sidebarOpen } = useSidebar();\n return (\n <div\n className={cn(styles.root, className, sidebarOpen ? styles.open : \"\")}\n {...rest}\n >\n {children}\n </div>\n );\n}\n"],"names":["SidebarFooter","props","children","className","rest","sidebarOpen","useSidebar","_jsx","cn","styles","root","open"],"mappings":"sLAOM,SAAUA,EAAcC,GAC5B,MAAMC,SAAEA,EAAQC,UAAEA,KAAcC,GAASH,GACnCI,YAAEA,GAAgBC,IACxB,OACEC,EAAA,MAAA,CACEJ,UAAWK,EAAGC,EAAOC,KAAMP,EAAWE,EAAcI,EAAOE,KAAO,OAC9DP,EAAIF,SAEPA,GAGP"}
@@ -1,4 +1,2 @@
1
- var styles = {"root":"SidebarFooter-module_root__AdFmj","open":"SidebarFooter-module_open__qHsZf"};
2
-
3
- export { styles as default };
1
+ var o={root:"SidebarFooter-module_root__AdFmj",open:"SidebarFooter-module_open__qHsZf"};export{o as default};
4
2
  //# sourceMappingURL=SidebarFooter.module.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarFooter.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"SidebarFooter.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,12 +1,2 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { useSidebar } from '../Sidebar.js';
4
-
5
- function SidebarHeader(props) {
6
- const { children, ...rest } = props;
7
- const { sidebarOpen } = useSidebar();
8
- return (jsx("div", { "data-open": sidebarOpen, ...rest, children: children }));
9
- }
10
-
11
- export { SidebarHeader };
1
+ "use client";import{jsx as r}from"react/jsx-runtime";import{useSidebar as e}from"../Sidebar.js";function i(i){const{children:n,...t}=i,{sidebarOpen:o}=e();return r("div",{"data-open":o,...t,children:n})}export{i as SidebarHeader};
12
2
  //# sourceMappingURL=SidebarHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarHeader.js","sources":["../../../../src/Layout/Sidebar/SidebarHeader/SidebarHeader.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { useSidebar } from \"../Sidebar\";\n\nexport function SidebarHeader(props: ComponentProps<\"div\">) {\n const { children, ...rest } = props;\n const { sidebarOpen } = useSidebar();\n return (\n <div data-open={sidebarOpen} {...rest}>\n {children}\n </div>\n );\n}\n"],"names":["_jsx"],"mappings":";;;;AAKM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAC,CAAA,CAAA,CAAA,CAAA,CAA4B,CAAA,CAAA;IACxD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAE,GAAG,CAAA,CAAA,CAAA,CAAI,CAAA,CAAE,GAAG,CAAA,CAAA,CAAA,CAAA,CAAK;AACnC,CAAA,CAAA,CAAA,CAAA,MAAM,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAE,CAAA,CAAA,CAAG,UAAU,CAAA,CAAE;IACpC,QACEA,CAAAA,CAAAA,wBAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,GAAM,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,QAAA,CAAA,CAClC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,EAAA,CACL,CAAA;AAEV;;"}
1
+ {"version":3,"file":"SidebarHeader.js","sources":["../../../../src/Layout/Sidebar/SidebarHeader/SidebarHeader.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { useSidebar } from \"../Sidebar\";\n\nexport function SidebarHeader(props: ComponentProps<\"div\">) {\n const { children, ...rest } = props;\n const { sidebarOpen } = useSidebar();\n return (\n <div data-open={sidebarOpen} {...rest}>\n {children}\n </div>\n );\n}\n"],"names":["SidebarHeader","props","children","rest","sidebarOpen","useSidebar","_jsx"],"mappings":"gGAKM,SAAUA,EAAcC,GAC5B,MAAMC,SAAEA,KAAaC,GAASF,GACxBG,YAAEA,GAAgBC,IACxB,OACEC,qBAAgBF,KAAiBD,EAAID,SAClCA,GAGP"}
@@ -1,11 +1,2 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import styles from './SidebarViewport.module.css.js';
3
- import { cn } from '@studiocubics/utils';
4
-
5
- function SidebarViewport(props) {
6
- const { children, className, ...rest } = props;
7
- return (jsx("div", { className: cn(styles.root, className), ...rest, children: children }));
8
- }
9
-
10
- export { SidebarViewport };
1
+ import{jsx as r}from"react/jsx-runtime";import o from"./SidebarViewport.module.css.js";import{cn as i}from"@studiocubics/utils";function t(t){const{children:s,className:e,...c}=t;return r("div",{className:i(o.root,e),...c,children:s})}export{t as SidebarViewport};
11
2
  //# sourceMappingURL=SidebarViewport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarViewport.js","sources":["../../../../src/Layout/Sidebar/SidebarViewport/SidebarViewport.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport styles from \"./SidebarViewport.module.css\";\nimport { cn } from \"@studiocubics/utils\";\nexport function SidebarViewport(props: ComponentProps<\"div\">) {\n const { children, className, ...rest } = props;\n return (\n <div className={cn(styles.root, className)} {...rest}>\n {children}\n </div>\n );\n}\n"],"names":["_jsx"],"mappings":";;;;AAGM,SAAU,eAAe,CAAC,KAA4B,EAAA;IAC1D,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK;AAC9C,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,EAAA,GAAM,IAAI,YACjD,QAAQ,EAAA,CACL;AAEV;;;;"}
1
+ {"version":3,"file":"SidebarViewport.js","sources":["../../../../src/Layout/Sidebar/SidebarViewport/SidebarViewport.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport styles from \"./SidebarViewport.module.css\";\nimport { cn } from \"@studiocubics/utils\";\nexport function SidebarViewport(props: ComponentProps<\"div\">) {\n const { children, className, ...rest } = props;\n return (\n <div className={cn(styles.root, className)} {...rest}>\n {children}\n </div>\n );\n}\n"],"names":["SidebarViewport","props","children","className","rest","_jsx","cn","styles","root"],"mappings":"gIAGM,SAAUA,EAAgBC,GAC9B,MAAMC,SAAEA,EAAQC,UAAEA,KAAcC,GAASH,EACzC,OACEI,EAAA,MAAA,CAAKF,UAAWG,EAAGC,EAAOC,KAAML,MAAgBC,WAC7CF,GAGP"}
@@ -1,4 +1,2 @@
1
- var styles = {"root":"SidebarViewport-module_root__KAGAg"};
2
-
3
- export { styles as default };
1
+ var o={root:"SidebarViewport-module_root__KAGAg"};export{o as default};
4
2
  //# sourceMappingURL=SidebarViewport.module.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarViewport.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"SidebarViewport.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,131 +1,2 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { createContext, useContext, useState, useRef, isValidElement } from 'react';
4
- import { getColumnCount, isAOA, isAOO, isOOA, isOCR } from './tableUtils.js';
5
- import styles from './Table.module.css.js';
6
- import { mergeRefs, cn } from '@studiocubics/utils';
7
-
8
- const TableContext = createContext(null);
9
- function useTable() {
10
- const c = useContext(TableContext);
11
- if (!c)
12
- throw new Error("Components must be wrapped in <Table/>");
13
- return c;
14
- }
15
- /**
16
- * Works for data of four types
17
- *
18
- * **Array of arrays:-**
19
- *
20
- * ```ts
21
- * const aoaData: TableData = [
22
- ["name", "email", "age"], // column headers are always 0th element
23
- ["pumpernickel", "pump@nick.com", 420],
24
- ["rumpelstiltskin", "rump@stilt.com", 96],
25
- ];
26
- * ```
27
- * **Array of objects:-**
28
- *
29
- * ```ts
30
- * const aooData: TableData = [
31
- { name: "pumpernickel", email: "pump@nick.com", age: 420 }, // keys are column headers
32
- { name: "rumpelstiltskin", email: "rump@stilt.com", age: 96 },
33
- ];
34
- * ```
35
- * **Object of arrays:-**
36
- *
37
- * ```ts
38
- * const ooaData: TableData = {
39
- name: ["pumpernickel", "rumpelstiltskin"], // keys are column headers
40
- email: ["pump@nick.com", "rump@stilt.com"],
41
- age: [420, 96],
42
- };
43
- * ```
44
- * **Explicit schema + rows:-**
45
- *
46
- * ```ts
47
- * const ocrData: TableData = {
48
- columns: ["name", "email", "age"], // column headers are defined in a seperate columns array
49
- rows: [
50
- ["pumpernickel", "pump@nick.com", 420],
51
- ["rumpelstiltskin", "rump@stilt.com", 96],
52
- ],
53
- };
54
- * ```
55
- */
56
- function Table({ data }) {
57
- const [selectedCell, setSelectedCell] = useState(null);
58
- const columnCount = getColumnCount(data);
59
- function renderRows() {
60
- // AOA (array of arrays)
61
- if (isAOA(data)) {
62
- return data.map((row, r) => Array.isArray(row)
63
- ? row.map((cell, c) => (jsx(TableCell, { id: `${r},${c}`, children: renderCell(cell) }, `${r},${c}`)))
64
- : null);
65
- }
66
- // AOO (array of objects)
67
- if (isAOO(data)) {
68
- const columns = Object.keys(data[0]);
69
- return data.map((row, r) => columns.map((col, c) => (jsx(TableCell, { id: `${r},${c}`, children: renderCell(row[col]) }, `${r},${c}`))));
70
- }
71
- // OOA (object of arrays)
72
- if (isOOA(data)) {
73
- const columns = Object.keys(data);
74
- const rowCount = data[columns[0]]?.length ?? 0;
75
- return Array.from({ length: rowCount }, (_, r) => columns.map((col, c) => (jsx(TableCell, { id: `${r},${c}`, children: renderCell(data[col][r]) }, `${r},${c}`))));
76
- }
77
- // OCR (columns + rows)
78
- if (isOCR(data)) {
79
- return data.rows.map((row, r) => row.map((cell, c) => (jsx(TableCell, { id: `${r},${c}`, children: renderCell(cell) }, `${r},${c}`))));
80
- }
81
- return null;
82
- }
83
- return (jsx(TableContext.Provider, { value: { selectedCell, setSelectedCell, columnCount }, children: jsx("div", { className: styles.root, children: jsx("div", { className: styles.table, style: {
84
- gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`,
85
- }, children: renderRows() }) }) }));
86
- }
87
- const defaultElement = "div";
88
- function TableCellBase(props) {
89
- const { as, children, ref, onClick, ...rest } = props;
90
- const cellRef = useRef(null);
91
- const { setSelectedCell, selectedCell } = useTable();
92
- const Component = as || defaultElement;
93
- const componentProps = {
94
- className: cn(styles.tableCell, selectedCell?.id == cellRef.current?.id ? styles.selected : ""),
95
- ref: mergeRefs(cellRef, ref),
96
- onClick: handleSelectCell,
97
- ...rest,
98
- };
99
- function handleSelectCell(e) {
100
- setSelectedCell(cellRef.current);
101
- onClick?.(e);
102
- }
103
- return jsx(Component, { ...componentProps, children: children });
104
- }
105
- TableCellBase.displayName = "TableCell";
106
- const TableCell = TableCellBase;
107
- function renderCell(cell) {
108
- if (typeof cell === "boolean")
109
- return cell ? "✔" : "❌";
110
- if (!cell)
111
- return;
112
- if (typeof cell === "string" || isValidElement(cell))
113
- return cell;
114
- if (typeof cell === "object" && "type" in cell) {
115
- switch (cell.type) {
116
- case "boolean":
117
- return cell.value ? "✔" : "X";
118
- case "timestamp":
119
- return cell.value.toLocaleString();
120
- case "array":
121
- return JSON.stringify(cell.value);
122
- case "image":
123
- return jsx("img", { src: cell.value, alt: cell.alt });
124
- default:
125
- return cell.value;
126
- }
127
- }
128
- }
129
-
130
- export { Table, TableCell, renderCell, useTable };
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import{createContext as r,useContext as t,useState as l,useRef as n,isValidElement as i}from"react";import{getColumnCount as a,isAOA as c,isAOO as o,isOOA as s,isOCR as u}from"./tableUtils.js";import m from"./Table.module.css.js";import{mergeRefs as d,cn as f}from"@studiocubics/utils";const p=r(null);function $(){const e=t(p);if(!e)throw new Error("Components must be wrapped in <Table/>");return e}function y({data:r}){const[t,n]=l(null),i=a(r);return e(p.Provider,{value:{selectedCell:t,setSelectedCell:n,columnCount:i},children:e("div",{className:m.root,children:e("div",{className:m.table,style:{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`},children:function(){if(c(r))return r.map((r,t)=>Array.isArray(r)?r.map((r,l)=>e(h,{id:`${t},${l}`,children:C(r)},`${t},${l}`)):null);if(o(r)){const t=Object.keys(r[0]);return r.map((r,l)=>t.map((t,n)=>e(h,{id:`${l},${n}`,children:C(r[t])},`${l},${n}`)))}if(s(r)){const t=Object.keys(r),l=r[t[0]]?.length??0;return Array.from({length:l},(l,n)=>t.map((t,l)=>e(h,{id:`${n},${l}`,children:C(r[t][n])},`${n},${l}`)))}return u(r)?r.rows.map((r,t)=>r.map((r,l)=>e(h,{id:`${t},${l}`,children:C(r)},`${t},${l}`))):null}()})})})}function b(r){const{as:t,children:l,ref:i,onClick:a,...c}=r,o=n(null),{setSelectedCell:s,selectedCell:u}=$(),p=t||"div",y={className:f(m.tableCell,u?.id==o.current?.id?m.selected:""),ref:d(o,i),onClick:function(e){s(o.current),a?.(e)},...c};return e(p,{...y,children:l})}b.displayName="TableCell";const h=b;function C(r){if("boolean"==typeof r)return r?"✔":"❌";if(r){if("string"==typeof r||i(r))return r;if("object"==typeof r&&"type"in r)switch(r.type){case"boolean":return r.value?"✔":"X";case"timestamp":return r.value.toLocaleString();case"array":return JSON.stringify(r.value);case"image":return e("img",{src:r.value,alt:r.alt});default:return r.value}}}export{y as Table,h as TableCell,C as renderCell,$ as useTable};
131
2
  //# sourceMappingURL=Table.js.map