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,295 @@
|
|
|
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 = BarChart;
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
require("core-js/modules/es.array.reduce.js");
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var d3 = _interopRequireWildcard(require("d3"));
|
|
13
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
14
|
+
var _antd = require("antd");
|
|
15
|
+
var _colorOptions = require("../../global-css/color-options");
|
|
16
|
+
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
17
|
+
var _TypographiesMap = _interopRequireDefault(require("../../global-css/TypographiesMap"));
|
|
18
|
+
var _utils = require("../../utils");
|
|
19
|
+
var _templateObject;
|
|
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 _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
24
|
+
const FullSizeContainer = _styledComponents.default.section(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n \n display: inline-block;\n position: relative;\n width: 100%;\n padding-bottom: ", "%;\n vertical-align: top;\n overflow: hidden;\n\n .bar-chart-svg {\n display: inline-block;\n position: absolute;\n top: 0;\n left: 0;\n }\n\n .empty-component-container {\n display: ", ";\n position: absolute;\n top: ", ";\n left: ", ";\n transform: translate(-50%, -50%) scale(1.2);\n }\n"])), props => 100 / props.$aspectRatio, props => props !== null && props !== void 0 && props.$showNoData ? 'block' : 'none', props => "calc(50% + (".concat(props.$marginTop, "px - ").concat(props.$marginBottom, "px) / 2)"), props => "calc(50% + (".concat(props.$marginLeft, "px - ").concat(props.$marginRight, "px) / 2)"));
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Function to create a curved bar path based on the provided parameters.
|
|
28
|
+
* @param {number} x - The x-coordinate of the top-left corner of the bar.
|
|
29
|
+
* @param {number} y - The y-coordinate of the top-left corner of the bar.
|
|
30
|
+
* @param {number} width - The width of the bar.
|
|
31
|
+
* @param {number} height - The height of the bar.
|
|
32
|
+
* @param {number} r - The radius of the curved corners.
|
|
33
|
+
* @returns {string} The SVG path string for the curved bar.
|
|
34
|
+
*/
|
|
35
|
+
function curvedBar(x, y, width, height, r) {
|
|
36
|
+
// x coordinates of top of arcs
|
|
37
|
+
const x0 = x + r;
|
|
38
|
+
const x1 = x + width - r;
|
|
39
|
+
// y coordinates of bottom of arcs
|
|
40
|
+
const y0 = y - height + r;
|
|
41
|
+
|
|
42
|
+
// assemble path:
|
|
43
|
+
const parts = ['M', x, y,
|
|
44
|
+
// step 1
|
|
45
|
+
'L', x, y0,
|
|
46
|
+
// step 2
|
|
47
|
+
'A', r, r, 0, 0, 1, x0, y - height,
|
|
48
|
+
// step 3
|
|
49
|
+
'L', x1, y - height,
|
|
50
|
+
// step 4
|
|
51
|
+
'A', r, r, 0, 0, 1, x + width, y0,
|
|
52
|
+
// step 5
|
|
53
|
+
'L', x + width, y,
|
|
54
|
+
// step 6
|
|
55
|
+
'Z' // step 7
|
|
56
|
+
];
|
|
57
|
+
return parts.join(' ');
|
|
58
|
+
}
|
|
59
|
+
function BarChart(_ref) {
|
|
60
|
+
var _barsConfig$length, _barsConfig$length2;
|
|
61
|
+
let {
|
|
62
|
+
barsConfig,
|
|
63
|
+
totalValue,
|
|
64
|
+
showPercentage,
|
|
65
|
+
yLabel,
|
|
66
|
+
xLabel
|
|
67
|
+
} = _ref;
|
|
68
|
+
const height = 450;
|
|
69
|
+
const width = 600;
|
|
70
|
+
const aspectRatio = width / height;
|
|
71
|
+
const barSpacing = 32;
|
|
72
|
+
const marginBottom = 32;
|
|
73
|
+
const marginTop = 32;
|
|
74
|
+
const marginLeft = 48;
|
|
75
|
+
const marginRight = 48;
|
|
76
|
+
const yMin = 0;
|
|
77
|
+
const yMax = showPercentage ? 100 : Math.max(...barsConfig.map(barConfig => barConfig.value));
|
|
78
|
+
const xLabelPlural = "".concat(xLabel, "s");
|
|
79
|
+
const yLabelPlural = "".concat(yLabel, "s");
|
|
80
|
+
const totalForPercentages = barsConfig === null || barsConfig === void 0 ? void 0 : barsConfig.reduce((accumulator, currentValue) => currentValue.value + accumulator, 0);
|
|
81
|
+
const showNoData = (() => {
|
|
82
|
+
if (totalForPercentages <= 0) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
})();
|
|
87
|
+
|
|
88
|
+
// This function gets the value for y-axis, based on whether `showPercentage` is true or not.
|
|
89
|
+
const getValueY = value => showPercentage ? (0, _utils.fixMaxDecimalPlaces)(100 * (value / totalValue), 2) : value;
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
This function gets the labels placed above the bars,
|
|
93
|
+
based on whether `showPercentage` is true or not.
|
|
94
|
+
*/
|
|
95
|
+
const getBarLabel = value => "".concat(getValueY(value)).concat(showPercentage ? '%' : " ".concat(value === 1 ? yLabel : yLabelPlural));
|
|
96
|
+
|
|
97
|
+
// n + 1 bar spacing for n bars.
|
|
98
|
+
const numberOfSpacesPresentInGraph = ((_barsConfig$length = barsConfig === null || barsConfig === void 0 ? void 0 : barsConfig.length) !== null && _barsConfig$length !== void 0 ? _barsConfig$length : 0) + 1;
|
|
99
|
+
const widthOfEachBar = (width - marginLeft - marginRight // Removed left and right margin.
|
|
100
|
+
- barSpacing * numberOfSpacesPresentInGraph) / ((_barsConfig$length2 = barsConfig === null || barsConfig === void 0 ? void 0 : barsConfig.length) !== null && _barsConfig$length2 !== void 0 ? _barsConfig$length2 : 1); // Divided by the number of bars.
|
|
101
|
+
|
|
102
|
+
// Got the spacing in percentage of the width of the bar.
|
|
103
|
+
const barSpacingInPercentage = barSpacing / (widthOfEachBar + barSpacing);
|
|
104
|
+
|
|
105
|
+
// We will be referring the graph container using a react ref.
|
|
106
|
+
const barChartRef = (0, _react.useRef)(null);
|
|
107
|
+
const availableHeight = height - marginTop - marginBottom;
|
|
108
|
+
const availableWidth = width - marginRight - marginLeft;
|
|
109
|
+
|
|
110
|
+
/*
|
|
111
|
+
Scale for the values on the Y-axis
|
|
112
|
+
Minimum value of scale is at bottom.
|
|
113
|
+
The scale goes from 0 to reduced value of height (remove upper and lower margin from height)
|
|
114
|
+
*/
|
|
115
|
+
const yScale = d3.scaleLinear().domain([yMin, yMax]).range([availableHeight, 0]).nice();
|
|
116
|
+
|
|
117
|
+
/*
|
|
118
|
+
Scale for the bars on the X axis.
|
|
119
|
+
The scale goes from 0 to reduced value of width (remove left and right margin from height)
|
|
120
|
+
*/
|
|
121
|
+
const xScale = d3.scaleBand().domain(barsConfig.map(barConfig => barConfig.label)).range([0, availableWidth]).padding(barSpacingInPercentage); // Inner and outer paddings are equal for symmmetry
|
|
122
|
+
|
|
123
|
+
const updateChartDimensions = barChartSvg => {
|
|
124
|
+
// Adding the svg element on first render.
|
|
125
|
+
barChartSvg.attr('viewBox', "0 0 ".concat(width, " ").concat(height)).attr('preserveAspectRatio', 'xMidYMid meet');
|
|
126
|
+
};
|
|
127
|
+
const updateAxesPosition = barChartSvg => {
|
|
128
|
+
const xAxisRef = barChartSvg.select('#x-axis');
|
|
129
|
+
const yAxisRef = barChartSvg.select('#y-axis');
|
|
130
|
+
|
|
131
|
+
// Setting the position of X-axis
|
|
132
|
+
const xAxis = xAxisRef.attr('transform', "translate(".concat(marginLeft, ", ").concat(height - marginBottom, ")"));
|
|
133
|
+
const xAxisLabel = barChartSvg.selectAll('#x-axis-label').data([xLabelPlural]) // Singular data join
|
|
134
|
+
.join('text').attr('id', 'x-axis-label').classed('type-b3-400', true).style('fill', _ColorVariablesMap.default['--color-primary-content']).style('dominant-baseline', 'middle') // This CSS property aligns the <text> element, with the X-axis.
|
|
135
|
+
.attr('transform', "translate(".concat(width - marginRight + 12, ", ").concat(height - marginBottom, ")")).text(d => d);
|
|
136
|
+
|
|
137
|
+
// Setting the position of Y-axis
|
|
138
|
+
const yAxis = yAxisRef.attr('transform', "translate(".concat(marginLeft, ", ").concat(marginTop, ")"));
|
|
139
|
+
const yAxisLabel = barChartSvg.selectAll('#y-axis-label').data([yLabelPlural]) // Singular data join
|
|
140
|
+
.join('text').attr('id', 'y-axis-label').classed('type-b3-400', true).style('fill', _ColorVariablesMap.default['--color-primary-content']).attr('transform', "translate(".concat(marginLeft, ", ").concat(marginTop - _TypographiesMap.default['type-b2-400']['line-height'], ")")).attr('text-anchor', 'middle').text(d => d);
|
|
141
|
+
};
|
|
142
|
+
const updateBars = barChartSvg => {
|
|
143
|
+
if (showNoData) {
|
|
144
|
+
barChartSvg.selectAll('#bar').remove();
|
|
145
|
+
|
|
146
|
+
// barChartSvg
|
|
147
|
+
// .select('.bar-chart-svg')
|
|
148
|
+
// .select('#no-data-image')
|
|
149
|
+
// .join([true])
|
|
150
|
+
// .
|
|
151
|
+
} else {
|
|
152
|
+
barChartSvg.selectAll('#bar') // We select the id which we add just below, so that the existing bars are updated.
|
|
153
|
+
.data(barsConfig) // Performing a data join for an array of objects.
|
|
154
|
+
.join('path').filter(d => d.value !== 0).attr('d', (d, i) => curvedBar(marginRight + xScale(d.label), height - marginBottom, widthOfEachBar, availableHeight - yScale(getValueY(d.value)), 4)).attr('id', 'bar').style('fill', d => {
|
|
155
|
+
var _d$color;
|
|
156
|
+
return _ColorVariablesMap.default["--color-".concat((_d$color = d === null || d === void 0 ? void 0 : d.color) !== null && _d$color !== void 0 ? _d$color : 'warning')];
|
|
157
|
+
});
|
|
158
|
+
barChartSvg.selectAll('#bar-label') // We select the id which we add just below, so that the existing bars are updated.
|
|
159
|
+
.data(barsConfig).join('text').text('') // Resetting the text before filtering
|
|
160
|
+
.filter(d => d.value !== 0).attr('id', 'bar-label').style('width', widthOfEachBar).attr('text-anchor', 'middle').text((d, i) => getBarLabel(d.value)).attr('x', (d, i) => marginRight + widthOfEachBar / 2 + xScale(d.label)) // Center position
|
|
161
|
+
.attr('y', (d, i) => marginTop + yScale(getValueY(d.value)) - 12).classed('type-b3-400', true);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const updateAxesConfiguration = () => {
|
|
165
|
+
const xAxisRef = d3.select('#x-axis');
|
|
166
|
+
const yAxisRef = d3.select('#y-axis');
|
|
167
|
+
|
|
168
|
+
/*
|
|
169
|
+
tickSizeOuter is used to control the sizes of the ticks on the outer ends of the axes.
|
|
170
|
+
tickSizeInnr is for controlling the size of the remaining ticks.
|
|
171
|
+
tickSize sets both at once
|
|
172
|
+
*/
|
|
173
|
+
|
|
174
|
+
const yAxisConfiguration = d3.axisLeft(yScale).ticks(5) // Controls the approximate number of ticks to be shown on Y-axis.
|
|
175
|
+
.tickSizeInner(-availableWidth) // This draws the grid lines out of the Y-axis.
|
|
176
|
+
.tickSizeOuter(0).tickPadding(16).tickFormat(showPercentage ? d => "".concat(d, "%") : _utils.rupeeShorthandFormatter);
|
|
177
|
+
|
|
178
|
+
// TODO: Add smooth transition
|
|
179
|
+
const yAxis = yAxisRef.transition().call(yAxisConfiguration);
|
|
180
|
+
|
|
181
|
+
// After calling the function for the drawing the Y-axis, we remove the tick with value 0.
|
|
182
|
+
yAxisRef.selectAll('.tick').filter(d => d === 0).remove();
|
|
183
|
+
const xAxisConfiguration = d3.axisBottom(xScale).tickSize(0).tickPadding(12);
|
|
184
|
+
|
|
185
|
+
// TODO: Add smooth transition
|
|
186
|
+
const xAxis = xAxisRef.transition().call(xAxisConfiguration);
|
|
187
|
+
|
|
188
|
+
// Adding typography class to text of all ticks
|
|
189
|
+
d3.selectAll('.tick text').classed('type-b2-400', true);
|
|
190
|
+
|
|
191
|
+
// Setting the color of Y-axis
|
|
192
|
+
yAxisRef.select('path').attr('stroke', _ColorVariablesMap.default['--color-placeholder-text']).attr('marker-end', 'url(#arrowhead-up)');
|
|
193
|
+
|
|
194
|
+
// Setting the color of the ticks (dashed grid of Y-axis)
|
|
195
|
+
yAxisRef.selectAll('.tick line').attr('stroke', _ColorVariablesMap.default['--color-placeholder-text']).style('stroke-dasharray', '3,6');
|
|
196
|
+
|
|
197
|
+
// Setting the color of X-axis
|
|
198
|
+
|
|
199
|
+
xAxisRef.select('path').attr('stroke', _ColorVariablesMap.default['--color-placeholder-text']).attr('marker-end', 'url(#arrowhead-right)');
|
|
200
|
+
};
|
|
201
|
+
(0, _react.useEffect)(() => {
|
|
202
|
+
// Selecting this bar chart svg, only after mount, so that it is present in the DOM.
|
|
203
|
+
const barChartSvgReference = d3.select(barChartRef.current).select('svg.bar-chart-svg');
|
|
204
|
+
updateChartDimensions(barChartSvgReference);
|
|
205
|
+
updateAxesPosition(barChartSvgReference);
|
|
206
|
+
updateAxesConfiguration();
|
|
207
|
+
updateBars(barChartSvgReference);
|
|
208
|
+
});
|
|
209
|
+
return /*#__PURE__*/_react.default.createElement(FullSizeContainer, {
|
|
210
|
+
$aspectRatio: aspectRatio,
|
|
211
|
+
$marginTop: marginTop,
|
|
212
|
+
$marginRight: marginRight,
|
|
213
|
+
$marginBottom: marginBottom,
|
|
214
|
+
$marginLeft: marginLeft,
|
|
215
|
+
$showNoData: showNoData,
|
|
216
|
+
ref: barChartRef
|
|
217
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
218
|
+
className: "bar-chart-svg"
|
|
219
|
+
}, /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("svg", {
|
|
220
|
+
id: "no-data-svg-ref",
|
|
221
|
+
width: "64",
|
|
222
|
+
height: "41",
|
|
223
|
+
viewBox: "0 0 64 41",
|
|
224
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
225
|
+
}, /*#__PURE__*/_react.default.createElement("g", {
|
|
226
|
+
transform: "translate(0 1)",
|
|
227
|
+
fill: "none",
|
|
228
|
+
fillRule: "evenodd"
|
|
229
|
+
}, /*#__PURE__*/_react.default.createElement("ellipse", {
|
|
230
|
+
fill: "#f5f5f5",
|
|
231
|
+
cx: "32",
|
|
232
|
+
cy: "33",
|
|
233
|
+
rx: "32",
|
|
234
|
+
ry: "7"
|
|
235
|
+
}), /*#__PURE__*/_react.default.createElement("g", {
|
|
236
|
+
fillRule: "nonzero",
|
|
237
|
+
stroke: "#d9d9d9"
|
|
238
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
239
|
+
d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"
|
|
240
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
241
|
+
d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",
|
|
242
|
+
fill: "#fafafa"
|
|
243
|
+
})))), /*#__PURE__*/_react.default.createElement("marker", {
|
|
244
|
+
id: "arrowhead-right",
|
|
245
|
+
refX: "1" // X-coordinate of the marker svg which has to matched with end of X-axis
|
|
246
|
+
,
|
|
247
|
+
refY: "5" // Y-coordinate of the marker svg which has to matched with end of X-axis
|
|
248
|
+
,
|
|
249
|
+
markerWidth: "16",
|
|
250
|
+
markerHeight: "13"
|
|
251
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
252
|
+
d: "M 1 0 L 6 5 L 1 10",
|
|
253
|
+
stroke: _ColorVariablesMap.default['--color-placeholder-text'],
|
|
254
|
+
strokeWidth: "1",
|
|
255
|
+
fill: "none"
|
|
256
|
+
})), /*#__PURE__*/_react.default.createElement("marker", {
|
|
257
|
+
id: "arrowhead-up",
|
|
258
|
+
refX: "5" // X-coordinate of the marker svg which has to matched with end of X-axis
|
|
259
|
+
,
|
|
260
|
+
refY: "14" // Y-coordinate of the marker svg which has to matched with end of X-axis
|
|
261
|
+
,
|
|
262
|
+
markerWidth: "11",
|
|
263
|
+
markerHeight: "14"
|
|
264
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
265
|
+
d: "M 0 5 L 5 0 L 10 5 M 5 6 L 5 14",
|
|
266
|
+
stroke: _ColorVariablesMap.default['--color-placeholder-text'],
|
|
267
|
+
strokeWidth: "1",
|
|
268
|
+
fill: "none"
|
|
269
|
+
}))), /*#__PURE__*/_react.default.createElement("g", {
|
|
270
|
+
id: "x-axis"
|
|
271
|
+
}), /*#__PURE__*/_react.default.createElement("g", {
|
|
272
|
+
id: "y-axis"
|
|
273
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
274
|
+
className: "empty-component-container"
|
|
275
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Empty, {
|
|
276
|
+
image: _antd.Empty.PRESENTED_IMAGE_SIMPLE
|
|
277
|
+
})));
|
|
278
|
+
}
|
|
279
|
+
BarChart.propTypes = {
|
|
280
|
+
barsConfig: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
281
|
+
value: _propTypes.default.number,
|
|
282
|
+
color: _propTypes.default.oneOf(_colorOptions.colorOptions)
|
|
283
|
+
})),
|
|
284
|
+
showPercentage: _propTypes.default.bool,
|
|
285
|
+
yLabel: _propTypes.default.string,
|
|
286
|
+
xLabel: _propTypes.default.string,
|
|
287
|
+
totalValue: _propTypes.default.number
|
|
288
|
+
};
|
|
289
|
+
BarChart.defaultProps = {
|
|
290
|
+
totalValue: 1,
|
|
291
|
+
barsConfig: [],
|
|
292
|
+
showPercentage: false,
|
|
293
|
+
yLabel: 'Y',
|
|
294
|
+
xLabel: 'X'
|
|
295
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _antd = require("antd");
|
|
10
|
+
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
/**
|
|
13
|
+
* A custom implementation of antd's Breadcrumb component.
|
|
14
|
+
* This component provides a styled breadcrumb in accordance with the OneAssist design language.
|
|
15
|
+
* The colors used are as follows:
|
|
16
|
+
* - The color of other items in breadcrumb: --color-secondary-content
|
|
17
|
+
* - The color of last item in breadcrumb: --color-primary
|
|
18
|
+
* - The color of items that are links: --color-secondary-content
|
|
19
|
+
* - The color of items that are links, during hover: --color-primary-hover
|
|
20
|
+
* - The color of separator: --color-secondary-content
|
|
21
|
+
* - The margin of separator: 4px
|
|
22
|
+
* The background color of text on hover is set to --color-primary-background.
|
|
23
|
+
*/
|
|
24
|
+
function CustomBreadCrumb(props) {
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
26
|
+
theme: {
|
|
27
|
+
components: {
|
|
28
|
+
Breadcrumb: {
|
|
29
|
+
itemColor: _ColorVariablesMap.default['--color-secondary-content'],
|
|
30
|
+
// Color of other items in breadcrumb
|
|
31
|
+
lastItemColor: _ColorVariablesMap.default['--color-primary'],
|
|
32
|
+
// Color of last item in breadcrumb.
|
|
33
|
+
linkColor: _ColorVariablesMap.default['--color-secondary-content'],
|
|
34
|
+
// Color of items that are links.
|
|
35
|
+
linkHoverColor: _ColorVariablesMap.default['--color-primary-hover'],
|
|
36
|
+
// Color of items that are links, during hover.
|
|
37
|
+
separatorColor: _ColorVariablesMap.default['--color-secondary-content'],
|
|
38
|
+
separatorMargin: 4 // Separator margin
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
theme: {
|
|
42
|
+
colorBgTextHover: _ColorVariablesMap.default['--color-primary-background']
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Breadcrumb, props));
|
|
46
|
+
}
|
|
47
|
+
var _default = exports.default = CustomBreadCrumb;
|
|
@@ -0,0 +1,108 @@
|
|
|
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.regexp.exec.js");
|
|
9
|
+
require("core-js/modules/es.string.replace.js");
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _Typography = _interopRequireDefault(require("../oa-component-typography/Typography"));
|
|
13
|
+
var _styles = require("./styles");
|
|
14
|
+
const _excluded = ["className", "disabled", "onClick", "htmlType", "iconConfig", "label", "showEllipsis", "size", "type", "data-test"];
|
|
15
|
+
/* eslint-disable */
|
|
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 _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; }
|
|
19
|
+
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; }
|
|
20
|
+
/**
|
|
21
|
+
* CustomButton component renders a styled button with various configurations.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} className - Additional class names for the button.
|
|
24
|
+
* @param {boolean} disabled - Disables the button if set to true.
|
|
25
|
+
* @param {function} onClick - Callback function to handle button click events.
|
|
26
|
+
* @param {string} htmlType - Specifies the HTML type of the button (e.g., 'button', 'submit').
|
|
27
|
+
* @param {object} iconConfig - Configuration for the button's icon, containing:
|
|
28
|
+
* - `icon`: React node for the icon.
|
|
29
|
+
* - `position`: Position of the icon, either 'left' or 'right'.
|
|
30
|
+
* @param {ReactNode} label - The text or content displayed on the button.
|
|
31
|
+
* @param {boolean} showEllipsis - Shows ellipsis if the label is too long.
|
|
32
|
+
* @param {string} size - Size of the button, can be 'small', 'medium', or 'large'.
|
|
33
|
+
* @param {string} type - Type of button, defining its style (e.g., 'primary', 'danger-primary').
|
|
34
|
+
* @param {string} dataTest - Data attribute for testing purposes.
|
|
35
|
+
* @param {object} domProps - Additional props to be spread onto the button element.
|
|
36
|
+
*
|
|
37
|
+
* @returns {ReactElement} A styled button component.
|
|
38
|
+
*/
|
|
39
|
+
function CustomButton(_ref) {
|
|
40
|
+
let {
|
|
41
|
+
className,
|
|
42
|
+
disabled,
|
|
43
|
+
onClick,
|
|
44
|
+
htmlType,
|
|
45
|
+
iconConfig,
|
|
46
|
+
label,
|
|
47
|
+
showEllipsis,
|
|
48
|
+
size,
|
|
49
|
+
type,
|
|
50
|
+
"data-test": dataTest
|
|
51
|
+
} = _ref,
|
|
52
|
+
domProps = _objectWithoutProperties(_ref, _excluded);
|
|
53
|
+
const buttonTypography = (0, _styles.getButtonTypography)(size);
|
|
54
|
+
const iconSize = (0, _styles.getIconSize)(size);
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_styles.ColoredStyledButton, _extends({
|
|
56
|
+
className: "".concat(disabled ? "".concat(type.replace("danger-", ""), "-disabled") : type, " ").concat(type.replace("danger-", "") === "text-only" ? "".concat(size, "-text-only") : size, " ").concat(className),
|
|
57
|
+
disabled: disabled,
|
|
58
|
+
onClick: disabled ? null : onClick,
|
|
59
|
+
type: htmlType,
|
|
60
|
+
size: size,
|
|
61
|
+
"data-test": dataTest
|
|
62
|
+
}, domProps), /*#__PURE__*/_react.default.createElement("div", {
|
|
63
|
+
className: "text-container"
|
|
64
|
+
}, iconConfig.position === "left" && /*#__PURE__*/_react.default.isValidElement(iconConfig.icon) && /*#__PURE__*/_react.default.cloneElement(iconConfig.icon, {
|
|
65
|
+
size: (iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.size) || iconSize,
|
|
66
|
+
color: (iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.color) || undefined
|
|
67
|
+
}), label && (showEllipsis ? /*#__PURE__*/_react.default.createElement(_styles.EllipsisTypography, {
|
|
68
|
+
title: label,
|
|
69
|
+
typography: buttonTypography
|
|
70
|
+
}, label) : /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
71
|
+
typography: buttonTypography
|
|
72
|
+
}, label)), iconConfig.position === "right" && /*#__PURE__*/_react.default.isValidElement(iconConfig.icon) && /*#__PURE__*/_react.default.cloneElement(iconConfig.icon, {
|
|
73
|
+
size: (iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.size) || iconSize,
|
|
74
|
+
color: (iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.color) || undefined
|
|
75
|
+
})));
|
|
76
|
+
}
|
|
77
|
+
CustomButton.propTypes = {
|
|
78
|
+
className: _propTypes.default.string,
|
|
79
|
+
"data-test": _propTypes.default.string,
|
|
80
|
+
disabled: _propTypes.default.bool,
|
|
81
|
+
onClick: _propTypes.default.func.isRequired,
|
|
82
|
+
htmlType: _propTypes.default.oneOf(["button", "submit", "reset"]),
|
|
83
|
+
iconConfig: _propTypes.default.shape({
|
|
84
|
+
icon: _propTypes.default.node,
|
|
85
|
+
position: _propTypes.default.oneOf(["left", "right"]),
|
|
86
|
+
style: _propTypes.default.objectOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])),
|
|
87
|
+
size: _propTypes.default.number
|
|
88
|
+
}),
|
|
89
|
+
label: _propTypes.default.node,
|
|
90
|
+
showEllipsis: _propTypes.default.bool,
|
|
91
|
+
size: _propTypes.default.oneOf(["small", "medium", "large"]),
|
|
92
|
+
type: _propTypes.default.oneOf(["primary", "secondary", "text-only", "danger-primary", "danger-secondary", "danger-text-only"])
|
|
93
|
+
};
|
|
94
|
+
CustomButton.defaultProps = {
|
|
95
|
+
className: "",
|
|
96
|
+
"data-test": null,
|
|
97
|
+
disabled: false,
|
|
98
|
+
htmlType: "button",
|
|
99
|
+
iconConfig: {
|
|
100
|
+
position: "left",
|
|
101
|
+
size: 20
|
|
102
|
+
},
|
|
103
|
+
label: "",
|
|
104
|
+
showEllipsis: false,
|
|
105
|
+
size: "medium",
|
|
106
|
+
type: "primary"
|
|
107
|
+
};
|
|
108
|
+
var _default = exports.default = CustomButton;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.EllipsisTypography = exports.ColoredStyledButton = void 0;
|
|
7
|
+
exports.getButtonTypography = getButtonTypography;
|
|
8
|
+
exports.getIconSize = getIconSize;
|
|
9
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var _Typography = _interopRequireDefault(require("../oa-component-typography/Typography"));
|
|
11
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
14
|
+
var _default = exports.default = {};
|
|
15
|
+
const StyledButton = _styledComponents.default.button(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-radius: 4px;\n cursor: pointer;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n .text-container {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px; \n text-align: left;\n }\n"])));
|
|
16
|
+
const EllipsisTypography = exports.EllipsisTypography = (0, _styledComponents.default)(_Typography.default)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: block; \n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: 84px;\n"])));
|
|
17
|
+
const ColoredStyledButton = exports.ColoredStyledButton = (0, _styledComponents.default)(StyledButton)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 2.25rem;\n min-width: 100px;\n padding: 0.625rem 1rem;\n\n &.small {\n height: 30px;\n min-width: 80px;\n padding: 10px 16px;\n }\n\n &.medium {\n height: 36px;\n min-width: 100px;\n padding: 10px 16px;\n }\n\n &.large {\n height: 48px;\n min-width: 136px;\n padding: 10px 24px;\n }\n\n &.medium-text-only,\n &.small-text-only {\n min-width: auto;\n height: auto;\n padding: 4px 0;\n }\n\n &.large-text-only {\n min-width: auto;\n height: auto;\n padding: 8px 0;\n }\n\n &.primary {\n background: var(--color-primary);\n border: 1px solid var(--color-primary);\n color: var(--color-primary-background);\n }\n &.primary:hover {\n background: var(--color-primary-hover);\n border: 1px solid var(--color-primary-hover);\n }\n\n &.primary-disabled {\n background: var(--color-disabled-button);\n cursor: not-allowed;\n color: var(--color-primary-background);\n border: 1px solid var(--color-disabled-button);\n }\n\n &.secondary {\n background: transparent;\n border: 1px solid var(--color-primary);\n color: var(--color-primary);\n }\n &.secondary:hover {\n background: transparent;\n border: 1px solid var(--color-primary-hover);\n color: var(--color-primary-hover);\n }\n\n &.secondary-disabled {\n background: transparent;\n border: 1px solid var(--color-disabled-button);\n color: var(--color-disabled-button);\n cursor: not-allowed;\n }\n \n &.text-only {\n border: none;\n background: transparent;\n color: var(--color-primary);\n }\n &.text-only:hover {\n color: var(--color-primary-hover);\n }\n\n &.text-only-disabled {\n border: none;\n background: transparent;\n color: var(--color-disabled-button);\n cursor: not-allowed;\n }\n \n &.danger-primary {\n background: var(--color-negative);\n color: var(--color-primary-background);\n border: 1px solid var(--color-negative);\n }\n &.danger-primary:hover {\n background: var(--color-hover-negative);\n color: var(--color-primary-background);\n border: 1px solid var(--color-hover-negative);\n }\n\n &.danger-secondary {\n background: transparent;\n border: 1px solid var(--color-negative);\n color: var(--color-negative);\n }\n &.danger-secondary:hover {\n background: transparent;\n border: 1px solid var(--color-hover-negative);\n color: var(--color-hover-negative);\n }\n\n &.danger-text-only {\n border: none;\n color: var(--color-negative);\n background: transparent;\n }\n &.danger-text-only:hover {\n border: none;\n color: var(--color-hover-negative);\n background: transparent;\n }\n @media only screen and (max-width: 600px) {\n &.text-only:hover {\n color: var(--color-primary);\n }\n }\n"])));
|
|
18
|
+
function getButtonTypography(size) {
|
|
19
|
+
switch (size) {
|
|
20
|
+
case 'large':
|
|
21
|
+
return 'type-t2-700';
|
|
22
|
+
case 'small':
|
|
23
|
+
return 'type-b3-400';
|
|
24
|
+
case 'medium':
|
|
25
|
+
return 'type-button-500';
|
|
26
|
+
default:
|
|
27
|
+
return 'type-button-500';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function getIconSize(size) {
|
|
31
|
+
switch (size) {
|
|
32
|
+
case 'large':
|
|
33
|
+
return 24;
|
|
34
|
+
case 'small':
|
|
35
|
+
return 16;
|
|
36
|
+
case 'medium':
|
|
37
|
+
return 20;
|
|
38
|
+
default:
|
|
39
|
+
return 20;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.assign.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getCheckboxTheme = exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _antd = require("antd");
|
|
11
|
+
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
12
|
+
var _Typography = _interopRequireDefault(require("../oa-component-typography/Typography"));
|
|
13
|
+
var _styles = require("./styles");
|
|
14
|
+
var _utils = require("../../utils");
|
|
15
|
+
const _excluded = ["data-test", "label", "onChange", "size", "className"];
|
|
16
|
+
/* eslint-disable */
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
/**
|
|
22
|
+
* Returns the theme configuration for a custom checkbox component.
|
|
23
|
+
*
|
|
24
|
+
* The theme includes the following properties:
|
|
25
|
+
* - colorTextDisabled: The color of the text when the checkbox is disabled.
|
|
26
|
+
* - colorPrimaryHover: The color of the checkbox when hovered.
|
|
27
|
+
* - colorPrimary: The primary color of the checkbox.
|
|
28
|
+
* - colorBgContainerDisabled: The background color of the checkbox when disabled.
|
|
29
|
+
* - colorBorder: The color of the checkbox border.
|
|
30
|
+
* - colorText: The color of the text associated with the checkbox.
|
|
31
|
+
* - borderRadiusSM: The small border radius applied to the checkbox.
|
|
32
|
+
* - paddingXS: The extra small padding applied to the checkbox.
|
|
33
|
+
*/
|
|
34
|
+
const getCheckboxTheme = () => ({
|
|
35
|
+
token: {
|
|
36
|
+
colorTextDisabled: _ColorVariablesMap.default["--color-disabled-button"],
|
|
37
|
+
colorPrimaryHover: _ColorVariablesMap.default["--color-primary"],
|
|
38
|
+
colorPrimary: _ColorVariablesMap.default["--color-primary"],
|
|
39
|
+
colorBgContainerDisabled: _ColorVariablesMap.default["--color-secondary-background"],
|
|
40
|
+
colorBorder: _ColorVariablesMap.default["--color-secondary-content"],
|
|
41
|
+
colorText: _ColorVariablesMap.default["--color-primary-content"],
|
|
42
|
+
borderRadiusSM: "2px",
|
|
43
|
+
paddingXS: "12px"
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A custom checkbox component with an accompanying label.
|
|
49
|
+
*
|
|
50
|
+
* This component wraps around the `antd` `Checkbox` component.
|
|
51
|
+
* It provides the following features:
|
|
52
|
+
* - A themed checkbox.
|
|
53
|
+
* - A label that can be a string, number, or a node.
|
|
54
|
+
* - A `data-test` attribute to aid with testing.
|
|
55
|
+
* - A `size` prop to control the size of the label accompanying the checkbox.
|
|
56
|
+
* - All props of the `antd` `Checkbox` component are applicable here as well.
|
|
57
|
+
*
|
|
58
|
+
* @param {Object} props Component props.
|
|
59
|
+
* @param {string} [props.data-test] A unique identifier for the component for testing purposes.
|
|
60
|
+
* @param {string|number|node} [props.label] The label to be displayed next to the checkbox.
|
|
61
|
+
* @param {function} [props.onChange] The callback function to be called when the checkbox state changes.
|
|
62
|
+
* @param {string} [props.size] The size of the label accompanying the checkbox. It can be either 'large' or 'small'.
|
|
63
|
+
* @param {Object} [props.antDesignProps] The extra props to be passed to the `antd` `Checkbox` component.
|
|
64
|
+
*/
|
|
65
|
+
exports.getCheckboxTheme = getCheckboxTheme;
|
|
66
|
+
function CustomCheckBox(_ref) {
|
|
67
|
+
let {
|
|
68
|
+
"data-test": dataTest,
|
|
69
|
+
label,
|
|
70
|
+
onChange,
|
|
71
|
+
size,
|
|
72
|
+
className
|
|
73
|
+
/*
|
|
74
|
+
Instead of keeping a `checked` prop explicitly,
|
|
75
|
+
we keep it optional by directly passing extra props to the antd component.
|
|
76
|
+
So, if required, the `checked` prop can be supplied to the component.
|
|
77
|
+
*/
|
|
78
|
+
} = _ref,
|
|
79
|
+
antDesignProps = _objectWithoutProperties(_ref, _excluded);
|
|
80
|
+
const handleChange = event => {
|
|
81
|
+
// Call to `onChange` callback received from props.
|
|
82
|
+
onChange(event);
|
|
83
|
+
};
|
|
84
|
+
return /*#__PURE__*/_react.default.createElement(_styles.StyleContainer, null, /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
85
|
+
theme: getCheckboxTheme()
|
|
86
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Checkbox, _extends({
|
|
87
|
+
className: className !== null && className !== void 0 ? className : "",
|
|
88
|
+
"data-test": dataTest,
|
|
89
|
+
onChange: handleChange
|
|
90
|
+
}, antDesignProps),
|
|
91
|
+
// The label is a string or a number
|
|
92
|
+
((0, _utils.isString)(label) || (0, _utils.isNumber)(label)) && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
93
|
+
typography: size === "large" ? "type-b1-400" : "type-b2-400"
|
|
94
|
+
}, label) ||
|
|
95
|
+
// The label is a node
|
|
96
|
+
/*#__PURE__*/_react.default.isValidElement(label) && label || undefined)));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// This allows us referencing the Group container in our Checkbox component
|
|
100
|
+
CustomCheckBox.Group = _antd.Checkbox.Group;
|
|
101
|
+
CustomCheckBox.propTypes = {
|
|
102
|
+
"data-test": _propTypes.default.string,
|
|
103
|
+
label: _propTypes.default.node,
|
|
104
|
+
onChange: _propTypes.default.func,
|
|
105
|
+
size: _propTypes.default.oneOf(["large", "small"]),
|
|
106
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.bool])
|
|
107
|
+
};
|
|
108
|
+
CustomCheckBox.defaultProps = {
|
|
109
|
+
"data-test": null,
|
|
110
|
+
label: null,
|
|
111
|
+
onChange: value => {},
|
|
112
|
+
size: "small",
|
|
113
|
+
value: ""
|
|
114
|
+
};
|
|
115
|
+
var _default = exports.default = CustomCheckBox;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.StyleContainer = 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 StyleContainer = exports.StyleContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.ant-checkbox-wrapper .ant-checkbox {\n align-self: start;\n margin: 2px 0 0 0; \n}\n"])));
|