1 | 'use client';
|
2 |
|
3 | import * as React from 'react';
|
4 | import { jsx as _jsx } from "react/jsx-runtime";
|
5 | const defaultContextValue = {
|
6 | disableDefaultClasses: false
|
7 | };
|
8 | const ClassNameConfiguratorContext = React.createContext(defaultContextValue);
|
9 | if (process.env.NODE_ENV !== 'production') {
|
10 | ClassNameConfiguratorContext.displayName = 'ClassNameConfiguratorContext';
|
11 | }
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | export function useClassNamesOverride(generateUtilityClass) {
|
21 | const {
|
22 | disableDefaultClasses
|
23 | } = React.useContext(ClassNameConfiguratorContext);
|
24 | return slot => {
|
25 | if (disableDefaultClasses) {
|
26 | return '';
|
27 | }
|
28 | return generateUtilityClass(slot);
|
29 | };
|
30 | }
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | export function ClassNameConfigurator(props) {
|
36 | const {
|
37 | disableDefaultClasses,
|
38 | children
|
39 | } = props;
|
40 | const contextValue = React.useMemo(() => ({
|
41 | disableDefaultClasses: disableDefaultClasses != null ? disableDefaultClasses : false
|
42 | }), [disableDefaultClasses]);
|
43 | return _jsx(ClassNameConfiguratorContext.Provider, {
|
44 | value: contextValue,
|
45 | children: children
|
46 | });
|
47 | } |
\ | No newline at end of file |