{"version":3,"file":"mantine-adapter.cjs","sources":["../src/components/Accordion/Accordion.tsx","../src/components/ThemeProvider/ThemeProvider.tsx","../src/utils/copyToClipboard.ts"],"sourcesContent":["import {\n  Accordion as MantineAccordion,\n  type AccordionProps as MantineAccordionProps,\n} from \"@mantine/core\";\nimport * as styles from \"./Accordion.css\";\n\n// interface FigmaVariantProps {\n//   Open?: boolean;\n//   Divider?: boolean;\n//   Title?: string;\n// }\n\nexport type AccordionProps = MantineAccordionProps;\n\nconst AccordionWrapper = (props: AccordionProps) => {\n  return (\n    <MantineAccordion\n      {...props}\n      classNames={{\n        ...styles,\n        ...props.classNames,\n      }}\n    />\n  );\n};\n\n// Define the type for our Accordion component with sub-components\ntype AccordionComponent = typeof AccordionWrapper & {\n  Item: typeof MantineAccordion.Item;\n  Control: typeof MantineAccordion.Control;\n  Panel: typeof MantineAccordion.Panel;\n};\n\n// Export the main Accordion component with dot notation\nexport const Accordion: AccordionComponent = Object.assign(AccordionWrapper, {\n  Item: MantineAccordion.Item,\n  Control: MantineAccordion.Control,\n  Panel: MantineAccordion.Panel,\n});\n","import { useEffect } from \"react\";\n\ninterface ThemeProviderProps {\n  currentTheme?: string;\n  children: React.ReactNode;\n}\n\nconst THEME_DATA_ATTRIBUTE = \"data-current-theme\";\n\nexport function ThemeProvider({ children, currentTheme }: ThemeProviderProps) {\n  useEffect(() => {\n    if (!currentTheme) return;\n\n    const root = document.documentElement;\n\n    // Get the previously applied theme class from data attribute\n    const previousTheme = root.getAttribute(THEME_DATA_ATTRIBUTE);\n\n    // Remove the previous theme class if it exists\n    if (previousTheme) {\n      root.classList.remove(previousTheme);\n    }\n\n    // Apply the new theme class\n    root.classList.add(currentTheme);\n\n    // Store the current theme class in the data attribute\n    root.setAttribute(THEME_DATA_ATTRIBUTE, currentTheme);\n\n    // Cleanup: remove current theme class and data attribute when component unmounts\n    return () => {\n      root.classList.remove(currentTheme);\n      root.removeAttribute(THEME_DATA_ATTRIBUTE);\n    };\n  }, [currentTheme]);\n\n  return <>{children}</>;\n}\n","import React from \"react\";\n\n/**\n * Helper function for copy text to clipboard\n * @param {string} textToCopy The text string for copying to the clipboard\n * @param {element|node} componentRef The ref of the component that we want to trigger the copy\n */\nconst copyToClipboard = (\n  textToCopy: string,\n  componentRef: React.RefObject<HTMLElement | null>,\n): Promise<void> => {\n  const currentFocus = document.activeElement as HTMLInputElement;\n  return new Promise((resolve, reject) => {\n    if (componentRef && componentRef.current) {\n      const textArea = document.createElement(\"textarea\");\n      textArea.readOnly = true;\n      textArea.defaultValue = textToCopy;\n      componentRef.current.appendChild(textArea);\n      textArea.select();\n      const wasCopied = document.execCommand(\"copy\");\n      componentRef.current.removeChild(textArea);\n      if (currentFocus) {\n        currentFocus.focus();\n      }\n      if (wasCopied) {\n        resolve();\n      } else {\n        reject(new Error(\"Failed to copy\"));\n      }\n    } else {\n      reject(new Error(\"Copy area reference is not defined\"));\n    }\n  });\n};\n\nexport { copyToClipboard };\n"],"names":["_jsx","MantineAccordion","useEffect","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;AAcA,MAAM,gBAAgB,GAAG,CAAC,KAAqB,KAAI;AACjD,IAAA,QACEA,cAAA,CAACC,cAAgB,OACX,KAAK,EACT,UAAU,EAAE;AACV,YAAA,GAAG,MAAM;YACT,GAAG,KAAK,CAAC,UAAU;AACpB,SAAA,EAAA,CACD;AAEN,CAAC;AASD;MACa,SAAS,GAAuB,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;IAC3E,IAAI,EAAEA,cAAgB,CAAC,IAAI;IAC3B,OAAO,EAAEA,cAAgB,CAAC,OAAO;IACjC,KAAK,EAAEA,cAAgB,CAAC,KAAK;AAC9B,CAAA;;AC/BD,MAAM,oBAAoB,GAAG,oBAAoB;SAEjC,aAAa,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAsB,EAAA;IAC1EC,eAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,YAAY;YAAE;AAEnB,QAAA,MAAM,IAAI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