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,432 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
require("core-js/modules/es.object.assign.js");
|
|
5
|
+
require("core-js/modules/es.weak-map.js");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.default = CustomSelect;
|
|
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
|
+
require("core-js/modules/es.array.reduce.js");
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
|
+
var _antd = require("antd");
|
|
17
|
+
var _KeyboardArrowDown = _interopRequireDefault(require("@material-ui/icons/KeyboardArrowDown"));
|
|
18
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
+
var _utils = require("../../utils");
|
|
20
|
+
var _MaterialIcon = _interopRequireDefault(require("../oa-component-icons/MaterialIcon"));
|
|
21
|
+
var _Typography = _interopRequireDefault(require("../oa-component-typography/Typography"));
|
|
22
|
+
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
23
|
+
require("antd/dist/reset.css");
|
|
24
|
+
var _Elevation = require("../../global-css/Elevation");
|
|
25
|
+
const _excluded = ["allText", "children", "defaultValue", "data-test", "mode", "onSelectionChange", "options", "placeholder", "maxSelectForMultiSelect", "onCustomSelect"],
|
|
26
|
+
_excluded2 = ["label", "disabled", "value"];
|
|
27
|
+
var _templateObject;
|
|
28
|
+
/* eslint-disable */
|
|
29
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
+
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); }
|
|
31
|
+
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; }
|
|
32
|
+
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); }
|
|
33
|
+
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; }
|
|
34
|
+
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; }
|
|
35
|
+
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; }
|
|
36
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
37
|
+
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); }
|
|
38
|
+
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; }
|
|
39
|
+
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; }
|
|
40
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
41
|
+
const {
|
|
42
|
+
Option
|
|
43
|
+
} = _antd.Select;
|
|
44
|
+
const StyledSelect = (0, _styledComponents.default)(_antd.Select)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* Hiding the last tag in case of All being selected. */\n .ant-select-selection-overflow-item.ant-select-selection-overflow-item-rest {\n display: ", ";\n }\n .ant-select-selection-item-content {\n max-width: 70px;\n }\n"])), props => props.maxTagCount === 1 ? "none" : undefined);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Takes an array of values and an object mapping values to labels and returns an
|
|
48
|
+
* array of objects with value and label keys.
|
|
49
|
+
*
|
|
50
|
+
* @param {Array} valuesArray - An array of values to be converted to options.
|
|
51
|
+
* @param {object} valueLabelMap - An object mapping values to labels.
|
|
52
|
+
* @returns {Array} - An array of objects with value and label keys.
|
|
53
|
+
*/
|
|
54
|
+
const valuesArrayToOptionArray = (valuesArray, valueLabelMap) => valuesArray.map(value => ({
|
|
55
|
+
value,
|
|
56
|
+
label: valueLabelMap === null || valueLabelMap === void 0 ? void 0 : valueLabelMap[value]
|
|
57
|
+
}));
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A customized version of Ant Design's Select component.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} allText - Text to be shown when all options are selected.
|
|
63
|
+
* @param {React.ReactNode} children - React children to be passed to the Select component.
|
|
64
|
+
* @param {string | number | Array<string | number>} defaultValue - Default value or values to be selected.
|
|
65
|
+
* @param {string} data-test - A string to be used for data-test attribute.
|
|
66
|
+
* @param {'multiple' | 'tags'} mode - If 'multiple' then the select box allows multiple selection and if 'tags' then the select box allows multiple selection and shows them as tags.
|
|
67
|
+
* @param {function} onSelectionChange - Callback function to be called when selection changes.
|
|
68
|
+
* @param {Array<React.ReactNode>} options - An array of React nodes to be passed as options to the Select component.
|
|
69
|
+
* @param {string} placeholder - Placeholder text to be shown when no option is selected.
|
|
70
|
+
*
|
|
71
|
+
* @returns {React.ReactElement} - A customized Select component.
|
|
72
|
+
*/
|
|
73
|
+
function CustomSelect(_ref) {
|
|
74
|
+
var _selectedOptions$inde2;
|
|
75
|
+
let {
|
|
76
|
+
allText,
|
|
77
|
+
children,
|
|
78
|
+
defaultValue,
|
|
79
|
+
"data-test": dataTest,
|
|
80
|
+
mode,
|
|
81
|
+
onSelectionChange,
|
|
82
|
+
options,
|
|
83
|
+
placeholder,
|
|
84
|
+
maxSelectForMultiSelect,
|
|
85
|
+
onCustomSelect
|
|
86
|
+
} = _ref,
|
|
87
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
88
|
+
// If allText is present in default values, we select all the options manually.
|
|
89
|
+
const actualDefaultValue = mode === "multiple" ? [...defaultValue] : defaultValue;
|
|
90
|
+
if (mode === "multiple" && allText && defaultValue !== null && defaultValue !== void 0 && defaultValue.includes(allText)) {
|
|
91
|
+
var _options$filter$map, _options$filter;
|
|
92
|
+
// Emptying the array first.
|
|
93
|
+
actualDefaultValue.length = 0;
|
|
94
|
+
|
|
95
|
+
// Pushing the allText
|
|
96
|
+
actualDefaultValue === null || actualDefaultValue === void 0 || actualDefaultValue.push(allText);
|
|
97
|
+
|
|
98
|
+
// Pushing the enabled options.
|
|
99
|
+
actualDefaultValue.push(...((_options$filter$map = options === null || options === void 0 || (_options$filter = options.filter(option => {
|
|
100
|
+
var _option$disabled;
|
|
101
|
+
return !((_option$disabled = option === null || option === void 0 ? void 0 : option.disabled) !== null && _option$disabled !== void 0 ? _option$disabled : false);
|
|
102
|
+
})) === null || _options$filter === void 0 ? void 0 : _options$filter.map(option => option.value)) !== null && _options$filter$map !== void 0 ? _options$filter$map : []));
|
|
103
|
+
}
|
|
104
|
+
const [selectedOptions, setSelectedOptions] = (0, _react.useState)(actualDefaultValue);
|
|
105
|
+
const valueLabelMap = Array.isArray(options) && (options === null || options === void 0 ? void 0 : options.reduce((accumulator, option) => {
|
|
106
|
+
var _option$label;
|
|
107
|
+
accumulator[option.value] = (_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : option.value;
|
|
108
|
+
return accumulator;
|
|
109
|
+
}, {}));
|
|
110
|
+
const actualOptions = Array.isArray(options) && options.map(option => {
|
|
111
|
+
const {
|
|
112
|
+
label,
|
|
113
|
+
disabled = false,
|
|
114
|
+
value
|
|
115
|
+
} = option,
|
|
116
|
+
otherProperties = _objectWithoutProperties(option, _excluded2);
|
|
117
|
+
const shouldDisableOption = (option, selectedOptions, maxSelectForMultiSelect, allText) => {
|
|
118
|
+
var _selectedOptions$filt;
|
|
119
|
+
// If option is already disabled, keep it disabled
|
|
120
|
+
if (option.disabled) return true;
|
|
121
|
+
|
|
122
|
+
// If no max limit, don't disable
|
|
123
|
+
if (!maxSelectForMultiSelect) return false;
|
|
124
|
+
|
|
125
|
+
// If this option is already selected, don't disable it (so user can deselect)
|
|
126
|
+
if (selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.includes(option.value)) return false;
|
|
127
|
+
|
|
128
|
+
// If this is the 'all' option, don't disable it
|
|
129
|
+
if (option.value === allText) return false;
|
|
130
|
+
|
|
131
|
+
// Check if we've reached the max limit (excluding allText)
|
|
132
|
+
const actualSelectionCount = (selectedOptions === null || selectedOptions === void 0 || (_selectedOptions$filt = selectedOptions.filter(val => val !== allText)) === null || _selectedOptions$filt === void 0 ? void 0 : _selectedOptions$filt.length) || 0;
|
|
133
|
+
return actualSelectionCount >= maxSelectForMultiSelect;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Determine if this option should be disabled due to max limit
|
|
137
|
+
const shouldBeDisabled = shouldDisableOption(option, selectedOptions, maxSelectForMultiSelect, allText);
|
|
138
|
+
const finalDisabled = disabled || shouldBeDisabled;
|
|
139
|
+
if ((0, _utils.isString)(label) || (0, _utils.isNumber)(label)) {
|
|
140
|
+
return _objectSpread({
|
|
141
|
+
label: /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
142
|
+
color: finalDisabled ? "placeholder-text" : undefined,
|
|
143
|
+
typography: "type-b2-400",
|
|
144
|
+
title: label,
|
|
145
|
+
"data-test": dataTest ? "".concat(dataTest, "-(").concat(label, ")") : undefined
|
|
146
|
+
}, label),
|
|
147
|
+
disabled: finalDisabled,
|
|
148
|
+
value
|
|
149
|
+
}, otherProperties);
|
|
150
|
+
}
|
|
151
|
+
if ( /*#__PURE__*/_react.default.isValidElement(label)) {
|
|
152
|
+
return _objectSpread({
|
|
153
|
+
label: dataTest ? /*#__PURE__*/_react.default.cloneElement(label, {
|
|
154
|
+
"data-test": "".concat(dataTest, "-(").concat(label, ")")
|
|
155
|
+
}) : label,
|
|
156
|
+
disabled: finalDisabled,
|
|
157
|
+
value
|
|
158
|
+
}, otherProperties);
|
|
159
|
+
}
|
|
160
|
+
if ((0, _utils.isString)(value) || (0, _utils.isNumber)(value)) {
|
|
161
|
+
return _objectSpread({
|
|
162
|
+
label: /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
163
|
+
color: finalDisabled ? "placeholder-text" : undefined,
|
|
164
|
+
typography: "type-b2-400",
|
|
165
|
+
"data-test": dataTest ? "".concat(dataTest, "-(").concat(value, ")") : undefined
|
|
166
|
+
}, value),
|
|
167
|
+
value,
|
|
168
|
+
disabled: finalDisabled
|
|
169
|
+
}, otherProperties);
|
|
170
|
+
}
|
|
171
|
+
return _objectSpread(_objectSpread({}, option), {}, {
|
|
172
|
+
disabled: finalDisabled
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Return a placeholder text for the maxTagCount option.
|
|
178
|
+
*
|
|
179
|
+
* If the allText option is selected, return null, otherwise return the string
|
|
180
|
+
* "+X more" where X is the number of omitted values.
|
|
181
|
+
*
|
|
182
|
+
* @param {Array} omittedValues - The array of values that are omitted when
|
|
183
|
+
* maxTagCount is exceeded.
|
|
184
|
+
* @returns {String|null} - The placeholder text or null if allText is selected.
|
|
185
|
+
*/
|
|
186
|
+
const getMaxTagPlaceholder = omittedValues => {
|
|
187
|
+
var _selectedOptions$inde;
|
|
188
|
+
if ((selectedOptions === null || selectedOptions === void 0 || (_selectedOptions$inde = selectedOptions.indexOf) === null || _selectedOptions$inde === void 0 ? void 0 : _selectedOptions$inde.call(selectedOptions, allText)) !== -1) {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
return "".concat("+".concat(omittedValues.length, " more"));
|
|
192
|
+
};
|
|
193
|
+
const safePush = (array, element) => {
|
|
194
|
+
if (!array.includes(element)) {
|
|
195
|
+
array.push(element);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Given an array of options, add all non-disabled options to the newlySelectedOptions array.
|
|
201
|
+
* If the option has a value property, add the value to the array. Otherwise add the option itself.
|
|
202
|
+
* @param {Array} optionsToBeAdded - The array of options to be added.
|
|
203
|
+
* @param {Array} newlySelectedOptions - The array to which the options are added.
|
|
204
|
+
*/
|
|
205
|
+
const addAllOptions = (optionsToBeAdded, newlySelectedOptions) => {
|
|
206
|
+
optionsToBeAdded.forEach(option => {
|
|
207
|
+
if ((option === null || option === void 0 ? void 0 : option.disabled) !== true) {
|
|
208
|
+
if (option.value) {
|
|
209
|
+
safePush(newlySelectedOptions, option.value);
|
|
210
|
+
} else {
|
|
211
|
+
safePush(newlySelectedOptions, option);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* This function is called whenever the selection changes for a single select.
|
|
219
|
+
* @param {Boolean} select - True if the option was selected, false if it was deselected.
|
|
220
|
+
* @param {String|Number} value - The value of the option that was selected or deselected.
|
|
221
|
+
*/
|
|
222
|
+
const onOptionsChangeForSingle = (select, value) => {
|
|
223
|
+
if (select) {
|
|
224
|
+
setSelectedOptions(value);
|
|
225
|
+
} else {
|
|
226
|
+
setSelectedOptions(null);
|
|
227
|
+
}
|
|
228
|
+
onSelectionChange({
|
|
229
|
+
label: valueLabelMap[value],
|
|
230
|
+
value
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Checks if maximum selection limit has been reached
|
|
235
|
+
* @param {Array} currentSelection - Current selected options array
|
|
236
|
+
* @param {Boolean} isSelecting - Whether we're selecting (true) or deselecting (false)
|
|
237
|
+
* @returns {Boolean} - True if max limit would be exceeded
|
|
238
|
+
*/
|
|
239
|
+
const isMaxSelectReached = currentSelection => {
|
|
240
|
+
var _currentSelection$fil;
|
|
241
|
+
// Count selections excluding allText if present
|
|
242
|
+
const actualSelectionCount = (currentSelection === null || currentSelection === void 0 || (_currentSelection$fil = currentSelection.filter(option => option !== allText)) === null || _currentSelection$fil === void 0 ? void 0 : _currentSelection$fil.length) || 0;
|
|
243
|
+
return actualSelectionCount >= maxSelectForMultiSelect;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* This function is called whenever the selection changes for a multiple select.
|
|
247
|
+
* @param {Boolean} select - True if the option was selected, false if it was deselected.
|
|
248
|
+
* @param {String|Number} value - The value of the option that was selected or deselected.
|
|
249
|
+
*
|
|
250
|
+
* If the user selects the "All" option, the selections are cleared, and all options are added to the selection.
|
|
251
|
+
* If all other options are selected, the "All" option is added to the selection.
|
|
252
|
+
* If the user deselects the "All" option, the selections are cleared.
|
|
253
|
+
* If the user deselects an option, it is removed from the selection.
|
|
254
|
+
*/
|
|
255
|
+
const onOptionsChangeForMultiple = (select, value) => {
|
|
256
|
+
var _newlySelectedOptions;
|
|
257
|
+
const newlySelectedOptions = selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.slice(0);
|
|
258
|
+
const allIndex = newlySelectedOptions === null || newlySelectedOptions === void 0 || (_newlySelectedOptions = newlySelectedOptions.indexOf) === null || _newlySelectedOptions === void 0 ? void 0 : _newlySelectedOptions.call(newlySelectedOptions, allText);
|
|
259
|
+
if (allIndex !== -1) {
|
|
260
|
+
newlySelectedOptions.splice(allIndex, 1);
|
|
261
|
+
}
|
|
262
|
+
if (select) {
|
|
263
|
+
if (maxSelectForMultiSelect && value !== allText && isMaxSelectReached(newlySelectedOptions)) {
|
|
264
|
+
// Don't proceed with selection if max limit reached
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (value === allText) {
|
|
268
|
+
newlySelectedOptions.length = 0; // Emptying the array.
|
|
269
|
+
|
|
270
|
+
safePush(newlySelectedOptions, allText);
|
|
271
|
+
addAllOptions(options, newlySelectedOptions);
|
|
272
|
+
} else {
|
|
273
|
+
safePush(newlySelectedOptions, value);
|
|
274
|
+
const enabledOptions = options === null || options === void 0 ? void 0 : options.filter(option => {
|
|
275
|
+
var _option$disabled2;
|
|
276
|
+
return !((_option$disabled2 = option === null || option === void 0 ? void 0 : option.disabled) !== null && _option$disabled2 !== void 0 ? _option$disabled2 : false);
|
|
277
|
+
});
|
|
278
|
+
if (newlySelectedOptions.length === enabledOptions.length && allText) {
|
|
279
|
+
newlySelectedOptions === null || newlySelectedOptions === void 0 || newlySelectedOptions.unshift(allText);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
} else if (value === allText) {
|
|
283
|
+
newlySelectedOptions.length = 0; // Emptying the array.
|
|
284
|
+
} else {
|
|
285
|
+
var _newlySelectedOptions2;
|
|
286
|
+
newlySelectedOptions.splice((_newlySelectedOptions2 = newlySelectedOptions.indexOf) === null || _newlySelectedOptions2 === void 0 ? void 0 : _newlySelectedOptions2.call(newlySelectedOptions, value), 1);
|
|
287
|
+
}
|
|
288
|
+
const optionsWithoutAllText = newlySelectedOptions.filter(option => option !== allText);
|
|
289
|
+
|
|
290
|
+
// Passing the data to parent, using a callback.
|
|
291
|
+
onSelectionChange(valuesArrayToOptionArray(optionsWithoutAllText, valueLabelMap));
|
|
292
|
+
setSelectedOptions(newlySelectedOptions);
|
|
293
|
+
};
|
|
294
|
+
const onOptionsChange = mode === "multiple" ? onOptionsChangeForMultiple : onOptionsChangeForSingle;
|
|
295
|
+
return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
296
|
+
theme: {
|
|
297
|
+
components: {
|
|
298
|
+
Select: {
|
|
299
|
+
optionHeight: (props === null || props === void 0 ? void 0 : props.size) === "small" ? "36px" : "52px",
|
|
300
|
+
optionSelectedBg: _ColorVariablesMap.default["--color-primary-background"],
|
|
301
|
+
optionSelectedColor: _ColorVariablesMap.default["--color-primary"]
|
|
302
|
+
// optionPadding: [3, 2],
|
|
303
|
+
// optionPadding: (props?.size === 'small') ? '8px 12px' : '16 16',
|
|
304
|
+
// activeShadow: '0px 0px 4px 0px red', // Box shadow for active select box.
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
token: {
|
|
308
|
+
// controlOutline: '4px 4px 4px 4px red', // an attempt at applying box shadow
|
|
309
|
+
colorTextPlaceholder: _ColorVariablesMap.default["--color-placeholder-text"],
|
|
310
|
+
// Color of placeholder text
|
|
311
|
+
colorTextQuaternary: _ColorVariablesMap.default["--color-secondary-content"],
|
|
312
|
+
// Color of dropdown arrow.
|
|
313
|
+
|
|
314
|
+
colorPrimary: _ColorVariablesMap.default["--color-primary"],
|
|
315
|
+
// for active color of select
|
|
316
|
+
colorPrimaryHover: _ColorVariablesMap.default["--color-primary"],
|
|
317
|
+
// for hover color of select
|
|
318
|
+
borderRadius: "4px",
|
|
319
|
+
// For border radius of select text field.
|
|
320
|
+
borderRadiusLG: "4px",
|
|
321
|
+
// For border radius of dropdown
|
|
322
|
+
controlHeight: 48,
|
|
323
|
+
// height of text field (tag height is half of this, i.e. 24px)
|
|
324
|
+
controlHeightSM: 32,
|
|
325
|
+
// height of small text field
|
|
326
|
+
|
|
327
|
+
// This controls padding of larger text box
|
|
328
|
+
controlPaddingHorizontalSM: (props === null || props === void 0 ? void 0 : props.size) === "small" ? 13 : 17,
|
|
329
|
+
// 1 extra so that it shows 12px and 16px in browser console.
|
|
330
|
+
paddingSM: (props === null || props === void 0 ? void 0 : props.size) === "small" ? 13 : 17,
|
|
331
|
+
// paddingSM is what determines padding of input box.
|
|
332
|
+
|
|
333
|
+
controlItemBgHover: _ColorVariablesMap.default["--color-background-info"],
|
|
334
|
+
// hover color of items
|
|
335
|
+
colorBgElevated: _ColorVariablesMap.default["--color-primary-background"],
|
|
336
|
+
// background color of dropdown
|
|
337
|
+
// multipleItemHeight: 100,
|
|
338
|
+
colorBgContainerDisabled: _ColorVariablesMap.default["--color-divider"],
|
|
339
|
+
// background color of disabled select
|
|
340
|
+
colorBorder: _ColorVariablesMap.default["--color-placeholder-text"],
|
|
341
|
+
colorFillSecondary: _ColorVariablesMap.default["--color-secondary-background"],
|
|
342
|
+
// background color for tags
|
|
343
|
+
|
|
344
|
+
colorText: _ColorVariablesMap.default["--color-primary-content"],
|
|
345
|
+
// Text color of unselected options in dropdown
|
|
346
|
+
colorTextDisabled: _ColorVariablesMap.default["--color-secondary-content"],
|
|
347
|
+
// Text color when disabled
|
|
348
|
+
|
|
349
|
+
colorIcon: _ColorVariablesMap.default["--color-primary-content"],
|
|
350
|
+
// Color of cross icon
|
|
351
|
+
colorError: _ColorVariablesMap.default["--color-negative"],
|
|
352
|
+
// Error color
|
|
353
|
+
colorErrorBorderHover: _ColorVariablesMap.default["--color-negative"],
|
|
354
|
+
// Hover error color should be same as error color
|
|
355
|
+
boxShadowSecondary: _Elevation.ElevationMap["elevation-white-1"] // Box shadow of dropdown.
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}, /*#__PURE__*/_react.default.createElement(StyledSelect, _extends({
|
|
359
|
+
"data-test": dataTest,
|
|
360
|
+
dropdownStyle: {
|
|
361
|
+
padding: "0px"
|
|
362
|
+
},
|
|
363
|
+
mode: mode,
|
|
364
|
+
maxTagCount: (selectedOptions === null || selectedOptions === void 0 || (_selectedOptions$inde2 = selectedOptions.indexOf) === null || _selectedOptions$inde2 === void 0 ? void 0 : _selectedOptions$inde2.call(selectedOptions, allText)) === -1 ? "responsive" : 1,
|
|
365
|
+
maxTagPlaceholder: getMaxTagPlaceholder,
|
|
366
|
+
onDeselect: (0, _utils.isFunction)(onSelectionChange) ? value => onOptionsChange(false, value) : undefined,
|
|
367
|
+
onSelect: (0, _utils.isFunction)(onSelectionChange) || (0, _utils.isFunction)(onCustomSelect) ? value => {
|
|
368
|
+
if ((0, _utils.isFunction)(onSelectionChange)) {
|
|
369
|
+
onOptionsChange(true, value);
|
|
370
|
+
}
|
|
371
|
+
if ((0, _utils.isFunction)(onCustomSelect)) {
|
|
372
|
+
const fullOption = options === null || options === void 0 ? void 0 : options.find(opt => opt.value === value);
|
|
373
|
+
if (fullOption) {
|
|
374
|
+
onCustomSelect(fullOption);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
} : undefined,
|
|
378
|
+
suffixIcon: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
379
|
+
icon: _KeyboardArrowDown.default,
|
|
380
|
+
size: 20
|
|
381
|
+
}),
|
|
382
|
+
value: (0, _utils.isFunction)(onSelectionChange) ? selectedOptions : undefined,
|
|
383
|
+
defaultValue: defaultValue,
|
|
384
|
+
virtual: false,
|
|
385
|
+
placeholder: placeholder
|
|
386
|
+
}, props), allText && /*#__PURE__*/_react.default.createElement(Option, {
|
|
387
|
+
value: allText
|
|
388
|
+
}, allText), children || Array.isArray(actualOptions) && (actualOptions === null || actualOptions === void 0 ? void 0 : actualOptions.map(actualOption => {
|
|
389
|
+
var _actualOption$disable;
|
|
390
|
+
return /*#__PURE__*/_react.default.createElement(Option, {
|
|
391
|
+
disabled: (_actualOption$disable = actualOption.disabled) !== null && _actualOption$disable !== void 0 ? _actualOption$disable : false,
|
|
392
|
+
value: actualOption.value,
|
|
393
|
+
key: (0, _utils.getUUID)(),
|
|
394
|
+
label: actualOption.label
|
|
395
|
+
}, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, actualOption.label, (actualOption === null || actualOption === void 0 ? void 0 : actualOption.subLabel) && /*#__PURE__*/_react.default.createElement("div", {
|
|
396
|
+
className: "margin-top-4"
|
|
397
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
398
|
+
typography: "type-b3-400",
|
|
399
|
+
color: "secondary-content"
|
|
400
|
+
}, actualOption === null || actualOption === void 0 ? void 0 : actualOption.subLabel))));
|
|
401
|
+
}))));
|
|
402
|
+
}
|
|
403
|
+
CustomSelect.Option = _antd.Select.Option;
|
|
404
|
+
CustomSelect.propTypes = {
|
|
405
|
+
allText: _propTypes.default.string,
|
|
406
|
+
children: _propTypes.default.node,
|
|
407
|
+
defaultValue: _propTypes.default.oneOfType([_propTypes.default.array, _propTypes.default.string, _propTypes.default.number]),
|
|
408
|
+
"data-test": _propTypes.default.string,
|
|
409
|
+
mode: _propTypes.default.oneOf(["multiple", "tags"]),
|
|
410
|
+
onSelectionChange: _propTypes.default.func,
|
|
411
|
+
options: _propTypes.default.arrayOf(
|
|
412
|
+
// Checked from antd's github
|
|
413
|
+
_propTypes.default.shape({
|
|
414
|
+
label: _propTypes.default.node,
|
|
415
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired
|
|
416
|
+
})),
|
|
417
|
+
size: _propTypes.default.oneOf(["small", "middle"]),
|
|
418
|
+
placeholder: _propTypes.default.string,
|
|
419
|
+
maxSelectForMultiSelect: _propTypes.default.number
|
|
420
|
+
};
|
|
421
|
+
CustomSelect.defaultProps = {
|
|
422
|
+
allText: null,
|
|
423
|
+
children: null,
|
|
424
|
+
defaultValue: [],
|
|
425
|
+
"data-test": null,
|
|
426
|
+
mode: null,
|
|
427
|
+
onSelectionChange: null,
|
|
428
|
+
options: [],
|
|
429
|
+
size: "middle",
|
|
430
|
+
placeholder: "",
|
|
431
|
+
maxSelectForMultiSelect: null
|
|
432
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
require("core-js/modules/es.symbol.description.js");
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _antd = require("antd");
|
|
12
|
+
var _utils = require("../../utils");
|
|
13
|
+
var _styles = require("./styles");
|
|
14
|
+
const _excluded = ["data", "data-test", "current", "direction", "size", "labelPlacement", "progressDot", "responsive", "onChange", "style"],
|
|
15
|
+
_excluded2 = ["key", "title", "subTitle", "description", "icon", "status", "disabled"];
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
22
|
+
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); }
|
|
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
|
+
* CustomSteps: Wrapper around Ant Design Steps with a data-driven API.
|
|
27
|
+
* - Parent controls current step and can customize via props.
|
|
28
|
+
* - Accepts `data.steps` array with step configs.
|
|
29
|
+
*/
|
|
30
|
+
function CustomSteps(_ref) {
|
|
31
|
+
var _data$steps;
|
|
32
|
+
let {
|
|
33
|
+
data,
|
|
34
|
+
'data-test': dataTest,
|
|
35
|
+
current,
|
|
36
|
+
direction,
|
|
37
|
+
size,
|
|
38
|
+
labelPlacement,
|
|
39
|
+
progressDot,
|
|
40
|
+
responsive,
|
|
41
|
+
onChange,
|
|
42
|
+
style
|
|
43
|
+
} = _ref,
|
|
44
|
+
antDesignProps = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
+
const items = ((_data$steps = data === null || data === void 0 ? void 0 : data.steps) !== null && _data$steps !== void 0 ? _data$steps : []).map(_ref2 => {
|
|
46
|
+
let {
|
|
47
|
+
key,
|
|
48
|
+
title,
|
|
49
|
+
subTitle,
|
|
50
|
+
description,
|
|
51
|
+
icon,
|
|
52
|
+
status,
|
|
53
|
+
disabled
|
|
54
|
+
} = _ref2,
|
|
55
|
+
otherProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
56
|
+
return _objectSpread({
|
|
57
|
+
key: key !== null && key !== void 0 ? key : (0, _utils.getUUID)(),
|
|
58
|
+
title: dataTest && ((0, _utils.isString)(title) || (0, _utils.isNumber)(title)) ? /*#__PURE__*/_react.default.createElement("span", {
|
|
59
|
+
"data-test": "".concat(dataTest, "--title-(").concat(title, ")")
|
|
60
|
+
}, title) : title,
|
|
61
|
+
subTitle,
|
|
62
|
+
description,
|
|
63
|
+
icon,
|
|
64
|
+
status,
|
|
65
|
+
disabled
|
|
66
|
+
}, otherProps);
|
|
67
|
+
});
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement(_styles.StepsContainer, {
|
|
69
|
+
style: style
|
|
70
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Steps, _extends({
|
|
71
|
+
current: current,
|
|
72
|
+
direction: direction,
|
|
73
|
+
size: size,
|
|
74
|
+
labelPlacement: labelPlacement,
|
|
75
|
+
progressDot: progressDot,
|
|
76
|
+
responsive: responsive,
|
|
77
|
+
items: items,
|
|
78
|
+
onChange: onChange
|
|
79
|
+
}, antDesignProps)));
|
|
80
|
+
}
|
|
81
|
+
CustomSteps.propTypes = {
|
|
82
|
+
data: _propTypes.default.shape({
|
|
83
|
+
steps: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
84
|
+
key: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
85
|
+
title: _propTypes.default.node,
|
|
86
|
+
subTitle: _propTypes.default.node,
|
|
87
|
+
description: _propTypes.default.node,
|
|
88
|
+
icon: _propTypes.default.node,
|
|
89
|
+
status: _propTypes.default.oneOf(['wait', 'process', 'finish', 'error']),
|
|
90
|
+
disabled: _propTypes.default.bool
|
|
91
|
+
}))
|
|
92
|
+
}),
|
|
93
|
+
'data-test': _propTypes.default.string,
|
|
94
|
+
current: _propTypes.default.number,
|
|
95
|
+
direction: _propTypes.default.oneOf(['horizontal', 'vertical']),
|
|
96
|
+
size: _propTypes.default.oneOf(['default', 'small']),
|
|
97
|
+
labelPlacement: _propTypes.default.oneOf(['horizontal', 'vertical']),
|
|
98
|
+
progressDot: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.func]),
|
|
99
|
+
responsive: _propTypes.default.bool,
|
|
100
|
+
onChange: _propTypes.default.func,
|
|
101
|
+
style: _propTypes.default.object
|
|
102
|
+
};
|
|
103
|
+
CustomSteps.defaultProps = {
|
|
104
|
+
data: {
|
|
105
|
+
steps: []
|
|
106
|
+
},
|
|
107
|
+
'data-test': null,
|
|
108
|
+
current: 0,
|
|
109
|
+
direction: 'horizontal',
|
|
110
|
+
size: 'default',
|
|
111
|
+
labelPlacement: 'horizontal',
|
|
112
|
+
progressDot: false,
|
|
113
|
+
responsive: true,
|
|
114
|
+
onChange: undefined,
|
|
115
|
+
style: {}
|
|
116
|
+
};
|
|
117
|
+
var _default = exports.default = CustomSteps;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.StepsContainer = 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 StepsContainer = exports.StepsContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n"])));
|