-
Notifications
You must be signed in to change notification settings - Fork 429
/
Copy pathcheck-props.js
74 lines (67 loc) · 2.25 KB
/
check-props.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
/* eslint-disable import/no-mutable-exports */
import deprecatedProperty from '../../utilities/warning/deprecated-property';
import componentIsDeprecated from '../../utilities/warning/component-is-deprecated';
import getComponentDocFn from '../../utilities/get-component-doc';
import oneOfComponent from '../../utilities/warning/one-of-component';
import sunsetProperty from '../../utilities/warning/sunset-property';
import {
APP_LAUNCHER,
APP_LAUNCHER_EXPANDABLE_SECTION,
APP_LAUNCHER_SECTION,
APP_LAUNCHER_TILE,
} from '../../utilities/constants';
let checkProps = function checkPropsFunction() {};
if (process.env.NODE_ENV !== 'production') {
checkProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {
const createDocUrl = getComponentDocFn(jsonDoc);
if (COMPONENT === APP_LAUNCHER) {
if (props.modalHeaderButton !== undefined) {
oneOfComponent(
COMPONENT,
props,
'modalHeaderButton',
['SLDSButton'],
createDocUrl('modalHeaderButton')
);
}
deprecatedProperty(
COMPONENT,
props.triggerAssistiveText,
'triggerAssistiveText',
"assistiveText['trigger']",
createDocUrl('assistiveText')
);
} else if (COMPONENT === APP_LAUNCHER_EXPANDABLE_SECTION) {
deprecatedProperty(
COMPONENT,
props.collapseSectionAssistiveText,
'collapseSectionAssistiveText',
"assistiveText['collapseSection']",
createDocUrl('assistiveText')
);
} else if (COMPONENT === APP_LAUNCHER_SECTION) {
componentIsDeprecated(
COMPONENT,
props,
'App Launcher Section has been deprecated. Please use APP_LAUNCHER_EXPANDABLE_SECTION instead.'
);
} else if (COMPONENT === APP_LAUNCHER_TILE) {
deprecatedProperty(
COMPONENT,
props.descriptionHeading,
'descriptionHeading',
null,
'Description headings are no longer a part of the SLDS App Launcher Tile spec. Please reach out to DSR admin if there is a special need for this feature'
);
sunsetProperty(
COMPONENT,
props.size,
'size',
'App Launcher Tiles are now all a consistent size according to SLDS specifications'
);
}
};
}
export default checkProps;