@rdsaude/pulso-react-components
Version:
Biblioteca de componentes React do Pulso Design System da RD Saúde oferece componentes consistentes e de alto desempenho, alinhados com os padrões da RDSaúde. Ideal para desenvolver aplicações modernas e acessíveis.
1 lines • 4.14 kB
Source Map (JSON)
{"version":3,"sources":["../../../src/components/refresh/index.ts","../../../src/hooks/use-theme.ts","../../../src/components/theme-provider/theme-provider.tsx","../../../src/components/refresh/utils/get-refresh-color.ts","../../../src/components/refresh/refresh.tsx"],"sourcesContent":["export { Refresh } from './refresh'\nexport type { TRefreshProps } from './refresh.types'\n","import {\n DROGASIL_TOKENS,\n GLOBALS_TOKENS,\n PRIME_TOKENS,\n RAIA_TOKENS,\n RDSAUDESISTEMAS_TOKENS,\n SUBSCRIPTION_TOKENS,\n} from '@raiadrogasil/pulso-design-tokens'\n\nimport { useContext } from 'react'\n\nimport { ThemeContext } from '~/components/theme-provider/theme-provider'\n\nexport function useTheme() {\n const { currentTheme } = useContext(ThemeContext)\n\n const themes = {\n rdsaudesistemas: RDSAUDESISTEMAS_TOKENS,\n drogasil: DROGASIL_TOKENS,\n raia: RAIA_TOKENS,\n subscription: SUBSCRIPTION_TOKENS,\n prime: PRIME_TOKENS,\n }\n\n return {\n ...themes[currentTheme],\n ...GLOBALS_TOKENS,\n }\n}\n","import { createContext, useEffect } from 'react'\n\nimport type { Themes } from '@raiadrogasil/pulso-design-tokens'\n\ntype TThemeContextData = {\n currentTheme: Themes\n}\n\ninterface IThemeProviderProps {\n children: React.ReactNode\n theme: Themes\n}\n\nexport const ThemeContext = createContext({} as TThemeContextData)\n\nexport function ThemeProvider({ children, theme }: IThemeProviderProps) {\n useEffect(() => {\n if (theme && document) {\n document?.documentElement?.classList?.add(theme)\n }\n\n return () => {\n document?.documentElement?.classList?.remove(theme)\n }\n }, [theme])\n\n return (\n <ThemeContext.Provider\n value={{\n currentTheme: theme,\n }}\n >\n {children}\n </ThemeContext.Provider>\n )\n}\n","import { useTheme } from '~/hooks/use-theme'\n\nimport type { TRefreshColor } from '../refresh.types'\n\nexport function getRefreshColor(color: TRefreshColor) {\n const theme = useTheme()\n\n const colors = {\n brand: theme.colorActionFillBrandPrimaryEnabled,\n neutral: theme.colorTextNeutralReadonly,\n black: theme.colorTextNeutralDefault,\n white: theme.colorTextNeutralInverse,\n } as Record<TRefreshColor, string>\n\n return colors[color]\n}\n","import type { TRefreshProps } from './refresh.types'\n\nimport { getRefreshColor } from './utils/get-refresh-color'\n\nexport function Refresh({ color = 'brand', srText }: TRefreshProps) {\n return (\n <div\n role=\"status\"\n className=\"grid size-eightpulse place-items-center\"\n aria-label={srText}\n >\n <svg className=\"size-sixpulse animate-spin fill-none\" viewBox=\"0 0 24 24\">\n <path\n fillRule=\"evenodd\"\n d=\"M0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0v2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12H0z\"\n clipRule=\"evenodd\"\n fill={getRefreshColor(color)}\n />\n\n <title>{srText}</title>\n </svg>\n </div>\n )\n}\n\nexport type { TRefreshProps }\n"],"mappings":"4rBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAOO,6CAEPC,EAA2B,iBCT3B,IAAAC,EAAyC,iBA2BrCC,EAAA,6BAdSC,KAAe,iBAAc,CAAC,CAAsB,EDA1D,SAASC,GAAW,CACzB,GAAM,CAAE,aAAAC,CAAa,KAAI,cAAWC,CAAY,EAUhD,OAAOC,IAAA,GARQ,CACb,gBAAiB,yBACjB,SAAU,kBACV,KAAM,cACN,aAAc,sBACd,MAAO,cACT,EAGYF,CAAY,GACnB,iBAEP,CExBO,SAASG,EAAgBC,EAAsB,CACpD,IAAMC,EAAQC,EAAS,EASvB,MAPe,CACb,MAAOD,EAAM,mCACb,QAASA,EAAM,yBACf,MAAOA,EAAM,wBACb,MAAOA,EAAM,uBACf,EAEcD,CAAK,CACrB,CCJM,IAAAG,EAAA,6BAPC,SAASC,EAAQ,CAAE,MAAAC,EAAQ,QAAS,OAAAC,CAAO,EAAkB,CAClE,SACE,OAAC,OACC,KAAK,SACL,UAAU,0CACV,aAAYA,EAEZ,oBAAC,OAAI,UAAU,uCAAuC,QAAQ,YAC5D,oBAAC,QACC,SAAS,UACT,EAAE,sHACF,SAAS,UACT,KAAMC,EAAgBF,CAAK,EAC7B,KAEA,OAAC,SAAO,SAAAC,EAAO,GACjB,EACF,CAEJ","names":["refresh_exports","__export","Refresh","__toCommonJS","import_pulso_design_tokens","import_react","import_react","import_jsx_runtime","ThemeContext","useTheme","currentTheme","ThemeContext","__spreadValues","getRefreshColor","color","theme","useTheme","import_jsx_runtime","Refresh","color","srText","getRefreshColor"]}