@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.59 kB
Source Map (JSON)
{"version":3,"sources":["../../../src/components/icon/index.ts","../../../src/hooks/use-theme.ts","../../../src/components/theme-provider/theme-provider.tsx","../../../src/components/icon/utils/get-icon-color.ts","../../../src/components/icon/utils/get-icon-size.ts","../../../src/components/icon/icon.tsx"],"sourcesContent":["export { Icon } from './icon'\nexport type { TIconProps } from './icon.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 type { TIconColors } from '../icon.types'\n\nimport { useTheme } from '~/hooks/use-theme'\n\nexport function getColorIcon(color: keyof TIconColors) {\n const theme = useTheme()\n const allTokens = Object.keys(theme)\n\n const colorTokens = allTokens.reduce((acc, tokenKey) => {\n if (tokenKey.includes('color')) {\n const colorToken = tokenKey as keyof TIconColors\n acc[colorToken] = theme[colorToken]\n }\n\n return acc\n }, {} as TIconColors)\n\n return colorTokens[color]\n}\n","export const getIconSize = {\n tiny: 'var(--sizing-tiny)',\n 'extra-small': 'var(--sizing-extrasmall)',\n small: 'var(--sizing-small)',\n medium: 'var(--sizing-medium)',\n}\n","import type { TIconProps } from './icon.types'\n\nimport { getColorIcon } from './utils/get-icon-color'\nimport { getIconSize } from './utils/get-icon-size'\n\nexport function Icon({\n symbol = 'rdicon-default',\n size = 'small',\n color = 'colorActionFillBrandPrimaryEnabled',\n ...props\n}: TIconProps) {\n const symbolName = symbol.replace('rdicon', '').trim()\n\n return (\n <i\n {...props}\n title={symbolName}\n className={symbol}\n style={{\n fontSize: getIconSize[size],\n color: getColorIcon(color),\n }}\n />\n )\n}\n\nexport type { TIconProps }\n"],"mappings":"s6BAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,UAAAE,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,EAAaC,EAA0B,CACrD,IAAMC,EAAQC,EAAS,EAYvB,OAXkB,OAAO,KAAKD,CAAK,EAEL,OAAO,CAACE,EAAKC,IAAa,CACtD,GAAIA,EAAS,SAAS,OAAO,EAAG,CAC9B,IAAMC,EAAaD,EACnBD,EAAIE,CAAU,EAAIJ,EAAMI,CAAU,CACpC,CAEA,OAAOF,CACT,EAAG,CAAC,CAAgB,EAEDH,CAAK,CAC1B,CClBO,IAAMM,EAAc,CACzB,KAAM,qBACN,cAAe,2BACf,MAAO,sBACP,OAAQ,sBACV,ECSI,IAAAC,EAAA,6BATG,SAASC,EAAKC,EAKN,CALM,IAAAC,EAAAD,EACnB,QAAAE,EAAS,iBACT,KAAAC,EAAO,QACP,MAAAC,EAAQ,oCARV,EAKqBH,EAIhBI,EAAAC,EAJgBL,EAIhB,CAHH,SACA,OACA,UAGA,IAAMM,EAAaL,EAAO,QAAQ,SAAU,EAAE,EAAE,KAAK,EAErD,SACE,OAAC,IAAAM,EAAAC,EAAA,GACKJ,GADL,CAEC,MAAOE,EACP,UAAWL,EACX,MAAO,CACL,SAAUQ,EAAYP,CAAI,EAC1B,MAAOQ,EAAaP,CAAK,CAC3B,GACF,CAEJ","names":["icon_exports","__export","Icon","__toCommonJS","import_pulso_design_tokens","import_react","import_react","import_jsx_runtime","ThemeContext","useTheme","currentTheme","ThemeContext","__spreadValues","getColorIcon","color","theme","useTheme","acc","tokenKey","colorToken","getIconSize","import_jsx_runtime","Icon","_a","_b","symbol","size","color","props","__objRest","symbolName","__spreadProps","__spreadValues","getIconSize","getColorIcon"]}