@bikdotai/bik-component-library 0.0.763-beta.57 → 0.0.763

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.
Files changed (183) hide show
  1. package/dist/cjs/components/QueryBuilder/Filters/CustomField/components/CustomField.js +1 -1
  2. package/dist/cjs/components/QueryBuilder/Filters/Event/components/EventFilter.js +1 -1
  3. package/dist/cjs/components/QueryBuilder/Filters/UserProperty/components/UserPropertyFilter.js +1 -1
  4. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  5. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  6. package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  7. package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  8. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  9. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.js +1 -1
  10. package/dist/cjs/components/QueryBuilder/components/Connectors/Components/InTheLast.js +1 -1
  11. package/dist/cjs/components/QueryBuilder/components/Connectors/Components/InTwoLast.js +1 -1
  12. package/dist/cjs/components/QueryBuilder/helpers/SegmentValidator.d.ts +26 -6
  13. package/dist/cjs/components/QueryBuilder/helpers/SegmentValidator.js +1 -0
  14. package/dist/cjs/components/SearchFilter/components/DatePickerButton.js +1 -1
  15. package/dist/cjs/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
  16. package/dist/cjs/components/SearchFilter/components/SearchFilterItem.js +1 -1
  17. package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
  18. package/dist/cjs/components/TablePagination/TablePaginationCard.d.ts +1 -1
  19. package/dist/cjs/components/WhatsAppTextEditor/CustomEditor.styled.d.ts +3 -3
  20. package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +1 -1
  21. package/dist/cjs/components/analytics-card/AnalyticsCard.styled.d.ts +2 -2
  22. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  23. package/dist/cjs/components/analytics-chips-and-dropdowns/CommonStyles.d.ts +5 -5
  24. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js +1 -1
  25. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.d.ts +3 -3
  26. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMap.d.ts +4 -0
  27. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js +1 -1
  28. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapStyled.d.ts +8 -8
  29. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.d.ts +1 -1
  30. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.d.ts +5 -5
  31. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/scoreBlock/ScoreBlock.styled.d.ts +5 -5
  32. package/dist/cjs/components/banner/Banner.styled.d.ts +20 -20
  33. package/dist/cjs/components/bik-layout/BikHeader.js +1 -1
  34. package/dist/cjs/components/bik-layout/CommonStyles.d.ts +17 -17
  35. package/dist/cjs/components/bik-layout/CommonStyles.js +1 -1
  36. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
  37. package/dist/cjs/components/button/Button.styled.d.ts +1 -1
  38. package/dist/cjs/components/card-selection-modal/CardSelectionModal.styled.d.ts +2 -2
  39. package/dist/cjs/components/carousel-secondary/CarouselSecondary.style.d.ts +6 -6
  40. package/dist/cjs/components/checkList/CheckList.styled.d.ts +1 -1
  41. package/dist/cjs/components/code-block/CodeBlock.js +1 -1
  42. package/dist/cjs/components/colourInput/ColourInput.styled.d.ts +2 -2
  43. package/dist/cjs/components/country-code-picker/CountryCodePicker.js +1 -1
  44. package/dist/cjs/components/country-code-picker/CountryCodePicker.styled.d.ts +2 -2
  45. package/dist/cjs/components/country-code-picker/CountryPicker.js +1 -1
  46. package/dist/cjs/components/country-code-picker/CountryPicker.styled.d.ts +2 -2
  47. package/dist/cjs/components/custom-date-time/CustomDateTime.js +1 -1
  48. package/dist/cjs/components/custom-date-time/CustomDateTime.styled.d.ts +1 -1
  49. package/dist/cjs/components/custom-date-time/DateSelector/DateSelector.js +1 -1
  50. package/dist/cjs/components/dashboard-review-popup/DashboardReviewPopUp.styled.d.ts +2 -2
  51. package/dist/cjs/components/dashboard-review-popup/components/FiveStar.styled.d.ts +2 -2
  52. package/dist/cjs/components/dashboard-review-popup/components/Form.styled.d.ts +6 -6
  53. package/dist/cjs/components/datePicker/DatePicker.styled.d.ts +4 -4
  54. package/dist/cjs/components/datePicker/TimePicker.js +1 -1
  55. package/dist/cjs/components/discount-modal/CouponExpiration/CouponExpiration.js +1 -1
  56. package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
  57. package/dist/cjs/components/discount-modal/DiscountModal.styled.d.ts +5 -5
  58. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  59. package/dist/cjs/components/discount-modal/DynamicCoupon/MinimumRequirementComponent.js +1 -1
  60. package/dist/cjs/components/dropdown/Dropdown.d.ts +0 -1
  61. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  62. package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
  63. package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  64. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +0 -6
  65. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +4 -34
  66. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +0 -2
  67. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
  68. package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.d.ts +0 -1
  69. package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
  70. package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
  71. package/dist/cjs/components/dropdown/type.d.ts +0 -8
  72. package/dist/cjs/components/dropdown-button/DropdownButton.js +1 -1
  73. package/dist/cjs/components/input/Input.styled.d.ts +4 -4
  74. package/dist/cjs/components/keywords-input/KeywordsInput.styled.d.ts +1 -1
  75. package/dist/cjs/components/list-item/ListItem.styled.d.ts +1 -1
  76. package/dist/cjs/components/modals/modal.styled.d.ts +4 -4
  77. package/dist/cjs/components/pagination/Pagination.styled.d.ts +1 -1
  78. package/dist/cjs/components/plans/DurationSelectorStyles.d.ts +1 -1
  79. package/dist/cjs/components/plans/SubscriptionPlanSelector.d.ts +2 -2
  80. package/dist/cjs/components/plans/SubscriptionPlanStyled.d.ts +2 -2
  81. package/dist/cjs/components/product-picker/ProductPicker.styled.d.ts +2 -2
  82. package/dist/cjs/components/progress-bar/ProgressBarComponent.d.ts +1 -1
  83. package/dist/cjs/components/radioList/RadioList.styled.d.ts +1 -1
  84. package/dist/cjs/components/sample-button/SampleButton.styled.d.ts +1 -1
  85. package/dist/cjs/components/shimmer/ShimmerComponent/ShimmerStyled.d.ts +2 -2
  86. package/dist/cjs/components/switch/Switch.d.ts +3 -3
  87. package/dist/cjs/components/tabs/Tabs.styles.d.ts +5 -5
  88. package/dist/cjs/components/tag/Tag.styled.d.ts +1 -1
  89. package/dist/cjs/components/testimonial-card/TestimonialCard.style.d.ts +9 -9
  90. package/dist/cjs/components/toaster/Toaster.js +1 -1
  91. package/dist/cjs/components/toaster/Toaster.styled.d.ts +1 -1
  92. package/dist/esm/components/QueryBuilder/Filters/CustomField/components/CustomField.js +1 -1
  93. package/dist/esm/components/QueryBuilder/Filters/Event/components/EventFilter.js +1 -1
  94. package/dist/esm/components/QueryBuilder/Filters/UserProperty/components/UserPropertyFilter.js +1 -1
  95. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  96. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  97. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  98. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  99. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  100. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.js +1 -1
  101. package/dist/esm/components/QueryBuilder/components/Connectors/Components/InTheLast.js +1 -1
  102. package/dist/esm/components/QueryBuilder/components/Connectors/Components/InTwoLast.js +1 -1
  103. package/dist/esm/components/QueryBuilder/helpers/SegmentValidator.d.ts +26 -6
  104. package/dist/esm/components/QueryBuilder/helpers/SegmentValidator.js +1 -0
  105. package/dist/esm/components/SearchFilter/components/DatePickerButton.js +1 -1
  106. package/dist/esm/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
  107. package/dist/esm/components/SearchFilter/components/SearchFilterItem.js +1 -1
  108. package/dist/esm/components/TablePagination/TablePagination.js +1 -1
  109. package/dist/esm/components/TablePagination/TablePaginationCard.d.ts +1 -1
  110. package/dist/esm/components/WhatsAppTextEditor/CustomEditor.styled.d.ts +3 -3
  111. package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +1 -1
  112. package/dist/esm/components/analytics-card/AnalyticsCard.styled.d.ts +2 -2
  113. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  114. package/dist/esm/components/analytics-chips-and-dropdowns/CommonStyles.d.ts +5 -5
  115. package/dist/esm/components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js +1 -1
  116. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.d.ts +3 -3
  117. package/dist/esm/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMap.d.ts +4 -0
  118. package/dist/esm/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js +1 -1
  119. package/dist/esm/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapStyled.d.ts +8 -8
  120. package/dist/esm/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.d.ts +1 -1
  121. package/dist/esm/components/analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.d.ts +5 -5
  122. package/dist/esm/components/analytics-chips-and-dropdowns/chart/scoreBlock/ScoreBlock.styled.d.ts +5 -5
  123. package/dist/esm/components/banner/Banner.styled.d.ts +20 -20
  124. package/dist/esm/components/bik-layout/BikHeader.js +1 -1
  125. package/dist/esm/components/bik-layout/CommonStyles.d.ts +17 -17
  126. package/dist/esm/components/bik-layout/CommonStyles.js +1 -1
  127. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
  128. package/dist/esm/components/button/Button.styled.d.ts +1 -1
  129. package/dist/esm/components/card-selection-modal/CardSelectionModal.styled.d.ts +2 -2
  130. package/dist/esm/components/carousel-secondary/CarouselSecondary.style.d.ts +6 -6
  131. package/dist/esm/components/checkList/CheckList.styled.d.ts +1 -1
  132. package/dist/esm/components/code-block/CodeBlock.js +1 -1
  133. package/dist/esm/components/colourInput/ColourInput.styled.d.ts +2 -2
  134. package/dist/esm/components/country-code-picker/CountryCodePicker.js +1 -1
  135. package/dist/esm/components/country-code-picker/CountryCodePicker.styled.d.ts +2 -2
  136. package/dist/esm/components/country-code-picker/CountryPicker.js +1 -1
  137. package/dist/esm/components/country-code-picker/CountryPicker.styled.d.ts +2 -2
  138. package/dist/esm/components/custom-date-time/CustomDateTime.js +1 -1
  139. package/dist/esm/components/custom-date-time/CustomDateTime.styled.d.ts +1 -1
  140. package/dist/esm/components/custom-date-time/DateSelector/DateSelector.js +1 -1
  141. package/dist/esm/components/dashboard-review-popup/DashboardReviewPopUp.styled.d.ts +2 -2
  142. package/dist/esm/components/dashboard-review-popup/components/FiveStar.styled.d.ts +2 -2
  143. package/dist/esm/components/dashboard-review-popup/components/Form.styled.d.ts +6 -6
  144. package/dist/esm/components/datePicker/DatePicker.styled.d.ts +4 -4
  145. package/dist/esm/components/datePicker/TimePicker.js +1 -1
  146. package/dist/esm/components/discount-modal/CouponExpiration/CouponExpiration.js +1 -1
  147. package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
  148. package/dist/esm/components/discount-modal/DiscountModal.styled.d.ts +5 -5
  149. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  150. package/dist/esm/components/discount-modal/DynamicCoupon/MinimumRequirementComponent.js +1 -1
  151. package/dist/esm/components/dropdown/Dropdown.d.ts +0 -1
  152. package/dist/esm/components/dropdown/Dropdown.js +1 -1
  153. package/dist/esm/components/dropdown/DropdownPopover/index.js +1 -1
  154. package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  155. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +0 -6
  156. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +6 -36
  157. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +0 -2
  158. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
  159. package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.d.ts +0 -1
  160. package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
  161. package/dist/esm/components/dropdown/hooks/useDropdown.js +1 -1
  162. package/dist/esm/components/dropdown/type.d.ts +0 -8
  163. package/dist/esm/components/dropdown-button/DropdownButton.js +1 -1
  164. package/dist/esm/components/input/Input.styled.d.ts +4 -4
  165. package/dist/esm/components/keywords-input/KeywordsInput.styled.d.ts +1 -1
  166. package/dist/esm/components/list-item/ListItem.styled.d.ts +1 -1
  167. package/dist/esm/components/modals/modal.styled.d.ts +4 -4
  168. package/dist/esm/components/pagination/Pagination.styled.d.ts +1 -1
  169. package/dist/esm/components/plans/DurationSelectorStyles.d.ts +1 -1
  170. package/dist/esm/components/plans/SubscriptionPlanSelector.d.ts +2 -2
  171. package/dist/esm/components/plans/SubscriptionPlanStyled.d.ts +2 -2
  172. package/dist/esm/components/product-picker/ProductPicker.styled.d.ts +2 -2
  173. package/dist/esm/components/progress-bar/ProgressBarComponent.d.ts +1 -1
  174. package/dist/esm/components/radioList/RadioList.styled.d.ts +1 -1
  175. package/dist/esm/components/sample-button/SampleButton.styled.d.ts +1 -1
  176. package/dist/esm/components/shimmer/ShimmerComponent/ShimmerStyled.d.ts +2 -2
  177. package/dist/esm/components/switch/Switch.d.ts +3 -3
  178. package/dist/esm/components/tabs/Tabs.styles.d.ts +5 -5
  179. package/dist/esm/components/tag/Tag.styled.d.ts +1 -1
  180. package/dist/esm/components/testimonial-card/TestimonialCard.style.d.ts +9 -9
  181. package/dist/esm/components/toaster/Toaster.js +1 -1
  182. package/dist/esm/components/toaster/Toaster.styled.d.ts +1 -1
  183. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),t=require("../../../assets/icons/info.svg.js"),o=require("../../alerts/Alert.js"),s=require("../../alerts/AlertHelper.js"),n=require("../../button/Button.js"),r=require("../../checkBox/CheckBox.js"),l=require("../type.js");require("../../dropdown/DropdownPopover/index.js");var a=require("../../dropdown/Dropdown.js");require("../../dropdown/ChipDropdown.js"),require("react"),require("../../zeroState/ZeroState.js");var d=require("../../TypographyStyle.js"),c=require("../../../constants/Theme.js");require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../icon-button/IconButton.js");var u=require("../../input/Input.js"),p=require("../../../assets/icons/cross.svg.js");require("../../dropdown/MenuItem/MenuItem.js");var T,C=require("../../radioButton/RadioButton.js"),E=require("../../../assets/icons/cubeIcon.svg.js"),D=require("../../../assets/icons/delete.svg.js"),O=require("../../../assets/icons/edit.svg.js"),S=require("../../../assets/icons/plus.svg.js"),P=require("../CouponExpiration/CouponExpiration.js"),I=require("../DiscountModal.styled.js"),x=require("./DynamicCoupon.styled.js"),v=require("./MinimumRequirementComponent.js"),_=require("./ZeroState.js");exports.DISCOUNT_PRODUCTS=void 0,(T=exports.DISCOUNT_PRODUCTS||(exports.DISCOUNT_PRODUCTS={})).ENTITLED="entitled",T.PREREQUISITE="prerequisite";exports.default=T=>{var j,b,g,m,y,U,h,R;const N=[{selected:T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER,label:"Entire Order",value:l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER},{selected:T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS}],V=[{selected:T.offerAppliesToBuy===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:T.offerAppliesToBuy===l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS}],A=[{selected:T.offerAppliesToGet===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:T.offerAppliesToGet===l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS}],L=(e,r,a)=>{var u,C,P,I,v,_,j,b,g,m,y,U;let h=[],R=[],N={},V={};T.useNewPicker?(N=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,V=null!==(u=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==u?u:[],(null==N?void 0:N.isCustom)&&delete N.isCustom,(null==V?void 0:V.isCustom)&&delete V.isCustom,Object.values(N).forEach((e=>{Object.keys(e.products).forEach((i=>{h.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(V).forEach((e=>{"isCustom"!==e&&R.push({id:e,name:V[e].name,image:V[e].image})}))):(h=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,R=null!==(C=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==C?C:[]);const A=[null===(P=T.dynamicDiscountValidationError)||void 0===P?void 0:P.inValidProductSelection,null===(I=T.dynamicDiscountValidationError)||void 0===I?void 0:I.inValidProductVariableSelection,null===(v=T.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidCollectionSelection],L=[null===(_=T.dynamicDiscountValidationError)||void 0===_?void 0:_.inValidBuyXCollectionSelection,null===(j=T.dynamicDiscountValidationError)||void 0===j?void 0:j.inValidBuyXProductSelection,null===(b=T.dynamicDiscountValidationError)||void 0===b?void 0:b.inValidBuyXProductVariableSelection],f=[null===(g=T.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidGetYCollectionSelection,null===(m=T.dynamicDiscountValidationError)||void 0===m?void 0:m.inValidGetYProductSelection,null===(y=T.dynamicDiscountValidationError)||void 0===y?void 0:y.inValidGetYProductVariableSelection];let F=!1;return"couponAppliesTo"===a&&(F=A.some(Boolean)),"buyX"===a&&(F=L.some(Boolean)),"getY"===a&&(F=f.some(Boolean)),i.jsxs(i.Fragment,{children:[i.jsxs("div",Object.assign({style:{display:"flex",gap:18}},{children:[e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS&&0===h.length&&(r===exports.DISCOUNT_PRODUCTS.ENTITLED&&!T.entitledProductVariable||r===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&!T.preRequisiteProductVariable)&&!(null==R?void 0:R.length)&&i.jsxs(x.AddProductButtonsContainer,{children:[i.jsx("div",Object.assign({style:{width:T.isProductVariableSupported?"284px":"300px",display:"flex"}},{children:i.jsx(n.Button,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:S.default,matchParentWidth:!0,onClick:()=>{T.setIsProductPickerOpen(r)},error:F})})),T.isProductVariableSupported&&T.productVariableList&&i.jsxs(i.Fragment,{children:[i.jsx(d.BodySecondary,Object.assign({color:c.DEFAULT_THEME.colorsV2.content.placeholder},{children:"OR"})),i.jsx(n.Button,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:S.default,matchParentWidth:!0,onClick:()=>{T.setIsProductVariablePickerOpen(r)},error:F})]})]}),e===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&0===R.length&&!(null==h?void 0:h.length)&&i.jsx("div",Object.assign({style:{width:"300px",display:"flex"}},{children:i.jsx(n.Button,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:S.default,matchParentWidth:!0,onClick:()=>{T.setIsCollectionPickerOpen(r)},style:{marginTop:"16px"},error:F})}))]})),F&&i.jsx("div",Object.assign({style:{margin:"8px 0 0"}},{children:i.jsx(o.Alert,{type:s.ALERT_TYPES.NEGATIVE,text:"Required Field",contentPosition:s.CONTENT_POSITION.START,icon:()=>i.jsx(t.default,{width:16,height:16,color:c.DEFAULT_THEME.colorsV2.content.negative})})})),h.length||R.length?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"8px 0"}},{children:e===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"})),i.jsxs(x.ProductCollectionCard,{children:[i.jsx(x.CubeIconContainer,{children:i.jsx(E.default,{width:20,height:20,color:c.DEFAULT_THEME.colorsV2.content.secondary})}),i.jsxs(d.TitleSmall,{children:[e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?h.length:R.length," ",e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i.jsxs("div",Object.assign({style:{display:"flex",gap:4}},{children:[i.jsx(x.IconContainer,Object.assign({onClick:()=>{e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?T.setIsProductPickerOpen(r):T.setIsCollectionPickerOpen(r)}},{children:i.jsx(O.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.placeholder})})),i.jsx(x.IconContainer,Object.assign({onClick:()=>{e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.setEntitledProducts([]):T.setPrerequisiteProducts([]):r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.setEntitledCollections([]):T.setPrerequisiteCollections([])}},{children:i.jsx(D.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.placeholder})}))]}))]})]}):r===exports.DISCOUNT_PRODUCTS.ENTITLED&&T.entitledProductVariable?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i.jsxs(x.ProductVariableCard,{children:[i.jsx(d.TitleSmall,{children:T.entitledProductVariable.displayName}),i.jsx("div",Object.assign({style:{display:"flex",gap:4}},{children:i.jsx(x.IconContainer,Object.assign({onClick:()=>{T.setEntitledProductVariable(void 0)}},{children:i.jsx(p.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.primary})}))}))]})]}):r===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(U=T.preRequisiteProductVariable)||void 0===U?void 0:U.displayName)?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i.jsxs(x.ProductVariableCard,{children:[i.jsx(d.TitleSmall,{children:T.preRequisiteProductVariable.displayName}),i.jsx("div",Object.assign({style:{display:"flex",gap:4}},{children:i.jsx(x.IconContainer,Object.assign({onClick:()=>{T.setPreRequisiteProductVariable(void 0)}},{children:i.jsx(p.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.primary})}))}))]})]}):i.jsx(i.Fragment,{children:" "})]})},f=(e,t)=>{var o,s,n,r,c,p,C,E,D,O;let S=[],P=[],I={},x={};T.useNewPicker?(I=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,x=null!==(o=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==o?o:[],(null==I?void 0:I.isCustom)&&delete I.isCustom,(null==x?void 0:x.isCustom)&&delete x.isCustom,Object.values(I).forEach((e=>{Object.keys(e.products).forEach((i=>{S.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(x).forEach((e=>{"isCustom"!==e&&P.push({id:e,name:x[e].name,image:x[e].image})}))):(S=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,P=null!==(s=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==s?s:[]);const v=e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?T.offerAppliesToBuy:T.offerAppliesToGet,_=e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?exports.DISCOUNT_PRODUCTS.PREREQUISITE:exports.DISCOUNT_PRODUCTS.ENTITLED,j=v===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS?l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS:l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS;return i.jsxs("div",{children:[i.jsx(d.TitleSmall,Object.assign({style:{marginBottom:16}},{children:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"Customer buys":"Customer gets"})),i.jsxs("div",Object.assign({style:{display:"flex"}},{children:[!t&&i.jsx("div",{children:i.jsxs("div",Object.assign({className:"input__rows"},{children:[i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:e===exports.DISCOUNT_PRODUCTS.ENTITLED?null!==(r=null===(n=T.discountData.entitledQuantity)||void 0===n?void 0:n.toString())&&void 0!==r?r:"":null!==(p=null===(c=T.discountData.prerequisiteQuantity)||void 0===c?void 0:c.toString())&&void 0!==p?p:"",type:"number",onChangeText:i=>{e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.setDiscountData(Object.assign(Object.assign({},T.discountData),{entitledQuantity:parseInt(i)})):T.setDiscountData(Object.assign(Object.assign({},T.discountData),{prerequisiteQuantity:parseInt(i)}))},labelText:"Quantity of products",placeholder:"Eg. 2",width:"300px",errorMessage:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(C=T.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidBuyXValue)||e===exports.DISCOUNT_PRODUCTS.ENTITLED&&(null===(E=T.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidGetYValue)?"Required Field":"",state:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(D=T.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidBuyXValue)||e===exports.DISCOUNT_PRODUCTS.ENTITLED&&(null===(O=T.dynamicDiscountValidationError)||void 0===O?void 0:O.inValidGetYValue)?"invalid":"none"})})),i.jsx("div",{className:"input__wrapper"})]}))}),i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{marginBottom:8}},{children:"Any items from"})),e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&i.jsx(a.Dropdown,{width:"244px",options:V,placement:"bottom-start",onSelect:e=>{var i,t,o;T.setOfferAppliesToBuy(e.value),T.setPrerequisiteProducts([]),T.setPrerequisiteCollections([]),T.setPreRequisiteProductVariable(void 0),T.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidBuyXCollectionSelection:!1,inValidBuyXProductSelection:!1,inValidBuyXProductVariableSelection:!1}))),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:null===(i=T.discountData.collectionsConf)||void 0===i?void 0:i.entitledCollections,prerequisiteCollections:{}},productsConf:{entitledProducts:null===(t=T.discountData.productsConf)||void 0===t?void 0:t.entitledProducts,prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:null===(o=T.discountData.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,prerequisiteProductVariable:{}}}))}}),e===exports.DISCOUNT_PRODUCTS.ENTITLED&&i.jsx(a.Dropdown,{width:"244px",options:A,placement:"bottom-start",onSelect:e=>{var i,t,o;T.setOfferAppliesToGet(e.value),T.setEntitledProducts([]),T.setEntitledCollections([]),T.setEntitledProductVariable(void 0),T.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidGetYCollectionSelection:!1,inValidGetYProductSelection:!1,inValidGetYProductVariableSelection:!1}))),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{entitledCollectionIds:[],entitledProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:null===(i=T.discountData.collectionsConf)||void 0===i?void 0:i.prerequisiteCollections},productsConf:{entitledProducts:{},prerequisiteProducts:null===(t=T.discountData.productsConf)||void 0===t?void 0:t.prerequisiteProducts},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:null===(o=T.discountData.productVariableConf)||void 0===o?void 0:o.prerequisiteProductVariable}}))}})]})]})),L(j,_,e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"buyX":"getY")]})};return i.jsxs(I.DynamicCouponContainer,Object.assign({style:T.noTopMargin?{marginTop:0}:{}},{children:[i.jsxs("div",{children:[i.jsxs("div",Object.assign({style:{display:"flex",gap:16}},{children:[i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:null!==(j=T.discountData.title)&&void 0!==j?j:"",onChangeText:e=>{var i;T.setDiscountData(Object.assign(Object.assign({},T.discountData),{title:null!==(i=null==e?void 0:e.trim())&&void 0!==i?i:""}))},maxCharLimit:30,labelText:"Discount Coupon Title",placeholder:`Eg. “Flat ${null!==(b=T.currency)&&void 0!==b?b:""} 15 Off”`,hintText:"Will be same for everyone. Can’t be changed later",width:"300px",isRequired:!0,errorMessage:(null===(g=T.dynamicDiscountValidationError)||void 0===g?void 0:g.invalidCouponTitle)?"Required Field":"",state:(null===(m=T.dynamicDiscountValidationError)||void 0===m?void 0:m.invalidCouponTitle)?"invalid":"none"})})),!T.hideProbability&&i.jsx(u.Input,{value:null!==(U=null===(y=T.discountData.probability)||void 0===y?void 0:y.toString())&&void 0!==U?U:"",type:"number",onChangeText:e=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability of getting coupon ",hintText:"Enter a decimal value between 0-1",placeholder:"Eg. 0.5",maxCharLimit:4,width:"300px",isRequired:!0,errorMessage:(null===(h=T.dynamicDiscountValidationError)||void 0===h?void 0:h.inValidProbability)?"Required Field":"",state:(null===(R=T.dynamicDiscountValidationError)||void 0===R?void 0:R.inValidProbability)?"invalid":"none"})]})),i.jsx("div",{style:{height:"1px",width:"100%",background:c.DEFAULT_THEME.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),T.allowStaticCoupon&&i.jsx((()=>i.jsxs("div",{children:[i.jsx(d.TitleRegular,{children:"Discount Details"}),i.jsx(x.DiscountOptionsContainer,{children:T.discountDetailsOptions.map((t=>{return i.jsxs(x.DiscountDetailsOption,Object.assign({selected:T.selectedDiscountDetails.id===t.id,onClick:()=>(i=>{if(T.selectedDiscountDetails.id!==i.id)if(T.resetValidationErrors(),T.setValidationErrorMessage(""),T.setDiscountCouponAppliesTo(l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),T.setSelectedDiscountDetails(i),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:void 0})),T.setPreRequisiteProductVariable(void 0),T.setEntitledProductVariable(void 0),["percentage","amount"].includes(i.value)){T.onChangeCouponType({label:"Amount off on order",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER});const t=Object.assign(Object.assign({},T.discountData),{valueType:"percentage"===i.value?l.DISCOUNT_VALUE_TYPES.PERCENTAGE:l.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,value:void 0,targetType:l.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:l.DISCOUNT_TARGET_SELECTION.ALL,entitledCollectionIds:[],entitledProductIds:[],prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:{}},productsConf:{entitledProducts:{},prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:{}}}),o=e.__rest(t,["entitledQuantity","prerequisiteQuantity"]);T.setDiscountData(o)}else T.onChangeCouponType({label:i.label,selected:!0,value:i.value})})(t)},{children:[t.icon((o=t.id,T.selectedDiscountDetails.id===o?c.DEFAULT_THEME.colorsV2.stroke.brand:c.DEFAULT_THEME.colorsV2.text.secondary)),t.label]}),t.id);var o}))})]})),{}),(T.selectedCouponType===l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER||T.selectedCouponType===l.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS)&&(()=>{var e,t,o,s,n,r;return i.jsxs(i.Fragment,{children:[i.jsx("div",Object.assign({className:"input__rows"},{children:i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:null!==(o=null===(t=null===(e=T.discountData)||void 0===e?void 0:e.value)||void 0===t?void 0:t.toString())&&void 0!==o?o:"",labelText:"Discount amount",type:"number",width:"300px",onChangeText:e=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:parseInt(e)}))},placeholder:"15",prefixText:T.discountData.valueType===l.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(s=T.currency)&&void 0!==s?s:"":void 0,suffixText:T.discountData.valueType===l.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0,errorMessage:(null===(n=T.dynamicDiscountValidationError)||void 0===n?void 0:n.inValidDiscountAmount)?"Required Field":"",state:(null===(r=T.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"invalid":"none"})}))})),i.jsx("div",Object.assign({style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`}},{children:i.jsxs("div",Object.assign({className:"input__wrapper"},{children:[i.jsx(d.TitleRegular,Object.assign({style:{marginBottom:10}},{children:"Applies to"})),i.jsx("div",Object.assign({style:{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto"}},{children:i.jsx(a.Dropdown,{width:"300px",options:N,placement:"bottom-start",onSelect:e=>{const i="value"in e&&e.value===l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER?{label:"Amount off on order",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER}:{label:"Amount off on products",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS};T.onChangeCouponType(i),T.setDiscountCouponAppliesTo(e.value),T.setEntitledProductVariable(void 0),T.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidProductVariableSelection:!1,inValidProductSelection:!1,inValidCollectionSelection:!1})))}})})),(T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS)&&L(T.discountCouponAppliesTo,exports.DISCOUNT_PRODUCTS.ENTITLED,"couponAppliesTo")]}))}))]})})(),T.selectedCouponType===l.DISCOUNT_TYPES.BUY_X_GET_Y&&(()=>{var e,t,o,s,n;return i.jsxs(I.DynamicCouponContainer,Object.assign({style:{border:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0}},{children:[f(exports.DISCOUNT_PRODUCTS.PREREQUISITE),i.jsx("div",{style:{width:"100%",height:"1px",backgroundColor:c.DEFAULT_THEME.colorsV2.stroke.primary,margin:"8px 0"}}),f(exports.DISCOUNT_PRODUCTS.ENTITLED),i.jsx(d.BodySecondary,Object.assign({style:{marginTop:"8px"}},{children:"At a discounted value"})),i.jsx("div",{children:i.jsx(C.RadioButton,{label:"Free",isActive:100===T.discountData.value,onValueChange:e=>{e?T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:100})):T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:void 0}))}})}),i.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[i.jsx(C.RadioButton,{label:"Percentage off",isActive:100!==T.discountData.value,onValueChange:()=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:void 0}))}}),100!==T.discountData.value&&i.jsx("div",Object.assign({style:{marginTop:8}},{children:i.jsx(u.Input,{value:null!==(o=null===(t=null===(e=T.discountData)||void 0===e?void 0:e.value)||void 0===t?void 0:t.toString())&&void 0!==o?o:"",onChangeText:e=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Eg. 50",suffixText:"%",width:"300px",errorMessage:(null===(s=T.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"Required Field":"",state:(null===(n=T.dynamicDiscountValidationError)||void 0===n?void 0:n.inValidDiscountAmount)?"invalid":"none"})}))]}))]}))})(),!T.selectedCouponType&&i.jsx(_.default,{}),T.allowStaticCoupon&&T.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y&&i.jsx("div",Object.assign({style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`}},{children:i.jsx(v.default,{selectedMinimumRequirement:T.selectedMinimumRequirement,setSelectedMinimumRequirement:T.setSelectedMinimumRequirement,discountData:T.discountData,setDiscountData:T.setDiscountData,currency:T.currency,dynamicDiscountValidationError:T.dynamicDiscountValidationError})})),T.selectedCouponType&&!T.hideExpiration&&i.jsxs("div",Object.assign({style:{padding:T.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:T.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y?`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`:"none"}},{children:[i.jsx(r.CheckBox,{label:"Add expiration",isDisabled:!!T.makeExpiryMandatory,isChecked:T.isAddExpirationChecked,onValueChange:e=>{T.setIsAddExpirationChecked(e),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{expireAfter:void 0,expireAt:void 0})),T.setSelectedExpiration(T.isUsageFromStatic?l.COUPON_EXPIRATION.FIXED_EXPIRATION:l.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)},boldOnChecked:!0,labelSize:"DEFAULT"}),i.jsx(d.BodySecondary,Object.assign({style:{color:c.DEFAULT_THEME.colorsV2.text.secondary,marginLeft:28}},{children:"Make coupon only valid till a certain time"})),T.isAddExpirationChecked&&i.jsx(P.CouponExpiration,{discountData:T.discountData,setDiscountData:T.setDiscountData,isAddExpirationChecked:T.isAddExpirationChecked,inValidCouponExpiry:T.dynamicDiscountValidationError.inValidCouponExpiry,selectedExpiration:T.selectedExpiration,setSelectedExpiration:T.setSelectedExpiration,hideExpirationOptions:T.isUsageFromStatic})]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),t=require("../../../assets/icons/info.svg.js"),o=require("../../alerts/Alert.js"),s=require("../../alerts/AlertHelper.js"),n=require("../../button/Button.js"),r=require("../../checkBox/CheckBox.js"),l=require("../type.js");require("../../dropdown/DropdownPopover/index.js");var a=require("../../dropdown/Dropdown.js");require("../../dropdown/ChipDropdown.js"),require("react"),require("../../zeroState/ZeroState.js"),require("lodash/debounce");var d=require("../../TypographyStyle.js"),c=require("../../../constants/Theme.js");require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../icon-button/IconButton.js");var u=require("../../input/Input.js"),p=require("../../../assets/icons/cross.svg.js");require("../../dropdown/MenuItem/MenuItem.js");var T,C=require("../../radioButton/RadioButton.js"),E=require("../../../assets/icons/cubeIcon.svg.js"),D=require("../../../assets/icons/delete.svg.js"),O=require("../../../assets/icons/edit.svg.js"),S=require("../../../assets/icons/plus.svg.js"),P=require("../CouponExpiration/CouponExpiration.js"),I=require("../DiscountModal.styled.js"),x=require("./DynamicCoupon.styled.js"),v=require("./MinimumRequirementComponent.js"),_=require("./ZeroState.js");exports.DISCOUNT_PRODUCTS=void 0,(T=exports.DISCOUNT_PRODUCTS||(exports.DISCOUNT_PRODUCTS={})).ENTITLED="entitled",T.PREREQUISITE="prerequisite";exports.default=T=>{var j,b,g,m,y,U,h,R;const N=[{selected:T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER,label:"Entire Order",value:l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER},{selected:T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS}],V=[{selected:T.offerAppliesToBuy===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:T.offerAppliesToBuy===l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS}],A=[{selected:T.offerAppliesToGet===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:T.offerAppliesToGet===l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS}],L=(e,r,a)=>{var u,C,P,I,v,_,j,b,g,m,y,U;let h=[],R=[],N={},V={};T.useNewPicker?(N=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,V=null!==(u=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==u?u:[],(null==N?void 0:N.isCustom)&&delete N.isCustom,(null==V?void 0:V.isCustom)&&delete V.isCustom,Object.values(N).forEach((e=>{Object.keys(e.products).forEach((i=>{h.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(V).forEach((e=>{"isCustom"!==e&&R.push({id:e,name:V[e].name,image:V[e].image})}))):(h=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,R=null!==(C=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==C?C:[]);const A=[null===(P=T.dynamicDiscountValidationError)||void 0===P?void 0:P.inValidProductSelection,null===(I=T.dynamicDiscountValidationError)||void 0===I?void 0:I.inValidProductVariableSelection,null===(v=T.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidCollectionSelection],L=[null===(_=T.dynamicDiscountValidationError)||void 0===_?void 0:_.inValidBuyXCollectionSelection,null===(j=T.dynamicDiscountValidationError)||void 0===j?void 0:j.inValidBuyXProductSelection,null===(b=T.dynamicDiscountValidationError)||void 0===b?void 0:b.inValidBuyXProductVariableSelection],f=[null===(g=T.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidGetYCollectionSelection,null===(m=T.dynamicDiscountValidationError)||void 0===m?void 0:m.inValidGetYProductSelection,null===(y=T.dynamicDiscountValidationError)||void 0===y?void 0:y.inValidGetYProductVariableSelection];let F=!1;return"couponAppliesTo"===a&&(F=A.some(Boolean)),"buyX"===a&&(F=L.some(Boolean)),"getY"===a&&(F=f.some(Boolean)),i.jsxs(i.Fragment,{children:[i.jsxs("div",Object.assign({style:{display:"flex",gap:18}},{children:[e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS&&0===h.length&&(r===exports.DISCOUNT_PRODUCTS.ENTITLED&&!T.entitledProductVariable||r===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&!T.preRequisiteProductVariable)&&!(null==R?void 0:R.length)&&i.jsxs(x.AddProductButtonsContainer,{children:[i.jsx("div",Object.assign({style:{width:T.isProductVariableSupported?"284px":"300px",display:"flex"}},{children:i.jsx(n.Button,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:S.default,matchParentWidth:!0,onClick:()=>{T.setIsProductPickerOpen(r)},error:F})})),T.isProductVariableSupported&&T.productVariableList&&i.jsxs(i.Fragment,{children:[i.jsx(d.BodySecondary,Object.assign({color:c.DEFAULT_THEME.colorsV2.content.placeholder},{children:"OR"})),i.jsx(n.Button,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:S.default,matchParentWidth:!0,onClick:()=>{T.setIsProductVariablePickerOpen(r)},error:F})]})]}),e===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&0===R.length&&!(null==h?void 0:h.length)&&i.jsx("div",Object.assign({style:{width:"300px",display:"flex"}},{children:i.jsx(n.Button,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:S.default,matchParentWidth:!0,onClick:()=>{T.setIsCollectionPickerOpen(r)},style:{marginTop:"16px"},error:F})}))]})),F&&i.jsx("div",Object.assign({style:{margin:"8px 0 0"}},{children:i.jsx(o.Alert,{type:s.ALERT_TYPES.NEGATIVE,text:"Required Field",contentPosition:s.CONTENT_POSITION.START,icon:()=>i.jsx(t.default,{width:16,height:16,color:c.DEFAULT_THEME.colorsV2.content.negative})})})),h.length||R.length?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"8px 0"}},{children:e===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"})),i.jsxs(x.ProductCollectionCard,{children:[i.jsx(x.CubeIconContainer,{children:i.jsx(E.default,{width:20,height:20,color:c.DEFAULT_THEME.colorsV2.content.secondary})}),i.jsxs(d.TitleSmall,{children:[e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?h.length:R.length," ",e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i.jsxs("div",Object.assign({style:{display:"flex",gap:4}},{children:[i.jsx(x.IconContainer,Object.assign({onClick:()=>{e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?T.setIsProductPickerOpen(r):T.setIsCollectionPickerOpen(r)}},{children:i.jsx(O.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.placeholder})})),i.jsx(x.IconContainer,Object.assign({onClick:()=>{e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.setEntitledProducts([]):T.setPrerequisiteProducts([]):r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.setEntitledCollections([]):T.setPrerequisiteCollections([])}},{children:i.jsx(D.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.placeholder})}))]}))]})]}):r===exports.DISCOUNT_PRODUCTS.ENTITLED&&T.entitledProductVariable?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i.jsxs(x.ProductVariableCard,{children:[i.jsx(d.TitleSmall,{children:T.entitledProductVariable.displayName}),i.jsx("div",Object.assign({style:{display:"flex",gap:4}},{children:i.jsx(x.IconContainer,Object.assign({onClick:()=>{T.setEntitledProductVariable(void 0)}},{children:i.jsx(p.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.primary})}))}))]})]}):r===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(U=T.preRequisiteProductVariable)||void 0===U?void 0:U.displayName)?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i.jsxs(x.ProductVariableCard,{children:[i.jsx(d.TitleSmall,{children:T.preRequisiteProductVariable.displayName}),i.jsx("div",Object.assign({style:{display:"flex",gap:4}},{children:i.jsx(x.IconContainer,Object.assign({onClick:()=>{T.setPreRequisiteProductVariable(void 0)}},{children:i.jsx(p.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.primary})}))}))]})]}):i.jsx(i.Fragment,{children:" "})]})},f=(e,t)=>{var o,s,n,r,c,p,C,E,D,O;let S=[],P=[],I={},x={};T.useNewPicker?(I=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,x=null!==(o=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==o?o:[],(null==I?void 0:I.isCustom)&&delete I.isCustom,(null==x?void 0:x.isCustom)&&delete x.isCustom,Object.values(I).forEach((e=>{Object.keys(e.products).forEach((i=>{S.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(x).forEach((e=>{"isCustom"!==e&&P.push({id:e,name:x[e].name,image:x[e].image})}))):(S=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,P=null!==(s=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==s?s:[]);const v=e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?T.offerAppliesToBuy:T.offerAppliesToGet,_=e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?exports.DISCOUNT_PRODUCTS.PREREQUISITE:exports.DISCOUNT_PRODUCTS.ENTITLED,j=v===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS?l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS:l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS;return i.jsxs("div",{children:[i.jsx(d.TitleSmall,Object.assign({style:{marginBottom:16}},{children:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"Customer buys":"Customer gets"})),i.jsxs("div",Object.assign({style:{display:"flex"}},{children:[!t&&i.jsx("div",{children:i.jsxs("div",Object.assign({className:"input__rows"},{children:[i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:e===exports.DISCOUNT_PRODUCTS.ENTITLED?null!==(r=null===(n=T.discountData.entitledQuantity)||void 0===n?void 0:n.toString())&&void 0!==r?r:"":null!==(p=null===(c=T.discountData.prerequisiteQuantity)||void 0===c?void 0:c.toString())&&void 0!==p?p:"",type:"number",onChangeText:i=>{e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.setDiscountData(Object.assign(Object.assign({},T.discountData),{entitledQuantity:parseInt(i)})):T.setDiscountData(Object.assign(Object.assign({},T.discountData),{prerequisiteQuantity:parseInt(i)}))},labelText:"Quantity of products",placeholder:"Eg. 2",width:"300px",errorMessage:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(C=T.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidBuyXValue)||e===exports.DISCOUNT_PRODUCTS.ENTITLED&&(null===(E=T.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidGetYValue)?"Required Field":"",state:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(D=T.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidBuyXValue)||e===exports.DISCOUNT_PRODUCTS.ENTITLED&&(null===(O=T.dynamicDiscountValidationError)||void 0===O?void 0:O.inValidGetYValue)?"invalid":"none"})})),i.jsx("div",{className:"input__wrapper"})]}))}),i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{marginBottom:8}},{children:"Any items from"})),e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&i.jsx(a.Dropdown,{width:"244px",options:V,placement:"bottom-start",onSelect:e=>{var i,t,o;T.setOfferAppliesToBuy(e.value),T.setPrerequisiteProducts([]),T.setPrerequisiteCollections([]),T.setPreRequisiteProductVariable(void 0),T.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidBuyXCollectionSelection:!1,inValidBuyXProductSelection:!1,inValidBuyXProductVariableSelection:!1}))),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:null===(i=T.discountData.collectionsConf)||void 0===i?void 0:i.entitledCollections,prerequisiteCollections:{}},productsConf:{entitledProducts:null===(t=T.discountData.productsConf)||void 0===t?void 0:t.entitledProducts,prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:null===(o=T.discountData.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,prerequisiteProductVariable:{}}}))}}),e===exports.DISCOUNT_PRODUCTS.ENTITLED&&i.jsx(a.Dropdown,{width:"244px",options:A,placement:"bottom-start",onSelect:e=>{var i,t,o;T.setOfferAppliesToGet(e.value),T.setEntitledProducts([]),T.setEntitledCollections([]),T.setEntitledProductVariable(void 0),T.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidGetYCollectionSelection:!1,inValidGetYProductSelection:!1,inValidGetYProductVariableSelection:!1}))),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{entitledCollectionIds:[],entitledProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:null===(i=T.discountData.collectionsConf)||void 0===i?void 0:i.prerequisiteCollections},productsConf:{entitledProducts:{},prerequisiteProducts:null===(t=T.discountData.productsConf)||void 0===t?void 0:t.prerequisiteProducts},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:null===(o=T.discountData.productVariableConf)||void 0===o?void 0:o.prerequisiteProductVariable}}))}})]})]})),L(j,_,e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"buyX":"getY")]})};return i.jsxs(I.DynamicCouponContainer,Object.assign({style:T.noTopMargin?{marginTop:0}:{}},{children:[i.jsxs("div",{children:[i.jsxs("div",Object.assign({style:{display:"flex",gap:16}},{children:[i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:null!==(j=T.discountData.title)&&void 0!==j?j:"",onChangeText:e=>{var i;T.setDiscountData(Object.assign(Object.assign({},T.discountData),{title:null!==(i=null==e?void 0:e.trim())&&void 0!==i?i:""}))},maxCharLimit:30,labelText:"Discount Coupon Title",placeholder:`Eg. “Flat ${null!==(b=T.currency)&&void 0!==b?b:""} 15 Off”`,hintText:"Will be same for everyone. Can’t be changed later",width:"300px",isRequired:!0,errorMessage:(null===(g=T.dynamicDiscountValidationError)||void 0===g?void 0:g.invalidCouponTitle)?"Required Field":"",state:(null===(m=T.dynamicDiscountValidationError)||void 0===m?void 0:m.invalidCouponTitle)?"invalid":"none"})})),!T.hideProbability&&i.jsx(u.Input,{value:null!==(U=null===(y=T.discountData.probability)||void 0===y?void 0:y.toString())&&void 0!==U?U:"",type:"number",onChangeText:e=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability of getting coupon ",hintText:"Enter a decimal value between 0-1",placeholder:"Eg. 0.5",maxCharLimit:4,width:"300px",isRequired:!0,errorMessage:(null===(h=T.dynamicDiscountValidationError)||void 0===h?void 0:h.inValidProbability)?"Required Field":"",state:(null===(R=T.dynamicDiscountValidationError)||void 0===R?void 0:R.inValidProbability)?"invalid":"none"})]})),i.jsx("div",{style:{height:"1px",width:"100%",background:c.DEFAULT_THEME.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),T.allowStaticCoupon&&i.jsx((()=>i.jsxs("div",{children:[i.jsx(d.TitleRegular,{children:"Discount Details"}),i.jsx(x.DiscountOptionsContainer,{children:T.discountDetailsOptions.map((t=>{return i.jsxs(x.DiscountDetailsOption,Object.assign({selected:T.selectedDiscountDetails.id===t.id,onClick:()=>(i=>{if(T.selectedDiscountDetails.id!==i.id)if(T.resetValidationErrors(),T.setValidationErrorMessage(""),T.setDiscountCouponAppliesTo(l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),T.setSelectedDiscountDetails(i),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:void 0})),T.setPreRequisiteProductVariable(void 0),T.setEntitledProductVariable(void 0),["percentage","amount"].includes(i.value)){T.onChangeCouponType({label:"Amount off on order",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER});const t=Object.assign(Object.assign({},T.discountData),{valueType:"percentage"===i.value?l.DISCOUNT_VALUE_TYPES.PERCENTAGE:l.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,value:void 0,targetType:l.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:l.DISCOUNT_TARGET_SELECTION.ALL,entitledCollectionIds:[],entitledProductIds:[],prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:{}},productsConf:{entitledProducts:{},prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:{}}}),o=e.__rest(t,["entitledQuantity","prerequisiteQuantity"]);T.setDiscountData(o)}else T.onChangeCouponType({label:i.label,selected:!0,value:i.value})})(t)},{children:[t.icon((o=t.id,T.selectedDiscountDetails.id===o?c.DEFAULT_THEME.colorsV2.stroke.brand:c.DEFAULT_THEME.colorsV2.text.secondary)),t.label]}),t.id);var o}))})]})),{}),(T.selectedCouponType===l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER||T.selectedCouponType===l.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS)&&(()=>{var e,t,o,s,n,r;return i.jsxs(i.Fragment,{children:[i.jsx("div",Object.assign({className:"input__rows"},{children:i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:null!==(o=null===(t=null===(e=T.discountData)||void 0===e?void 0:e.value)||void 0===t?void 0:t.toString())&&void 0!==o?o:"",labelText:"Discount amount",type:"number",width:"300px",onChangeText:e=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:parseInt(e)}))},placeholder:"15",prefixText:T.discountData.valueType===l.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(s=T.currency)&&void 0!==s?s:"":void 0,suffixText:T.discountData.valueType===l.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0,errorMessage:(null===(n=T.dynamicDiscountValidationError)||void 0===n?void 0:n.inValidDiscountAmount)?"Required Field":"",state:(null===(r=T.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"invalid":"none"})}))})),i.jsx("div",Object.assign({style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`}},{children:i.jsxs("div",Object.assign({className:"input__wrapper"},{children:[i.jsx(d.TitleRegular,Object.assign({style:{marginBottom:10}},{children:"Applies to"})),i.jsx("div",Object.assign({style:{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto"}},{children:i.jsx(a.Dropdown,{width:"300px",options:N,placement:"bottom-start",onSelect:e=>{const i="value"in e&&e.value===l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER?{label:"Amount off on order",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER}:{label:"Amount off on products",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS};T.onChangeCouponType(i),T.setDiscountCouponAppliesTo(e.value),T.setEntitledProductVariable(void 0),T.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidProductVariableSelection:!1,inValidProductSelection:!1,inValidCollectionSelection:!1})))}})})),(T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS)&&L(T.discountCouponAppliesTo,exports.DISCOUNT_PRODUCTS.ENTITLED,"couponAppliesTo")]}))}))]})})(),T.selectedCouponType===l.DISCOUNT_TYPES.BUY_X_GET_Y&&(()=>{var e,t,o,s,n;return i.jsxs(I.DynamicCouponContainer,Object.assign({style:{border:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0}},{children:[f(exports.DISCOUNT_PRODUCTS.PREREQUISITE),i.jsx("div",{style:{width:"100%",height:"1px",backgroundColor:c.DEFAULT_THEME.colorsV2.stroke.primary,margin:"8px 0"}}),f(exports.DISCOUNT_PRODUCTS.ENTITLED),i.jsx(d.BodySecondary,Object.assign({style:{marginTop:"8px"}},{children:"At a discounted value"})),i.jsx("div",{children:i.jsx(C.RadioButton,{label:"Free",isActive:100===T.discountData.value,onValueChange:e=>{e?T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:100})):T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:void 0}))}})}),i.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[i.jsx(C.RadioButton,{label:"Percentage off",isActive:100!==T.discountData.value,onValueChange:()=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:void 0}))}}),100!==T.discountData.value&&i.jsx("div",Object.assign({style:{marginTop:8}},{children:i.jsx(u.Input,{value:null!==(o=null===(t=null===(e=T.discountData)||void 0===e?void 0:e.value)||void 0===t?void 0:t.toString())&&void 0!==o?o:"",onChangeText:e=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Eg. 50",suffixText:"%",width:"300px",errorMessage:(null===(s=T.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"Required Field":"",state:(null===(n=T.dynamicDiscountValidationError)||void 0===n?void 0:n.inValidDiscountAmount)?"invalid":"none"})}))]}))]}))})(),!T.selectedCouponType&&i.jsx(_.default,{}),T.allowStaticCoupon&&T.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y&&i.jsx("div",Object.assign({style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`}},{children:i.jsx(v.default,{selectedMinimumRequirement:T.selectedMinimumRequirement,setSelectedMinimumRequirement:T.setSelectedMinimumRequirement,discountData:T.discountData,setDiscountData:T.setDiscountData,currency:T.currency,dynamicDiscountValidationError:T.dynamicDiscountValidationError})})),T.selectedCouponType&&!T.hideExpiration&&i.jsxs("div",Object.assign({style:{padding:T.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:T.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y?`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`:"none"}},{children:[i.jsx(r.CheckBox,{label:"Add expiration",isDisabled:!!T.makeExpiryMandatory,isChecked:T.isAddExpirationChecked,onValueChange:e=>{T.setIsAddExpirationChecked(e),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{expireAfter:void 0,expireAt:void 0})),T.setSelectedExpiration(T.isUsageFromStatic?l.COUPON_EXPIRATION.FIXED_EXPIRATION:l.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)},boldOnChecked:!0,labelSize:"DEFAULT"}),i.jsx(d.BodySecondary,Object.assign({style:{color:c.DEFAULT_THEME.colorsV2.text.secondary,marginLeft:28}},{children:"Make coupon only valid till a certain time"})),T.isAddExpirationChecked&&i.jsx(P.CouponExpiration,{discountData:T.discountData,setDiscountData:T.setDiscountData,isAddExpirationChecked:T.isAddExpirationChecked,inValidCouponExpiry:T.dynamicDiscountValidationError.inValidCouponExpiry,selectedExpiration:T.selectedExpiration,setSelectedExpiration:T.setSelectedExpiration,hideExpirationOptions:T.isUsageFromStatic})]}))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("../../checkBox/CheckBox.js");require("../../dropdown/DropdownPopover/index.js");var i=require("../../dropdown/Dropdown.js");require("../../dropdown/ChipDropdown.js"),require("react"),require("../../zeroState/ZeroState.js");var t=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js");require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../button/Button.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../icon-button/IconButton.js");var r=require("../../input/Input.js");require("../../dropdown/MenuItem/MenuItem.js");var s=require("../type.js");exports.default=u=>{var d,a,m,c,l,E,M,p,R;const j=[{selected:u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT,label:"Minimum order value",value:s.MIN_PURCHASE_REQUIREMENT.AMOUNT},{selected:u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.QUANTITY,label:"Minimum number of items",value:s.MIN_PURCHASE_REQUIREMENT.QUANTITY}];return e.jsxs(e.Fragment,{children:[e.jsx(n.CheckBox,{label:"Minimum Purchase Requirements",isChecked:u.selectedMinimumRequirement!==s.MIN_PURCHASE_REQUIREMENT.NA,onValueChange:e=>{e?(u.setSelectedMinimumRequirement(s.MIN_PURCHASE_REQUIREMENT.AMOUNT),u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minQuantity:void 0,minAmount:void 0}))):(u.setSelectedMinimumRequirement(s.MIN_PURCHASE_REQUIREMENT.NA),u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minQuantity:void 0,minAmount:void 0})))},boldOnChecked:!0,labelSize:"DEFAULT"}),e.jsx(t.BodySecondary,Object.assign({style:{color:o.DEFAULT_THEME.colorsV2.text.secondary,marginLeft:28}},{children:"Enable coupon only after a minimum order value"})),u.selectedMinimumRequirement!==s.MIN_PURCHASE_REQUIREMENT.NA&&e.jsxs("div",Object.assign({style:{margin:"16px 0 0 28px"},className:"input__rows"},{children:[e.jsxs("div",Object.assign({className:"input__wrapper"},{children:[e.jsx(t.BodySecondary,Object.assign({style:{marginBottom:10}},{children:"Requirements"})),e.jsx(i.Dropdown,{options:j,placement:"bottom-start",onSelect:e=>{const n=e.value;u.setSelectedMinimumRequirement(n),u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minQuantity:void 0,minAmount:void 0}))},truncatedText:!1,width:"272px"})]})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(r.Input,{value:u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?null!==(a=null===(d=u.discountData.minAmount)||void 0===d?void 0:d.toString())&&void 0!==a?a:"":null!==(c=null===(m=u.discountData.minQuantity)||void 0===m?void 0:m.toString())&&void 0!==c?c:"",onChangeText:e=>{u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minAmount:parseInt(e)})):u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.QUANTITY&&u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minQuantity:parseInt(e)}))},labelText:u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?"Minimum amount":"Minimum no. of items",prefixText:u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?null!==(l=u.currency)&&void 0!==l?l:"":void 0,type:"number",placeholder:u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?"Eg. 5000":"Eg. 5",errorMessage:(null===(E=u.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidMinimumAmount)||(null===(M=u.dynamicDiscountValidationError)||void 0===M?void 0:M.inValidMinimumQuantity)?"Required Field":"",state:(null===(p=u.dynamicDiscountValidationError)||void 0===p?void 0:p.inValidMinimumAmount)||(null===(R=u.dynamicDiscountValidationError)||void 0===R?void 0:R.inValidMinimumQuantity)?"invalid":"none"})}))]}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("../../checkBox/CheckBox.js");require("../../dropdown/DropdownPopover/index.js");var i=require("../../dropdown/Dropdown.js");require("../../dropdown/ChipDropdown.js"),require("react"),require("../../zeroState/ZeroState.js"),require("lodash/debounce");var t=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js");require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../button/Button.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../icon-button/IconButton.js");var r=require("../../input/Input.js");require("../../dropdown/MenuItem/MenuItem.js");var s=require("../type.js");exports.default=u=>{var d,a,m,c,l,E,M,p,R;const j=[{selected:u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT,label:"Minimum order value",value:s.MIN_PURCHASE_REQUIREMENT.AMOUNT},{selected:u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.QUANTITY,label:"Minimum number of items",value:s.MIN_PURCHASE_REQUIREMENT.QUANTITY}];return e.jsxs(e.Fragment,{children:[e.jsx(n.CheckBox,{label:"Minimum Purchase Requirements",isChecked:u.selectedMinimumRequirement!==s.MIN_PURCHASE_REQUIREMENT.NA,onValueChange:e=>{e?(u.setSelectedMinimumRequirement(s.MIN_PURCHASE_REQUIREMENT.AMOUNT),u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minQuantity:void 0,minAmount:void 0}))):(u.setSelectedMinimumRequirement(s.MIN_PURCHASE_REQUIREMENT.NA),u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minQuantity:void 0,minAmount:void 0})))},boldOnChecked:!0,labelSize:"DEFAULT"}),e.jsx(t.BodySecondary,Object.assign({style:{color:o.DEFAULT_THEME.colorsV2.text.secondary,marginLeft:28}},{children:"Enable coupon only after a minimum order value"})),u.selectedMinimumRequirement!==s.MIN_PURCHASE_REQUIREMENT.NA&&e.jsxs("div",Object.assign({style:{margin:"16px 0 0 28px"},className:"input__rows"},{children:[e.jsxs("div",Object.assign({className:"input__wrapper"},{children:[e.jsx(t.BodySecondary,Object.assign({style:{marginBottom:10}},{children:"Requirements"})),e.jsx(i.Dropdown,{options:j,placement:"bottom-start",onSelect:e=>{const n=e.value;u.setSelectedMinimumRequirement(n),u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minQuantity:void 0,minAmount:void 0}))},truncatedText:!1,width:"272px"})]})),e.jsx("div",Object.assign({className:"input__wrapper"},{children:e.jsx(r.Input,{value:u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?null!==(a=null===(d=u.discountData.minAmount)||void 0===d?void 0:d.toString())&&void 0!==a?a:"":null!==(c=null===(m=u.discountData.minQuantity)||void 0===m?void 0:m.toString())&&void 0!==c?c:"",onChangeText:e=>{u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minAmount:parseInt(e)})):u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.QUANTITY&&u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minQuantity:parseInt(e)}))},labelText:u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?"Minimum amount":"Minimum no. of items",prefixText:u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?null!==(l=u.currency)&&void 0!==l?l:"":void 0,type:"number",placeholder:u.selectedMinimumRequirement===s.MIN_PURCHASE_REQUIREMENT.AMOUNT?"Eg. 5000":"Eg. 5",errorMessage:(null===(E=u.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidMinimumAmount)||(null===(M=u.dynamicDiscountValidationError)||void 0===M?void 0:M.inValidMinimumQuantity)?"Required Field":"",state:(null===(p=u.dynamicDiscountValidationError)||void 0===p?void 0:p.inValidMinimumAmount)||(null===(R=u.dynamicDiscountValidationError)||void 0===R?void 0:R.inValidMinimumQuantity)?"invalid":"none"})}))]}))]})};
@@ -17,6 +17,5 @@ export type DropdownProps = OpenDropdownProps & {
17
17
  showTrailingIconPlaceholder?: boolean;
18
18
  showLabelsOnMoreHover?: boolean;
19
19
  backgroundColor?: string;
20
- value?: string;
21
20
  };
22
21
  export declare const Dropdown: React.FC<DropdownProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),t=require("react"),o=require("../../constants/Theme.js"),l=require("../../assets/icons/chevronDown.svg.js"),r=require("../input/Input.js"),i=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),a=require("./DropdownPopover/index.js"),d=require("./OpenedDropdown/utils/iterationOnOptions.js");function c(){}const u=u=>{var p,h,v,x,f,{placeHolder:g,size:j,onSelect:b,defaultOptions:m,disabled:w,noErrorHint:O,placeHolderHeight:S,showPlaceholderWhenSelected:y=!1,inputStyle:I={},inputType:E="default",onDeleteChip:H,truncatedText:C,showLeadingIconInPlaceholder:D=!1,showTrailingIconPlaceholder:P=!1,showLabelsOnMoreHover:T=!1,value:q}=u,M=e.__rest(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value"]);const[W,L]=t.useState(!1),[_,z]=t.useState(!1),k=null!=j?j:"default",A=t.useRef(),[F,R]=t.useState(null!=m?m:[]),N=t.useRef(null),[U,V]=t.useState(null);t.useEffect((()=>{var e;const n=[];null===(e=null==M?void 0:M.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&n.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&n.push(e)})),R([...n])}),[M.options]),t.useEffect((()=>{m&&R([...m])}),[m]);const $=d.getSelectedOptionsAsText(F),B=y?g:null!==(p=null!=$?$:g)&&void 0!==p?p:"Select an option";t.useEffect((()=>{if(N.current){const e=N.current.scrollWidth;V(e+("x-small"===k?16:"small"===k?20:24)+2*("x-small"===k?16:12)+8+2)}}),[B,k]);const G=null!==(v=null!==(h=M.buttonWidth)&&void 0!==h?h:M.inputWidth)&&void 0!==v?v:"100%",J=U?`${U}px`:G;return n.jsxs(n.Fragment,{children:[n.jsx("span",Object.assign({ref:N,style:{position:"absolute",visibility:"hidden",whiteSpace:"nowrap",fontSize:"x-small"===k?"12px":"small"===k?"14px":"16px",fontFamily:"Inter"}},{children:B})),n.jsx(i.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:S||("x-small"===k?24:"small"===k?32:48),width:J,maxWidth:G,zIndex:1,cursor:"pointer",padding:"x-small"===k?"4px 8px":"6px 8px",backgroundColor:void 0!==q?"#C3E4C4":_?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"},I),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==q?"#00580E":"inherit"}}},{children:n.jsx("div",Object.assign({onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1)},{children:n.jsxs(a.DropdownPopover,Object.assign({"data-test":M["data-test"],ref:A,onSelect:function(e){Array.isArray(e)?R([...e]):R([e]),null==b||b(e)},disabled:w,onDropdownVisbilityChange:e=>L(e)},M,{children:["default"==E&&n.jsx(r.Input,{version:M.version,noErrorHint:O,state:w?"disabled":"none",value:void 0===q?B:q,errorMessage:M.error,variant:k,placeholder:null!=g?g:"Select an option",onChangeText:c,leftIcon:D&&(null===(x=F[0])||void 0===x?void 0:x.leadingIcon)?{icon:()=>{var e;return n.jsx(n.Fragment,{children:null===(e=F[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return n.jsxs("div",Object.assign({style:{display:"flex"}},{children:[P&&(null===(e=F[0])||void 0===e?void 0:e.trailingIcon),n.jsx(l.default,{style:{transform:W?"rotate(180deg)":"rotate(0deg)"},onClick:c,width:"x-small"===k?16:"small"===k?20:24,height:"x-small"===k?16:"small"===k?20:24,color:o.COLORS.content.primary})]}))}},truncateText:null==C||C}),"chip"==E&&n.jsx(s.default,{placeholder:null!=g?g:"Select options",chips:F,onDeleteChip:e=>{null==H||H(e)},errorMessage:M.error,isDropdownOpened:W,sizeToUse:k,containerStyle:{width:null!==(f=M.width)&&void 0!==f?f:"100%",cursor:"pointer"},showLabelsOnMoreHover:T})]}))}))}))]})};u.displayName="Dropdown",exports.Dropdown=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),o=require("../../constants/Theme.js"),l=require("../../assets/icons/chevronDown.svg.js"),r=require("../input/Input.js"),i=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),a=require("./DropdownPopover/index.js"),d=require("./OpenedDropdown/utils/iterationOnOptions.js");function u(){}const c=c=>{var p,h,v,g,x,{placeHolder:w,size:j,onSelect:f,defaultOptions:b,disabled:O,noErrorHint:I,placeHolderHeight:y,showPlaceholderWhenSelected:S=!1,inputStyle:m={},inputType:H="default",onDeleteChip:D,truncatedText:P,showLeadingIconInPlaceholder:T=!1,showTrailingIconPlaceholder:q=!1,showLabelsOnMoreHover:C=!1}=c,E=e.__rest(c,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover"]);const[L,M]=n.useState(!1),_=null!=j?j:"default",z=n.useRef(),[W,A]=n.useState(null!=b?b:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==E?void 0:E.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&t.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&t.push(e)})),A([...t])}),[E.options]),n.useEffect((()=>{b&&A([...b])}),[b]);const R=d.getSelectedOptionsAsText(W);return t.jsx(i.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:y||("x-small"===_?24:"small"===_?32:48),width:null!==(h=null!==(p=E.buttonWidth)&&void 0!==p?p:E.width)&&void 0!==h?h:"100%",zIndex:1,cursor:"pointer",padding:"x-small"===_?"4px 8px":"6px 8px"},m),input:{minHeight:"100%"}}},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":E["data-test"],ref:z,onSelect:function(e){Array.isArray(e)?A([...e]):A([e]),null==f||f(e)},disabled:O,onDropdownVisbilityChange:e=>M(e)},E,{children:["default"==H&&t.jsx(r.Input,{version:E.version,noErrorHint:I,state:O?"disabled":"none",value:S?w:null!=R?R:"",errorMessage:E.error,variant:_,placeholder:null!=w?w:"Select an option",width:null!==(v=E.width)&&void 0!==v?v:"100%",onChangeText:u,leftIcon:T&&(null===(g=W[0])||void 0===g?void 0:g.leadingIcon)?{icon:()=>{var e;return t.jsx(t.Fragment,{children:null===(e=W[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return t.jsxs("div",Object.assign({style:{display:"flex"}},{children:[q&&(null===(e=W[0])||void 0===e?void 0:e.trailingIcon),t.jsx(l.default,{style:{transform:L?"rotate(180deg)":"rotate(0deg)"},onClick:u,width:"x-small"===_?16:"small"===_?20:24,height:"x-small"===_?16:"small"===_?20:24,color:o.COLORS.content.primary})]}))}},truncateText:null==P||P}),"chip"==H&&t.jsx(s.default,{placeholder:null!=w?w:"Select options",chips:W,onDeleteChip:e=>{null==D||D(e)},errorMessage:E.error,isDropdownOpened:L,sizeToUse:_,containerStyle:{width:null!==(x=E.width)&&void 0!==x?x:"100%",cursor:"pointer"},showLabelsOnMoreHover:C})]}))}))};c.displayName="Dropdown",exports.Dropdown=c;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),o=require("react/jsx-runtime"),t=require("react"),n=require("react-popper"),r=require("../../dropShadow/DropShadow.js"),l=require("../../tooltips/Tooltip.js"),i=require("../Common.styled.js"),s=require("../OpenedDropdown/components/OpennedDropdown.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=a(t).default.forwardRef(((a,d)=>{var{children:p,onDropdownVisbilityChange:c,version:u="1.0",tooltipContent:v,tooltipDirection:j,showTooltipArrow:w,isChildLoading:b,forceOpen:g}=a,h=e.__rest(a,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow","isChildLoading","forceOpen"]);const f=d,[O,D]=t.useState(!1),[x,y]=t.useState(null),[S,C]=t.useState(null),m=t.useRef(null),{styles:q,attributes:E}=n.usePopper(x,S,{placement:h.placement,strategy:h.strategy}),R=e=>{var o,t;"2.0"===u&&h.isMultiSelect&&e&&(null===(o=h.onSelect)||void 0===o||o.call(h,[...e])),D(!1),null===(t=null==h?void 0:h.onClose)||void 0===t||t.call(h)};t.useImperativeHandle(f,(()=>({openDropdown:O})),[]),t.useEffect((()=>{(null==f?void 0:f.current)&&(f.current.openDropdown=O)}),[O]),t.useEffect((()=>{null==c||c(O)}),[O]);const _=()=>{var e;return o.jsxs(o.Fragment,{children:[o.jsxs("div",Object.assign({style:{position:"relative"},ref:y},{children:[o.jsx(i.OverLapAbs,Object.assign({ref:m,allowEvents:h.allowEvents,disabled:h.disabled,onClick:e=>{var o;null===(o=h.onDropdownOpen)||void 0===o||o.call(h),O?(D(!1),e.preventDefault()):h.disabled||D(!0)},isChildLoading:b},{children:h.allowEvents?p:null})),h.allowEvents?null:p]})),(O||g)&&o.jsx(i.OpenDropdownContainer,Object.assign({ref:C,style:Object.assign(Object.assign({},q.popper),{zIndex:null!==(e=h.dropdownZIndex)&&void 0!==e?e:3})},E.popper,{"data-test":h["data-test"]},{children:o.jsx(r.DropShadow,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:o.jsx(s.OpenedDropdown,Object.assign({},h,{onSelect:e=>{var o;"2.0"===u&&h.isMultiSelect||(null===(o=h.onSelect)||void 0===o||o.call(h,e),D(!1))},onClose:R,version:u,headerRef:m,zeroState:null==h?void 0:h.zeroState,isDraggable:h.isDraggable,onOptionsReorder:h.onOptionsReorder}))}))}))]})};return o.jsx(o.Fragment,{children:O||g||void 0===v?_():o.jsx(l.Tooltip,Object.assign({body:v,placement:j,hideArrow:!w},{children:o.jsx("div",Object.assign({"data-test":h["data-test"]},{children:_()}))}))})}));d.displayName="DropdownPopover",exports.DropdownPopover=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),o=require("react/jsx-runtime"),t=require("react"),n=require("react-popper"),r=require("../../dropShadow/DropShadow.js"),l=require("../../tooltips/Tooltip.js"),i=require("../Common.styled.js"),s=require("../OpenedDropdown/components/OpennedDropdown.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=a(t).default.forwardRef(((a,d)=>{var{children:p,onDropdownVisbilityChange:c,version:u="1.0",tooltipContent:v,tooltipDirection:j,showTooltipArrow:w,isChildLoading:h,forceOpen:b}=a,f=e.__rest(a,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow","isChildLoading","forceOpen"]);const g=d,[O,D]=t.useState(!1),[x,y]=t.useState(null),[S,C]=t.useState(null),m=t.useRef(null),{styles:q,attributes:E}=n.usePopper(x,S,{placement:f.placement,strategy:f.strategy}),_=e=>{var o,t;"2.0"===u&&f.isMultiSelect&&e&&(null===(o=f.onSelect)||void 0===o||o.call(f,[...e])),D(!1),null===(t=null==f?void 0:f.onClose)||void 0===t||t.call(f)};t.useImperativeHandle(g,(()=>({openDropdown:O})),[]),t.useEffect((()=>{(null==g?void 0:g.current)&&(g.current.openDropdown=O)}),[O]),t.useEffect((()=>{null==c||c(O)}),[O]);const z=()=>o.jsxs(o.Fragment,{children:[o.jsxs("div",Object.assign({style:{position:"relative"},ref:y},{children:[o.jsx(i.OverLapAbs,Object.assign({ref:m,allowEvents:f.allowEvents,disabled:f.disabled,onClick:e=>{var o;null===(o=f.onDropdownOpen)||void 0===o||o.call(f),O?(D(!1),e.preventDefault()):f.disabled||D(!0)},isChildLoading:h},{children:f.allowEvents?p:null})),f.allowEvents?null:p]})),(O||b)&&o.jsx(i.OpenDropdownContainer,Object.assign({ref:C,style:Object.assign(Object.assign({},q.popper),{zIndex:3})},E.popper,{"data-test":f["data-test"]},{children:o.jsx(r.DropShadow,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:o.jsx(s.OpenedDropdown,Object.assign({},f,{onSelect:e=>{var o;"2.0"===u&&f.isMultiSelect||(null===(o=f.onSelect)||void 0===o||o.call(f,e),D(!1))},onClose:_,version:u,headerRef:m,zeroState:null==f?void 0:f.zeroState}))}))}))]});return o.jsx(o.Fragment,{children:O||b||void 0===v?z():o.jsx(l.Tooltip,Object.assign({body:v,placement:j,hideArrow:!w},{children:o.jsx("div",Object.assign({"data-test":f["data-test"]},{children:z()}))}))})}));d.displayName="DropdownPopover",exports.DropdownPopover=d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),s=require("../../../../hooks/useOutside.js"),r=require("../../hooks/useDropdown.js"),o=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),c=require("./multiSelect/MultiSelectDropdownBottomBar.js"),a=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const f=304,h=290;exports.OpenedDropdown=b=>{let{options:S,isSearchable:g,isMultiSelect:j,maxSelections:v,width:x,allowFreeForm:O,height:m,onClose:w,onSelect:y,onSearch:C,version:D,skipSorting:k,headerRef:q,hideSelectAll:M,primaryButtonText:E,onInfiniteScroll:L,onMultiSelectClear:R,onDropdownItemClick:A,buttonOptions:I,isSearchLoading:F,disableSearchOptions:T,disableSearchedOptionExcept:B,useDefaultCursor:H,containerStyle:Z={},zeroState:z,isDraggable:P=!1,onOptionsReorder:V,hideClearButton:W=!1}=b;const $=t.useCallback((e=>{if(!P||!j)return e;const t=[],n=[];return e.forEach((e=>{if(e.options)n.push(e);else{e.selected?t.push(e):n.push(e)}})),[...t,...n]}),[P,j]),[_,K]=t.useState((()=>$(S))),N=t.useRef(_),U=t.useRef(!1),G=t.useRef(V);t.useEffect((()=>{K($(S))}),[S,$]),t.useEffect((()=>{N.current=_}),[_]),t.useEffect((()=>{G.current=V}),[V]),t.useEffect((()=>()=>{U.current&&G.current&&G.current(N.current)}),[]);const J=t.useCallback((e=>{const t=$(e);K(t),"2.0"===D?null==V||V(t):U.current=!0}),[V,$,D]),Q=P?_:S,{dropdownOptions:X,search:Y,searchedString:ee,searchedOptions:te,onApplyHandler:ne,selectAllHandler:se,onMultiSelectClear:re,onFreeFormSelect:oe,onMultiSelectApply:ie,latestDropdownOptionsRef:le,getSelectedOptions:ue,getCurrentSelectionCount:ce}=r.useDropdown(D,Q,y,k||P,j,C,T,B,v),[ae,de]=t.useState(null!=x?x:h),[pe,fe]=t.useState(null),[he,be]=t.useState(-1),Se=t.useRef(null),ge=t.useRef([]),je=t.useRef(null);s.useOutside(Se,(()=>{if(fe(null),j&&"2.0"===D){const e=ue(le.current);null==w||w(e)}else null==w||w(X)}),[q,ge]),t.useEffect((()=>{const e=setTimeout((()=>{Se.current&&Se.current.focus({preventScroll:!0})}),0);return()=>clearTimeout(e)}),[]);t.useEffect((()=>{const e=e=>{const t=(e=>{const t=[];return e.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||t.push(e)}));else{const n=e;n.disabled||t.push(n)}})),t})(ee&&C?te:X);if(0!==t.length)if("ArrowDown"===e.key)e.preventDefault(),be((e=>{const n=e<t.length-1?e+1:0;return setTimeout((()=>{var e;const t=null===(e=je.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${n}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),n}));else if("ArrowUp"===e.key)e.preventDefault(),be((e=>{const n=e>0?e-1:t.length-1;return setTimeout((()=>{var e;const t=null===(e=je.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${n}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),n}));else if("Enter"===e.key&&he>=0){e.preventDefault();const n=t[he];n&&(ne(Object.assign(Object.assign({},n),{selected:!n.selected})),A&&A(n))}},t=Se.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[he,ee,te,X,C,ne,A]);const ve=null!=m?m:f,xe="number"==typeof ve?g&&j?ve-96:g&&!j||!g&&j?ve-48:ve:ve;t.useEffect((()=>{const e=null!=x?x:h;if(null===pe)de(e);else if("number"==typeof e)de(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));de(t)}}),[pe]);const Oe=[],me=(e=>{if(!j||!v&&0!==v)return e;const t=ce(e)>=v;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const n=e;return Object.assign(Object.assign({},n),{disabled:n.disabled||!n.selected&&t})}})):e})((ee&&C?te:X).map((e=>{var t,n;if(ee&&!C){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(ee.toLowerCase()))&&(Oe.push(!ee||e.label===ee),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(ee.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(ee.toLowerCase()))?(Oe.push(!ee||e.label===ee),e):null}return e})).filter((e=>null!==e))),we=!!g&&ee&&0===me.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({version:D,ref:Se,tabIndex:-1,style:Object.assign(Object.assign({width:ae},Z),{outline:"none"})},{children:[e.jsxs("div",Object.assign({style:{width:pe?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!g&&e.jsx(d.SearchBox,{onSearch:Y,version:D}),me.length||ee?e.jsxs(a.MenuListContainer,Object.assign({minHeight:ve,maxHeight:xe,ref:je},{children:[!!j&&!we&&!M&&e.jsx(u.SelectAllMenu,{version:D,options:ee&&C?te:X,onSelect:se}),!O&&we&&e.jsx(p.SearchZeroState,{isLoading:F,height:xe,searchedString:ee,containerWidth:x}),O&&(we||!!Oe.length&&Oe.every((e=>!1===e)))&&e.jsx(i.FreeFormMenu,{version:D,isMultiSelect:j,onSelect:oe,searchedString:ee}),e.jsx(l.MenuList,{onInfiniteScroll:L,onDropdownItemClick:A,version:D,onSelect:ne,showDescription:function(e,t){fe(e&&t?{title:e,description:t}:null)},isMultiSelect:j,options:me,useDefaultCursor:H,ref:ge,focusedIndex:he,isDraggable:P,onOptionsReorder:J})]})):e.jsx("div",Object.assign({style:{height:ve,display:"flex"}},{children:e.jsx(n.ZeroState,Object.assign({},z,{title:(null==z?void 0:z.title)||"No results found",subTitle:(null==z?void 0:z.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!j&&!(!me.length&&!ee)&&"2.0"!==D&&e.jsx(c.default,{onClear:()=>{re(),null==R||R()},onApply:ie,list:ee&&C?te:X,buttonText:E,buttonOptions:I,hideClearButton:W})]})),!!pe&&e.jsx(o.Description,{title:pe.title,description:pe.description,version:D})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),s=require("../../../../hooks/useOutside.js"),o=require("../../hooks/useDropdown.js"),r=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),c=require("./multiSelect/MultiSelectDropdownBottomBar.js"),a=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,f=290;exports.OpenedDropdown=S=>{let{options:b,isSearchable:j,isMultiSelect:g,maxSelections:v,width:x,allowFreeForm:O,height:m,onClose:w,onSelect:y,onSearch:D,version:C,skipSorting:q,headerRef:M,hideSelectAll:k,primaryButtonText:L,onInfiniteScroll:A,onMultiSelectClear:E,onDropdownItemClick:I,buttonOptions:F,isSearchLoading:T,disableSearchOptions:B,disableSearchedOptionExcept:R,useDefaultCursor:H,containerStyle:Z={},zeroState:z}=S;const{dropdownOptions:P,search:V,searchedString:W,searchedOptions:$,onApplyHandler:_,selectAllHandler:K,onMultiSelectClear:N,onFreeFormSelect:U,onMultiSelectApply:G,latestDropdownOptionsRef:J,getSelectedOptions:Q,getCurrentSelectionCount:X}=o.useDropdown(C,b,y,q,g,D,B,R,v),[Y,ee]=t.useState(null!=x?x:f),[te,ne]=t.useState(null),[se,oe]=t.useState(-1),re=t.useRef(null),ie=t.useRef([]),le=t.useRef(null);s.useOutside(re,(()=>{if(ne(null),g&&"2.0"===C){const e=Q(J.current);null==w||w(e)}else null==w||w(P)}),[M,ie]),t.useEffect((()=>{const e=setTimeout((()=>{re.current&&re.current.focus({preventScroll:!0})}),0);return()=>clearTimeout(e)}),[]);t.useEffect((()=>{const e=e=>{const t=(e=>{const t=[];return e.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||t.push(e)}));else{const n=e;n.disabled||t.push(n)}})),t})(W&&D?$:P);if(0!==t.length)if("ArrowDown"===e.key)e.preventDefault(),oe((e=>{const n=e<t.length-1?e+1:0;return setTimeout((()=>{var e;const t=null===(e=le.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${n}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),n}));else if("ArrowUp"===e.key)e.preventDefault(),oe((e=>{const n=e>0?e-1:t.length-1;return setTimeout((()=>{var e;const t=null===(e=le.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${n}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),n}));else if("Enter"===e.key&&se>=0){e.preventDefault();const n=t[se];n&&(_(Object.assign(Object.assign({},n),{selected:!n.selected})),I&&I(n))}},t=re.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[se,W,$,P,D,_,I]);const ue=null!=m?m:h,ce="number"==typeof ue?j&&g?ue-96:j&&!g||!j&&g?ue-48:ue:ue;t.useEffect((()=>{const e=null!=x?x:f;if(null===te)ee(e);else if("number"==typeof e)ee(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));ee(t)}}),[te]);const ae=[],de=(e=>{if(!g||!v&&0!==v)return e;const t=X(e)>=v;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const n=e;return Object.assign(Object.assign({},n),{disabled:n.disabled||!n.selected&&t})}})):e})((W&&D?$:P).map((e=>{var t,n;if(W&&!D){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(W.toLowerCase()))&&(ae.push(!W||e.label===W),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(W.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(W.toLowerCase()))?(ae.push(!W||e.label===W),e):null}return e})).filter((e=>null!==e))),pe=!!j&&W&&0===de.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({version:C,ref:re,tabIndex:-1,style:Object.assign(Object.assign({width:Y},Z),{outline:"none"})},{children:[e.jsxs("div",Object.assign({style:{width:te?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!j&&e.jsx(d.SearchBox,{onSearch:V,version:C}),de.length||W?e.jsxs(a.MenuListContainer,Object.assign({minHeight:ue,maxHeight:ce,ref:le},{children:[!!g&&!pe&&!k&&e.jsx(u.SelectAllMenu,{version:C,options:W&&D?$:P,onSelect:K}),!O&&pe&&e.jsx(p.SearchZeroState,{isLoading:T,height:ce,searchedString:W,containerWidth:x}),O&&(pe||!!ae.length&&ae.every((e=>!1===e)))&&e.jsx(i.FreeFormMenu,{version:C,isMultiSelect:g,onSelect:U,searchedString:W}),e.jsx(l.MenuList,{onInfiniteScroll:A,onDropdownItemClick:I,version:C,onSelect:_,showDescription:function(e,t){ne(e&&t?{title:e,description:t}:null)},isMultiSelect:g,options:de,useDefaultCursor:H,ref:ie,focusedIndex:se})]})):e.jsx("div",Object.assign({style:{height:ue,display:"flex"}},{children:e.jsx(n.ZeroState,Object.assign({},z,{title:(null==z?void 0:z.title)||"No results found",subTitle:(null==z?void 0:z.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!g&&!(!de.length&&!W)&&"2.0"!==C&&e.jsx(c.default,{onClear:()=>{N(),null==E||E()},onApply:G,list:W&&D?$:P,buttonText:L,buttonOptions:F})]})),!!te&&e.jsx(r.Description,{title:te.title,description:te.description,version:C})]}))};
@@ -11,12 +11,6 @@ interface MenuItemProps {
11
11
  useDefaultCursor?: boolean;
12
12
  isFocused?: boolean;
13
13
  dataIndex?: number;
14
- isDraggable?: boolean;
15
- onDragStart?: (e: React.DragEvent<HTMLDivElement>) => void;
16
- onDragOver?: (e: React.DragEvent<HTMLDivElement>) => void;
17
- onDrop?: (e: React.DragEvent<HTMLDivElement>) => void;
18
- onDragEnd?: (e: React.DragEvent<HTMLDivElement>) => void;
19
- isDraggedOver?: boolean;
20
14
  }
21
15
  export declare const MenuItem: import("react").ForwardRefExoticComponent<MenuItemProps & import("react").RefAttributes<HTMLDivElement>>;
22
16
  export {};
@@ -1,43 +1,13 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../../assets/icons/chevronRight.svg.js"),n=require("react"),r=require("styled-components"),i=require("../../../../checkBox/CheckBox.js"),o=require("../../../../list-item/ListItem.js"),s=require("../../../../tooltips/Tooltip.js"),a=require("../../../../TypographyStyle.js"),l=require("../../../../../constants/Theme.js"),d=require("./FreeFormMenu.styled.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(r);const g=u.default(o.ListItem)`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../../assets/icons/chevronRight.svg.js"),n=require("react"),i=require("styled-components"),r=require("../../../../checkBox/CheckBox.js"),s=require("../../../../list-item/ListItem.js"),o=require("../../../../tooltips/Tooltip.js"),l=require("../../../../TypographyStyle.js"),a=require("../../../../../constants/Theme.js"),d=require("./FreeFormMenu.styled.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(i);const p=u.default(s.ListItem)`
2
2
  padding: ${e=>"2.0"===e.version?"8px 12px":"14px 16px"} !important;
3
3
  cursor: pointer;
4
4
  margin-top: ${e=>"2.0"===e.version?"2px":"0"};
5
- `,p=u.default.div`
5
+ `,x=u.default.div`
6
6
  box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.12);
7
7
  border-radius: ${e=>{let{version:t}=e;return"1.0"===t?"0":"8px"}};
8
8
  padding: ${e=>{let{version:t}=e;return"1.0"===t?"0":"4px"}};
9
9
  min-width: 148px;
10
- border: ${e=>{let{version:t}=e;return"1.0"===t?`1px solid ${l.DEFAULT_THEME.colorsV2.stroke.primary}`:"none"}};
10
+ border: ${e=>{let{version:t}=e;return"1.0"===t?`1px solid ${a.DEFAULT_THEME.colorsV2.stroke.primary}`:"none"}};
11
11
  max-height: 248px;
12
12
  overflow-y: auto;
13
- `,x=u.default.div`
14
- display: grid;
15
- grid-template-columns: repeat(2, 2.86px);
16
- grid-template-rows: repeat(3, 2.86px);
17
- column-gap: 3.8px;
18
- row-gap: 4px;
19
- margin-right: 8px;
20
- cursor: move;
21
- flex-shrink: 0;
22
- align-self: center;
23
- height: fit-content;
24
- min-height: 18px;
25
- `,v=u.default.div`
26
- width: 2.86px;
27
- height: 2.86px;
28
- border-radius: 50%;
29
- background-color: ${l.COLORS.content.inactive};
30
- flex-shrink: 0;
31
- `,j=u.default.div`
32
- display: flex;
33
- align-content: center;
34
- justify-content: center;
35
- gap: 8px;
36
- `,h=u.default.div`
37
- margin-right: -4px;
38
- `,b=u.default.div`
39
- display: flex;
40
- align-items: center;
41
- flex-direction: column;
42
- flex: 1;
43
- `,m=t=>{let{onDragStart:n,onDragEnd:r}=t;return e.jsxs(x,Object.assign({draggable:!0,onDragStart:n,onDragEnd:r},{children:[e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{})]}))},f=n.forwardRef(((r,o)=>{let{option:c,isMultiSelect:u,showDescription:x,onSelect:v,last:f,version:O,onDropdownItemClick:D,useDefaultCursor:y,isFocused:C=!1,dataIndex:I=-1,isDraggable:F=!1,onDragStart:T,onDragOver:S,onDrop:E,onDragEnd:k,isDraggedOver:w=!1}=r;var L;const[q,M]=n.useState(c.selected),$=(e,t)=>{if(!e.children){B(!e.selected);const n=t?Object.assign(Object.assign({},e),{parent:t}):e;null==D||D(n)}},B=e=>{c.disabled||v(Object.assign(Object.assign({},c),{selected:e}))},R=y?{cursor:"default"}:{};return e.jsx(e.Fragment,{children:e.jsx(s.Tooltip,Object.assign({body:"",tooltipContent:c.children?e.jsx("div",Object.assign({style:{backgroundColor:l.DEFAULT_THEME.colorsV2.surface.standard},ref:o,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1)},{children:e.jsx(p,Object.assign({version:null!=O?O:"2.0"},{children:c.children.map((t=>{var n;return e.jsx(g,{version:O,style:"1.0"!==O&&(null!==(n=null==c?void 0:c.children)&&void 0!==n?n:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),$(t,c)},listItem:{value:t.value,label:t.label},subText:t.subText,leadingIcon:t.leadingIcon||void 0,customComponent:t.customComponent,trailingIcon:t.trailingIcon||void 0,variant:c.disabled?"inactive":t.selected?"selected":"default"},t.value)}))}))})):e.jsx(e.Fragment,{}),placement:"right-start",hideArrow:!0},{children:e.jsx(g,{version:O,style:f?Object.assign(Object.assign({borderBottom:0},R),w?{borderTop:`2px solid ${l.COLORS.content.brand}`,opacity:.5}:{}):Object.assign(Object.assign({},R),w?{borderTop:`2px solid ${l.COLORS.content.brand}`,opacity:.5}:{}),onClick:e=>{e.preventDefault(),$(c)},onMouseOver:()=>{c.description?x(c.label,c.description):x()},listItem:{value:c.value,label:c.label},subText:c.subText,"data-option-index":I,role:"option",id:`dropdown-option-${I}`,"aria-selected":!!c.selected,onDragOver:F?S:void 0,onDrop:F?E:void 0,leadingIcon:u?e.jsxs(j,{children:[F&&e.jsx(m,{onDragStart:T,onDragEnd:k}),e.jsx(i.CheckBox,{size:"2.0"===O?"SMALL":"DEFAULT",isDisabled:null!==(L=c.disabled)&&void 0!==L&&L,isChecked:!!c.selected,onValueChange:B}),e.jsx(h,{children:c.leadingIcon})]}):F?e.jsxs(b,{children:[e.jsx(m,{onDragStart:T,onDragEnd:k}),c.leadingIcon&&e.jsx("div",{children:c.leadingIcon})]}):c.leadingIcon?e.jsx(e.Fragment,{children:c.leadingIcon}):void 0,customComponent:c.customComponent,trailingIcon:c.isFreeForm?e.jsx(d.FreeFormContainer,{children:e.jsx(a.BodyCaption,Object.assign({style:{color:l.COLORS.content.secondary}},{children:"Freeform"}))}):c.children?e.jsx(t.default,{width:12,height:12}):c.trailingIcon?e.jsx(e.Fragment,{children:c.trailingIcon}):void 0,variant:c.disabled?"inactive":C||c.selected||!u&&q?"selected":"default"})}))})}));exports.MenuItem=f;
13
+ `,g=n.forwardRef(((i,s)=>{let{option:c,isMultiSelect:u,showDescription:g,onSelect:v,last:j,version:b,onDropdownItemClick:h,useDefaultCursor:m,isFocused:f=!1,dataIndex:y=-1}=i;var C;const[I,O]=n.useState(c.selected),F=(e,t)=>{if(!e.children){T(!e.selected);const n=t?Object.assign(Object.assign({},e),{parent:t}):e;null==h||h(n)}},T=e=>{c.disabled||v(Object.assign(Object.assign({},c),{selected:e}))},q=m?{cursor:"default"}:{};return e.jsx(e.Fragment,{children:e.jsx(o.Tooltip,Object.assign({body:"",tooltipContent:c.children?e.jsx("div",Object.assign({style:{backgroundColor:a.DEFAULT_THEME.colorsV2.surface.standard},ref:s,onMouseEnter:()=>O(!0),onMouseLeave:()=>O(!1)},{children:e.jsx(x,Object.assign({version:null!=b?b:"2.0"},{children:c.children.map((t=>{var n;return e.jsx(p,{version:b,style:"1.0"!==b&&(null!==(n=null==c?void 0:c.children)&&void 0!==n?n:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),F(t,c)},listItem:{value:t.value,label:t.label},subText:t.subText,leadingIcon:t.leadingIcon||void 0,customComponent:t.customComponent,trailingIcon:t.trailingIcon||void 0,variant:c.disabled?"inactive":t.selected?"selected":"default"},t.value)}))}))})):e.jsx(e.Fragment,{}),placement:"right-start",hideArrow:!0},{children:e.jsx(p,{version:b,style:j?Object.assign({borderBottom:0},q):Object.assign({},q),onClick:e=>{e.preventDefault(),F(c)},onMouseOver:()=>{c.description?g(c.label,c.description):g()},listItem:{value:c.value,label:c.label},subText:c.subText,"data-option-index":y,role:"option",id:`dropdown-option-${y}`,"aria-selected":!!c.selected,leadingIcon:u?e.jsxs("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e.jsx(r.CheckBox,{size:"2.0"===b?"SMALL":"DEFAULT",isDisabled:null!==(C=c.disabled)&&void 0!==C&&C,isChecked:!!c.selected,onValueChange:T}),e.jsx("div",Object.assign({style:{marginRight:"-4px"}},{children:c.leadingIcon}))]})):c.leadingIcon?e.jsx(e.Fragment,{children:c.leadingIcon}):void 0,customComponent:c.customComponent,trailingIcon:c.isFreeForm?e.jsx(d.FreeFormContainer,{children:e.jsx(l.BodyCaption,Object.assign({style:{color:a.COLORS.content.secondary}},{children:"Freeform"}))}):c.children?e.jsx(t.default,{width:12,height:12}):c.trailingIcon?e.jsx(e.Fragment,{children:c.trailingIcon}):void 0,variant:c.disabled?"inactive":f||c.selected||!u&&I?"selected":"default"})}))})}));exports.MenuItem=g;
@@ -10,8 +10,6 @@ interface MenuListProps {
10
10
  onDropdownItemClick?: (option: DropdownOption) => void;
11
11
  useDefaultCursor?: boolean;
12
12
  focusedIndex?: number;
13
- isDraggable?: boolean;
14
- onOptionsReorder?: (reorderedOptions: DropdownOption[]) => void;
15
13
  }
16
14
  export declare const MenuList: import("react").ForwardRefExoticComponent<MenuListProps & import("react").RefAttributes<HTMLDivElement[]>>;
17
15
  export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("./MenuItem.js"),s=require("./MenuList.styled.js");const r=n.forwardRef(((r,l)=>{let{options:o,isMultiSelect:i,showDescription:c,onSelect:u,version:a,onInfiniteScroll:d,onDropdownItemClick:p,useDefaultCursor:f,focusedIndex:g=-1,isDraggable:b=!1,onOptionsReorder:D}=r;const j=n.useRef(null),v=n.useRef(null),[x,m]=n.useState(null),[I,h]=n.useState(null),C=n.useCallback((()=>{j.current&&j.current.disconnect(),j.current=new IntersectionObserver((e=>{e[0].isIntersecting&&(null==d||d())})),v.current&&j.current.observe(v.current)}),[d]);n.useEffect((()=>(C(),()=>{j.current&&j.current.disconnect()})),[C,o]);const S=n.useCallback((e=>n=>{b&&(m(e),n.dataTransfer.effectAllowed="move")}),[b]),w=n.useCallback((e=>n=>{b&&(n.preventDefault(),n.dataTransfer.dropEffect="move",h(e))}),[b]),M=n.useCallback((e=>n=>{if(b&&null!==x){if(n.preventDefault(),x!==e){const n=[...o],t=n[x],s=n[e];if(t.selected===s.selected){const[t]=n.splice(x,1);n.splice(e,0,t),null==D||D(n)}}m(null),h(null)}}),[b,x,o,D]),k=n.useCallback((()=>{m(null),h(null)}),[]),O=new Map;let y=-1;return o.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||(y++,O.set(e,y))}));else{const n=e;n.disabled||(y++,O.set(n,y))}})),e.jsx(e.Fragment,{children:o.map(((n,r)=>{const d=r===o.length-1;if(n.options){const o=n;return e.jsxs("div",Object.assign({style:{marginTop:"2.0"===a?2:0}},{children:[e.jsxs(s.StyledGroupedLabel,Object.assign({version:a},{children:[o.leadingIcon?e.jsx("span",Object.assign({style:{marginRight:8}},{children:o.leadingIcon})):null,o.label]})),o.options.map(((n,s)=>{const d=O.get(n),b=d===g&&!n.disabled;return e.jsx(t.MenuItem,{version:a,last:s===o.options.length-1,onSelect:u,showDescription:c,onDropdownItemClick:p,isMultiSelect:i,option:n,useDefaultCursor:f,isFocused:b,dataIndex:d,isDraggable:!1,ref:e=>{l&&"object"==typeof l&&l.current&&e&&e&&e&&e&&(l.current[r]=e)}},`${r}-${s}`)})),d?e.jsx("span",{ref:v}):null]}),r)}const D=n,j=O.get(D),x=j===g&&!D.disabled;return e.jsxs("div",{children:[e.jsx(t.MenuItem,{version:a,last:d,onSelect:u,showDescription:c,onDropdownItemClick:p,isMultiSelect:i,option:D,useDefaultCursor:f,isFocused:x,dataIndex:j,isDraggable:b,onDragStart:S(r),onDragOver:w(r),onDrop:M(r),onDragEnd:k,isDraggedOver:I===r,ref:e=>{l&&"object"==typeof l&&l.current&&e&&(l.current[r]=e)}},D.value),d?e.jsx("span",{ref:v}):null]},r)}))})}));exports.MenuList=r;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("./MenuItem.js"),s=require("./MenuList.styled.js");const r=n.forwardRef(((r,o)=>{let{options:i,isMultiSelect:c,showDescription:l,onSelect:u,version:a,onInfiniteScroll:d,onDropdownItemClick:p,useDefaultCursor:f,focusedIndex:j=-1}=r;const b=n.useRef(null),x=n.useRef(null),g=n.useCallback((()=>{b.current&&b.current.disconnect(),b.current=new IntersectionObserver((e=>{e[0].isIntersecting&&(null==d||d())})),x.current&&b.current.observe(x.current)}),[d]);n.useEffect((()=>(g(),()=>{b.current&&b.current.disconnect()})),[g,i]);const I=new Map;let h=-1;return i.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||(h++,I.set(e,h))}));else{const n=e;n.disabled||(h++,I.set(n,h))}})),e.jsx(e.Fragment,{children:i.map(((n,r)=>{const d=r===i.length-1;if(n.options){const i=n;return e.jsxs("div",Object.assign({style:{marginTop:"2.0"===a?2:0}},{children:[e.jsxs(s.StyledGroupedLabel,Object.assign({version:a},{children:[i.leadingIcon?e.jsx("span",Object.assign({style:{marginRight:8}},{children:i.leadingIcon})):null,i.label]})),i.options.map(((n,s)=>{const d=I.get(n),b=d===j&&!n.disabled;return e.jsx(t.MenuItem,{version:a,last:s===i.options.length-1,onSelect:u,showDescription:l,onDropdownItemClick:p,isMultiSelect:c,option:n,useDefaultCursor:f,isFocused:b,dataIndex:d,ref:e=>{o&&"object"==typeof o&&o.current&&e&&e&&e&&e&&(o.current[r]=e)}},`${r}-${s}`)})),d?e.jsx("span",{ref:x}):null]}),r)}const b=n,g=I.get(b),h=g===j&&!b.disabled;return e.jsxs("div",{children:[e.jsx(t.MenuItem,{version:a,last:d,onSelect:u,showDescription:l,onDropdownItemClick:p,isMultiSelect:c,option:b,useDefaultCursor:f,isFocused:h,dataIndex:g,ref:e=>{o&&"object"==typeof o&&o.current&&e&&(o.current[r]=e)}},b.value),d?e.jsx("span",{ref:x}):null]},r)}))})}));exports.MenuList=r;
@@ -6,7 +6,6 @@ interface MultiSelectDropdownBottomBarProps {
6
6
  list: DropdownOption[];
7
7
  buttonText?: string;
8
8
  buttonOptions?: ButtonOptions;
9
- hideClearButton?: boolean;
10
9
  }
11
10
  declare const MultiSelectDropdownBottomBar: React.FC<MultiSelectDropdownBottomBarProps>;
12
11
  export default MultiSelectDropdownBottomBar;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../button/Button.js"),r=require("../../../../TypographyStyle.js"),n=require("../../../../../constants/Theme.js"),o=require("./MultiSelectDropdownBottomBar.styled.js");exports.default=s=>{const{onClear:i,onApply:l,list:u,buttonText:a,buttonOptions:c,hideClearButton:p}=s,{primaryButtonText:y,primaryButtonType:d,secondaryButtonText:x,secondaryButtonType:j}=null!=c?c:{},B=u.reduce(((e,t)=>{if(t.options){return e+t.options.filter((e=>!0===e.selected)).length}return t.selected?e+1:e}),0);return e.jsxs(o.BottomBarContainer,Object.assign({style:{justifyContent:"space-between"}},{children:[e.jsx(r.BodySecondary,Object.assign({style:{flex:1,color:n.COLORS.content.primary}},{children:B?`${B} selected`:""})),e.jsxs("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[!p&&e.jsx(t.Button,{size:"small",buttonType:j||"primary",buttonText:x||"Clear",onClick:i}),e.jsx(t.Button,{size:"small",buttonText:y||a||"Apply",buttonType:d||"primary",onClick:()=>{l()}})]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../button/Button.js"),r=require("../../../../TypographyStyle.js"),n=require("../../../../../constants/Theme.js"),o=require("./MultiSelectDropdownBottomBar.styled.js");exports.default=s=>{const{onClear:i,onApply:l,list:u,buttonText:a,buttonOptions:c}=s,{primaryButtonText:p,primaryButtonType:y,secondaryButtonText:d,secondaryButtonType:x}=null!=c?c:{},j=u.reduce(((e,t)=>{if(t.options){return e+t.options.filter((e=>!0===e.selected)).length}return t.selected?e+1:e}),0);return e.jsxs(o.BottomBarContainer,Object.assign({style:{justifyContent:"space-between"}},{children:[e.jsx(r.BodySecondary,Object.assign({style:{flex:1,color:n.COLORS.content.primary}},{children:j?`${j} selected`:""})),e.jsxs("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[e.jsx(t.Button,{size:"small",buttonType:x||"primary",buttonText:d||"Clear",onClick:i}),e.jsx(t.Button,{size:"small",buttonText:p||a||"Apply",buttonType:y||"primary",onClick:()=>{l()}})]}))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../OpenedDropdown/utils/iterationOnOptions.js");exports.useDropdown=function(){let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"1.0",n=arguments.length>1?arguments[1]:void 0,l=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,c=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,r=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],u=arguments.length>8?arguments[8]:void 0;const[d,p]=e.useState(null!=n?n:[]),[v,O]=e.useState([]),[f,b]=e.useState(""),g=e.useRef(d);e.useEffect((()=>{if(g.current=d,v.length&&f&&o){let e=[...v];const t=d.map((e=>{if(e.options)return e.options.map((e=>({value:e.value,selected:e.selected})));const t=e;return{value:t.value,selected:t.selected}})).flat();e=e.map((e=>{const s=t.find((t=>e.value===t.value));return s?Object.assign(Object.assign({},e),{selected:s.selected}):e})),a&&(e=e.map((e=>Object.assign(Object.assign({},e),{disabled:!r.includes(e.value)})))),O(c&&!i?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[d]),e.useEffect((()=>{if(n){const e=[...n];p(c&&!i?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[n]);const j=e=>{const t=[];return e.forEach((e=>{if(e.options){const s=e.options.filter((e=>!0===e.selected));t.push(Object.assign(Object.assign({},e),{options:[...s]}))}else e.selected&&t.push(Object.assign({},e))})),t},h=e=>{let t=0;return e.forEach((e=>{e.options?t+=e.options.filter((e=>!0===e.selected)).length:e.selected&&t++})),t},m=e=>!(!c||!u&&0!==u)&&h(e)>=u;function S(e,n){if(c){if(e.selected&&u&&m(d))return;if(v.length&&f&&o)if(e.selected){if(u&&m(d))return;let l=!1;const i=t.iterateOnOptions(d,{selected:e.selected},(t=>t.value===e.value&&(l=!0,!0)));if(l||i.push(e),n)return[...i];p([...i]),"2.0"===s&&w(i)}else{let l=!1,i=t.iterateOnOptions(d,{selected:e.selected},(t=>t.value===e.value&&(l=!0,!0)));if(l&&(i=i.filter((t=>t.value!==e.value))),n)return[...i];p([...i]),"2.0"===s&&w(i)}else{const l=t.iterateOnOptions(d,{selected:e.selected},(t=>t.value===e.value));if(n)return[...l];p([...l]),"2.0"===s&&w(l)}}else null==l||l(e)}function w(e){const t=j(null!=e?e:g.current);null==l||l([...t])}return{latestDropdownOptionsRef:g,dropdownOptions:d,search:function(e){if(b(e),O([]),e&&o){const s=[];t.iterateOnOptionsRaw(d,(e=>{e.selected&&!s.includes(e.value)&&s.push(e.value)})),o(e).then((e=>{if(e){const t=e.map((e=>{if(e.options){const t=e;return Object.assign(Object.assign({},t),{options:t.options.map((e=>Object.assign(Object.assign({},e),{selected:s.includes(e.value)})))})}return Object.assign(Object.assign({},e),{selected:s.includes(e.value)})}));O([...t])}}))}},searchedString:f,searchedOptions:v,onApplyHandler:S,selectAllHandler:function(e){if(v.length&&f&&o)"selectAll"===e?function(e){let t=[...d];if(e&&u&&u>0){const e=h(t),n=u-e;if(n<=0)return;let l=0;v.forEach((e=>{if(l>=n)return;let s=!1;t=t.map((t=>{const n=e;return t.selected||t.disabled?t:void 0!==n.value&&n.value===t.value?(s=!0,l++,Object.assign(Object.assign({},t),{selected:!0})):t})),!s&&l<n&&(e.disabled||(t.push(Object.assign(Object.assign({},e),{selected:!0})),l++))})),p([...t]),"2.0"===s&&w(t)}}(!0):function(e){let t=[...d];e?v.forEach((e=>{let s=!1;t=t.map((t=>{const n=e;return void 0!==n.value&&n.value===t.value?(s=!0,Object.assign(Object.assign({},t),{selected:!0})):t})),s||t.push(Object.assign(Object.assign({},e),{selected:!0}))})):v.forEach((e=>{t=t.map((t=>{const s=e;return void 0!==s.value&&s.value===t.value?Object.assign(Object.assign({},t),{selected:!1}):t}))})),p([...t]),"2.0"===s&&w(t)}(!1);else if("selectAll"===e)if(u&&u>0){const e=h(d),t=u-e;if(t<=0)return;let n=0;const l=d.map((e=>{var s;if(e.options){const s=e;return Object.assign(Object.assign({},s),{options:s.options.map((e=>{var s;return e.disabled||e.selected||f&&!(null===(s=e.label)||void 0===s?void 0:s.toLowerCase().includes(f.toLowerCase()))?e:n<t?(n++,Object.assign(Object.assign({},e),{selected:!0})):e}))})}{const l=e;return l.disabled||(l.selected||f&&!(null===(s=l.label)||void 0===s?void 0:s.toLowerCase().includes(f.toLowerCase())))?e:n<t?(n++,Object.assign(Object.assign({},e),{selected:!0})):e}}));p([...l]),"2.0"===s&&w(l)}else{const e=t.iterateOnOptions(d,{selected:!0},(e=>{var t;return f?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(f.toLowerCase()))&&!e.disabled:!e.disabled}));p([...e]),"2.0"===s&&w(e)}else if("notSelected"===e){const e=t.iterateOnOptions(d,{selected:!1},(e=>!e.disabled));p([...e]),"2.0"===s&&w(e)}},onMultiSelectClear:function(){const e=t.iterateOnOptions(d,{selected:!1});p([...e]),"2.0"===s&&w(e)},onFreeFormSelect:function(e){if(!c)return void S({label:f,value:f,isFreeForm:!0,selected:!0});const t=d.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===f&&t.value===f?e:t.selected})));e&&(t.some((e=>e.label===f&&e.value===f))||t.unshift({label:f,value:f,isFreeForm:!0,selected:!0})),p([...t]),"2.0"===s&&w(t)},onMultiSelectApply:w,getSelectedOptions:j,getCurrentSelectionCount:h,isMaxSelectionsReached:m,maxSelections:u}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("lodash/debounce"),t=require("react"),s=require("../OpenedDropdown/utils/iterationOnOptions.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=n(e);exports.useDropdown=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"1.0",n=arguments.length>1?arguments[1]:void 0,c=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,u=arguments.length>6?arguments[6]:void 0,r=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],d=arguments.length>8?arguments[8]:void 0;const[f,p]=t.useState(null!=n?n:[]),[v,O]=t.useState([]),[g,b]=t.useState(""),h=t.useRef(f),j=t.useRef(a);t.useEffect((()=>{j.current=a}),[a]),t.useEffect((()=>{if(h.current=f,v.length&&g&&a){let e=[...v];const t=f.map((e=>{if(e.options)return e.options.map((e=>({value:e.value,selected:e.selected})));const t=e;return{value:t.value,selected:t.selected}})).flat();e=e.map((e=>{const s=t.find((t=>e.value===t.value));return s?Object.assign(Object.assign({},e),{selected:s.selected}):e})),u&&(e=e.map((e=>Object.assign(Object.assign({},e),{disabled:!r.includes(e.value)})))),O(o&&!i?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[f]),t.useEffect((()=>{if(n){const e=[...n];p(o&&!i?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[n]);const m=e=>{const t=[];return e.forEach((e=>{if(e.options){const s=e.options.filter((e=>!0===e.selected));t.push(Object.assign(Object.assign({},e),{options:[...s]}))}else e.selected&&t.push(Object.assign({},e))})),t},S=e=>{let t=0;return e.forEach((e=>{e.options?t+=e.options.filter((e=>!0===e.selected)).length:e.selected&&t++})),t},E=e=>!(!o||!d&&0!==d)&&S(e)>=d,w=t.useCallback((e=>{const t=j.current;if(!e||!t)return;const n=[];s.iterateOnOptionsRaw(h.current,(e=>{e.selected&&!n.includes(e.value)&&n.push(e.value)})),t(e).then((e=>{if(e){const t=e.map((e=>{if(e.options){const t=e;return Object.assign(Object.assign({},t),{options:t.options.map((e=>Object.assign(Object.assign({},e),{selected:n.includes(e.value)})))})}return Object.assign(Object.assign({},e),{selected:n.includes(e.value)})}));O([...t])}}))}),[]),C=t.useMemo((()=>l.default(w,300)),[w]);function F(t,n){if(o){if(t.selected&&d&&E(f))return;if(v.length&&g&&a)if(t.selected){if(d&&E(f))return;let l=!1;const c=s.iterateOnOptions(f,{selected:t.selected},(e=>e.value===t.value&&(l=!0,!0)));if(l||c.push(t),n)return[...c];p([...c]),"2.0"===e&&A(c)}else{let l=!1,c=s.iterateOnOptions(f,{selected:t.selected},(e=>e.value===t.value&&(l=!0,!0)));if(l&&(c=c.filter((e=>e.value!==t.value))),n)return[...c];p([...c]),"2.0"===e&&A(c)}else{const l=s.iterateOnOptions(f,{selected:t.selected},(e=>e.value===t.value));if(n)return[...l];p([...l]),"2.0"===e&&A(l)}}else null==c||c(t)}function A(e){const t=m(null!=e?e:h.current);null==c||c([...t])}return t.useEffect((()=>()=>null==C?void 0:C.cancel()),[C]),{latestDropdownOptionsRef:h,dropdownOptions:f,search:function(e){b(e),O([]),e?C(e):null==C||C.cancel()},searchedString:g,searchedOptions:v,onApplyHandler:F,selectAllHandler:function(t){if(v.length&&g&&a)!function(t){let s=[...f];t?v.forEach((e=>{let t=!1;s=s.map((s=>{const n=e;return void 0!==n.value&&n.value===s.value?(t=!0,Object.assign(Object.assign({},s),{selected:!0})):s})),t||s.push(Object.assign(Object.assign({},e),{selected:!0}))})):v.forEach((e=>{s=s.map((t=>{const s=e;return void 0!==s.value&&s.value===t.value?Object.assign(Object.assign({},t),{selected:!1}):t}))})),p([...s]),"2.0"===e&&A(s)}("selectAll"===t);else if("selectAll"===t){const t=s.iterateOnOptions(f,{selected:!0},(e=>{var t;return g?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(g.toLowerCase()))&&!e.disabled:!e.disabled}));p([...t]),"2.0"===e&&A(t)}else if("notSelected"===t){const t=s.iterateOnOptions(f,{selected:!1},(e=>!e.disabled));p([...t]),"2.0"===e&&A(t)}},onMultiSelectClear:function(){const t=s.iterateOnOptions(f,{selected:!1});p([...t]),"2.0"===e&&A(t)},onFreeFormSelect:function(t){if(!o)return void F({label:g,value:g,isFreeForm:!0,selected:!0});const s=f.map((e=>e.options?e:Object.assign(Object.assign({},e),{selected:e.label===g&&e.value===g?t:e.selected})));t&&(s.some((e=>e.label===g&&e.value===g))||s.unshift({label:g,value:g,isFreeForm:!0,selected:!0})),p([...s]),"2.0"===e&&A(s)},onMultiSelectApply:A,getSelectedOptions:m,getCurrentSelectionCount:S,isMaxSelectionsReached:E,maxSelections:d}};
@@ -8,7 +8,6 @@ export interface OpenDropdownProps {
8
8
  error?: string;
9
9
  isMultiSelect?: boolean;
10
10
  maxSelections?: number;
11
- inputWidth?: string;
12
11
  width?: string;
13
12
  height?: number | string;
14
13
  allowFreeForm?: boolean;
@@ -40,13 +39,6 @@ export interface OpenDropdownProps {
40
39
  title: string;
41
40
  subTitle?: string;
42
41
  };
43
- /** Enable drag-and-drop reordering of options */
44
- isDraggable?: boolean;
45
- hideClearButton?: boolean;
46
- /** Callback when options are reordered via drag-and-drop */
47
- onOptionsReorder?: (reorderedOptions: DropdownOption[]) => void;
48
- /** z-index of the dropdown popover. Defaults to 3. */
49
- dropdownZIndex?: number;
50
42
  }
51
43
  export type GroupedOption = {
52
44
  label?: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),o=require("react/jsx-runtime"),r=require("../dropdown/DropdownPopover/index.js");require("../dropdown/Dropdown.js"),require("../dropdown/ChipDropdown.js"),require("react"),require("../zeroState/ZeroState.js"),require("../TypographyStyle.js"),require("../../constants/Theme.js"),require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js");var n=require("../button/Button.js");require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var t=require("../button/themes.js"),s=require("../spinner/Spinner.js"),i=require("./DropdownButton.style.js");exports.DropdownButton=d=>{var p,u;const a=d.buttonProps,l=e.__rest(a,["onClick"]);return o.jsxs(i.DropdownButtonStyle,Object.assign({type:d.buttonProps.buttonType,disabled:d.buttonProps.disabled},{children:[(null===(p=d.buttonProps)||void 0===p?void 0:p.isLoading)&&o.jsx(i.LoaderContainer,{children:o.jsx(s.Spinner,{className:"spinner",size:"small",color:t.SpinnerColorMap(d.buttonProps.buttonType||"primary",d.buttonProps.inverse)})}),o.jsx(n.Button,Object.assign({},d.buttonProps,{isLoading:!1,style:{borderRadius:"0px",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:"0px"}})),o.jsx("div",{className:"dd-button-divider"}),o.jsx(r.DropdownPopover,Object.assign({},d.dropdownProps,{isChildLoading:null===(u=d.buttonProps)||void 0===u?void 0:u.isLoading},{children:o.jsx(n.Button,Object.assign({},l,{isLoading:!1,buttonText:"",TrailingIcon:d.iconProps,style:{borderRadius:"0px",borderTopRightRadius:"4px",borderBottomRightRadius:"4px"}}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),o=require("react/jsx-runtime"),r=require("../dropdown/DropdownPopover/index.js");require("../dropdown/Dropdown.js"),require("../dropdown/ChipDropdown.js"),require("react"),require("../zeroState/ZeroState.js"),require("lodash/debounce"),require("../TypographyStyle.js"),require("../../constants/Theme.js"),require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js");var n=require("../button/Button.js");require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var t=require("../button/themes.js"),s=require("../spinner/Spinner.js"),i=require("./DropdownButton.style.js");exports.DropdownButton=d=>{var p,u;const a=d.buttonProps,l=e.__rest(a,["onClick"]);return o.jsxs(i.DropdownButtonStyle,Object.assign({type:d.buttonProps.buttonType,disabled:d.buttonProps.disabled},{children:[(null===(p=d.buttonProps)||void 0===p?void 0:p.isLoading)&&o.jsx(i.LoaderContainer,{children:o.jsx(s.Spinner,{className:"spinner",size:"small",color:t.SpinnerColorMap(d.buttonProps.buttonType||"primary",d.buttonProps.inverse)})}),o.jsx(n.Button,Object.assign({},d.buttonProps,{isLoading:!1,style:{borderRadius:"0px",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:"0px"}})),o.jsx("div",{className:"dd-button-divider"}),o.jsx(r.DropdownPopover,Object.assign({},d.dropdownProps,{isChildLoading:null===(u=d.buttonProps)||void 0===u?void 0:u.isLoading},{children:o.jsx(n.Button,Object.assign({},l,{isLoading:!1,buttonText:"",TrailingIcon:d.iconProps,style:{borderRadius:"0px",borderTopRightRadius:"4px",borderBottomRightRadius:"4px"}}))}))]}))};
@@ -2,7 +2,7 @@
2
2
  import { InputStateI, InputTypeI, InputVariant } from "./Input";
3
3
  export declare const InputWrapper: import("@emotion/styled").StyledComponent<{
4
4
  theme?: import("@emotion/react").Theme | undefined;
5
- as?: import("react").ElementType<any> | undefined;
5
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
6
6
  } & {
7
7
  width?: string | undefined;
8
8
  height?: string | undefined;
@@ -16,7 +16,7 @@ export declare const InputWrapper: import("@emotion/styled").StyledComponent<{
16
16
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
17
17
  export declare const IconHolder: import("@emotion/styled").StyledComponent<{
18
18
  theme?: import("@emotion/react").Theme | undefined;
19
- as?: import("react").ElementType<any> | undefined;
19
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
20
20
  } & {
21
21
  isLeft?: boolean | undefined;
22
22
  iconSize?: string | undefined;
@@ -57,7 +57,7 @@ export declare const InputContainerSmall: import("@emotion/styled").StyledCompon
57
57
  }, {}, {}>;
58
58
  export declare const InputHeader: import("@emotion/styled").StyledComponent<{
59
59
  theme?: import("@emotion/react").Theme | undefined;
60
- as?: import("react").ElementType<any> | undefined;
60
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
61
61
  } & {
62
62
  invalid?: boolean | undefined;
63
63
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -91,7 +91,7 @@ export declare const InputFooter: import("@emotion/styled").StyledComponent<{
91
91
  }, {}, {}>;
92
92
  export declare const RootContainer: import("@emotion/styled").StyledComponent<{
93
93
  theme?: import("@emotion/react").Theme | undefined;
94
- as?: import("react").ElementType<any> | undefined;
94
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
95
95
  } & {
96
96
  width?: string | undefined;
97
97
  height?: string | undefined;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  export declare const ChipStyle: import("@emotion/styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any> | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -2,7 +2,7 @@
2
2
  import type { Variant } from './ListItem';
3
3
  export declare const ListItem: import("@emotion/styled").StyledComponent<{
4
4
  theme?: import("@emotion/react").Theme | undefined;
5
- as?: import("react").ElementType<any> | undefined;
5
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
6
6
  } & {
7
7
  variant: Variant;
8
8
  borderBottom?: string | undefined;
@@ -1,23 +1,23 @@
1
1
  /// <reference types="react" />
2
2
  export declare const RootContainer: import("@emotion/styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any> | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  } & {
6
6
  zIndex?: number | undefined;
7
7
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
8
8
  export declare const CentralContainer: import("@emotion/styled").StyledComponent<{
9
9
  theme?: import("@emotion/react").Theme | undefined;
10
- as?: import("react").ElementType<any> | undefined;
10
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
11
11
  } & {
12
12
  width?: string | undefined;
13
13
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
14
14
  export declare const CloseButtonContainer: import("@emotion/styled").StyledComponent<{
15
15
  theme?: import("@emotion/react").Theme | undefined;
16
- as?: import("react").ElementType<any> | undefined;
16
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
17
17
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
18
18
  export declare const CloseButtonWithTimer: import("@emotion/styled").StyledComponent<{
19
19
  theme?: import("@emotion/react").Theme | undefined;
20
- as?: import("react").ElementType<any> | undefined;
20
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
21
21
  } & {
22
22
  timerExists?: boolean | undefined;
23
23
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  export declare const Pagination: import("@emotion/styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any> | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  export declare const DurationSelectorStyled: import("@emotion/styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any> | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -30,11 +30,11 @@ type Props = {
30
30
  };
31
31
  export declare const HeaderWrapper: import("@emotion/styled").StyledComponent<{
32
32
  theme?: import("@emotion/react").Theme | undefined;
33
- as?: import("react").ElementType<any> | undefined;
33
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
34
34
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
35
35
  export declare const BottomWrapper: import("@emotion/styled").StyledComponent<{
36
36
  theme?: import("@emotion/react").Theme | undefined;
37
- as?: import("react").ElementType<any> | undefined;
37
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
38
38
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
39
39
  export declare const defaultTabs: {
40
40
  key: string;
@@ -1,14 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  export declare const SubscriptionPlanStyled: import("@emotion/styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any> | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  } & {
6
6
  isSelected: boolean;
7
7
  isManifestPlan?: boolean | undefined;
8
8
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
9
9
  export declare const NewSubscriptionStyled: import("@emotion/styled").StyledComponent<{
10
10
  theme?: import("@emotion/react").Theme | undefined;
11
- as?: import("react").ElementType<any> | undefined;
11
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
12
12
  } & {
13
13
  showMostPopularChip: boolean;
14
14
  height?: string | undefined;