@carbon/ibm-products 2.25.0 → 2.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. package/css/index-full-carbon.css +556 -63
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +50 -16
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +556 -63
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +527 -55
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/BigNumbers/BigNumbers.d.ts +11 -0
  18. package/es/components/BigNumbers/BigNumbers.js +238 -0
  19. package/es/components/BigNumbers/constants.d.ts +13 -0
  20. package/es/components/BigNumbers/constants.js +67 -0
  21. package/es/components/BigNumbers/index.d.ts +1 -0
  22. package/es/components/Cascade/Cascade.d.ts +19 -2
  23. package/es/components/Cascade/Cascade.js +12 -9
  24. package/es/components/Coachmark/CoachmarkTagline.js +1 -2
  25. package/es/components/CoachmarkStack/CoachmarkStackHome.js +1 -1
  26. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +4 -3
  27. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +3 -2
  28. package/es/components/DataSpreadsheet/utils/checkForHoldingKey.d.ts +1 -0
  29. package/es/components/DataSpreadsheet/utils/checkForHoldingKey.js +17 -0
  30. package/es/components/Datagrid/Datagrid/Datagrid.js +9 -2
  31. package/es/components/Datagrid/Datagrid/DatagridContent.d.ts +3 -1
  32. package/es/components/Datagrid/Datagrid/DatagridContent.js +6 -2
  33. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +21 -8
  34. package/es/components/Datagrid/Datagrid/DatagridRow.js +15 -2
  35. package/es/components/Datagrid/Datagrid/DatagridToolbar.d.ts +10 -1
  36. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +21 -4
  37. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +32 -9
  38. package/es/components/Datagrid/Datagrid/addons/Filtering/constants.d.ts +3 -1
  39. package/es/components/Datagrid/Datagrid/addons/Filtering/constants.js +4 -1
  40. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +35 -3
  41. package/es/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +2 -0
  42. package/es/components/Datagrid/Datagrid/addons/Slug/{ColumnHeaderSlug.js → DatagridSlug.js} +4 -4
  43. package/es/components/Datagrid/Datagrid/addons/stateReducer.js +3 -3
  44. package/es/components/Datagrid/useSelectAllToggle.js +5 -3
  45. package/es/components/Datagrid/useSortableColumns.js +2 -2
  46. package/es/components/EmptyStates/EmptyStateContent.d.ts +1 -1
  47. package/es/components/FullPageError/FullPageError.js +41 -15
  48. package/es/components/FullPageError/assets/Error403SVG.d.ts +9 -0
  49. package/es/components/FullPageError/assets/Error403SVG.js +714 -0
  50. package/es/components/FullPageError/assets/Error404SVG.d.ts +9 -0
  51. package/es/components/FullPageError/assets/Error404SVG.js +623 -0
  52. package/es/components/HTTPErrors/HTTPErrorContent.d.ts +1 -1
  53. package/es/components/InterstitialScreen/InterstitialScreen.js +1 -1
  54. package/es/components/SidePanel/SidePanel.js +13 -6
  55. package/es/components/SidePanel/motion/variants.d.ts +39 -12
  56. package/es/components/SidePanel/motion/variants.js +42 -11
  57. package/es/components/StringFormatter/StringFormatter.d.ts +6 -0
  58. package/es/components/StringFormatter/StringFormatter.js +79 -0
  59. package/es/components/StringFormatter/index.d.ts +1 -0
  60. package/es/components/StringFormatter/utils/enums.d.ts +14 -0
  61. package/es/components/StringFormatter/utils/enums.js +23 -0
  62. package/es/components/Tearsheet/TearsheetShell.js +26 -8
  63. package/es/components/UserAvatar/UserAvatar.js +59 -44
  64. package/es/components/index.d.ts +2 -0
  65. package/es/global/js/hooks/index.d.ts +2 -0
  66. package/es/global/js/hooks/useFocus.d.ts +11 -0
  67. package/es/global/js/hooks/useFocus.js +76 -0
  68. package/es/global/js/hooks/useIsomorphicEffect.d.ts +2 -0
  69. package/es/global/js/hooks/useIsomorphicEffect.js +14 -0
  70. package/es/global/js/package-settings.d.ts +2 -0
  71. package/es/global/js/package-settings.js +2 -0
  72. package/es/index.js +2 -0
  73. package/es/settings.d.ts +2 -0
  74. package/lib/components/BigNumbers/BigNumbers.d.ts +11 -0
  75. package/lib/components/BigNumbers/BigNumbers.js +244 -0
  76. package/lib/components/BigNumbers/constants.d.ts +13 -0
  77. package/lib/components/BigNumbers/constants.js +76 -0
  78. package/lib/components/BigNumbers/index.d.ts +1 -0
  79. package/lib/components/Cascade/Cascade.d.ts +19 -2
  80. package/lib/components/Cascade/Cascade.js +12 -9
  81. package/lib/components/Coachmark/CoachmarkTagline.js +3 -4
  82. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +2 -2
  83. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +4 -3
  84. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +3 -2
  85. package/lib/components/DataSpreadsheet/utils/checkForHoldingKey.d.ts +1 -0
  86. package/lib/components/DataSpreadsheet/utils/checkForHoldingKey.js +21 -0
  87. package/lib/components/Datagrid/Datagrid/Datagrid.js +9 -2
  88. package/lib/components/Datagrid/Datagrid/DatagridContent.d.ts +3 -1
  89. package/lib/components/Datagrid/Datagrid/DatagridContent.js +6 -2
  90. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +20 -7
  91. package/lib/components/Datagrid/Datagrid/DatagridRow.js +14 -1
  92. package/lib/components/Datagrid/Datagrid/DatagridToolbar.d.ts +10 -1
  93. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +20 -3
  94. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +30 -7
  95. package/lib/components/Datagrid/Datagrid/addons/Filtering/constants.d.ts +3 -1
  96. package/lib/components/Datagrid/Datagrid/addons/Filtering/constants.js +4 -0
  97. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +33 -1
  98. package/lib/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +2 -0
  99. package/lib/components/Datagrid/Datagrid/addons/Slug/{ColumnHeaderSlug.js → DatagridSlug.js} +4 -4
  100. package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +3 -3
  101. package/lib/components/Datagrid/useSelectAllToggle.js +4 -2
  102. package/lib/components/Datagrid/useSortableColumns.js +2 -2
  103. package/lib/components/EmptyStates/EmptyStateContent.d.ts +1 -1
  104. package/lib/components/FullPageError/FullPageError.js +41 -15
  105. package/lib/components/FullPageError/assets/Error403SVG.d.ts +9 -0
  106. package/lib/components/FullPageError/assets/Error403SVG.js +722 -0
  107. package/lib/components/FullPageError/assets/Error404SVG.d.ts +9 -0
  108. package/lib/components/FullPageError/assets/Error404SVG.js +631 -0
  109. package/lib/components/HTTPErrors/HTTPErrorContent.d.ts +1 -1
  110. package/lib/components/InterstitialScreen/InterstitialScreen.js +3 -3
  111. package/lib/components/SidePanel/SidePanel.js +11 -4
  112. package/lib/components/SidePanel/motion/variants.d.ts +39 -12
  113. package/lib/components/SidePanel/motion/variants.js +42 -10
  114. package/lib/components/StringFormatter/StringFormatter.d.ts +6 -0
  115. package/lib/components/StringFormatter/StringFormatter.js +85 -0
  116. package/lib/components/StringFormatter/index.d.ts +1 -0
  117. package/lib/components/StringFormatter/utils/enums.d.ts +14 -0
  118. package/lib/components/StringFormatter/utils/enums.js +27 -0
  119. package/lib/components/Tearsheet/TearsheetShell.js +26 -8
  120. package/lib/components/UserAvatar/UserAvatar.js +59 -44
  121. package/lib/components/index.d.ts +2 -0
  122. package/lib/global/js/hooks/index.d.ts +2 -0
  123. package/lib/global/js/hooks/useFocus.d.ts +11 -0
  124. package/lib/global/js/hooks/useFocus.js +80 -0
  125. package/lib/global/js/hooks/useIsomorphicEffect.d.ts +2 -0
  126. package/lib/global/js/hooks/useIsomorphicEffect.js +18 -0
  127. package/lib/global/js/package-settings.d.ts +2 -0
  128. package/lib/global/js/package-settings.js +2 -0
  129. package/lib/index.js +10 -0
  130. package/lib/settings.d.ts +2 -0
  131. package/package.json +7 -7
  132. package/scss/components/BigNumbers/_big-numbers.scss +151 -0
  133. package/scss/components/BigNumbers/_carbon-imports.scss +11 -0
  134. package/scss/components/BigNumbers/_index-with-carbon.scss +9 -0
  135. package/scss/components/BigNumbers/_index.scss +8 -0
  136. package/scss/components/Datagrid/styles/_datagrid.scss +19 -0
  137. package/scss/components/FilterSummary/_filter-summary.scss +1 -1
  138. package/scss/components/FullPageError/_full-page-error.scss +20 -2
  139. package/scss/components/ProductiveCard/_productive-card.scss +1 -1
  140. package/scss/components/SidePanel/_side-panel.scss +1 -1
  141. package/scss/components/StringFormatter/_carbon-imports.scss +10 -0
  142. package/scss/components/StringFormatter/_index-with-carbon.scss +9 -0
  143. package/scss/components/StringFormatter/_index.scss +8 -0
  144. package/scss/components/StringFormatter/_string-formatter.scss +97 -0
  145. package/scss/components/Tearsheet/_tearsheet.scss +34 -2
  146. package/scss/components/UserAvatar/_user-avatar.scss +47 -4
  147. package/scss/components/_index-with-carbon.scss +2 -0
  148. package/scss/components/_index.scss +2 -0
  149. package/es/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.d.ts +0 -2
  150. package/es/node_modules/@carbon/icon-helpers/es/index.js +0 -140
  151. package/es/node_modules/@carbon/icons-react/es/Icon.js +0 -73
  152. package/es/node_modules/@carbon/icons-react/es/generated/bucket-0.js +0 -2985
  153. package/es/node_modules/@carbon/icons-react/es/generated/bucket-3.js +0 -2900
  154. package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3004
  155. package/es/node_modules/@carbon/icons-react/es/iconPropTypes-4cbeb95d.js +0 -14
  156. package/lib/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.d.ts +0 -2
  157. package/lib/node_modules/@carbon/icon-helpers/es/index.js +0 -145
  158. package/lib/node_modules/@carbon/icons-react/es/Icon.js +0 -81
  159. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-0.js +0 -3117
  160. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-3.js +0 -3032
  161. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3136
  162. package/lib/node_modules/@carbon/icons-react/es/iconPropTypes-4cbeb95d.js +0 -18
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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 { usePrefix } from '@carbon/react';
9
+ import { pkg } from '../../../settings.js';
10
+ import { useCallback, useEffect } from 'react';
11
+
12
+ var useFocus = function useFocus(modalRef) {
13
+ var carbonPrefix = usePrefix();
14
+ var tearsheetBaseClass = "".concat(pkg.prefix, "--tearsheet");
15
+ // Querying focusable element in the modal
16
+ // Query to exclude hidden elements in the modal from querySelectorAll() method
17
+ // feel free to include more if needed :)
18
+ var notQuery = ":not(.".concat(carbonPrefix, "--visually-hidden,.").concat(tearsheetBaseClass, "__header--no-close-icon,.").concat(carbonPrefix, "--btn--disabled,[aria-hidden=\"true\"],[tabindex=\"-1\"])");
19
+ // Queries to include element types button, input, select, textarea
20
+ var queryButton = "button".concat(notQuery);
21
+ var queryInput = "input".concat(notQuery);
22
+ var querySelect = "select".concat(notQuery);
23
+ var queryTextarea = "textarea".concat(notQuery);
24
+ var queryLink = "[href]".concat(notQuery);
25
+ // Final query
26
+ var query = "".concat(queryButton, ",").concat(queryLink, ",").concat(queryInput, ",").concat(querySelect, ",").concat(queryTextarea);
27
+ var modalEl = modalRef === null || modalRef === void 0 ? void 0 : modalRef.current;
28
+ var getFocusable = useCallback(function () {
29
+ // Selecting all focusable elements based on the above conditions
30
+ var focusableElements = modalEl === null || modalEl === void 0 ? void 0 : modalEl.querySelectorAll("".concat(query));
31
+ var first = focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements[0];
32
+ var last = focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements[(focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements.length) - 1];
33
+ var all = focusableElements;
34
+ return {
35
+ first: first,
36
+ last: last,
37
+ all: all
38
+ };
39
+ }, [modalEl, query]);
40
+ useEffect(function () {
41
+ getFocusable();
42
+ }, [getFocusable]);
43
+ var handleKeyDown = function handleKeyDown(event) {
44
+ // Checking whether the key is tab or not
45
+ if (event.key === 'Tab') {
46
+ // updating the focusable elements list
47
+ var _getFocusable = getFocusable(),
48
+ first = _getFocusable.first,
49
+ last = _getFocusable.last,
50
+ all = _getFocusable.all;
51
+ setTimeout(function () {
52
+ var _document, _document2;
53
+ if (event.shiftKey && !Array.prototype.includes.call(all, (_document = document) === null || _document === void 0 ? void 0 : _document.activeElement)) {
54
+ // Prevents the default "Tab" behavior
55
+ event.preventDefault();
56
+ // if the user press shift+tab and the current element not in focusable items
57
+ last === null || last === void 0 || last.focus();
58
+ } else if (!Array.prototype.includes.call(all, (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.activeElement)) {
59
+ event.preventDefault();
60
+ // user pressing tab key only then
61
+ // focusing the first element if the current element is not in focusable items
62
+ first === null || first === void 0 || first.focus();
63
+ }
64
+ }, 0);
65
+ }
66
+ };
67
+ return {
68
+ firstElement: getFocusable().first,
69
+ lastElement: getFocusable().last,
70
+ allElements: getFocusable().all,
71
+ keyDownListener: handleKeyDown,
72
+ getFocusable: getFocusable
73
+ };
74
+ };
75
+
76
+ export { useFocus };
@@ -0,0 +1,2 @@
1
+ export const useIsomorphicEffect: typeof useEffect;
2
+ import { useEffect } from 'react';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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 { useLayoutEffect, useEffect } from 'react';
9
+
10
+ // Originally from `@carbon/react`, https://github.com/carbon-design-system/carbon/blob/main/packages/react/src/internal/useIsomorphicEffect.js
11
+ // useLayoutEffect on the client, useEffect on the server
12
+ var useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
13
+
14
+ export { useIsomorphicEffect };
@@ -75,9 +75,11 @@ declare namespace defaults {
75
75
  let EditTearsheetNarrow: boolean;
76
76
  let EditFullPage: boolean;
77
77
  let EditUpdateCards: boolean;
78
+ let BigNumbers: boolean;
78
79
  let TruncatedList: boolean;
79
80
  let DelimitedList: boolean;
80
81
  let FullPageError: boolean;
82
+ let StringFormatter: boolean;
81
83
  let Coachmark: boolean;
82
84
  let CoachmarkBeacon: boolean;
83
85
  let CoachmarkButton: boolean;
@@ -74,9 +74,11 @@ var defaults = {
74
74
  EditTearsheetNarrow: false,
75
75
  EditFullPage: false,
76
76
  EditUpdateCards: false,
77
+ BigNumbers: false,
77
78
  TruncatedList: false,
78
79
  DelimitedList: false,
79
80
  FullPageError: false,
81
+ StringFormatter: false,
80
82
  /* new component flags here - comment used by generate CLI */
81
83
 
82
84
  // Novice to pro components not yet reviewed and released:
package/es/index.js CHANGED
@@ -99,6 +99,7 @@ export { InlineTip } from './components/InlineTip/InlineTip.js';
99
99
  export { InlineTipButton } from './components/InlineTip/InlineTipButton.js';
100
100
  export { InlineTipLink } from './components/InlineTip/InlineTipLink.js';
101
101
  export { NonLinearReading } from './components/NonLinearReading/NonLinearReading.js';
102
+ export { BigNumbers } from './components/BigNumbers/BigNumbers.js';
102
103
  export { TruncatedList } from './components/TruncatedList/TruncatedList.js';
103
104
  export { InterstitialScreen } from './components/InterstitialScreen/InterstitialScreen.js';
104
105
  export { InterstitialScreenView } from './components/InterstitialScreenView/InterstitialScreenView.js';
@@ -106,4 +107,5 @@ export { InterstitialScreenViewModule } from './components/InterstitialScreenVie
106
107
  export { DelimitedList } from './components/DelimitedList/DelimitedList.js';
107
108
  export { FullPageError } from './components/FullPageError/FullPageError.js';
108
109
  export { SearchBar } from './components/SearchBar/SearchBar.js';
110
+ export { StringFormatter } from './components/StringFormatter/StringFormatter.js';
109
111
  export { UserAvatar } from './components/UserAvatar/UserAvatar.js';
package/es/settings.d.ts CHANGED
@@ -61,9 +61,11 @@ export const pkg: {
61
61
  EditTearsheetNarrow: boolean;
62
62
  EditFullPage: boolean;
63
63
  EditUpdateCards: boolean;
64
+ BigNumbers: boolean;
64
65
  TruncatedList: boolean;
65
66
  DelimitedList: boolean;
66
67
  FullPageError: boolean;
68
+ StringFormatter: boolean;
67
69
  Coachmark: boolean;
68
70
  CoachmarkBeacon: boolean;
69
71
  CoachmarkButton: boolean;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * BigNumbers is used to display large values in a small area. The display of
3
+ * values can be the value itself, or grouped in a numerator / denominator fashion.
4
+ * Control over the total fraction decimals displayed as well as how the
5
+ * values/totals are displayed are done via a locale prop. Other optional props
6
+ * allow control over size, truncation, if the value is a percentage, the addition
7
+ * of a button as well as tool tip functionality.
8
+ * The default locale is English (`en-US`) if one is not provided or if the provided one is not supported.
9
+ */
10
+ export let BigNumbers: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
11
+ import React from 'react';
@@ -0,0 +1,244 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
+ var React = require('react');
14
+ var index$1 = require('../../node_modules/prop-types/index.js');
15
+ var index = require('../../node_modules/classnames/index.js');
16
+ var devtools = require('../../global/js/utils/devtools.js');
17
+ var settings = require('../../settings.js');
18
+ var icons = require('@carbon/react/icons');
19
+ var react = require('@carbon/react');
20
+ var constants = require('./constants.js');
21
+ var TooltipTrigger = require('../TooltipTrigger/TooltipTrigger.js');
22
+
23
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
24
+
25
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
+
27
+ var _Information;
28
+ var _excluded = ["className", "forceShowTotal", "fractionDigits", "iconButton", "loading", "label", "locale", "percentage", "size", "tooltipDescription", "total", "trending", "truncate", "value"],
29
+ _excluded2 = ["className", "size"];
30
+
31
+ // The block part of our conventional BEM class names (blockClass__E--M).
32
+ var blockClass = "".concat(settings.pkg.prefix, "--big-numbers");
33
+ var skeletonBlockClass = "".concat(settings.pkg.prefix, "--big-numbers-skeleton");
34
+ var componentName = 'BigNumbers';
35
+
36
+ // NOTE: the component SCSS is not imported here: it is rolled up separately.
37
+
38
+ // Default values for props
39
+ var defaults = {
40
+ forceShowTotal: false,
41
+ fractionDigits: 1,
42
+ loading: false,
43
+ locale: constants.DefaultLocale,
44
+ percentage: false,
45
+ size: constants.BigNumbersSize.Default,
46
+ total: 0,
47
+ trending: false,
48
+ truncate: true,
49
+ value: null
50
+ };
51
+
52
+ /**
53
+ * BigNumbers is used to display large values in a small area. The display of
54
+ * values can be the value itself, or grouped in a numerator / denominator fashion.
55
+ * Control over the total fraction decimals displayed as well as how the
56
+ * values/totals are displayed are done via a locale prop. Other optional props
57
+ * allow control over size, truncation, if the value is a percentage, the addition
58
+ * of a button as well as tool tip functionality.
59
+ * The default locale is English (`en-US`) if one is not provided or if the provided one is not supported.
60
+ */
61
+ exports.BigNumbers = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
62
+ var _formatValue, _formatValue2;
63
+ var className = _ref.className,
64
+ _ref$forceShowTotal = _ref.forceShowTotal,
65
+ forceShowTotal = _ref$forceShowTotal === void 0 ? defaults.forceShowTotal : _ref$forceShowTotal,
66
+ _ref$fractionDigits = _ref.fractionDigits,
67
+ fractionDigits = _ref$fractionDigits === void 0 ? defaults.fractionDigits : _ref$fractionDigits,
68
+ iconButton = _ref.iconButton,
69
+ _ref$loading = _ref.loading,
70
+ loading = _ref$loading === void 0 ? defaults.loading : _ref$loading,
71
+ label = _ref.label,
72
+ _ref$locale = _ref.locale,
73
+ locale = _ref$locale === void 0 ? defaults.locale : _ref$locale,
74
+ _ref$percentage = _ref.percentage,
75
+ percentage = _ref$percentage === void 0 ? defaults.percentage : _ref$percentage,
76
+ _ref$size = _ref.size,
77
+ size = _ref$size === void 0 ? defaults.size : _ref$size,
78
+ tooltipDescription = _ref.tooltipDescription,
79
+ _ref$total = _ref.total,
80
+ total = _ref$total === void 0 ? defaults.total : _ref$total,
81
+ _ref$trending = _ref.trending,
82
+ trending = _ref$trending === void 0 ? defaults.trending : _ref$trending,
83
+ _ref$truncate = _ref.truncate,
84
+ truncate = _ref$truncate === void 0 ? defaults.truncate : _ref$truncate,
85
+ _ref$value = _ref.value,
86
+ value = _ref$value === void 0 ? defaults.value : _ref$value,
87
+ rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
88
+ var BigNumbersClasses = index["default"](className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--lg"), size === constants.BigNumbersSize.Large), "".concat(blockClass, "--xl"), size === constants.BigNumbersSize.XLarge));
89
+ var supportedLocale = constants.getSupportedLocale(locale);
90
+ var truncatedValue = (_formatValue = constants.formatValue(supportedLocale, value, fractionDigits, truncate)) !== null && _formatValue !== void 0 ? _formatValue : constants.Characters.Dash;
91
+ var truncatedTotal = (_formatValue2 = constants.formatValue(supportedLocale, total, fractionDigits, truncate)) !== null && _formatValue2 !== void 0 ? _formatValue2 : 'Unknown';
92
+ var shouldDisplayDenominator = !percentage && total > value && truncatedValue !== truncatedTotal || forceShowTotal && total > 0;
93
+ if (loading) {
94
+ return /*#__PURE__*/React__default["default"].createElement(SkeletonBigNumbers, _rollupPluginBabelHelpers["extends"]({}, rest, {
95
+ ref: ref,
96
+ className: className,
97
+ size: size
98
+ }, devtools.getDevtoolsProps(componentName)));
99
+ }
100
+ return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
101
+ className: index["default"](blockClass, BigNumbersClasses, className),
102
+ ref: ref
103
+ }, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement("span", {
104
+ className: "".concat(blockClass, "__row")
105
+ }, /*#__PURE__*/React__default["default"].createElement("h4", {
106
+ className: "".concat(blockClass, "__label")
107
+ }, label), tooltipDescription && /*#__PURE__*/React__default["default"].createElement(react.Tooltip, {
108
+ description: tooltipDescription,
109
+ align: "right",
110
+ className: "".concat(blockClass, "__info")
111
+ }, /*#__PURE__*/React__default["default"].createElement(TooltipTrigger.TooltipTrigger, {
112
+ className: "".concat(blockClass, "__tooltip-trigger")
113
+ }, _Information || (_Information = /*#__PURE__*/React__default["default"].createElement(icons.Information, {
114
+ size: 16
115
+ }))))), /*#__PURE__*/React__default["default"].createElement("span", {
116
+ className: "".concat(blockClass, "__row"),
117
+ role: "math"
118
+ }, trending && /*#__PURE__*/React__default["default"].createElement(icons.ArrowUp, {
119
+ className: "".concat(blockClass, "__trend"),
120
+ size: constants.getIconSize(size)
121
+ }), /*#__PURE__*/React__default["default"].createElement("span", {
122
+ className: "".concat(blockClass, "__value")
123
+ }, percentage ? /*#__PURE__*/React__default["default"].createElement("div", {
124
+ className: "".concat(blockClass, "__percentage")
125
+ }, truncatedValue, /*#__PURE__*/React__default["default"].createElement("span", {
126
+ className: "".concat(blockClass, "__percentage-mark")
127
+ }, "%")) : truncatedValue), shouldDisplayDenominator && /*#__PURE__*/React__default["default"].createElement("span", {
128
+ className: "".concat(blockClass, "__total")
129
+ }, /*#__PURE__*/React__default["default"].createElement("span", null, constants.Characters.Slash, truncatedTotal)), iconButton));
130
+ });
131
+
132
+ // Return a placeholder if not released and not enabled by feature flag
133
+ exports.BigNumbers = settings.pkg.checkComponentEnabled(exports.BigNumbers, componentName);
134
+
135
+ // The display name of the component, used by React. Note that displayName
136
+ // is used in preference to relying on function.name.
137
+ exports.BigNumbers.displayName = componentName;
138
+
139
+ // The types and DocGen commentary for the component props,
140
+ // in alphabetical order (for consistency).
141
+ // See https://www.npmjs.com/package/prop-types#usage.
142
+ exports.BigNumbers.propTypes = {
143
+ /**
144
+ * Optional class name.
145
+ * @type number
146
+ */
147
+ className: index$1["default"].string,
148
+ /**
149
+ * Display the `total` even when the `value` is equal to
150
+ * the `total` when `forceShowTotal` prop is true on the
151
+ * condition that the `total` is greater than 0.
152
+ * @type bool
153
+ */
154
+ forceShowTotal: index$1["default"].bool,
155
+ /**
156
+ * Optional value to control the maximum fraction digits
157
+ * used when truncating the value and total.
158
+ * @type number
159
+ */
160
+ fractionDigits: index$1["default"].number,
161
+ /** Displays an iconButton next to the BigNumbers value
162
+ * @type node
163
+ */
164
+ iconButton: index$1["default"].node,
165
+ /**
166
+ * Text label for BigNumbers.
167
+ * @type string
168
+ */
169
+ label: index$1["default"].string.isRequired,
170
+ /** Specify if the BigNumbers is in a loading state
171
+ * @type bool
172
+ */
173
+ loading: index$1["default"].bool,
174
+ /**
175
+ * Locale value to determine approach to formatting numbers.
176
+ * @type string
177
+ */
178
+ locale: index$1["default"].string,
179
+ /**
180
+ * Format number to percentage when `percentage` prop is true.
181
+ * @type bool
182
+ */
183
+ percentage: index$1["default"].bool,
184
+ /** The size of the BigNumbers.
185
+ * @type string
186
+ */
187
+ size: index$1["default"].oneOf(Object.values(constants.BigNumbersSize)),
188
+ /** Label applied to a Tooltip - marked with the Information icon.
189
+ * @type string
190
+ */
191
+ tooltipDescription: index$1["default"].string,
192
+ /**
193
+ * Total value that the main BigNumbers value is a subset of.
194
+ * @type number
195
+ */
196
+ total: index$1["default"].number,
197
+ /** Display trending icon.
198
+ * @type boolean
199
+ */
200
+ trending: index$1["default"].bool,
201
+ /** Specify whether or not the values should be truncated.
202
+ * @type boolean
203
+ */
204
+ truncate: index$1["default"].bool,
205
+ /**
206
+ * The main BigNumbers value to display
207
+ * @type number
208
+ */
209
+ value: index$1["default"].number
210
+ };
211
+
212
+ /**
213
+ * SkeletonBigNumbers is used to display a skeleton version while
214
+ * content is loading (handled by the BigNumbers prop `loading').
215
+ *
216
+ * Note: This component is only used within BigNumbers.
217
+ */
218
+ var SkeletonBigNumbers = /*#__PURE__*/React__default["default"].forwardRef(function (_ref2, ref) {
219
+ var className = _ref2.className,
220
+ size = _ref2.size,
221
+ rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref2, _excluded2);
222
+ var BigNumbersSkeletonClasses = index["default"](className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(skeletonBlockClass, "--lg"), size === constants.BigNumbersSize.Large), "".concat(skeletonBlockClass, "--xl"), size === constants.BigNumbersSize.XLarge));
223
+ return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
224
+ className: index["default"](className, skeletonBlockClass, BigNumbersSkeletonClasses),
225
+ ref: ref
226
+ }, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement(react.SkeletonText, {
227
+ className: "".concat(skeletonBlockClass, "__label")
228
+ }), /*#__PURE__*/React__default["default"].createElement(react.SkeletonText, {
229
+ heading: true,
230
+ className: "".concat(skeletonBlockClass, "__value"),
231
+ width: "80%"
232
+ }));
233
+ });
234
+ SkeletonBigNumbers.propTypes = {
235
+ /**
236
+ * Optional class name.
237
+ * @type number
238
+ */
239
+ className: index$1["default"].string,
240
+ /** The size of the BigNumbers.
241
+ * @type string
242
+ */
243
+ size: index$1["default"].oneOf(Object.values(constants.BigNumbersSize))
244
+ };
@@ -0,0 +1,13 @@
1
+ export namespace BigNumbersSize {
2
+ let Default: string;
3
+ let Large: string;
4
+ let XLarge: string;
5
+ }
6
+ export namespace Characters {
7
+ let Dash: string;
8
+ let Slash: string;
9
+ }
10
+ export const DefaultLocale: "en-US";
11
+ export function formatValue(locale: string, value: number, fractionDigits: number, truncate: boolean): string | null;
12
+ export function getIconSize(size: string): 16 | 20 | 24;
13
+ export function getSupportedLocale(locale: string): string;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ /* **************************** | CONSTANTS | ***************************** */
13
+
14
+ var BigNumbersSize = {
15
+ Default: 'default',
16
+ Large: 'lg',
17
+ XLarge: 'xl'
18
+ };
19
+ var Characters = {
20
+ Dash: '–',
21
+ Slash: '/'
22
+ };
23
+ var DefaultLocale = 'en-US';
24
+
25
+ /* ************************ | UTILITY FUNCTIONS | ************************* */
26
+
27
+ /**
28
+ * Ensure that the value is formatted correctly based on whether it should be truncated or not.
29
+ * @param {string} locale Locale value to be used in formatting numbers.
30
+ * @param {number} value The value to format.
31
+ * @param {number} fractionDigits How many significant figures should be displayed.
32
+ * @param {boolean} truncate Whether or not the value should be truncated.
33
+ * @returns {string | null} The formatted value.
34
+ */
35
+ var formatValue = function formatValue(locale, value, fractionDigits, truncate) {
36
+ if (value === null || value === undefined || typeof value !== 'number') {
37
+ return null;
38
+ }
39
+ return truncate ? Intl.NumberFormat(locale, {
40
+ notation: 'compact',
41
+ minimumFractionDigits: 0,
42
+ maximumFractionDigits: Math.round(fractionDigits)
43
+ }).format(value) : Intl.NumberFormat(locale).format(value);
44
+ };
45
+
46
+ /**
47
+ * Function which takes a size and returns a numeric value for sizing icons
48
+ * @param {string} size Size of desired icon. Expected values are 'default', 'lg', or 'xl'.
49
+ */
50
+ var getIconSize = function getIconSize(size) {
51
+ switch (size) {
52
+ case BigNumbersSize.Large:
53
+ return 20;
54
+ case BigNumbersSize.XLarge:
55
+ return 24;
56
+ default:
57
+ return 16;
58
+ }
59
+ };
60
+
61
+ /**
62
+ * Function which takes a locale and returns a supported locale or the default
63
+ * @param {string} locale Desired locale for number formatting.
64
+ *
65
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#locales
66
+ */
67
+ var getSupportedLocale = function getSupportedLocale(locale) {
68
+ return Intl.NumberFormat.supportedLocalesOf(locale).length > 0 ? locale : DefaultLocale;
69
+ };
70
+
71
+ exports.BigNumbersSize = BigNumbersSize;
72
+ exports.Characters = Characters;
73
+ exports.DefaultLocale = DefaultLocale;
74
+ exports.formatValue = formatValue;
75
+ exports.getIconSize = getIconSize;
76
+ exports.getSupportedLocale = getSupportedLocale;
@@ -0,0 +1 @@
1
+ export { BigNumbers } from "./BigNumbers";
@@ -1,3 +1,18 @@
1
+ import React, { ReactNode } from 'react';
2
+ interface CascadeProps {
3
+ children: ReactNode;
4
+ /**
5
+ * Specify an optional className to be applied to
6
+ * the container node.
7
+ */
8
+ className?: string;
9
+ /**
10
+ * Specifies whether or not to wrap the child content in a `<Grid />`.
11
+ * If this is set to true it's important that the children are being wrapped in rows in columns.
12
+ * Check the documentation for additional clarification.
13
+ */
14
+ grid?: boolean;
15
+ }
1
16
  /**
2
17
 
3
18
  This pattern is intended for use with cards, tiles, or similarly styled
@@ -7,5 +22,7 @@ the page. It should not be used on a page if it is the secondary focus of the
7
22
  page as that will distract the user.
8
23
 
9
24
  */
10
- export let Cascade: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
11
- import React from 'react';
25
+ export declare let Cascade: React.ForwardRefExoticComponent<CascadeProps & {
26
+ children?: React.ReactNode;
27
+ } & React.RefAttributes<HTMLDivElement>>;
28
+ export {};
@@ -61,16 +61,19 @@ exports.Cascade = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
61
61
  if (grid) {
62
62
  var colIdx = 0;
63
63
  var gridElm = React__default["default"].Children.map(children, function (row) {
64
- var cols = React__default["default"].Children.map(row.props.children, function (col) {
65
- colIdx = colIdx + 1;
66
- var colClassnames = index["default"](col.props.className, "".concat(blockClass, "__col"), "".concat(blockClass, "__col-").concat(colIdx));
67
- return /*#__PURE__*/React__default["default"].cloneElement(col, {
68
- className: colClassnames
64
+ if ( /*#__PURE__*/React__default["default"].isValidElement(row)) {
65
+ var cols = React__default["default"].Children.map(row === null || row === void 0 ? void 0 : row.props.children, function (col) {
66
+ colIdx = colIdx + 1;
67
+ var colClassnames = index["default"](col.props.className, "".concat(blockClass, "__col"), "".concat(blockClass, "__col-").concat(colIdx));
68
+ return /*#__PURE__*/React__default["default"].cloneElement(col, {
69
+ className: colClassnames
70
+ });
69
71
  });
70
- });
71
- return /*#__PURE__*/React__default["default"].cloneElement(row, {
72
- children: cols
73
- });
72
+ return /*#__PURE__*/React__default["default"].cloneElement(row, {
73
+ children: cols
74
+ });
75
+ }
76
+ return children;
74
77
  });
75
78
  return /*#__PURE__*/React__default["default"].createElement("div", props, /*#__PURE__*/React__default["default"].createElement(react.Grid, null, gridElm));
76
79
  }
@@ -13,12 +13,11 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
13
13
  var React = require('react');
14
14
  var index$1 = require('../../node_modules/prop-types/index.js');
15
15
  var index = require('../../node_modules/classnames/index.js');
16
+ var icons = require('@carbon/react/icons');
16
17
  var react = require('@carbon/react');
17
18
  var context = require('./utils/context.js');
18
19
  var devtools = require('../../global/js/utils/devtools.js');
19
20
  var settings = require('../../settings.js');
20
- var bucket8 = require('../../node_modules/@carbon/icons-react/es/generated/bucket-8.js');
21
- var bucket3 = require('../../node_modules/@carbon/icons-react/es/generated/bucket-3.js');
22
21
 
23
22
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
24
23
 
@@ -59,14 +58,14 @@ exports.CoachmarkTagline = /*#__PURE__*/React__default["default"].forwardRef(fun
59
58
  type: "button"
60
59
  }, coachmark.buttonProps), /*#__PURE__*/React__default["default"].createElement("div", {
61
60
  className: "".concat(blockClass, "__idea")
62
- }, _Idea || (_Idea = /*#__PURE__*/React__default["default"].createElement(bucket8.Idea, {
61
+ }, _Idea || (_Idea = /*#__PURE__*/React__default["default"].createElement(icons.Idea, {
63
62
  size: 16
64
63
  }))), /*#__PURE__*/React__default["default"].createElement("div", null, title)), /*#__PURE__*/React__default["default"].createElement("div", {
65
64
  className: "".concat(blockClass, "--close-btn-container")
66
65
  }, /*#__PURE__*/React__default["default"].createElement(react.Button, {
67
66
  kind: "ghost",
68
67
  size: "sm",
69
- renderIcon: bucket3.Close,
68
+ renderIcon: icons.Close,
70
69
  iconDescription: closeIconDescription,
71
70
  hasIconOnly: true,
72
71
  className: "".concat(blockClass, "--close-btn"),
@@ -14,12 +14,12 @@ var React = require('react');
14
14
  var pconsole = require('../../global/js/utils/pconsole.js');
15
15
  var index$1 = require('../../node_modules/prop-types/index.js');
16
16
  var index = require('../../node_modules/classnames/index.js');
17
+ var icons = require('@carbon/react/icons');
17
18
  var react = require('@carbon/react');
18
19
  var devtools = require('../../global/js/utils/devtools.js');
19
20
  var settings = require('../../settings.js');
20
21
  var reactDom = require('react-dom');
21
22
  var CoachmarkHeader = require('../Coachmark/CoachmarkHeader.js');
22
- var bucket8 = require('../../node_modules/@carbon/icons-react/es/generated/bucket-8.js');
23
23
  var SteppedAnimatedMedia = require('../SteppedAnimatedMedia/SteppedAnimatedMedia.js');
24
24
 
25
25
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -82,7 +82,7 @@ exports.CoachmarkStackHome = /*#__PURE__*/React.forwardRef(function (_ref, ref)
82
82
  className: "".concat(overlayClass, "__body")
83
83
  }, /*#__PURE__*/React__default["default"].createElement("div", {
84
84
  className: "".concat(overlayClass, "-element")
85
- }, !media && /*#__PURE__*/React__default["default"].createElement(bucket8.Idea, {
85
+ }, !media && /*#__PURE__*/React__default["default"].createElement(icons.Idea, {
86
86
  size: 20,
87
87
  className: "".concat(blockClass, "__icon-idea")
88
88
  }), media && (media.render ? media.render() : /*#__PURE__*/React__default["default"].createElement(SteppedAnimatedMedia.SteppedAnimatedMedia, {
@@ -24,6 +24,7 @@ var checkActiveHeaderCell = require('./utils/checkActiveHeaderCell.js');
24
24
  var checkSelectedHeaderCell = require('./utils/checkSelectedHeaderCell.js');
25
25
  var handleHeaderCellSelection = require('./utils/handleHeaderCellSelection.js');
26
26
  var getSpreadsheetWidth = require('./utils/getSpreadsheetWidth.js');
27
+ var checkForHoldingKey = require('./utils/checkForHoldingKey.js');
27
28
  var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
28
29
  var useSpreadsheetMouseUp = require('./hooks/useSpreadsheetMouseUp.js');
29
30
 
@@ -212,8 +213,8 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
212
213
  var closestBodyCell = event.target.closest(".".concat(blockClass, "__body--td"));
213
214
  var isValidSelectionAreaStart = closestBodyCell.classList.contains("".concat(blockClass, "__body--td"));
214
215
  setValidStartingPoint(isValidSelectionAreaStart);
215
- var isHoldingCommandKey = event.metaKey || event.ctrlKey;
216
- var isHoldingShiftKey = event.shiftKey;
216
+ var isHoldingCommandKey = checkForHoldingKey.checkForHoldingKey(event, 'cmd');
217
+ var isHoldingShiftKey = checkForHoldingKey.checkForHoldingKey(event, 'shiftKey');
217
218
  setContainerHasFocus(true);
218
219
  var activeCoordinates = {
219
220
  row: cell.row.index,
@@ -315,7 +316,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
315
316
  }, [clickAndHoldActive, currentMatcher, setSelectionAreas]);
316
317
  var handleRowHeaderClick = React.useCallback(function (index) {
317
318
  return function (event) {
318
- var isHoldingCommandKey = event.metaKey || event.ctrlKey;
319
+ var isHoldingCommandKey = checkForHoldingKey.checkForHoldingKey(event, 'cmd');
319
320
  handleHeaderCellSelection.handleHeaderCellSelection({
320
321
  type: 'row',
321
322
  activeCellCoordinates: activeCellCoordinates,