@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.
- package/css/index-full-carbon.css +5404 -5117
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +4 -4
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +820 -61
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +329 -6
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +9 -10
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
- package/es/components/Carousel/Carousel.d.ts +46 -2
- package/es/components/Carousel/Carousel.js +36 -21
- package/es/components/Carousel/CarouselItem.d.ts +19 -2
- package/es/components/Carousel/CarouselItem.js +0 -1
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +261 -0
- package/es/components/ConditionBuilder/ConditionBuilder.js +45 -16
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +74 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
- package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
- package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +112 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +151 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +59 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +52 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +162 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +82 -0
- package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
- package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +85 -0
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +145 -0
- package/es/components/ConditionBuilder/utils/util.d.ts +4 -0
- package/es/components/ConditionBuilder/utils/util.js +16 -0
- package/es/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
- package/es/components/CreateTearsheet/CreateTearsheet.js +12 -32
- package/es/components/Datagrid/useParentDimensions.js +1 -1
- package/es/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
- package/es/components/EditUpdateCards/EditUpdateCards.js +3 -0
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
- package/es/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
- package/es/components/ExpressiveCard/ExpressiveCard.js +4 -0
- package/es/components/InlineTip/InlineTipButton.d.ts +21 -2
- package/es/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
- package/es/components/InterstitialScreen/InterstitialScreen.js +25 -14
- package/es/components/Nav/NavItem.js +1 -1
- package/es/components/NotificationsPanel/NotificationsPanel.js +5 -6
- package/es/components/PageHeader/PageHeader.js +12 -3
- package/es/components/SidePanel/SidePanel.js +1 -1
- package/es/components/SimpleHeader/SimpleHeader.d.ts +1 -5
- package/es/components/SimpleHeader/SimpleHeader.js +2 -4
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
- package/es/components/Tearsheet/TearsheetShell.d.ts +119 -10
- package/es/components/Tearsheet/TearsheetShell.js +18 -8
- package/es/components/UserProfileImage/UserProfileImage.d.ts +66 -2
- package/es/components/UserProfileImage/UserProfileImage.js +5 -3
- package/es/components/WebTerminal/WebTerminal.d.ts +46 -2
- package/es/components/WebTerminal/WebTerminal.js +2 -2
- package/es/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/es/global/js/hooks/usePrefersReducedMotion.js +28 -0
- package/es/global/js/utils/Wrap.d.ts +31 -2
- package/es/global/js/utils/Wrap.js +7 -9
- package/es/global/js/utils/getNodeTextContent.d.ts +1 -1
- package/es/global/js/utils/getNodeTextContent.js +1 -1
- package/es/global/js/utils/window.d.ts +2 -0
- package/es/global/js/utils/window.js +12 -0
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2780 -0
- package/lib/_virtual/_rollupPluginBabelHelpers.js +9 -10
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
- package/lib/components/Carousel/Carousel.d.ts +46 -2
- package/lib/components/Carousel/Carousel.js +35 -20
- package/lib/components/Carousel/CarouselItem.d.ts +19 -2
- package/lib/components/Carousel/CarouselItem.js +0 -1
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +270 -0
- package/lib/components/ConditionBuilder/ConditionBuilder.js +46 -17
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +48 -0
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +83 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
- package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +121 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +44 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +159 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +67 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +60 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +170 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +48 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +90 -0
- package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
- package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +93 -0
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +153 -0
- package/lib/components/ConditionBuilder/utils/util.d.ts +4 -0
- package/lib/components/ConditionBuilder/utils/util.js +20 -0
- package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
- package/lib/components/CreateTearsheet/CreateTearsheet.js +12 -32
- package/lib/components/Datagrid/useParentDimensions.js +1 -1
- package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
- package/lib/components/EditUpdateCards/EditUpdateCards.js +3 -0
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
- package/lib/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
- package/lib/components/ExpressiveCard/ExpressiveCard.js +4 -0
- package/lib/components/InlineTip/InlineTipButton.d.ts +21 -2
- package/lib/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
- package/lib/components/InterstitialScreen/InterstitialScreen.js +24 -13
- package/lib/components/Nav/NavItem.js +2 -2
- package/lib/components/NotificationsPanel/NotificationsPanel.js +5 -6
- package/lib/components/PageHeader/PageHeader.js +11 -2
- package/lib/components/SidePanel/SidePanel.js +1 -1
- package/lib/components/SimpleHeader/SimpleHeader.d.ts +1 -5
- package/lib/components/SimpleHeader/SimpleHeader.js +2 -4
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
- package/lib/components/Tearsheet/TearsheetShell.d.ts +119 -10
- package/lib/components/Tearsheet/TearsheetShell.js +16 -6
- package/lib/components/UserProfileImage/UserProfileImage.d.ts +66 -2
- package/lib/components/UserProfileImage/UserProfileImage.js +5 -3
- package/lib/components/WebTerminal/WebTerminal.d.ts +46 -2
- package/lib/components/WebTerminal/WebTerminal.js +2 -2
- package/lib/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/lib/global/js/hooks/usePrefersReducedMotion.js +32 -0
- package/lib/global/js/utils/Wrap.d.ts +31 -2
- package/lib/global/js/utils/Wrap.js +7 -9
- package/lib/global/js/utils/getNodeTextContent.d.ts +1 -1
- package/lib/global/js/utils/getNodeTextContent.js +1 -1
- package/lib/global/js/utils/window.d.ts +2 -0
- package/lib/global/js/utils/window.js +16 -0
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2912 -0
- package/package.json +5 -5
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -1
- package/scss/components/ConditionBuilder/_condition-builder.scss +26 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +46 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +194 -0
- package/scss/components/ConditionBuilder/styles/_index.scss +2 -0
- package/scss/components/Guidebanner/_guidebanner.scss +3 -0
- package/scss/components/InterstitialScreen/_interstitial-screen.scss +1 -6
- package/scss/components/Tearsheet/_tearsheet.scss +3 -1
- package/telemetry.yml +3 -0
- package/es/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
- package/es/global/js/utils/keyboardNavigation.d.ts +0 -27
- package/es/global/js/utils/keyboardNavigation.js +0 -33
- package/es/global/js/utils/wrapFocus.d.ts +0 -25
- package/es/global/js/utils/wrapFocus.js +0 -68
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3004
- package/lib/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
- package/lib/global/js/utils/keyboardNavigation.d.ts +0 -27
- package/lib/global/js/utils/keyboardNavigation.js +0 -39
- package/lib/global/js/utils/wrapFocus.d.ts +0 -25
- package/lib/global/js/utils/wrapFocus.js +0 -73
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3136
@@ -0,0 +1,112 @@
|
|
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 { pkg } from '../../../settings.js';
|
9
|
+
import { translationsObject } from './translationObject.js';
|
10
|
+
|
11
|
+
var statementConfig = [{
|
12
|
+
label: 'if',
|
13
|
+
id: 'if'
|
14
|
+
}, {
|
15
|
+
label: 'excl.if',
|
16
|
+
id: 'excl.if'
|
17
|
+
}];
|
18
|
+
var connectorConfig = [{
|
19
|
+
label: 'and',
|
20
|
+
id: 'and'
|
21
|
+
}, {
|
22
|
+
label: 'or',
|
23
|
+
id: 'or'
|
24
|
+
}];
|
25
|
+
//op types : option, text, number, date,
|
26
|
+
var operatorConfig = [{
|
27
|
+
label: 'is',
|
28
|
+
id: 'is',
|
29
|
+
type: 'all'
|
30
|
+
}, {
|
31
|
+
label: 'is greater than',
|
32
|
+
id: 'greater',
|
33
|
+
type: 'number'
|
34
|
+
}, {
|
35
|
+
label: 'is greater than or equal to',
|
36
|
+
id: 'greater-equal',
|
37
|
+
type: 'number'
|
38
|
+
}, {
|
39
|
+
label: 'is lower than',
|
40
|
+
id: 'lower',
|
41
|
+
type: 'number'
|
42
|
+
}, {
|
43
|
+
label: 'is lower than or equal to',
|
44
|
+
id: 'lower-equal',
|
45
|
+
type: 'number'
|
46
|
+
}, {
|
47
|
+
label: 'starts with',
|
48
|
+
id: 'starts-with',
|
49
|
+
type: 'text'
|
50
|
+
}, {
|
51
|
+
label: 'ends with',
|
52
|
+
id: 'ends-with',
|
53
|
+
type: 'text'
|
54
|
+
}, {
|
55
|
+
label: 'contains',
|
56
|
+
id: 'contains',
|
57
|
+
type: 'text'
|
58
|
+
}, {
|
59
|
+
label: 'is one of',
|
60
|
+
id: 'one-of',
|
61
|
+
type: 'option'
|
62
|
+
}, {
|
63
|
+
label: 'is before',
|
64
|
+
id: 'before',
|
65
|
+
type: 'date,time'
|
66
|
+
}, {
|
67
|
+
label: 'is after',
|
68
|
+
id: 'after',
|
69
|
+
type: 'date,time'
|
70
|
+
}, {
|
71
|
+
label: 'is between',
|
72
|
+
id: 'between',
|
73
|
+
type: 'date'
|
74
|
+
}];
|
75
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
76
|
+
var blockClass = "".concat(pkg.prefix, "--condition-builder");
|
77
|
+
var formatDate = function formatDate(date) {
|
78
|
+
var day = String(date.getDate()).padStart(2, '0');
|
79
|
+
var month = String(date.getMonth() + 1).padStart(2, '0');
|
80
|
+
var year = date.getFullYear();
|
81
|
+
return "".concat(day, "/").concat(month, "/").concat(year);
|
82
|
+
};
|
83
|
+
var translationsObjectCurrent = translationsObject['en']; // TO DO: need to discuss if language is to be passed as prop
|
84
|
+
var translateWithId = function translateWithId(key) {
|
85
|
+
var _translationsObjectCu;
|
86
|
+
return (_translationsObjectCu = translationsObjectCurrent[key]) !== null && _translationsObjectCu !== void 0 ? _translationsObjectCu : key;
|
87
|
+
};
|
88
|
+
var valueRenderers = {
|
89
|
+
text: function text(val) {
|
90
|
+
return val;
|
91
|
+
},
|
92
|
+
time: function time(val) {
|
93
|
+
return val;
|
94
|
+
},
|
95
|
+
number: function number(val, config) {
|
96
|
+
return config.unit && val ? "".concat(val, " ").concat(config.unit) : val;
|
97
|
+
},
|
98
|
+
option: function option(value) {
|
99
|
+
return Array.isArray(value) ? value.join(', ') : value;
|
100
|
+
},
|
101
|
+
date: function date(value) {
|
102
|
+
if (Array.isArray(value) && value.length > 1) {
|
103
|
+
var start = value !== null && value !== void 0 && value[0] ? formatDate(new Date(value[0])) : '';
|
104
|
+
var end = value !== null && value !== void 0 && value[1] ? formatDate(new Date(value[1])) : '';
|
105
|
+
return "".concat(start, " To ").concat(end);
|
106
|
+
} else {
|
107
|
+
return value && new Date(value) ? formatDate(new Date(value)) : value;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
};
|
111
|
+
|
112
|
+
export { blockClass, connectorConfig, operatorConfig, statementConfig, translateWithId, 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,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
|
+
var translationsObject = {
|
9
|
+
en: {
|
10
|
+
if: 'if',
|
11
|
+
'excl-if': 'excl.if',
|
12
|
+
and: 'and',
|
13
|
+
or: 'or',
|
14
|
+
is: 'is',
|
15
|
+
greater: 'is greater than',
|
16
|
+
'greater-equal': 'is greater than or equal to',
|
17
|
+
lower: 'is lower than',
|
18
|
+
'lower-equal': 'is lower than or equal to',
|
19
|
+
'starts-with': 'starts with',
|
20
|
+
'ends-with': 'ends with',
|
21
|
+
contains: 'contains',
|
22
|
+
'one-of': 'is one of',
|
23
|
+
before: 'is before',
|
24
|
+
after: 'is after',
|
25
|
+
between: 'is between',
|
26
|
+
'add-condition': 'Add Condition',
|
27
|
+
condition: 'Condition',
|
28
|
+
property: 'Property',
|
29
|
+
operator: 'Operator',
|
30
|
+
connector: 'Connector',
|
31
|
+
condition_row: 'Condition row',
|
32
|
+
remove_condition: 'Remove condition',
|
33
|
+
add_condition_row: 'Add condition row',
|
34
|
+
start: 'Start',
|
35
|
+
end: 'End',
|
36
|
+
clear_search: 'Clear search input'
|
37
|
+
}
|
38
|
+
};
|
39
|
+
|
40
|
+
export { 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,151 @@
|
|
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, slicedToArray as _slicedToArray, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import React__default, { useRef, useState, useEffect } from 'react';
|
10
|
+
import { Popover, PopoverContent, Layer } from '@carbon/react';
|
11
|
+
import PropTypes from '../../../node_modules/prop-types/index.js';
|
12
|
+
import { Add } from '@carbon/react/icons';
|
13
|
+
import { valueRenderers, translateWithId, blockClass } from '../ConditionBuilderContext/DataConfigs.js';
|
14
|
+
import { ConditionBuilderButton } from '../ConditionBuilderButton/ConditionBuilderButton.js';
|
15
|
+
|
16
|
+
var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "state", "popOverClassName", "config"];
|
17
|
+
var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
18
|
+
var children = _ref.children,
|
19
|
+
className = _ref.className,
|
20
|
+
label = _ref.label,
|
21
|
+
renderIcon = _ref.renderIcon,
|
22
|
+
title = _ref.title,
|
23
|
+
type = _ref.type,
|
24
|
+
showToolTip = _ref.showToolTip,
|
25
|
+
state = _ref.state,
|
26
|
+
popOverClassName = _ref.popOverClassName,
|
27
|
+
config = _ref.config,
|
28
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
29
|
+
var contentRef = useRef(null);
|
30
|
+
var _useState = useState(label),
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
32
|
+
propertyLabel = _useState2[0],
|
33
|
+
setPropertyLabel = _useState2[1];
|
34
|
+
var _useState3 = useState(false),
|
35
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
36
|
+
open = _useState4[0],
|
37
|
+
setOpen = _useState4[1];
|
38
|
+
useEffect(function () {
|
39
|
+
var propertyId = rest['data-name'] == 'valueField' && type ? valueRenderers[type](label, config) : label;
|
40
|
+
setPropertyLabel(translateWithId(propertyId));
|
41
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
42
|
+
}, [label]);
|
43
|
+
useEffect(function () {
|
44
|
+
/**
|
45
|
+
* rest['data-name'] holds the current field name
|
46
|
+
* popoverToOpen hold the next popover to be opened if required
|
47
|
+
*/
|
48
|
+
if (state) {
|
49
|
+
var currentField = rest['data-name'];
|
50
|
+
//if any condition is changed, state prop is triggered
|
51
|
+
if (state.popoverToOpen && currentField !== state.popoverToOpen) {
|
52
|
+
// close the previous popover
|
53
|
+
setOpen(false);
|
54
|
+
} else if (currentField == 'valueField' && type == 'option' && state.operator !== 'one-of') {
|
55
|
+
//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.
|
56
|
+
setOpen(false);
|
57
|
+
}
|
58
|
+
if (state.popoverToOpen == currentField) {
|
59
|
+
//current popover need to be opened
|
60
|
+
setOpen(true);
|
61
|
+
}
|
62
|
+
} else {
|
63
|
+
// when we change any statement(if/ excl.if) which is not part of condition state, label change is triggered.
|
64
|
+
//close popOver when statement is changed.
|
65
|
+
setOpen(false);
|
66
|
+
}
|
67
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
68
|
+
}, [state, label]);
|
69
|
+
useEffect(function () {
|
70
|
+
//this will focus the first input field in the popover
|
71
|
+
if (open && contentRef.current) {
|
72
|
+
var firstFocusableElement = contentRef.current.querySelector('input, button,li');
|
73
|
+
if (firstFocusableElement) {
|
74
|
+
firstFocusableElement.focus();
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}, [contentRef, open]);
|
78
|
+
return /*#__PURE__*/React__default.createElement(Popover, {
|
79
|
+
open: open,
|
80
|
+
isTabTip: true,
|
81
|
+
role: "gridcell",
|
82
|
+
className: popOverClassName,
|
83
|
+
onRequestClose: function onRequestClose() {
|
84
|
+
setOpen(false);
|
85
|
+
}
|
86
|
+
}, /*#__PURE__*/React__default.createElement(ConditionBuilderButton, _extends({
|
87
|
+
label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : translateWithId('add-condition'),
|
88
|
+
hideLabel: !label ? true : false,
|
89
|
+
onClick: function onClick() {
|
90
|
+
setOpen(!open);
|
91
|
+
},
|
92
|
+
className: className,
|
93
|
+
"aria-haspopup": true,
|
94
|
+
"aria-expanded": open,
|
95
|
+
renderIcon: renderIcon ? renderIcon : label == undefined ? Add : null,
|
96
|
+
showToolTip: showToolTip
|
97
|
+
}, rest)), /*#__PURE__*/React__default.createElement(PopoverContent, {
|
98
|
+
className: "".concat(blockClass, "__condition-builder-item__content"),
|
99
|
+
role: "dialog",
|
100
|
+
"aria-label": "".concat(title)
|
101
|
+
}, /*#__PURE__*/React__default.createElement(Layer, null, /*#__PURE__*/React__default.createElement("h1", {
|
102
|
+
className: "".concat(blockClass, "__condition-builder-item__title")
|
103
|
+
}, title), /*#__PURE__*/React__default.createElement("div", {
|
104
|
+
ref: contentRef
|
105
|
+
}, open && children))));
|
106
|
+
};
|
107
|
+
ConditionBuilderItem.propTypes = {
|
108
|
+
/**
|
109
|
+
* provide the contents of the popover
|
110
|
+
*/
|
111
|
+
children: PropTypes.node,
|
112
|
+
/**
|
113
|
+
* Provide an optional class to be applied to the containing node.
|
114
|
+
*/
|
115
|
+
className: PropTypes.string,
|
116
|
+
/**
|
117
|
+
* this is the config object again the current property from inputConfig
|
118
|
+
*/
|
119
|
+
|
120
|
+
config: PropTypes.object,
|
121
|
+
/**
|
122
|
+
* text to be displayed in the field
|
123
|
+
*/
|
124
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
125
|
+
/**
|
126
|
+
* class name for popover
|
127
|
+
*/
|
128
|
+
popOverClassName: PropTypes.string,
|
129
|
+
/**
|
130
|
+
* Optional prop to allow overriding the icon rendering.
|
131
|
+
*/
|
132
|
+
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
133
|
+
/**
|
134
|
+
* show tool tip
|
135
|
+
*/
|
136
|
+
showToolTip: PropTypes.bool,
|
137
|
+
/**
|
138
|
+
* current condition state object
|
139
|
+
*/
|
140
|
+
state: PropTypes.object,
|
141
|
+
/**
|
142
|
+
* title of the popover
|
143
|
+
*/
|
144
|
+
title: PropTypes.string,
|
145
|
+
/**
|
146
|
+
* input type
|
147
|
+
*/
|
148
|
+
type: PropTypes.string
|
149
|
+
};
|
150
|
+
|
151
|
+
export { 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,59 @@
|
|
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, { useRef } from 'react';
|
9
|
+
import { DatePicker, DatePickerInput } from '@carbon/react';
|
10
|
+
import { pkg } from '../../../../settings.js';
|
11
|
+
import PropTypes from '../../../../node_modules/prop-types/index.js';
|
12
|
+
import { translateWithId } from '../../ConditionBuilderContext/DataConfigs.js';
|
13
|
+
|
14
|
+
var blockClass = "".concat(pkg.prefix, "--condition-builder");
|
15
|
+
var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
|
16
|
+
var conditionState = _ref.conditionState,
|
17
|
+
onChange = _ref.onChange;
|
18
|
+
var DatePickerInputRef = useRef();
|
19
|
+
var datePickerType = conditionState.operator == 'between' ? 'range' : 'single';
|
20
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21
|
+
className: "".concat(blockClass, "__condition-builder-item-date ")
|
22
|
+
}, datePickerType == 'single' && /*#__PURE__*/React__default.createElement(DatePicker, {
|
23
|
+
ref: DatePickerInputRef,
|
24
|
+
dateFormat: "d/m/Y",
|
25
|
+
datePickerType: "single",
|
26
|
+
onClose: onChange,
|
27
|
+
value: conditionState.value
|
28
|
+
}, /*#__PURE__*/React__default.createElement(DatePickerInput, {
|
29
|
+
id: "datePicker",
|
30
|
+
placeholder: "dd/mm/yyyy",
|
31
|
+
labelText: conditionState.property
|
32
|
+
})), datePickerType == 'range' && /*#__PURE__*/React__default.createElement(DatePicker, {
|
33
|
+
ref: DatePickerInputRef,
|
34
|
+
dateFormat: "d/m/Y",
|
35
|
+
datePickerType: datePickerType,
|
36
|
+
onClose: onChange,
|
37
|
+
value: conditionState.value
|
38
|
+
}, /*#__PURE__*/React__default.createElement(DatePickerInput, {
|
39
|
+
id: "datePickerStart",
|
40
|
+
placeholder: "dd/mm/yyyy",
|
41
|
+
labelText: translateWithId('start')
|
42
|
+
}), /*#__PURE__*/React__default.createElement(DatePickerInput, {
|
43
|
+
id: "datePickerEnd",
|
44
|
+
placeholder: "dd/mm/yyyy",
|
45
|
+
labelText: translateWithId('end')
|
46
|
+
})));
|
47
|
+
};
|
48
|
+
ConditionBuilderItemDate.propTypes = {
|
49
|
+
/**
|
50
|
+
* current condition object
|
51
|
+
*/
|
52
|
+
conditionState: PropTypes.object,
|
53
|
+
/**
|
54
|
+
* callback to update state oin date change
|
55
|
+
*/
|
56
|
+
onChange: PropTypes.func
|
57
|
+
};
|
58
|
+
|
59
|
+
export { 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,52 @@
|
|
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 { NumberInput } from '@carbon/react';
|
10
|
+
import { pkg } from '../../../../settings.js';
|
11
|
+
import PropTypes from '../../../../node_modules/prop-types/index.js';
|
12
|
+
|
13
|
+
var blockClass = "".concat(pkg.prefix, "--condition-builder");
|
14
|
+
var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
|
15
|
+
var _conditionState$prope;
|
16
|
+
var conditionState = _ref.conditionState,
|
17
|
+
config = _ref.config,
|
18
|
+
onChange = _ref.onChange;
|
19
|
+
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
20
|
+
var value = _ref2.value;
|
21
|
+
onChange(value + '');
|
22
|
+
};
|
23
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
24
|
+
className: "".concat(blockClass, "__condition-builder-item-number")
|
25
|
+
}, /*#__PURE__*/React__default.createElement(NumberInput, {
|
26
|
+
label: conditionState.property,
|
27
|
+
hideLabel: true,
|
28
|
+
id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
|
29
|
+
value: conditionState.value ? conditionState.value.split(' ')[0] : conditionState.value,
|
30
|
+
min: config.min,
|
31
|
+
max: config.max,
|
32
|
+
step: config.step,
|
33
|
+
allowEmpty: true,
|
34
|
+
onChange: onChangeHandler
|
35
|
+
}));
|
36
|
+
};
|
37
|
+
ConditionBuilderItemNumber.propTypes = {
|
38
|
+
/**
|
39
|
+
* current condition object
|
40
|
+
*/
|
41
|
+
conditionState: PropTypes.object,
|
42
|
+
/**
|
43
|
+
* current config object that this property is part of
|
44
|
+
*/
|
45
|
+
config: PropTypes.object,
|
46
|
+
/**
|
47
|
+
* callback to update state oin date change
|
48
|
+
*/
|
49
|
+
onChange: PropTypes.func
|
50
|
+
};
|
51
|
+
|
52
|
+
export { 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';
|
@@ -0,0 +1,162 @@
|
|
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, toConsumableArray as _toConsumableArray, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import React__default, { useContext, useState, useEffect } from 'react';
|
10
|
+
import { Search, Button, SelectSkeleton } from '@carbon/react';
|
11
|
+
import { CheckboxCheckedFilled, Checkbox, Checkmark } from '@carbon/react/icons';
|
12
|
+
import PropTypes from '../../../../node_modules/prop-types/index.js';
|
13
|
+
import { ConditionBuilderContext } from '../../ConditionBuilderContext/ConditionBuilderProvider.js';
|
14
|
+
import { blockClass, translateWithId } from '../../ConditionBuilderContext/DataConfigs.js';
|
15
|
+
|
16
|
+
var _CheckboxCheckedFille, _Checkbox, _SelectSkeleton;
|
17
|
+
var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
|
18
|
+
var _ref$conditionState = _ref.conditionState,
|
19
|
+
conditionState = _ref$conditionState === void 0 ? {} : _ref$conditionState,
|
20
|
+
_ref$config = _ref.config,
|
21
|
+
config = _ref$config === void 0 ? {} : _ref$config,
|
22
|
+
onChange = _ref.onChange;
|
23
|
+
var multiSelectable = conditionState.operator === 'one-of';
|
24
|
+
var _useContext = useContext(ConditionBuilderContext),
|
25
|
+
popOverSearchThreshold = _useContext.popOverSearchThreshold,
|
26
|
+
getOptions = _useContext.getOptions;
|
27
|
+
var _useState = useState(config.options),
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
29
|
+
allOptions = _useState2[0],
|
30
|
+
setAllOptions = _useState2[1];
|
31
|
+
var _useState3 = useState(config.options),
|
32
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
33
|
+
filteredItems = _useState4[0],
|
34
|
+
setFilteredItems = _useState4[1];
|
35
|
+
var selection = Array.isArray(conditionState.value) ? conditionState.value : conditionState.value !== undefined ? [conditionState.value] : [];
|
36
|
+
useEffect(function () {
|
37
|
+
if (!allOptions && getOptions) {
|
38
|
+
var fetchData = /*#__PURE__*/function () {
|
39
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
40
|
+
var response;
|
41
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
42
|
+
while (1) switch (_context.prev = _context.next) {
|
43
|
+
case 0:
|
44
|
+
_context.next = 2;
|
45
|
+
return getOptions(conditionState);
|
46
|
+
case 2:
|
47
|
+
response = _context.sent;
|
48
|
+
if ((response === null || response === void 0 ? void 0 : response.length) > 0 && Object.keys(response[0]).includes('label') && Object.keys(response[0]).includes('id')) {
|
49
|
+
setAllOptions(response);
|
50
|
+
setFilteredItems(response);
|
51
|
+
}
|
52
|
+
case 4:
|
53
|
+
case "end":
|
54
|
+
return _context.stop();
|
55
|
+
}
|
56
|
+
}, _callee);
|
57
|
+
}));
|
58
|
+
return function fetchData() {
|
59
|
+
return _ref2.apply(this, arguments);
|
60
|
+
};
|
61
|
+
}();
|
62
|
+
fetchData(); // Call the async method
|
63
|
+
}
|
64
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
65
|
+
}, []);
|
66
|
+
var handleSelectAll = function handleSelectAll(e) {
|
67
|
+
if (e.currentTarget.dataset.selectedAll == 'false') {
|
68
|
+
onChange(undefined);
|
69
|
+
} else {
|
70
|
+
onChange(allOptions.map(function (op) {
|
71
|
+
return op.id;
|
72
|
+
}));
|
73
|
+
}
|
74
|
+
};
|
75
|
+
var onSearchChangeHandler = function onSearchChangeHandler(e) {
|
76
|
+
var value = e.target.value;
|
77
|
+
var _filteredItems = allOptions.filter(function (opt) {
|
78
|
+
return opt.label.toLowerCase().includes(value.toLowerCase());
|
79
|
+
});
|
80
|
+
setFilteredItems(_filteredItems);
|
81
|
+
};
|
82
|
+
var onClickHandler = function onClickHandler(e, option, isSelected) {
|
83
|
+
if (multiSelectable) {
|
84
|
+
if (isSelected) {
|
85
|
+
var items = selection.filter(function (v) {
|
86
|
+
return v !== option.id;
|
87
|
+
});
|
88
|
+
onChange(items.length > 0 ? items : undefined, e);
|
89
|
+
} else {
|
90
|
+
onChange([].concat(_toConsumableArray(selection), [option.id]), e);
|
91
|
+
}
|
92
|
+
} else {
|
93
|
+
onChange(option.id, e);
|
94
|
+
}
|
95
|
+
};
|
96
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, allOptions && /*#__PURE__*/React__default.createElement("div", {
|
97
|
+
className: "".concat(blockClass, "__condition-builder-item-option")
|
98
|
+
}, (config.includeSearch || allOptions.length > popOverSearchThreshold) && /*#__PURE__*/React__default.createElement("div", {
|
99
|
+
className: "".concat(blockClass, "__condition-builder-item-option__search")
|
100
|
+
}, /*#__PURE__*/React__default.createElement(Search, {
|
101
|
+
size: "sm",
|
102
|
+
labelText: translateWithId('clear_search'),
|
103
|
+
closeButtonLabelText: translateWithId('clear_search'),
|
104
|
+
onChange: onSearchChangeHandler
|
105
|
+
})), multiSelectable && /*#__PURE__*/React__default.createElement("div", {
|
106
|
+
className: "".concat(blockClass, "__multiselectSelectionStatusContainer")
|
107
|
+
}, /*#__PURE__*/React__default.createElement("h4", null, /*#__PURE__*/React__default.createElement("label", null, selection.length, "/", allOptions.length, " Selected")), /*#__PURE__*/React__default.createElement(Button, {
|
108
|
+
kind: 'ghost',
|
109
|
+
size: 'sm',
|
110
|
+
"data-selected-all": "".concat(selection.length == 0 ? true : false),
|
111
|
+
onClick: handleSelectAll,
|
112
|
+
className: "".concat(blockClass, "__selectAll-button")
|
113
|
+
}, selection.length == 0 ? 'Select all' : 'Deselect all')), /*#__PURE__*/React__default.createElement("ul", {
|
114
|
+
"aria-label": conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : translateWithId('property'),
|
115
|
+
role: "listbox",
|
116
|
+
"data-multi-select": multiSelectable
|
117
|
+
}, filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.map(function (option) {
|
118
|
+
var isSelected = selection.includes(option.id);
|
119
|
+
var Icon = option.icon;
|
120
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
121
|
+
tabIndex: 0,
|
122
|
+
key: option.id,
|
123
|
+
role: "option",
|
124
|
+
"aria-selected": isSelected,
|
125
|
+
className: "".concat(blockClass, "__condition-builder-item-option__option"),
|
126
|
+
onKeyUp: function onKeyUp() {
|
127
|
+
return false;
|
128
|
+
},
|
129
|
+
onClick: function onClick(e) {
|
130
|
+
return onClickHandler(e, option, isSelected);
|
131
|
+
}
|
132
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
133
|
+
className: "".concat(blockClass, "__condition-builder-item-option__option-content")
|
134
|
+
}, multiSelectable ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
135
|
+
className: "".concat(blockClass, "__option-check-box")
|
136
|
+
}, isSelected ? _CheckboxCheckedFille || (_CheckboxCheckedFille = /*#__PURE__*/React__default.createElement(CheckboxCheckedFilled, null)) : _Checkbox || (_Checkbox = /*#__PURE__*/React__default.createElement(Checkbox, null))), /*#__PURE__*/React__default.createElement("span", {
|
137
|
+
className: "".concat(blockClass, "__condition-builder-item-option__option-label")
|
138
|
+
}, option.label), Icon && /*#__PURE__*/React__default.createElement("span", {
|
139
|
+
className: "".concat(blockClass, "__option-icon")
|
140
|
+
}, /*#__PURE__*/React__default.createElement(Icon, null))) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
141
|
+
className: "".concat(blockClass, "__condition-builder-item-option__option-label")
|
142
|
+
}, Icon && /*#__PURE__*/React__default.createElement(Icon, null), option.label), isSelected && /*#__PURE__*/React__default.createElement(Checkmark, {
|
143
|
+
className: "".concat(blockClass, "__condition-builder-checkmark")
|
144
|
+
}))));
|
145
|
+
}))), !allOptions && (_SelectSkeleton || (_SelectSkeleton = /*#__PURE__*/React__default.createElement(SelectSkeleton, null))));
|
146
|
+
};
|
147
|
+
ConditionBuilderItemOption.propTypes = {
|
148
|
+
/**
|
149
|
+
* current condition object
|
150
|
+
*/
|
151
|
+
conditionState: PropTypes.object,
|
152
|
+
/**
|
153
|
+
* current config object that this property is part of
|
154
|
+
*/
|
155
|
+
config: PropTypes.object,
|
156
|
+
/**
|
157
|
+
* callback to update state oin date change
|
158
|
+
*/
|
159
|
+
onChange: PropTypes.func
|
160
|
+
};
|
161
|
+
|
162
|
+
export { ConditionBuilderItemOption };
|