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,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.weak-map.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _antd = require("antd");
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _ratingConstants = require("../../constants/ratingConstants");
|
|
13
|
+
var _CustomModal = _interopRequireDefault(require("../../components/oa-component-modal/CustomModal"));
|
|
14
|
+
var _CustomButton = _interopRequireDefault(require("../../components/oa-component-button/CustomButton"));
|
|
15
|
+
var _CustomTextArea = _interopRequireDefault(require("../../components/oa-component-textarea/CustomTextArea"));
|
|
16
|
+
var _CustomCheckBox = _interopRequireDefault(require("../../components/oa-component-checkbox/CustomCheckBox"));
|
|
17
|
+
var _styles = require("./styles");
|
|
18
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
19
|
+
const _excluded = ["submitBtnLabel", "activity", "submitRating", "open", "closeRatingModal", "data-test"];
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
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); }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
24
|
+
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; }
|
|
25
|
+
/**
|
|
26
|
+
* CustomerRatingCard component allows users to rate an activity and provide feedback.
|
|
27
|
+
*
|
|
28
|
+
* @param {Object} props
|
|
29
|
+
* @param {string} props.submitBtnLabel - Label for the submit button.
|
|
30
|
+
* @param {string} props.activity - The activity for which the rating is provided.
|
|
31
|
+
* @param {Function} props.submitRating - Callback function to handle the rating submission.
|
|
32
|
+
* @param {boolean} props.open - Determines if the rating modal is visible.
|
|
33
|
+
* @param {Function} props.closeRatingModal - Callback function to close the rating modal.
|
|
34
|
+
* @param {string} [props.data-test] - Optional attribute for testing purposes.
|
|
35
|
+
* @returns {ReactElement} CustomerRatingCard component.
|
|
36
|
+
*/
|
|
37
|
+
function CustomerRatingCard(_ref) {
|
|
38
|
+
var _rateTextAndDescripti;
|
|
39
|
+
let {
|
|
40
|
+
submitBtnLabel,
|
|
41
|
+
activity,
|
|
42
|
+
submitRating,
|
|
43
|
+
open,
|
|
44
|
+
closeRatingModal,
|
|
45
|
+
'data-test': dataTest
|
|
46
|
+
} = _ref,
|
|
47
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
+
const [rating, setRating] = (0, _react.useState)(0);
|
|
49
|
+
const [absRating, setAbsRating] = (0, _react.useState)(0);
|
|
50
|
+
const [feedbackOptions, setFeedbackOptions] = (0, _react.useState)([]);
|
|
51
|
+
const [tags, setTags] = (0, _react.useState)([]);
|
|
52
|
+
const [remarks, setRemarks] = (0, _react.useState)('');
|
|
53
|
+
const [isButtonEnabled, setIsButtonEnabled] = (0, _react.useState)(false);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Handles the change in rating value.
|
|
57
|
+
* @param {number} value - The new rating value.
|
|
58
|
+
*/
|
|
59
|
+
const handleRatingChange = value => {
|
|
60
|
+
setRating(value);
|
|
61
|
+
setTags([]);
|
|
62
|
+
setAbsRating(Math.ceil(value));
|
|
63
|
+
setIsButtonEnabled(value > 0);
|
|
64
|
+
const options = _ratingConstants.RatingConstants[activity][Math.ceil(value)];
|
|
65
|
+
setFeedbackOptions(options);
|
|
66
|
+
};
|
|
67
|
+
const handleFeedbackChange = value => {
|
|
68
|
+
setTags(value);
|
|
69
|
+
};
|
|
70
|
+
const handleRemarksChange = event => {
|
|
71
|
+
setRemarks(event.target.value);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Submits the rating feedback.
|
|
76
|
+
* @function
|
|
77
|
+
* @returns {void}
|
|
78
|
+
*/
|
|
79
|
+
const handleSubmit = () => {
|
|
80
|
+
const data = {
|
|
81
|
+
tags,
|
|
82
|
+
rating,
|
|
83
|
+
comments: remarks,
|
|
84
|
+
activity
|
|
85
|
+
};
|
|
86
|
+
submitRating(data);
|
|
87
|
+
};
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
|
|
89
|
+
open: open,
|
|
90
|
+
onCancel: closeRatingModal,
|
|
91
|
+
maskClosable: false
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.RatingModalStyle, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
93
|
+
className: "ratingSection"
|
|
94
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
95
|
+
color: "primary-content",
|
|
96
|
+
className: "type-t1-500"
|
|
97
|
+
}, "Rate Us"), /*#__PURE__*/_react.default.createElement("div", {
|
|
98
|
+
className: "ratingDiv"
|
|
99
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Rate, {
|
|
100
|
+
value: rating,
|
|
101
|
+
onChange: handleRatingChange
|
|
102
|
+
}), rating > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
103
|
+
className: "rateTextAntbelowStar"
|
|
104
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
105
|
+
className: "type-b3-400",
|
|
106
|
+
color: "primary-content"
|
|
107
|
+
}, _ratingConstants.rateTextAndDescriptionMap[absRating].rateText))), rating > 0 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
+
className: "rating"
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
110
|
+
color: "primary-content",
|
|
111
|
+
className: "type-t2-700"
|
|
112
|
+
}, (_ratingConstants.rateTextAndDescriptionMap === null || _ratingConstants.rateTextAndDescriptionMap === void 0 || (_rateTextAndDescripti = _ratingConstants.rateTextAndDescriptionMap[absRating]) === null || _rateTextAndDescripti === void 0 ? void 0 : _rateTextAndDescripti.heading) || 'What could be improved?'), /*#__PURE__*/_react.default.createElement(_CustomCheckBox.default.Group, {
|
|
113
|
+
value: tags,
|
|
114
|
+
options: feedbackOptions,
|
|
115
|
+
onChange: handleFeedbackChange
|
|
116
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
117
|
+
className: "leaveComment"
|
|
118
|
+
}, /*#__PURE__*/_react.default.createElement("label", {
|
|
119
|
+
htmlFor: "remarks"
|
|
120
|
+
}, "Leave a comment (optional)"), /*#__PURE__*/_react.default.createElement(_CustomTextArea.default, {
|
|
121
|
+
id: "remarks",
|
|
122
|
+
rows: 4,
|
|
123
|
+
placeholder: "Enter any additional comments",
|
|
124
|
+
value: remarks,
|
|
125
|
+
onChange: handleRemarksChange
|
|
126
|
+
}))), /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
127
|
+
type: "primary",
|
|
128
|
+
label: submitBtnLabel,
|
|
129
|
+
className: "rateUs",
|
|
130
|
+
disabled: !isButtonEnabled,
|
|
131
|
+
onClick: handleSubmit
|
|
132
|
+
}))));
|
|
133
|
+
}
|
|
134
|
+
CustomerRatingCard.propTypes = {
|
|
135
|
+
activity: _propTypes.default.string,
|
|
136
|
+
submitRating: _propTypes.default.func.isRequired,
|
|
137
|
+
open: _propTypes.default.bool.isRequired,
|
|
138
|
+
closeRatingModal: _propTypes.default.func.isRequired,
|
|
139
|
+
submitBtnLabel: _propTypes.default.string,
|
|
140
|
+
'data-test': _propTypes.default.string
|
|
141
|
+
};
|
|
142
|
+
CustomerRatingCard.defaultProps = {
|
|
143
|
+
submitBtnLabel: 'Submit',
|
|
144
|
+
activity: 'DEFAULT',
|
|
145
|
+
'data-test': null
|
|
146
|
+
};
|
|
147
|
+
var _default = exports.default = CustomerRatingCard;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.RatingModalStyle = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _templateObject;
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
+
var _default = exports.default = {};
|
|
12
|
+
const RatingModalStyle = exports.RatingModalStyle = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ratingSection{\n text-align: center;\n display: flex;\n flex-direction: column;\n gap: 32px;\n}\n .ratingSection .ant-rate{\n color: #FF991F;\n font-size: 40px;\n }\n .ratingDiv{\n width: 235px;\n margin: 0 auto;\n }\n .rateTextAntbelowStar{\n display: flex;\n justify-content: center;\n padding: 4px 0 0;\n }\n .ratingSection button{\n width: 100%;\n }\n .leaveComment{\n text-align: left;\n }\n .ant-checkbox-wrapper-checked{\n border-radius: 4px;\nborder: 1px solid #014FC5;\nbackground: #014FC5;\n \n }\n.ant-checkbox-wrapper-checked .ant-checkbox+span{\n color: #fff;\n}\n .ant-checkbox-inner{\n display: none;\n }\n .ant-checkbox+span{\n color: #014FC5;\n }\n .ant-checkbox-group{\n gap: 16px;\n justify-content: center;\n padding: 16px 0 0;\n }\n .ant-checkbox-group-item{\n border: 1px solid #014FC5;\n padding: 8px;\n border-radius: 4px;\n }\n"])));
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.symbol.description.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.parse-int.js");
|
|
10
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
12
|
+
require("core-js/modules/es.string.split.js");
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _antd = require("antd");
|
|
15
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
|
+
var _Done = _interopRequireDefault(require("@material-ui/icons/Done"));
|
|
17
|
+
var _dayjs4 = _interopRequireDefault(require("dayjs"));
|
|
18
|
+
var _styles = require("./styles");
|
|
19
|
+
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
20
|
+
var _CustomSelect = _interopRequireDefault(require("../../components/oa-component-select/CustomSelect"));
|
|
21
|
+
var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
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); }
|
|
24
|
+
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; }
|
|
25
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
26
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
27
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
28
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
29
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
30
|
+
const {
|
|
31
|
+
RangePicker
|
|
32
|
+
} = _antd.DatePicker;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Calculate the date offset based on the input day value.
|
|
36
|
+
* If the day is -1, returns null.
|
|
37
|
+
* @param {number} day - The number of days to offset the date by.
|
|
38
|
+
* @returns {Date|null} - The calculated date offset.
|
|
39
|
+
*/
|
|
40
|
+
function getDateOffset(day) {
|
|
41
|
+
if (day === -1) return null;
|
|
42
|
+
const days = parseInt(day, 10);
|
|
43
|
+
const date = new Date();
|
|
44
|
+
date.setDate(date.getDate() - days);
|
|
45
|
+
return date;
|
|
46
|
+
}
|
|
47
|
+
let rangePickerLabel;
|
|
48
|
+
const labelWithDate = {};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A widget to select dates from a predefined list of options.
|
|
52
|
+
*
|
|
53
|
+
* The widget shows a dropdown list of options. If the user selects an option
|
|
54
|
+
* that corresponds to a date range (e.g. "Last 30 days"), the widget will
|
|
55
|
+
* display a date range picker to allow the user to select a specific date
|
|
56
|
+
* range. The selected date range will be displayed in the dropdown list.
|
|
57
|
+
*
|
|
58
|
+
* The widget also allows the user to reset the selected date range to the
|
|
59
|
+
* default date range.
|
|
60
|
+
*
|
|
61
|
+
* The widget will pass the selected date range to the parent component as a
|
|
62
|
+
* prop.
|
|
63
|
+
*
|
|
64
|
+
* @param {object} options - An array of options to display in the dropdown
|
|
65
|
+
* list. Each option should have a "label" property and a "value" property.
|
|
66
|
+
* The "value" property should be a number representing the number of days to
|
|
67
|
+
* offset the date by. If the "value" property is -1, the widget will display
|
|
68
|
+
* a date range picker.
|
|
69
|
+
* @param {string} format - The format to display the dates in. Should be a
|
|
70
|
+
* string in the format "DD-MM-YYYY".
|
|
71
|
+
* @param {function} getValues - A function to call when the user selects a
|
|
72
|
+
* date range. The function will be passed an object with "startDate",
|
|
73
|
+
* "endDate", and "label" properties.
|
|
74
|
+
* @param {string} defaultLabel - The default label to display in the dropdown
|
|
75
|
+
* list.
|
|
76
|
+
* @param {string} defaultValue - The default value to select in the dropdown
|
|
77
|
+
* list.
|
|
78
|
+
* @param {string} subLine - The subline text to display below the dropdown
|
|
79
|
+
* list.
|
|
80
|
+
* @param {boolean} resetState - A boolean to reset the state of the widget.
|
|
81
|
+
* @param {Date} beforeDisabledDate - The date before which all dates are
|
|
82
|
+
* disabled.
|
|
83
|
+
* @param {Date} afterDisabledDate - The date after which all dates are
|
|
84
|
+
* disabled.
|
|
85
|
+
* @param {string} placeholder - The placeholder text to display in the
|
|
86
|
+
* dropdown list.
|
|
87
|
+
*/
|
|
88
|
+
function DateDropDown(_ref) {
|
|
89
|
+
let {
|
|
90
|
+
options,
|
|
91
|
+
format,
|
|
92
|
+
getValues,
|
|
93
|
+
defaultLabel,
|
|
94
|
+
defaultValue,
|
|
95
|
+
subLine,
|
|
96
|
+
resetState,
|
|
97
|
+
beforeDisabledDate,
|
|
98
|
+
afterDisabledDate,
|
|
99
|
+
placeholder
|
|
100
|
+
} = _ref;
|
|
101
|
+
const [showRangePicker, setshowRangePicker] = (0, _react.useState)(false);
|
|
102
|
+
const [selectValue, setSelectValue] = (0, _react.useState)({
|
|
103
|
+
label: defaultLabel,
|
|
104
|
+
dateSelected: false,
|
|
105
|
+
prevLabel: ''
|
|
106
|
+
});
|
|
107
|
+
(0, _react.useEffect)(() => {
|
|
108
|
+
options.forEach(option => {
|
|
109
|
+
if (option.value === -1) {
|
|
110
|
+
rangePickerLabel = option.label;
|
|
111
|
+
}
|
|
112
|
+
labelWithDate[option.label] = option.value;
|
|
113
|
+
});
|
|
114
|
+
if (selectValue !== null && selectValue !== void 0 && selectValue.label) {
|
|
115
|
+
getValues({
|
|
116
|
+
startDate: (0, _dayjs4.default)(getDateOffset(labelWithDate[selectValue.label])).format(format),
|
|
117
|
+
endDate: (0, _dayjs4.default)(getDateOffset(0)).format(format),
|
|
118
|
+
label: selectValue === null || selectValue === void 0 ? void 0 : selectValue.label
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}, []);
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Resets the local state of the widget.
|
|
125
|
+
*
|
|
126
|
+
* This function is used to reset the local state of the widget. It sets the
|
|
127
|
+
* `selectValue` state to its default value, and resets the `showRangePicker`
|
|
128
|
+
* state to `false`. It also calls the `getValues` callback with the default
|
|
129
|
+
* values.
|
|
130
|
+
*/
|
|
131
|
+
const resetLocalState = () => {
|
|
132
|
+
setSelectValue({
|
|
133
|
+
label: defaultLabel,
|
|
134
|
+
dateSelected: false,
|
|
135
|
+
prevLabel: ''
|
|
136
|
+
});
|
|
137
|
+
setshowRangePicker(false);
|
|
138
|
+
getValues({
|
|
139
|
+
startDate: (0, _dayjs4.default)(getDateOffset(labelWithDate[defaultLabel])).format(format),
|
|
140
|
+
endDate: (0, _dayjs4.default)(getDateOffset(0)).format(format),
|
|
141
|
+
label: defaultLabel
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
(0, _react.useEffect)(() => {
|
|
145
|
+
if (resetState) {
|
|
146
|
+
resetLocalState();
|
|
147
|
+
}
|
|
148
|
+
}, [resetState]);
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Decides whether to show a tick icon on the custom select dropdown.
|
|
152
|
+
* @param {string} selectedLabel The currently selected label.
|
|
153
|
+
* @param {string} allLabel The label for the "All" option.
|
|
154
|
+
* @returns {boolean} True if the tick icon should be shown, false otherwise.
|
|
155
|
+
*/
|
|
156
|
+
const showTickIcon = (selectedLabel, allLabel) => {
|
|
157
|
+
var _dayjs, _selectedLabel$split;
|
|
158
|
+
if (selectedLabel && selectedLabel === allLabel) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
if (selectedLabel && ((_dayjs = (0, _dayjs4.default)(selectedLabel === null || selectedLabel === void 0 || (_selectedLabel$split = selectedLabel.split) === null || _selectedLabel$split === void 0 || (_selectedLabel$split = _selectedLabel$split.call(selectedLabel, ' - ')) === null || _selectedLabel$split === void 0 ? void 0 : _selectedLabel$split[0])) === null || _dayjs === void 0 ? void 0 : _dayjs.format(format)) !== 'Invalid Date' && allLabel === rangePickerLabel) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
return false;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* A function to render a custom option in the dropdown select.
|
|
169
|
+
* @param {object} option - The option to render.
|
|
170
|
+
* @returns {ReactElement} - A React element representing the rendered option.
|
|
171
|
+
*
|
|
172
|
+
* The function renders a styled container containing a span with the
|
|
173
|
+
* option's label. If the option is the "All" option, the function renders a
|
|
174
|
+
* MaterialIcon tick icon after the label. If the option is the "Custom
|
|
175
|
+
* range" option, the function renders a second span with the subline text
|
|
176
|
+
* below the label.
|
|
177
|
+
*/
|
|
178
|
+
const optionRender = option => {
|
|
179
|
+
var _option$label;
|
|
180
|
+
const allLabel = option === null || option === void 0 || (_option$label = option.label) === null || _option$label === void 0 || (_option$label = _option$label.props) === null || _option$label === void 0 ? void 0 : _option$label.children;
|
|
181
|
+
const isCustomRange = allLabel === rangePickerLabel;
|
|
182
|
+
const {
|
|
183
|
+
label
|
|
184
|
+
} = selectValue !== null && selectValue !== void 0 ? selectValue : {};
|
|
185
|
+
return /*#__PURE__*/_react.default.createElement(_styles.StyledContainer, {
|
|
186
|
+
style: isCustomRange ? {
|
|
187
|
+
borderTop: ''
|
|
188
|
+
} : {}
|
|
189
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
190
|
+
className: "label-date-dropdown"
|
|
191
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
192
|
+
style: showTickIcon(label, allLabel) ? {
|
|
193
|
+
color: _ColorVariablesMap.default['--color-primary']
|
|
194
|
+
} : {}
|
|
195
|
+
}, allLabel), showTickIcon(label, allLabel) && /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
196
|
+
icon: _Done.default,
|
|
197
|
+
size: 20,
|
|
198
|
+
color: "primary"
|
|
199
|
+
}))), isCustomRange && /*#__PURE__*/_react.default.createElement("span", {
|
|
200
|
+
style: showTickIcon(label, allLabel) ? {
|
|
201
|
+
color: _ColorVariablesMap.default['--color-primary']
|
|
202
|
+
} : {}
|
|
203
|
+
}, subLine));
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Handles the selection of a date option from the dropdown.
|
|
208
|
+
*
|
|
209
|
+
* When a date option is selected, updates the `selectValue` state and
|
|
210
|
+
* determines whether to show the range picker based on the option selected.
|
|
211
|
+
* If the "Custom range" option is selected, opens the range picker and sets
|
|
212
|
+
* the label to "Start date - End date". Otherwise, updates the `selectValue`
|
|
213
|
+
* with the selected option's label and calls `getValues` with the appropriate
|
|
214
|
+
* start and end dates.
|
|
215
|
+
*
|
|
216
|
+
* @param {object} event - The event object containing the selected option's
|
|
217
|
+
* label and value.
|
|
218
|
+
*/
|
|
219
|
+
const onSelect = event => {
|
|
220
|
+
if ((event === null || event === void 0 ? void 0 : event.label) === rangePickerLabel) {
|
|
221
|
+
setSelectValue(prev => {
|
|
222
|
+
setshowRangePicker(true);
|
|
223
|
+
return {
|
|
224
|
+
label: 'Start date -End date',
|
|
225
|
+
dateSelected: false,
|
|
226
|
+
prevLabel: prev.label
|
|
227
|
+
};
|
|
228
|
+
});
|
|
229
|
+
} else {
|
|
230
|
+
getValues({
|
|
231
|
+
startDate: (0, _dayjs4.default)(getDateOffset(event.value)).format(format),
|
|
232
|
+
endDate: (0, _dayjs4.default)(getDateOffset((event === null || event === void 0 ? void 0 : event.value) === 1 ? event.value : 0)).format(format),
|
|
233
|
+
label: event === null || event === void 0 ? void 0 : event.label
|
|
234
|
+
});
|
|
235
|
+
setSelectValue({
|
|
236
|
+
label: event === null || event === void 0 ? void 0 : event.label,
|
|
237
|
+
dateSelected: false
|
|
238
|
+
});
|
|
239
|
+
setshowRangePicker(false);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Handles the selection of a date range from the range picker.
|
|
245
|
+
*
|
|
246
|
+
* When a date range is selected, formats the dates from the API's date
|
|
247
|
+
* format to the user's preferred date format. Updates the `selectValue` state
|
|
248
|
+
* with the selected date range and calls `getValues` with the formatted
|
|
249
|
+
* start and end dates. Finally, resets the `showRangePicker` state to
|
|
250
|
+
* `false`.
|
|
251
|
+
*
|
|
252
|
+
* @param {object} e - The event object containing the selected date range.
|
|
253
|
+
*/
|
|
254
|
+
const handleDateRangeValue = e => {
|
|
255
|
+
var _dayjs2, _dayjs2$format, _e$, _dayjs3, _dayjs3$format, _e$2;
|
|
256
|
+
const fromDateApi = _dayjs4.default === null || _dayjs4.default === void 0 || (_dayjs2 = (0, _dayjs4.default)(e === null || e === void 0 || (_e$ = e[0]) === null || _e$ === void 0 ? void 0 : _e$.$d)) === null || _dayjs2 === void 0 || (_dayjs2$format = _dayjs2.format) === null || _dayjs2$format === void 0 ? void 0 : _dayjs2$format.call(_dayjs2, format);
|
|
257
|
+
const toDateApi = _dayjs4.default === null || _dayjs4.default === void 0 || (_dayjs3 = (0, _dayjs4.default)(e === null || e === void 0 || (_e$2 = e[1]) === null || _e$2 === void 0 ? void 0 : _e$2.$d)) === null || _dayjs3 === void 0 || (_dayjs3$format = _dayjs3.format) === null || _dayjs3$format === void 0 ? void 0 : _dayjs3$format.call(_dayjs3, format);
|
|
258
|
+
const date = "".concat(fromDateApi, " - ").concat(toDateApi);
|
|
259
|
+
setSelectValue({
|
|
260
|
+
label: date,
|
|
261
|
+
dateSelected: true
|
|
262
|
+
});
|
|
263
|
+
getValues({
|
|
264
|
+
startDate: fromDateApi,
|
|
265
|
+
endDate: toDateApi,
|
|
266
|
+
label: date
|
|
267
|
+
});
|
|
268
|
+
setshowRangePicker(false);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Handles the click on the date dropdown's select option.
|
|
273
|
+
*
|
|
274
|
+
* If the user clicks on the select option after selecting a custom range,
|
|
275
|
+
* resets the date dropdown's value to the previously selected label and
|
|
276
|
+
* calls `getValues` with the start and end dates corresponding to the
|
|
277
|
+
* previously selected label.
|
|
278
|
+
*/
|
|
279
|
+
const handleOnSelectClick = () => {
|
|
280
|
+
setshowRangePicker(false);
|
|
281
|
+
if (selectValue !== null && selectValue !== void 0 && selectValue.prevLabel) {
|
|
282
|
+
const getParsedValue = labelWithDate[selectValue === null || selectValue === void 0 ? void 0 : selectValue.prevLabel];
|
|
283
|
+
setSelectValue(prev => {
|
|
284
|
+
if (prev.prevLabel) {
|
|
285
|
+
getValues({
|
|
286
|
+
startDate: (0, _dayjs4.default)(getParsedValue).format(format),
|
|
287
|
+
endDate: (0, _dayjs4.default)(getDateOffset(0)).format(format),
|
|
288
|
+
label: selectValue === null || selectValue === void 0 ? void 0 : selectValue.prevLabel
|
|
289
|
+
});
|
|
290
|
+
return {
|
|
291
|
+
label: prev === null || prev === void 0 ? void 0 : prev.prevLabel,
|
|
292
|
+
dateSelected: false,
|
|
293
|
+
prevLabel: ''
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
return _objectSpread({}, prev);
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Function to disable dates that are outside of the allowed range.
|
|
303
|
+
*
|
|
304
|
+
* @param {dayjs} e - The date to check.
|
|
305
|
+
* @returns {boolean} True if the date is outside of the allowed range, false otherwise.
|
|
306
|
+
*/
|
|
307
|
+
const disabledDateHandler = e => {
|
|
308
|
+
if (beforeDisabledDate) {
|
|
309
|
+
if (e.isBefore(beforeDisabledDate, 'day')) {
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (afterDisabledDate) {
|
|
314
|
+
if (e.isAfter(afterDisabledDate, 'day')) {
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return false;
|
|
319
|
+
};
|
|
320
|
+
return /*#__PURE__*/_react.default.createElement(_styles.StyledContainer, null, /*#__PURE__*/_react.default.createElement(_CustomSelect.default, {
|
|
321
|
+
defaultLabel: setSelectValue === null || setSelectValue === void 0 ? void 0 : setSelectValue.label,
|
|
322
|
+
defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : undefined,
|
|
323
|
+
value: selectValue === null || selectValue === void 0 ? void 0 : selectValue.label,
|
|
324
|
+
className: "selectWidth",
|
|
325
|
+
optionRender: optionRender,
|
|
326
|
+
options: options,
|
|
327
|
+
onSelectionChange: onSelect,
|
|
328
|
+
placeholder: placeholder
|
|
329
|
+
}), showRangePicker && /*#__PURE__*/_react.default.createElement("div", {
|
|
330
|
+
className: "datePicker"
|
|
331
|
+
}, /*#__PURE__*/_react.default.createElement(RangePicker, {
|
|
332
|
+
open: true,
|
|
333
|
+
onOpenChange: () => handleOnSelectClick(),
|
|
334
|
+
autoFocus: true,
|
|
335
|
+
allowClear: true,
|
|
336
|
+
format: format,
|
|
337
|
+
disabledDate: e => disabledDateHandler(e),
|
|
338
|
+
onChange: value => handleDateRangeValue(value)
|
|
339
|
+
})));
|
|
340
|
+
}
|
|
341
|
+
DateDropDown.propTypes = {
|
|
342
|
+
options: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
343
|
+
label: _propTypes.default.node,
|
|
344
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired
|
|
345
|
+
})),
|
|
346
|
+
getValues: _propTypes.default.func,
|
|
347
|
+
format: _propTypes.default.string,
|
|
348
|
+
defaultLabel: _propTypes.default.string,
|
|
349
|
+
placeholder: _propTypes.default.string,
|
|
350
|
+
resetState: _propTypes.default.bool,
|
|
351
|
+
defaultValue: _propTypes.default.any,
|
|
352
|
+
subLine: _propTypes.default.string,
|
|
353
|
+
beforeDisabledDate: _propTypes.default.instanceOf(Date),
|
|
354
|
+
afterDisabledDate: _propTypes.default.instanceOf(Date)
|
|
355
|
+
};
|
|
356
|
+
DateDropDown.defaultProps = {
|
|
357
|
+
options: [{
|
|
358
|
+
label: 'Today',
|
|
359
|
+
value: 0
|
|
360
|
+
}, {
|
|
361
|
+
label: 'Yesterday',
|
|
362
|
+
value: 1
|
|
363
|
+
}, {
|
|
364
|
+
label: 'Last 30 days',
|
|
365
|
+
value: 30
|
|
366
|
+
}, {
|
|
367
|
+
// label: (<div className="customDateRange">
|
|
368
|
+
// <h6>Custome Range</h6>
|
|
369
|
+
// <p>Data available from Jun, 2023</p>
|
|
370
|
+
// </div>),
|
|
371
|
+
|
|
372
|
+
label: 'Custom Range',
|
|
373
|
+
value: -1
|
|
374
|
+
}],
|
|
375
|
+
format: 'DD-MMM-YYYY',
|
|
376
|
+
subLine: '',
|
|
377
|
+
beforeDisabledDate: null,
|
|
378
|
+
afterDisabledDate: null,
|
|
379
|
+
defaultLabel: null,
|
|
380
|
+
getValues: () => {},
|
|
381
|
+
resetState: false,
|
|
382
|
+
defaultValue: '',
|
|
383
|
+
placeholder: 'Please select a date'
|
|
384
|
+
};
|
|
385
|
+
var _default = exports.default = DateDropDown;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.StyledContainer = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _templateObject;
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
+
var _default = exports.default = {};
|
|
12
|
+
const StyledContainer = exports.StyledContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.ant-select .ant-select-arrow{\n margin: -6px 0 0 16px;\n}\n.ant-select{\n width: 100%;\n}\n.ant-picker-range{\n height: 0px;\n}\n.customDateRange{display:flex; flex-direction:column;}\n.customDateRange h6{color: var(--color-primary-content);\n font-size: 14px; margin:0;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;}\n\n .customDateRange span{\n color: var(--color-secondary-content);\nmargin:4px 0 0 0;\nfont-size: 12px;\nfont-style: normal;\nfont-weight: 400;\nline-height: 16px; }\n.ant-select-dropdown {width:auto !important;}\n\n\n"])));
|