@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
@@ -0,0 +1,11 @@
1
+ export function ConditionBuilderItemText({ conditionState, onChange }: {
2
+ conditionState: any;
3
+ onChange: any;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ export namespace ConditionBuilderItemText {
6
+ namespace propTypes {
7
+ let conditionState: PropTypes.Requireable<object>;
8
+ let onChange: PropTypes.Requireable<(...args: any[]) => any>;
9
+ }
10
+ }
11
+ import PropTypes from 'prop-types';
@@ -0,0 +1,40 @@
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 React__default from 'react';
9
+ import { TextInput } from '@carbon/react';
10
+ import PropTypes from '../../../../node_modules/prop-types/index.js';
11
+ import { blockClass } from '../../ConditionBuilderContext/DataConfigs.js';
12
+
13
+ var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
14
+ var _conditionState$value, _conditionState$prope;
15
+ var conditionState = _ref.conditionState,
16
+ _onChange = _ref.onChange;
17
+ return /*#__PURE__*/React__default.createElement("div", {
18
+ className: "".concat(blockClass, "__condition-builder-item-text")
19
+ }, /*#__PURE__*/React__default.createElement(TextInput, {
20
+ labelText: conditionState.property,
21
+ hideLabel: true,
22
+ value: (_conditionState$value = conditionState.value) !== null && _conditionState$value !== void 0 ? _conditionState$value : '',
23
+ id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
24
+ onChange: function onChange(e) {
25
+ _onChange(e.target.value);
26
+ }
27
+ }));
28
+ };
29
+ ConditionBuilderItemText.propTypes = {
30
+ /**
31
+ * current condition object
32
+ */
33
+ conditionState: PropTypes.object,
34
+ /**
35
+ * callback to update state oin date change
36
+ */
37
+ onChange: PropTypes.func
38
+ };
39
+
40
+ export { ConditionBuilderItemText };
@@ -0,0 +1,11 @@
1
+ export function ConditionBuilderItemTime({ onChange, config }: {
2
+ onChange: any;
3
+ config: any;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ export namespace ConditionBuilderItemTime {
6
+ namespace propTypes {
7
+ let config: PropTypes.Requireable<object>;
8
+ let onChange: PropTypes.Requireable<(...args: any[]) => any>;
9
+ }
10
+ }
11
+ import PropTypes from 'prop-types';
@@ -0,0 +1,82 @@
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 } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default, { useState, useEffect } from 'react';
10
+ import { TimePicker, TimePickerSelect, SelectItem } from '@carbon/react';
11
+ import PropTypes from '../../../../node_modules/prop-types/index.js';
12
+ import { blockClass } from '../../ConditionBuilderContext/DataConfigs.js';
13
+
14
+ var _SelectItem, _SelectItem2;
15
+ var ConditionBuilderItemTime = function ConditionBuilderItemTime(_ref) {
16
+ var _config$timeZones, _config$timeZones2;
17
+ var onChange = _ref.onChange,
18
+ config = _ref.config;
19
+ var _useState = useState(''),
20
+ _useState2 = _slicedToArray(_useState, 2),
21
+ timeValue = _useState2[0],
22
+ setTimeValue = _useState2[1];
23
+ var _useState3 = useState('AM'),
24
+ _useState4 = _slicedToArray(_useState3, 2),
25
+ dayZoneValue = _useState4[0],
26
+ setDayZoneValue = _useState4[1];
27
+ var _useState5 = useState(config === null || config === void 0 || (_config$timeZones = config.timeZones) === null || _config$timeZones === void 0 ? void 0 : _config$timeZones[0]),
28
+ _useState6 = _slicedToArray(_useState5, 2),
29
+ timeZoneValue = _useState6[0],
30
+ setTimeZoneValue = _useState6[1];
31
+ useEffect(function () {
32
+ var timeToUpdate = "".concat(timeValue !== null && timeValue !== void 0 ? timeValue : '', " ").concat(dayZoneValue !== null && dayZoneValue !== void 0 ? dayZoneValue : '', " ").concat(timeZoneValue !== null && timeZoneValue !== void 0 ? timeZoneValue : '');
33
+ onChange(timeValue ? timeToUpdate : undefined);
34
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35
+ }, [timeValue, dayZoneValue, timeZoneValue]);
36
+ var setTimeZone = function setTimeZone(e) {
37
+ setTimeZoneValue(e.target.value);
38
+ };
39
+ var setDayZone = function setDayZone(e) {
40
+ setDayZoneValue(e.target.value);
41
+ };
42
+ var setTime = function setTime(e) {
43
+ setTimeValue(e.target.value);
44
+ };
45
+ return /*#__PURE__*/React__default.createElement("div", {
46
+ className: "".concat(blockClass, "__condition-builder-item-time")
47
+ }, /*#__PURE__*/React__default.createElement(TimePicker, {
48
+ id: "time-picker",
49
+ labelText: "Select a time",
50
+ onChange: setTime
51
+ }, /*#__PURE__*/React__default.createElement(TimePickerSelect, {
52
+ id: "time-picker-day-zone",
53
+ onChange: setDayZone
54
+ }, _SelectItem || (_SelectItem = /*#__PURE__*/React__default.createElement(SelectItem, {
55
+ value: "AM",
56
+ text: "AM"
57
+ })), _SelectItem2 || (_SelectItem2 = /*#__PURE__*/React__default.createElement(SelectItem, {
58
+ value: "PM",
59
+ text: "PM"
60
+ }))), /*#__PURE__*/React__default.createElement(TimePickerSelect, {
61
+ id: "time-picker-select-2",
62
+ onChange: setTimeZone
63
+ }, config === null || config === void 0 || (_config$timeZones2 = config.timeZones) === null || _config$timeZones2 === void 0 ? void 0 : _config$timeZones2.map(function (timeZone, index) {
64
+ return /*#__PURE__*/React__default.createElement(SelectItem, {
65
+ key: index,
66
+ value: timeZone,
67
+ text: timeZone
68
+ });
69
+ }))));
70
+ };
71
+ ConditionBuilderItemTime.propTypes = {
72
+ /**
73
+ * current config object that this property is part of
74
+ */
75
+ config: PropTypes.object,
76
+ /**
77
+ * callback to update state oin date change
78
+ */
79
+ onChange: PropTypes.func
80
+ };
81
+
82
+ export { ConditionBuilderItemTime };
@@ -0,0 +1,15 @@
1
+ export default ConditionConnector;
2
+ declare function ConditionConnector({ operator, className, onChange, ...rest }: {
3
+ [x: string]: any;
4
+ operator: any;
5
+ className: any;
6
+ onChange: any;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ declare namespace ConditionConnector {
9
+ namespace propTypes {
10
+ let className: PropTypes.Requireable<string>;
11
+ let onChange: PropTypes.Requireable<(...args: any[]) => any>;
12
+ let operator: PropTypes.Requireable<string>;
13
+ }
14
+ }
15
+ import PropTypes from 'prop-types';
@@ -0,0 +1,85 @@
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 { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default, { useCallback } from 'react';
10
+ import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
11
+ import { ConditionBuilderItemOption } from '../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js';
12
+ import { translateWithId, connectorConfig } from '../ConditionBuilderContext/DataConfigs.js';
13
+ import { pkg } from '../../../settings.js';
14
+ import PropTypes from '../../../node_modules/prop-types/index.js';
15
+ import { focusThisField } from '../utils/util.js';
16
+
17
+ var _excluded = ["operator", "className", "onChange"];
18
+ var blockClass = "".concat(pkg.prefix, "--condition-builder");
19
+ function ConditionConnector(_ref) {
20
+ var operator = _ref.operator,
21
+ className = _ref.className,
22
+ onChange = _ref.onChange,
23
+ rest = _objectWithoutProperties(_ref, _excluded);
24
+ var handleConnectorHover = useCallback(function (parentGroup, isHover) {
25
+ if (isHover) {
26
+ parentGroup.classList.add('hoveredConnector');
27
+ } else {
28
+ parentGroup.classList.remove('hoveredConnector');
29
+ }
30
+ }, []);
31
+ var activeConnectorHandler = function activeConnectorHandler(e) {
32
+ var parentGroup = e.currentTarget.closest('.eachGroup');
33
+ handleConnectorHover(parentGroup, true);
34
+ };
35
+ var inActiveConnectorHandler = function inActiveConnectorHandler(e) {
36
+ var parentGroup = e.currentTarget.closest('.eachGroup');
37
+ handleConnectorHover(parentGroup, false);
38
+ };
39
+ var onChangeHandler = function onChangeHandler(op, e) {
40
+ onChange(op);
41
+ focusThisField(e);
42
+ };
43
+ return (
44
+ /*#__PURE__*/
45
+ // <div className={className} {...rest}>
46
+ React__default.createElement(ConditionBuilderItem, _extends({
47
+ label: operator,
48
+ title: translateWithId('connector'),
49
+ "data-name": "connectorField",
50
+ onMouseEnter: activeConnectorHandler,
51
+ onMouseLeave: inActiveConnectorHandler,
52
+ onFocus: activeConnectorHandler,
53
+ onBlur: inActiveConnectorHandler
54
+ }, rest, {
55
+ popOverClassName: className,
56
+ className: "".concat(blockClass, "__connector-button ")
57
+ }), /*#__PURE__*/React__default.createElement(ConditionBuilderItemOption, {
58
+ config: {
59
+ options: connectorConfig
60
+ },
61
+ conditionState: {
62
+ value: operator,
63
+ label: translateWithId('connector')
64
+ },
65
+ onChange: onChangeHandler
66
+ }))
67
+ // </div>
68
+ );
69
+ }
70
+ ConditionConnector.propTypes = {
71
+ /**
72
+ * Provide an optional class to be applied to the containing node.
73
+ */
74
+ className: PropTypes.string,
75
+ /**
76
+ * callback to update the current condition of the state tree
77
+ */
78
+ onChange: PropTypes.func,
79
+ /**
80
+ * string that defines the connector operator (and/or)
81
+ */
82
+ operator: PropTypes.string
83
+ };
84
+
85
+ export { ConditionConnector as default };
@@ -0,0 +1,24 @@
1
+ export default ConditionGroupBuilder;
2
+ /**
3
+ *
4
+ * state - this is the current group that is being rendered . This can be a inner group or outer group
5
+ * All the inner components of group are called from here.
6
+ * @returns
7
+ */
8
+ declare function ConditionGroupBuilder({ state, aria, onRemove, onChange, conditionBuilderRef, }: {
9
+ state: any;
10
+ aria: any;
11
+ onRemove: any;
12
+ onChange: any;
13
+ conditionBuilderRef: any;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ declare namespace ConditionGroupBuilder {
16
+ namespace propTypes {
17
+ let aria: PropTypes.Requireable<object>;
18
+ let conditionBuilderRef: PropTypes.Requireable<object>;
19
+ let onChange: PropTypes.Requireable<(...args: any[]) => any>;
20
+ let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
21
+ let state: PropTypes.Requireable<object>;
22
+ }
23
+ }
24
+ import PropTypes from 'prop-types';
@@ -0,0 +1,145 @@
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 { objectSpread2 as _objectSpread2, toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default from 'react';
10
+ import ConditionBlock from '../ConditionBlock/ConditionBlock.js';
11
+ import PropTypes from '../../../node_modules/prop-types/index.js';
12
+ import { blockClass, translateWithId } from '../ConditionBuilderContext/DataConfigs.js';
13
+
14
+ /**
15
+ *
16
+ * state - this is the current group that is being rendered . This can be a inner group or outer group
17
+ * All the inner components of group are called from here.
18
+ * @returns
19
+ */
20
+ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
21
+ var _state$conditions;
22
+ var state = _ref.state,
23
+ aria = _ref.aria,
24
+ onRemove = _ref.onRemove,
25
+ onChange = _ref.onChange,
26
+ conditionBuilderRef = _ref.conditionBuilderRef;
27
+ var onRemoveHandler = function onRemoveHandler(conditionIndex, e) {
28
+ if (state.conditions.length > 1) {
29
+ onChange(_objectSpread2(_objectSpread2({}, state), {}, {
30
+ conditions: state.conditions.filter(function (condition, cIndex) {
31
+ return conditionIndex !== cIndex;
32
+ })
33
+ }));
34
+ handleFocusOnClose(e);
35
+ } else {
36
+ onRemove();
37
+ }
38
+ };
39
+ var onChangeHandler = function onChangeHandler(updatedConditions, conditionIndex) {
40
+ onChange(_objectSpread2(_objectSpread2({}, state), {}, {
41
+ conditions: state.conditions.map(function (condition, cIndex) {
42
+ return conditionIndex === cIndex ? updatedConditions : condition;
43
+ })
44
+ }));
45
+ };
46
+ var addConditionHandler = function addConditionHandler(conditionIndex) {
47
+ onChange(_objectSpread2(_objectSpread2({}, state), {}, {
48
+ conditions: [].concat(_toConsumableArray(state.conditions.slice(0, conditionIndex + 1)), [{
49
+ property: undefined,
50
+ operator: '',
51
+ value: '',
52
+ popoverToOpen: 'propertyField'
53
+ }], _toConsumableArray(state.conditions.slice(conditionIndex + 1)))
54
+ }));
55
+ };
56
+ var handleFocusOnClose = function handleFocusOnClose(e) {
57
+ var _e$currentTarget;
58
+ var previousClose = (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.closest('[role="row"]')) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.previousSibling) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.querySelector('[data-name="closeCondition"]');
59
+ if (previousClose) {
60
+ previousClose.focus();
61
+ }
62
+ };
63
+ return /*#__PURE__*/React__default.createElement("div", {
64
+ className: " ".concat(blockClass, "__condition-builder__group eachGroup")
65
+ }, /*#__PURE__*/React__default.createElement("div", {
66
+ className: "".concat(blockClass, "__condition-wrapper"),
67
+ role: "grid",
68
+ "aria-label": translateWithId('condition_builder_group')
69
+ }, state === null || state === void 0 || (_state$conditions = state.conditions) === null || _state$conditions === void 0 ? void 0 : _state$conditions.map(function (eachCondition, conditionIndex) {
70
+ return /*#__PURE__*/React__default.createElement("div", {
71
+ key: conditionIndex
72
+ }, eachCondition.conditions && /*#__PURE__*/React__default.createElement(ConditionGroupBuilder, {
73
+ aria: {
74
+ level: aria.level + 1,
75
+ posinset: conditionIndex + 1,
76
+ setsize: state.conditions.length
77
+ },
78
+ state: eachCondition,
79
+ onChange: function onChange(updatedConditions) {
80
+ onChangeHandler(updatedConditions, conditionIndex);
81
+ },
82
+ onRemove: function onRemove(e) {
83
+ onRemoveHandler(conditionIndex, e);
84
+ },
85
+ conditionBuilderRef: conditionBuilderRef,
86
+ key: conditionIndex
87
+ }), !eachCondition.conditions && /*#__PURE__*/React__default.createElement(ConditionBlock, {
88
+ key: conditionIndex,
89
+ conjunction: conditionIndex > 0 ? state.groupOperator : undefined,
90
+ aria: {
91
+ level: aria.level + 1,
92
+ posinset: conditionIndex + 1,
93
+ setsize: state.conditions.length
94
+ },
95
+ isStatement: conditionIndex == 0,
96
+ state: eachCondition,
97
+ group: state,
98
+ conditionIndex: conditionIndex,
99
+ className: "".concat(blockClass, "__gap ").concat(blockClass, "__gap-bottom"),
100
+ onChange: function onChange(updatedConditions) {
101
+ onChangeHandler(updatedConditions, conditionIndex);
102
+ },
103
+ addConditionHandler: addConditionHandler,
104
+ onRemove: function onRemove(e) {
105
+ onRemoveHandler(conditionIndex, e);
106
+ },
107
+ onConnectorOperatorChange: function onConnectorOperatorChange(op) {
108
+ onChange(_objectSpread2(_objectSpread2({}, state), {}, {
109
+ groupOperator: op
110
+ }));
111
+ },
112
+ onStatementChange: function onStatementChange(updatedStatement) {
113
+ onChange(_objectSpread2(_objectSpread2({}, state), {}, {
114
+ statement: updatedStatement
115
+ }));
116
+ }
117
+ }));
118
+ })));
119
+ };
120
+ var ConditionGroupBuilder$1 = ConditionGroupBuilder;
121
+ ConditionGroupBuilder.propTypes = {
122
+ /**
123
+ * object contains the aria attributes
124
+ */
125
+ aria: PropTypes.object,
126
+ /**
127
+ * ref of condition builder
128
+ */
129
+ conditionBuilderRef: PropTypes.object,
130
+ /**
131
+
132
+ * callback to update the current condition of the state tree
133
+ */
134
+ onChange: PropTypes.func,
135
+ /**
136
+ * call back to remove the particular group from the state tree
137
+ */
138
+ onRemove: PropTypes.func,
139
+ /**
140
+ * state defines the current group
141
+ */
142
+ state: PropTypes.object
143
+ };
144
+
145
+ export { ConditionGroupBuilder$1 as default };
@@ -0,0 +1,4 @@
1
+ export function focusThisField(e: any): void;
2
+ export function focusThisItem(currentElement: any): void;
3
+ export function traverseClockVise(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any): void;
4
+ export function traverseReverse(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any): void;
@@ -0,0 +1,16 @@
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
+ var focusThisField = function focusThisField(e) {
9
+ setTimeout(function () {
10
+ var _e$target$closest, _e$target$closest2;
11
+ (_e$target$closest = e.target.closest('[role="gridcell"]')) === null || _e$target$closest === void 0 || (_e$target$closest = _e$target$closest.querySelector('button')) === null || _e$target$closest === void 0 || _e$target$closest.click();
12
+ (_e$target$closest2 = e.target.closest('[role="gridcell"]')) === null || _e$target$closest2 === void 0 || (_e$target$closest2 = _e$target$closest2.querySelector('button')) === null || _e$target$closest2 === void 0 || _e$target$closest2.focus();
13
+ }, 0);
14
+ };
15
+
16
+ export { focusThisField };
@@ -1,4 +1,106 @@
1
- export const StepsContext: React.Context<null>;
2
- export const StepNumberContext: React.Context<number>;
3
- export let CreateTearsheet: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
4
- import React from 'react';
1
+ /**
2
+ * Copyright IBM Corp. 2021, 2022
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, PropsWithChildren, Dispatch, SetStateAction } from 'react';
8
+ export interface StepsContextType {
9
+ currentStep: number;
10
+ setIsDisabled: Dispatch<SetStateAction<boolean>>;
11
+ setOnPrevious: (fn: any) => void;
12
+ setOnNext: (fn: any) => void;
13
+ setOnMount: (fn: any) => void;
14
+ setStepData: Dispatch<SetStateAction<Step[]>>;
15
+ stepData: Step[];
16
+ }
17
+ export declare const StepsContext: React.Context<StepsContextType | null>;
18
+ export declare const StepNumberContext: React.Context<number>;
19
+ interface CreateTearsheetProps extends PropsWithChildren {
20
+ /**
21
+ * The back button text
22
+ */
23
+ backButtonText: string;
24
+ /**
25
+ * The cancel button text
26
+ */
27
+ cancelButtonText: string;
28
+ /**
29
+ * The main content of the tearsheet
30
+ */
31
+ /**
32
+ * An optional class or classes to be added to the outermost element.
33
+ */
34
+ className?: string;
35
+ /**
36
+ * A description of the flow, displayed in the header area of the tearsheet.
37
+ */
38
+ description?: ReactNode;
39
+ /**
40
+ * Specifies elements to focus on first on render.
41
+ */
42
+ firstFocusElement?: string;
43
+ /**
44
+ * Used to set the size of the influencer
45
+ */
46
+ influencerWidth?: 'narrow' | 'wide';
47
+ /**
48
+ * This can be used to open the component to a step other than the first step.
49
+ * For example, a create flow was previously in progress, data was saved, and
50
+ * is now being completed.
51
+ */
52
+ initialStep?: number;
53
+ /**
54
+ * A label for the tearsheet, displayed in the header area of the tearsheet
55
+ * to maintain context for the tearsheet (e.g. as the title changes from page
56
+ * to page of a multi-page task).
57
+ */
58
+ label?: ReactNode;
59
+ /**
60
+ * The next button text
61
+ */
62
+ nextButtonText: string;
63
+ /**
64
+ * An optional handler that is called when the user closes the tearsheet (by
65
+ * clicking the close button, if enabled, or clicking outside, if enabled).
66
+ * Returning `false` here prevents the modal from closing.
67
+ */
68
+ onClose?: () => void;
69
+ /**
70
+ * Specify a handler for submitting the multi step tearsheet (final step).
71
+ * This function can _optionally_ return a promise that is either resolved or rejected and the CreateTearsheet will handle the submitting state of the create button.
72
+ */
73
+ onRequestSubmit: () => void;
74
+ /**
75
+ * Specifies whether the tearsheet is currently open.
76
+ */
77
+ open?: boolean;
78
+ /**
79
+ * **Experimental:** Provide a `Slug` component to be rendered inside the `Tearsheet` component
80
+ */
81
+ slug?: ReactNode;
82
+ /**
83
+ * The submit button text
84
+ */
85
+ submitButtonText: string;
86
+ /**
87
+ * The main title of the tearsheet, displayed in the header area.
88
+ */
89
+ title?: ReactNode;
90
+ /**
91
+ * The position of the top of tearsheet in the viewport. The 'normal'
92
+ * position (the default) is a short distance down from the top of the
93
+ * viewport, leaving room at the top for a global header bar to show through
94
+ * from below. The 'lower' position provides a little extra room at the top
95
+ * to allow an action bar navigation or breadcrumbs to also show through.
96
+ */
97
+ verticalPosition?: 'normal' | 'lower';
98
+ }
99
+ interface Step {
100
+ introStep?: boolean;
101
+ secondaryLabel?: string;
102
+ shouldIncludeStep?: boolean;
103
+ title?: string;
104
+ }
105
+ export declare let CreateTearsheet: React.ForwardRefExoticComponent<CreateTearsheetProps & React.RefAttributes<HTMLDivElement>>;
106
+ export {};