|
| 1 | +import deprecationWarning from './utils/deprecationWarning'; |
| 2 | + |
1 | 3 | export Accordion from './Accordion'; |
2 | 4 | export Affix from './Affix'; |
3 | 5 | export AffixMixin from './AffixMixin'; |
@@ -70,16 +72,36 @@ export Fade from './Collapse'; |
70 | 72 |
|
71 | 73 | export * as FormControls from './FormControls'; |
72 | 74 |
|
| 75 | +import domUtils from './utils/domUtils'; |
73 | 76 | import childrenValueInputValidation from './utils/childrenValueInputValidation'; |
74 | 77 | import createChainedFunction from './utils/createChainedFunction'; |
75 | | -import domUtils from './utils/domUtils'; |
76 | 78 | import ValidComponentChildren from './utils/ValidComponentChildren'; |
77 | 79 | import CustomPropTypes from './utils/CustomPropTypes'; |
78 | 80 |
|
79 | 81 | export const utils = { |
80 | 82 | childrenValueInputValidation, |
81 | 83 | createChainedFunction, |
82 | | - domUtils, |
83 | 84 | ValidComponentChildren, |
84 | | - CustomPropTypes |
| 85 | + CustomPropTypes, |
| 86 | + domUtils: createDeprecationWrapper(domUtils, 'utils/domUtils', 'npm install dom-helpers'), |
85 | 87 | }; |
| 88 | + |
| 89 | +function createDeprecationWrapper(obj, deprecated, instead, link){ |
| 90 | + let wrapper = {}; |
| 91 | + |
| 92 | + if (process.env.NODE_ENV === 'production'){ |
| 93 | + return obj; |
| 94 | + } |
| 95 | + |
| 96 | + Object.keys(obj).forEach(key => { |
| 97 | + Object.defineProperty(wrapper, key, { |
| 98 | + get(){ |
| 99 | + deprecationWarning(deprecated, instead, link); |
| 100 | + return obj[key]; |
| 101 | + }, |
| 102 | + set(x){ obj[key] = x; } |
| 103 | + }); |
| 104 | + }); |
| 105 | + |
| 106 | + return wrapper; |
| 107 | +} |
0 commit comments