UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

1 lines 1.25 kB
{"version":3,"file":"get-global-class-names.cjs","names":[],"sources":["../../../../../../src/core/styles-api/use-styles/get-class-name/get-global-class-names/get-global-class-names.ts"],"sourcesContent":["import cx from 'clsx';\nimport { MantineTheme } from '../../../../MantineProvider';\nimport { GetStylesApiOptions } from '../../../styles-api.types';\n\ninterface GetGlobalClassNamesOptions {\n theme: MantineTheme;\n unstyled: boolean | undefined;\n options: GetStylesApiOptions | undefined;\n}\n\nexport const FOCUS_CLASS_NAMES = {\n always: 'mantine-focus-always',\n auto: 'mantine-focus-auto',\n never: 'mantine-focus-never',\n} as const;\n\n/** Returns classes that are defined globally (focus and active styles) based on options */\nexport function getGlobalClassNames({ theme, options, unstyled }: GetGlobalClassNamesOptions) {\n return cx(\n options?.focusable && !unstyled && (theme.focusClassName || FOCUS_CLASS_NAMES[theme.focusRing]),\n options?.active && !unstyled && theme.activeClassName\n );\n}\n"],"mappings":";;;;;AAUA,MAAa,oBAAoB;CAC/B,QAAQ;CACR,MAAM;CACN,OAAO;CACR;;AAGD,SAAgB,oBAAoB,EAAE,OAAO,SAAS,YAAwC;AAC5F,SAAA,GAAA,KAAA,SACE,SAAS,aAAa,CAAC,aAAa,MAAM,kBAAkB,kBAAkB,MAAM,aACpF,SAAS,UAAU,CAAC,YAAY,MAAM,gBACvC"}