@cerberus-design/react 0.1.1 → 0.1.2-next-606dce0

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 (203) hide show
  1. package/build/legacy/aria-helpers/nav-menu.aria.js +3 -7
  2. package/build/legacy/aria-helpers/nav-menu.aria.js.map +1 -1
  3. package/build/legacy/chunk-55J6XMHW.js +1 -0
  4. package/build/legacy/chunk-6YEAMVRY.js +82 -0
  5. package/build/legacy/chunk-6YEAMVRY.js.map +1 -0
  6. package/build/legacy/chunk-BPIYUAYS.js +26 -0
  7. package/build/legacy/chunk-BPIYUAYS.js.map +1 -0
  8. package/build/legacy/chunk-JA4IX7GN.js +48 -0
  9. package/build/legacy/chunk-JA4IX7GN.js.map +1 -0
  10. package/build/legacy/chunk-JF76VIL3.js +12 -0
  11. package/build/legacy/chunk-JF76VIL3.js.map +1 -0
  12. package/build/legacy/chunk-KETL4ZJK.js +33 -0
  13. package/build/legacy/chunk-KETL4ZJK.js.map +1 -0
  14. package/build/legacy/chunk-KJUCHZHV.js +51 -0
  15. package/build/legacy/chunk-KJUCHZHV.js.map +1 -0
  16. package/build/legacy/chunk-R4H3352X.js +16 -0
  17. package/build/legacy/chunk-R4H3352X.js.map +1 -0
  18. package/build/legacy/chunk-SXXWC6UD.js +83 -0
  19. package/build/legacy/chunk-SXXWC6UD.js.map +1 -0
  20. package/build/legacy/chunk-WSQTX34C.js +86 -0
  21. package/build/legacy/chunk-WSQTX34C.js.map +1 -0
  22. package/build/legacy/chunk-XFWARXLU.js +26 -0
  23. package/build/legacy/chunk-XFWARXLU.js.map +1 -0
  24. package/build/legacy/components/Button.js +2 -26
  25. package/build/legacy/components/Button.js.map +1 -1
  26. package/build/legacy/components/IconButton.js +2 -64
  27. package/build/legacy/components/IconButton.js.map +1 -1
  28. package/build/legacy/components/NavMenuLink.js +3 -43
  29. package/build/legacy/components/NavMenuLink.js.map +1 -1
  30. package/build/legacy/components/NavMenuList.js +5 -103
  31. package/build/legacy/components/NavMenuList.js.map +1 -1
  32. package/build/legacy/components/NavMenuTrigger.js +5 -77
  33. package/build/legacy/components/NavMenuTrigger.js.map +1 -1
  34. package/build/legacy/components/Show.js +3 -12
  35. package/build/legacy/components/Show.js.map +1 -1
  36. package/build/legacy/context/field.js +3 -27
  37. package/build/legacy/context/field.js.map +1 -1
  38. package/build/legacy/context/navMenu.js +3 -45
  39. package/build/legacy/context/navMenu.js.map +1 -1
  40. package/build/legacy/context/theme.js +6 -21
  41. package/build/legacy/context/theme.js.map +1 -1
  42. package/build/legacy/hooks/useTheme.js +2 -56
  43. package/build/legacy/hooks/useTheme.js.map +1 -1
  44. package/build/legacy/index.js +57 -13
  45. package/build/legacy/index.js.map +1 -1
  46. package/build/legacy/types.js +1 -0
  47. package/build/modern/aria-helpers/nav-menu.aria.js +3 -7
  48. package/build/modern/aria-helpers/nav-menu.aria.js.map +1 -1
  49. package/build/modern/chunk-55J6XMHW.js +1 -0
  50. package/build/modern/chunk-6YEAMVRY.js +82 -0
  51. package/build/modern/chunk-6YEAMVRY.js.map +1 -0
  52. package/build/modern/chunk-BPIYUAYS.js +26 -0
  53. package/build/modern/chunk-BPIYUAYS.js.map +1 -0
  54. package/build/modern/chunk-JA4IX7GN.js +48 -0
  55. package/build/modern/chunk-JA4IX7GN.js.map +1 -0
  56. package/build/modern/chunk-JF76VIL3.js +12 -0
  57. package/build/modern/chunk-JF76VIL3.js.map +1 -0
  58. package/build/modern/chunk-KETL4ZJK.js +33 -0
  59. package/build/modern/chunk-KETL4ZJK.js.map +1 -0
  60. package/build/modern/chunk-KJUCHZHV.js +51 -0
  61. package/build/modern/chunk-KJUCHZHV.js.map +1 -0
  62. package/build/modern/chunk-R4H3352X.js +16 -0
  63. package/build/modern/chunk-R4H3352X.js.map +1 -0
  64. package/build/modern/chunk-SXXWC6UD.js +83 -0
  65. package/build/modern/chunk-SXXWC6UD.js.map +1 -0
  66. package/build/modern/chunk-WSQTX34C.js +86 -0
  67. package/build/modern/chunk-WSQTX34C.js.map +1 -0
  68. package/build/modern/chunk-XFWARXLU.js +26 -0
  69. package/build/modern/chunk-XFWARXLU.js.map +1 -0
  70. package/build/modern/components/Button.js +2 -26
  71. package/build/modern/components/Button.js.map +1 -1
  72. package/build/modern/components/IconButton.js +2 -64
  73. package/build/modern/components/IconButton.js.map +1 -1
  74. package/build/modern/components/NavMenuLink.js +3 -43
  75. package/build/modern/components/NavMenuLink.js.map +1 -1
  76. package/build/modern/components/NavMenuList.js +5 -103
  77. package/build/modern/components/NavMenuList.js.map +1 -1
  78. package/build/modern/components/NavMenuTrigger.js +5 -77
  79. package/build/modern/components/NavMenuTrigger.js.map +1 -1
  80. package/build/modern/components/Show.js +3 -12
  81. package/build/modern/components/Show.js.map +1 -1
  82. package/build/modern/context/field.js +3 -27
  83. package/build/modern/context/field.js.map +1 -1
  84. package/build/modern/context/navMenu.js +3 -45
  85. package/build/modern/context/navMenu.js.map +1 -1
  86. package/build/modern/context/theme.js +6 -21
  87. package/build/modern/context/theme.js.map +1 -1
  88. package/build/modern/hooks/useTheme.js +2 -56
  89. package/build/modern/hooks/useTheme.js.map +1 -1
  90. package/build/modern/index.js +57 -13
  91. package/build/modern/index.js.map +1 -1
  92. package/build/modern/types.js +1 -0
  93. package/package.json +5 -12
  94. package/src/components/Button.tsx +2 -2
  95. package/src/components/IconButton.tsx +2 -2
  96. package/src/components/NavMenuLink.tsx +1 -1
  97. package/src/components/NavMenuList.tsx +2 -2
  98. package/src/components/NavMenuTrigger.tsx +2 -2
  99. package/build/legacy/_tsup-dts-rollup.d.cts +0 -254
  100. package/build/legacy/aria-helpers/nav-menu.aria.cjs +0 -36
  101. package/build/legacy/aria-helpers/nav-menu.aria.cjs.map +0 -1
  102. package/build/legacy/aria-helpers/nav-menu.aria.d.cts +0 -2
  103. package/build/legacy/chunk-2EH5BYDL.js +0 -108
  104. package/build/legacy/chunk-2EH5BYDL.js.map +0 -1
  105. package/build/legacy/chunk-KMSZ2GAN.js +0 -332
  106. package/build/legacy/chunk-KMSZ2GAN.js.map +0 -1
  107. package/build/legacy/chunk-WX6UE7PC.js +0 -51
  108. package/build/legacy/chunk-WX6UE7PC.js.map +0 -1
  109. package/build/legacy/components/Button.cjs +0 -472
  110. package/build/legacy/components/Button.cjs.map +0 -1
  111. package/build/legacy/components/Button.d.cts +0 -2
  112. package/build/legacy/components/IconButton.cjs +0 -470
  113. package/build/legacy/components/IconButton.cjs.map +0 -1
  114. package/build/legacy/components/IconButton.d.cts +0 -3
  115. package/build/legacy/components/NavMenuLink.cjs +0 -346
  116. package/build/legacy/components/NavMenuLink.cjs.map +0 -1
  117. package/build/legacy/components/NavMenuLink.d.cts +0 -2
  118. package/build/legacy/components/NavMenuList.cjs +0 -427
  119. package/build/legacy/components/NavMenuList.cjs.map +0 -1
  120. package/build/legacy/components/NavMenuList.d.cts +0 -3
  121. package/build/legacy/components/NavMenuTrigger.cjs +0 -520
  122. package/build/legacy/components/NavMenuTrigger.cjs.map +0 -1
  123. package/build/legacy/components/NavMenuTrigger.d.cts +0 -2
  124. package/build/legacy/components/Show.cjs +0 -41
  125. package/build/legacy/components/Show.cjs.map +0 -1
  126. package/build/legacy/components/Show.d.cts +0 -2
  127. package/build/legacy/context/field.cjs +0 -55
  128. package/build/legacy/context/field.cjs.map +0 -1
  129. package/build/legacy/context/field.d.cts +0 -3
  130. package/build/legacy/context/navMenu.cjs +0 -70
  131. package/build/legacy/context/navMenu.cjs.map +0 -1
  132. package/build/legacy/context/navMenu.d.cts +0 -5
  133. package/build/legacy/context/theme.cjs +0 -56
  134. package/build/legacy/context/theme.cjs.map +0 -1
  135. package/build/legacy/context/theme.d.cts +0 -8
  136. package/build/legacy/global.d.cjs +0 -2
  137. package/build/legacy/global.d.d.cts +0 -1
  138. package/build/legacy/global.d.d.ts +0 -1
  139. package/build/legacy/global.d.js +0 -1
  140. package/build/legacy/hooks/useTheme.cjs +0 -77
  141. package/build/legacy/hooks/useTheme.cjs.map +0 -1
  142. package/build/legacy/hooks/useTheme.d.cts +0 -1
  143. package/build/legacy/index.cjs +0 -47
  144. package/build/legacy/index.cjs.map +0 -1
  145. package/build/legacy/index.d.cts +0 -34
  146. package/build/legacy/types.cjs +0 -19
  147. package/build/legacy/types.cjs.map +0 -1
  148. package/build/legacy/types.d.cts +0 -1
  149. package/build/modern/_tsup-dts-rollup.d.cts +0 -254
  150. package/build/modern/aria-helpers/nav-menu.aria.cjs +0 -36
  151. package/build/modern/aria-helpers/nav-menu.aria.cjs.map +0 -1
  152. package/build/modern/aria-helpers/nav-menu.aria.d.cts +0 -2
  153. package/build/modern/chunk-BLNT5VLF.js +0 -108
  154. package/build/modern/chunk-BLNT5VLF.js.map +0 -1
  155. package/build/modern/chunk-JHIMPIXK.js +0 -51
  156. package/build/modern/chunk-JHIMPIXK.js.map +0 -1
  157. package/build/modern/chunk-X3GZABU6.js +0 -332
  158. package/build/modern/chunk-X3GZABU6.js.map +0 -1
  159. package/build/modern/components/Button.cjs +0 -472
  160. package/build/modern/components/Button.cjs.map +0 -1
  161. package/build/modern/components/Button.d.cts +0 -2
  162. package/build/modern/components/IconButton.cjs +0 -470
  163. package/build/modern/components/IconButton.cjs.map +0 -1
  164. package/build/modern/components/IconButton.d.cts +0 -3
  165. package/build/modern/components/NavMenuLink.cjs +0 -346
  166. package/build/modern/components/NavMenuLink.cjs.map +0 -1
  167. package/build/modern/components/NavMenuLink.d.cts +0 -2
  168. package/build/modern/components/NavMenuList.cjs +0 -427
  169. package/build/modern/components/NavMenuList.cjs.map +0 -1
  170. package/build/modern/components/NavMenuList.d.cts +0 -3
  171. package/build/modern/components/NavMenuTrigger.cjs +0 -520
  172. package/build/modern/components/NavMenuTrigger.cjs.map +0 -1
  173. package/build/modern/components/NavMenuTrigger.d.cts +0 -2
  174. package/build/modern/components/Show.cjs +0 -41
  175. package/build/modern/components/Show.cjs.map +0 -1
  176. package/build/modern/components/Show.d.cts +0 -2
  177. package/build/modern/context/field.cjs +0 -55
  178. package/build/modern/context/field.cjs.map +0 -1
  179. package/build/modern/context/field.d.cts +0 -3
  180. package/build/modern/context/navMenu.cjs +0 -70
  181. package/build/modern/context/navMenu.cjs.map +0 -1
  182. package/build/modern/context/navMenu.d.cts +0 -5
  183. package/build/modern/context/theme.cjs +0 -56
  184. package/build/modern/context/theme.cjs.map +0 -1
  185. package/build/modern/context/theme.d.cts +0 -8
  186. package/build/modern/global.d.cjs +0 -2
  187. package/build/modern/global.d.cjs.map +0 -1
  188. package/build/modern/global.d.d.cts +0 -1
  189. package/build/modern/global.d.d.ts +0 -1
  190. package/build/modern/global.d.js +0 -1
  191. package/build/modern/global.d.js.map +0 -1
  192. package/build/modern/hooks/useTheme.cjs +0 -77
  193. package/build/modern/hooks/useTheme.cjs.map +0 -1
  194. package/build/modern/hooks/useTheme.d.cts +0 -1
  195. package/build/modern/index.cjs +0 -47
  196. package/build/modern/index.cjs.map +0 -1
  197. package/build/modern/index.d.cts +0 -34
  198. package/build/modern/types.cjs +0 -19
  199. package/build/modern/types.cjs.map +0 -1
  200. package/build/modern/types.d.cts +0 -1
  201. package/src/global.d.ts +0 -19
  202. /package/build/legacy/{global.d.cjs.map → chunk-55J6XMHW.js.map} +0 -0
  203. /package/build/{legacy/global.d.js.map → modern/chunk-55J6XMHW.js.map} +0 -0
@@ -1,68 +1,6 @@
1
1
  import {
2
- createRecipe,
3
- mergeRecipes
4
- } from "../chunk-2EH5BYDL.js";
5
- import {
6
- cx,
7
- memo,
8
- splitProps
9
- } from "../chunk-KMSZ2GAN.js";
10
-
11
- // ../styled-system/recipes/icon-button.mjs
12
- var iconButtonFn = /* @__PURE__ */ createRecipe("icon-btn", {
13
- "palette": "action",
14
- "usage": "text",
15
- "shape": "circle"
16
- }, []);
17
- var iconButtonVariantMap = {
18
- "palette": [
19
- "action",
20
- "danger"
21
- ],
22
- "usage": [
23
- "text",
24
- "filled"
25
- ],
26
- "shape": [
27
- "circle"
28
- ]
29
- };
30
- var iconButtonVariantKeys = Object.keys(iconButtonVariantMap);
31
- var iconButton = /* @__PURE__ */ Object.assign(memo(iconButtonFn.recipeFn), {
32
- __recipe__: true,
33
- __name__: "iconButton",
34
- __getCompoundVariantCss__: iconButtonFn.__getCompoundVariantCss__,
35
- raw: (props) => props,
36
- variantKeys: iconButtonVariantKeys,
37
- variantMap: iconButtonVariantMap,
38
- merge(recipe) {
39
- return mergeRecipes(this, recipe);
40
- },
41
- splitVariantProps(props) {
42
- return splitProps(props, iconButtonVariantKeys);
43
- },
44
- getVariantProps: iconButtonFn.getVariantProps
45
- });
46
-
47
- // src/components/IconButton.tsx
48
- import { jsx } from "react/jsx-runtime";
49
- function IconButton(props) {
50
- const { ariaLabel, palette, usage, ...nativeProps } = props;
51
- return /* @__PURE__ */ jsx(
52
- "button",
53
- {
54
- ...nativeProps,
55
- "aria-label": ariaLabel ?? "Icon Button",
56
- className: cx(
57
- nativeProps.className,
58
- iconButton({
59
- palette,
60
- usage
61
- })
62
- )
63
- }
64
- );
65
- }
2
+ IconButton
3
+ } from "../chunk-BPIYUAYS.js";
66
4
  export {
67
5
  IconButton
68
6
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../styled-system/recipes/icon-button.mjs","../../../src/components/IconButton.tsx"],"sourcesContent":["import { memo, splitProps } from '../helpers.mjs';\nimport { createRecipe, mergeRecipes } from './create-recipe.mjs';\n\nconst iconButtonFn = /* @__PURE__ */ createRecipe('icon-btn', {\n \"palette\": \"action\",\n \"usage\": \"text\",\n \"shape\": \"circle\"\n}, [])\n\nconst iconButtonVariantMap = {\n \"palette\": [\n \"action\",\n \"danger\"\n ],\n \"usage\": [\n \"text\",\n \"filled\"\n ],\n \"shape\": [\n \"circle\"\n ]\n}\n\nconst iconButtonVariantKeys = Object.keys(iconButtonVariantMap)\n\nexport const iconButton = /* @__PURE__ */ Object.assign(memo(iconButtonFn.recipeFn), {\n __recipe__: true,\n __name__: 'iconButton',\n __getCompoundVariantCss__: iconButtonFn.__getCompoundVariantCss__,\n raw: (props) => props,\n variantKeys: iconButtonVariantKeys,\n variantMap: iconButtonVariantMap,\n merge(recipe) {\n return mergeRecipes(this, recipe)\n },\n splitVariantProps(props) {\n return splitProps(props, iconButtonVariantKeys)\n },\n getVariantProps: iconButtonFn.getVariantProps,\n})","import type { ButtonHTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css/index.mjs'\nimport { iconButton } from '@cerberus/styled-system/recipes/index.mjs'\nimport type { ButtonProps } from './Button'\n\n/**\n * This module contains the Icon Button component.\n * @module\n */\n\nexport type IconButtonUsage = Exclude<ButtonProps['usage'], 'outline'>\nexport interface IconButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n ariaLabel: string\n palette?: ButtonProps['palette']\n usage?: IconButtonUsage\n shape?: 'circle'\n}\n\n/**\n * A component that allows the user to perform actions using an icon\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/IconButton.tsx\n */\nexport function IconButton(props: IconButtonProps): JSX.Element {\n const { ariaLabel, palette, usage, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n aria-label={ariaLabel ?? 'Icon Button'}\n className={cx(\n nativeProps.className,\n iconButton({\n palette,\n usage,\n }),\n )}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;AAGA,IAAM,eAA+B,6BAAa,YAAY;AAAA,EAC5D,WAAW;AAAA,EACX,SAAS;AAAA,EACT,SAAS;AACX,GAAG,CAAC,CAAC;AAEL,IAAM,uBAAuB;AAAA,EAC3B,WAAW;AAAA,IACT;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP;AAAA,EACF;AACF;AAEA,IAAM,wBAAwB,OAAO,KAAK,oBAAoB;AAEvD,IAAM,aAA6B,uBAAO,OAAO,KAAK,aAAa,QAAQ,GAAG;AAAA,EACnF,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,2BAA2B,aAAa;AAAA,EACxC,KAAK,CAAC,UAAU;AAAA,EAChB,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,MAAM,QAAQ;AACZ,WAAO,aAAa,MAAM,MAAM;AAAA,EAClC;AAAA,EACA,kBAAkB,OAAO;AACvB,WAAO,WAAW,OAAO,qBAAqB;AAAA,EAChD;AAAA,EACA,iBAAiB,aAAa;AAChC,CAAC;;;ACbG;AAHG,SAAS,WAAW,OAAqC;AAC9D,QAAM,EAAE,WAAW,SAAS,OAAO,GAAG,YAAY,IAAI;AACtD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,cAAY,aAAa;AAAA,MACzB,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,47 +1,7 @@
1
1
  import {
2
- css,
3
- cx
4
- } from "../chunk-KMSZ2GAN.js";
5
-
6
- // src/components/NavMenuLink.tsx
7
- import { Show } from "./Show.js";
8
- import { jsx } from "react/jsx-runtime";
9
- function NavMenuLink(props) {
10
- const { as, ...nativeProps } = props;
11
- const hasAs = Boolean(as);
12
- const AsSub = as;
13
- return /* @__PURE__ */ jsx(
14
- "li",
15
- {
16
- className: css({
17
- w: "full"
18
- }),
19
- children: /* @__PURE__ */ jsx(
20
- Show,
21
- {
22
- when: hasAs,
23
- fallback: /* @__PURE__ */ jsx(
24
- "a",
25
- {
26
- ...nativeProps,
27
- className: cx(
28
- nativeProps.className,
29
- css({
30
- color: "action.navigation.initial",
31
- textStyle: "link",
32
- _hover: {
33
- color: "action.navigation.hover"
34
- }
35
- })
36
- )
37
- }
38
- ),
39
- children: hasAs && /* @__PURE__ */ jsx(AsSub, { ...nativeProps })
40
- }
41
- )
42
- }
43
- );
44
- }
2
+ NavMenuLink
3
+ } from "../chunk-JA4IX7GN.js";
4
+ import "../chunk-R4H3352X.js";
45
5
  export {
46
6
  NavMenuLink
47
7
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/NavMenuLink.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, ElementType } from 'react'\nimport { css, cx } from '@cerberus/styled-system/css/index.mjs'\nimport { Show } from './Show'\n\nexport interface NavMenuLinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement> {\n as?: ElementType\n}\n\nexport function NavMenuLink(props: NavMenuLinkProps): JSX.Element {\n const { as, ...nativeProps } = props\n const hasAs = Boolean(as)\n const AsSub: ElementType = as!\n\n return (\n <li\n className={css({\n w: 'full',\n })}\n >\n <Show\n when={hasAs}\n fallback={\n <a\n {...nativeProps}\n className={cx(\n nativeProps.className,\n css({\n color: 'action.navigation.initial',\n textStyle: 'link',\n _hover: {\n color: 'action.navigation.hover',\n },\n }),\n )}\n />\n }\n >\n {hasAs && <AsSub {...nativeProps} />}\n </Show>\n </li>\n )\n}\n"],"mappings":";;;;;;AAEA,SAAS,YAAY;AAqBX;AAdH,SAAS,YAAY,OAAsC;AAChE,QAAM,EAAE,IAAI,GAAG,YAAY,IAAI;AAC/B,QAAM,QAAQ,QAAQ,EAAE;AACxB,QAAM,QAAqB;AAE3B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,IAAI;AAAA,QACb,GAAG;AAAA,MACL,CAAC;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,UACE;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACJ,WAAW;AAAA,gBACT,YAAY;AAAA,gBACZ,IAAI;AAAA,kBACF,OAAO;AAAA,kBACP,WAAW;AAAA,kBACX,QAAQ;AAAA,oBACN,OAAO;AAAA,kBACT;AAAA,gBACF,CAAC;AAAA,cACH;AAAA;AAAA,UACF;AAAA,UAGD,mBAAS,oBAAC,SAAO,GAAG,aAAa;AAAA;AAAA,MACpC;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,108 +1,10 @@
1
1
  "use client";
2
2
  import {
3
- css,
4
- cx,
5
- getPatternStyles,
6
- patternFns
7
- } from "../chunk-KMSZ2GAN.js";
8
-
9
- // src/components/NavMenuList.tsx
10
- import { useMemo } from "react";
11
-
12
- // ../styled-system/patterns/vstack.mjs
13
- var vstackConfig = {
14
- transform(props) {
15
- const { justify, gap, ...rest } = props;
16
- return {
17
- display: "flex",
18
- alignItems: "center",
19
- justifyContent: justify,
20
- gap,
21
- flexDirection: "column",
22
- ...rest
23
- };
24
- },
25
- defaultValues: { gap: "10px" }
26
- };
27
- var getVstackStyle = (styles = {}) => {
28
- const _styles = getPatternStyles(vstackConfig, styles);
29
- return vstackConfig.transform(_styles, patternFns);
30
- };
31
- var vstack = (styles) => css(getVstackStyle(styles));
32
- vstack.raw = getVstackStyle;
33
-
34
- // src/components/NavMenuList.tsx
35
- import { useNavMenuContext } from "../context/navMenu.js";
36
- import { Show } from "./Show.js";
37
- import { jsx } from "react/jsx-runtime";
38
- function getPosition(position) {
39
- const defaultPositions = {
40
- left: "auto",
41
- right: "auto",
42
- top: "auto",
43
- bottom: "auto"
44
- };
45
- switch (position) {
46
- case "right":
47
- return { ...defaultPositions, top: "0%", left: "105%" };
48
- case "left":
49
- return { ...defaultPositions, top: "0%", right: "105%" };
50
- case "bottom":
51
- return { ...defaultPositions, top: "110%" };
52
- case "top":
53
- return { ...defaultPositions, bottom: "110%" };
54
- default:
55
- return defaultPositions;
56
- }
57
- }
58
- var navListStyles = vstack({
59
- alignItems: "flex-start",
60
- bgColor: "neutral.surface.100",
61
- boxShadow: "lg",
62
- gap: "2",
63
- opacity: "0",
64
- p: "4",
65
- position: "absolute",
66
- rounded: "md",
67
- zIndex: "dropdown",
68
- _motionSafe: {
69
- animationName: "zoomIn",
70
- animationDelay: "100ms",
71
- animationDuration: "150ms",
72
- animationFillMode: "both",
73
- animationTimingFunction: "ease-in-out"
74
- },
75
- _positionBottom: {
76
- transformOrigin: "top left"
77
- },
78
- _positionTop: {
79
- transformOrigin: "bottom left"
80
- },
81
- _positionLeft: {
82
- transformOrigin: "top right"
83
- },
84
- _positionRight: {
85
- transformOrigin: "top left"
86
- }
87
- });
88
- function NavMenuList(props) {
89
- const { position, ...nativeProps } = props;
90
- const { menuRef, expanded } = useNavMenuContext();
91
- const locationStyles = useMemo(
92
- () => getPosition(position ?? "bottom"),
93
- [position]
94
- );
95
- return /* @__PURE__ */ jsx(Show, { when: expanded, children: /* @__PURE__ */ jsx(
96
- "ul",
97
- {
98
- ...nativeProps,
99
- "data-position": position ?? "bottom",
100
- className: cx(nativeProps.className, navListStyles),
101
- ref: menuRef,
102
- style: locationStyles
103
- }
104
- ) });
105
- }
3
+ NavMenuList,
4
+ getPosition
5
+ } from "../chunk-WSQTX34C.js";
6
+ import "../chunk-KJUCHZHV.js";
7
+ import "../chunk-R4H3352X.js";
106
8
  export {
107
9
  NavMenuList,
108
10
  getPosition
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/NavMenuList.tsx","../../../../styled-system/patterns/vstack.mjs"],"sourcesContent":["'use client'\n\nimport { useMemo, type HTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css/index.mjs'\nimport { vstack } from '@cerberus/styled-system/patterns/index.mjs'\nimport { useNavMenuContext } from '../context/navMenu'\nimport type { Positions } from '../types'\nimport { Show } from './Show'\n\ninterface GetPositionResult {\n left: string\n right: string\n top: string\n bottom: string\n}\n\nexport function getPosition(position: Positions): GetPositionResult {\n const defaultPositions = {\n left: 'auto',\n right: 'auto',\n top: 'auto',\n bottom: 'auto',\n }\n switch (position) {\n case 'right':\n return { ...defaultPositions, top: '0%', left: '105%' }\n case 'left':\n return { ...defaultPositions, top: '0%', right: '105%' }\n case 'bottom':\n return { ...defaultPositions, top: '110%' }\n case 'top':\n return { ...defaultPositions, bottom: '110%' }\n default:\n return defaultPositions\n }\n}\n\nconst navListStyles = vstack({\n alignItems: 'flex-start',\n bgColor: 'neutral.surface.100',\n boxShadow: 'lg',\n gap: '2',\n opacity: '0',\n p: '4',\n position: 'absolute',\n rounded: 'md',\n zIndex: 'dropdown',\n _motionSafe: {\n animationName: 'zoomIn',\n animationDelay: '100ms',\n animationDuration: '150ms',\n animationFillMode: 'both',\n animationTimingFunction: 'ease-in-out',\n },\n _positionBottom: {\n transformOrigin: 'top left',\n },\n _positionTop: {\n transformOrigin: 'bottom left',\n },\n _positionLeft: {\n transformOrigin: 'top right',\n },\n _positionRight: {\n transformOrigin: 'top left',\n },\n})\n\nexport interface NavMenuListProps extends HTMLAttributes<HTMLUListElement> {\n id: string\n position?: Positions\n}\n\n/**\n * A component that allows the user to display a menu of navigation links.\n * @definition [Disclosure Nav](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation/)\n * @definition [NavMenu Docs](https://cerberus.digitalu.design/react/nav-menu)\n *\n * @example\n * ```tsx\n * <NavMenuList id=\"nav-menu-list\" position=\"bottom\">\n * <NavMenuLink href=\"/home\">Home</NavMenuLink>\n * <NavMenuLink href=\"/about\">About</NavMenuLink>\n * </NavMenuList>\n * ```\n **/\nexport function NavMenuList(props: NavMenuListProps): JSX.Element {\n const { position, ...nativeProps } = props\n const { menuRef, expanded } = useNavMenuContext()\n const locationStyles = useMemo(\n () => getPosition(position ?? 'bottom'),\n [position],\n )\n\n return (\n <Show when={expanded}>\n <ul\n {...nativeProps}\n data-position={position ?? 'bottom'}\n className={cx(nativeProps.className, navListStyles)}\n ref={menuRef}\n style={locationStyles}\n />\n </Show>\n )\n}\n","import { getPatternStyles, patternFns } from '../helpers.mjs';\nimport { css } from '../css/index.mjs';\n\nconst vstackConfig = {\ntransform(props) {\n const { justify, gap, ...rest } = props;\n return {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: justify,\n gap,\n flexDirection: \"column\",\n ...rest\n };\n},\ndefaultValues:{gap:'10px'}}\n\nexport const getVstackStyle = (styles = {}) => {\n const _styles = getPatternStyles(vstackConfig, styles)\n return vstackConfig.transform(_styles, patternFns)\n}\n\nexport const vstack = (styles) => css(getVstackStyle(styles))\nvstack.raw = getVstackStyle"],"mappings":";;;;;;;;;AAEA,SAAS,eAAoC;;;ACC7C,IAAM,eAAe;AAAA,EACrB,UAAU,OAAO;AACf,UAAM,EAAE,SAAS,KAAK,GAAG,KAAK,IAAI;AAClC,WAAO;AAAA,MACL,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB;AAAA,MACA,eAAe;AAAA,MACf,GAAG;AAAA,IACL;AAAA,EACF;AAAA,EACA,eAAc,EAAC,KAAI,OAAM;AAAC;AAEnB,IAAM,iBAAiB,CAAC,SAAS,CAAC,MAAM;AAC7C,QAAM,UAAU,iBAAiB,cAAc,MAAM;AACrD,SAAO,aAAa,UAAU,SAAS,UAAU;AACnD;AAEO,IAAM,SAAS,CAAC,WAAW,IAAI,eAAe,MAAM,CAAC;AAC5D,OAAO,MAAM;;;ADlBb,SAAS,yBAAyB;AAElC,SAAS,YAAY;AAyFf;AAhFC,SAAS,YAAY,UAAwC;AAClE,QAAM,mBAAmB;AAAA,IACvB,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,QAAQ;AAAA,EACV;AACA,UAAQ,UAAU;AAAA,IAChB,KAAK;AACH,aAAO,EAAE,GAAG,kBAAkB,KAAK,MAAM,MAAM,OAAO;AAAA,IACxD,KAAK;AACH,aAAO,EAAE,GAAG,kBAAkB,KAAK,MAAM,OAAO,OAAO;AAAA,IACzD,KAAK;AACH,aAAO,EAAE,GAAG,kBAAkB,KAAK,OAAO;AAAA,IAC5C,KAAK;AACH,aAAO,EAAE,GAAG,kBAAkB,QAAQ,OAAO;AAAA,IAC/C;AACE,aAAO;AAAA,EACX;AACF;AAEA,IAAM,gBAAgB,OAAO;AAAA,EAC3B,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,WAAW;AAAA,EACX,KAAK;AAAA,EACL,SAAS;AAAA,EACT,GAAG;AAAA,EACH,UAAU;AAAA,EACV,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,IACX,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,IACnB,yBAAyB;AAAA,EAC3B;AAAA,EACA,iBAAiB;AAAA,IACf,iBAAiB;AAAA,EACnB;AAAA,EACA,cAAc;AAAA,IACZ,iBAAiB;AAAA,EACnB;AAAA,EACA,eAAe;AAAA,IACb,iBAAiB;AAAA,EACnB;AAAA,EACA,gBAAgB;AAAA,IACd,iBAAiB;AAAA,EACnB;AACF,CAAC;AAoBM,SAAS,YAAY,OAAsC;AAChE,QAAM,EAAE,UAAU,GAAG,YAAY,IAAI;AACrC,QAAM,EAAE,SAAS,SAAS,IAAI,kBAAkB;AAChD,QAAM,iBAAiB;AAAA,IACrB,MAAM,YAAY,YAAY,QAAQ;AAAA,IACtC,CAAC,QAAQ;AAAA,EACX;AAEA,SACE,oBAAC,QAAK,MAAM,UACV;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,iBAAe,YAAY;AAAA,MAC3B,WAAW,GAAG,YAAY,WAAW,aAAa;AAAA,MAClD,KAAK;AAAA,MACL,OAAO;AAAA;AAAA,EACT,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,82 +1,10 @@
1
1
  "use client";
2
2
  import {
3
- button
4
- } from "../chunk-WX6UE7PC.js";
5
- import "../chunk-2EH5BYDL.js";
6
- import {
7
- cx
8
- } from "../chunk-KMSZ2GAN.js";
9
-
10
- // src/components/NavMenuTrigger.tsx
11
- import {
12
- useCallback
13
- } from "react";
14
- import {
15
- createNavTriggerProps
16
- } from "../aria-helpers/nav-menu.aria.js";
17
- import { useNavMenuContext } from "../context/navMenu.js";
18
- import { Show } from "./Show.js";
19
- import { jsx } from "react/jsx-runtime";
20
- function NavMenuTrigger(props) {
21
- const {
22
- as,
23
- palette,
24
- usage,
25
- shape,
26
- controls,
27
- expanded: propsExpanded,
28
- onClick,
29
- ...nativeProps
30
- } = props;
31
- const { triggerRef, onToggle, expanded } = useNavMenuContext();
32
- const ariaProps = createNavTriggerProps({
33
- controls,
34
- expanded: propsExpanded ?? expanded
35
- });
36
- const hasAs = Boolean(as);
37
- const AsSub = as;
38
- const handleClick = useCallback(
39
- (e) => {
40
- if (onClick)
41
- return onClick(e);
42
- onToggle();
43
- },
44
- [onClick, onToggle]
45
- );
46
- return /* @__PURE__ */ jsx(
47
- Show,
48
- {
49
- when: hasAs,
50
- fallback: /* @__PURE__ */ jsx(
51
- "button",
52
- {
53
- ...nativeProps,
54
- ...ariaProps,
55
- className: cx(
56
- nativeProps.className,
57
- button({
58
- palette,
59
- usage,
60
- shape
61
- })
62
- ),
63
- onClick: handleClick,
64
- ref: triggerRef,
65
- children: props.children
66
- }
67
- ),
68
- children: hasAs && /* @__PURE__ */ jsx(
69
- AsSub,
70
- {
71
- ...nativeProps,
72
- ...ariaProps,
73
- onClick: handleClick,
74
- ref: triggerRef
75
- }
76
- )
77
- }
78
- );
79
- }
3
+ NavMenuTrigger
4
+ } from "../chunk-6YEAMVRY.js";
5
+ import "../chunk-JF76VIL3.js";
6
+ import "../chunk-KJUCHZHV.js";
7
+ import "../chunk-R4H3352X.js";
80
8
  export {
81
9
  NavMenuTrigger
82
10
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/NavMenuTrigger.tsx"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n type ButtonHTMLAttributes,\n type ElementType,\n type MouseEvent,\n} from 'react'\nimport { cx } from '@cerberus/styled-system/css/index.mjs'\nimport { button } from '@cerberus/styled-system/recipes/index.mjs'\nimport {\n createNavTriggerProps,\n type NavTriggerAriaValues,\n} from '../aria-helpers/nav-menu.aria'\nimport { useNavMenuContext } from '../context/navMenu'\nimport type { ButtonProps } from './Button'\nimport { Show } from './Show'\n\nexport interface NavMenuTriggerProps\n extends ButtonHTMLAttributes<HTMLButtonElement>,\n ButtonProps,\n NavTriggerAriaValues {\n as?: ElementType\n}\n\n/**\n * A component that allows the user to trigger a navigation menu.\n * @definition [NavMenu Docs](https://cerberus.digitalu.design/react/nav-menu)\n * @example\n * ```tsx\n * <NavMenu>\n * <NavMenuTrigger controls=\"nav-menu-list\">\n * Menu\n * </NavMenuTrigger>\n * </NavMenu>\n * ```\n */\nexport function NavMenuTrigger(props: NavMenuTriggerProps): JSX.Element {\n const {\n as,\n palette,\n usage,\n shape,\n controls,\n expanded: propsExpanded,\n onClick,\n ...nativeProps\n } = props\n const { triggerRef, onToggle, expanded } = useNavMenuContext()\n const ariaProps = createNavTriggerProps({\n controls,\n expanded: propsExpanded ?? expanded,\n })\n const hasAs = Boolean(as)\n const AsSub: ElementType = as!\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n if (onClick) return onClick(e)\n onToggle()\n },\n [onClick, onToggle],\n )\n\n return (\n <Show\n when={hasAs}\n fallback={\n <button\n {...nativeProps}\n {...ariaProps}\n className={cx(\n nativeProps.className,\n button({\n palette,\n usage,\n shape,\n }),\n )}\n onClick={handleClick}\n ref={triggerRef}\n >\n {props.children}\n </button>\n }\n >\n {hasAs && (\n <AsSub\n {...nativeProps}\n {...ariaProps}\n onClick={handleClick}\n ref={triggerRef}\n />\n )}\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;AAEA;AAAA,EACE;AAAA,OAIK;AAGP;AAAA,EACE;AAAA,OAEK;AACP,SAAS,yBAAyB;AAElC,SAAS,YAAY;AAoDb;AA/BD,SAAS,eAAe,OAAyC;AACtE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,EAAE,YAAY,UAAU,SAAS,IAAI,kBAAkB;AAC7D,QAAM,YAAY,sBAAsB;AAAA,IACtC;AAAA,IACA,UAAU,iBAAiB;AAAA,EAC7B,CAAC;AACD,QAAM,QAAQ,QAAQ,EAAE;AACxB,QAAM,QAAqB;AAE3B,QAAM,cAAc;AAAA,IAClB,CAAC,MAAqC;AACpC,UAAI;AAAS,eAAO,QAAQ,CAAC;AAC7B,eAAS;AAAA,IACX;AAAA,IACA,CAAC,SAAS,QAAQ;AAAA,EACpB;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,UACE;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG;AAAA,UACJ,WAAW;AAAA,YACT,YAAY;AAAA,YACZ,OAAO;AAAA,cACL;AAAA,cACA;AAAA,cACA;AAAA,YACF,CAAC;AAAA,UACH;AAAA,UACA,SAAS;AAAA,UACT,KAAK;AAAA,UAEJ,gBAAM;AAAA;AAAA,MACT;AAAA,MAGD,mBACC;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG;AAAA,UACJ,SAAS;AAAA,UACT,KAAK;AAAA;AAAA,MACP;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,16 +1,7 @@
1
1
  "use client";
2
-
3
- // src/components/Show.tsx
4
- import { useMemo } from "react";
5
- function Show(props) {
6
- const { when, children, fallback } = props;
7
- const condition = useMemo(() => when ?? false, [when]);
8
- return useMemo(() => {
9
- if (condition)
10
- return children;
11
- return fallback ?? null;
12
- }, [condition, children, fallback]);
13
- }
2
+ import {
3
+ Show
4
+ } from "../chunk-R4H3352X.js";
14
5
  export {
15
6
  Show
16
7
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\nexport interface ShowProps {\n when: boolean | null | undefined\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render its children or an optional fallback component\n * based on the SolidJS component.\n * @definition [Show docs](https://cerberus.digitalu.design/react/show)\n * @example\n * ```tsx\n * <Show when={condition}>\n * <div>Content</div>\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n"],"mappings":";;;AAEA,SAAS,eAAuD;AAiBzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,YAAY,QAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,SAAO,QAAQ,MAAM;AACnB,QAAI;AAAW,aAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,32 +1,8 @@
1
1
  "use client";
2
-
3
- // src/context/field.tsx
4
2
  import {
5
- createContext,
6
- useContext,
7
- useMemo
8
- } from "react";
9
- import { jsx } from "react/jsx-runtime";
10
- var FieldContext = createContext(null);
11
- function Field(props) {
12
- const value = useMemo(
13
- () => ({
14
- disabled: props.disabled,
15
- readonly: props.readonly,
16
- required: props.required,
17
- invalid: props.invalid
18
- }),
19
- [props.disabled, props.readonly, props.required, props.invalid]
20
- );
21
- return /* @__PURE__ */ jsx(FieldContext.Provider, { value, children: props.children });
22
- }
23
- function useFieldContext() {
24
- const context = useContext(FieldContext);
25
- if (!context) {
26
- throw new Error("useFieldContext must be used within a Field Provider.");
27
- }
28
- return context;
29
- }
3
+ Field,
4
+ useFieldContext
5
+ } from "../chunk-KETL4ZJK.js";
30
6
  export {
31
7
  Field,
32
8
  useFieldContext
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/field.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\nexport interface FieldContextValue {\n disabled?: boolean\n readonly?: boolean\n required?: boolean\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readonly: props.readonly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readonly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n"],"mappings":";;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAyBH;AAhBJ,IAAM,eAAe,cAAwC,IAAI;AAE1D,SAAS,MACd,OACa;AACb,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,MAChB,SAAS,MAAM;AAAA,IACjB;AAAA,IACA,CAAC,MAAM,UAAU,MAAM,UAAU,MAAM,UAAU,MAAM,OAAO;AAAA,EAChE;AAEA,SACE,oBAAC,aAAa,UAAb,EAAsB,OACpB,gBAAM,UACT;AAEJ;AAEO,SAAS,kBAAqC;AACnD,QAAM,UAAU,WAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,50 +1,8 @@
1
1
  "use client";
2
-
3
- // src/context/navMenu.tsx
4
- import { css } from "@cerberus/styled-system/css.js";
5
2
  import {
6
- createContext,
7
- useCallback,
8
- useContext,
9
- useMemo,
10
- useRef,
11
- useState
12
- } from "react";
13
- import { jsx } from "react/jsx-runtime";
14
- var NavMenuContext = createContext(null);
15
- function NavMenu(props) {
16
- const triggerRef = useRef(null);
17
- const menuRef = useRef(null);
18
- const [expanded, setExpanded] = useState(false);
19
- const handleToggle = useCallback(() => {
20
- setExpanded((prev) => !prev);
21
- }, []);
22
- const value = useMemo(
23
- () => ({
24
- triggerRef,
25
- menuRef,
26
- expanded,
27
- onToggle: handleToggle
28
- }),
29
- [expanded, handleToggle]
30
- );
31
- return /* @__PURE__ */ jsx(NavMenuContext.Provider, { value, children: /* @__PURE__ */ jsx(
32
- "nav",
33
- {
34
- className: css({
35
- position: "relative"
36
- }),
37
- children: props.children
38
- }
39
- ) });
40
- }
41
- function useNavMenuContext() {
42
- const context = useContext(NavMenuContext);
43
- if (!context) {
44
- throw new Error("useNavMenuContext must be used within a NavMenu.");
45
- }
46
- return context;
47
- }
3
+ NavMenu,
4
+ useNavMenuContext
5
+ } from "../chunk-KJUCHZHV.js";
48
6
  export {
49
7
  NavMenu,
50
8
  useNavMenuContext
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/navMenu.tsx"],"sourcesContent":["'use client'\n\nimport { css } from '@cerberus/styled-system/css'\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type PropsWithChildren,\n type RefObject,\n} from 'react'\n\nexport type NavTriggerRef = RefObject<HTMLButtonElement>\nexport type NavMenuRef = RefObject<HTMLUListElement>\n\nexport interface NavMenuContextValue {\n triggerRef: NavTriggerRef | null\n menuRef: NavMenuRef | null\n expanded: boolean\n onToggle: () => void\n}\n\nconst NavMenuContext = createContext<NavMenuContextValue | null>(null)\n\nexport function NavMenu(props: PropsWithChildren): JSX.Element {\n const triggerRef = useRef<HTMLButtonElement>(null)\n const menuRef = useRef<HTMLUListElement>(null)\n const [expanded, setExpanded] = useState<boolean>(false)\n\n const handleToggle = useCallback(() => {\n setExpanded((prev) => !prev)\n }, [])\n\n const value = useMemo(\n () => ({\n triggerRef,\n menuRef,\n expanded,\n onToggle: handleToggle,\n }),\n [expanded, handleToggle],\n )\n\n return (\n <NavMenuContext.Provider value={value}>\n <nav\n className={css({\n position: 'relative',\n })}\n >\n {props.children}\n </nav>\n </NavMenuContext.Provider>\n )\n}\n\nexport function useNavMenuContext(): NavMenuContextValue {\n const context = useContext(NavMenuContext)\n if (!context) {\n throw new Error('useNavMenuContext must be used within a NavMenu.')\n }\n return context\n}\n"],"mappings":";;;AAEA,SAAS,WAAW;AACpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAmCD;AAvBN,IAAM,iBAAiB,cAA0C,IAAI;AAE9D,SAAS,QAAQ,OAAuC;AAC7D,QAAM,aAAa,OAA0B,IAAI;AACjD,QAAM,UAAU,OAAyB,IAAI;AAC7C,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkB,KAAK;AAEvD,QAAM,eAAe,YAAY,MAAM;AACrC,gBAAY,CAAC,SAAS,CAAC,IAAI;AAAA,EAC7B,GAAG,CAAC,CAAC;AAEL,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,IACZ;AAAA,IACA,CAAC,UAAU,YAAY;AAAA,EACzB;AAEA,SACE,oBAAC,eAAe,UAAf,EAAwB,OACvB;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,IAAI;AAAA,QACb,UAAU;AAAA,MACZ,CAAC;AAAA,MAEA,gBAAM;AAAA;AAAA,EACT,GACF;AAEJ;AAEO,SAAS,oBAAyC;AACvD,QAAM,UAAU,WAAW,cAAc;AACzC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,25 +1,10 @@
1
1
  "use client";
2
-
3
- // src/context/theme.tsx
4
- import { createContext, useContext } from "react";
5
- import { useTheme } from "../hooks/useTheme.js";
6
- import { jsx } from "react/jsx-runtime";
7
- var THEME_KEY = "cerberus-theme";
8
- var MODE_KEY = "cerberus-mode";
9
- var ThemeContext = createContext(
10
- null
11
- );
12
- function ThemeProvider(props) {
13
- const state = useTheme();
14
- return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: state, children: props.children });
15
- }
16
- function useThemeContext() {
17
- const context = useContext(ThemeContext);
18
- if (!context) {
19
- throw new Error("useThemeContext must be used within a ThemeProvider");
20
- }
21
- return context;
22
- }
2
+ import {
3
+ MODE_KEY,
4
+ THEME_KEY,
5
+ ThemeProvider,
6
+ useThemeContext
7
+ } from "../chunk-SXXWC6UD.js";
23
8
  export {
24
9
  MODE_KEY,
25
10
  THEME_KEY,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/theme.tsx"],"sourcesContent":["'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport { useTheme } from '../hooks/useTheme'\n\nexport type DefaultThemes = 'cerberus'\nexport type CustomThemes<K extends string = DefaultThemes> = 'cerberus' | K\nexport type ColorModes = 'light' | 'dark'\n\nexport interface ThemeContextValue<T extends string = DefaultThemes> {\n theme: CustomThemes<T>\n mode: ColorModes\n updateTheme: (theme: T) => void\n updateMode: () => void\n}\n\nexport const THEME_KEY = 'cerberus-theme'\nexport const MODE_KEY = 'cerberus-mode'\n\nconst ThemeContext = createContext<ThemeContextValue<DefaultThemes> | null>(\n null,\n)\n\n/**\n * A context provider that allows the user to set the theme and mode of the application.\n * @example\n * ```tsx\n * <ThemeProvider>\n * <App />\n * </ThemeProvider>\n * ```\n */\nexport function ThemeProvider(props: PropsWithChildren<unknown>): JSX.Element {\n const state = useTheme()\n return (\n <ThemeContext.Provider value={state}>\n {props.children}\n </ThemeContext.Provider>\n )\n}\n\nexport function useThemeContext(): ThemeContextValue<DefaultThemes> {\n const context = useContext(ThemeContext)\n if (!context) {\n throw new Error('useThemeContext must be used within a ThemeProvider')\n }\n return context\n}\n"],"mappings":";;;AAEA,SAAS,eAAe,kBAA0C;AAClE,SAAS,gBAAgB;AAgCrB;AAnBG,IAAM,YAAY;AAClB,IAAM,WAAW;AAExB,IAAM,eAAe;AAAA,EACnB;AACF;AAWO,SAAS,cAAc,OAAgD;AAC5E,QAAM,QAAQ,SAAS;AACvB,SACE,oBAAC,aAAa,UAAb,EAAsB,OAAO,OAC3B,gBAAM,UACT;AAEJ;AAEO,SAAS,kBAAoD;AAClE,QAAM,UAAU,WAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,61 +1,7 @@
1
1
  "use client";
2
-
3
- // src/hooks/useTheme.ts
4
2
  import {
5
- useCallback,
6
- useEffect,
7
- useLayoutEffect,
8
- useMemo,
9
- useState
10
- } from "react";
11
- import {
12
- MODE_KEY,
13
- THEME_KEY
14
- } from "../context/theme.js";
15
- function useTheme(defaultTheme = "cerberus", defaultColorMode = "light") {
16
- const [theme, setTheme] = useState(defaultTheme);
17
- const [colorMode, setColorMode] = useState(defaultColorMode);
18
- const handleThemeChange = useCallback((newTheme) => {
19
- setTheme(newTheme);
20
- localStorage.setItem(THEME_KEY, newTheme);
21
- }, []);
22
- const handleColorModeChange = useCallback(() => {
23
- setColorMode((prev) => {
24
- const newMode = prev === "light" ? "dark" : "light";
25
- localStorage.setItem(MODE_KEY, newMode);
26
- return newMode;
27
- });
28
- }, []);
29
- useLayoutEffect(() => {
30
- const theme2 = localStorage.getItem(THEME_KEY);
31
- if (theme2) {
32
- setTheme(theme2);
33
- }
34
- }, []);
35
- useLayoutEffect(() => {
36
- const mode = localStorage.getItem(MODE_KEY);
37
- if (mode) {
38
- setColorMode(mode);
39
- }
40
- }, []);
41
- useEffect(() => {
42
- const root = document.documentElement;
43
- root.dataset.theme = theme;
44
- }, [theme]);
45
- useEffect(() => {
46
- const root = document.documentElement;
47
- root.dataset.colorMode = colorMode;
48
- }, [colorMode]);
49
- return useMemo(
50
- () => ({
51
- theme,
52
- mode: colorMode,
53
- updateTheme: handleThemeChange,
54
- updateMode: handleColorModeChange
55
- }),
56
- [theme, colorMode, handleThemeChange, handleColorModeChange]
57
- );
58
- }
3
+ useTheme
4
+ } from "../chunk-SXXWC6UD.js";
59
5
  export {
60
6
  useTheme
61
7
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/useTheme.ts"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useState,\n} from 'react'\nimport {\n MODE_KEY,\n THEME_KEY,\n type ColorModes,\n type CustomThemes,\n type DefaultThemes,\n type ThemeContextValue,\n} from '../context/theme'\n\nexport function useTheme<C extends string = DefaultThemes>(\n defaultTheme: CustomThemes<C> = 'cerberus',\n defaultColorMode: ColorModes = 'light',\n): ThemeContextValue<C> {\n const [theme, setTheme] = useState<CustomThemes<C>>(defaultTheme)\n const [colorMode, setColorMode] = useState<ColorModes>(defaultColorMode)\n\n const handleThemeChange = useCallback((newTheme: CustomThemes<C>) => {\n setTheme(newTheme)\n localStorage.setItem(THEME_KEY, newTheme)\n }, [])\n\n const handleColorModeChange = useCallback(() => {\n setColorMode((prev) => {\n const newMode = prev === 'light' ? 'dark' : 'light'\n localStorage.setItem(MODE_KEY, newMode)\n return newMode\n })\n }, [])\n\n useLayoutEffect(() => {\n const theme = localStorage.getItem(THEME_KEY)\n if (theme) {\n setTheme(theme as CustomThemes<C>)\n }\n }, [])\n\n useLayoutEffect(() => {\n const mode = localStorage.getItem(MODE_KEY)\n if (mode) {\n setColorMode(mode as ColorModes)\n }\n }, [])\n\n useEffect(() => {\n const root = document.documentElement\n root.dataset.theme = theme\n }, [theme])\n\n useEffect(() => {\n const root = document.documentElement\n root.dataset.colorMode = colorMode\n }, [colorMode])\n\n return useMemo(\n () => ({\n theme,\n mode: colorMode,\n updateTheme: handleThemeChange,\n updateMode: handleColorModeChange,\n }),\n [theme, colorMode, handleThemeChange, handleColorModeChange],\n )\n}\n"],"mappings":";;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAKK;AAEA,SAAS,SACd,eAAgC,YAChC,mBAA+B,SACT;AACtB,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA0B,YAAY;AAChE,QAAM,CAAC,WAAW,YAAY,IAAI,SAAqB,gBAAgB;AAEvE,QAAM,oBAAoB,YAAY,CAAC,aAA8B;AACnE,aAAS,QAAQ;AACjB,iBAAa,QAAQ,WAAW,QAAQ;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,QAAM,wBAAwB,YAAY,MAAM;AAC9C,iBAAa,CAAC,SAAS;AACrB,YAAM,UAAU,SAAS,UAAU,SAAS;AAC5C,mBAAa,QAAQ,UAAU,OAAO;AACtC,aAAO;AAAA,IACT,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,kBAAgB,MAAM;AACpB,UAAMA,SAAQ,aAAa,QAAQ,SAAS;AAC5C,QAAIA,QAAO;AACT,eAASA,MAAwB;AAAA,IACnC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,kBAAgB,MAAM;AACpB,UAAM,OAAO,aAAa,QAAQ,QAAQ;AAC1C,QAAI,MAAM;AACR,mBAAa,IAAkB;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,UAAM,OAAO,SAAS;AACtB,SAAK,QAAQ,QAAQ;AAAA,EACvB,GAAG,CAAC,KAAK,CAAC;AAEV,YAAU,MAAM;AACd,UAAM,OAAO,SAAS;AACtB,SAAK,QAAQ,YAAY;AAAA,EAC3B,GAAG,CAAC,SAAS,CAAC;AAEd,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA,MAAM;AAAA,MACN,aAAa;AAAA,MACb,YAAY;AAAA,IACd;AAAA,IACA,CAAC,OAAO,WAAW,mBAAmB,qBAAqB;AAAA,EAC7D;AACF;","names":["theme"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}