@carbon-labs/react-ui-shell 0.86.0 → 0.88.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/es/components/HeaderContainer.js +2 -2
  2. package/es/components/HeaderDivider.js +2 -2
  3. package/es/components/HeaderOverflowPanel.js +5 -5
  4. package/es/components/HeaderPopover.js +6 -6
  5. package/es/components/Link.js +2 -2
  6. package/es/components/Profile.js +17 -17
  7. package/es/components/SharkFinIcon.js +6 -6
  8. package/es/components/SideNav.js +10 -10
  9. package/es/components/SideNavFlyoutMenu.js +9 -9
  10. package/es/components/SideNavItems.js +5 -5
  11. package/es/components/SideNavLink.js +7 -7
  12. package/es/components/SideNavLinkPopover.js +2 -2
  13. package/es/components/SideNavMenu.js +24 -24
  14. package/es/components/SideNavMenuItem.js +7 -7
  15. package/es/components/SideNavSlot.js +4 -4
  16. package/es/components/SideNavTitle.js +3 -3
  17. package/es/components/SideNavToggle.js +7 -7
  18. package/es/components/TrialCountdown.js +3 -3
  19. package/es/internal/useId.js +2 -2
  20. package/es/internal/useIdPrefix.js +3 -3
  21. package/es/internal/usePrefix.js +3 -3
  22. package/lib/components/HeaderContainer.js +10 -10
  23. package/lib/components/HeaderDivider.js +2 -2
  24. package/lib/components/HeaderOverflowPanel.js +5 -5
  25. package/lib/components/HeaderPopover.js +9 -9
  26. package/lib/components/Link.js +3 -3
  27. package/lib/components/Profile.js +17 -17
  28. package/lib/components/SharkFinIcon.js +6 -6
  29. package/lib/components/SideNav.js +23 -23
  30. package/lib/components/SideNavFlyoutMenu.js +22 -22
  31. package/lib/components/SideNavItems.js +8 -8
  32. package/lib/components/SideNavLink.js +9 -9
  33. package/lib/components/SideNavLinkPopover.js +2 -2
  34. package/lib/components/SideNavMenu.js +42 -42
  35. package/lib/components/SideNavMenuItem.js +8 -8
  36. package/lib/components/SideNavSlot.js +4 -4
  37. package/lib/components/SideNavTitle.js +3 -3
  38. package/lib/components/SideNavToggle.js +9 -9
  39. package/lib/components/TrialCountdown.js +3 -3
  40. package/lib/es/components/HeaderContainer.d.ts +2 -2
  41. package/lib/es/components/HeaderDivider.d.ts +2 -2
  42. package/lib/es/components/HeaderOverflowPanel.d.ts +2 -2
  43. package/lib/es/components/HeaderPopover.d.ts +4 -4
  44. package/lib/es/components/Link.d.ts +3 -3
  45. package/lib/es/components/Profile.d.ts +7 -7
  46. package/lib/es/components/SharkFinIcon.d.ts +2 -2
  47. package/lib/es/components/SideNav.d.ts +4 -4
  48. package/lib/es/components/SideNavFlyoutMenu.d.ts +2 -2
  49. package/lib/es/components/SideNavItems.d.ts +2 -2
  50. package/lib/es/components/SideNavLink.d.ts +2 -2
  51. package/lib/es/components/SideNavLinkPopover.d.ts +2 -2
  52. package/lib/es/components/SideNavMenu.d.ts +2 -2
  53. package/lib/es/components/SideNavMenuItem.d.ts +2 -2
  54. package/lib/es/components/SideNavSlot.d.ts +2 -2
  55. package/lib/es/components/SideNavTitle.d.ts +3 -3
  56. package/lib/es/components/SideNavToggle.d.ts +2 -2
  57. package/lib/es/components/TrialCountdown.d.ts +2 -2
  58. package/lib/es/internal/useIdPrefix.d.ts +2 -2
  59. package/lib/es/internal/usePrefix.d.ts +2 -2
  60. package/lib/internal/useDelayedState.js +5 -5
  61. package/lib/internal/useEvent.js +4 -4
  62. package/lib/internal/useId.js +5 -5
  63. package/lib/internal/useIdPrefix.js +3 -3
  64. package/lib/internal/useMatchMedia.js +3 -3
  65. package/lib/internal/useMergedRefs.js +2 -2
  66. package/lib/internal/usePrefix.js +3 -3
  67. package/package.json +4 -6
  68. package/scss/styles/_header-divider.scss +1 -0
  69. package/scss/styles/_header.scss +13 -1
  70. package/scss/styles/_profile.scss +4 -1
  71. package/LICENSE +0 -201
  72. package/es/node_modules/@carbon/ibm-products/es/_virtual/_commonjsHelpers.js +0 -12
  73. package/es/node_modules/@carbon/ibm-products/es/_virtual/_rollupPluginBabelHelpers.js +0 -18
  74. package/es/node_modules/@carbon/ibm-products/es/_virtual/index.js +0 -14
  75. package/es/node_modules/@carbon/ibm-products/es/_virtual/index2.js +0 -12
  76. package/es/node_modules/@carbon/ibm-products/es/components/TooltipTrigger/TooltipTrigger.js +0 -62
  77. package/es/node_modules/@carbon/ibm-products/es/components/UserAvatar/UserAvatar.js +0 -161
  78. package/es/node_modules/@carbon/ibm-products/es/components/_Canary/Canary.js +0 -49
  79. package/es/node_modules/@carbon/ibm-products/es/global/js/package-settings.js +0 -246
  80. package/es/node_modules/@carbon/ibm-products/es/global/js/utils/devtools.js +0 -16
  81. package/es/node_modules/@carbon/ibm-products/es/global/js/utils/pconsole.js +0 -35
  82. package/es/node_modules/@carbon/ibm-products/es/node_modules/object-assign/index.js +0 -89
  83. package/es/node_modules/@carbon/ibm-products/es/node_modules/prop-types/checkPropTypes.js +0 -95
  84. package/es/node_modules/@carbon/ibm-products/es/node_modules/prop-types/factoryWithThrowingShims.js +0 -64
  85. package/es/node_modules/@carbon/ibm-products/es/node_modules/prop-types/factoryWithTypeCheckers.js +0 -561
  86. package/es/node_modules/@carbon/ibm-products/es/node_modules/prop-types/index.js +0 -32
  87. package/es/node_modules/@carbon/ibm-products/es/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -18
  88. package/es/node_modules/@carbon/ibm-products/es/node_modules/prop-types/lib/has.js +0 -17
  89. package/es/node_modules/@carbon/ibm-products/es/settings.js +0 -84
  90. package/lib/node_modules/@carbon/ibm-products/es/_virtual/_commonjsHelpers.js +0 -14
  91. package/lib/node_modules/@carbon/ibm-products/es/_virtual/_rollupPluginBabelHelpers.js +0 -20
  92. package/lib/node_modules/@carbon/ibm-products/es/_virtual/index.js +0 -19
  93. package/lib/node_modules/@carbon/ibm-products/es/_virtual/index2.js +0 -14
  94. package/lib/node_modules/@carbon/ibm-products/es/components/TooltipTrigger/TooltipTrigger.js +0 -64
  95. package/lib/node_modules/@carbon/ibm-products/es/components/UserAvatar/UserAvatar.js +0 -163
  96. package/lib/node_modules/@carbon/ibm-products/es/components/_Canary/Canary.js +0 -51
  97. package/lib/node_modules/@carbon/ibm-products/es/global/js/package-settings.js +0 -252
  98. package/lib/node_modules/@carbon/ibm-products/es/global/js/utils/devtools.js +0 -20
  99. package/lib/node_modules/@carbon/ibm-products/es/global/js/utils/pconsole.js +0 -45
  100. package/lib/node_modules/@carbon/ibm-products/es/node_modules/object-assign/index.js +0 -91
  101. package/lib/node_modules/@carbon/ibm-products/es/node_modules/prop-types/checkPropTypes.js +0 -97
  102. package/lib/node_modules/@carbon/ibm-products/es/node_modules/prop-types/factoryWithThrowingShims.js +0 -66
  103. package/lib/node_modules/@carbon/ibm-products/es/node_modules/prop-types/factoryWithTypeCheckers.js +0 -563
  104. package/lib/node_modules/@carbon/ibm-products/es/node_modules/prop-types/index.js +0 -34
  105. package/lib/node_modules/@carbon/ibm-products/es/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -20
  106. package/lib/node_modules/@carbon/ibm-products/es/node_modules/prop-types/lib/has.js +0 -19
  107. package/lib/node_modules/@carbon/ibm-products/es/settings.js +0 -86
@@ -1,246 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2024
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- // Copyright IBM Corp. 2020, 2025
9
- //
10
- // This source code is licensed under the Apache-2.0 license found in the
11
- // LICENSE file in the root directory of this source tree.
12
- //
13
-
14
- const defaults = {
15
- prefix: 'c4p',
16
- // by default only released components are set to true
17
- component: {
18
- // reviewed and released components:
19
- AboutModal: true,
20
- APIKeyModal: true,
21
- Cascade: true,
22
- Checklist: true,
23
- CreateModal: true,
24
- CreateFullPage: true,
25
- CreateFullPageStep: true,
26
- CreateSidePanel: true,
27
- CreateTearsheetNarrow: true,
28
- CreateTearsheet: true,
29
- CreateTearsheetStep: true,
30
- CreateTearsheetDivider: true,
31
- Datagrid: true,
32
- EditInPlace: true,
33
- EmptyState: true,
34
- ErrorEmptyState: true,
35
- ExportModal: true,
36
- ExpressiveCard: true,
37
- FullPageError: true,
38
- HTTPError403: true,
39
- HTTPError404: true,
40
- HTTPErrorOther: true,
41
- ImportModal: true,
42
- MultiAddSelect: true,
43
- NotificationsPanel: true,
44
- NoDataEmptyState: true,
45
- NoTagsEmptyState: true,
46
- NotFoundEmptyState: true,
47
- NotificationsEmptyState: true,
48
- OptionsTile: true,
49
- PageHeader: true,
50
- ProductiveCard: true,
51
- RemoveModal: true,
52
- Saving: true,
53
- SidePanel: true,
54
- SingleAddSelect: true,
55
- StatusIcon: true,
56
- TagSet: true,
57
- Tearsheet: true,
58
- TearsheetNarrow: true,
59
- UnauthorizedEmptyState: true,
60
- UserProfileImage: true,
61
- WebTerminal: true,
62
- WebTerminalContentWrapper: true,
63
- WebTerminalProvider: true,
64
- UserAvatar: true,
65
- // other public components not yet reviewed and released:
66
- Toolbar: false,
67
- ToolbarButton: false,
68
- ToolbarGroup: false,
69
- EditSidePanel: false,
70
- CancelableTextEdit: false,
71
- DataSpreadsheet: false,
72
- EditTearsheet: false,
73
- EditTearsheetForm: false,
74
- EditTearsheetNarrow: false,
75
- EditFullPage: false,
76
- EditUpdateCards: false,
77
- Nav: false,
78
- NavItem: false,
79
- NavList: false,
80
- BigNumber: false,
81
- TruncatedList: false,
82
- TruncatedText: false,
83
- DelimitedList: false,
84
- ScrollGradient: false,
85
- StringFormatter: false,
86
- StatusIndicator: false,
87
- StatusIndicatorStep: false,
88
- TagOverflow: false,
89
- ActionBar: false,
90
- FilterPanel: false,
91
- FilterPanelAccordion: false,
92
- FilterPanelAccordionItem: false,
93
- FilterPanelCheckbox: false,
94
- FilterPanelCheckboxWithOverflow: false,
95
- FilterPanelGroup: false,
96
- FilterPanelLabel: false,
97
- FilterPanelSearch: false,
98
- ConditionBuilder: false,
99
- GetStartedCard: false,
100
- /* new component flags here - comment used by generate CLI */
101
-
102
- // Onboarding components not yet reviewed and released:
103
- Coachmark: false,
104
- CoachmarkBeacon: false,
105
- CoachmarkButton: false,
106
- CoachmarkFixed: false,
107
- CoachmarkOverlayElement: false,
108
- CoachmarkOverlayElements: false,
109
- CoachmarkStack: false,
110
- Decorator: false,
111
- DecoratorLink: false,
112
- DecoratorSingleButton: false,
113
- DecoratorDualButton: false,
114
- DescriptionList: false,
115
- DescriptionListBody: false,
116
- DescriptionListCell: false,
117
- DescriptionListRow: false,
118
- SearchBar: false,
119
- /* new component flags here - comment used by generate CLI */
120
-
121
- // Onboarding components not yet reviewed and released:
122
- EmptyStateV2: false,
123
- Guidebanner: false,
124
- GuidebannerElement: false,
125
- GuidebannerElementButton: false,
126
- GuidebannerElementLink: false,
127
- InlineTip: false,
128
- InlineTipButton: false,
129
- InlineTipLink: false,
130
- InterstitialScreen: true,
131
- NonLinearReading: false
132
- },
133
- // feature level flags
134
- feature: {
135
- 'default-portal-target-body': true,
136
- 'Datagrid.useInlineEdit': false,
137
- 'Datagrid.useEditableCell': false,
138
- 'Datagrid.useCustomizeColumns': false,
139
- 'ExampleComponent.secondaryIcon': false,
140
- 'ExampleComponent.useExample': false
141
- }
142
- };
143
- const warningMessageComponent = property => `Carbon for IBM Products (WARNING): Component "${property}" enabled via feature flags. This component has not yet completed its review process.`;
144
- const warningMessageFeature = property => `Carbon for IBM Products (WARNING): Feature "${property}" enabled via feature flags.`;
145
- const errorMessageFeature = property => `Carbon for IBM Products (Error): Feature "${property}" not enabled. To enable see the notes on feature flags in the README.`;
146
- const warningMessageAllComponents = 'Carbon for IBM Products (WARNING): All components enabled through use of setAllComponents. This includes components that have not yet completed their review process.';
147
- const warningMessageAllFeatures = 'Carbon for IBM Products (WARNING): All features enabled through use of setAllFeatures';
148
-
149
- // Values to represent overrides for component or feature settings.
150
- // Each value maps the initial value to the value that should be returned.
151
- const all = {
152
- INITIAL: v => v,
153
- ON: () => true,
154
- OFF: () => false
155
- };
156
- let allComponents = all.INITIAL;
157
- let allFeatures = all.INITIAL;
158
- let silent = false;
159
- const component = new Proxy({
160
- ...defaults.component
161
- }, {
162
- set(target, property, value) {
163
- if (target[property] !== true && !silent && value) {
164
- // not already true, not silent, and now true
165
- console.warn(warningMessageComponent(property));
166
- }
167
- target[property] = value;
168
- return true; // value set
169
- },
170
- get(target, property) {
171
- return allComponents(target[property] ?? false);
172
- }
173
- });
174
- const feature = new Proxy({
175
- ...defaults.feature
176
- }, {
177
- set(target, property, value) {
178
- // If we receive a feature flag that doesn't exist in our defaults we should not log
179
- // a warning message and instead just return
180
- if (!Object.getOwnPropertyDescriptor(defaults.feature, property)) {
181
- return true;
182
- }
183
- if (target[property] !== true && !silent && value) {
184
- // not already true, not silent, and now true
185
- console.warn(warningMessageFeature(property));
186
- }
187
- target[property] = value;
188
- return true; // value set
189
- },
190
- get(target, property) {
191
- return allFeatures(target[property] ?? false);
192
- }
193
- });
194
- const devtoolsAttribute = 'data-carbon-devtools-id';
195
- function getDevtoolsId(componentName) {
196
- return `${defaults.prefix}--${componentName}`;
197
- }
198
- var pkg = {
199
- devtoolsAttribute,
200
- getDevtoolsId,
201
- prefix: defaults.prefix,
202
- component: component,
203
- feature: feature,
204
- isComponentEnabled: function (componentOrName) {
205
- let byDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
206
- const componentName = componentOrName?.displayName || componentOrName?.name || componentOrName;
207
- return byDefault ? defaults.component[componentName] : component[componentName];
208
- },
209
- isComponentPublic: function (componentOrName) {
210
- let byDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
211
- const componentName = componentOrName?.displayName || componentOrName?.name || componentOrName;
212
- return Object.prototype.hasOwnProperty.call(byDefault ? defaults.component : component, componentName);
213
- },
214
- isFeatureEnabled: function (featureName) {
215
- let byDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
216
- return byDefault ? defaults.feature[featureName] : feature[featureName];
217
- },
218
- checkReportFeatureEnabled(featureName) {
219
- if (feature[featureName]) {
220
- // NOTE: Warning emitted if feature flag is enabled (see Proxy above)
221
- return true;
222
- } else {
223
- console.error(errorMessageFeature(featureName));
224
- }
225
- },
226
- isFeaturePublic: function (featureName) {
227
- let byDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
228
- return Object.prototype.hasOwnProperty.call(byDefault ? defaults.feature : feature, featureName);
229
- },
230
- setAllComponents: enabled => {
231
- enabled === true && !silent && console.warn(warningMessageAllComponents);
232
- allComponents = enabled === true ? all.ON : enabled === false ? all.OFF : all.INITIAL;
233
- },
234
- setAllFeatures: enabled => {
235
- enabled === true && !silent && console.warn(warningMessageAllFeatures);
236
- allFeatures = enabled === true ? all.ON : enabled === false ? all.OFF : all.INITIAL;
237
- },
238
- _silenceWarnings: value => {
239
- // This will suppress console warnings when components or feature flags
240
- // are enabled, and should only be used when this is not an issue, such
241
- // as in internal test suites and storybook builds.
242
- silent = value;
243
- }
244
- };
245
-
246
- export { pkg as default, devtoolsAttribute, getDevtoolsId };
@@ -1,16 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2024
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import { getDevtoolsId, devtoolsAttribute } from '../package-settings.js';
9
-
10
- function getDevtoolsProps(componentName) {
11
- return {
12
- [devtoolsAttribute]: getDevtoolsId(componentName)
13
- };
14
- }
15
-
16
- export { devtoolsAttribute, getDevtoolsId, getDevtoolsProps };
@@ -1,35 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2024
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- // Copyright IBM Corp. 2020, 2021
9
- //
10
- // This source code is licensed under the Apache-2.0 license found in the
11
- // LICENSE file in the root directory of this source tree.
12
- //
13
-
14
- const isProduction = process.env.NODE_ENV === 'production';
15
- const noop = () => undefined;
16
- const shimIfProduction = fn => isProduction ? noop : fn;
17
- const log = shimIfProduction(function () {
18
- return console.log(...arguments);
19
- });
20
- const warn = shimIfProduction(function () {
21
- return console.warn(...arguments);
22
- });
23
- const error = shimIfProduction(function () {
24
- return console.error(...arguments);
25
- });
26
- var pconsole = {
27
- isProduction,
28
- noop,
29
- shimIfProduction,
30
- log,
31
- warn,
32
- error
33
- };
34
-
35
- export { pconsole as default, error, isProduction, log, noop, shimIfProduction, warn };
@@ -1,89 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2024
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- var objectAssign;
9
- var hasRequiredObjectAssign;
10
- function requireObjectAssign() {
11
- if (hasRequiredObjectAssign) return objectAssign;
12
- hasRequiredObjectAssign = 1;
13
- /* eslint-disable no-unused-vars */
14
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
15
- var hasOwnProperty = Object.prototype.hasOwnProperty;
16
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
17
- function toObject(val) {
18
- if (val === null || val === undefined) {
19
- throw new TypeError('Object.assign cannot be called with null or undefined');
20
- }
21
- return Object(val);
22
- }
23
- function shouldUseNative() {
24
- try {
25
- if (!Object.assign) {
26
- return false;
27
- }
28
-
29
- // Detect buggy property enumeration order in older V8 versions.
30
-
31
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
32
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
33
- test1[5] = 'de';
34
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
35
- return false;
36
- }
37
-
38
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
39
- var test2 = {};
40
- for (var i = 0; i < 10; i++) {
41
- test2['_' + String.fromCharCode(i)] = i;
42
- }
43
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
44
- return test2[n];
45
- });
46
- if (order2.join('') !== '0123456789') {
47
- return false;
48
- }
49
-
50
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
51
- var test3 = {};
52
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
53
- test3[letter] = letter;
54
- });
55
- if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
56
- return false;
57
- }
58
- return true;
59
- } catch (err) {
60
- // We don't expect any of the above to throw, but better to be safe.
61
- return false;
62
- }
63
- }
64
- objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
65
- var from;
66
- var to = toObject(target);
67
- var symbols;
68
- for (var s = 1; s < arguments.length; s++) {
69
- from = Object(arguments[s]);
70
- for (var key in from) {
71
- if (hasOwnProperty.call(from, key)) {
72
- to[key] = from[key];
73
- }
74
- }
75
- if (getOwnPropertySymbols) {
76
- symbols = getOwnPropertySymbols(from);
77
- for (var i = 0; i < symbols.length; i++) {
78
- if (propIsEnumerable.call(from, symbols[i])) {
79
- to[symbols[i]] = from[symbols[i]];
80
- }
81
- }
82
- }
83
- }
84
- return to;
85
- };
86
- return objectAssign;
87
- }
88
-
89
- export { requireObjectAssign as __require };
@@ -1,95 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2024
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import { __require as requireReactPropTypesSecret } from './lib/ReactPropTypesSecret.js';
9
- import { __require as requireHas } from './lib/has.js';
10
-
11
- var checkPropTypes_1;
12
- var hasRequiredCheckPropTypes;
13
- function requireCheckPropTypes() {
14
- if (hasRequiredCheckPropTypes) return checkPropTypes_1;
15
- hasRequiredCheckPropTypes = 1;
16
- var printWarning = function () {};
17
- if (process.env.NODE_ENV !== 'production') {
18
- var ReactPropTypesSecret = /*@__PURE__*/requireReactPropTypesSecret();
19
- var loggedTypeFailures = {};
20
- var has = /*@__PURE__*/requireHas();
21
- printWarning = function (text) {
22
- var message = 'Warning: ' + text;
23
- if (typeof console !== 'undefined') {
24
- console.error(message);
25
- }
26
- try {
27
- // --- Welcome to debugging React ---
28
- // This error was thrown as a convenience so that you can use this stack
29
- // to find the callsite that caused this warning to fire.
30
- throw new Error(message);
31
- } catch (x) {/**/}
32
- };
33
- }
34
-
35
- /**
36
- * Assert that the values match with the type specs.
37
- * Error messages are memorized and will only be shown once.
38
- *
39
- * @param {object} typeSpecs Map of name to a ReactPropType
40
- * @param {object} values Runtime values that need to be type-checked
41
- * @param {string} location e.g. "prop", "context", "child context"
42
- * @param {string} componentName Name of the component for error messages.
43
- * @param {?Function} getStack Returns the component stack.
44
- * @private
45
- */
46
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
47
- if (process.env.NODE_ENV !== 'production') {
48
- for (var typeSpecName in typeSpecs) {
49
- if (has(typeSpecs, typeSpecName)) {
50
- var error;
51
- // Prop type validation may throw. In case they do, we don't want to
52
- // fail the render phase where it didn't fail before. So we log it.
53
- // After these have been cleaned up, we'll let them throw.
54
- try {
55
- // This is intentionally an invariant that gets caught. It's the same
56
- // behavior as without this statement except with a better message.
57
- if (typeof typeSpecs[typeSpecName] !== 'function') {
58
- var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
59
- err.name = 'Invariant Violation';
60
- throw err;
61
- }
62
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
63
- } catch (ex) {
64
- error = ex;
65
- }
66
- if (error && !(error instanceof Error)) {
67
- printWarning((componentName || 'React class') + ': type specification of ' + location + ' `' + typeSpecName + '` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).');
68
- }
69
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
70
- // Only monitor this failure once because there tends to be a lot of the
71
- // same error.
72
- loggedTypeFailures[error.message] = true;
73
- var stack = getStack ? getStack() : '';
74
- printWarning('Failed ' + location + ' type: ' + error.message + (stack != null ? stack : ''));
75
- }
76
- }
77
- }
78
- }
79
- }
80
-
81
- /**
82
- * Resets warning cache when testing.
83
- *
84
- * @private
85
- */
86
- checkPropTypes.resetWarningCache = function () {
87
- if (process.env.NODE_ENV !== 'production') {
88
- loggedTypeFailures = {};
89
- }
90
- };
91
- checkPropTypes_1 = checkPropTypes;
92
- return checkPropTypes_1;
93
- }
94
-
95
- export { requireCheckPropTypes as __require };
@@ -1,64 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2024
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import { __require as requireReactPropTypesSecret } from './lib/ReactPropTypesSecret.js';
9
-
10
- var factoryWithThrowingShims;
11
- var hasRequiredFactoryWithThrowingShims;
12
- function requireFactoryWithThrowingShims() {
13
- if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
14
- hasRequiredFactoryWithThrowingShims = 1;
15
- var ReactPropTypesSecret = /*@__PURE__*/requireReactPropTypesSecret();
16
- function emptyFunction() {}
17
- function emptyFunctionWithReset() {}
18
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
19
- factoryWithThrowingShims = function () {
20
- function shim(props, propName, componentName, location, propFullName, secret) {
21
- if (secret === ReactPropTypesSecret) {
22
- // It is still safe when called from React.
23
- return;
24
- }
25
- var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
26
- err.name = 'Invariant Violation';
27
- throw err;
28
- }
29
- shim.isRequired = shim;
30
- function getShim() {
31
- return shim;
32
- }
33
- // Important!
34
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
35
- var ReactPropTypes = {
36
- array: shim,
37
- bigint: shim,
38
- bool: shim,
39
- func: shim,
40
- number: shim,
41
- object: shim,
42
- string: shim,
43
- symbol: shim,
44
- any: shim,
45
- arrayOf: getShim,
46
- element: shim,
47
- elementType: shim,
48
- instanceOf: getShim,
49
- node: shim,
50
- objectOf: getShim,
51
- oneOf: getShim,
52
- oneOfType: getShim,
53
- shape: getShim,
54
- exact: getShim,
55
- checkPropTypes: emptyFunctionWithReset,
56
- resetWarningCache: emptyFunction
57
- };
58
- ReactPropTypes.PropTypes = ReactPropTypes;
59
- return ReactPropTypes;
60
- };
61
- return factoryWithThrowingShims;
62
- }
63
-
64
- export { requireFactoryWithThrowingShims as __require };