@intlayer/design-system 8.7.12 → 8.7.13

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 (83) hide show
  1. package/README.md +1 -1
  2. package/dist/esm/components/DictionaryEditor/NodeWrapper/BooleanWrapper.mjs +1 -1
  3. package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +1 -1
  4. package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +2 -0
  5. package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  6. package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +1 -1
  7. package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  8. package/dist/esm/components/Form/elements/SwitchSelectorElement.mjs +1 -1
  9. package/dist/esm/components/IDE/Code.mjs +4 -1
  10. package/dist/esm/components/IDE/Code.mjs.map +1 -1
  11. package/dist/esm/components/IDE/CodeBlockClient.mjs.map +1 -1
  12. package/dist/esm/components/IDE/CodeBlockHighlight.mjs +2 -2
  13. package/dist/esm/components/IDE/CodeBlockHighlight.mjs.map +1 -1
  14. package/dist/esm/components/IDE/CodeBlockShiki.mjs +1 -1
  15. package/dist/esm/components/IDE/CodeBlockShiki.mjs.map +1 -1
  16. package/dist/esm/components/Input/Checkbox.mjs +13 -13
  17. package/dist/esm/components/Input/Checkbox.mjs.map +1 -1
  18. package/dist/esm/components/Link/Link.mjs +3 -3
  19. package/dist/esm/components/Link/Link.mjs.map +1 -1
  20. package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +2 -1
  21. package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -1
  22. package/dist/esm/components/Navbar/index.mjs.map +1 -1
  23. package/dist/esm/components/Popover/static.mjs +1 -1
  24. package/dist/esm/components/Popover/static.mjs.map +1 -1
  25. package/dist/esm/components/SwitchSelector/SwitchSelector.mjs +127 -0
  26. package/dist/esm/components/SwitchSelector/SwitchSelector.mjs.map +1 -0
  27. package/dist/esm/components/SwitchSelector/VerticalSwitchSelector.mjs +105 -0
  28. package/dist/esm/components/SwitchSelector/VerticalSwitchSelector.mjs.map +1 -0
  29. package/dist/esm/components/SwitchSelector/index.mjs +3 -179
  30. package/dist/esm/components/SwitchSelector/useSwitchSelector.mjs +44 -0
  31. package/dist/esm/components/SwitchSelector/useSwitchSelector.mjs.map +1 -0
  32. package/dist/esm/components/index.mjs +3 -2
  33. package/dist/esm/hooks/index.mjs +2 -2
  34. package/dist/esm/hooks/reactQuery.mjs +41 -12
  35. package/dist/esm/hooks/reactQuery.mjs.map +1 -1
  36. package/dist/esm/hooks/useAuth/useOAuth2.mjs +2 -2
  37. package/dist/esm/hooks/useAuth/useOAuth2.mjs.map +1 -1
  38. package/dist/esm/hooks/useAuth/useSession.mjs +6 -4
  39. package/dist/esm/hooks/useAuth/useSession.mjs.map +1 -1
  40. package/dist/esm/hooks/useItemSelector.mjs +33 -20
  41. package/dist/esm/hooks/useItemSelector.mjs.map +1 -1
  42. package/dist/esm/providers/ReactQueryProvider.mjs +56 -21
  43. package/dist/esm/providers/ReactQueryProvider.mjs.map +1 -1
  44. package/dist/types/components/Badge/index.d.ts +1 -1
  45. package/dist/types/components/Button/Button.d.ts +3 -3
  46. package/dist/types/components/CollapsibleTable/CollapsibleTable.d.ts +1 -1
  47. package/dist/types/components/Command/index.d.ts +1 -1
  48. package/dist/types/components/Container/index.d.ts +6 -6
  49. package/dist/types/components/IDE/Code.d.ts +2 -2
  50. package/dist/types/components/IDE/Code.d.ts.map +1 -1
  51. package/dist/types/components/IDE/CodeBlockClient.d.ts +3 -3
  52. package/dist/types/components/IDE/CodeBlockClient.d.ts.map +1 -1
  53. package/dist/types/components/IDE/CodeBlockHighlight.d.ts +2 -1
  54. package/dist/types/components/IDE/CodeBlockHighlight.d.ts.map +1 -1
  55. package/dist/types/components/IDE/CodeBlockShiki.d.ts +2 -2
  56. package/dist/types/components/IDE/CodeBlockShiki.d.ts.map +1 -1
  57. package/dist/types/components/Input/Checkbox.d.ts +3 -3
  58. package/dist/types/components/Input/Checkbox.d.ts.map +1 -1
  59. package/dist/types/components/Input/Input.d.ts +1 -1
  60. package/dist/types/components/Link/Link.d.ts +2 -2
  61. package/dist/types/components/Navbar/index.d.ts.map +1 -1
  62. package/dist/types/components/Pagination/Pagination.d.ts +1 -1
  63. package/dist/types/components/SwitchSelector/SwitchSelector.d.ts +56 -0
  64. package/dist/types/components/SwitchSelector/SwitchSelector.d.ts.map +1 -0
  65. package/dist/types/components/SwitchSelector/VerticalSwitchSelector.d.ts +22 -0
  66. package/dist/types/components/SwitchSelector/VerticalSwitchSelector.d.ts.map +1 -0
  67. package/dist/types/components/SwitchSelector/index.d.ts +3 -79
  68. package/dist/types/components/SwitchSelector/useSwitchSelector.d.ts +27 -0
  69. package/dist/types/components/SwitchSelector/useSwitchSelector.d.ts.map +1 -0
  70. package/dist/types/components/Tab/Tab.d.ts +1 -1
  71. package/dist/types/components/TabSelector/TabSelector.d.ts +1 -1
  72. package/dist/types/components/Tag/index.d.ts +2 -2
  73. package/dist/types/components/Toaster/Toast.d.ts +1 -1
  74. package/dist/types/components/index.d.ts +3 -2
  75. package/dist/types/hooks/index.d.ts +2 -2
  76. package/dist/types/hooks/reactQuery.d.ts +4 -1
  77. package/dist/types/hooks/reactQuery.d.ts.map +1 -1
  78. package/dist/types/hooks/useAuth/useOAuth2.d.ts.map +1 -1
  79. package/dist/types/providers/ReactQueryProvider.d.ts +5 -2
  80. package/dist/types/providers/ReactQueryProvider.d.ts.map +1 -1
  81. package/package.json +24 -21
  82. package/dist/esm/components/SwitchSelector/index.mjs.map +0 -1
  83. package/dist/types/components/SwitchSelector/index.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useSession.mjs","names":["configuration","defaultConfiguration"],"sources":["../../../../src/hooks/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport { useQueryClient } from '@hooks/reactQuery';\nimport type { SessionAPI } from '@intlayer/backend';\nimport { default as defaultConfiguration } from '@intlayer/config/built';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { getAuthAPI } from '@libs/auth';\nimport { useQuery } from '@tanstack/react-query';\n\nexport type UseSessionResult = {\n /** The current session: `undefined` while loading, `null` if fetched and no session, otherwise the session. */\n session: SessionAPI | null | undefined;\n /** Refetches the session and returns it (undefined while loading). */\n fetchSession: () => Promise<SessionAPI | null | undefined>;\n /** Alias of `fetchSession` for ergonomics. */\n revalidateSession: () => Promise<SessionAPI | null | undefined>;\n /** Manually set the session cache. */\n setSession: (nextSession: SessionAPI | null) => void;\n};\n\nexport const useSession = (\n sessionProp?: SessionAPI | null,\n intlayerConfiguration?: IntlayerConfig\n): UseSessionResult => {\n const configuration = useConfiguration();\n const config = (intlayerConfiguration ??\n configuration ??\n defaultConfiguration) as IntlayerConfig;\n\n const queryClient = useQueryClient();\n\n // Keep TanStack generics internal so they don't leak into the d.ts\n const { data, isFetched, refetch } = useQuery({\n queryKey: ['session'],\n queryFn: async () => {\n const intlayerAPI = getAuthAPI(config);\n const result = await intlayerAPI.getSession();\n // Narrow to the public shape we want to expose\n return result.data as unknown as SessionAPI;\n },\n // Session data rarely changes during navigation, so keep it fresh for 1 minute\n // This prevents unnecessary refetches when navigating between pages\n staleTime: 60 * 1000,\n gcTime: 5 * 60 * 1000,\n // Only refetch if data is stale (not on every mount)\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n enabled: !sessionProp,\n });\n\n const session = data ?? (isFetched ? null : undefined);\n\n const setSession = (nextSession: SessionAPI | null) => {\n queryClient.setQueryData(['session'], nextSession);\n };\n\n const fetchSession = async (): Promise<SessionAPI | null | undefined> => {\n const res = await refetch();\n return res.data as SessionAPI | null | undefined;\n };\n\n const revalidateSession = fetchSession;\n\n return {\n session,\n fetchSession,\n revalidateSession,\n setSession,\n };\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAa,cACX,aACA,0BACqB;CACrB,MAAMA,kBAAgB,kBAAkB;CACxC,MAAM,SAAU,yBACdA,mBACAC;CAEF,MAAM,cAAc,gBAAgB;CAGpC,MAAM,EAAE,MAAM,WAAW,YAAY,SAAS;EAC5C,UAAU,CAAC,UAAU;EACrB,SAAS,YAAY;AAInB,WAAO,MAHa,WAAW,OACC,CAAC,YAAY,EAE/B;;EAIhB,WAAW,KAAK;EAChB,QAAQ,MAAS;EAEjB,gBAAgB;EAChB,sBAAsB;EACtB,oBAAoB;EACpB,SAAS,CAAC;EACX,CAAC;CAEF,MAAM,UAAU,SAAS,YAAY,OAAO;CAE5C,MAAM,cAAc,gBAAmC;AACrD,cAAY,aAAa,CAAC,UAAU,EAAE,YAAY;;CAGpD,MAAM,eAAe,YAAoD;AAEvE,UAAO,MADW,SAAS,EAChB;;AAKb,QAAO;EACL;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"useSession.mjs","names":["configuration","defaultConfiguration"],"sources":["../../../../src/hooks/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport { useQueryClient } from '@hooks/reactQuery';\nimport type { SessionAPI } from '@intlayer/backend';\nimport { default as defaultConfiguration } from '@intlayer/config/built';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { getAuthAPI } from '@libs/auth';\nimport { useQuery } from '@tanstack/react-query';\n\nexport type UseSessionResult = {\n /** The current session: `undefined` while loading, `null` if fetched and no session, otherwise the session. */\n session: SessionAPI | null | undefined;\n /** Refetches the session and returns it (undefined while loading). */\n fetchSession: () => Promise<SessionAPI | null | undefined>;\n /** Alias of `fetchSession` for ergonomics. */\n revalidateSession: () => Promise<SessionAPI | null | undefined>;\n /** Manually set the session cache. */\n setSession: (nextSession: SessionAPI | null) => void;\n};\n\nexport const useSession = (\n sessionProp?: SessionAPI | null,\n intlayerConfiguration?: IntlayerConfig\n): UseSessionResult => {\n const configuration = useConfiguration();\n const config = (intlayerConfiguration ??\n configuration ??\n defaultConfiguration) as IntlayerConfig;\n\n const queryClient = useQueryClient();\n\n // Keep TanStack generics internal so they don't leak into the d.ts\n const { data, isFetched, refetch } = useQuery({\n queryKey: ['session'],\n queryFn: async () => {\n const intlayerAPI = getAuthAPI(config);\n const result = await intlayerAPI.getSession();\n // Narrow to the public shape we want to expose\n return result.data as unknown as SessionAPI;\n },\n // Session data rarely changes during navigation, so keep it fresh for 5 minutes\n // This prevents unnecessary refetches when navigating between pages\n staleTime: 5 * 60 * 1000,\n gcTime: 30 * 60 * 1000,\n // Periodically revalidate so the backend's sliding session-refresh\n // (better-auth `updateAge`) keeps the cookie alive for active users.\n refetchInterval: 10 * 60 * 1000,\n refetchIntervalInBackground: false,\n refetchOnMount: true,\n // Refetching on focus/reconnect lets a returning user get a fresh,\n // extended session without a manual reload.\n refetchOnWindowFocus: true,\n refetchOnReconnect: true,\n enabled: !sessionProp,\n });\n\n const session = data ?? (isFetched ? null : undefined);\n\n const setSession = (nextSession: SessionAPI | null) => {\n queryClient.setQueryData(['session'], nextSession);\n };\n\n const fetchSession = async (): Promise<SessionAPI | null | undefined> => {\n const res = await refetch();\n return res.data as SessionAPI | null | undefined;\n };\n\n const revalidateSession = fetchSession;\n\n return {\n session,\n fetchSession,\n revalidateSession,\n setSession,\n };\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAa,cACX,aACA,0BACqB;CACrB,MAAMA,kBAAgB,kBAAkB;CACxC,MAAM,SAAU,yBACdA,mBACAC;CAEF,MAAM,cAAc,gBAAgB;CAGpC,MAAM,EAAE,MAAM,WAAW,YAAY,SAAS;EAC5C,UAAU,CAAC,UAAU;EACrB,SAAS,YAAY;AAInB,WAAO,MAHa,WAAW,OACC,CAAC,YAAY,EAE/B;;EAIhB,WAAW,MAAS;EACpB,QAAQ,OAAU;EAGlB,iBAAiB,MAAU;EAC3B,6BAA6B;EAC7B,gBAAgB;EAGhB,sBAAsB;EACtB,oBAAoB;EACpB,SAAS,CAAC;EACX,CAAC;CAEF,MAAM,UAAU,SAAS,YAAY,OAAO;CAE5C,MAAM,cAAc,gBAAmC;AACrD,cAAY,aAAa,CAAC,UAAU,EAAE,YAAY;;CAGpD,MAAM,eAAe,YAAoD;AAEvE,UAAO,MADW,SAAS,EAChB;;AAKb,QAAO;EACL;EACA;EACA;EACA;EACD"}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { useEffect, useRef, useState } from "react";
3
+ import { useLayoutEffect, useRef, useState } from "react";
4
4
 
5
5
  //#region src/hooks/useItemSelector.ts
6
6
  const selectorDefault = (option) => option?.getAttribute("aria-selected") === "true";
@@ -24,47 +24,60 @@ const useItemSelector = (optionsRefs, { selector = selectorDefault, isHoverable
24
24
  }
25
25
  } else targetElement = optionsRefs.current.find(selector) ?? null;
26
26
  if (!targetElement) {
27
- if (orientation === "vertical") setChoiceIndicatorPosition((prev) => {
28
- const verticalPrev = prev;
27
+ if (orientation === "vertical") {
28
+ const verticalPrev = lastPositionRef.current;
29
29
  const newPosition = {
30
30
  top: verticalPrev?.top ?? 0,
31
31
  height: verticalPrev?.height ?? 0,
32
32
  opacity: 0
33
33
  };
34
- lastPositionRef.current = newPosition;
35
- return newPosition;
36
- });
37
- else setChoiceIndicatorPosition((prev) => {
38
- const horizontalPrev = prev;
34
+ if (verticalPrev?.opacity !== 0) {
35
+ setChoiceIndicatorPosition(newPosition);
36
+ lastPositionRef.current = newPosition;
37
+ }
38
+ } else {
39
+ const horizontalPrev = lastPositionRef.current;
39
40
  const newPosition = {
40
41
  left: horizontalPrev?.left ?? 0,
41
42
  width: horizontalPrev?.width ?? 0,
42
43
  opacity: 0
43
44
  };
44
- lastPositionRef.current = newPosition;
45
- return newPosition;
46
- });
45
+ if (horizontalPrev?.opacity !== 0) {
46
+ setChoiceIndicatorPosition(newPosition);
47
+ lastPositionRef.current = newPosition;
48
+ }
49
+ }
47
50
  return;
48
51
  }
49
52
  if (orientation === "vertical") {
53
+ const top = targetElement.offsetTop;
54
+ const height = targetElement.offsetHeight;
50
55
  const newPosition = {
51
- top: targetElement.offsetTop,
52
- height: targetElement.offsetHeight,
56
+ top,
57
+ height,
53
58
  opacity: 1
54
59
  };
55
- setChoiceIndicatorPosition(newPosition);
56
- lastPositionRef.current = newPosition;
60
+ const prev = lastPositionRef.current;
61
+ if (!prev || prev.top !== top || prev.height !== height || prev.opacity !== 1) {
62
+ setChoiceIndicatorPosition(newPosition);
63
+ lastPositionRef.current = newPosition;
64
+ }
57
65
  } else {
66
+ const left = targetElement.offsetLeft;
67
+ const width = targetElement.offsetWidth;
58
68
  const newPosition = {
59
- left: targetElement.offsetLeft,
60
- width: targetElement.offsetWidth,
69
+ left,
70
+ width,
61
71
  opacity: 1
62
72
  };
63
- setChoiceIndicatorPosition(newPosition);
64
- lastPositionRef.current = newPosition;
73
+ const prev = lastPositionRef.current;
74
+ if (!prev || prev.left !== left || prev.width !== width || prev.opacity !== 1) {
75
+ setChoiceIndicatorPosition(newPosition);
76
+ lastPositionRef.current = newPosition;
77
+ }
65
78
  }
66
79
  };
67
- useEffect(() => {
80
+ useLayoutEffect(() => {
68
81
  calculatePosition();
69
82
  window.addEventListener("resize", calculatePosition);
70
83
  window.addEventListener("DOMContentLoaded", calculatePosition);
@@ -1 +1 @@
1
- {"version":3,"file":"useItemSelector.mjs","names":[],"sources":["../../../src/hooks/useItemSelector.ts"],"sourcesContent":["'use client';\n\nimport { type RefObject, useEffect, useRef, useState } from 'react';\n\nexport type ItemSelectorOrientation = 'horizontal' | 'vertical';\n\ntype HorizontalStyleState = {\n left: number;\n width: number;\n opacity: number;\n};\n\ntype VerticalStyleState = {\n top: number;\n height: number;\n opacity: number;\n};\n\ntype StyleState = HorizontalStyleState | VerticalStyleState;\n\nconst selectorDefault = (option: HTMLElement) =>\n option?.getAttribute('aria-selected') === 'true';\n\ntype Options = {\n selector?: (option: HTMLElement, index: number) => boolean;\n isHoverable?: boolean;\n orientation?: ItemSelectorOrientation;\n};\n\nexport const useItemSelector = (\n optionsRefs: RefObject<HTMLElement[]>,\n {\n selector = selectorDefault,\n isHoverable = false,\n orientation = 'horizontal',\n }: Options = {\n selector: selectorDefault,\n isHoverable: false,\n orientation: 'horizontal',\n }\n) => {\n const [choiceIndicatorPosition, setChoiceIndicatorPosition] =\n useState<StyleState | null>(null);\n\n const [hoveredItem, setHoveredItem] = useState<HTMLElement | null>(null);\n const hideTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n const lastPositionRef = useRef<StyleState | null>(null);\n\n const itemsLength = optionsRefs.current.length;\n\n const calculatePosition = () => {\n let targetElement: HTMLElement | null = null;\n\n if (hoveredItem) {\n targetElement = hoveredItem;\n // Clear any pending hide timeout when hovering over an item\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n } else {\n targetElement = optionsRefs.current.find(selector) ?? null;\n }\n\n if (!targetElement) {\n // Keep previous position but set opacity to 0\n if (orientation === 'vertical') {\n setChoiceIndicatorPosition((prev) => {\n const verticalPrev = prev as VerticalStyleState | null;\n const newPosition: VerticalStyleState = {\n top: verticalPrev?.top ?? 0,\n height: verticalPrev?.height ?? 0,\n opacity: 0,\n };\n lastPositionRef.current = newPosition;\n return newPosition;\n });\n } else {\n setChoiceIndicatorPosition((prev) => {\n const horizontalPrev = prev as HorizontalStyleState | null;\n const newPosition: HorizontalStyleState = {\n left: horizontalPrev?.left ?? 0,\n width: horizontalPrev?.width ?? 0,\n opacity: 0,\n };\n lastPositionRef.current = newPosition;\n return newPosition;\n });\n }\n return;\n }\n\n if (orientation === 'vertical') {\n const top = targetElement.offsetTop;\n const height = targetElement.offsetHeight;\n\n const newPosition = {\n top,\n height,\n opacity: 1,\n };\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n } else {\n const left = targetElement.offsetLeft;\n const width = targetElement.offsetWidth;\n\n const newPosition = {\n left,\n width,\n opacity: 1,\n };\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n }\n };\n\n useEffect(() => {\n calculatePosition();\n\n // Event listeners for window events\n window.addEventListener('resize', calculatePosition);\n window.addEventListener('DOMContentLoaded', calculatePosition);\n\n // MutationObserver to watch for 'aria-selected' changes\n const mutationObservers: MutationObserver[] = [];\n\n optionsRefs.current.forEach((option) => {\n if (option) {\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (\n mutation.type === 'attributes' &&\n (mutation.attributeName === 'aria-selected' ||\n mutation.attributeName === 'data-active' ||\n mutation.attributeName === 'data-indicator')\n ) {\n calculatePosition();\n break;\n }\n }\n });\n\n observer.observe(option, {\n attributes: true,\n attributeFilter: ['aria-selected', 'data-active', 'data-indicator'],\n });\n\n mutationObservers.push(observer);\n }\n });\n\n // ResizeObserver to watch for size changes\n const resizeObservers: ResizeObserver[] = [];\n\n const observeSize = (element: HTMLElement) => {\n if (!element) return;\n const resizeObserver = new ResizeObserver(() => {\n calculatePosition();\n });\n resizeObserver.observe(element);\n resizeObservers.push(resizeObserver);\n };\n\n // Observe the selected item\n const selectedItem = optionsRefs.current.find(selector) ?? null;\n\n if (selectedItem) {\n observeSize(selectedItem);\n }\n\n // Observe the hovered item\n if (hoveredItem) {\n observeSize(hoveredItem);\n }\n\n // Add hover event listeners\n const handleMouseEnter = (event: Event) => {\n // Clear any pending hide timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n setHoveredItem(event.currentTarget as HTMLElement);\n };\n\n const handleMouseLeave = () => {\n // Clear any existing timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n\n // Keep the indicator at its current position for 150ms\n // before removing the hovered item\n hideTimeoutRef.current = setTimeout(() => {\n setHoveredItem(null);\n }, 150); // 150ms delay before hiding\n };\n\n if (isHoverable) {\n optionsRefs.current.forEach((option) => {\n option?.addEventListener('mouseenter', handleMouseEnter, {\n passive: true,\n });\n option?.addEventListener('mouseleave', handleMouseLeave, {\n passive: true,\n });\n });\n }\n\n return () => {\n // Clear any pending hide timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n\n // Cleanup window event listeners\n window.removeEventListener('resize', calculatePosition);\n window.removeEventListener('DOMContentLoaded', calculatePosition);\n\n // Disconnect MutationObservers\n mutationObservers.forEach((observer) => {\n observer.disconnect();\n });\n\n // Disconnect ResizeObservers\n resizeObservers.forEach((observer) => {\n observer.disconnect();\n });\n\n // Remove hover event listeners\n optionsRefs.current.forEach((option) => {\n option?.removeEventListener('mouseenter', handleMouseEnter);\n option?.removeEventListener('mouseleave', handleMouseLeave);\n });\n };\n }, [\n optionsRefs,\n selector,\n hoveredItem,\n itemsLength,\n orientation,\n isHoverable,\n ]);\n\n return { choiceIndicatorPosition, calculatePosition, orientation };\n};\n"],"mappings":";;;;;AAoBA,MAAM,mBAAmB,WACvB,QAAQ,aAAa,gBAAgB,KAAK;AAQ5C,MAAa,mBACX,aACA,EACE,WAAW,iBACX,cAAc,OACd,cAAc,iBACH;CACX,UAAU;CACV,aAAa;CACb,aAAa;CACd,KACE;CACH,MAAM,CAAC,yBAAyB,8BAC9B,SAA4B,KAAK;CAEnC,MAAM,CAAC,aAAa,kBAAkB,SAA6B,KAAK;CACxE,MAAM,iBAAiB,OAA8B,KAAK;CAC1D,MAAM,kBAAkB,OAA0B,KAAK;CAEvD,MAAM,cAAc,YAAY,QAAQ;CAExC,MAAM,0BAA0B;EAC9B,IAAI,gBAAoC;AAExC,MAAI,aAAa;AACf,mBAAgB;AAEhB,OAAI,eAAe,SAAS;AAC1B,iBAAa,eAAe,QAAQ;AACpC,mBAAe,UAAU;;QAG3B,iBAAgB,YAAY,QAAQ,KAAK,SAAS,IAAI;AAGxD,MAAI,CAAC,eAAe;AAElB,OAAI,gBAAgB,WAClB,6BAA4B,SAAS;IACnC,MAAM,eAAe;IACrB,MAAM,cAAkC;KACtC,K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,eAAe,YAAY,QAAQ,KAAK,SAAS,IAAI;AAE3D,MAAI,aACF,aAAY,aAAa;AAI3B,MAAI,YACF,aAAY,YAAY;EAI1B,MAAM,oBAAoB,UAAiB;AAEzC,OAAI,eAAe,SAAS;AAC1B,iBAAa,eAAe,QAAQ;AACpC,mBAAe,UAAU;;AAE3B,kBAAe,MAAM,cAA6B;;EAGpD,MAAM,yBAAyB;AAE7B,OAAI,eAAe,QACjB,cAAa,eAAe,QAAQ;AAKtC,kBAAe,UAAU,iBAAiB;AACxC,mBAAe,KAAK;MACnB,IAAI;;AAGT,MAAI,YACF,aAAY,QAAQ,SAAS,WAAW;AACtC,WAAQ,iBAAiB,cAAc,kBAAkB,EACvD,SAAS,MACV,CAAC;AACF,WAAQ,iBAAiB,cAAc,kBAAkB,EACvD,SAAS,MACV,CAAC;IACF;AAGJ,eAAa;AAEX,OAAI,eAAe,QACjB,cAAa,eAAe,QAAQ;AAItC,UAAO,oBAAoB,UAAU,kBAAkB;AACvD,UAAO,oBAAoB,oBAAoB,kBAAkB;AAGjE,qBAAkB,SAAS,aAAa;AACtC,aAAS,YAAY;KACrB;AAGF,mBAAgB,SAAS,aAAa;AACpC,aAAS,YAAY;KACrB;AAGF,eAAY,QAAQ,SAAS,WAAW;AACtC,YAAQ,oBAAoB,cAAc,iBAAiB;AAC3D,YAAQ,oBAAoB,cAAc,iBAAiB;KAC3D;;IAEH;EACD;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QAAO;EAAE;EAAyB;EAAmB;EAAa"}
1
+ {"version":3,"file":"useItemSelector.mjs","names":[],"sources":["../../../src/hooks/useItemSelector.ts"],"sourcesContent":["'use client';\n\nimport { type RefObject, useLayoutEffect, useRef, useState } from 'react';\n\nexport type ItemSelectorOrientation = 'horizontal' | 'vertical';\n\ntype HorizontalStyleState = {\n left: number;\n width: number;\n opacity: number;\n};\n\ntype VerticalStyleState = {\n top: number;\n height: number;\n opacity: number;\n};\n\ntype StyleState = HorizontalStyleState | VerticalStyleState;\n\nconst selectorDefault = (option: HTMLElement) =>\n option?.getAttribute('aria-selected') === 'true';\n\ntype Options = {\n selector?: (option: HTMLElement, index: number) => boolean;\n isHoverable?: boolean;\n orientation?: ItemSelectorOrientation;\n};\n\nexport const useItemSelector = (\n optionsRefs: RefObject<HTMLElement[]>,\n {\n selector = selectorDefault,\n isHoverable = false,\n orientation = 'horizontal',\n }: Options = {\n selector: selectorDefault,\n isHoverable: false,\n orientation: 'horizontal',\n }\n) => {\n const [choiceIndicatorPosition, setChoiceIndicatorPosition] =\n useState<StyleState | null>(null);\n\n const [hoveredItem, setHoveredItem] = useState<HTMLElement | null>(null);\n const hideTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n const lastPositionRef = useRef<StyleState | null>(null);\n\n const itemsLength = optionsRefs.current.length;\n\n const calculatePosition = () => {\n let targetElement: HTMLElement | null = null;\n\n if (hoveredItem) {\n targetElement = hoveredItem;\n // Clear any pending hide timeout when hovering over an item\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n } else {\n targetElement = optionsRefs.current.find(selector) ?? null;\n }\n\n if (!targetElement) {\n // Keep previous position but set opacity to 0\n if (orientation === 'vertical') {\n const verticalPrev =\n lastPositionRef.current as VerticalStyleState | null;\n const newPosition: VerticalStyleState = {\n top: verticalPrev?.top ?? 0,\n height: verticalPrev?.height ?? 0,\n opacity: 0,\n };\n\n if (verticalPrev?.opacity !== 0) {\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n }\n } else {\n const horizontalPrev =\n lastPositionRef.current as HorizontalStyleState | null;\n const newPosition: HorizontalStyleState = {\n left: horizontalPrev?.left ?? 0,\n width: horizontalPrev?.width ?? 0,\n opacity: 0,\n };\n\n if (horizontalPrev?.opacity !== 0) {\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n }\n }\n return;\n }\n\n if (orientation === 'vertical') {\n const top = targetElement.offsetTop;\n const height = targetElement.offsetHeight;\n\n const newPosition = {\n top,\n height,\n opacity: 1,\n };\n\n const prev = lastPositionRef.current as VerticalStyleState | null;\n\n if (\n !prev ||\n prev.top !== top ||\n prev.height !== height ||\n prev.opacity !== 1\n ) {\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n }\n } else {\n const left = targetElement.offsetLeft;\n const width = targetElement.offsetWidth;\n\n const newPosition = {\n left,\n width,\n opacity: 1,\n };\n\n const prev = lastPositionRef.current as HorizontalStyleState | null;\n\n if (\n !prev ||\n prev.left !== left ||\n prev.width !== width ||\n prev.opacity !== 1\n ) {\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n }\n }\n };\n\n useLayoutEffect(() => {\n calculatePosition();\n\n // Event listeners for window events\n window.addEventListener('resize', calculatePosition);\n window.addEventListener('DOMContentLoaded', calculatePosition);\n\n // MutationObserver to watch for 'aria-selected' changes\n const mutationObservers: MutationObserver[] = [];\n\n optionsRefs.current.forEach((option) => {\n if (option) {\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (\n mutation.type === 'attributes' &&\n (mutation.attributeName === 'aria-selected' ||\n mutation.attributeName === 'data-active' ||\n mutation.attributeName === 'data-indicator')\n ) {\n calculatePosition();\n break;\n }\n }\n });\n\n observer.observe(option, {\n attributes: true,\n attributeFilter: ['aria-selected', 'data-active', 'data-indicator'],\n });\n\n mutationObservers.push(observer);\n }\n });\n\n // ResizeObserver to watch for size changes\n const resizeObservers: ResizeObserver[] = [];\n\n const observeSize = (element: HTMLElement) => {\n if (!element) return;\n const resizeObserver = new ResizeObserver(() => {\n calculatePosition();\n });\n resizeObserver.observe(element);\n resizeObservers.push(resizeObserver);\n };\n\n // Observe the selected item\n const selectedItem = optionsRefs.current.find(selector) ?? null;\n\n if (selectedItem) {\n observeSize(selectedItem);\n }\n\n // Observe the hovered item\n if (hoveredItem) {\n observeSize(hoveredItem);\n }\n\n // Add hover event listeners\n const handleMouseEnter = (event: Event) => {\n // Clear any pending hide timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n setHoveredItem(event.currentTarget as HTMLElement);\n };\n\n const handleMouseLeave = () => {\n // Clear any existing timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n\n // Keep the indicator at its current position for 150ms\n // before removing the hovered item\n hideTimeoutRef.current = setTimeout(() => {\n setHoveredItem(null);\n }, 150); // 150ms delay before hiding\n };\n\n if (isHoverable) {\n optionsRefs.current.forEach((option) => {\n option?.addEventListener('mouseenter', handleMouseEnter, {\n passive: true,\n });\n option?.addEventListener('mouseleave', handleMouseLeave, {\n passive: true,\n });\n });\n }\n\n return () => {\n // Clear any pending hide timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n\n // Cleanup window event listeners\n window.removeEventListener('resize', calculatePosition);\n window.removeEventListener('DOMContentLoaded', calculatePosition);\n\n // Disconnect MutationObservers\n mutationObservers.forEach((observer) => {\n observer.disconnect();\n });\n\n // Disconnect ResizeObservers\n resizeObservers.forEach((observer) => {\n observer.disconnect();\n });\n\n // Remove hover event listeners\n optionsRefs.current.forEach((option) => {\n option?.removeEventListener('mouseenter', handleMouseEnter);\n option?.removeEventListener('mouseleave', handleMouseLeave);\n });\n };\n }, [\n optionsRefs,\n selector,\n hoveredItem,\n itemsLength,\n orientation,\n isHoverable,\n ]);\n\n return { choiceIndicatorPosition, calculatePosition, orientation };\n};\n"],"mappings":";;;;;AAoBA,MAAM,mBAAmB,WACvB,QAAQ,aAAa,gBAAgB,KAAK;AAQ5C,MAAa,mBACX,aACA,EACE,WAAW,iBACX,cAAc,OACd,cAAc,iBACH;CACX,UAAU;CACV,aAAa;CACb,aAAa;CACd,KACE;CACH,MAAM,CAAC,yBAAyB,8BAC9B,SAA4B,KAAK;CAEnC,MAAM,CAAC,aAAa,kBAAkB,SAA6B,KAAK;CACxE,MAAM,iBAAiB,OAA8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AAI,eAAe,QACjB,cAAa,eAAe,QAAQ;AAItC,UAAO,oBAAoB,UAAU,kBAAkB;AACvD,UAAO,oBAAoB,oBAAoB,kBAAkB;AAGjE,qBAAkB,SAAS,aAAa;AACtC,aAAS,YAAY;KACrB;AAGF,mBAAgB,SAAS,aAAa;AACpC,aAAS,YAAY;KACrB;AAGF,eAAY,QAAQ,SAAS,WAAW;AACtC,YAAQ,oBAAoB,cAAc,iBAAiB;AAC3D,YAAQ,oBAAoB,cAAc,iBAAiB;KAC3D;;IAEH;EACD;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QAAO;EAAE;EAAyB;EAAmB;EAAa"}
@@ -1,22 +1,38 @@
1
1
  'use client';
2
2
 
3
3
  import { useToast } from "../components/Toaster/useToast.mjs";
4
+ import { createAsyncStoragePersister } from "@tanstack/query-async-storage-persister";
4
5
  import { MutationCache, QueryClient, QueryClientProvider } from "@tanstack/react-query";
6
+ import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client";
5
7
  import { useRef } from "react";
6
8
  import { jsx } from "react/jsx-runtime";
7
9
 
8
10
  //#region src/providers/ReactQueryProvider.tsx
11
+ const PERSIST_MAX_AGE = 1e3 * 60 * 60 * 24;
12
+ const PERSIST_BUSTER = "v1";
9
13
  const defaultQueryOptions = {
10
14
  queries: {
11
15
  retry: 1,
12
16
  staleTime: 30 * 1e3,
13
- gcTime: 300 * 1e3,
17
+ gcTime: PERSIST_MAX_AGE,
14
18
  refetchOnMount: true,
15
19
  refetchOnWindowFocus: false,
16
20
  refetchOnReconnect: false
17
21
  },
18
22
  mutations: { retry: 0 }
19
23
  };
24
+ const persister = createAsyncStoragePersister({
25
+ storage: typeof window !== "undefined" ? {
26
+ getItem: (key) => Promise.resolve(window.localStorage.getItem(key)),
27
+ setItem: (key, value) => Promise.resolve(window.localStorage.setItem(key, value)),
28
+ removeItem: (key) => Promise.resolve(window.localStorage.removeItem(key))
29
+ } : {
30
+ getItem: () => Promise.resolve(null),
31
+ setItem: () => Promise.resolve(),
32
+ removeItem: () => Promise.resolve()
33
+ },
34
+ key: "intlayer-rq-cache"
35
+ });
20
36
  const formatErrorCode = (errorCode) => errorCode.split("_").join(" ");
21
37
  /**
22
38
  * Hook to handle error logging and toast notifications
@@ -64,29 +80,48 @@ const useToastEvents = () => {
64
80
  };
65
81
  };
66
82
  const getQueryClient = () => new QueryClient({ defaultOptions: defaultQueryOptions });
67
- const ReactQueryProvider = ({ children }) => {
83
+ const ReactQueryProvider = ({ children, client }) => {
68
84
  const { onError, onSuccess } = useToastEvents();
69
- const clientRef = useRef(null);
70
- if (!clientRef.current) {
71
- const queryClient = new QueryClient({
72
- defaultOptions: defaultQueryOptions,
73
- mutationCache: new MutationCache({
74
- onSuccess,
75
- onError,
76
- onSettled: (_data, _error, _variables, _context, mutation) => {
77
- if (mutation.meta?.invalidateQueries) mutation.meta.invalidateQueries.forEach((queryKey) => {
78
- queryClient.invalidateQueries({ queryKey });
79
- });
80
- if (mutation.meta?.resetQueries) mutation.meta.resetQueries.forEach((queryKey) => {
81
- queryClient.resetQueries({ queryKey });
82
- });
83
- }
84
- })
85
- });
86
- clientRef.current = queryClient;
85
+ const handlersRef = useRef({
86
+ onSuccess,
87
+ onError
88
+ });
89
+ handlersRef.current = {
90
+ onSuccess,
91
+ onError
92
+ };
93
+ const clientRef = useRef(client ?? null);
94
+ if (!clientRef.current) clientRef.current = new QueryClient({
95
+ defaultOptions: defaultQueryOptions,
96
+ mutationCache: new MutationCache()
97
+ });
98
+ const wiredRef = useRef(false);
99
+ if (!wiredRef.current) {
100
+ wiredRef.current = true;
101
+ const cache = clientRef.current.getMutationCache();
102
+ cache.config.onSuccess = (data, variables, onMutateResult, mutation, context) => handlersRef.current.onSuccess?.(data, variables, onMutateResult, mutation, context);
103
+ cache.config.onError = (error, variables, onMutateResult, mutation, context) => handlersRef.current.onError?.(error, variables, onMutateResult, mutation, context);
104
+ cache.config.onSettled = (_data, _error, _variables, _onMutateResult, mutation) => {
105
+ if (mutation.meta?.invalidateQueries) mutation.meta.invalidateQueries.forEach((queryKey) => {
106
+ clientRef.current?.invalidateQueries({ queryKey });
107
+ });
108
+ if (mutation.meta?.resetQueries) mutation.meta.resetQueries.forEach((queryKey) => {
109
+ clientRef.current?.resetQueries({ queryKey });
110
+ });
111
+ };
87
112
  }
88
- return /* @__PURE__ */ jsx(QueryClientProvider, {
113
+ if (client) return /* @__PURE__ */ jsx(QueryClientProvider, {
114
+ client: clientRef.current,
115
+ children
116
+ });
117
+ return /* @__PURE__ */ jsx(PersistQueryClientProvider, {
89
118
  client: clientRef.current,
119
+ persistOptions: {
120
+ persister,
121
+ maxAge: PERSIST_MAX_AGE,
122
+ buster: PERSIST_BUSTER,
123
+ dehydrateOptions: { shouldDehydrateQuery: (query) => query.state.status === "success" }
124
+ },
90
125
  children
91
126
  });
92
127
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ReactQueryProvider.mjs","names":[],"sources":["../../../src/providers/ReactQueryProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n type DefaultOptions,\n MutationCache,\n QueryClient,\n QueryClientProvider,\n type QueryKey,\n type UseMutationOptions,\n} from '@tanstack/react-query';\nimport { type FC, type PropsWithChildren, useRef } from 'react';\nimport { useToast } from '../components/Toaster';\n\nconst defaultQueryOptions: DefaultOptions = {\n queries: {\n retry: 1,\n // Keep data fresh for 30 seconds to avoid unnecessary refetches during navigation\n staleTime: 30 * 1000,\n // Give the cache a little breathing room across route transitions:\n gcTime: 5 * 60 * 1000, // e.g. 5 minutes\n // Only refetch on mount if data is stale (not every single mount)\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n },\n mutations: {\n retry: 0,\n },\n};\n\nconst SHOW_ERROR_CODE = false;\n\ndeclare module '@tanstack/react-query' {\n interface Register {\n mutationMeta: {\n onSuccess?: UseMutationOptions['onSuccess'];\n onError?: UseMutationOptions['onError'];\n invalidateQueries?: QueryKey[];\n resetQueries?: QueryKey[];\n };\n }\n}\n\nconst formatErrorCode = (errorCode: string) => errorCode.split('_').join(' ');\n\n/**\n * Hook to handle error logging and toast notifications\n */\nconst useToastEvents = () => {\n const { toast } = useToast();\n\n const onError: MutationCache['config']['onError'] = (error: any) => {\n const parsed = (() => {\n try {\n if (typeof error === 'string') return JSON.parse(error);\n if (error instanceof Error) return JSON.parse(error.message);\n } catch (_) {}\n return error;\n })();\n\n [parsed].flat().forEach((err: any) => {\n // Check for nested error object (standard in your API responses: { statusCode, error: { ... } })\n const apiError = err?.error ?? err;\n\n if (apiError?.code === 'RATE_LIMIT_EXCEEDED_UNAUTHENTICATED') {\n toast({\n title: apiError.message,\n variant: 'error',\n });\n return;\n }\n\n toast({\n title: formatErrorCode(\n SHOW_ERROR_CODE\n ? (apiError?.code ?? err?.code)\n : (apiError?.title ?? err?.title ?? 'Error')\n ),\n description:\n apiError?.message ??\n err?.message ??\n String(apiError ?? 'An error occurred'),\n variant: 'error',\n });\n });\n };\n\n const onSuccess: MutationCache['config']['onSuccess'] = (data: any) => {\n if (data?.error) {\n toast({\n title: formatErrorCode(data.error.title ?? data.error.code ?? 'Error'),\n description:\n data.error.message ?? data.error.code ?? 'An error occurred',\n variant: 'error',\n });\n }\n\n if (data?.message) {\n toast({\n title: data.message,\n description: data.description,\n variant: 'success',\n });\n }\n };\n\n return {\n onError,\n onSuccess,\n };\n};\n\nexport const getQueryClient = () =>\n new QueryClient({ defaultOptions: defaultQueryOptions });\n\nexport const ReactQueryProvider: FC<PropsWithChildren> = ({ children }) => {\n const { onError, onSuccess } = useToastEvents();\n const clientRef = useRef<QueryClient>(null);\n\n if (!clientRef.current) {\n const mutationCache = new MutationCache({\n onSuccess,\n onError,\n onSettled: (_data, _error, _variables, _context, mutation) => {\n if (mutation.meta?.invalidateQueries) {\n mutation.meta.invalidateQueries.forEach((queryKey) => {\n queryClient.invalidateQueries({\n queryKey,\n });\n });\n }\n\n if (mutation.meta?.resetQueries) {\n mutation.meta.resetQueries.forEach((queryKey) => {\n queryClient.resetQueries({\n queryKey,\n });\n });\n }\n },\n });\n\n const queryClient = new QueryClient({\n defaultOptions: defaultQueryOptions,\n mutationCache,\n });\n clientRef.current = queryClient;\n }\n\n return (\n <QueryClientProvider client={clientRef.current}>\n {children}\n </QueryClientProvider>\n );\n};\n"],"mappings":";;;;;;;;AAaA,MAAM,sBAAsC;CAC1C,SAAS;EACP,OAAO;EAEP,WAAW,KAAK;EAEhB,QAAQ,MAAS;EAEjB,gBAAgB;EAChB,sBAAsB;EACtB,oBAAoB;EACrB;CACD,WAAW,EACT,OAAO,GACR;CACF;AAeD,MAAM,mBAAmB,cAAsB,UAAU,MAAM,IAAI,CAAC,KAAK,IAAI;;;;AAK7E,MAAM,uBAAuB;CAC3B,MAAM,EAAE,UAAU,UAAU;CAE5B,MAAM,WAA+C,UAAe;AASlE,UARsB;AACpB,OAAI;AACF,QAAI,OAAO,UAAU,SAAU,QAAO,KAAK,MAAM,MAAM;AACvD,QAAI,iBAAiB,MAAO,QAAO,KAAK,MAAM,MAAM,QAAQ;YACrD,GAAG;AACZ,UAAO;MAGF,CAAC,CAAC,MAAM,CAAC,SAAS,QAAa;GAEpC,MAAM,WAAW,KAAK,SAAS;AAE/B,OAAI,UAAU,SAAS,uCAAuC;AAC5D,UAAM;KACJ,OAAO,SAAS;KAChB,SAAS;KACV,CAAC;AACF;;AAGF,SAAM;IACJ,OAAO,gBAGA,UAAU,SAAS,KAAK,SAAS,QACvC;IACD,aACE,UAAU,WACV,KAAK,WACL,OAAO,YAAY,oBAAoB;IACzC,SAAS;IACV,CAAC;IACF;;CAGJ,MAAM,aAAmD,SAAc;AACrE,MAAI,MAAM,MACR,OAAM;GACJ,OAAO,gBAAgB,KAAK,MAAM,SAAS,KAAK,MAAM,QAAQ,QAAQ;GACtE,aACE,KAAK,MAAM,WAAW,KAAK,MAAM,QAAQ;GAC3C,SAAS;GACV,CAAC;AAGJ,MAAI,MAAM,QACR,OAAM;GACJ,OAAO,KAAK;GACZ,aAAa,KAAK;GAClB,SAAS;GACV,CAAC;;AAIN,QAAO;EACL;EACA;EACD;;AAGH,MAAa,uBACX,IAAI,YAAY,EAAE,gBAAgB,qBAAqB,CAAC;AAE1D,MAAa,sBAA6C,EAAE,eAAe;CACzE,MAAM,EAAE,SAAS,cAAc,gBAAgB;CAC/C,MAAM,YAAY,OAAoB,KAAK;AAE3C,KAAI,CAAC,UAAU,SAAS;EAuBtB,MAAM,cAAc,IAAI,YAAY;GAClC,gBAAgB;GAChB,mBAxBwB,cAAc;IACtC;IACA;IACA,YAAY,OAAO,QAAQ,YAAY,UAAU,aAAa;AAC5D,SAAI,SAAS,MAAM,kBACjB,UAAS,KAAK,kBAAkB,SAAS,aAAa;AACpD,kBAAY,kBAAkB,EAC5B,UACD,CAAC;OACF;AAGJ,SAAI,SAAS,MAAM,aACjB,UAAS,KAAK,aAAa,SAAS,aAAa;AAC/C,kBAAY,aAAa,EACvB,UACD,CAAC;OACF;;IAGP,CAIc;GACd,CAAC;AACF,YAAU,UAAU;;AAGtB,QACE,oBAAC,qBAAD;EAAqB,QAAQ,UAAU;EACpC;EACmB"}
1
+ {"version":3,"file":"ReactQueryProvider.mjs","names":[],"sources":["../../../src/providers/ReactQueryProvider.tsx"],"sourcesContent":["'use client';\n\nimport { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister';\nimport {\n type DefaultOptions,\n MutationCache,\n QueryClient,\n QueryClientProvider,\n type QueryKey,\n type UseMutationOptions,\n} from '@tanstack/react-query';\nimport { PersistQueryClientProvider } from '@tanstack/react-query-persist-client';\nimport { type FC, type PropsWithChildren, useRef } from 'react';\nimport { useToast } from '../components/Toaster';\n\nconst PERSIST_MAX_AGE = 1000 * 60 * 60 * 24; // 24h\n// Bump to invalidate every persisted cache after a breaking change in query shapes\nconst PERSIST_BUSTER = 'v1';\n\nconst defaultQueryOptions: DefaultOptions = {\n queries: {\n retry: 1,\n // Keep data fresh for 30 seconds to avoid unnecessary refetches during navigation\n staleTime: 30 * 1000,\n // gcTime must be >= persist maxAge, otherwise restored entries are dropped on rehydrate\n gcTime: PERSIST_MAX_AGE,\n // Only refetch on mount if data is stale (not every single mount)\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n },\n mutations: {\n retry: 0,\n },\n};\n\nconst browserLocalStorage = {\n getItem: (key: string) => Promise.resolve(window.localStorage.getItem(key)),\n setItem: (key: string, value: string) =>\n Promise.resolve(window.localStorage.setItem(key, value)),\n removeItem: (key: string) =>\n Promise.resolve(window.localStorage.removeItem(key)),\n};\n\nconst noopStorage = {\n getItem: () => Promise.resolve(null),\n setItem: () => Promise.resolve(),\n removeItem: () => Promise.resolve(),\n};\n\nconst persister = createAsyncStoragePersister({\n storage: typeof window !== 'undefined' ? browserLocalStorage : noopStorage,\n key: 'intlayer-rq-cache',\n});\n\nconst SHOW_ERROR_CODE = false;\n\ndeclare module '@tanstack/react-query' {\n interface Register {\n mutationMeta: {\n onSuccess?: UseMutationOptions['onSuccess'];\n onError?: UseMutationOptions['onError'];\n invalidateQueries?: QueryKey[];\n resetQueries?: QueryKey[];\n };\n }\n}\n\nconst formatErrorCode = (errorCode: string) => errorCode.split('_').join(' ');\n\n/**\n * Hook to handle error logging and toast notifications\n */\nconst useToastEvents = () => {\n const { toast } = useToast();\n\n const onError: MutationCache['config']['onError'] = (error: any) => {\n const parsed = (() => {\n try {\n if (typeof error === 'string') return JSON.parse(error);\n if (error instanceof Error) return JSON.parse(error.message);\n } catch (_) {}\n return error;\n })();\n\n [parsed].flat().forEach((err: any) => {\n // Check for nested error object (standard in your API responses: { statusCode, error: { ... } })\n const apiError = err?.error ?? err;\n\n if (apiError?.code === 'RATE_LIMIT_EXCEEDED_UNAUTHENTICATED') {\n toast({\n title: apiError.message,\n variant: 'error',\n });\n return;\n }\n\n toast({\n title: formatErrorCode(\n SHOW_ERROR_CODE\n ? (apiError?.code ?? err?.code)\n : (apiError?.title ?? err?.title ?? 'Error')\n ),\n description:\n apiError?.message ??\n err?.message ??\n String(apiError ?? 'An error occurred'),\n variant: 'error',\n });\n });\n };\n\n const onSuccess: MutationCache['config']['onSuccess'] = (data: any) => {\n if (data?.error) {\n toast({\n title: formatErrorCode(data.error.title ?? data.error.code ?? 'Error'),\n description:\n data.error.message ?? data.error.code ?? 'An error occurred',\n variant: 'error',\n });\n }\n\n if (data?.message) {\n toast({\n title: data.message,\n description: data.description,\n variant: 'success',\n });\n }\n };\n\n return {\n onError,\n onSuccess,\n };\n};\n\nexport const getQueryClient = () =>\n new QueryClient({ defaultOptions: defaultQueryOptions });\n\ninterface ReactQueryProviderProps {\n client?: QueryClient;\n}\n\nexport const ReactQueryProvider: FC<\n PropsWithChildren<ReactQueryProviderProps>\n> = ({ children, client }) => {\n const { onError, onSuccess } = useToastEvents();\n // Keep handlers in a ref so the cache config (set once below) always calls\n // the latest closures from useToastEvents without needing re-wiring.\n const handlersRef = useRef({ onSuccess, onError });\n handlersRef.current = { onSuccess, onError };\n\n const clientRef = useRef<QueryClient>(client ?? null);\n\n if (!clientRef.current) {\n clientRef.current = new QueryClient({\n defaultOptions: defaultQueryOptions,\n mutationCache: new MutationCache(),\n });\n }\n\n // Wire toast handlers + meta-driven invalidation onto whatever client we\n // ended up with. Required even when the client is created externally (e.g.\n // via getQueryClient() in TanStack Router context), since the externally\n // created client ships with a bare MutationCache.\n const wiredRef = useRef(false);\n if (!wiredRef.current) {\n wiredRef.current = true;\n const cache = clientRef.current.getMutationCache();\n cache.config.onSuccess = (\n data,\n variables,\n onMutateResult,\n mutation,\n context\n ) =>\n handlersRef.current.onSuccess?.(\n data,\n variables,\n onMutateResult,\n mutation,\n context\n );\n cache.config.onError = (\n error,\n variables,\n onMutateResult,\n mutation,\n context\n ) =>\n handlersRef.current.onError?.(\n error,\n variables,\n onMutateResult,\n mutation,\n context\n );\n cache.config.onSettled = (\n _data,\n _error,\n _variables,\n _onMutateResult,\n mutation\n ) => {\n if (mutation.meta?.invalidateQueries) {\n mutation.meta.invalidateQueries.forEach((queryKey) => {\n clientRef.current?.invalidateQueries({ queryKey });\n });\n }\n\n if (mutation.meta?.resetQueries) {\n mutation.meta.resetQueries.forEach((queryKey) => {\n clientRef.current?.resetQueries({ queryKey });\n });\n }\n };\n }\n\n if (client) {\n return (\n <QueryClientProvider client={clientRef.current}>\n {children}\n </QueryClientProvider>\n );\n }\n\n return (\n <PersistQueryClientProvider\n client={clientRef.current}\n persistOptions={{\n persister,\n maxAge: PERSIST_MAX_AGE,\n buster: PERSIST_BUSTER,\n dehydrateOptions: {\n shouldDehydrateQuery: (query) => query.state.status === 'success',\n },\n }}\n >\n {children}\n </PersistQueryClientProvider>\n );\n};\n"],"mappings":";;;;;;;;;;AAeA,MAAM,kBAAkB,MAAO,KAAK,KAAK;AAEzC,MAAM,iBAAiB;AAEvB,MAAM,sBAAsC;CAC1C,SAAS;EACP,OAAO;EAEP,WAAW,KAAK;EAEhB,QAAQ;EAER,gBAAgB;EAChB,sBAAsB;EACtB,oBAAoB;EACrB;CACD,WAAW,EACT,OAAO,GACR;CACF;AAgBD,MAAM,YAAY,4BAA4B;CAC5C,SAAS,OAAO,WAAW,cAAc;EAdzC,UAAU,QAAgB,QAAQ,QAAQ,OAAO,aAAa,QAAQ,IAAI,CAAC;EAC3E,UAAU,KAAa,UACrB,QAAQ,QAAQ,OAAO,aAAa,QAAQ,KAAK,MAAM,CAAC;EAC1D,aAAa,QACX,QAAQ,QAAQ,OAAO,aAAa,WAAW,IAAI,CAAC;EAUM,GAAG;EAN/D,eAAe,QAAQ,QAAQ,KAAK;EACpC,eAAe,QAAQ,SAAS;EAChC,kBAAkB,QAAQ,SAAS;EAIuC;CAC1E,KAAK;CACN,CAAC;AAeF,MAAM,mBAAmB,cAAsB,UAAU,MAAM,IAAI,CAAC,KAAK,IAAI;;;;AAK7E,MAAM,uBAAuB;CAC3B,MAAM,EAAE,UAAU,UAAU;CAE5B,MAAM,WAA+C,UAAe;AASlE,UARsB;AACpB,OAAI;AACF,QAAI,OAAO,UAAU,SAAU,QAAO,KAAK,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BACA,UACA,YAEA,YAAY,QAAQ,YAClB,MACA,WACA,gBACA,UACA,QACD;AACH,QAAM,OAAO,WACX,OACA,WACA,gBACA,UACA,YAEA,YAAY,QAAQ,UAClB,OACA,WACA,gBACA,UACA,QACD;AACH,QAAM,OAAO,aACX,OACA,QACA,YACA,iBACA,aACG;AACH,OAAI,SAAS,MAAM,kBACjB,UAAS,KAAK,kBAAkB,SAAS,aAAa;AACpD,cAAU,SAAS,kBAAkB,EAAE,UAAU,CAAC;KAClD;AAGJ,OAAI,SAAS,MAAM,aACjB,UAAS,KAAK,aAAa,SAAS,aAAa;AAC/C,cAAU,SAAS,aAAa,EAAE,UAAU,CAAC;KAC7C;;;AAKR,KAAI,OACF,QACE,oBAAC,qBAAD;EAAqB,QAAQ,UAAU;EACpC;EACmB;AAI1B,QACE,oBAAC,4BAAD;EACE,QAAQ,UAAU;EAClB,gBAAgB;GACd;GACA,QAAQ;GACR,QAAQ;GACR,kBAAkB,EAChB,uBAAuB,UAAU,MAAM,MAAM,WAAW,WACzD;GACF;EAEA;EAC0B"}
@@ -45,7 +45,7 @@ declare enum BadgeSize {
45
45
  declare const badgeVariants: (props?: {
46
46
  color?: "text" | "error" | "custom" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark" | "success";
47
47
  variant?: "none" | "default" | "hoverable" | "outline";
48
- size?: "lg" | "md" | "sm";
48
+ size?: "sm" | "md" | "lg";
49
49
  } & _$class_variance_authority_types0.ClassProp) => string;
50
50
  /**
51
51
  * Badge component props interface
@@ -60,10 +60,10 @@ declare enum ButtonTextAlign {
60
60
  * Enhanced button variants with improved accessibility and focus states
61
61
  */
62
62
  declare const buttonVariants: (props?: {
63
- size?: "lg" | "md" | "sm" | "xl" | "icon-sm" | "icon-md" | "icon-lg" | "icon-xl";
63
+ size?: "sm" | "md" | "lg" | "xl" | "icon-sm" | "icon-md" | "icon-lg" | "icon-xl";
64
64
  color?: "text" | "error" | "custom" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark" | "text-inverse" | "success" | "card" | "current";
65
- roundedSize?: "lg" | "none" | "md" | "sm" | "xl" | "2xl" | "3xl" | "full" | "4xl" | "5xl";
66
- variant?: "none" | "default" | "input" | "invisible-link" | "hoverable" | "link" | "outline" | "fade";
65
+ roundedSize?: "sm" | "md" | "lg" | "xl" | "2xl" | "none" | "3xl" | "full" | "4xl" | "5xl";
66
+ variant?: "none" | "default" | "input" | "invisible-link" | "hoverable" | "outline" | "link" | "fade";
67
67
  textAlign?: "left" | "right" | "center";
68
68
  isFullWidth?: boolean;
69
69
  } & _$class_variance_authority_types0.ClassProp) => string;
@@ -6,7 +6,7 @@ import { VariantProps } from "class-variance-authority";
6
6
  declare const collapsibleTableVariants: (props?: {
7
7
  size?: "sm" | "md" | "lg" | "xl" | "full";
8
8
  variant?: "default" | "ghost" | "dark" | "outlined";
9
- spacing?: "none" | "sm" | "md" | "lg" | "auto";
9
+ spacing?: "sm" | "md" | "lg" | "none" | "auto";
10
10
  } & _$class_variance_authority_types0.ClassProp) => string;
11
11
  interface CollapsibleTableProps extends Omit<HTMLAttributes<HTMLElement>, 'title'>, VariantProps<typeof collapsibleTableVariants> {
12
12
  /** Table title displayed in the header */
@@ -29,7 +29,7 @@ declare const Command: {
29
29
  ref?: React.Ref<HTMLInputElement>;
30
30
  } & {
31
31
  asChild?: boolean;
32
- }, "key" | "asChild" | keyof _$react.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "type" | "value"> & {
32
+ }, "key" | keyof _$react.InputHTMLAttributes<HTMLInputElement> | "asChild">, "type" | "onChange" | "value"> & {
33
33
  value?: string;
34
34
  onValueChange?: (search: string) => void;
35
35
  } & _$react.RefAttributes<HTMLInputElement>>;
@@ -8,14 +8,14 @@ import { VariantProps } from "class-variance-authority";
8
8
  * Provides flexible styling options for background, padding, borders, and layout
9
9
  */
10
10
  declare const containerVariants: (props?: {
11
- roundedSize?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "full";
12
- transparency?: "none" | "sm" | "md" | "lg" | "xl" | "full" | "xs";
13
- padding?: "none" | "sm" | "md" | "lg" | "xl" | "2xl";
14
- separator?: "without" | "x" | "y" | "both";
11
+ roundedSize?: "sm" | "md" | "lg" | "xl" | "2xl" | "none" | "3xl" | "full" | "4xl";
12
+ transparency?: "xs" | "sm" | "md" | "lg" | "xl" | "none" | "full";
13
+ padding?: "sm" | "md" | "lg" | "xl" | "2xl" | "none";
14
+ separator?: "both" | "without" | "x" | "y";
15
15
  border?: "none" | "with";
16
- borderColor?: "primary" | "secondary" | "neutral" | "card" | "text" | "error" | "warning" | "success";
16
+ borderColor?: "error" | "success" | "text" | "primary" | "secondary" | "neutral" | "card" | "warning";
17
17
  background?: "none" | "with" | "hoverable";
18
- gap?: "none" | "sm" | "md" | "lg" | "xl" | "2xl";
18
+ gap?: "sm" | "md" | "lg" | "xl" | "2xl" | "none";
19
19
  } & _$class_variance_authority_types0.ClassProp) => string;
20
20
  /** Available rounded corner sizes for the container */
21
21
  declare enum ContainerRoundedSize {
@@ -1,5 +1,5 @@
1
1
  import { CodeFormat, ContentDeclarationFormat, PackageManager } from "./CodeContext.js";
2
- import { FC, HTMLAttributes } from "react";
2
+ import { FC, HTMLAttributes, ReactNode } from "react";
3
3
  import { BundledLanguage } from "shiki/bundle/web";
4
4
 
5
5
  //#region src/components/IDE/Code.d.ts
@@ -10,7 +10,7 @@ type CodeCompAttributes = {
10
10
  contentDeclarationFormat?: ContentDeclarationFormat | string | string[];
11
11
  };
12
12
  type CodeCompProps = {
13
- children: string;
13
+ children: ReactNode;
14
14
  fileName?: string;
15
15
  language: BundledLanguage;
16
16
  isDarkMode?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Code.d.ts","names":[],"sources":["../../../../src/components/IDE/Code.tsx"],"mappings":";;;;;KAsBY,kBAAA;EACV,QAAA;EACA,cAAA,GAAiB,cAAA,EAFW;EAI5B,UAAA,GAAa,UAAA;EACb,wBAAA,GAA2B,wBAAA;AAAA;AAAA,KAGxB,aAAA;EACH,QAAA;EACA,QAAA;EACA,QAAA,EAAU,eAAA;EACV,UAAA;EACA,UAAA;EACA,eAAA;EACA,UAAA;AAAA,IACE,kBAAA,GACF,cAAA,CAAe,cAAA;AAAA,cAwBJ,IAAA,EAAM,EAAA,CAAG,aAAA"}
1
+ {"version":3,"file":"Code.d.ts","names":[],"sources":["../../../../src/components/IDE/Code.tsx"],"mappings":";;;;;KAsBY,kBAAA;EACV,QAAA;EACA,cAAA,GAAiB,cAAA,EAFW;EAI5B,UAAA,GAAa,UAAA;EACb,wBAAA,GAA2B,wBAAA;AAAA;AAAA,KAGxB,aAAA;EACH,QAAA,EAAU,SAAA;EACV,QAAA;EACA,QAAA,EAAU,eAAA;EACV,UAAA;EACA,UAAA;EACA,eAAA;EACA,UAAA;AAAA,IACE,kBAAA,GACF,cAAA,CAAe,cAAA;AAAA,cAwBJ,IAAA,EAAM,EAAA,CAAG,aAAA"}
@@ -1,12 +1,12 @@
1
- import { FC, HTMLAttributes } from "react";
1
+ import { FC, HTMLAttributes, ReactNode } from "react";
2
2
  import { BundledLanguage, BundledLanguage as CodeLanguage } from "shiki/bundle/web";
3
3
 
4
4
  //#region src/components/IDE/CodeBlockClient.d.ts
5
5
  declare const CodeDefault: FC<{
6
- children: string;
6
+ children: ReactNode;
7
7
  }>;
8
8
  type CodeBlockProps = {
9
- children: string;
9
+ children: React.ReactNode;
10
10
  lang: BundledLanguage;
11
11
  isDarkMode?: boolean;
12
12
  isEditable?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlockClient.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockClient.tsx"],"mappings":";;;;cAMa,WAAA,EAAa,EAAA;EAAK,QAAA;AAAA;AAAA,KA0BnB,cAAA;EACV,QAAA;EACA,IAAA,EAAM,eAAA;EACN,UAAA;EACA,UAAA;EACA,QAAA,IAAY,OAAA;AAAA,IACV,IAAA,CAAK,cAAA,CAAe,cAAA;AAAA,cAEX,SAAA,EAAW,EAAA,CAAG,cAAA"}
1
+ {"version":3,"file":"CodeBlockClient.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockClient.tsx"],"mappings":";;;;cAYa,WAAA,EAAa,EAAA;EAAK,QAAA,EAAU,SAAA;AAAA;AAAA,KA0B7B,cAAA;EACV,QAAA,EAAU,KAAA,CAAM,SAAA;EAChB,IAAA,EAAM,eAAA;EACN,UAAA;EACA,UAAA;EACA,QAAA,IAAY,OAAA;AAAA,IACV,IAAA,CAAK,cAAA,CAAe,cAAA;AAAA,cAEX,SAAA,EAAW,EAAA,CAAG,cAAA"}
@@ -1,10 +1,11 @@
1
1
  import { CodeFormat } from "./CodeContext.js";
2
+ import { ReactNode } from "react";
2
3
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
4
  import { BundledLanguage } from "shiki/bundle/web";
4
5
 
5
6
  //#region src/components/IDE/CodeBlockHighlight.d.ts
6
7
  type Props = {
7
- /** Raw TypeScript source code (the canonical "source of truth"). */children: string; /** Language of the source (e.g. 'tsx', 'typescript'). */
8
+ /** Raw TypeScript source code (the canonical "source of truth"). */children: ReactNode; /** Language of the source (e.g. 'tsx', 'typescript'). */
8
9
  originalLang: BundledLanguage; /** Currently selected format: 'typescript' | 'esm' | 'commonjs'. */
9
10
  targetFormat: Exclude<CodeFormat, 'json'>;
10
11
  isDarkMode?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlockHighlight.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockHighlight.tsx"],"mappings":";;;;;KAcK,KAAA;sEAEH,QAAA,UAFG;EAIH,YAAA,EAAc,eAAA;EAEd,YAAA,EAAc,OAAA,CAAQ,UAAA;EACtB,UAAA;AAAA;AAAA,cAmBW,kBAAA;EAAsB,QAAA;EAAA,YAAA;EAAA,YAAA;EAAA;AAAA,GAKhC,KAAA,KAAK,oBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"CodeBlockHighlight.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockHighlight.tsx"],"mappings":";;;;;;KAcK,KAAA;EAMmB,oEAJtB,QAAA,EAAU,SAAA,EAIW;EAFrB,YAAA,EAAc,eAAA,EAFd;EAIA,YAAA,EAAc,OAAA,CAAQ,UAAA;EACtB,UAAA;AAAA;AAAA,cAmBW,kBAAA;EAAsB,QAAA;EAAA,YAAA;EAAA,YAAA;EAAA;AAAA,GAKhC,KAAA,KAAK,oBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -1,9 +1,9 @@
1
- import { FC } from "react";
1
+ import { FC, ReactNode } from "react";
2
2
  import { BundledLanguage } from "shiki/bundle/web";
3
3
 
4
4
  //#region src/components/IDE/CodeBlockShiki.d.ts
5
5
  type CodeBlockShikiProps = {
6
- children: string;
6
+ children: ReactNode;
7
7
  lang: BundledLanguage;
8
8
  isDarkMode?: boolean;
9
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlockShiki.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockShiki.tsx"],"mappings":";;;;KA0JY,mBAAA;EACV,QAAA;EACA,IAAA,EAAM,eAAA;EACN,UAAA;AAAA;AAAA,cAGW,cAAA,EAAgB,EAAA,CAAG,mBAAA"}
1
+ {"version":3,"file":"CodeBlockShiki.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockShiki.tsx"],"mappings":";;;;KAyJY,mBAAA;EACV,QAAA,EAAU,SAAA;EACV,IAAA,EAAM,eAAA;EACN,UAAA;AAAA;AAAA,cAGW,cAAA,EAAgB,EAAA,CAAG,mBAAA"}
@@ -5,9 +5,9 @@ import { VariantProps } from "class-variance-authority";
5
5
  //#region src/components/Input/Checkbox.d.ts
6
6
  declare const checkboxVariants: (props?: {
7
7
  variant?: "default";
8
- size?: "sm" | "md" | "lg" | "xs";
9
- color?: "primary" | "secondary" | "neutral" | "text" | "error" | "success" | "destructive" | "custom" | "dark" | "light";
10
- validationStyleEnabled?: "disabled" | "enabled";
8
+ size?: "xs" | "sm" | "md" | "lg";
9
+ color?: "error" | "success" | "text" | "custom" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark";
10
+ validationStyleEnabled?: "enabled" | "disabled";
11
11
  } & _$class_variance_authority_types0.ClassProp) => string;
12
12
  declare enum CheckboxSize {
13
13
  XS = "xs",
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","names":[],"sources":["../../../../src/components/Input/Checkbox.tsx"],"mappings":";;;;;cASa,gBAAA,GAAgB,KAAA;;;;;IA0D5B,iCAAA,CAAA,SAAA;AAAA,aAEW,YAAA;EACV,EAAA;EACA,EAAA;EACA,EAAA;EACA,EAAA;AAAA;AAAA,aAGU,aAAA;EACV,OAAA;EACA,SAAA;EACA,WAAA;EACA,OAAA;EACA,KAAA;EACA,IAAA;EACA,IAAA;EACA,KAAA;EACA,OAAA;EACA,MAAA;AAAA;AAAA,KAGU,aAAA,GAAgB,IAAA,CAC1B,iBAAA,CAAkB,mBAAA,CAAoB,gBAAA,GAAmB,gBAAA;EAGzD,IAAA;EACA,sBAAA;EACA,KAAA,GAAQ,SAAA;AAAA,IACN,IAAA,CACA,YAAA,QAAoB,gBAAA;EAGpB,IAAA,GAAO,YAAA,MAAkB,YAAA;EACzB,KAAA,GAAQ,aAAA,MAAmB,aAAA;EAC3B,cAAA;AAAA;AAAA,cA6BS,QAAA,EAAU,EAAA,CAAG,aAAA"}
1
+ {"version":3,"file":"Checkbox.d.ts","names":[],"sources":["../../../../src/components/Input/Checkbox.tsx"],"mappings":";;;;;cASa,gBAAA,GAAgB,KAAA;;;;;IAkE5B,iCAAA,CAAA,SAAA;AAAA,aAEW,YAAA;EACV,EAAA;EACA,EAAA;EACA,EAAA;EACA,EAAA;AAAA;AAAA,aAGU,aAAA;EACV,OAAA;EACA,SAAA;EACA,WAAA;EACA,OAAA;EACA,KAAA;EACA,IAAA;EACA,IAAA;EACA,KAAA;EACA,OAAA;EACA,MAAA;AAAA;AAAA,KAGU,aAAA,GAAgB,IAAA,CAC1B,iBAAA,CAAkB,mBAAA,CAAoB,gBAAA,GAAmB,gBAAA;EAGzD,IAAA;EACA,sBAAA;EACA,KAAA,GAAQ,SAAA;AAAA,IACN,IAAA,CACA,YAAA,QAAoB,gBAAA;EAGpB,IAAA,GAAO,YAAA,MAAkB,YAAA;EACzB,KAAA,GAAQ,aAAA,MAAmB,aAAA;EAC3B,cAAA;AAAA;AAAA,cA6BS,QAAA,EAAU,EAAA,CAAG,aAAA"}
@@ -6,7 +6,7 @@ import { VariantProps } from "class-variance-authority";
6
6
  declare const inputVariants: (props?: {
7
7
  variant?: "default" | "invisible";
8
8
  size?: "sm" | "md" | "lg";
9
- validationStyleEnabled?: "disabled" | "enabled";
9
+ validationStyleEnabled?: "enabled" | "disabled";
10
10
  } & _$class_variance_authority_types0.ClassProp) => string;
11
11
  declare enum InputVariant {
12
12
  DEFAULT = "default",
@@ -54,9 +54,9 @@ declare enum LinkUnderlined {
54
54
  }
55
55
  declare const linkVariants: (props?: {
56
56
  variant?: "default" | "invisible-link" | "button" | "button-outlined" | "hoverable";
57
- roundedSize?: "lg" | "none" | "md" | "sm" | "xl" | "2xl" | "3xl" | "full";
57
+ roundedSize?: "sm" | "md" | "lg" | "xl" | "2xl" | "none" | "3xl" | "full";
58
58
  color?: "text" | "error" | "custom" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark" | "text-inverse" | "success";
59
- size?: "lg" | "md" | "custom" | "sm" | "xl";
59
+ size?: "sm" | "md" | "lg" | "xl" | "custom";
60
60
  underlined?: boolean | LinkUnderlined.DEFAULT;
61
61
  } & _$class_variance_authority_types0.ClassProp) => string;
62
62
  type LinkProps = DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> & VariantProps<typeof linkVariants> & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/components/Navbar/index.tsx"],"mappings":";;;;;;;;;;;;KAaK,WAAA,WAAsB,oBAAA;uDAEzB,IAAA,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AA,iBAAA;EAAA,oBAAA;EAAA,oBAAA;EAAA,iBAAA;EAAA,gBAAA;EAAA,cAAA;EAAA;AAAA,GAWpD,WAAA,CAAY,CAAA,MAAE,oBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -5,7 +5,7 @@ import { VariantProps } from "class-variance-authority";
5
5
  //#region src/components/Pagination/Pagination.d.ts
6
6
  declare const paginationVariants: (props?: {
7
7
  size?: "sm" | "md" | "lg";
8
- color?: "primary" | "secondary" | "neutral" | "text" | "destructive";
8
+ color?: "text" | "primary" | "secondary" | "destructive" | "neutral";
9
9
  variant?: "default" | "bordered" | "ghost";
10
10
  } & _$class_variance_authority_types0.ClassProp) => string;
11
11
  declare enum PaginationSize {
@@ -0,0 +1,56 @@
1
+ import { HTMLAttributes, ReactNode } from "react";
2
+ import * as _$class_variance_authority_types0 from "class-variance-authority/types";
3
+ import { VariantProps } from "class-variance-authority";
4
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
5
+
6
+ //#region src/components/SwitchSelector/SwitchSelector.d.ts
7
+ type SwitchSelectorChoice<T = boolean> = {
8
+ content: ReactNode;
9
+ value: T;
10
+ } & HTMLAttributes<HTMLButtonElement>;
11
+ type SwitchSelectorChoices<T> = SwitchSelectorChoice<T>[];
12
+ declare const defaultChoices: SwitchSelectorChoices<boolean>;
13
+ declare enum SwitchSelectorColor {
14
+ PRIMARY = "primary",
15
+ SECONDARY = "secondary",
16
+ DESTRUCTIVE = "destructive",
17
+ NEUTRAL = "neutral",
18
+ LIGHT = "light",
19
+ DARK = "dark",
20
+ TEXT = "text"
21
+ }
22
+ declare enum SwitchSelectorSize {
23
+ SM = "sm",
24
+ MD = "md",
25
+ LG = "lg"
26
+ }
27
+ type SwitchSelectorBaseProps<T = boolean> = {
28
+ choices?: SwitchSelectorChoices<T>;
29
+ value?: T;
30
+ defaultValue?: T;
31
+ onChange?: (choice: T) => void;
32
+ className?: string;
33
+ itemClassName?: string;
34
+ hoverable?: boolean;
35
+ disabled?: boolean;
36
+ [key: string]: any;
37
+ };
38
+ type SwitchSelectorProps<T = boolean> = SwitchSelectorBaseProps<T> & VariantProps<typeof switchSelectorVariant> & VariantProps<typeof choiceVariant>;
39
+ declare const switchSelectorVariant: (props?: {
40
+ color?: "text" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark";
41
+ disabled?: boolean;
42
+ } & _$class_variance_authority_types0.ClassProp) => string;
43
+ declare const choiceVariant: (props?: {
44
+ size?: "sm" | "md" | "lg";
45
+ } & _$class_variance_authority_types0.ClassProp) => string;
46
+ declare const indicatorVariant: (props?: {
47
+ color?: "text" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark";
48
+ } & _$class_variance_authority_types0.ClassProp) => string;
49
+ /**
50
+ * Component that allows the user to select one of the provided choices.
51
+ * This component is horizontal.
52
+ */
53
+ declare const SwitchSelector: <T>(props: SwitchSelectorProps<T>) => _$react_jsx_runtime0.JSX.Element;
54
+ //#endregion
55
+ export { SwitchSelector, SwitchSelectorBaseProps, SwitchSelectorChoice, SwitchSelectorChoices, SwitchSelectorColor, SwitchSelectorProps, SwitchSelectorSize, choiceVariant, defaultChoices, indicatorVariant, switchSelectorVariant };
56
+ //# sourceMappingURL=SwitchSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwitchSelector.d.ts","names":[],"sources":["../../../../src/components/SwitchSelector/SwitchSelector.tsx"],"mappings":";;;;;;KAOY,oBAAA;EACV,OAAA,EAAS,SAAA;EACT,KAAA,EAAO,CAAA;AAAA,IACL,cAAA,CAAe,iBAAA;AAAA,KACP,qBAAA,MAA2B,oBAAA,CAAqB,CAAA;AAAA,cAE/C,cAAA,EAAgB,qBAAA;AAAA,aAKjB,mBAAA;EACV,OAAA;EACA,SAAA;EACA,WAAA;EACA,OAAA;EACA,KAAA;EACA,IAAA;EACA,IAAA;AAAA;AAAA,aAGU,kBAAA;EACV,EAAA;EACA,EAAA;EACA,EAAA;AAAA;AAAA,KAGU,uBAAA;EACV,OAAA,GAAU,qBAAA,CAAsB,CAAA;EAChC,KAAA,GAAQ,CAAA;EACR,YAAA,GAAe,CAAA;EACf,QAAA,IAAY,MAAA,EAAQ,CAAA;EACpB,SAAA;EACA,aAAA;EACA,SAAA;EACA,QAAA;EAAA,CACC,GAAA;AAAA;AAAA,KAGS,mBAAA,gBAAmC,uBAAA,CAAwB,CAAA,IACrE,YAAA,QAAoB,qBAAA,IACpB,YAAA,QAAoB,aAAA;AAAA,cAET,qBAAA,GAAqB,KAAA;;;IAwBjC,iCAAA,CAAA,SAAA;AAAA,cAEY,aAAA,GAAa,KAAA;;IAczB,iCAAA,CAAA,SAAA;AAAA,cAEY,gBAAA,GAAgB,KAAA;;IAsB5B,iCAAA,CAAA,SAAA;;;;;cAMY,cAAA,MAAsB,KAAA,EAAO,mBAAA,CAAoB,CAAA,MAAE,oBAAA,CAAA,GAAA,CAAA,OAAA"}