@carbon/ibm-products 2.36.0-alpha.27 → 2.37.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. package/css/index-full-carbon.css +5404 -5117
  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 +4 -4
  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 +820 -61
  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 +329 -6
  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/_virtual/_rollupPluginBabelHelpers.js +9 -10
  18. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
  19. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
  20. package/es/components/Carousel/Carousel.d.ts +46 -2
  21. package/es/components/Carousel/Carousel.js +36 -21
  22. package/es/components/Carousel/CarouselItem.d.ts +19 -2
  23. package/es/components/Carousel/CarouselItem.js +0 -1
  24. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
  25. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +261 -0
  26. package/es/components/ConditionBuilder/ConditionBuilder.js +45 -16
  27. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
  28. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +40 -0
  29. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
  30. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +74 -0
  31. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
  32. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
  33. package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
  34. package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
  35. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
  36. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +112 -0
  37. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
  38. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +40 -0
  39. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
  40. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +151 -0
  41. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
  42. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +59 -0
  43. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
  44. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +52 -0
  45. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
  46. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +162 -0
  47. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
  48. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +40 -0
  49. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
  50. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +82 -0
  51. package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
  52. package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +85 -0
  53. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
  54. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +145 -0
  55. package/es/components/ConditionBuilder/utils/util.d.ts +4 -0
  56. package/es/components/ConditionBuilder/utils/util.js +16 -0
  57. package/es/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
  58. package/es/components/CreateTearsheet/CreateTearsheet.js +12 -32
  59. package/es/components/Datagrid/useParentDimensions.js +1 -1
  60. package/es/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
  61. package/es/components/EditUpdateCards/EditUpdateCards.js +3 -0
  62. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
  63. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
  64. package/es/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
  65. package/es/components/ExpressiveCard/ExpressiveCard.js +4 -0
  66. package/es/components/InlineTip/InlineTipButton.d.ts +21 -2
  67. package/es/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
  68. package/es/components/InterstitialScreen/InterstitialScreen.js +25 -14
  69. package/es/components/Nav/NavItem.js +1 -1
  70. package/es/components/NotificationsPanel/NotificationsPanel.js +5 -6
  71. package/es/components/PageHeader/PageHeader.js +12 -3
  72. package/es/components/SidePanel/SidePanel.js +1 -1
  73. package/es/components/SimpleHeader/SimpleHeader.d.ts +1 -5
  74. package/es/components/SimpleHeader/SimpleHeader.js +2 -4
  75. package/es/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
  76. package/es/components/Tearsheet/TearsheetShell.d.ts +119 -10
  77. package/es/components/Tearsheet/TearsheetShell.js +18 -8
  78. package/es/components/UserProfileImage/UserProfileImage.d.ts +66 -2
  79. package/es/components/UserProfileImage/UserProfileImage.js +5 -3
  80. package/es/components/WebTerminal/WebTerminal.d.ts +46 -2
  81. package/es/components/WebTerminal/WebTerminal.js +2 -2
  82. package/es/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
  83. package/es/global/js/hooks/usePrefersReducedMotion.js +28 -0
  84. package/es/global/js/utils/Wrap.d.ts +31 -2
  85. package/es/global/js/utils/Wrap.js +7 -9
  86. package/es/global/js/utils/getNodeTextContent.d.ts +1 -1
  87. package/es/global/js/utils/getNodeTextContent.js +1 -1
  88. package/es/global/js/utils/window.d.ts +2 -0
  89. package/es/global/js/utils/window.js +12 -0
  90. package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2780 -0
  91. package/lib/_virtual/_rollupPluginBabelHelpers.js +9 -10
  92. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
  93. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
  94. package/lib/components/Carousel/Carousel.d.ts +46 -2
  95. package/lib/components/Carousel/Carousel.js +35 -20
  96. package/lib/components/Carousel/CarouselItem.d.ts +19 -2
  97. package/lib/components/Carousel/CarouselItem.js +0 -1
  98. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
  99. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +270 -0
  100. package/lib/components/ConditionBuilder/ConditionBuilder.js +46 -17
  101. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
  102. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +48 -0
  103. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
  104. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +83 -0
  105. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
  106. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
  107. package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
  108. package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
  109. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
  110. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +121 -0
  111. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
  112. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +44 -0
  113. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
  114. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +159 -0
  115. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
  116. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +67 -0
  117. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
  118. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +60 -0
  119. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
  120. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +170 -0
  121. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
  122. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +48 -0
  123. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
  124. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +90 -0
  125. package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
  126. package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +93 -0
  127. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
  128. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +153 -0
  129. package/lib/components/ConditionBuilder/utils/util.d.ts +4 -0
  130. package/lib/components/ConditionBuilder/utils/util.js +20 -0
  131. package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
  132. package/lib/components/CreateTearsheet/CreateTearsheet.js +12 -32
  133. package/lib/components/Datagrid/useParentDimensions.js +1 -1
  134. package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
  135. package/lib/components/EditUpdateCards/EditUpdateCards.js +3 -0
  136. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
  137. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
  138. package/lib/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
  139. package/lib/components/ExpressiveCard/ExpressiveCard.js +4 -0
  140. package/lib/components/InlineTip/InlineTipButton.d.ts +21 -2
  141. package/lib/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
  142. package/lib/components/InterstitialScreen/InterstitialScreen.js +24 -13
  143. package/lib/components/Nav/NavItem.js +2 -2
  144. package/lib/components/NotificationsPanel/NotificationsPanel.js +5 -6
  145. package/lib/components/PageHeader/PageHeader.js +11 -2
  146. package/lib/components/SidePanel/SidePanel.js +1 -1
  147. package/lib/components/SimpleHeader/SimpleHeader.d.ts +1 -5
  148. package/lib/components/SimpleHeader/SimpleHeader.js +2 -4
  149. package/lib/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
  150. package/lib/components/Tearsheet/TearsheetShell.d.ts +119 -10
  151. package/lib/components/Tearsheet/TearsheetShell.js +16 -6
  152. package/lib/components/UserProfileImage/UserProfileImage.d.ts +66 -2
  153. package/lib/components/UserProfileImage/UserProfileImage.js +5 -3
  154. package/lib/components/WebTerminal/WebTerminal.d.ts +46 -2
  155. package/lib/components/WebTerminal/WebTerminal.js +2 -2
  156. package/lib/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
  157. package/lib/global/js/hooks/usePrefersReducedMotion.js +32 -0
  158. package/lib/global/js/utils/Wrap.d.ts +31 -2
  159. package/lib/global/js/utils/Wrap.js +7 -9
  160. package/lib/global/js/utils/getNodeTextContent.d.ts +1 -1
  161. package/lib/global/js/utils/getNodeTextContent.js +1 -1
  162. package/lib/global/js/utils/window.d.ts +2 -0
  163. package/lib/global/js/utils/window.js +16 -0
  164. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2912 -0
  165. package/package.json +5 -5
  166. package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -1
  167. package/scss/components/ConditionBuilder/_condition-builder.scss +26 -0
  168. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +46 -0
  169. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +194 -0
  170. package/scss/components/ConditionBuilder/styles/_index.scss +2 -0
  171. package/scss/components/Guidebanner/_guidebanner.scss +3 -0
  172. package/scss/components/InterstitialScreen/_interstitial-screen.scss +1 -6
  173. package/scss/components/Tearsheet/_tearsheet.scss +3 -1
  174. package/telemetry.yml +3 -0
  175. package/es/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
  176. package/es/global/js/utils/keyboardNavigation.d.ts +0 -27
  177. package/es/global/js/utils/keyboardNavigation.js +0 -33
  178. package/es/global/js/utils/wrapFocus.d.ts +0 -25
  179. package/es/global/js/utils/wrapFocus.js +0 -68
  180. package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3004
  181. package/lib/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
  182. package/lib/global/js/utils/keyboardNavigation.d.ts +0 -27
  183. package/lib/global/js/utils/keyboardNavigation.js +0 -39
  184. package/lib/global/js/utils/wrapFocus.d.ts +0 -25
  185. package/lib/global/js/utils/wrapFocus.js +0 -73
  186. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3136
@@ -18,7 +18,7 @@ import '../../global/js/utils/props-helper.js';
18
18
  import { TooltipTrigger } from '../TooltipTrigger/TooltipTrigger.js';
19
19
 
20
20
  var _TooltipTrigger;
21
- var _excluded = ["breadcrumbs", "className", "maxVisible", "noTrailingSlash", "overflowAriaLabel"],
21
+ var _excluded = ["breadcrumbs", "className", "maxVisible", "noTrailingSlash", "overflowAriaLabel", "overflowTooltipAlign"],
22
22
  _excluded2 = ["label", "key", "title", "id"],
23
23
  _excluded3 = ["className", "key", "label", "title"];
24
24
 
@@ -38,6 +38,7 @@ var BreadcrumbWithOverflow = function BreadcrumbWithOverflow(_ref) {
38
38
  maxVisible = _ref.maxVisible,
39
39
  noTrailingSlash = _ref.noTrailingSlash,
40
40
  overflowAriaLabel = _ref.overflowAriaLabel,
41
+ overflowTooltipAlign = _ref.overflowTooltipAlign,
41
42
  other = _objectWithoutProperties(_ref, _excluded);
42
43
  var carbonPrefix = usePrefix();
43
44
  var _useState = useState(3),
@@ -62,6 +63,7 @@ var BreadcrumbWithOverflow = function BreadcrumbWithOverflow(_ref) {
62
63
  return /*#__PURE__*/React__default.createElement(BreadcrumbItem, {
63
64
  key: "breadcrumb-overflow-".concat(internalId.current)
64
65
  }, /*#__PURE__*/React__default.createElement(OverflowMenu, {
66
+ align: overflowTooltipAlign,
65
67
  "aria-label": overflowAriaLabel,
66
68
  iconDescription: overflowAriaLabel // also needs setting to avoid a11y "Accessible name does not match or contain the visible label text"
67
69
  ,
@@ -319,7 +321,11 @@ BreadcrumbWithOverflow.propTypes = {
319
321
  overflowAriaLabel: PropTypes.string.isRequired.if(function (_ref6) {
320
322
  var breadcrumbs = _ref6.breadcrumbs;
321
323
  return breadcrumbs.length > 1;
322
- })
324
+ }),
325
+ /**
326
+ * overflowTooltipAlign: align tooltip position
327
+ */
328
+ overflowTooltipAlign: Tooltip.propTypes.align
323
329
  };
324
330
  BreadcrumbWithOverflow.displayName = componentName;
325
331
 
@@ -1,3 +1,47 @@
1
+ /**
2
+ * Copyright IBM Corp. 2023, 2023
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
+ import React, { ReactNode } from 'react';
8
+ interface CarouselProps {
9
+ /**
10
+ * Provide the contents of the Carousel.
11
+ */
12
+ children: ReactNode;
13
+ /**
14
+ * Provide an optional class to be applied to the containing node.
15
+ */
16
+ className?: string;
17
+ /**
18
+ * Disables the ability of the Carousel to scroll
19
+ * use a keyboard's left and right arrow keys.
20
+ */
21
+ disableArrowScroll?: boolean;
22
+ /**
23
+ * Enables the edges of the component to have faded styling.
24
+ *
25
+ * Pass a single string (`$color`) to specify the same color for left and right.
26
+ *
27
+ * Or pass an object (`{ left: $color1, right: $color2 }`) to specify different colors.
28
+ */
29
+ fadedEdgeColor?: string | {
30
+ left: string;
31
+ right: string;
32
+ };
33
+ /**
34
+ * An optional callback function that returns `true`
35
+ * when the carousel has enough content to be scrollable,
36
+ * and `false` when there is not enough content.
37
+ */
38
+ onChangeIsScrollable?: (isScrollable: boolean) => void;
39
+ /**
40
+ * An optional callback function that returns the scroll position as
41
+ * a value between 0 and 1.
42
+ */
43
+ onScroll?: (scrollPercent: number) => void;
44
+ }
1
45
  /**
2
46
  * The Carousel acts as a scaffold for other Novice to Pro content.
3
47
  *
@@ -14,5 +58,5 @@
14
58
  * 2. From the right-aligned position, when scrolling left,
15
59
  * the left-most item should again be left-aligned.
16
60
  */
17
- export const Carousel: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
18
- import React from 'react';
61
+ declare const Carousel: React.ForwardRefExoticComponent<CarouselProps & React.RefAttributes<HTMLDivElement>>;
62
+ export { Carousel };
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectWithoutProperties as _objectWithoutProperties, typeof as _typeof, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useRef, useCallback, useEffect, useImperativeHandle } from 'react';
10
10
  import PropTypes from '../../node_modules/prop-types/index.js';
11
11
  import { CarouselItem } from './CarouselItem.js';
@@ -14,7 +14,6 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
14
14
  import { pkg } from '../../settings.js';
15
15
 
16
16
  var _excluded = ["children", "className", "disableArrowScroll", "fadedEdgeColor", "onChangeIsScrollable", "onScroll"];
17
-
18
17
  // The block part of our conventional BEM class names (blockClass__E--M).
19
18
  var blockClass = "".concat(pkg.prefix, "--carousel");
20
19
  var componentName = 'Carousel';
@@ -53,29 +52,31 @@ var Carousel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
53
52
  _ref$onScroll = _ref.onScroll,
54
53
  onScroll = _ref$onScroll === void 0 ? defaults.onScroll : _ref$onScroll,
55
54
  rest = _objectWithoutProperties(_ref, _excluded);
56
- var carouselRef = useRef();
57
- var scrollRef = useRef();
55
+ var carouselRef = useRef(null);
56
+ var scrollRef = useRef(null);
58
57
  // Array of refs used to reference this component's children DOM elements
59
58
  var childElementsRef = useRef(Array(React__default.Children.count(children)).fill(useRef(null)));
60
- var leftFadedEdgeColor = (fadedEdgeColor === null || fadedEdgeColor === void 0 ? void 0 : fadedEdgeColor.left) || fadedEdgeColor;
61
- var rightFadedEdgeColor = (fadedEdgeColor === null || fadedEdgeColor === void 0 ? void 0 : fadedEdgeColor.right) || fadedEdgeColor;
59
+ var leftFadedEdgeColor = _typeof(fadedEdgeColor) === 'object' ? fadedEdgeColor === null || fadedEdgeColor === void 0 ? void 0 : fadedEdgeColor.left : fadedEdgeColor;
60
+ var rightFadedEdgeColor = _typeof(fadedEdgeColor) === 'object' ? fadedEdgeColor === null || fadedEdgeColor === void 0 ? void 0 : fadedEdgeColor.right : fadedEdgeColor;
62
61
 
63
62
  // Trigger callbacks to report state of the carousel
64
63
  var handleOnScroll = useCallback(function () {
64
+ var _scrollRef$current, _scrollRef$current2, _scrollRef$current3;
65
+ if (!scrollRef.current) {
66
+ return;
67
+ }
68
+
65
69
  // viewport's width
66
- var clientWidth = scrollRef.current.clientWidth;
70
+ var clientWidth = (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.clientWidth;
67
71
  // scroll position
68
- var scrollLeft = parseInt(scrollRef.current.scrollLeft, 10);
72
+ var scrollLeft = parseInt("".concat((_scrollRef$current2 = scrollRef.current) === null || _scrollRef$current2 === void 0 ? void 0 : _scrollRef$current2.scrollLeft), 10);
69
73
  // scrollable width
70
- var scrollWidth = scrollRef.current.scrollWidth;
74
+ var scrollWidth = (_scrollRef$current3 = scrollRef.current) === null || _scrollRef$current3 === void 0 ? void 0 : _scrollRef$current3.scrollWidth;
71
75
 
72
76
  // The maximum scrollLeft achievable is the scrollable width - the viewport width.
73
77
  var scrollLeftMax = scrollWidth - clientWidth;
74
78
  // if isNaN(scrollLeft / scrollLeftMax), then set to zero
75
79
  var scrollPercent = parseFloat((scrollLeft / scrollLeftMax).toFixed(2)) || 0;
76
- if (!scrollRef.current) {
77
- return;
78
- }
79
80
 
80
81
  // Callback 1: Does the carousel have enough content to enable scrolling?
81
82
  onChangeIsScrollable(scrollWidth > clientWidth);
@@ -95,7 +96,8 @@ var Carousel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
95
96
 
96
97
  // Get all elements that are visible in the container.
97
98
  var getElementsInView = useCallback(function () {
98
- var containerRect = scrollRef.current.getBoundingClientRect();
99
+ var _scrollRef$current4;
100
+ var containerRect = scrollRef === null || scrollRef === void 0 || (_scrollRef$current4 = scrollRef.current) === null || _scrollRef$current4 === void 0 ? void 0 : _scrollRef$current4.getBoundingClientRect();
99
101
  var inViewElements = childElementsRef.current.filter(function (el) {
100
102
  return getElementInView(containerRect, el.getBoundingClientRect());
101
103
  });
@@ -104,8 +106,9 @@ var Carousel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
104
106
 
105
107
  // Return container's and children's rect data
106
108
  var getContainerAndChildRectData = useCallback(function () {
109
+ var _scrollRef$current5;
107
110
  // Get the rect of the container
108
- var containerRect = scrollRef.current.getBoundingClientRect();
111
+ var containerRect = scrollRef === null || scrollRef === void 0 || (_scrollRef$current5 = scrollRef.current) === null || _scrollRef$current5 === void 0 ? void 0 : _scrollRef$current5.getBoundingClientRect();
109
112
  // Get all child elements that are in view of the container, and return their bounding rects.
110
113
  var elementRectsInView = getElementsInView().map(function (el) {
111
114
  return el.getBoundingClientRect();
@@ -123,27 +126,37 @@ var Carousel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
123
126
  };
124
127
  }, [getElementsInView]);
125
128
  var handleScrollNext = useCallback(function () {
129
+ if (!scrollRef.current) {
130
+ return;
131
+ }
126
132
  var _getContainerAndChild = getContainerAndChildRectData(),
127
133
  containerRect = _getContainerAndChild.containerRect,
128
134
  visibleWidth = _getContainerAndChild.visibleWidth;
129
135
  // Set the scrollValue to the visibleWidth, but if the visibleWidth value is 0, set it to the container's width
130
- var scrollValue = visibleWidth > 0 ? visibleWidth : containerRect.width;
136
+ var scrollValue = visibleWidth > 0 ? visibleWidth : containerRect === null || containerRect === void 0 ? void 0 : containerRect.width;
131
137
  // Increment the scrollLeft of the container
132
138
  scrollRef.current.scrollLeft += scrollValue;
133
139
  }, [getContainerAndChildRectData]);
134
140
  var handleScrollPrev = useCallback(function () {
141
+ var _containerRect$width, _containerRect$left;
142
+ if (!scrollRef.current) {
143
+ return;
144
+ }
135
145
  var _getContainerAndChild2 = getContainerAndChildRectData(),
136
146
  containerRect = _getContainerAndChild2.containerRect,
137
147
  elementRectsInView = _getContainerAndChild2.elementRectsInView,
138
148
  visibleWidth = _getContainerAndChild2.visibleWidth;
139
149
  // Set the scrollValue to the visibleWidth minus the first child's left value,
140
150
  // but if the visibleWidth value is 0, set it to the container's width plus the container's left value
141
- var scrollValue = visibleWidth > 0 ? visibleWidth - elementRectsInView[0].left : containerRect.width + containerRect.left;
151
+ var scrollValue = visibleWidth > 0 ? visibleWidth - elementRectsInView[0].left : ((_containerRect$width = containerRect === null || containerRect === void 0 ? void 0 : containerRect.width) !== null && _containerRect$width !== void 0 ? _containerRect$width : 0) + ((_containerRect$left = containerRect === null || containerRect === void 0 ? void 0 : containerRect.left) !== null && _containerRect$left !== void 0 ? _containerRect$left : 0);
142
152
 
143
153
  // Decrement the scrollLeft of the container
144
154
  scrollRef.current.scrollLeft -= scrollValue;
145
155
  }, [getContainerAndChildRectData]);
146
156
  var handleScrollReset = useCallback(function () {
157
+ if (!scrollRef.current) {
158
+ return;
159
+ }
147
160
  // This doesn't trigger "scrollend"...
148
161
  scrollRef.current.scrollLeft = 0;
149
162
  // ...so trigger a callback manually.
@@ -170,6 +183,9 @@ var Carousel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
170
183
  // On window.resize, reset carousel to zero.
171
184
  useEffect(function () {
172
185
  var handleWindowResize = function handleWindowResize() {
186
+ if (!scrollRef.current) {
187
+ return;
188
+ }
173
189
  scrollRef.current.scrollLeft = 0;
174
190
  handleOnScroll();
175
191
  };
@@ -185,9 +201,9 @@ var Carousel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
185
201
  handleOnScroll();
186
202
  };
187
203
  var scrollDiv = scrollRef.current;
188
- scrollDiv.addEventListener('scrollend', handleScrollend);
204
+ scrollDiv === null || scrollDiv === void 0 || scrollDiv.addEventListener('scrollend', handleScrollend);
189
205
  return function () {
190
- return scrollDiv.removeEventListener('scrollend', handleScrollend);
206
+ return scrollDiv === null || scrollDiv === void 0 ? void 0 : scrollDiv.removeEventListener('scrollend', handleScrollend);
191
207
  };
192
208
  }, [handleOnScroll]);
193
209
 
@@ -207,9 +223,7 @@ var Carousel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
207
223
  passive: false
208
224
  });
209
225
  return function () {
210
- scrollDiv.removeEventListener('wheel', handleWheel, {
211
- passive: false
212
- });
226
+ scrollDiv.removeEventListener('wheel', handleWheel);
213
227
  };
214
228
  }
215
229
  }, []);
@@ -305,6 +319,7 @@ Carousel.propTypes = {
305
319
  *
306
320
  * Or pass an object (`{ left: $color1, right: $color2 }`) to specify different colors.
307
321
  */
322
+ /**@ts-ignore*/
308
323
  fadedEdgeColor: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
309
324
  left: PropTypes.string,
310
325
  right: PropTypes.string
@@ -1,5 +1,22 @@
1
+ /**
2
+ * Copyright IBM Corp. 2023, 2023
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
+ import React, { ReactNode } from 'react';
8
+ interface CarouselItemProps {
9
+ /**
10
+ * Provide the contents of the CarouselItem.
11
+ */
12
+ children: ReactNode;
13
+ /**
14
+ * Provide an optional class to be applied to the containing node.
15
+ */
16
+ className?: string;
17
+ }
1
18
  /**
2
19
  * TODO: A description of the component.
3
20
  */
4
- export const CarouselItem: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
- import React from 'react';
21
+ declare const CarouselItem: React.ForwardRefExoticComponent<CarouselItemProps & React.RefAttributes<HTMLDivElement>>;
22
+ export { CarouselItem };
@@ -13,7 +13,6 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
13
13
  import { pkg } from '../../settings.js';
14
14
 
15
15
  var _excluded = ["children", "className"];
16
-
17
16
  // Carbon and package components we use.
18
17
  /* TODO: @import(s) of carbon components and other package components. */
19
18
 
@@ -0,0 +1,21 @@
1
+ export default ConditionBlock;
2
+ /**
3
+ * This component build each block of condition consisting of property, operator value and close button.
4
+ */
5
+ declare function ConditionBlock(props: any): import("react/jsx-runtime").JSX.Element;
6
+ declare namespace ConditionBlock {
7
+ namespace propTypes {
8
+ let addConditionHandler: PropTypes.Requireable<(...args: any[]) => any>;
9
+ let aria: PropTypes.Requireable<object>;
10
+ let conditionIndex: PropTypes.Requireable<number>;
11
+ let conjunction: PropTypes.Requireable<string>;
12
+ let group: PropTypes.Requireable<object>;
13
+ let isStatement: PropTypes.Requireable<boolean>;
14
+ let onChange: PropTypes.Requireable<(...args: any[]) => any>;
15
+ let onConnectorOperatorChange: PropTypes.Requireable<(...args: any[]) => any>;
16
+ let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
17
+ let onStatementChange: PropTypes.Requireable<(...args: any[]) => any>;
18
+ let state: PropTypes.Requireable<object>;
19
+ }
20
+ }
21
+ import PropTypes from 'prop-types';
@@ -0,0 +1,261 @@
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 { slicedToArray as _slicedToArray, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default, { useContext, useState } from 'react';
10
+ import { Close } from '@carbon/react/icons';
11
+ import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
12
+ import PropTypes from '../../../node_modules/prop-types/index.js';
13
+ import { blockClass, translateWithId, statementConfig, operatorConfig } from '../ConditionBuilderContext/DataConfigs.js';
14
+ import { ConditionBuilderItemOption } from '../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js';
15
+ import cx from 'classnames';
16
+ import ConditionConnector from '../ConditionConnector/ConditionConnector.js';
17
+ import { ConditionBuilderItemNumber } from '../ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js';
18
+ import { ConditionBuilderItemText } from '../ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js';
19
+ import { ConditionBuilderItemDate } from '../ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js';
20
+ import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
21
+ import { ConditionBuilderButton } from '../ConditionBuilderButton/ConditionBuilderButton.js';
22
+ import { focusThisField } from '../utils/util.js';
23
+ import { ConditionBuilderItemTime } from '../ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js';
24
+ import ConditionBuilderAdd from '../ConditionBuilderAdd/ConditionBuilderAdd.js';
25
+
26
+ /**
27
+ * This component build each block of condition consisting of property, operator value and close button.
28
+ */
29
+
30
+ var ConditionBlock = function ConditionBlock(props) {
31
+ var _props$state = props.state,
32
+ property = _props$state.property,
33
+ value = _props$state.value,
34
+ operator = _props$state.operator;
35
+ var onRemove = props.onRemove,
36
+ onChange = props.onChange,
37
+ state = props.state,
38
+ conjunction = props.conjunction,
39
+ onConnectorOperatorChange = props.onConnectorOperatorChange,
40
+ isStatement = props.isStatement,
41
+ group = props.group,
42
+ onStatementChange = props.onStatementChange,
43
+ addConditionHandler = props.addConditionHandler,
44
+ conditionIndex = props.conditionIndex;
45
+ var _useContext = useContext(ConditionBuilderContext),
46
+ inputConfig = _useContext.inputConfig;
47
+ var itemComponents = {
48
+ option: ConditionBuilderItemOption,
49
+ text: ConditionBuilderItemText,
50
+ number: ConditionBuilderItemNumber,
51
+ date: ConditionBuilderItemDate,
52
+ time: ConditionBuilderItemTime
53
+ };
54
+ var _useState = useState(false),
55
+ _useState2 = _slicedToArray(_useState, 2),
56
+ showDeletionPreview = _useState2[0],
57
+ setShowDeletionPreview = _useState2[1];
58
+
59
+ //filtering the current property to access its properties and config options
60
+ var getCurrentConfig = function getCurrentConfig(property) {
61
+ var _inputConfig$properti, _inputConfig$properti2;
62
+ return (_inputConfig$properti = (_inputConfig$properti2 = inputConfig.properties) === null || _inputConfig$properti2 === void 0 ? void 0 : _inputConfig$properti2.filter(function (eachProperty) {
63
+ var _eachProperty$label;
64
+ return ((_eachProperty$label = eachProperty.label) === null || _eachProperty$label === void 0 ? void 0 : _eachProperty$label.toUpperCase()) == (property === null || property === void 0 ? void 0 : property.toUpperCase());
65
+ })[0]) !== null && _inputConfig$properti !== void 0 ? _inputConfig$properti : {};
66
+ };
67
+ var isLastCondition = function isLastCondition(conditionIndex, conditionArr) {
68
+ return conditionIndex + 1 >= conditionArr.length || conditionArr.length - 1 != conditionIndex && conditionArr[conditionIndex + 1].conditions;
69
+ };
70
+ var _getCurrentConfig = getCurrentConfig(property),
71
+ icon = _getCurrentConfig.icon,
72
+ type = _getCurrentConfig.type,
73
+ config = _getCurrentConfig.config,
74
+ label = _getCurrentConfig.label;
75
+ var ItemComponent = property ? itemComponents[type] : null;
76
+ var onStatementChangeHandler = function onStatementChangeHandler(v, e) {
77
+ focusThisField(e);
78
+ onStatementChange(v);
79
+ };
80
+ var onConnectorOperatorChangeHandler = function onConnectorOperatorChangeHandler(op) {
81
+ onConnectorOperatorChange(op);
82
+ };
83
+ var onPropertyChangeHandler = function onPropertyChangeHandler(newProperty) {
84
+ onChange(_objectSpread2(_objectSpread2({}, state), {}, {
85
+ property: newProperty,
86
+ operator: undefined,
87
+ value: '',
88
+ popoverToOpen: 'operatorField'
89
+ }));
90
+ };
91
+ var onOperatorChangeHandler = function onOperatorChangeHandler(newOperator) {
92
+ onChange(_objectSpread2(_objectSpread2({}, state), {}, {
93
+ operator: newOperator,
94
+ value: undefined,
95
+ popoverToOpen: 'valueField'
96
+ }));
97
+ };
98
+ var onValueChangeHandler = function onValueChangeHandler(newValue) {
99
+ onChange(_objectSpread2(_objectSpread2({}, state), {}, {
100
+ value: newValue,
101
+ popoverToOpen: ''
102
+ }));
103
+ };
104
+ var handleShowDeletionPreview = function handleShowDeletionPreview() {
105
+ setShowDeletionPreview(true);
106
+ };
107
+ var handleHideDeletionPreview = function handleHideDeletionPreview() {
108
+ setShowDeletionPreview(false);
109
+ };
110
+ var getOperators = function getOperators() {
111
+ return operatorConfig.filter(function (operator) {
112
+ return operator.type.indexOf(type) != -1 || operator.type == 'all';
113
+ });
114
+ };
115
+ return /*#__PURE__*/React__default.createElement("div", {
116
+ className: cx("".concat(blockClass, "__condition-block conditionBlockWrapper ").concat(blockClass, "__gap ").concat(blockClass, "__gap-bottom"), _defineProperty({}, "".concat(blockClass, "__condition-builder-condition__deletion-preview"), showDeletionPreview)),
117
+ key: conditionIndex,
118
+ role: "row",
119
+ "aria-label": translateWithId('condition_row'),
120
+ tabIndex: -1
121
+ }, isStatement && /*#__PURE__*/React__default.createElement(ConditionBuilderItem
122
+ // open={false}
123
+ , {
124
+ label: group.statement,
125
+ title: translateWithId('condition'),
126
+ "data-name": "connectorField",
127
+ popOverClassName: "".concat(blockClass, "__gap"),
128
+ className: "".concat(blockClass, "__statement-button")
129
+ }, /*#__PURE__*/React__default.createElement(ConditionBuilderItemOption, {
130
+ conditionState: {
131
+ value: group.statement,
132
+ label: translateWithId('condition')
133
+ },
134
+ onChange: onStatementChangeHandler,
135
+ config: {
136
+ options: statementConfig
137
+ }
138
+ })), conjunction && /*#__PURE__*/React__default.createElement(ConditionConnector, {
139
+ className: "".concat(blockClass, "__gap"),
140
+ operator: conjunction,
141
+ onChange: onConnectorOperatorChangeHandler
142
+ }), /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
143
+ label: label,
144
+ title: translateWithId('property'),
145
+ renderIcon: icon !== null && icon !== void 0 ? icon : null,
146
+ className: "".concat(blockClass, "__property-field"),
147
+ "data-name": "propertyField",
148
+ state: state,
149
+ type: type
150
+ }, /*#__PURE__*/React__default.createElement(ConditionBuilderItemOption, {
151
+ conditionState: {
152
+ value: property,
153
+ label: translateWithId('property')
154
+ },
155
+ onChange: onPropertyChangeHandler,
156
+ config: {
157
+ options: inputConfig.properties
158
+ }
159
+ })), property && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
160
+ label: operator,
161
+ title: translateWithId('operator'),
162
+ "data-name": "operatorField",
163
+ state: state,
164
+ type: type
165
+ }, /*#__PURE__*/React__default.createElement(ConditionBuilderItemOption, {
166
+ config: {
167
+ options: getOperators()
168
+ },
169
+ conditionState: {
170
+ value: operator,
171
+ label: translateWithId('operator')
172
+ },
173
+ onChange: onOperatorChangeHandler
174
+ })), property && operator && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
175
+ label: value,
176
+ type: type,
177
+ title: label,
178
+ showToolTip: true,
179
+ "data-name": "valueField",
180
+ state: state,
181
+ config: config
182
+ }, /*#__PURE__*/React__default.createElement(ItemComponent, {
183
+ conditionState: {
184
+ property: property,
185
+ operator: operator,
186
+ value: value
187
+ },
188
+ onChange: onValueChangeHandler,
189
+ config: config
190
+ })), /*#__PURE__*/React__default.createElement("span", {
191
+ role: "gridcell",
192
+ "aria-label": translateWithId('remove_condition')
193
+ }, /*#__PURE__*/React__default.createElement(ConditionBuilderButton, {
194
+ hideLabel: true,
195
+ label: translateWithId('remove_condition'),
196
+ onClick: onRemove,
197
+ onMouseEnter: handleShowDeletionPreview,
198
+ onMouseLeave: handleHideDeletionPreview,
199
+ onFocus: handleShowDeletionPreview,
200
+ onBlur: handleHideDeletionPreview,
201
+ renderIcon: Close,
202
+ className: "".concat(blockClass, "__close-condition"),
203
+ "data-name": "closeCondition"
204
+ })), isLastCondition(conditionIndex, group.conditions) && /*#__PURE__*/React__default.createElement(ConditionBuilderAdd, {
205
+ onClick: function onClick() {
206
+ addConditionHandler(conditionIndex);
207
+ }
208
+ //addConditionSubGroupHandler={()=>{addConditionSubGroupHandler(conditionIndex)}}
209
+ ,
210
+ className: "".concat(blockClass, "__gap ").concat(blockClass, "__gap-left")
211
+ }));
212
+ };
213
+ var ConditionBlock$1 = ConditionBlock;
214
+ ConditionBlock.propTypes = {
215
+ /**
216
+ * callback to add a new condition
217
+ */
218
+ addConditionHandler: PropTypes.func,
219
+ /**
220
+ * object hold aria attributes
221
+ */
222
+ aria: PropTypes.object,
223
+ /**
224
+ * index of the current condition
225
+ */
226
+ conditionIndex: PropTypes.number,
227
+ /**
228
+ * string that decides to show the condition connector
229
+ */
230
+ conjunction: PropTypes.string,
231
+ /**
232
+ * object that hold the current group object where is condition is part of
233
+ */
234
+ group: PropTypes.object,
235
+ /**
236
+ * boolean that decides to show the statement(if/ excl.if)
237
+ */
238
+ isStatement: PropTypes.bool,
239
+ /**
240
+ * callback to update the current condition of the state tree
241
+ */
242
+ onChange: PropTypes.func,
243
+ /**
244
+ * callback to handle the connector(and/or) change
245
+ */
246
+ onConnectorOperatorChange: PropTypes.func,
247
+ /**
248
+ * callback for Remove a condition
249
+ */
250
+ onRemove: PropTypes.func,
251
+ /**
252
+ * callback to handle the statement(if/ excl.if) change
253
+ */
254
+ onStatementChange: PropTypes.func,
255
+ /**
256
+ * object that hold the current condition
257
+ */
258
+ state: PropTypes.object
259
+ };
260
+
261
+ export { ConditionBlock$1 as default };