{"version":3,"file":"PromoCardContext.mjs","sources":["../../src/promoCard/PromoCardContext.tsx"],"sourcesContent":["import React, { useContext, createContext } from 'react';\n\n/**\n * The type of the PromoCard context object.\n *\n * The context object contains the current state of the PromoCard group, whether\n * the group is disabled or not, and a function to call when the group value\n * changes. This value is used to provide context to child PromoCard components,\n * allowing them to interact with the group and update its state.\n */\ninterface PromoCardContextType {\n  /**\n   * The current value of the PromoCard group.\n   *\n   * @default ''\n   */\n  state: string;\n  /**\n   * Whether the PromoCard group is disabled or not.\n   *\n   * @default false\n   */\n  isDisabled: boolean;\n  /**\n   * A function to call when the PromoCard group value changes.\n   *\n   * @param {string} value - The new value of the PromoCard group.\n   * @default () => {}\n   */\n  onChange: (value: string) => void;\n}\n\nconst defaultPromoCardContext: PromoCardContextType = {\n  state: '',\n  isDisabled: false,\n  onChange: () => {},\n};\n\n/**\n * The PromoCard context object.\n */\nexport const PromoCardContext = createContext<PromoCardContextType>(defaultPromoCardContext);\n\n/**\n * A custom hook for accessing the PromoCard context object.\n *\n * The `usePromoCardContext` hook is used to access the PromoCard context object\n * from within a child PromoCard component. It throws an error if the context\n * object is not available, which can help with debugging and development.\n *\n * @returns {PromoCardContextType} - The PromoCard context object.\n */\nexport const usePromoCardContext = (): PromoCardContextType => {\n  return useContext(PromoCardContext);\n};\n\nexport default PromoCardContext;\n"],"names":["defaultPromoCardContext","state","isDisabled","onChange","PromoCardContext","createContext","usePromoCardContext","useContext"],"mappings":";;AAgCA,MAAMA,uBAAuB,GAAyB;AACpDC,EAAAA,KAAK,EAAE,EAAE;AACTC,EAAAA,UAAU,EAAE,KAAK;EACjBC,QAAQ,EAAEA,MAAK,CAAE;CAClB;AAED;;AAEG;MACUC,gBAAgB,gBAAGC,aAAa,CAAuBL,uBAAuB;AAE3F;;;;;;;;AAQG;AACI,MAAMM,mBAAmB,GAAGA,MAA2B;EAC5D,OAAOC,UAAU,CAACH,gBAAgB,CAAC;AACrC;;;;"}