@boomerang-io/carbon-addons-boomerang-react 4.6.14-beta.9 → 4.6.15-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -162
- package/dist/cjs/components/AboutPlatform/AboutPlatform.js +50 -50
- package/dist/cjs/components/AdvantageSideNav/AdvantageSideNav.js +221 -221
- package/dist/cjs/components/AutoSuggest/AutoSuggest.js +101 -101
- package/dist/cjs/components/Avatar/Avatar.js +18 -18
- package/dist/cjs/components/CheckboxList/CheckboxList.js +34 -34
- package/dist/cjs/components/ComboBox/ComboBox.js +103 -103
- package/dist/cjs/components/ComboBoxMultiSelect/ComboBoxMultiSelect.js +32 -32
- package/dist/cjs/components/ComboBoxMultiSelect/MultiSelect.js +208 -208
- package/dist/cjs/components/ComposedModal/ComposedModal.js +80 -80
- package/dist/cjs/components/ConfirmModal/ConfirmModal.js +43 -43
- package/dist/cjs/components/Creatable/Creatable.js +137 -137
- package/dist/cjs/components/DataDrivenInput/DataDrivenInput.js +226 -226
- package/dist/cjs/components/DateInput/DateInput.js +35 -35
- package/dist/cjs/components/DecisionButtons/DecisionButtons.js +61 -61
- package/dist/cjs/components/DelayedRender/DelayedRender.js +17 -17
- package/dist/cjs/components/DynamicFormik/DynamicFormik.js +578 -578
- package/dist/cjs/components/Error403/Error403.js +13 -13
- package/dist/cjs/components/Error403/ForbiddenErrorBackground.js +113 -113
- package/dist/cjs/components/Error403/GraphicWrangler/GraphicWrangler.js +62 -62
- package/dist/cjs/components/Error404/Error404.js +13 -13
- package/dist/cjs/components/Error404/GraphicLoch/GraphicLoch.js +17 -17
- package/dist/cjs/components/Error404/NotFoundErrorBackground.js +129 -129
- package/dist/cjs/components/ErrorBoundary/ErrorBoundary.js +32 -32
- package/dist/cjs/components/ErrorDragon/ErrorDragon.js +13 -13
- package/dist/cjs/components/ErrorDragon/assets/ErrorGraphic.js +35 -35
- package/dist/cjs/components/ErrorFullPage/ErrorFullPage.js +10 -10
- package/dist/cjs/components/ErrorMessage/ErrorMessage.js +22 -22
- package/dist/cjs/components/ErrorPage/ErrorPage.js +11 -11
- package/dist/cjs/components/ErrorPageCore/ErrorPageCore.js +15 -15
- package/dist/cjs/components/ErrorPageCore/GenericErrorBackground.js +124 -124
- package/dist/cjs/components/FeatureHeader/FeatureHeader.js +29 -29
- package/dist/cjs/components/FeatureNavTab/FeatureNavTab.js +12 -12
- package/dist/cjs/components/FeatureNavTabs/FeatureNavTabs.js +12 -12
- package/dist/cjs/components/FeatureSideNav/FeatureSideNav.js +12 -12
- package/dist/cjs/components/FeatureSideNav/FeatureSideNavFooter.js +8 -8
- package/dist/cjs/components/FeatureSideNav/FeatureSideNavHeader.js +8 -8
- package/dist/cjs/components/FeatureSideNav/FeatureSideNavLinks.js +14 -14
- package/dist/cjs/components/FeatureSideNavLink/FeatureSideNavLink.js +12 -12
- package/dist/cjs/components/Feedback/Feedback.js +38 -38
- package/dist/cjs/components/FlowModal/FlowModal.js +141 -141
- package/dist/cjs/components/FlowModal/FlowModalForm.js +12 -12
- package/dist/cjs/components/Header/Header.js +187 -187
- package/dist/cjs/components/Header/HeaderAppSwitcher.js +94 -94
- package/dist/cjs/components/Header/HeaderMenu.js +7 -7
- package/dist/cjs/components/Header/HeaderMenuItem.js +51 -51
- package/dist/cjs/components/Header/HeaderTeamSwitcher.js +329 -332
- package/dist/cjs/components/Header/UserRequests.js +29 -29
- package/dist/cjs/components/ImageModal/ImageModal.js +17 -17
- package/dist/cjs/components/Loading/Loading.js +8 -8
- package/dist/cjs/components/MemberBar/MemberBar.js +20 -20
- package/dist/cjs/components/Modal/Modal.js +20 -20
- package/dist/cjs/components/ModalConfirmEdit/ModalConfirmArray.js +14 -14
- package/dist/cjs/components/ModalConfirmEdit/ModalConfirmDetails.js +11 -11
- package/dist/cjs/components/ModalConfirmEdit/ModalConfirmEdit.js +17 -17
- package/dist/cjs/components/ModalForm/ModalForm.js +9 -9
- package/dist/cjs/components/Notifications/NotificationsContainer.js +22 -22
- package/dist/cjs/components/Notifications/ToastNotification.js +21 -21
- package/dist/cjs/components/Notifications/notify.js +17 -17
- package/dist/cjs/components/PlatformBanner/PlatformBanner.js +8 -8
- package/dist/cjs/components/PlatformNotifications/PlatformNotification.js +17 -17
- package/dist/cjs/components/PlatformNotifications/PlatformNotificationsContainer.js +136 -136
- package/dist/cjs/components/Portal/Portal.js +14 -14
- package/dist/cjs/components/PrivacyRedirect/PrivacyRedirect.js +30 -30
- package/dist/cjs/components/PrivacyStatement/PrivacyStatement.js +90 -90
- package/dist/cjs/components/ProfileSettings/ProfileSettings.js +124 -142
- package/dist/cjs/components/ProtectedRoute/ProtectedRoute.js +13 -13
- package/dist/cjs/components/RadioGroup/RadioGroup.js +33 -33
- package/dist/cjs/components/RichTextArea/RichTextArea.js +142 -142
- package/dist/cjs/components/SignOut/SignOut.js +27 -27
- package/dist/cjs/components/SupportCenter/SupportCenter.js +65 -65
- package/dist/cjs/components/TextArea/TextArea.js +16 -16
- package/dist/cjs/components/TextInput/TextInput.js +13 -13
- package/dist/cjs/components/Toggle/Toggle.js +22 -22
- package/dist/cjs/components/TooltipHover/TooltipHover.js +39 -39
- package/dist/cjs/components/UIShell/UIShell.js +95 -95
- package/dist/cjs/config/servicesConfig.js +22 -22
- package/dist/cjs/constants/DataDrivenInputTypes.js +74 -74
- package/dist/cjs/constants/UserType.js +13 -13
- package/dist/cjs/hooks/useHeaderMenu.js +49 -49
- package/dist/cjs/hooks/usePortal.js +74 -74
- package/dist/cjs/hooks/useWindowSize.js +33 -33
- package/dist/cjs/internal/ListBox/ListBox.js +41 -41
- package/dist/cjs/internal/ListBox/ListBoxField.js +19 -19
- package/dist/cjs/internal/ListBox/ListBoxMenu.js +19 -19
- package/dist/cjs/internal/ListBox/ListBoxMenuIcon.js +31 -31
- package/dist/cjs/internal/ListBox/ListBoxMenuItem.js +38 -38
- package/dist/cjs/internal/ListBox/ListBoxSelection.js +64 -64
- package/dist/cjs/internal/ListBox/index.js +10 -10
- package/dist/cjs/internal/keyboard/keys.js +16 -16
- package/dist/cjs/internal/keyboard/match.js +67 -67
- package/dist/cjs/internal/settings.js +5 -5
- package/dist/cjs/tools/accessibility.js +13 -13
- package/dist/cjs/tools/createPropAdapter.js +44 -44
- package/dist/cjs/tools/isUrl.js +39 -39
- package/dist/cjs/tools/setupGetInstanceId.js +20 -20
- package/dist/cjs/tools/useSetState.js +12 -12
- package/dist/cjs/tools/yupAst/astGenerator.js +212 -212
- package/dist/cjs/tools/yupAst/customValidators.js +17 -17
- package/dist/esm/components/AboutPlatform/AboutPlatform.js +50 -50
- package/dist/esm/components/AdvantageSideNav/AdvantageSideNav.js +221 -221
- package/dist/esm/components/AutoSuggest/AutoSuggest.js +101 -101
- package/dist/esm/components/Avatar/Avatar.js +18 -18
- package/dist/esm/components/CheckboxList/CheckboxList.js +34 -34
- package/dist/esm/components/ComboBox/ComboBox.js +103 -103
- package/dist/esm/components/ComboBoxMultiSelect/ComboBoxMultiSelect.js +32 -32
- package/dist/esm/components/ComboBoxMultiSelect/MultiSelect.js +208 -208
- package/dist/esm/components/ComposedModal/ComposedModal.js +80 -80
- package/dist/esm/components/ConfirmModal/ConfirmModal.js +43 -43
- package/dist/esm/components/Creatable/Creatable.js +137 -137
- package/dist/esm/components/DataDrivenInput/DataDrivenInput.js +226 -226
- package/dist/esm/components/DateInput/DateInput.js +35 -35
- package/dist/esm/components/DecisionButtons/DecisionButtons.js +61 -61
- package/dist/esm/components/DelayedRender/DelayedRender.js +17 -17
- package/dist/esm/components/DynamicFormik/DynamicFormik.js +578 -578
- package/dist/esm/components/Error403/Error403.js +13 -13
- package/dist/esm/components/Error403/ForbiddenErrorBackground.js +113 -113
- package/dist/esm/components/Error403/GraphicWrangler/GraphicWrangler.js +62 -62
- package/dist/esm/components/Error404/Error404.js +13 -13
- package/dist/esm/components/Error404/GraphicLoch/GraphicLoch.js +17 -17
- package/dist/esm/components/Error404/NotFoundErrorBackground.js +129 -129
- package/dist/esm/components/ErrorBoundary/ErrorBoundary.js +32 -32
- package/dist/esm/components/ErrorDragon/ErrorDragon.js +13 -13
- package/dist/esm/components/ErrorDragon/assets/ErrorGraphic.js +35 -35
- package/dist/esm/components/ErrorFullPage/ErrorFullPage.js +10 -10
- package/dist/esm/components/ErrorMessage/ErrorMessage.js +22 -22
- package/dist/esm/components/ErrorPage/ErrorPage.js +11 -11
- package/dist/esm/components/ErrorPageCore/ErrorPageCore.js +15 -15
- package/dist/esm/components/ErrorPageCore/GenericErrorBackground.js +124 -124
- package/dist/esm/components/FeatureHeader/FeatureHeader.js +29 -29
- package/dist/esm/components/FeatureNavTab/FeatureNavTab.js +12 -12
- package/dist/esm/components/FeatureNavTabs/FeatureNavTabs.js +12 -12
- package/dist/esm/components/FeatureSideNav/FeatureSideNav.js +12 -12
- package/dist/esm/components/FeatureSideNav/FeatureSideNavFooter.js +8 -8
- package/dist/esm/components/FeatureSideNav/FeatureSideNavHeader.js +8 -8
- package/dist/esm/components/FeatureSideNav/FeatureSideNavLinks.js +14 -14
- package/dist/esm/components/FeatureSideNavLink/FeatureSideNavLink.js +12 -12
- package/dist/esm/components/Feedback/Feedback.js +38 -38
- package/dist/esm/components/FlowModal/FlowModal.js +141 -141
- package/dist/esm/components/FlowModal/FlowModalForm.js +12 -12
- package/dist/esm/components/Header/Header.js +187 -187
- package/dist/esm/components/Header/HeaderAppSwitcher.js +94 -94
- package/dist/esm/components/Header/HeaderMenu.js +7 -7
- package/dist/esm/components/Header/HeaderMenuItem.js +51 -51
- package/dist/esm/components/Header/HeaderTeamSwitcher.js +329 -332
- package/dist/esm/components/Header/UserRequests.js +29 -29
- package/dist/esm/components/ImageModal/ImageModal.js +17 -17
- package/dist/esm/components/Loading/Loading.js +8 -8
- package/dist/esm/components/MemberBar/MemberBar.js +20 -20
- package/dist/esm/components/Modal/Modal.js +20 -20
- package/dist/esm/components/ModalConfirmEdit/ModalConfirmArray.js +14 -14
- package/dist/esm/components/ModalConfirmEdit/ModalConfirmDetails.js +11 -11
- package/dist/esm/components/ModalConfirmEdit/ModalConfirmEdit.js +17 -17
- package/dist/esm/components/ModalForm/ModalForm.js +9 -9
- package/dist/esm/components/Notifications/NotificationsContainer.js +22 -22
- package/dist/esm/components/Notifications/ToastNotification.js +21 -21
- package/dist/esm/components/Notifications/notify.js +17 -17
- package/dist/esm/components/PlatformBanner/PlatformBanner.js +8 -8
- package/dist/esm/components/PlatformNotifications/PlatformNotification.js +17 -17
- package/dist/esm/components/PlatformNotifications/PlatformNotificationsContainer.js +136 -136
- package/dist/esm/components/Portal/Portal.js +14 -14
- package/dist/esm/components/PrivacyRedirect/PrivacyRedirect.js +30 -30
- package/dist/esm/components/PrivacyStatement/PrivacyStatement.js +90 -90
- package/dist/esm/components/ProfileSettings/ProfileSettings.js +124 -142
- package/dist/esm/components/ProtectedRoute/ProtectedRoute.js +13 -13
- package/dist/esm/components/RadioGroup/RadioGroup.js +33 -33
- package/dist/esm/components/RichTextArea/RichTextArea.js +142 -142
- package/dist/esm/components/SignOut/SignOut.js +27 -27
- package/dist/esm/components/SupportCenter/SupportCenter.js +65 -65
- package/dist/esm/components/TextArea/TextArea.js +16 -16
- package/dist/esm/components/TextInput/TextInput.js +13 -13
- package/dist/esm/components/Toggle/Toggle.js +22 -22
- package/dist/esm/components/TooltipHover/TooltipHover.js +39 -39
- package/dist/esm/components/UIShell/UIShell.js +95 -95
- package/dist/esm/config/servicesConfig.js +22 -22
- package/dist/esm/constants/DataDrivenInputTypes.js +74 -74
- package/dist/esm/constants/UserType.js +13 -13
- package/dist/esm/hooks/useHeaderMenu.js +49 -49
- package/dist/esm/hooks/usePortal.js +74 -74
- package/dist/esm/hooks/useWindowSize.js +33 -33
- package/dist/esm/internal/ListBox/ListBox.js +41 -41
- package/dist/esm/internal/ListBox/ListBoxField.js +19 -19
- package/dist/esm/internal/ListBox/ListBoxMenu.js +19 -19
- package/dist/esm/internal/ListBox/ListBoxMenuIcon.js +31 -31
- package/dist/esm/internal/ListBox/ListBoxMenuItem.js +38 -38
- package/dist/esm/internal/ListBox/ListBoxSelection.js +64 -64
- package/dist/esm/internal/ListBox/index.js +10 -10
- package/dist/esm/internal/keyboard/keys.js +16 -16
- package/dist/esm/internal/keyboard/match.js +67 -67
- package/dist/esm/internal/settings.js +5 -5
- package/dist/esm/tools/accessibility.js +13 -13
- package/dist/esm/tools/createPropAdapter.js +44 -44
- package/dist/esm/tools/isUrl.js +39 -39
- package/dist/esm/tools/setupGetInstanceId.js +20 -20
- package/dist/esm/tools/useSetState.js +12 -12
- package/dist/esm/tools/yupAst/astGenerator.js +212 -212
- package/dist/esm/tools/yupAst/customValidators.js +17 -17
- package/dist/types/index.d.ts +1359 -1360
- package/package.json +167 -167
- package/scss/components/AboutPlatform/_aboutPlatform.scss +139 -139
- package/scss/components/AdvantageSideNav/_advantageSideNav.scss +272 -272
- package/scss/components/AutoSuggest/_autoSuggest.scss +62 -62
- package/scss/components/Avatar/_avatar.scss +32 -32
- package/scss/components/CheckboxList/_checkboxList.scss +26 -26
- package/scss/components/ComboBox/_combobox.scss +23 -23
- package/scss/components/ComboBoxMultiSelect/_comboBoxMultiSelect.scss +53 -53
- package/scss/components/ConfirmModal/_confirmModal.scss +12 -12
- package/scss/components/Creatable/_creatable.scss +48 -48
- package/scss/components/DateInput/_dateInput.scss +36 -36
- package/scss/components/DecisionButtons/_decisionButtons.scss +132 -132
- package/scss/components/DynamicFormik/_dynamicFormik.scss +17 -17
- package/scss/components/ErrorBoundary/_errorBoundary.scss +12 -12
- package/scss/components/ErrorDragon/_errorDragon.scss +55 -55
- package/scss/components/ErrorMessage/_errorMessage.scss +43 -43
- package/scss/components/ErrorPage/_errorPage.scss +66 -66
- package/scss/components/ErrorPageCore/_errorPageCore.scss +73 -73
- package/scss/components/FeatureHeader/_featureHeader.scss +67 -67
- package/scss/components/FeatureNavTab/_featureNavTab.scss +27 -27
- package/scss/components/FeatureSideNav/_featureSideNav.scss +76 -76
- package/scss/components/FeatureSideNavLink/_featureSideNavLink.scss +49 -49
- package/scss/components/Feedback/_feedback.scss +50 -50
- package/scss/components/Header/_header.scss +179 -179
- package/scss/components/Header/_headerAppSwitcher.scss +117 -117
- package/scss/components/Header/_headerMenu.scss +30 -30
- package/scss/components/Header/_headerMenuItem.scss +65 -65
- package/scss/components/Header/_headerTeamSwitcher.scss +222 -222
- package/scss/components/Header/_userRequests.scss +36 -36
- package/scss/components/ImageModal/_imageModal.scss +51 -51
- package/scss/components/MemberBar/_memberBar.scss +99 -99
- package/scss/components/Modal/_modal.scss +163 -163
- package/scss/components/ModalConfirmEdit/_modalConfirmEdit.scss +113 -113
- package/scss/components/Notifications/_notifications.scss +57 -57
- package/scss/components/PlatformBanner/_platformBanner.scss +30 -30
- package/scss/components/PlatformNotifications/_platformNotifications.scss +230 -230
- package/scss/components/PrivacyRedirect/_privacyRedirect.scss +43 -43
- package/scss/components/PrivacyStatement/_privacyStatement.scss +137 -137
- package/scss/components/ProfileSettings/_profileSettings.scss +117 -117
- package/scss/components/ProtectedRoute/_protectedRoute.scss +32 -32
- package/scss/components/RadioGroup/_radioGroup.scss +46 -46
- package/scss/components/RichTextArea/_richTextArea.scss +82 -82
- package/scss/components/SignOut/_signOut.scss +51 -51
- package/scss/components/SupportCenter/_supportCenter.scss +16 -16
- package/scss/components/TextArea/_textArea.scss +19 -19
- package/scss/components/TextInput/_textInput.scss +26 -26
- package/scss/components/Toggle/_toggle.scss +80 -80
- package/scss/components/TooltipHover/_tooltip.scss +48 -48
- package/scss/global/_config.scss +14 -14
- package/scss/global/_tippy.scss +49 -49
- package/scss/global/index.scss +401 -401
- package/scss/global/themes/_boomerang.scss +184 -184
- package/scss/global/themes/_default.scss +79 -79
- package/scss/global/themes/_shell-tokens.scss +42 -42
- package/scss/global/utils/_animations.scss +15 -15
- package/scss/global/utils/_mixins.scss +67 -67
- package/scss/global/utils/index.scss +10 -10
|
@@ -4,49 +4,49 @@ import cx from 'classnames';
|
|
|
4
4
|
import { Modal } from '../Modal/Modal.js';
|
|
5
5
|
import { prefix } from '../../internal/settings.js';
|
|
6
6
|
|
|
7
|
-
/*
|
|
8
|
-
IBM Confidential
|
|
9
|
-
694970X, 69497O0
|
|
10
|
-
© Copyright IBM Corp. 2022, 2024
|
|
11
|
-
*/
|
|
12
|
-
function ConfirmModal(props) {
|
|
13
|
-
const { affirmativeAction, affirmativeButtonProps, affirmativeText = "Yes", appElement, children, containerClassName, isExternallyControlled, label, modalHeaderProps = {}, modalProps, modalTrigger = () => void 0, negativeAction, negativeButtonProps, negativeText = "No", onCloseModal, selectorPrimaryFocus = `button[id="${prefix}--bmrg-confirm-modal-primary-button"]`, title = "Are you sure?", } = props;
|
|
14
|
-
const [isOpen, setIsOpen] = useState(props.isOpen);
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
setIsOpen(props.isOpen);
|
|
17
|
-
}, [props.isOpen]);
|
|
18
|
-
function closeModal() {
|
|
19
|
-
if (typeof onCloseModal === "function") {
|
|
20
|
-
onCloseModal();
|
|
21
|
-
}
|
|
22
|
-
setIsOpen(false);
|
|
23
|
-
}
|
|
24
|
-
function handleAffirmativeAction() {
|
|
25
|
-
if (typeof affirmativeAction === "function") {
|
|
26
|
-
affirmativeAction();
|
|
27
|
-
}
|
|
28
|
-
if (!isExternallyControlled)
|
|
29
|
-
closeModal();
|
|
30
|
-
}
|
|
31
|
-
function handleNegativeAction() {
|
|
32
|
-
if (typeof negativeAction === "function") {
|
|
33
|
-
negativeAction();
|
|
34
|
-
}
|
|
35
|
-
if (!isExternallyControlled)
|
|
36
|
-
closeModal();
|
|
37
|
-
}
|
|
38
|
-
return (React.createElement(React.Fragment, null,
|
|
39
|
-
modalTrigger({ openModal: () => setIsOpen(true) }),
|
|
40
|
-
React.createElement(Modal, { appElement: appElement, containerClassName: cx(`${prefix}--bmrg-confirm-modal-container`, containerClassName), closeTimeoutMS: 240,
|
|
41
|
-
//@ts-ignore
|
|
42
|
-
isOpen: isOpen, onRequestClose: closeModal, shouldCloseOnOverlayClick: true, selectorPrimaryFocus: selectorPrimaryFocus, ...modalProps },
|
|
43
|
-
React.createElement(ModalHeader, { closeModal: closeModal, iconDescription: "Close", label: label, title: title, ...modalHeaderProps }),
|
|
44
|
-
React.createElement("div", { id: "confirm-modal-container" },
|
|
45
|
-
React.createElement(ModalBody, null,
|
|
46
|
-
React.createElement("div", { className: `${prefix}--modal-content__text` }, children))),
|
|
47
|
-
React.createElement(ModalFooter, null,
|
|
48
|
-
React.createElement(Button, { id: `${prefix}--bmrg-confirm-modal-secondary-button`, kind: "secondary", onClick: handleNegativeAction, ...negativeButtonProps }, negativeText),
|
|
49
|
-
React.createElement(Button, { id: `${prefix}--bmrg-confirm-modal-primary-button`, onClick: handleAffirmativeAction, ...affirmativeButtonProps }, affirmativeText)))));
|
|
7
|
+
/*
|
|
8
|
+
IBM Confidential
|
|
9
|
+
694970X, 69497O0
|
|
10
|
+
© Copyright IBM Corp. 2022, 2024
|
|
11
|
+
*/
|
|
12
|
+
function ConfirmModal(props) {
|
|
13
|
+
const { affirmativeAction, affirmativeButtonProps, affirmativeText = "Yes", appElement, children, containerClassName, isExternallyControlled, label, modalHeaderProps = {}, modalProps, modalTrigger = () => void 0, negativeAction, negativeButtonProps, negativeText = "No", onCloseModal, selectorPrimaryFocus = `button[id="${prefix}--bmrg-confirm-modal-primary-button"]`, title = "Are you sure?", } = props;
|
|
14
|
+
const [isOpen, setIsOpen] = useState(props.isOpen);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
setIsOpen(props.isOpen);
|
|
17
|
+
}, [props.isOpen]);
|
|
18
|
+
function closeModal() {
|
|
19
|
+
if (typeof onCloseModal === "function") {
|
|
20
|
+
onCloseModal();
|
|
21
|
+
}
|
|
22
|
+
setIsOpen(false);
|
|
23
|
+
}
|
|
24
|
+
function handleAffirmativeAction() {
|
|
25
|
+
if (typeof affirmativeAction === "function") {
|
|
26
|
+
affirmativeAction();
|
|
27
|
+
}
|
|
28
|
+
if (!isExternallyControlled)
|
|
29
|
+
closeModal();
|
|
30
|
+
}
|
|
31
|
+
function handleNegativeAction() {
|
|
32
|
+
if (typeof negativeAction === "function") {
|
|
33
|
+
negativeAction();
|
|
34
|
+
}
|
|
35
|
+
if (!isExternallyControlled)
|
|
36
|
+
closeModal();
|
|
37
|
+
}
|
|
38
|
+
return (React.createElement(React.Fragment, null,
|
|
39
|
+
modalTrigger({ openModal: () => setIsOpen(true) }),
|
|
40
|
+
React.createElement(Modal, { appElement: appElement, containerClassName: cx(`${prefix}--bmrg-confirm-modal-container`, containerClassName), closeTimeoutMS: 240,
|
|
41
|
+
//@ts-ignore
|
|
42
|
+
isOpen: isOpen, onRequestClose: closeModal, shouldCloseOnOverlayClick: true, selectorPrimaryFocus: selectorPrimaryFocus, ...modalProps },
|
|
43
|
+
React.createElement(ModalHeader, { closeModal: closeModal, iconDescription: "Close", label: label, title: title, ...modalHeaderProps }),
|
|
44
|
+
React.createElement("div", { id: "confirm-modal-container" },
|
|
45
|
+
React.createElement(ModalBody, null,
|
|
46
|
+
React.createElement("div", { className: `${prefix}--modal-content__text` }, children))),
|
|
47
|
+
React.createElement(ModalFooter, null,
|
|
48
|
+
React.createElement(Button, { id: `${prefix}--bmrg-confirm-modal-secondary-button`, kind: "secondary", onClick: handleNegativeAction, ...negativeButtonProps }, negativeText),
|
|
49
|
+
React.createElement(Button, { id: `${prefix}--bmrg-confirm-modal-primary-button`, onClick: handleAffirmativeAction, ...affirmativeButtonProps }, affirmativeText)))));
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export { ConfirmModal as default };
|
|
@@ -6,143 +6,143 @@ import TooltipHover from '../TooltipHover/TooltipHover.js';
|
|
|
6
6
|
import { isAccessibleKeyDownEvent } from '../../tools/accessibility.js';
|
|
7
7
|
import { prefix } from '../../internal/settings.js';
|
|
8
8
|
|
|
9
|
-
/*
|
|
10
|
-
IBM Confidential
|
|
11
|
-
694970X, 69497O0
|
|
12
|
-
© Copyright IBM Corp. 2022, 2024
|
|
13
|
-
*/
|
|
14
|
-
function CreatableComponent({ buttonClassName = `${prefix}--bmrg-creatable__button`, buttonContent = "Add", buttonProps, createKeyValuePair = false, disabled, id, initialValues: externalInitialValues, invalid, invalidText, helperText, key, keyHelperText, keyLabel, keyLabelText, keyPlaceholder, label, labelText = "", max, nonDeletable = false, onKeyBlur, onValueBlur, onInputBlur, onChange, placeholder, tagProps, tagType = "teal", textInputProps, tooltipClassName = `${prefix}--bmrg-creatable__tooltip`, tooltipContent, tooltipProps = { direction: "top" }, type = "text", valueHelperText, valueLabel, valueLabelText, valuePlaceholder, value: externalValues, values, trimInput = false, removeOnlyFirst = false, }) {
|
|
15
|
-
const [keyValue, setKeyValue] = useState("");
|
|
16
|
-
const [value, setValue] = useState("");
|
|
17
|
-
const [input, setInput] = useState("");
|
|
18
|
-
const inputRef = React.useRef(null);
|
|
19
|
-
const inputLabel = labelText || label;
|
|
20
|
-
const inputKeyLabel = keyLabelText || keyLabel;
|
|
21
|
-
const inputValueLabel = valueLabelText || valueLabel;
|
|
22
|
-
const [createdItems, setCreatedItems] = useState([]);
|
|
23
|
-
const createButtonClassName = cx(buttonClassName, {
|
|
24
|
-
"--no-label": (!createKeyValuePair && !inputLabel && !tooltipContent) ||
|
|
25
|
-
(createKeyValuePair && !inputKeyLabel && !inputValueLabel),
|
|
26
|
-
});
|
|
27
|
-
/** Add support for csv strings */
|
|
28
|
-
let finalValues;
|
|
29
|
-
let finalExternalValues;
|
|
30
|
-
let finalExternalInitialValues;
|
|
31
|
-
if (typeof values === "string") {
|
|
32
|
-
finalValues = values === "" ? [] : values.split(",");
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
finalValues = values;
|
|
36
|
-
}
|
|
37
|
-
if (typeof externalValues === "string") {
|
|
38
|
-
finalExternalValues = externalValues === "" ? [] : externalValues.split(",");
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
finalExternalValues = externalValues;
|
|
42
|
-
}
|
|
43
|
-
if (typeof externalInitialValues === "string") {
|
|
44
|
-
finalExternalInitialValues = externalInitialValues.split(",");
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
finalExternalInitialValues = externalInitialValues;
|
|
48
|
-
}
|
|
49
|
-
const [initialItems] = useState(finalValues || finalExternalValues ? finalValues || finalExternalValues : []);
|
|
50
|
-
const tagItems = (finalValues || finalExternalValues ? finalValues || finalExternalValues : createdItems); // Externally controlled if values props exists
|
|
51
|
-
const initialTagItems = finalExternalInitialValues || initialItems || []; // Externally controlled if initialValues props exists
|
|
52
|
-
const existValue = (keyValue && value) || (trimInput ? input?.trim() : input);
|
|
53
|
-
const hasBothHelperText = keyHelperText && valueHelperText;
|
|
54
|
-
const hasBothLabelText = inputKeyLabel && inputValueLabel;
|
|
55
|
-
const tagsToShow = finalExternalInitialValues ? [...initialTagItems, ...tagItems] : [...tagItems];
|
|
56
|
-
const disableInputs = disabled || (max && tagsToShow.length >= max && max > 0);
|
|
57
|
-
// Check if key value pair has colon
|
|
58
|
-
const keyInputHasColon = keyValue?.includes(":");
|
|
59
|
-
const valueInputHasColon = value?.includes(":");
|
|
60
|
-
const isKeyInputValid = invalid || keyInputHasColon;
|
|
61
|
-
const isValueInputValid = invalid || valueInputHasColon;
|
|
62
|
-
const keyInputInvalidText = keyInputHasColon ? '":" is not allowed' : invalidText;
|
|
63
|
-
const valueInputInvalidText = valueInputHasColon ? '":" is not allowed' : invalidText;
|
|
64
|
-
const isAddButtonDisabled = disabled || !existValue || keyInputHasColon || valueInputHasColon;
|
|
65
|
-
const onInputChange = (e) => {
|
|
66
|
-
setInput(e.target.value);
|
|
67
|
-
};
|
|
68
|
-
const onKeyChange = (e) => {
|
|
69
|
-
setKeyValue(e.target.value);
|
|
70
|
-
};
|
|
71
|
-
const onValueChange = (e) => {
|
|
72
|
-
setValue(e.target.value);
|
|
73
|
-
};
|
|
74
|
-
const addValue = (e) => {
|
|
75
|
-
e.preventDefault();
|
|
76
|
-
const items = [...tagItems];
|
|
77
|
-
if (createKeyValuePair && keyValue && value) {
|
|
78
|
-
items.push(`${keyValue}:${value}`);
|
|
79
|
-
setKeyValue("");
|
|
80
|
-
setValue("");
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
if (input) {
|
|
84
|
-
// Check if input is a JSON object
|
|
85
|
-
const inputToTest = input.trim();
|
|
86
|
-
if (inputToTest.slice(0, 1) === "{" && inputToTest.slice(-1) === "}") {
|
|
87
|
-
const inputJsonObject = JSON.parse(input);
|
|
88
|
-
if (typeof inputJsonObject === "object" && inputJsonObject !== null) {
|
|
89
|
-
for (const [key, values] of Object.entries(inputJsonObject)) {
|
|
90
|
-
const valuesArray = [...values];
|
|
91
|
-
valuesArray.forEach((value) => items.push(`${key}:${value}`));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
items.push(input);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
setInput("");
|
|
100
|
-
}
|
|
101
|
-
setCreatedItems(items);
|
|
102
|
-
if (onChange)
|
|
103
|
-
onChange(items);
|
|
104
|
-
inputRef.current?.focus();
|
|
105
|
-
};
|
|
106
|
-
const removeValue = (value) => {
|
|
107
|
-
let items;
|
|
108
|
-
if (removeOnlyFirst) {
|
|
109
|
-
items = [...tagItems];
|
|
110
|
-
const index = items.indexOf(value);
|
|
111
|
-
if (index !== -1) {
|
|
112
|
-
items.splice(index, 1);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
items = tagItems.filter((item) => item !== value);
|
|
117
|
-
}
|
|
118
|
-
setCreatedItems(items);
|
|
119
|
-
if (onChange)
|
|
120
|
-
onChange(items);
|
|
121
|
-
};
|
|
122
|
-
return (React.createElement("div", { key: key, className: `${prefix}--bmrg-creatable` },
|
|
123
|
-
React.createElement("div", { className: `${prefix}--bmrg-creatable__input` },
|
|
124
|
-
createKeyValuePair ? (React.createElement("div", { className: `${prefix}--bmrg-creatable__key-value-inputs` },
|
|
125
|
-
React.createElement("div", { style: {
|
|
126
|
-
marginBottom: hasBothHelperText || keyHelperText ? "0" : valueHelperText ? "1.5rem" : "0rem",
|
|
127
|
-
marginTop: hasBothLabelText || inputKeyLabel ? "0" : inputValueLabel ? "1.5rem" : "0.5rem",
|
|
128
|
-
} },
|
|
129
|
-
React.createElement(TextInput, { disabled: disableInputs, id: `${id}-key`, invalid: isKeyInputValid, invalidText: keyInputInvalidText, helperText: keyHelperText, labelText: inputKeyLabel, onBlur: onKeyBlur, onChange: onKeyChange, placeholder: keyPlaceholder, ref: inputRef, type: type, value: keyValue, ...textInputProps })),
|
|
130
|
-
React.createElement("span", { className: `${prefix}--bmrg-creatable__colon`, style: {
|
|
131
|
-
marginTop: inputKeyLabel || inputValueLabel ? "2.25rem" : "1.25rem",
|
|
132
|
-
} }, ":"),
|
|
133
|
-
React.createElement("div", { style: {
|
|
134
|
-
marginBottom: hasBothHelperText || valueHelperText ? "0" : keyHelperText ? "1.5rem" : "0rem",
|
|
135
|
-
marginTop: hasBothLabelText || inputValueLabel ? "0" : inputKeyLabel ? "1.5rem" : "0.5rem",
|
|
136
|
-
} },
|
|
137
|
-
React.createElement(TextInput, { disabled: disableInputs, id: `${id}-value`, invalid: isValueInputValid, invalidText: valueInputInvalidText, helperText: valueHelperText, labelText: inputValueLabel, onBlur: onValueBlur, onChange: onValueChange, placeholder: valuePlaceholder, type: type, value: value, ...textInputProps })))) : (React.createElement(TextInput, { disabled: disableInputs, id: id, invalid: invalid, invalidText: invalidText, helperText: helperText, labelText: React.createElement("div", { style: { display: "flex" } },
|
|
138
|
-
React.createElement("div", null, inputLabel),
|
|
139
|
-
tooltipContent && (React.createElement("div", { className: tooltipClassName },
|
|
140
|
-
React.createElement(TooltipHover, { ...tooltipProps, tooltipText: tooltipContent },
|
|
141
|
-
React.createElement(Information, { size: 16, fill: "currentColor" }))))), onBlur: onInputBlur, onChange: onInputChange, placeholder: placeholder, ref: inputRef, type: type, value: input, ...textInputProps })),
|
|
142
|
-
React.createElement(Button, { className: createButtonClassName, disabled: isAddButtonDisabled, onClick: addValue, iconDescription: "Add", renderIcon: Add, size: "md", type: "button", ...buttonProps }, buttonContent)),
|
|
143
|
-
React.createElement("div", { className: `${prefix}--bmrg-creatable__tags` }, tagsToShow.map((item, index) => (React.createElement(Tag, { key: `${item}-${index}`, disabled: disabled, type: tagType, onClick: nonDeletable && initialTagItems.includes(item) ? undefined : () => removeValue(item), onKeyDown: nonDeletable && initialTagItems.includes(item)
|
|
144
|
-
? undefined
|
|
145
|
-
: (e) => isAccessibleKeyDownEvent(e) && removeValue(item), filter: !nonDeletable || (nonDeletable && !initialTagItems.includes(item)), ...tagProps }, item))))));
|
|
9
|
+
/*
|
|
10
|
+
IBM Confidential
|
|
11
|
+
694970X, 69497O0
|
|
12
|
+
© Copyright IBM Corp. 2022, 2024
|
|
13
|
+
*/
|
|
14
|
+
function CreatableComponent({ buttonClassName = `${prefix}--bmrg-creatable__button`, buttonContent = "Add", buttonProps, createKeyValuePair = false, disabled, id, initialValues: externalInitialValues, invalid, invalidText, helperText, key, keyHelperText, keyLabel, keyLabelText, keyPlaceholder, label, labelText = "", max, nonDeletable = false, onKeyBlur, onValueBlur, onInputBlur, onChange, placeholder, tagProps, tagType = "teal", textInputProps, tooltipClassName = `${prefix}--bmrg-creatable__tooltip`, tooltipContent, tooltipProps = { direction: "top" }, type = "text", valueHelperText, valueLabel, valueLabelText, valuePlaceholder, value: externalValues, values, trimInput = false, removeOnlyFirst = false, }) {
|
|
15
|
+
const [keyValue, setKeyValue] = useState("");
|
|
16
|
+
const [value, setValue] = useState("");
|
|
17
|
+
const [input, setInput] = useState("");
|
|
18
|
+
const inputRef = React.useRef(null);
|
|
19
|
+
const inputLabel = labelText || label;
|
|
20
|
+
const inputKeyLabel = keyLabelText || keyLabel;
|
|
21
|
+
const inputValueLabel = valueLabelText || valueLabel;
|
|
22
|
+
const [createdItems, setCreatedItems] = useState([]);
|
|
23
|
+
const createButtonClassName = cx(buttonClassName, {
|
|
24
|
+
"--no-label": (!createKeyValuePair && !inputLabel && !tooltipContent) ||
|
|
25
|
+
(createKeyValuePair && !inputKeyLabel && !inputValueLabel),
|
|
26
|
+
});
|
|
27
|
+
/** Add support for csv strings */
|
|
28
|
+
let finalValues;
|
|
29
|
+
let finalExternalValues;
|
|
30
|
+
let finalExternalInitialValues;
|
|
31
|
+
if (typeof values === "string") {
|
|
32
|
+
finalValues = values === "" ? [] : values.split(",");
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
finalValues = values;
|
|
36
|
+
}
|
|
37
|
+
if (typeof externalValues === "string") {
|
|
38
|
+
finalExternalValues = externalValues === "" ? [] : externalValues.split(",");
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
finalExternalValues = externalValues;
|
|
42
|
+
}
|
|
43
|
+
if (typeof externalInitialValues === "string") {
|
|
44
|
+
finalExternalInitialValues = externalInitialValues.split(",");
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
finalExternalInitialValues = externalInitialValues;
|
|
48
|
+
}
|
|
49
|
+
const [initialItems] = useState(finalValues || finalExternalValues ? finalValues || finalExternalValues : []);
|
|
50
|
+
const tagItems = (finalValues || finalExternalValues ? finalValues || finalExternalValues : createdItems); // Externally controlled if values props exists
|
|
51
|
+
const initialTagItems = finalExternalInitialValues || initialItems || []; // Externally controlled if initialValues props exists
|
|
52
|
+
const existValue = (keyValue && value) || (trimInput ? input?.trim() : input);
|
|
53
|
+
const hasBothHelperText = keyHelperText && valueHelperText;
|
|
54
|
+
const hasBothLabelText = inputKeyLabel && inputValueLabel;
|
|
55
|
+
const tagsToShow = finalExternalInitialValues ? [...initialTagItems, ...tagItems] : [...tagItems];
|
|
56
|
+
const disableInputs = disabled || (max && tagsToShow.length >= max && max > 0);
|
|
57
|
+
// Check if key value pair has colon
|
|
58
|
+
const keyInputHasColon = keyValue?.includes(":");
|
|
59
|
+
const valueInputHasColon = value?.includes(":");
|
|
60
|
+
const isKeyInputValid = invalid || keyInputHasColon;
|
|
61
|
+
const isValueInputValid = invalid || valueInputHasColon;
|
|
62
|
+
const keyInputInvalidText = keyInputHasColon ? '":" is not allowed' : invalidText;
|
|
63
|
+
const valueInputInvalidText = valueInputHasColon ? '":" is not allowed' : invalidText;
|
|
64
|
+
const isAddButtonDisabled = disabled || !existValue || keyInputHasColon || valueInputHasColon;
|
|
65
|
+
const onInputChange = (e) => {
|
|
66
|
+
setInput(e.target.value);
|
|
67
|
+
};
|
|
68
|
+
const onKeyChange = (e) => {
|
|
69
|
+
setKeyValue(e.target.value);
|
|
70
|
+
};
|
|
71
|
+
const onValueChange = (e) => {
|
|
72
|
+
setValue(e.target.value);
|
|
73
|
+
};
|
|
74
|
+
const addValue = (e) => {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
const items = [...tagItems];
|
|
77
|
+
if (createKeyValuePair && keyValue && value) {
|
|
78
|
+
items.push(`${keyValue}:${value}`);
|
|
79
|
+
setKeyValue("");
|
|
80
|
+
setValue("");
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
if (input) {
|
|
84
|
+
// Check if input is a JSON object
|
|
85
|
+
const inputToTest = input.trim();
|
|
86
|
+
if (inputToTest.slice(0, 1) === "{" && inputToTest.slice(-1) === "}") {
|
|
87
|
+
const inputJsonObject = JSON.parse(input);
|
|
88
|
+
if (typeof inputJsonObject === "object" && inputJsonObject !== null) {
|
|
89
|
+
for (const [key, values] of Object.entries(inputJsonObject)) {
|
|
90
|
+
const valuesArray = [...values];
|
|
91
|
+
valuesArray.forEach((value) => items.push(`${key}:${value}`));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
items.push(input);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
setInput("");
|
|
100
|
+
}
|
|
101
|
+
setCreatedItems(items);
|
|
102
|
+
if (onChange)
|
|
103
|
+
onChange(items);
|
|
104
|
+
inputRef.current?.focus();
|
|
105
|
+
};
|
|
106
|
+
const removeValue = (value) => {
|
|
107
|
+
let items;
|
|
108
|
+
if (removeOnlyFirst) {
|
|
109
|
+
items = [...tagItems];
|
|
110
|
+
const index = items.indexOf(value);
|
|
111
|
+
if (index !== -1) {
|
|
112
|
+
items.splice(index, 1);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
items = tagItems.filter((item) => item !== value);
|
|
117
|
+
}
|
|
118
|
+
setCreatedItems(items);
|
|
119
|
+
if (onChange)
|
|
120
|
+
onChange(items);
|
|
121
|
+
};
|
|
122
|
+
return (React.createElement("div", { key: key, className: `${prefix}--bmrg-creatable` },
|
|
123
|
+
React.createElement("div", { className: `${prefix}--bmrg-creatable__input` },
|
|
124
|
+
createKeyValuePair ? (React.createElement("div", { className: `${prefix}--bmrg-creatable__key-value-inputs` },
|
|
125
|
+
React.createElement("div", { style: {
|
|
126
|
+
marginBottom: hasBothHelperText || keyHelperText ? "0" : valueHelperText ? "1.5rem" : "0rem",
|
|
127
|
+
marginTop: hasBothLabelText || inputKeyLabel ? "0" : inputValueLabel ? "1.5rem" : "0.5rem",
|
|
128
|
+
} },
|
|
129
|
+
React.createElement(TextInput, { disabled: disableInputs, id: `${id}-key`, invalid: isKeyInputValid, invalidText: keyInputInvalidText, helperText: keyHelperText, labelText: inputKeyLabel, onBlur: onKeyBlur, onChange: onKeyChange, placeholder: keyPlaceholder, ref: inputRef, type: type, value: keyValue, ...textInputProps })),
|
|
130
|
+
React.createElement("span", { className: `${prefix}--bmrg-creatable__colon`, style: {
|
|
131
|
+
marginTop: inputKeyLabel || inputValueLabel ? "2.25rem" : "1.25rem",
|
|
132
|
+
} }, ":"),
|
|
133
|
+
React.createElement("div", { style: {
|
|
134
|
+
marginBottom: hasBothHelperText || valueHelperText ? "0" : keyHelperText ? "1.5rem" : "0rem",
|
|
135
|
+
marginTop: hasBothLabelText || inputValueLabel ? "0" : inputKeyLabel ? "1.5rem" : "0.5rem",
|
|
136
|
+
} },
|
|
137
|
+
React.createElement(TextInput, { disabled: disableInputs, id: `${id}-value`, invalid: isValueInputValid, invalidText: valueInputInvalidText, helperText: valueHelperText, labelText: inputValueLabel, onBlur: onValueBlur, onChange: onValueChange, placeholder: valuePlaceholder, type: type, value: value, ...textInputProps })))) : (React.createElement(TextInput, { disabled: disableInputs, id: id, invalid: invalid, invalidText: invalidText, helperText: helperText, labelText: React.createElement("div", { style: { display: "flex" } },
|
|
138
|
+
React.createElement("div", null, inputLabel),
|
|
139
|
+
tooltipContent && (React.createElement("div", { className: tooltipClassName },
|
|
140
|
+
React.createElement(TooltipHover, { ...tooltipProps, tooltipText: tooltipContent },
|
|
141
|
+
React.createElement(Information, { size: 16, fill: "currentColor" }))))), onBlur: onInputBlur, onChange: onInputChange, placeholder: placeholder, ref: inputRef, type: type, value: input, ...textInputProps })),
|
|
142
|
+
React.createElement(Button, { className: createButtonClassName, disabled: isAddButtonDisabled, onClick: addValue, iconDescription: "Add", renderIcon: Add, size: "md", type: "button", ...buttonProps }, buttonContent)),
|
|
143
|
+
React.createElement("div", { className: `${prefix}--bmrg-creatable__tags` }, tagsToShow.map((item, index) => (React.createElement(Tag, { key: `${item}-${index}`, disabled: disabled, type: tagType, onClick: nonDeletable && initialTagItems.includes(item) ? undefined : () => removeValue(item), onKeyDown: nonDeletable && initialTagItems.includes(item)
|
|
144
|
+
? undefined
|
|
145
|
+
: (e) => isAccessibleKeyDownEvent(e) && removeValue(item), filter: !nonDeletable || (nonDeletable && !initialTagItems.includes(item)), ...tagProps }, item))))));
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
export { CreatableComponent as default };
|