oa-componentbook 0.0.0-sit1.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 +92 -0
- package/build/MockData.js +2311 -0
- package/build/components/oa-component-accordion/Accordion.js +195 -0
- package/build/components/oa-component-accordion/styles.js +13 -0
- package/build/components/oa-component-auto-complete/CustomAutoComplete.js +167 -0
- package/build/components/oa-component-bar-chart/BarChart.js +295 -0
- package/build/components/oa-component-bread-crumb/CustomBreadCrumb.js +47 -0
- package/build/components/oa-component-button/CustomButton.js +108 -0
- package/build/components/oa-component-button/styles.js +41 -0
- package/build/components/oa-component-checkbox/CustomCheckBox.js +115 -0
- package/build/components/oa-component-checkbox/styles.js +12 -0
- package/build/components/oa-component-count-card/CustomCountCard.js +74 -0
- package/build/components/oa-component-count-card/styles.js +12 -0
- package/build/components/oa-component-datepicker/CustomDatePicker.js +134 -0
- package/build/components/oa-component-demo-border-radius/BorderRadiusDemo.js +35 -0
- package/build/components/oa-component-demo-border-radius/styles.js +12 -0
- package/build/components/oa-component-demo-color-variables/ColorVariablesDemo.js +34 -0
- package/build/components/oa-component-demo-color-variables/styles.js +12 -0
- package/build/components/oa-component-demo-elevation/ElevationDemo.js +22 -0
- package/build/components/oa-component-demo-elevation/styles.js +12 -0
- package/build/components/oa-component-demo-spacing/SpacingScales.js +26 -0
- package/build/components/oa-component-demo-spacing/styles.js +259 -0
- package/build/components/oa-component-drawer/CustomDrawer.js +178 -0
- package/build/components/oa-component-drawer/styles.js +16 -0
- package/build/components/oa-component-dropdown/CustomDropdown.js +102 -0
- package/build/components/oa-component-dropdown/customClass.css +9 -0
- package/build/components/oa-component-dropdown/styles.js +12 -0
- package/build/components/oa-component-feedback-form/FeedbackForm.js +75 -0
- package/build/components/oa-component-feedback-tooltip/FeedbackTooltip.js +69 -0
- package/build/components/oa-component-form-item/CustomFormItem.js +74 -0
- package/build/components/oa-component-header/CustomHeader.js +104 -0
- package/build/components/oa-component-header/styles.js +12 -0
- package/build/components/oa-component-icons/CustomIcon.js +92 -0
- package/build/components/oa-component-icons/MaterialIcon.js +70 -0
- package/build/components/oa-component-icons/SizedSvg.js +42 -0
- package/build/components/oa-component-info/CustomInfo.js +119 -0
- package/build/components/oa-component-info/styles.js +15 -0
- package/build/components/oa-component-input/CustomInput.js +131 -0
- package/build/components/oa-component-input-number/CustomInputNumber.js +140 -0
- package/build/components/oa-component-lable/CustomLable.js +37 -0
- package/build/components/oa-component-lable/styles.js +12 -0
- package/build/components/oa-component-loader/CustomLoader.js +66 -0
- package/build/components/oa-component-modal/CustomModal.js +153 -0
- package/build/components/oa-component-modal/styles.js +14 -0
- package/build/components/oa-component-notification/CustomNotification.js +152 -0
- package/build/components/oa-component-notification/styles.js +12 -0
- package/build/components/oa-component-notification/usage-example.md +44 -0
- package/build/components/oa-component-pagination/CustomPagination.js +111 -0
- package/build/components/oa-component-pagination/styles.js +12 -0
- package/build/components/oa-component-popover/CustomPopover.js +58 -0
- package/build/components/oa-component-progress-bar/CustomProgressBar.js +68 -0
- package/build/components/oa-component-progress-bar/styles.js +12 -0
- package/build/components/oa-component-radio/CustomRadio.js +112 -0
- package/build/components/oa-component-radio/styles.js +13 -0
- package/build/components/oa-component-rating/CustomRating.js +13 -0
- package/build/components/oa-component-select/CustomSelect.js +432 -0
- package/build/components/oa-component-steps/CustomSteps.js +117 -0
- package/build/components/oa-component-steps/styles.js +12 -0
- package/build/components/oa-component-table/CustomTable.js +300 -0
- package/build/components/oa-component-table/CustomTableV1.js +610 -0
- package/build/components/oa-component-table/styles.js +14 -0
- package/build/components/oa-component-table/stylesV1.js +19 -0
- package/build/components/oa-component-tabs/CustomTabs.js +102 -0
- package/build/components/oa-component-tabs/styles.js +13 -0
- package/build/components/oa-component-tag/CustomTag.js +66 -0
- package/build/components/oa-component-tag/styles.js +75 -0
- package/build/components/oa-component-textarea/CustomTextArea.js +74 -0
- package/build/components/oa-component-textarea/styles.js +16 -0
- package/build/components/oa-component-timeline/CustomTimeline.js +65 -0
- package/build/components/oa-component-timeline/styles.js +15 -0
- package/build/components/oa-component-timepicker/CustomTimePicker.js +104 -0
- package/build/components/oa-component-toggle/CustomToggle.js +111 -0
- package/build/components/oa-component-toggle/styles.js +43 -0
- package/build/components/oa-component-tooltip/CustomTooltip.js +70 -0
- package/build/components/oa-component-typography/Typography.js +58 -0
- package/build/components/oa-component-typography/styles.js +13 -0
- package/build/components/oa-component-upload/CustomUpload.js +332 -0
- package/build/components/oa-component-upload/styles.js +13 -0
- package/build/components/oa-component-viewer/CustomViewer.js +273 -0
- package/build/components/oa-component-viewer/styles.js +14 -0
- package/build/constants/ratingConstants.js +194 -0
- package/build/dev/oa-component-document-viewer/CustomDocumentViewer.js +367 -0
- package/build/dev/oa-component-document-viewer/styles.js +12 -0
- package/build/dev/oa-component-timeline/CustomTimeline.js +53 -0
- package/build/dev/oa-component-timeline/styles.js +15 -0
- package/build/dev/oa-component-upload/CustomUpload.js +285 -0
- package/build/dev/oa-component-upload/styles.js +13 -0
- package/build/dev/oa-component-viewer/CustomViewer.js +326 -0
- package/build/dev/oa-component-viewer/styles.js +14 -0
- package/build/dev/oa-widget-document-modal/DocumentSideModal.js +166 -0
- package/build/dev/oa-widget-document-modal/styles.js +12 -0
- package/build/dev/oa-widget-document-side-drawer/DocumentSideDrawer.js +196 -0
- package/build/dev/oa-widget-document-side-drawer/styles.js +12 -0
- package/build/dev/oa-widget-document-upload-card/DocUploadCardWidget.js +179 -0
- package/build/dev/oa-widget-document-upload-card/styles.js +13 -0
- package/build/global-css/BorderRadius.js +22 -0
- package/build/global-css/ColorVariables.js +26 -0
- package/build/global-css/ColorVariablesMap.js +29 -0
- package/build/global-css/CustomDropDownThemes.js +31 -0
- package/build/global-css/Elevation.js +35 -0
- package/build/global-css/GlobalCss.js +26 -0
- package/build/global-css/GridLayout.js +25 -0
- package/build/global-css/SpacingScales.js +11 -0
- package/build/global-css/Typographies.js +26 -0
- package/build/global-css/TypographiesMap.js +71 -0
- package/build/global-css/color-options.js +8 -0
- package/build/global-css/commonStyles.js +11 -0
- package/build/global-css/tooltip-placement-option.js +8 -0
- package/build/global-css/typography-options.js +8 -0
- package/build/images/AC.png +0 -0
- package/build/images/Car.png +0 -0
- package/build/images/Cooler.png +0 -0
- package/build/images/Default.png +0 -0
- package/build/images/Footwear.png +0 -0
- package/build/images/Furniture.png +0 -0
- package/build/images/Glasses.png +0 -0
- package/build/images/HA.png +0 -0
- package/build/images/Laptop.png +0 -0
- package/build/images/Luggage.png +0 -0
- package/build/images/Microwave.png +0 -0
- package/build/images/Mobile.png +0 -0
- package/build/images/PdfSampleImage.png +0 -0
- package/build/images/Refrigerator.png +0 -0
- package/build/images/Shirts.png +0 -0
- package/build/images/Tablets.png +0 -0
- package/build/images/Television.png +0 -0
- package/build/images/TwoWheeler.png +0 -0
- package/build/images/Wallet.png +0 -0
- package/build/images/WashingMachine.png +0 -0
- package/build/images/WaterPurifier.png +0 -0
- package/build/images/Wearable.png +0 -0
- package/build/images/ajax-loader.gif +0 -0
- package/build/images/astronaut_emptystate.png +0 -0
- package/build/images/caution.svg +3 -0
- package/build/images/close.svg +3 -0
- package/build/images/current-location.svg +3 -0
- package/build/images/delete.svg +8 -0
- package/build/images/exportGrp01.png +0 -0
- package/build/images/exportGrp02.png +0 -0
- package/build/images/exportGrp03.png +0 -0
- package/build/images/hand-icon.svg +4 -0
- package/build/images/iphone.svg +9 -0
- package/build/images/left-icon.svg +28 -0
- package/build/images/map_pointer.svg +25 -0
- package/build/images/modal-img.svg +8 -0
- package/build/images/oaChat.svg +5 -0
- package/build/images/offer.svg +3 -0
- package/build/images/oneassist-logo.png +0 -0
- package/build/images/outOfStock.png +0 -0
- package/build/images/right-icon.svg +28 -0
- package/build/images/search_ic.svg +3 -0
- package/build/images/search_not_found.svg +7 -0
- package/build/images/upload.svg +8 -0
- package/build/images/zoom.svg +4 -0
- package/build/index.js +763 -0
- package/build/layout/DetailDataLayout/DetailDataLayout.js +20 -0
- package/build/layout/DetailDataLayout/components/Form.js +22 -0
- package/build/layout/DetailDataLayout/components/Header.js +32 -0
- package/build/layout/DetailDataLayout/style.css +9 -0
- package/build/layout/DetailDataLayout/styles.js +12 -0
- package/build/layout/EntityOverviewLayout/EntityOverviewLayout.js +235 -0
- package/build/layout/EntityOverviewLayout/reducer/entityOverviewLayoutReducer.js +63 -0
- package/build/layout/EntityOverviewLayout/styles.js +13 -0
- package/build/layout/GenricLayOut/GenricLayOut.js +2293 -0
- package/build/layout/GenricLayOut/components/AppliedFilters.js +84 -0
- package/build/layout/GenricLayOut/components/CardList.js +34 -0
- package/build/layout/GenricLayOut/components/DropdownSearch.js +48 -0
- package/build/layout/GenricLayOut/components/Header.js +74 -0
- package/build/layout/GenricLayOut/components/Modal.js +85 -0
- package/build/layout/GenricLayOut/components/ProfileSection.js +87 -0
- package/build/layout/GenricLayOut/components/Search.js +51 -0
- package/build/layout/GenricLayOut/components/StaticFilter.css +73 -0
- package/build/layout/GenricLayOut/components/StaticFilter.js +37 -0
- package/build/layout/GenricLayOut/reducer/layoutReducer.js +294 -0
- package/build/layout/GenricLayOut/resolver/staticConfigResolver.js +98 -0
- package/build/layout/GenricLayOut/styles.js +25 -0
- package/build/layout/paymentAndConsent/CancelScreen.js +46 -0
- package/build/layout/paymentAndConsent/ConsentCard.js +68 -0
- package/build/layout/paymentAndConsent/DetailsCard.js +75 -0
- package/build/layout/paymentAndConsent/DetailsList.js +38 -0
- package/build/layout/paymentAndConsent/Header.js +33 -0
- package/build/layout/paymentAndConsent/InProgressScreen.js +46 -0
- package/build/layout/paymentAndConsent/Loader.js +21 -0
- package/build/layout/paymentAndConsent/Modal.js +28 -0
- package/build/layout/paymentAndConsent/PaymentAndConsent.js +22 -0
- package/build/layout/paymentAndConsent/PaymentCard.js +83 -0
- package/build/layout/paymentAndConsent/Section.js +34 -0
- package/build/layout/paymentAndConsent/SuccessScreen.js +46 -0
- package/build/layout/paymentAndConsent/TimeLineCard.js +28 -0
- package/build/layout/paymentAndConsent/TncList.js +32 -0
- package/build/layout/paymentAndConsent/style.js +12 -0
- package/build/utils/common.js +20 -0
- package/build/utils/download-file.js +23 -0
- package/build/utils/fix-decimal-places.js +24 -0
- package/build/utils/get-uuid.js +41 -0
- package/build/utils/hex-to-rgb.js +30 -0
- package/build/utils/index.js +78 -0
- package/build/utils/random-generators.js +19 -0
- package/build/utils/rupee-formatters.js +69 -0
- package/build/utils/type-checkers.js +16 -0
- package/build/widgets/oa-form-widget/FormWidget.js +544 -0
- package/build/widgets/oa-form-widget/FormWidgetStyle.js +18 -0
- package/build/widgets/oa-widget-add-spare-part/AddSparePartCollapseWidget.js +461 -0
- package/build/widgets/oa-widget-add-spare-part/AddSparePartWidget.js +355 -0
- package/build/widgets/oa-widget-add-spare-part/styles.js +12 -0
- package/build/widgets/oa-widget-address/AddressWidget.js +55 -0
- package/build/widgets/oa-widget-address/styles.js +13 -0
- package/build/widgets/oa-widget-approval/ApprovalWidget.js +200 -0
- package/build/widgets/oa-widget-approval/ApprovalWidgetNew.js +492 -0
- package/build/widgets/oa-widget-approval/styles.js +13 -0
- package/build/widgets/oa-widget-chat/ChatWidget.js +261 -0
- package/build/widgets/oa-widget-chat/styles.js +17 -0
- package/build/widgets/oa-widget-close-claim/CloseClaimWidget.js +256 -0
- package/build/widgets/oa-widget-close-claim/styles.js +12 -0
- package/build/widgets/oa-widget-collapsible-key-value/CollapsibleKeyValueWidget.js +395 -0
- package/build/widgets/oa-widget-collapsible-key-value/styles.js +16 -0
- package/build/widgets/oa-widget-content-panel/ContentPanel.js +82 -0
- package/build/widgets/oa-widget-content-panel/styles.js +12 -0
- package/build/widgets/oa-widget-custom-details/CustomDetails.js +41 -0
- package/build/widgets/oa-widget-customer-rating-card/CustomerRatingCard.js +147 -0
- package/build/widgets/oa-widget-customer-rating-card/styles.js +12 -0
- package/build/widgets/oa-widget-date-dropdown/DateDropDown.js +385 -0
- package/build/widgets/oa-widget-date-dropdown/styles.js +12 -0
- package/build/widgets/oa-widget-detailcard/MembershipDetailCard.js +182 -0
- package/build/widgets/oa-widget-detailcard/styles.js +12 -0
- package/build/widgets/oa-widget-document-upload/DocUploadWidget.js +264 -0
- package/build/widgets/oa-widget-document-upload/styles.js +13 -0
- package/build/widgets/oa-widget-document-upload-card/DocUploadCardWidget.js +178 -0
- package/build/widgets/oa-widget-document-upload-card/styles.js +13 -0
- package/build/widgets/oa-widget-dropdown-search-input/DropdownSearchInput.js +200 -0
- package/build/widgets/oa-widget-dropdown-search-input/styles.js +12 -0
- package/build/widgets/oa-widget-feedback/FeedbackWidget.js +83 -0
- package/build/widgets/oa-widget-feedback/styles.js +13 -0
- package/build/widgets/oa-widget-form/CustomFormWidget.js +51 -0
- package/build/widgets/oa-widget-form/styles.js +12 -0
- package/build/widgets/oa-widget-googlerating/GoogleRating.js +55 -0
- package/build/widgets/oa-widget-googlerating/styles.js +12 -0
- package/build/widgets/oa-widget-guide/GuideWidget.js +70 -0
- package/build/widgets/oa-widget-guide/GuideWidgetStyle.js +12 -0
- package/build/widgets/oa-widget-header/CustomHeaderWidget.js +98 -0
- package/build/widgets/oa-widget-header/styles.js +12 -0
- package/build/widgets/oa-widget-hub-automation-modal/HubAutomationDeleteBiker.js +24 -0
- package/build/widgets/oa-widget-hub-automation-modal/HubAutomationModal.js +34 -0
- package/build/widgets/oa-widget-hub-automation-modal/HubAutomationModalStyle.js +13 -0
- package/build/widgets/oa-widget-image-carousel/ImageCarouselWidget.js +256 -0
- package/build/widgets/oa-widget-image-carousel/styles.js +23 -0
- package/build/widgets/oa-widget-image-gallery/FullscreenViewer.js +169 -0
- package/build/widgets/oa-widget-image-gallery/ImageGallery.js +87 -0
- package/build/widgets/oa-widget-image-gallery/ThumbnailGrid.js +146 -0
- package/build/widgets/oa-widget-image-gallery/imageCache.js +15 -0
- package/build/widgets/oa-widget-image-gallery/imageGalleryStyle.js +16 -0
- package/build/widgets/oa-widget-input-pattern-pin/CustomPinPatternCaptureWidget.js +395 -0
- package/build/widgets/oa-widget-input-pattern-pin/styles.js +12 -0
- package/build/widgets/oa-widget-item-info-card/InfoCardListWidget.js +60 -0
- package/build/widgets/oa-widget-item-info-card/ItemInfoCardWidget.js +77 -0
- package/build/widgets/oa-widget-item-info-card/styles.css +50 -0
- package/build/widgets/oa-widget-item-info-card/styles.js +14 -0
- package/build/widgets/oa-widget-key-value/KeyValueWidget.js +121 -0
- package/build/widgets/oa-widget-key-value/styles.js +14 -0
- package/build/widgets/oa-widget-kpi/KPICardWidget.js +86 -0
- package/build/widgets/oa-widget-kpi/styles.js +12 -0
- package/build/widgets/oa-widget-location-access/LocationAccessWidget.js +92 -0
- package/build/widgets/oa-widget-location-access/styles.js +12 -0
- package/build/widgets/oa-widget-map-base-location/AddressDetails.js +84 -0
- package/build/widgets/oa-widget-map-base-location/AddressForm.js +106 -0
- package/build/widgets/oa-widget-map-base-location/CustomModalComponent.js +58 -0
- package/build/widgets/oa-widget-map-base-location/MapBaseLocation.js +93 -0
- package/build/widgets/oa-widget-map-base-location/MapComponent.js +167 -0
- package/build/widgets/oa-widget-map-base-location/styles.js +12 -0
- package/build/widgets/oa-widget-membershipcard/MembershipCard.js +266 -0
- package/build/widgets/oa-widget-membershipcard/styles.js +13 -0
- package/build/widgets/oa-widget-multiple-collapse-with-slots/MultipleCollapseWithSlots.js +85 -0
- package/build/widgets/oa-widget-multiple-collapse-with-slots/checkactive.svg +8 -0
- package/build/widgets/oa-widget-multiple-collapse-with-slots/checkhover.svg +8 -0
- package/build/widgets/oa-widget-multiple-collapse-with-slots/styles.js +16 -0
- package/build/widgets/oa-widget-notes/NotesWidget.js +135 -0
- package/build/widgets/oa-widget-notes/styles.js +13 -0
- package/build/widgets/oa-widget-pincode-base-location/PincodeBaseLocation.js +281 -0
- package/build/widgets/oa-widget-pincode-base-location/styles.js +12 -0
- package/build/widgets/oa-widget-plan-card/PlanCard.js +183 -0
- package/build/widgets/oa-widget-plan-card/styles.js +13 -0
- package/build/widgets/oa-widget-preview/Preview.js +172 -0
- package/build/widgets/oa-widget-preview/ZoomImageComponent.js +95 -0
- package/build/widgets/oa-widget-preview/styles.js +12 -0
- package/build/widgets/oa-widget-profile-data/ProfileDataWidget.js +117 -0
- package/build/widgets/oa-widget-profile-data/styles.js +13 -0
- package/build/widgets/oa-widget-progressive-steps/ProgressiveStepsWidget.js +362 -0
- package/build/widgets/oa-widget-progressive-steps/styles.js +12 -0
- package/build/widgets/oa-widget-reimbursement-breakup/ReimbursementBreakupWidget.js +141 -0
- package/build/widgets/oa-widget-reimbursement-breakup/styles.js +12 -0
- package/build/widgets/oa-widget-repair-service/RepairServiceWidget.js +79 -0
- package/build/widgets/oa-widget-repair-service/styles.js +12 -0
- package/build/widgets/oa-widget-reupload-drawer/ReUploadDrawer.js +164 -0
- package/build/widgets/oa-widget-send-payment-link/SendPaymentLinkWidget.js +224 -0
- package/build/widgets/oa-widget-send-payment-link/styles.js +15 -0
- package/build/widgets/oa-widget-servicecard/ServiceCard.js +185 -0
- package/build/widgets/oa-widget-servicecard/styles.js +13 -0
- package/build/widgets/oa-widget-sidebar/SidebarWidget.js +105 -0
- package/build/widgets/oa-widget-sidebar/components/Header.js +33 -0
- package/build/widgets/oa-widget-sidebar/sidebar.css +0 -0
- package/build/widgets/oa-widget-sidebar/styles.js +13 -0
- package/build/widgets/oa-widget-spare-part/SparePartsCollapseWidget.js +127 -0
- package/build/widgets/oa-widget-spare-part/SparePartsWidget.js +294 -0
- package/build/widgets/oa-widget-spare-part/styles.js +18 -0
- package/build/widgets/oa-widget-stage-timeline/StageTimelineWidget.js +159 -0
- package/build/widgets/oa-widget-stage-timeline/styles.js +29 -0
- package/build/widgets/oa-widget-track-shipment/TrackShipmentWidget.js +232 -0
- package/build/widgets/oa-widget-track-shipment/styles.js +13 -0
- package/build/widgets/oa-widget-track-shipment-list/TrackShipmentWidgetList.js +103 -0
- package/build/widgets/oa-widget-track-shipment-list/fn.js +81 -0
- package/build/widgets/oa-widget-track-shipment-list/styles.js +13 -0
- package/build/widgets/oa-widget-upload-download/UploadDownloadWidget.js +167 -0
- package/build/widgets/oa-widget-upload-download/styles.js +14 -0
- package/build/widgets/oa-widget-user-management/UserManagementWidget.js +352 -0
- package/build/widgets/oa-widget-user-management/styles.js +15 -0
- package/build/widgets/oa-widget-view-history/ViewHistoryWidget.js +181 -0
- package/build/widgets/oa-widget-view-history/styles.js +12 -0
- package/build/widgets/oa-widget-view-previous-description/ViewPreviousDescriptionWidget.js +188 -0
- package/build/widgets/oa-widget-view-previous-description/styles.js +16 -0
- package/package.json +100 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getSwitchConfig = exports.default = exports.SwitchStyle = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _antd = require("antd");
|
|
9
|
+
var _templateObject; // ToggleStyles.js
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
|
+
var _default = exports.default = {};
|
|
13
|
+
const SwitchStyle = exports.SwitchStyle = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.ant-switch{\n min-width: 56px;\n height: 32px;\n}\n.ant-switch .ant-switch-handle::before{\n border-radius: 50px;\n}\n.ant-switch .ant-switch-handle{\n width: 28px;\n height: 28px;\n}\n.ant-switch.ant-switch-checked .ant-switch-handle {\n inset-inline-start: calc(100% - 30px);\n}\n.ant-switch-small .ant-switch-handle{\n width: 16px;\n height: 16px;\n}\n.ant-switch.ant-switch-small.ant-switch-checked .ant-switch-handle {\n inset-inline-start: calc(100% - 18px) !important;\n}\n .ant-switch.ant-switch-small {\n min-width: 35px;\n height: 20px;\n"])));
|
|
14
|
+
const getSwitchConfig = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
disabled
|
|
17
|
+
} = _ref;
|
|
18
|
+
return {
|
|
19
|
+
// trackPadding: '2px',
|
|
20
|
+
// handleSizeSM: '1rem',
|
|
21
|
+
// handleSize: '28',
|
|
22
|
+
// trackHeightSM: '1.25rem',
|
|
23
|
+
// trackHeight: '2rem',
|
|
24
|
+
// trackMinWidthSM: '2.1875rem',
|
|
25
|
+
// trackMinWidth: '3.5rem',
|
|
26
|
+
|
|
27
|
+
// Toggle handle color.
|
|
28
|
+
handleBg: "var(".concat(disabled ? '--color-secondary-content' : '--color-primary-background', ")"),
|
|
29
|
+
// Toggle labels color.
|
|
30
|
+
colorText: "var(".concat(disabled ? '--color-secondary-content' : '--color-primary-background', ")"),
|
|
31
|
+
// Toggle on, background color
|
|
32
|
+
colorPrimary: "var(".concat(disabled ? '--color-disabled-button' : '--color-primary', ")"),
|
|
33
|
+
// Toggle on, hover background color
|
|
34
|
+
colorPrimaryHover: 'var(--color-primary-hover)',
|
|
35
|
+
// Toggle off, hover background color.
|
|
36
|
+
colorTextTertiary: 'var(--color-primary-hover)',
|
|
37
|
+
// Toggle off, background color.
|
|
38
|
+
colorTextQuaternary: "var(".concat(disabled ? '--color-disabled-button' : '--color-secondary-content', ")"),
|
|
39
|
+
// Removes lightening effect on disable.
|
|
40
|
+
opacityLoading: 1
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
exports.getSwitchConfig = getSwitchConfig;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.assign.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _antd = require("antd");
|
|
11
|
+
var _tooltipPlacementOption = require("../../global-css/tooltip-placement-option");
|
|
12
|
+
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
13
|
+
const _excluded = ["title", "placement", "children", "mode", "data-test"];
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
+
/**
|
|
19
|
+
* CustomTooltip component that wraps the children with a tooltip.
|
|
20
|
+
*
|
|
21
|
+
* @param {string|React.ReactNode} title - The title of the tooltip.
|
|
22
|
+
* @param {string} placement - The placement of the tooltip.
|
|
23
|
+
* @param {React.ReactNode} children - The content to be wrapped with the tooltip.
|
|
24
|
+
* @param {string} dataTest - The data attribute for testing purposes.
|
|
25
|
+
* @param {object} antDesignProps - Additional props for the Ant Design Tooltip component.
|
|
26
|
+
* @returns {React.ReactNode} The component with the tooltip.
|
|
27
|
+
*/
|
|
28
|
+
function CustomTooltip(_ref) {
|
|
29
|
+
let {
|
|
30
|
+
title,
|
|
31
|
+
placement,
|
|
32
|
+
children,
|
|
33
|
+
mode,
|
|
34
|
+
'data-test': dataTest
|
|
35
|
+
} = _ref,
|
|
36
|
+
antDesignProps = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
38
|
+
theme: {
|
|
39
|
+
components: {
|
|
40
|
+
Tooltip: {
|
|
41
|
+
colorBgSpotlight: _ColorVariablesMap.default['--color-primary-content'],
|
|
42
|
+
borderRadius: 4,
|
|
43
|
+
paddingXS: 8,
|
|
44
|
+
paddingSM: 16,
|
|
45
|
+
sizePopupArrow: 12,
|
|
46
|
+
boxShadowSecondary: null
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Tooltip, _extends({
|
|
51
|
+
title: title,
|
|
52
|
+
placement: placement,
|
|
53
|
+
"data-test": dataTest,
|
|
54
|
+
overlayClassName: mode === 'light' ? 'customLightTooltip' : ''
|
|
55
|
+
}, antDesignProps), children));
|
|
56
|
+
}
|
|
57
|
+
CustomTooltip.propTypes = {
|
|
58
|
+
title: _propTypes.default.node.isRequired,
|
|
59
|
+
placement: _propTypes.default.oneOf(_tooltipPlacementOption.tooltipPlacementOptions),
|
|
60
|
+
children: _propTypes.default.node,
|
|
61
|
+
'data-test': _propTypes.default.string,
|
|
62
|
+
mode: _propTypes.default.oneOf(['light', 'dark'])
|
|
63
|
+
};
|
|
64
|
+
CustomTooltip.defaultProps = {
|
|
65
|
+
placement: 'top',
|
|
66
|
+
children: null,
|
|
67
|
+
'data-test': null,
|
|
68
|
+
mode: 'dark'
|
|
69
|
+
};
|
|
70
|
+
var _default = exports.default = CustomTooltip;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.assign.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _styles = require("./styles");
|
|
11
|
+
var _colorOptions = require("../../global-css/color-options");
|
|
12
|
+
var _typographyOptions = require("../../global-css/typography-options");
|
|
13
|
+
const _excluded = ["children", "color", "data-test", "typography"];
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
+
/**
|
|
19
|
+
* A Typography component.
|
|
20
|
+
*
|
|
21
|
+
* This component renders a styled span with the text
|
|
22
|
+
* you provide. It also provides optional props for
|
|
23
|
+
* changing the color of the text, providing a data-test
|
|
24
|
+
* value for testing, and providing a typography style
|
|
25
|
+
* from the design system.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} children The text to render inside the Typography component.
|
|
28
|
+
* @param {string} color The color of the text. Should be one of the values from the design system.
|
|
29
|
+
* @param {string} [data-test] The value for the data-test attribute.
|
|
30
|
+
* @param {string} [typography] The typography style from the design system to use.
|
|
31
|
+
* @return {ReactElement} The rendered component.
|
|
32
|
+
*/
|
|
33
|
+
function Typography(_ref) {
|
|
34
|
+
let {
|
|
35
|
+
children,
|
|
36
|
+
color,
|
|
37
|
+
'data-test': dataTest,
|
|
38
|
+
typography
|
|
39
|
+
} = _ref,
|
|
40
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_styles.StyledTypography, _extends({
|
|
42
|
+
color: color,
|
|
43
|
+
className: "".concat(typography),
|
|
44
|
+
"data-test": dataTest
|
|
45
|
+
}, props), children);
|
|
46
|
+
}
|
|
47
|
+
Typography.propTypes = {
|
|
48
|
+
color: _propTypes.default.oneOf(_colorOptions.colorOptions),
|
|
49
|
+
children: _propTypes.default.node.isRequired,
|
|
50
|
+
'data-test': _propTypes.default.string,
|
|
51
|
+
typography: _propTypes.default.oneOf(_typographyOptions.typographyOptions)
|
|
52
|
+
};
|
|
53
|
+
Typography.defaultProps = {
|
|
54
|
+
color: null,
|
|
55
|
+
'data-test': null,
|
|
56
|
+
typography: null
|
|
57
|
+
};
|
|
58
|
+
var _default = exports.default = Typography;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.StyledTypography = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _TypographiesMap = _interopRequireDefault(require("../../global-css/TypographiesMap"));
|
|
9
|
+
var _templateObject;
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
|
+
var _default = exports.default = {};
|
|
13
|
+
const StyledTypography = exports.StyledTypography = _styledComponents.default.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n // If a color is provided then that is used, otherwise the color is inherited from parent.\n color: ", ";\n\n &.type-d1-500 {\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n }\n \n &.type-d2-500 {\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n }\n \n &.type-h1-500 {\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n }\n \n &.type-h2-500 {\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n }\n \n &.type-h3-500 {\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n }\n\n &.type-t1-500 {\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n }\n \n &.type-t2-700 {\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n }\n \n &.type-b1-400 {\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n }\n \n &.type-b2-400 {\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n }\n \n &.type-b3-400 {\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n }\n \n &.type-button-500 {\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n }\n \n &.type-sl1-700 {\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n letter-spacing: ", "px;\n text-transform: ", ";\n } \n"])), props => props.color !== null ? "var(--color-".concat(props.color, ")") : 'inherit', _TypographiesMap.default['type-d1-500']['font-size'], _TypographiesMap.default['type-d1-500']['font-weight'], _TypographiesMap.default['type-d1-500']['line-height'], _TypographiesMap.default['type-d2-500']['font-size'], _TypographiesMap.default['type-d2-500']['font-weight'], _TypographiesMap.default['type-d2-500']['line-height'], _TypographiesMap.default['type-h1-500']['font-size'], _TypographiesMap.default['type-h1-500']['font-weight'], _TypographiesMap.default['type-h1-500']['line-height'], _TypographiesMap.default['type-h2-500']['font-size'], _TypographiesMap.default['type-h2-500']['font-weight'], _TypographiesMap.default['type-h2-500']['line-height'], _TypographiesMap.default['type-h3-500']['font-size'], _TypographiesMap.default['type-h3-500']['font-weight'], _TypographiesMap.default['type-h3-500']['line-height'], _TypographiesMap.default['type-t1-500']['font-size'], _TypographiesMap.default['type-t1-500']['font-weight'], _TypographiesMap.default['type-t1-500']['line-height'], _TypographiesMap.default['type-t2-700']['font-size'], _TypographiesMap.default['type-t2-700']['font-weight'], _TypographiesMap.default['type-t2-700']['line-height'], _TypographiesMap.default['type-b1-400']['font-size'], _TypographiesMap.default['type-b1-400']['font-weight'], _TypographiesMap.default['type-b1-400']['line-height'], _TypographiesMap.default['type-b2-400']['font-size'], _TypographiesMap.default['type-b2-400']['font-weight'], _TypographiesMap.default['type-b2-400']['line-height'], _TypographiesMap.default['type-b3-400']['font-size'], _TypographiesMap.default['type-b3-400']['font-weight'], _TypographiesMap.default['type-b3-400']['line-height'], _TypographiesMap.default['type-button-500']['font-size'], _TypographiesMap.default['type-button-500']['font-weight'], _TypographiesMap.default['type-button-500']['line-height'], _TypographiesMap.default['type-sl1-700']['font-size'], _TypographiesMap.default['type-sl1-700']['font-weight'], _TypographiesMap.default['type-sl1-700']['line-height'], _TypographiesMap.default['type-sl1-700']['letter-spacing'], _TypographiesMap.default['type-sl1-700']['text-transform']);
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.assign.js");
|
|
4
|
+
require("core-js/modules/es.weak-map.js");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
require("core-js/modules/es.promise.js");
|
|
10
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
+
require("core-js/modules/es.array.includes.js");
|
|
12
|
+
require("core-js/modules/es.string.includes.js");
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
var _icons = require("@ant-design/icons");
|
|
16
|
+
var _antd = require("antd");
|
|
17
|
+
var _RemoveRedEye = _interopRequireDefault(require("@material-ui/icons/RemoveRedEye"));
|
|
18
|
+
var _CustomInfo = _interopRequireDefault(require("../oa-component-info/CustomInfo"));
|
|
19
|
+
var _MaterialIcon = _interopRequireDefault(require("../oa-component-icons/MaterialIcon"));
|
|
20
|
+
var _Typography = _interopRequireDefault(require("../oa-component-typography/Typography"));
|
|
21
|
+
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
22
|
+
var _styles = require("./styles");
|
|
23
|
+
var _CustomLoader = _interopRequireDefault(require("../oa-component-loader/CustomLoader"));
|
|
24
|
+
var _upload = _interopRequireDefault(require("../../images/upload.svg"));
|
|
25
|
+
var _CustomIcon = _interopRequireDefault(require("../oa-component-icons/CustomIcon"));
|
|
26
|
+
var _CustomViewer = _interopRequireDefault(require("../oa-component-viewer/CustomViewer"));
|
|
27
|
+
var _CustomModal = _interopRequireDefault(require("../oa-component-modal/CustomModal"));
|
|
28
|
+
var _handIcon = _interopRequireDefault(require("../../images/hand-icon.svg"));
|
|
29
|
+
var _PdfSampleImage = _interopRequireDefault(require("../../images/PdfSampleImage.png"));
|
|
30
|
+
var _CustomNotification = _interopRequireDefault(require("../../components/oa-component-notification/CustomNotification"));
|
|
31
|
+
const _excluded = ["uploadedDocuments", "onChange", "multipleDoc", "showDelete", "formName", "getPreview", "isMandatory", "noOfUpload", "downloadCallback", "formRules", "allowLocalDelete", "deleteHandler", "s3ResponseReturn", "form", "beforeUploadFileValidations", "allowedMediaType", "maxAllowedSize", "generateS3Url", "uploadOnS3", "label"];
|
|
32
|
+
/* eslint-disable */
|
|
33
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
35
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
36
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
37
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
38
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
39
|
+
/**
|
|
40
|
+
* Takes a file and returns a Promise that resolves with the file as a base64 encoded string.
|
|
41
|
+
* The Promise is rejected if there is an error reading the file.
|
|
42
|
+
* @param {File} file The file to be converted to base64
|
|
43
|
+
* @returns {Promise<string>} A Promise that resolves with the file as a base64 encoded string
|
|
44
|
+
*/
|
|
45
|
+
const getBase64 = file => new Promise((resolve, reject) => {
|
|
46
|
+
const reader = new FileReader();
|
|
47
|
+
reader.readAsDataURL(file);
|
|
48
|
+
reader.onload = () => resolve(reader.result);
|
|
49
|
+
reader.onerror = error => reject(error);
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Downloads a file from a base64 encoded string.
|
|
53
|
+
* @param {string} base64String The base64 encoded string of the file to be downloaded
|
|
54
|
+
* @param {string} [fileName] The name of the file to be downloaded. If not provided, the file will be downloaded with the name 'download'.
|
|
55
|
+
* @returns {undefined}
|
|
56
|
+
*/
|
|
57
|
+
const downloadFile = (base64String, fileName) => {
|
|
58
|
+
const link = document.createElement("a");
|
|
59
|
+
link.href = base64String;
|
|
60
|
+
link.download = fileName || "download";
|
|
61
|
+
link.click();
|
|
62
|
+
};
|
|
63
|
+
function isImageFile(fileName) {
|
|
64
|
+
var _fileName$split;
|
|
65
|
+
// Extract the file extension from the file name
|
|
66
|
+
const fileExtension = fileName === null || fileName === void 0 || (_fileName$split = fileName.split(".")) === null || _fileName$split === void 0 || (_fileName$split = _fileName$split.pop()) === null || _fileName$split === void 0 ? void 0 : _fileName$split.toLowerCase();
|
|
67
|
+
|
|
68
|
+
// Define an array of image file extensions
|
|
69
|
+
const imageFileExtensions = ["jpg", "jpeg", "png"];
|
|
70
|
+
|
|
71
|
+
// Check if the file extension is in the array of image file extensions
|
|
72
|
+
if (imageFileExtensions.indexOf(fileExtension) !== -1) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* DocumentUpload is a component that allows users to upload documents. It takes a number of props which control its behavior.
|
|
79
|
+
* @param {object} props The props passed to the component
|
|
80
|
+
* @param {array} [props.uploadedDocuments=[]] An array of documents that have already been uploaded
|
|
81
|
+
* @param {function} props.onChange A function that is called whenever the list of uploaded documents changes
|
|
82
|
+
* @param {number} [props.multipleDoc=0] The maximum number of documents that can be uploaded. If set to 0, there is no limit
|
|
83
|
+
* @param {boolean} [props.showDelete=false] Whether or not to show a delete button next to each uploaded document
|
|
84
|
+
* @param {string} [props.formName] The name of the form field that the uploaded documents should be associated with
|
|
85
|
+
* @param {function} [props.getPreview] A function that is called whenever the user clicks on an uploaded document. It should return a Promise that resolves with the URL of the document
|
|
86
|
+
* @param {boolean} [props.isMandatory=false] Whether or not the component is mandatory
|
|
87
|
+
* @param {number} [props.noOfUpload=1] The number of document that can be uploaded.
|
|
88
|
+
* @param {function} [props.downloadCallback] A function that is called whenever the user clicks on the download button. It should return a Promise that resolves with the URL of the document
|
|
89
|
+
* @param {function} [props.deleteHandler] A function that is called whenever the user clicks on the delete button. It should return a Promise that resolves with the deleted document
|
|
90
|
+
* @returns {object} A React component
|
|
91
|
+
*/
|
|
92
|
+
function DocumentUpload(_ref) {
|
|
93
|
+
let {
|
|
94
|
+
uploadedDocuments = [],
|
|
95
|
+
onChange,
|
|
96
|
+
multipleDoc,
|
|
97
|
+
showDelete,
|
|
98
|
+
formName,
|
|
99
|
+
getPreview,
|
|
100
|
+
isMandatory,
|
|
101
|
+
noOfUpload,
|
|
102
|
+
downloadCallback,
|
|
103
|
+
formRules,
|
|
104
|
+
allowLocalDelete,
|
|
105
|
+
deleteHandler,
|
|
106
|
+
s3ResponseReturn = () => {},
|
|
107
|
+
form,
|
|
108
|
+
beforeUploadFileValidations,
|
|
109
|
+
allowedMediaType,
|
|
110
|
+
maxAllowedSize,
|
|
111
|
+
generateS3Url,
|
|
112
|
+
uploadOnS3,
|
|
113
|
+
label
|
|
114
|
+
} = _ref,
|
|
115
|
+
antDesignProps = _objectWithoutProperties(_ref, _excluded);
|
|
116
|
+
const [previewOpen, setPreviewOpen] = (0, _react.useState)(false);
|
|
117
|
+
const [previewImage, setPreviewImage] = (0, _react.useState)(null);
|
|
118
|
+
const [previewTitle, setPreviewTitle] = (0, _react.useState)("");
|
|
119
|
+
const [loading, setLoading] = (0, _react.useState)(false);
|
|
120
|
+
const [fileList, setFileList] = (0, _react.useState)(uploadedDocuments);
|
|
121
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, _react.useState)(false);
|
|
122
|
+
const [selectedFile, setSelectedFile] = (0, _react.useState)(null);
|
|
123
|
+
const [selectedDocumentData, setSelectedDocumentData] = (0, _react.useState)({});
|
|
124
|
+
const notificationRef = (0, _react.useRef)(null);
|
|
125
|
+
const openNotification = (0, _react.useCallback)(params => notificationRef.current.openNotification(params), []);
|
|
126
|
+
(0, _react.useEffect)(() => {
|
|
127
|
+
setFileList(uploadedDocuments);
|
|
128
|
+
}, [uploadedDocuments === null || uploadedDocuments === void 0 ? void 0 : uploadedDocuments.length]);
|
|
129
|
+
const handlePreview = async file => {
|
|
130
|
+
if (file !== null && file !== void 0 && file.originFileObj) {
|
|
131
|
+
setPreviewImage(file);
|
|
132
|
+
} else if ((file === null || file === void 0 ? void 0 : file.fileType) === "thumbnail") {
|
|
133
|
+
const url = await getPreview();
|
|
134
|
+
setPreviewImage(url);
|
|
135
|
+
} else {
|
|
136
|
+
setPreviewImage(file === null || file === void 0 ? void 0 : file.url);
|
|
137
|
+
}
|
|
138
|
+
setPreviewTitle(file === null || file === void 0 ? void 0 : file.name);
|
|
139
|
+
setPreviewOpen(true);
|
|
140
|
+
setSelectedDocumentData(file);
|
|
141
|
+
};
|
|
142
|
+
const beforeUpload = (file, allowedMimeTypes, maxSizeMB) => {
|
|
143
|
+
if (allowedMimeTypes && (allowedMediaType === null || allowedMediaType === void 0 ? void 0 : allowedMediaType.length) > 0) {
|
|
144
|
+
const isAllowedType = allowedMimeTypes.includes(file.type);
|
|
145
|
+
if (!isAllowedType) {
|
|
146
|
+
openNotification({
|
|
147
|
+
description: "Only files of type: ".concat(allowedMimeTypes.join(", "), " are allowed!"),
|
|
148
|
+
type: "failure"
|
|
149
|
+
});
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (maxSizeMB) {
|
|
154
|
+
const isUnderSizeLimit = file.size / 1024 / 1024 < maxSizeMB;
|
|
155
|
+
if (!isUnderSizeLimit) {
|
|
156
|
+
openNotification({
|
|
157
|
+
description: "File must be smaller than ".concat(maxSizeMB, "MB!"),
|
|
158
|
+
type: "failure"
|
|
159
|
+
});
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return true;
|
|
164
|
+
};
|
|
165
|
+
const handleChange = async _ref2 => {
|
|
166
|
+
let {
|
|
167
|
+
fileList: newFileList,
|
|
168
|
+
file
|
|
169
|
+
} = _ref2;
|
|
170
|
+
const modifiedList = await Promise.all(newFileList.map(async files => {
|
|
171
|
+
let modifiedFile = files;
|
|
172
|
+
setLoading(true);
|
|
173
|
+
try {
|
|
174
|
+
if ((file === null || file === void 0 ? void 0 : file.uid) === (files === null || files === void 0 ? void 0 : files.uid)) {
|
|
175
|
+
if (generateS3Url) {
|
|
176
|
+
var _response, _response2, _response3;
|
|
177
|
+
if (beforeUploadFileValidations && formName && !beforeUpload(file, allowedMediaType, maxAllowedSize)) {
|
|
178
|
+
setLoading(false);
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
let response = await generateS3Url(files.name);
|
|
182
|
+
response = (_response = response) === null || _response === void 0 ? void 0 : _response.data;
|
|
183
|
+
s3ResponseReturn(response);
|
|
184
|
+
await uploadOnS3((_response2 = response) === null || _response2 === void 0 || (_response2 = _response2.response) === null || _response2 === void 0 || (_response2 = _response2.data) === null || _response2 === void 0 ? void 0 : _response2.uploadUrl, files);
|
|
185
|
+
if (((_response3 = response) === null || _response3 === void 0 || (_response3 = _response3.response) === null || _response3 === void 0 || (_response3 = _response3.status) === null || _response3 === void 0 ? void 0 : _response3.toLowerCase()) == "success") {
|
|
186
|
+
var _response4;
|
|
187
|
+
modifiedFile.status = "done";
|
|
188
|
+
modifiedFile.s3Uid = (_response4 = response) === null || _response4 === void 0 || (_response4 = _response4.response) === null || _response4 === void 0 || (_response4 = _response4.data) === null || _response4 === void 0 ? void 0 : _response4.uuid;
|
|
189
|
+
if (!isImageFile(files === null || files === void 0 ? void 0 : files.name)) {
|
|
190
|
+
modifiedFile.url = _PdfSampleImage.default;
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
modifiedFile.status = "failed";
|
|
194
|
+
modifiedFile = null;
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
await onChange(files);
|
|
198
|
+
modifiedFile.status = "done";
|
|
199
|
+
if (!isImageFile(file === null || file === void 0 ? void 0 : file.name)) {
|
|
200
|
+
modifiedFile.url = _PdfSampleImage.default;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
} catch (error) {
|
|
205
|
+
modifiedFile = null;
|
|
206
|
+
}
|
|
207
|
+
setLoading(false);
|
|
208
|
+
return modifiedFile;
|
|
209
|
+
}));
|
|
210
|
+
const tempList = modifiedList === null || modifiedList === void 0 ? void 0 : modifiedList.filter(Boolean);
|
|
211
|
+
setFileList(tempList);
|
|
212
|
+
};
|
|
213
|
+
const uploadButton = /*#__PURE__*/_react.default.createElement("button", {
|
|
214
|
+
style: {
|
|
215
|
+
border: 0,
|
|
216
|
+
background: "none"
|
|
217
|
+
},
|
|
218
|
+
type: "button"
|
|
219
|
+
}, loading ? /*#__PURE__*/_react.default.createElement(_icons.LoadingOutlined, null) : /*#__PURE__*/_react.default.createElement(_icons.UploadOutlined, null), /*#__PURE__*/_react.default.createElement("div", null, "Upload"));
|
|
220
|
+
const DeleteFile = async () => {
|
|
221
|
+
if (allowLocalDelete) {
|
|
222
|
+
const files = fileList;
|
|
223
|
+
const updatedFiles = files.filter(file => file.uid != selectedFile.uid);
|
|
224
|
+
const tempList = updatedFiles === null || updatedFiles === void 0 ? void 0 : updatedFiles.filter(Boolean);
|
|
225
|
+
setFileList(tempList);
|
|
226
|
+
setDeleteConfirmation(false);
|
|
227
|
+
form === null || form === void 0 || form.setFields([{
|
|
228
|
+
name: formName,
|
|
229
|
+
value: null
|
|
230
|
+
}]);
|
|
231
|
+
} else {
|
|
232
|
+
await deleteHandler(selectedFile);
|
|
233
|
+
setDeleteConfirmation(false);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
const handleRemove = file => new Promise((resolve, reject) => {
|
|
237
|
+
setSelectedFile(file);
|
|
238
|
+
setDeleteConfirmation(true);
|
|
239
|
+
resolve(false);
|
|
240
|
+
});
|
|
241
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.MainStyleSec, null, /*#__PURE__*/_react.default.createElement(_styles.StyledSection, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
242
|
+
className: "uploadDiv"
|
|
243
|
+
}, multipleDoc > 0 && /*#__PURE__*/_react.default.createElement("em", null, multipleDoc), /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
244
|
+
theme: {
|
|
245
|
+
token: {
|
|
246
|
+
colorBorder: _ColorVariablesMap.default["--color-divider"],
|
|
247
|
+
borderRadiusLG: 4,
|
|
248
|
+
colorPrimaryHover: _ColorVariablesMap.default["--color-primary"],
|
|
249
|
+
colorPrimaryBorder: _ColorVariablesMap.default["--color-divider"],
|
|
250
|
+
colorFillAlter: _ColorVariablesMap.default["--color-secondary-background"],
|
|
251
|
+
colorError: _ColorVariablesMap.default["--color-negative"],
|
|
252
|
+
colorText: _ColorVariablesMap.default["--color-secondary-content"]
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
256
|
+
label: label !== null && label !== void 0 ? label : "",
|
|
257
|
+
name: formName,
|
|
258
|
+
rules: formRules || [{
|
|
259
|
+
required: isMandatory,
|
|
260
|
+
message: "Required"
|
|
261
|
+
}],
|
|
262
|
+
initialValue: (uploadedDocuments === null || uploadedDocuments === void 0 ? void 0 : uploadedDocuments.length) > 0 ? fileList : []
|
|
263
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Upload, _extends({
|
|
264
|
+
customRequest: () => {},
|
|
265
|
+
listType: "picture-card",
|
|
266
|
+
fileList: fileList,
|
|
267
|
+
onPreview: handlePreview,
|
|
268
|
+
onChange: handleChange,
|
|
269
|
+
onRemove: handleRemove,
|
|
270
|
+
showUploadList: {
|
|
271
|
+
showDownloadIcon: false,
|
|
272
|
+
showRemoveIcon: showDelete,
|
|
273
|
+
removeIcon: /*#__PURE__*/_react.default.createElement(_icons.DeleteFilled, null),
|
|
274
|
+
previewIcon: /*#__PURE__*/_react.default.createElement(_icons.EyeFilled, null)
|
|
275
|
+
}
|
|
276
|
+
}, antDesignProps), (fileList === null || fileList === void 0 ? void 0 : fileList.length) >= noOfUpload ? null : uploadButton)))))), previewOpen && /*#__PURE__*/_react.default.createElement(_CustomViewer.default, {
|
|
277
|
+
open: previewOpen,
|
|
278
|
+
previewFile: previewImage,
|
|
279
|
+
title: previewTitle,
|
|
280
|
+
onCancel: () => setPreviewOpen(false),
|
|
281
|
+
downloadCallback: downloadCallback,
|
|
282
|
+
selectedDocumentData: selectedDocumentData
|
|
283
|
+
}), deleteConfirmation && /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
|
|
284
|
+
buttonConfig: [{
|
|
285
|
+
callback: () => DeleteFile(previewImage),
|
|
286
|
+
label: "Yes, Delete",
|
|
287
|
+
type: "danger-primary"
|
|
288
|
+
}],
|
|
289
|
+
imgSrc: _handIcon.default,
|
|
290
|
+
open: deleteConfirmation,
|
|
291
|
+
onCancel: () => setDeleteConfirmation(false),
|
|
292
|
+
title: "Delete Item?"
|
|
293
|
+
}, "This action will permanently delete the selected item"), /*#__PURE__*/_react.default.createElement(_CustomNotification.default, {
|
|
294
|
+
ref: notificationRef
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
297
|
+
DocumentUpload.propTypes = {
|
|
298
|
+
uploadedDocuments: _propTypes.default.array,
|
|
299
|
+
onChange: _propTypes.default.func,
|
|
300
|
+
deleteHandler: _propTypes.default.func,
|
|
301
|
+
formName: _propTypes.default.string,
|
|
302
|
+
showDelete: _propTypes.default.bool,
|
|
303
|
+
multipleDoc: _propTypes.default.number,
|
|
304
|
+
getPreview: _propTypes.default.func,
|
|
305
|
+
// Define the getPreview prop type
|
|
306
|
+
isMandatory: _propTypes.default.bool,
|
|
307
|
+
noOfUpload: _propTypes.default.number,
|
|
308
|
+
downloadCallback: _propTypes.default.func,
|
|
309
|
+
// function will be used to download the document,
|
|
310
|
+
allowLocalDelete: _propTypes.default.bool,
|
|
311
|
+
formRules: _propTypes.default.array,
|
|
312
|
+
beforeUploadFileValidations: _propTypes.default.bool,
|
|
313
|
+
allowedMediaType: _propTypes.default.array,
|
|
314
|
+
maxAllowedSize: _propTypes.default.string
|
|
315
|
+
};
|
|
316
|
+
DocumentUpload.defaultProps = {
|
|
317
|
+
uploadedDocuments: [],
|
|
318
|
+
onChange: () => {},
|
|
319
|
+
formName: "",
|
|
320
|
+
multipleDoc: 0,
|
|
321
|
+
showDelete: true,
|
|
322
|
+
getPreview: () => {},
|
|
323
|
+
isMandatory: true,
|
|
324
|
+
deleteHandler: () => {},
|
|
325
|
+
noOfUpload: 1,
|
|
326
|
+
downloadCallback: () => {},
|
|
327
|
+
allowLocalDelete: true,
|
|
328
|
+
beforeUploadFileValidations: false,
|
|
329
|
+
allowedMediaType: [],
|
|
330
|
+
maxAllowedSize: ""
|
|
331
|
+
};
|
|
332
|
+
var _default = exports.default = DocumentUpload;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledSection = exports.MainStyleSec = void 0;
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _templateObject, _templateObject2;
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
|
+
const MainStyleSec = exports.MainStyleSec = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.ant-upload-list{\n display: flex !important;\n gap: 16px !important;\n flex-wrap: wrap !important;\n}\n.ant-upload-wrapper .ant-upload-list::before {\n display: none;\n}\n.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload.ant-upload-select,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container{\n width: 96px;\n height: 96px;\n margin-block: 0;\n margin-inline: 0;\n}\n.ant-upload-select button > span.UploadImg{\n width: 24px !important;\n height: 24px;\n}\n.ant-upload-select button > span.UploadImg > img{\n width: 100% !important;\n}\n.ant-upload-list-item-container:last-child{\n margin: 0 !important;\n}\n.ant-form-item{\n margin-bottom: 0;\n}\n.ant-upload button{\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n} \n\n.uploadSecPad div{\n padding: 0 0 8px;\n}\n.anticon-upload{\n font-size: 24px;\n}\n.ant-upload-disabled .button{\n cursor: not-allowed;\n}\n.uploadSecPad{\n width: 100%;\n}\n.uploadSecPad div:last-child{\n padding: 0;\n}\n display: flex;\n flex-direction: column;\n gap: 24px;\n .ant-upload-list-item-done,.ant-upload-list-item-A{\n border: 1px solid var(--color-divider) !important;\n }\n \n .ant-upload-list-item-actions{\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 16px;\n }\n \n.ant-upload-list-item-actions button{\n background: #212121;\n border-radius: 50px;\n height: 24px !important;\n display: flex;\n align-items: center;\n}\n.ant-btn-text:not(:disabled):not(.ant-btn-disabled):hover{\n background: #212121;\n}\n .ant-upload-list-item-actions a{\n background: #212121;\n border-radius: 50px;\n height: 24px;\n display: flex;\n }\n \n .ant-upload-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item{\n opacity: 1 !important;\n }\n \n @media only screen and (max-width: 600px) {\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload.ant-upload-select{\n width: 64px;\n height: 64px;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item::before,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions,.ant-upload-wrapper .ant-upload-list .ant-upload-list-item .ant-upload-list-item-actions .ant-upload-list-item-action {\n opacity: 1;\n }\n .ant-upload-list-item-actions a {\n height: 16px;\n align-items: center;\n justify-content: center;\n width: 16px !important;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-eye, .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-delete {\n font-size: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0px !important;\n padding: 0px !important;\n color: #fff;\n}\n }\n"])));
|
|
13
|
+
const StyledSection = exports.StyledSection = _styledComponents.default.section(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n gap: 16px;\n justify-content: space-between;\n h2{\n margin: 0;\n }\n \n @media only screen and (max-width: 600px) {\n \n .ant-upload-list-item-actions button {\n height: 16px!important;\n width: 16px !important;\n justify-content: center;\n }\n .ant-upload-list-item-actions a {\n height: 16px;\n width: 16px !important;\n align-items: center;\n justify-content: center;\n}\n .ant-upload-list-item-actions {\n gap: 8px;\n }\n .ant-upload button span + div{\n display: none;\n }\n }\n"])));
|