@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,121 @@
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 settings = require('../../../settings.js');
13
+ var translationObject = require('./translationObject.js');
14
+
15
+ var statementConfig = [{
16
+ label: 'if',
17
+ id: 'if'
18
+ }, {
19
+ label: 'excl.if',
20
+ id: 'excl.if'
21
+ }];
22
+ var connectorConfig = [{
23
+ label: 'and',
24
+ id: 'and'
25
+ }, {
26
+ label: 'or',
27
+ id: 'or'
28
+ }];
29
+ //op types : option, text, number, date,
30
+ var operatorConfig = [{
31
+ label: 'is',
32
+ id: 'is',
33
+ type: 'all'
34
+ }, {
35
+ label: 'is greater than',
36
+ id: 'greater',
37
+ type: 'number'
38
+ }, {
39
+ label: 'is greater than or equal to',
40
+ id: 'greater-equal',
41
+ type: 'number'
42
+ }, {
43
+ label: 'is lower than',
44
+ id: 'lower',
45
+ type: 'number'
46
+ }, {
47
+ label: 'is lower than or equal to',
48
+ id: 'lower-equal',
49
+ type: 'number'
50
+ }, {
51
+ label: 'starts with',
52
+ id: 'starts-with',
53
+ type: 'text'
54
+ }, {
55
+ label: 'ends with',
56
+ id: 'ends-with',
57
+ type: 'text'
58
+ }, {
59
+ label: 'contains',
60
+ id: 'contains',
61
+ type: 'text'
62
+ }, {
63
+ label: 'is one of',
64
+ id: 'one-of',
65
+ type: 'option'
66
+ }, {
67
+ label: 'is before',
68
+ id: 'before',
69
+ type: 'date,time'
70
+ }, {
71
+ label: 'is after',
72
+ id: 'after',
73
+ type: 'date,time'
74
+ }, {
75
+ label: 'is between',
76
+ id: 'between',
77
+ type: 'date'
78
+ }];
79
+ // The block part of our conventional BEM class names (blockClass__E--M).
80
+ var blockClass = "".concat(settings.pkg.prefix, "--condition-builder");
81
+ var formatDate = function formatDate(date) {
82
+ var day = String(date.getDate()).padStart(2, '0');
83
+ var month = String(date.getMonth() + 1).padStart(2, '0');
84
+ var year = date.getFullYear();
85
+ return "".concat(day, "/").concat(month, "/").concat(year);
86
+ };
87
+ var translationsObjectCurrent = translationObject.translationsObject['en']; // TO DO: need to discuss if language is to be passed as prop
88
+ var translateWithId = function translateWithId(key) {
89
+ var _translationsObjectCu;
90
+ return (_translationsObjectCu = translationsObjectCurrent[key]) !== null && _translationsObjectCu !== void 0 ? _translationsObjectCu : key;
91
+ };
92
+ var valueRenderers = {
93
+ text: function text(val) {
94
+ return val;
95
+ },
96
+ time: function time(val) {
97
+ return val;
98
+ },
99
+ number: function number(val, config) {
100
+ return config.unit && val ? "".concat(val, " ").concat(config.unit) : val;
101
+ },
102
+ option: function option(value) {
103
+ return Array.isArray(value) ? value.join(', ') : value;
104
+ },
105
+ date: function date(value) {
106
+ if (Array.isArray(value) && value.length > 1) {
107
+ var start = value !== null && value !== void 0 && value[0] ? formatDate(new Date(value[0])) : '';
108
+ var end = value !== null && value !== void 0 && value[1] ? formatDate(new Date(value[1])) : '';
109
+ return "".concat(start, " To ").concat(end);
110
+ } else {
111
+ return value && new Date(value) ? formatDate(new Date(value)) : value;
112
+ }
113
+ }
114
+ };
115
+
116
+ exports.blockClass = blockClass;
117
+ exports.connectorConfig = connectorConfig;
118
+ exports.operatorConfig = operatorConfig;
119
+ exports.statementConfig = statementConfig;
120
+ exports.translateWithId = translateWithId;
121
+ exports.valueRenderers = valueRenderers;
@@ -0,0 +1,31 @@
1
+ export namespace translationsObject {
2
+ let en: {
3
+ if: string;
4
+ 'excl-if': string;
5
+ and: string;
6
+ or: string;
7
+ is: string;
8
+ greater: string;
9
+ 'greater-equal': string;
10
+ lower: string;
11
+ 'lower-equal': string;
12
+ 'starts-with': string;
13
+ 'ends-with': string;
14
+ contains: string;
15
+ 'one-of': string;
16
+ before: string;
17
+ after: string;
18
+ between: string;
19
+ 'add-condition': string;
20
+ condition: string;
21
+ property: string;
22
+ operator: string;
23
+ connector: string;
24
+ condition_row: string;
25
+ remove_condition: string;
26
+ add_condition_row: string;
27
+ start: string;
28
+ end: string;
29
+ clear_search: string;
30
+ };
31
+ }
@@ -0,0 +1,44 @@
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 translationsObject = {
13
+ en: {
14
+ if: 'if',
15
+ 'excl-if': 'excl.if',
16
+ and: 'and',
17
+ or: 'or',
18
+ is: 'is',
19
+ greater: 'is greater than',
20
+ 'greater-equal': 'is greater than or equal to',
21
+ lower: 'is lower than',
22
+ 'lower-equal': 'is lower than or equal to',
23
+ 'starts-with': 'starts with',
24
+ 'ends-with': 'ends with',
25
+ contains: 'contains',
26
+ 'one-of': 'is one of',
27
+ before: 'is before',
28
+ after: 'is after',
29
+ between: 'is between',
30
+ 'add-condition': 'Add Condition',
31
+ condition: 'Condition',
32
+ property: 'Property',
33
+ operator: 'Operator',
34
+ connector: 'Connector',
35
+ condition_row: 'Condition row',
36
+ remove_condition: 'Remove condition',
37
+ add_condition_row: 'Add condition row',
38
+ start: 'Start',
39
+ end: 'End',
40
+ clear_search: 'Clear search input'
41
+ }
42
+ };
43
+
44
+ exports.translationsObject = translationsObject;
@@ -0,0 +1,28 @@
1
+ export function ConditionBuilderItem({ children, className, label, renderIcon, title, type, showToolTip, state, popOverClassName, config, ...rest }: {
2
+ [x: string]: any;
3
+ children: any;
4
+ className: any;
5
+ label: any;
6
+ renderIcon: any;
7
+ title: any;
8
+ type: any;
9
+ showToolTip: any;
10
+ state: any;
11
+ popOverClassName: any;
12
+ config: any;
13
+ }): import("react/jsx-runtime").JSX.Element;
14
+ export namespace ConditionBuilderItem {
15
+ namespace propTypes {
16
+ let children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
17
+ let className: PropTypes.Requireable<string>;
18
+ let config: PropTypes.Requireable<object>;
19
+ let label: PropTypes.Requireable<NonNullable<string | any[] | null | undefined>>;
20
+ let popOverClassName: PropTypes.Requireable<string>;
21
+ let renderIcon: PropTypes.Requireable<object>;
22
+ let showToolTip: PropTypes.Requireable<boolean>;
23
+ let state: PropTypes.Requireable<object>;
24
+ let title: PropTypes.Requireable<string>;
25
+ let type: PropTypes.Requireable<string>;
26
+ }
27
+ }
28
+ import PropTypes from 'prop-types';
@@ -0,0 +1,159 @@
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 react = require('@carbon/react');
15
+ var index = require('../../../node_modules/prop-types/index.js');
16
+ var icons = require('@carbon/react/icons');
17
+ var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
18
+ var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
19
+
20
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
+
22
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
+
24
+ var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "state", "popOverClassName", "config"];
25
+ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
26
+ var children = _ref.children,
27
+ className = _ref.className,
28
+ label = _ref.label,
29
+ renderIcon = _ref.renderIcon,
30
+ title = _ref.title,
31
+ type = _ref.type,
32
+ showToolTip = _ref.showToolTip,
33
+ state = _ref.state,
34
+ popOverClassName = _ref.popOverClassName,
35
+ config = _ref.config,
36
+ rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
37
+ var contentRef = React.useRef(null);
38
+ var _useState = React.useState(label),
39
+ _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
40
+ propertyLabel = _useState2[0],
41
+ setPropertyLabel = _useState2[1];
42
+ var _useState3 = React.useState(false),
43
+ _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
44
+ open = _useState4[0],
45
+ setOpen = _useState4[1];
46
+ React.useEffect(function () {
47
+ var propertyId = rest['data-name'] == 'valueField' && type ? DataConfigs.valueRenderers[type](label, config) : label;
48
+ setPropertyLabel(DataConfigs.translateWithId(propertyId));
49
+ // eslint-disable-next-line react-hooks/exhaustive-deps
50
+ }, [label]);
51
+ React.useEffect(function () {
52
+ /**
53
+ * rest['data-name'] holds the current field name
54
+ * popoverToOpen hold the next popover to be opened if required
55
+ */
56
+ if (state) {
57
+ var currentField = rest['data-name'];
58
+ //if any condition is changed, state prop is triggered
59
+ if (state.popoverToOpen && currentField !== state.popoverToOpen) {
60
+ // close the previous popover
61
+ setOpen(false);
62
+ } else if (currentField == 'valueField' && type == 'option' && state.operator !== 'one-of') {
63
+ //close the current popover if the field is valueField and is a single select dropdown. For all other inputs ,popover need to be open on value changes.
64
+ setOpen(false);
65
+ }
66
+ if (state.popoverToOpen == currentField) {
67
+ //current popover need to be opened
68
+ setOpen(true);
69
+ }
70
+ } else {
71
+ // when we change any statement(if/ excl.if) which is not part of condition state, label change is triggered.
72
+ //close popOver when statement is changed.
73
+ setOpen(false);
74
+ }
75
+ // eslint-disable-next-line react-hooks/exhaustive-deps
76
+ }, [state, label]);
77
+ React.useEffect(function () {
78
+ //this will focus the first input field in the popover
79
+ if (open && contentRef.current) {
80
+ var firstFocusableElement = contentRef.current.querySelector('input, button,li');
81
+ if (firstFocusableElement) {
82
+ firstFocusableElement.focus();
83
+ }
84
+ }
85
+ }, [contentRef, open]);
86
+ return /*#__PURE__*/React__default["default"].createElement(react.Popover, {
87
+ open: open,
88
+ isTabTip: true,
89
+ role: "gridcell",
90
+ className: popOverClassName,
91
+ onRequestClose: function onRequestClose() {
92
+ setOpen(false);
93
+ }
94
+ }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
95
+ label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : DataConfigs.translateWithId('add-condition'),
96
+ hideLabel: !label ? true : false,
97
+ onClick: function onClick() {
98
+ setOpen(!open);
99
+ },
100
+ className: className,
101
+ "aria-haspopup": true,
102
+ "aria-expanded": open,
103
+ renderIcon: renderIcon ? renderIcon : label == undefined ? icons.Add : null,
104
+ showToolTip: showToolTip
105
+ }, rest)), /*#__PURE__*/React__default["default"].createElement(react.PopoverContent, {
106
+ className: "".concat(DataConfigs.blockClass, "__condition-builder-item__content"),
107
+ role: "dialog",
108
+ "aria-label": "".concat(title)
109
+ }, /*#__PURE__*/React__default["default"].createElement(react.Layer, null, /*#__PURE__*/React__default["default"].createElement("h1", {
110
+ className: "".concat(DataConfigs.blockClass, "__condition-builder-item__title")
111
+ }, title), /*#__PURE__*/React__default["default"].createElement("div", {
112
+ ref: contentRef
113
+ }, open && children))));
114
+ };
115
+ ConditionBuilderItem.propTypes = {
116
+ /**
117
+ * provide the contents of the popover
118
+ */
119
+ children: index["default"].node,
120
+ /**
121
+ * Provide an optional class to be applied to the containing node.
122
+ */
123
+ className: index["default"].string,
124
+ /**
125
+ * this is the config object again the current property from inputConfig
126
+ */
127
+
128
+ config: index["default"].object,
129
+ /**
130
+ * text to be displayed in the field
131
+ */
132
+ label: index["default"].oneOfType([index["default"].string, index["default"].array]),
133
+ /**
134
+ * class name for popover
135
+ */
136
+ popOverClassName: index["default"].string,
137
+ /**
138
+ * Optional prop to allow overriding the icon rendering.
139
+ */
140
+ renderIcon: index["default"].oneOfType([index["default"].func, index["default"].object]),
141
+ /**
142
+ * show tool tip
143
+ */
144
+ showToolTip: index["default"].bool,
145
+ /**
146
+ * current condition state object
147
+ */
148
+ state: index["default"].object,
149
+ /**
150
+ * title of the popover
151
+ */
152
+ title: index["default"].string,
153
+ /**
154
+ * input type
155
+ */
156
+ type: index["default"].string
157
+ };
158
+
159
+ exports.ConditionBuilderItem = ConditionBuilderItem;
@@ -0,0 +1,11 @@
1
+ export function ConditionBuilderItemDate({ conditionState, onChange }: {
2
+ conditionState: any;
3
+ onChange: any;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ export namespace ConditionBuilderItemDate {
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,67 @@
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 React = require('react');
13
+ var react = require('@carbon/react');
14
+ var settings = require('../../../../settings.js');
15
+ var index = require('../../../../node_modules/prop-types/index.js');
16
+ var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
17
+
18
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
+
20
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
+
22
+ var blockClass = "".concat(settings.pkg.prefix, "--condition-builder");
23
+ var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
24
+ var conditionState = _ref.conditionState,
25
+ onChange = _ref.onChange;
26
+ var DatePickerInputRef = React.useRef();
27
+ var datePickerType = conditionState.operator == 'between' ? 'range' : 'single';
28
+ return /*#__PURE__*/React__default["default"].createElement("div", {
29
+ className: "".concat(blockClass, "__condition-builder-item-date ")
30
+ }, datePickerType == 'single' && /*#__PURE__*/React__default["default"].createElement(react.DatePicker, {
31
+ ref: DatePickerInputRef,
32
+ dateFormat: "d/m/Y",
33
+ datePickerType: "single",
34
+ onClose: onChange,
35
+ value: conditionState.value
36
+ }, /*#__PURE__*/React__default["default"].createElement(react.DatePickerInput, {
37
+ id: "datePicker",
38
+ placeholder: "dd/mm/yyyy",
39
+ labelText: conditionState.property
40
+ })), datePickerType == 'range' && /*#__PURE__*/React__default["default"].createElement(react.DatePicker, {
41
+ ref: DatePickerInputRef,
42
+ dateFormat: "d/m/Y",
43
+ datePickerType: datePickerType,
44
+ onClose: onChange,
45
+ value: conditionState.value
46
+ }, /*#__PURE__*/React__default["default"].createElement(react.DatePickerInput, {
47
+ id: "datePickerStart",
48
+ placeholder: "dd/mm/yyyy",
49
+ labelText: DataConfigs.translateWithId('start')
50
+ }), /*#__PURE__*/React__default["default"].createElement(react.DatePickerInput, {
51
+ id: "datePickerEnd",
52
+ placeholder: "dd/mm/yyyy",
53
+ labelText: DataConfigs.translateWithId('end')
54
+ })));
55
+ };
56
+ ConditionBuilderItemDate.propTypes = {
57
+ /**
58
+ * current condition object
59
+ */
60
+ conditionState: index["default"].object,
61
+ /**
62
+ * callback to update state oin date change
63
+ */
64
+ onChange: index["default"].func
65
+ };
66
+
67
+ exports.ConditionBuilderItemDate = ConditionBuilderItemDate;
@@ -0,0 +1,13 @@
1
+ export function ConditionBuilderItemNumber({ conditionState, config, onChange, }: {
2
+ conditionState: any;
3
+ config: any;
4
+ onChange: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ export namespace ConditionBuilderItemNumber {
7
+ namespace propTypes {
8
+ let conditionState: PropTypes.Requireable<object>;
9
+ let config: PropTypes.Requireable<object>;
10
+ let onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
+ }
12
+ }
13
+ import PropTypes from 'prop-types';
@@ -0,0 +1,60 @@
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 React = require('react');
13
+ var react = require('@carbon/react');
14
+ var settings = require('../../../../settings.js');
15
+ var index = require('../../../../node_modules/prop-types/index.js');
16
+
17
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
+
19
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
20
+
21
+ var blockClass = "".concat(settings.pkg.prefix, "--condition-builder");
22
+ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
23
+ var _conditionState$prope;
24
+ var conditionState = _ref.conditionState,
25
+ config = _ref.config,
26
+ onChange = _ref.onChange;
27
+ var onChangeHandler = function onChangeHandler(e, _ref2) {
28
+ var value = _ref2.value;
29
+ onChange(value + '');
30
+ };
31
+ return /*#__PURE__*/React__default["default"].createElement("div", {
32
+ className: "".concat(blockClass, "__condition-builder-item-number")
33
+ }, /*#__PURE__*/React__default["default"].createElement(react.NumberInput, {
34
+ label: conditionState.property,
35
+ hideLabel: true,
36
+ id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
37
+ value: conditionState.value ? conditionState.value.split(' ')[0] : conditionState.value,
38
+ min: config.min,
39
+ max: config.max,
40
+ step: config.step,
41
+ allowEmpty: true,
42
+ onChange: onChangeHandler
43
+ }));
44
+ };
45
+ ConditionBuilderItemNumber.propTypes = {
46
+ /**
47
+ * current condition object
48
+ */
49
+ conditionState: index["default"].object,
50
+ /**
51
+ * current config object that this property is part of
52
+ */
53
+ config: index["default"].object,
54
+ /**
55
+ * callback to update state oin date change
56
+ */
57
+ onChange: index["default"].func
58
+ };
59
+
60
+ exports.ConditionBuilderItemNumber = ConditionBuilderItemNumber;
@@ -0,0 +1,13 @@
1
+ export function ConditionBuilderItemOption({ conditionState, config, onChange, }: {
2
+ conditionState?: {} | undefined;
3
+ config?: {} | undefined;
4
+ onChange: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ export namespace ConditionBuilderItemOption {
7
+ namespace propTypes {
8
+ let conditionState: PropTypes.Requireable<object>;
9
+ let config: PropTypes.Requireable<object>;
10
+ let onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
+ }
12
+ }
13
+ import PropTypes from 'prop-types';