@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 • 17.2 kB
Source Map (JSON)
{"version":3,"sources":["../../../src/components/card-informative/index.ts","../../../src/components/card-informative/card-informative.tsx","../../../src/utils/tv.ts","../../../src/components/card-informative/card-informative.styles.ts","../../../src/components/card-informative/components/card-informative-content/index.tsx","../../../src/components/card-informative/components/card-informative-title/card-informative-title.styles.ts","../../../src/components/card-informative/components/card-informative-title/index.tsx","../../../src/components/card-informative/components/card-informative-content/card-informative-content.styles.ts","../../../src/components/card-informative/components/card-informative-description/card-informative-description.styles.ts","../../../src/components/card-informative/components/card-informative-description/index.tsx","../../../src/components/card-informative/components/card-informative-icon/index.tsx","../../../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","../../../src/components/card-informative/components/card-informative-icon/card-informative-icon.styles.ts"],"sourcesContent":["export { CardInformative } from './card-informative'\nexport type { CardInformativeProps } from './card-informative.types'\n","import { type Scope, createContextScope } from '@radix-ui/react-context'\nimport { CardInformativeRootVariants } from './card-informative.styles'\nimport type { CardInformativeProps } from './card-informative.types'\nimport { CardInformativeContent } from './components/card-informative-content'\nimport { CardInformativeDescription } from './components/card-informative-description'\nimport { CardInformativeIcon } from './components/card-informative-icon'\nimport { CardInformativeTitle } from './components/card-informative-title'\n\nexport const DISPLAY_NAME = 'CardInformative'\n\ntype CardInformativeRootProps = CardInformativeProps & {\n children: React.ReactNode\n}\n\nexport const CardInformativeRoot = (props: CardInformativeRootProps) => {\n const { children, type, variants, iconName, __scopeCardInformative } =\n props as CardInformativeScopedProps<CardInformativeRootProps>\n\n const cardInformativeProps = {\n type,\n variants,\n iconName,\n scope: __scopeCardInformative,\n } as CardInformativeProps & { scope: Scope }\n return (\n <CardInformativeProvider {...cardInformativeProps}>\n <div\n {...props}\n className={CardInformativeRootVariants({ variants, type })}\n >\n {type !== 'text' && <CardInformativeIcon />}\n {children}\n </div>\n </CardInformativeProvider>\n )\n}\n\nCardInformativeRoot.displayName = DISPLAY_NAME\n\n/*\n----------------------------------------------------------------\nScope Definition\n----------------------------------------------------------------\n*/\n\nexport type CardInformativeContext = CardInformativeProps & {}\n\nexport type CardInformativeScopedProps<P> = P & {\n __scopeCardInformative?: Scope\n}\n\nconst [createCardInformativeContext] = createContextScope(DISPLAY_NAME)\n\nexport const [CardInformativeProvider, useCardInformativeContext]: readonly [\n ProviderType<CardInformativeContext>,\n (consumerName: string, scope: Scope) => CardInformativeContext,\n] = createCardInformativeContext<CardInformativeContext>(DISPLAY_NAME)\n\n/*\n----------------------------------------------------------------\nComposition Export\n----------------------------------------------------------------\n*/\n\nexport const CardInformative = {\n Root: CardInformativeRoot,\n Content: CardInformativeContent,\n Title: CardInformativeTitle,\n Description: CardInformativeDescription,\n}\n","import { type VariantProps, createTV } from 'tailwind-variants'\n\nexport const tv = createTV({\n twMergeConfig: {\n extend: {\n classGroups: {\n 'font-size': [\n {\n text: ['threepulse', 'threeandhalfpulse'],\n },\n ],\n 'border-width': [\n {\n border: ['quarterpulse', 'halfpulse'],\n },\n ],\n '--tw-ring-inset': [\n {\n ring: ['none', 'quarterpulse', 'halfpulse'],\n },\n ],\n },\n },\n },\n})\n\nexport type { VariantProps }\n","import { tv } from '~/utils/tv'\n\nexport const CardInformativeRootVariants = tv({\n base: `\n flex min-w-[16.25rem] border-none rounded-smallcontainer p-fourpulse justify-start items-center\n `,\n variants: {\n variants: {\n neutral: `\n bg-fill-neutral-alternative\n `,\n positive: `\n bg-fill-success\n `,\n informative: `\n bg-fill-informative\n `,\n warning: `\n bg-fill-warning\n `,\n negative: `\n bg-fill-danger\n `,\n },\n type: {\n icon: 'gap-threepulse',\n highlight: 'gap-fourpulse',\n text: '',\n },\n },\n})\n","import React from 'react'\nimport {\n type CardInformativeScopedProps,\n DISPLAY_NAME,\n useCardInformativeContext,\n} from '../../card-informative'\nimport { CardInformativeTitle } from '../card-informative-title'\nimport { CardInformativeContentVariants } from './card-informative-content.styles'\n\ntype CardInformativeContentProps = {\n children: React.ReactNode\n}\n\nexport const CardInformativeContent = (props: CardInformativeContentProps) => {\n const { children, __scopeCardInformative } =\n props as CardInformativeScopedProps<CardInformativeContentProps>\n const { type } = useCardInformativeContext(\n DISPLAY_NAME,\n __scopeCardInformative\n )\n\n return (\n <div {...props} className={CardInformativeContentVariants({})}>\n {React.Children.map(children, child => {\n if (!React.isValidElement(child)) return child\n\n if (type !== 'highlight' && child.type === CardInformativeTitle) {\n return null\n }\n\n return child\n })}\n </div>\n )\n}\n","import { tv } from '~/utils/tv'\n\nexport const CardInformativeTitleVariants = tv({\n base: `\n text-text-neutral font-rdmodern font-bold text-threeandhalfpulse line-clamp-1\n `,\n variants: {},\n})\n","import { CardInformativeTitleVariants } from './card-informative-title.styles'\n\ntype CardInformativeTitleProps = {\n children: React.ReactNode\n}\n\nexport const CardInformativeTitle = (props: CardInformativeTitleProps) => {\n const { children } = props\n\n return (\n <p {...props} className={CardInformativeTitleVariants({})}>\n {children}\n </p>\n )\n}\n","import { tv } from '~/utils/tv'\n\nexport const CardInformativeContentVariants = tv({\n base: 'flex flex-col justify-center align-middle',\n variants: {},\n})\n","import { tv } from '~/utils/tv'\n\nexport const CardInformativeDescriptionVariants = tv({\n base: `\n text-text-neutral font-rdmodern font-regular text-threeandhalfpulse line-clamp-4\n `,\n variants: {},\n})\n","import { CardInformativeDescriptionVariants } from './card-informative-description.styles'\n\ntype CardInformativeDescriptionProps = {\n children: React.ReactNode\n}\nexport const CardInformativeDescription = (\n props: CardInformativeDescriptionProps\n) => {\n const { children } = props\n return (\n <p {...props} className={CardInformativeDescriptionVariants({})}>\n {children}\n </p>\n )\n}\n","import { useCallback } from 'react'\nimport { Icon, type TIconProps } from '~/components/icon'\nimport {\n type CardInformativeScopedProps,\n DISPLAY_NAME,\n useCardInformativeContext,\n} from '../../card-informative'\nimport { CardInformativeIconVariants } from './card-informative-icon.styles'\n\ntype CardInformativeIconProps = {}\n\nexport const CardInformativeIcon = (props: CardInformativeIconProps) => {\n const { __scopeCardInformative } =\n props as CardInformativeScopedProps<CardInformativeIconProps>\n\n const { type, iconName, variants } = useCardInformativeContext(\n DISPLAY_NAME,\n __scopeCardInformative\n )\n\n const mapper: Record<typeof variants, TIconProps['color']> = {\n positive: 'colorTextSuccessAlternative',\n informative: 'colorTextInformativeAlternative',\n warning: 'colorTextWarningAlternative',\n negative: 'colorTextDangerAlternative',\n neutral: 'colorTextNeutralAlternative',\n }\n\n const mapVariantColor = useCallback((): TIconProps['color'] => {\n return mapper[variants]\n }, [variants])\n\n return (\n <div {...props} className={CardInformativeIconVariants({ type })}>\n <Icon symbol={iconName} size=\"small\" color={mapVariantColor()} />\n </div>\n )\n}\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","import { tv } from '~/utils/tv'\n\nexport const CardInformativeIconVariants = tv({\n base: `\n flex items-center\n `,\n variants: {\n type: {\n text: '',\n icon: '',\n highlight:\n 'max-h-large min-h-large min-w-large max-w-large items-center justify-center rounded-pill bg-fill-neutral',\n },\n },\n})\n"],"mappings":"sjCAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,qBAAAE,IAAA,eAAAC,GAAAH,ICAA,IAAAI,EAA+C,mCCA/C,IAAAC,EAA4C,6BAE/BC,KAAK,YAAS,CACzB,cAAe,CACb,OAAQ,CACN,YAAa,CAC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AACQ,GAAyBM,CAAyB,EAG5DD,GAAqDb,CAAY,EAQxDe,EAAkB,CAC7B,KAAMd,EACN,QAASe,EACT,MAAOC,EACP,YAAaC,CACf","names":["card_informative_exports","__export","CardInformative","__toCommonJS","import_react_context","import_tailwind_variants","tv","CardInformativeRootVariants","tv","import_react","CardInformativeTitleVariants","tv","import_jsx_runtime","CardInformativeTitle","props","children","__spreadProps","__spreadValues","CardInformativeTitleVariants","CardInformativeContentVariants","tv","import_jsx_runtime","CardInformativeContent","props","children","__scopeCardInformative","type","useCardInformativeContext","DISPLAY_NAME","__spreadProps","__spreadValues","CardInformativeContentVariants","React","child","CardInformativeTitle","CardInformativeDescriptionVariants","tv","import_jsx_runtime","CardInformativeDescription","props","children","__spreadProps","__spreadValues","CardInformativeDescriptionVariants","import_react","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","CardInformativeIconVariants","tv","import_jsx_runtime","CardInformativeIcon","props","__scopeCardInformative","type","iconName","variants","useCardInformativeContext","DISPLAY_NAME","mapper","mapVariantColor","__spreadProps","__spreadValues","CardInformativeIconVariants","Icon","import_jsx_runtime","DISPLAY_NAME","CardInformativeRoot","props","children","type","variants","iconName","__scopeCardInformative","CardInformativeProvider","__spreadProps","__spreadValues","CardInformativeRootVariants","CardInformativeIcon","createCardInformativeContext","useCardInformativeContext","CardInformative","CardInformativeContent","CardInformativeTitle","CardInformativeDescription"]}