@bikdotai/bik-component-library 0.0.210-beta.1 → 0.0.211-customSearch.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/QueryBuilder/Filters/Event/components/EventFilter.js +1 -1
- package/dist/cjs/components/QueryBuilder/Filters/UserProperty/components/UserPropertyFilter.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/InTheLast.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/MultiselectDropdownFreeText.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Connector.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/DropdownWrapper.d.ts +1 -0
- package/dist/cjs/components/QueryBuilder/components/DropdownWrapper.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Base/BaseQueryBuilderNode.d.ts +5 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
- package/dist/cjs/components/QueryBuilder/constants/connector.d.ts +7 -16
- package/dist/cjs/components/QueryBuilder/constants/connector.js +1 -1
- package/dist/cjs/components/QueryBuilder/helpers/Connector.helper.d.ts +0 -2
- package/dist/cjs/components/QueryBuilder/helpers/Connector.helper.js +1 -1
- package/dist/cjs/components/QueryBuilder/types/QueryBuilderConnector.type.d.ts +3 -1
- package/dist/cjs/components/QueryBuilder/types/QueryBuilderOperator.type.d.ts +7 -15
- package/dist/cjs/components/QueryBuilder/types/QueryBuilderOperator.type.js +1 -1
- package/dist/cjs/components/QueryBuilder/types/QueryBuilderPropertyProps.d.ts +1 -0
- package/dist/cjs/components/accordion/Accordion.d.ts +6 -2
- package/dist/cjs/components/accordion/Accordion.js +1 -1
- package/dist/cjs/components/accordion/Accordion.style.d.ts +2 -0
- package/dist/cjs/components/accordion/Accordion.style.js +8 -4
- package/dist/cjs/components/accordion/AccordionArrow.d.ts +5 -2
- package/dist/cjs/components/accordion/AccordionArrow.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/cjs/components/avatar/Avatar.js +1 -1
- package/dist/cjs/components/avatar/Avatar.styled.d.ts +2 -1
- package/dist/cjs/components/avatar/Avatar.styled.js +3 -3
- package/dist/cjs/components/avatar/index.d.ts +1 -0
- package/dist/cjs/components/bik-layout/CommonStyles.js +1 -1
- package/dist/cjs/components/checkBox/CheckBox.d.ts +2 -0
- package/dist/cjs/components/checkBox/CheckBox.js +1 -1
- package/dist/cjs/components/checkBox/CheckBox.styled.d.ts +1 -0
- package/dist/cjs/components/checkBox/CheckBox.styled.js +13 -12
- package/dist/cjs/components/country-code-picker/CountryCodePicker.d.ts +1 -0
- package/dist/cjs/components/country-code-picker/CountryCodePicker.js +1 -1
- package/dist/cjs/components/custom-date-time/CustomDateTime.js +1 -1
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/cjs/components/dropdown/DropdownPopover/index.d.ts +0 -6
- package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/cjs/components/dropdown/MenuItem/MenuItem.js +2 -2
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.styled.d.ts +3 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.styled.js +10 -24
- package/dist/cjs/components/dropdown/OpenedDropdown/components/description/Description.d.ts +1 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/description/Description.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/description/Description.styled.d.ts +3 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/description/Description.styled.js +2 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/FreeFormMenu.d.ts +1 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/FreeFormMenu.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +1 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +4 -3
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +1 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.styled.d.ts +2 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.styled.js +5 -4
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.d.ts +1 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.d.ts +1 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +1 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +1 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +40 -0
- package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -0
- package/dist/cjs/components/dropdown/type.d.ts +4 -1
- package/dist/cjs/components/dropdown-button/DropdownButton.js +1 -1
- package/dist/cjs/components/fab-menu/FABMenu.d.ts +1 -0
- package/dist/cjs/components/fab-menu/FABMenu.js +1 -1
- package/dist/cjs/components/input/Input.d.ts +2 -0
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/list-item/ListItem.d.ts +1 -0
- package/dist/cjs/components/list-item/ListItem.js +1 -1
- package/dist/cjs/components/list-item/ListItem.styled.d.ts +1 -0
- package/dist/cjs/components/list-item/ListItem.styled.js +1 -1
- package/dist/cjs/components/list-item/themes.d.ts +1 -1
- package/dist/cjs/components/list-item/themes.js +1 -1
- package/dist/cjs/components/radioButton/RadioButton.d.ts +2 -0
- package/dist/cjs/components/radioButton/RadioButton.js +1 -1
- package/dist/cjs/components/radioButton/RadioButton.styled.d.ts +1 -0
- package/dist/cjs/components/radioButton/RadioButton.styled.js +8 -7
- package/dist/cjs/components/states/StateComponent.d.ts +1 -0
- package/dist/cjs/components/states/StateComponent.js +1 -1
- package/dist/cjs/components/states/StateComponent.styled.d.ts +6 -2
- package/dist/cjs/components/states/StateComponent.styled.js +9 -6
- package/dist/cjs/components/tag/Tag.d.ts +1 -1
- package/dist/cjs/components/tag/Tag.js +1 -1
- package/dist/cjs/components/tag/Tag.styled.d.ts +2 -0
- package/dist/cjs/components/tag/Tag.styled.js +1 -1
- package/dist/cjs/components/tag/model.d.ts +2 -0
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/QueryBuilder/Filters/Event/components/EventFilter.js +1 -1
- package/dist/esm/components/QueryBuilder/Filters/UserProperty/components/UserPropertyFilter.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/InTheLast.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/MultiselectDropdownFreeText.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Connector.js +1 -1
- package/dist/esm/components/QueryBuilder/components/DropdownWrapper.d.ts +1 -0
- package/dist/esm/components/QueryBuilder/components/DropdownWrapper.js +1 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Base/BaseQueryBuilderNode.d.ts +5 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
- package/dist/esm/components/QueryBuilder/constants/connector.d.ts +7 -16
- package/dist/esm/components/QueryBuilder/constants/connector.js +1 -1
- package/dist/esm/components/QueryBuilder/helpers/Connector.helper.d.ts +0 -2
- package/dist/esm/components/QueryBuilder/helpers/Connector.helper.js +1 -1
- package/dist/esm/components/QueryBuilder/types/QueryBuilderConnector.type.d.ts +3 -1
- package/dist/esm/components/QueryBuilder/types/QueryBuilderOperator.type.d.ts +7 -15
- package/dist/esm/components/QueryBuilder/types/QueryBuilderOperator.type.js +1 -1
- package/dist/esm/components/QueryBuilder/types/QueryBuilderPropertyProps.d.ts +1 -0
- package/dist/esm/components/accordion/Accordion.d.ts +6 -2
- package/dist/esm/components/accordion/Accordion.js +1 -1
- package/dist/esm/components/accordion/Accordion.style.d.ts +2 -0
- package/dist/esm/components/accordion/Accordion.style.js +8 -4
- package/dist/esm/components/accordion/AccordionArrow.d.ts +5 -2
- package/dist/esm/components/accordion/AccordionArrow.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/esm/components/avatar/Avatar.js +1 -1
- package/dist/esm/components/avatar/Avatar.styled.d.ts +2 -1
- package/dist/esm/components/avatar/Avatar.styled.js +3 -3
- package/dist/esm/components/avatar/index.d.ts +1 -0
- package/dist/esm/components/bik-layout/CommonStyles.js +1 -1
- package/dist/esm/components/checkBox/CheckBox.d.ts +2 -0
- package/dist/esm/components/checkBox/CheckBox.js +1 -1
- package/dist/esm/components/checkBox/CheckBox.styled.d.ts +1 -0
- package/dist/esm/components/checkBox/CheckBox.styled.js +7 -6
- package/dist/esm/components/country-code-picker/CountryCodePicker.d.ts +1 -0
- package/dist/esm/components/country-code-picker/CountryCodePicker.js +1 -1
- package/dist/esm/components/custom-date-time/CustomDateTime.js +1 -1
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/esm/components/dropdown/DropdownPopover/index.d.ts +0 -6
- package/dist/esm/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/esm/components/dropdown/MenuItem/MenuItem.js +2 -2
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.styled.d.ts +3 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.styled.js +10 -24
- package/dist/esm/components/dropdown/OpenedDropdown/components/description/Description.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/description/Description.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/description/Description.styled.d.ts +3 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/description/Description.styled.js +2 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/FreeFormMenu.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/FreeFormMenu.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +4 -3
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.styled.d.ts +2 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.styled.js +6 -5
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +40 -0
- package/dist/esm/components/dropdown/hooks/useDropdown.js +1 -0
- package/dist/esm/components/dropdown/type.d.ts +4 -1
- package/dist/esm/components/dropdown-button/DropdownButton.js +1 -1
- package/dist/esm/components/fab-menu/FABMenu.d.ts +1 -0
- package/dist/esm/components/fab-menu/FABMenu.js +1 -1
- package/dist/esm/components/input/Input.d.ts +2 -0
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/list-item/ListItem.d.ts +1 -0
- package/dist/esm/components/list-item/ListItem.js +1 -1
- package/dist/esm/components/list-item/ListItem.styled.d.ts +1 -0
- package/dist/esm/components/list-item/ListItem.styled.js +1 -1
- package/dist/esm/components/list-item/themes.d.ts +1 -1
- package/dist/esm/components/list-item/themes.js +1 -1
- package/dist/esm/components/radioButton/RadioButton.d.ts +2 -0
- package/dist/esm/components/radioButton/RadioButton.js +1 -1
- package/dist/esm/components/radioButton/RadioButton.styled.d.ts +1 -0
- package/dist/esm/components/radioButton/RadioButton.styled.js +8 -7
- package/dist/esm/components/states/StateComponent.d.ts +1 -0
- package/dist/esm/components/states/StateComponent.js +1 -1
- package/dist/esm/components/states/StateComponent.styled.d.ts +6 -2
- package/dist/esm/components/states/StateComponent.styled.js +9 -6
- package/dist/esm/components/tag/Tag.d.ts +1 -1
- package/dist/esm/components/tag/Tag.js +1 -1
- package/dist/esm/components/tag/Tag.styled.d.ts +2 -0
- package/dist/esm/components/tag/Tag.styled.js +1 -1
- package/dist/esm/components/tag/model.d.ts +2 -0
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/InTwoLast.d.ts +0 -4
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/InTwoLast.js +0 -1
- package/dist/cjs/components/QueryBuilder/constants/DATE_OPERATORS_OPTIONS.d.ts +0 -2
- package/dist/cjs/components/QueryBuilder/constants/DATE_OPERATORS_OPTIONS.js +0 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/InTwoLast.d.ts +0 -4
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/InTwoLast.js +0 -1
- package/dist/esm/components/QueryBuilder/constants/DATE_OPERATORS_OPTIONS.d.ts +0 -2
- package/dist/esm/components/QueryBuilder/constants/DATE_OPERATORS_OPTIONS.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as i,jsx as e}from"react/jsx-runtime";import{useState as l,useEffect as s}from"react";import{CheckboxContainer as t,CheckboxIcon as a}from"./CheckBox.styled.js";import{BodyPrimary as r,BodySecondary as o}from"../TypographyStyle.js";import{COLORS as n}from"../../constants/Theme.js";const d=l=>i("svg",Object.assign({width:l.isSmall?"16":"18",height:l.isSmall?"16":"18",viewBox:l.isSmall?"0 0 16 16":"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e("rect",{x:"0",y:"0",width:l.isSmall?"16":"18",height:l.isSmall?"16":"18",rx:"4",fill:l.isDisabled?n.content.inactive:n.background.positive.vibrant}),!l.isPartial&&e("svg",Object.assign({width:l.isSmall?"8":"10",height:l.isSmall?"7":"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),l.isPartial&&e("rect",{x:"5",y:l.isSmall?"7":"8",width:l.isSmall?"6":"8",height:"2",rx:"1",fill:n.surface.standard})]})),c=c=>{var h;const[m,b]=l(c.isChecked||!1),[v,g]=l(c.isDisabled||!1),[p,w]=l(!1),[x,S]=l(!1);return s((()=>{b(c.isChecked)}),[c.isChecked]),s((()=>{g(c.isDisabled||!1)}),[c.isDisabled]),i(t,Object.assign({onClick:()=>{var i;if(!c.isDisabled){const e=!m;b(e),null===(i=c.onValueChange)||void 0===i||i.call(c,e,c.value)}},onMouseEnter:()=>w(!c.skipHoverState),onMouseLeave:()=>w(!1),onMouseDown:()=>S(!c.skipHoverState),onMouseUp:()=>S(!1)},{children:[e(a,Object.assign({checked:m,hovered:p,clicked:x,isDisabled:v,size:c.size},{children:m&&e(d,{isPartial:null!==(h=c.isPartiallyChecked)&&void 0!==h&&h,isDisabled:v,isSmall:"SMALL"===c.size})})),c.label&&"SMALL"!==c.size&&e(r,Object.assign({color:c.isDisabled?n.text.disabled:n.text.primary},{children:c.label})),c.label&&"SMALL"===c.size&&e(o,Object.assign({color:c.isDisabled?n.text.disabled:n.text.primary},{children:c.label}))]}))};export{c as CheckBox};
|
|
@@ -3,9 +3,9 @@ import e,{css as i}from"styled-components";import{COLORS as o}from"../../constan
|
|
|
3
3
|
gap: 8px;
|
|
4
4
|
align-items: center;
|
|
5
5
|
cursor: pointer;
|
|
6
|
-
`,
|
|
7
|
-
width:
|
|
8
|
-
height:
|
|
6
|
+
`,s=e.div`
|
|
7
|
+
width: ${e=>"SMALL"===e.size?12:14}px;
|
|
8
|
+
height: ${e=>"SMALL"===e.size?12:14}px;
|
|
9
9
|
border-radius: 4px;
|
|
10
10
|
border: 2px solid black;
|
|
11
11
|
display: flex;
|
|
@@ -13,9 +13,10 @@ import e,{css as i}from"styled-components";import{COLORS as o}from"../../constan
|
|
|
13
13
|
align-items: center;
|
|
14
14
|
box-sizing: content-box;
|
|
15
15
|
${e=>e.isDisabled?i`
|
|
16
|
-
border:
|
|
16
|
+
border: ${"SMALL"===e.size?1.5:2}px solid
|
|
17
|
+
${o.content.inactive};
|
|
17
18
|
`:i`
|
|
18
|
-
border:
|
|
19
|
+
border: ${"SMALL"===e.size?1.5:2}px solid black;
|
|
19
20
|
`}
|
|
20
21
|
${e=>e.checked&&i`
|
|
21
22
|
border: 0px;
|
|
@@ -30,4 +31,4 @@ import e,{css as i}from"styled-components";import{COLORS as o}from"../../constan
|
|
|
30
31
|
${e.checked?o.stroke.positive.lightAlt:o.surface.hovered};
|
|
31
32
|
outline-offset: 2px;
|
|
32
33
|
`}
|
|
33
|
-
`;export{t as CheckboxContainer,
|
|
34
|
+
`;export{t as CheckboxContainer,s as CheckboxIcon};
|
|
@@ -2,6 +2,7 @@ import { Placement, PositioningStrategy } from '@popperjs/core';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { CountryCode } from "./CountryCodePicker.modal";
|
|
4
4
|
export declare const CountryCodePicker: React.FC<{
|
|
5
|
+
version: '1.0' | '2.0';
|
|
5
6
|
onCountrySelect: (country: CountryCode) => void;
|
|
6
7
|
selectedCountry: CountryCode;
|
|
7
8
|
popoverWidth?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o,jsxs as e}from"react/jsx-runtime";import t from"../../assets/icons/chevronDown.svg.js";import{useState as n,useEffect as r}from"react";import{CountriesData as d}from"./CountryCodePicker.modal.js";import{StyledCountryPickerWrapper as s,StyledCountryPickerOption as
|
|
1
|
+
import{jsx as o,jsxs as e}from"react/jsx-runtime";import t from"../../assets/icons/chevronDown.svg.js";import{useState as n,useEffect as r}from"react";import{CountriesData as d}from"./CountryCodePicker.modal.js";import{StyledCountryPickerWrapper as s,StyledCountryPickerOption as i}from"./CountryCodePicker.styled.js";import{DropdownPopover as p}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../zeroState/ZeroState.js";import{BodySecondary as c}from"../TypographyStyle.js";import{COLORS as m}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";const l=l=>{var a,u,w,h,j,v;const[y,g]=n(null!==(a=l.selectedCountry)&&void 0!==a?a:{name:"India",dial:"+91",code:"IN"}),f=`https://flagcdn.com/${null===(u=y.code)||void 0===u?void 0:u.toLowerCase()}.svg`;r((()=>{l.selectedCountry&&g(l.selectedCountry)}),[null===(w=l.selectedCountry)||void 0===w?void 0:w.code]);return o(p,Object.assign({version:l.version,isSearchable:!0,width:null!==(h=l.popoverWidth)&&void 0!==h?h:"200px",placement:null!==(j=l.placement)&&void 0!==j?j:"bottom-start",strategy:null!==(v=l.placementStrategy)&&void 0!==v?v:"absolute",options:d.map((t=>{var n;const r=`https://flagcdn.com/${null===(n=t.code)||void 0===n?void 0:n.toLowerCase()}.svg`;return{value:t.code,label:t.dial,searchKey:t.name,customComponent:e(i,{children:[o("img",{src:r,className:"country-flag__option",alt:t.name}),e(c,{children:[t.code," ",t.dial]})]}),selected:y.code===t.code}})),onSelect:o=>{const e=d.filter((e=>e.code===o.value));g(e[0]),l.onCountrySelect(e[0])}},{children:e(s,Object.assign({height:l.height},{children:[e("div",Object.assign({className:"content__wrapper"},{children:[o("img",{src:f,className:"country-flag__selected-option",alt:y.name}),o(c,{children:y.dial})]})),o(t,{width:24,height:24,color:m.content.primary})]}))}))};export{l as CountryCodePicker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{format as t,isToday as r}from"date-fns";import{useState as n,useEffect as s}from"react";import i from"./DateSelector/DateSelector.js";import{DropdownPopover as m}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../zeroState/ZeroState.js";import{BodySecondary as p}from"../TypographyStyle.js";import"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../
|
|
1
|
+
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{format as t,isToday as r}from"date-fns";import{useState as n,useEffect as s}from"react";import i from"./DateSelector/DateSelector.js";import{DropdownPopover as m}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../zeroState/ZeroState.js";import{BodySecondary as p}from"../TypographyStyle.js";import"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import{Input as d}from"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import l from"../../utils/DateUtils.js";import c from"../../assets/icons/chevronDown.svg.js";import a from"../../assets/icons/clock.svg.js";import{CustomDateTimeStyle as u}from"./CustomDateTime.styled.js";const j=()=>{const e=[];for(let o=0;o<2;o++)for(let t=0;t<12;t++){let r;r=0===t?"12":t<10?`0${t}`:`${t}`;const n=`${r}:00 ${0===o?"AM":"PM"}`,s=`${r}:30 ${0===o?"AM":"PM"}`;e.push({label:n,value:n,selected:!1},{label:s,value:s,selected:!1})}return e},w=w=>{const[D,f]=n(w.time),[h,v]=n(w.date);s((()=>{w.setError(void 0);const e=l.convert12HourTimeTo24Hour(D),o=t(new Date,"HH:mm:ss");if(r(h)&&e<o)return void w.setError("Selected time should be later than current time");w.setError(void 0);const[n,s]=e.split(":"),i=new Date(h.getTime());i.setHours(+n,+s),w.onChange(i)}),[h,D]);return e(u,{children:[e("div",Object.assign({style:{display:"flex",gap:16}},{children:[o("div",Object.assign({style:{flex:1}},{children:o(i,{customDate:h,setCustomDate:v,placement:w.placement,minDate:w.minDate})})),o("div",Object.assign({style:{flex:1}},{children:o(m,Object.assign({options:j(),onSelect:e=>{f(e.value)}},{children:o(d,{value:D,leftIcon:{icon:a},rightIcon:{icon:c},onChangeText:e=>(e=>{if(l.timeFormatValidation(e)){const o=l.convert12HourTimeTo24Hour(e),n=t(new Date,"HH:mm:ss");if(r(h)&&o<n)return void w.setError("Selected time should be later than current time");w.setError(void 0),f(e)}else w.setError('Format of time should be "HH:MM AM" or "HH:MM PM"')})(e)})}))}))]})),w.error&&o(p,Object.assign({style:{paddingTop:8}},{children:w.error}))]})};export{w as CustomDateTime};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e,Fragment as o}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import{MIN_PURCHASE_REQUIREMENT as r,DISCOUNT_TARGET_TYPES as d,DISCOUNT_TYPES as s,DISCOUNT_TARGET_SELECTION as a,DISCOUNT_VALUE_TYPES as c}from"./type.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as l}from"../dropdown/Dropdown.js";import"../zeroState/ZeroState.js";import{TitleSmall as p,BodyCaption as u}from"../TypographyStyle.js";import{DEFAULT_THEME as m}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../
|
|
1
|
+
import{jsxs as t,jsx as e,Fragment as o}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import{MIN_PURCHASE_REQUIREMENT as r,DISCOUNT_TARGET_TYPES as d,DISCOUNT_TYPES as s,DISCOUNT_TARGET_SELECTION as a,DISCOUNT_VALUE_TYPES as c}from"./type.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as l}from"../dropdown/Dropdown.js";import"../zeroState/ZeroState.js";import{TitleSmall as p,BodyCaption as u}from"../TypographyStyle.js";import{DEFAULT_THEME as m}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledModal as b}from"../modals/styledModal.js";import{ProductPickerContent as y}from"../product-picker/ProductPickerModal.js";import{Tag as E}from"../tag/Tag.js";import{Tooltip as v}from"../tooltips/Tooltip.js";import P from"../../assets/icons/triangle_error.svg.js";import{StyledDiscountDialogueContainer as T,CouponTypeContainerStyled as g}from"./DiscountModal.styled.js";import{validateDiscountData as I}from"./DiscountUtils.js";import j,{DISCOUNT_PRODUCTS as C}from"./DynamicCoupon/DynamicCoupon.js";import h from"./StaticCoupon/StaticCoupon.js";const S=S=>{var O,D,N,_;const[w,f]=i(),[A,q]=i(null!==(O=S.data)&&void 0!==O?O:{}),[G,M]=i(((null===(D=S.data)||void 0===D?void 0:D.isStaticCoupon)||S.allowStaticCoupon)&&!(null===(N=S.data)||void 0===N?void 0:N.targetSelection)),[L,x]=i(!0),[R,k]=i(),[F,B]=i(r.NA),[U,X]=i([]),[Y,H]=i([]),[Q,V]=i(0);n((()=>{let t;S.hideProbability||(t=$()),x(I(A,F,R,S.hideProbability||!1,t,G)),S.hideProbability||$()}),[]),n((()=>{let t;S.hideProbability||(t=$()),x(I(A,F,R,S.hideProbability||!1,t,G))}),[G,A,Q,R,F]),n((()=>{var t,e;if(S.products){if(null===(t=S.data)||void 0===t?void 0:t.entitledProductIds){const t=S.products.filter((t=>{var e,o;return null===(o=null===(e=S.data)||void 0===e?void 0:e.entitledProductIds)||void 0===o?void 0:o.includes(parseInt(t.id))}));H(t)}if(null===(e=S.data)||void 0===e?void 0:e.prerequisiteProductIds){const t=S.products.filter((t=>{var e,o;return null===(o=null===(e=S.data)||void 0===e?void 0:e.prerequisiteProductIds)||void 0===o?void 0:o.includes(parseInt(t.id))}));X(t)}}}),[]),n((()=>{const t=Y.map((t=>parseInt(t.id)));q(Object.assign(Object.assign({},A),{entitledProductIds:t}))}),[Y]),n((()=>{const t=U.map((t=>parseInt(t.id)));q(Object.assign(Object.assign({},A),{prerequisiteProductIds:t}))}),[U]),n((()=>{A.targetType===d.SHIPPING_LINE?k(s.FREE_SHIPPING):A.targetSelection===a.ENTITLED?k(s.BUY_X_GET_Y):A.valueType===c.FIXED_AMOUNT?k(s.FIXED_AMOUNT):A.valueType===c.PERCENTAGE&&k(s.PERCENTAGE)}),[]);const z=[{value:s.FIXED_AMOUNT,label:"Fixed Amount",selected:R===s.FIXED_AMOUNT},{value:s.PERCENTAGE,label:"Percentage",selected:R===s.PERCENTAGE},{value:s.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:R===s.BUY_X_GET_Y},{value:s.FREE_SHIPPING,label:"Free shipping",selected:R===s.FREE_SHIPPING}],$=()=>{if(!S.quadrant||!S.probability)return;const t=[...S.probability];let e=[];t.length>=S.quadrant&&t.splice(S.quadrant-1,1),e=t;const o=e.reduce(((t,e)=>t+e),0)+(A.probability||0);return V(o),o},K=t=>{const e=t.value;k(e),e===s.FREE_SHIPPING?(X([]),H([]),q(Object.assign(Object.assign({},A),{value:100,targetSelection:a.ALL,targetType:d.SHIPPING_LINE,valueType:c.PERCENTAGE,entitledQuantity:void 0,prerequisiteQuantity:void 0,entitledProductIds:void 0,prerequisiteProductIds:void 0}))):e===s.BUY_X_GET_Y?q(Object.assign(Object.assign({},A),{targetSelection:a.ENTITLED,targetType:d.LINE_ITEM,valueType:c.PERCENTAGE})):e===s.PERCENTAGE?(X([]),H([]),q(Object.assign(Object.assign({},A),{targetSelection:a.ALL,targetType:d.LINE_ITEM,valueType:c.PERCENTAGE,entitledQuantity:void 0,prerequisiteQuantity:void 0,entitledProductIds:void 0,prerequisiteProductIds:void 0}))):e===s.FIXED_AMOUNT&&(X([]),H([]),q(Object.assign(Object.assign({},A),{targetSelection:a.ALL,targetType:d.LINE_ITEM,valueType:c.FIXED_AMOUNT,entitledQuantity:void 0,prerequisiteQuantity:void 0,entitledProductIds:void 0,prerequisiteProductIds:void 0})))};return t(b,Object.assign({open:S.isOpen,headingTitle:w?"Select Products":S.title,headingSubtitle:w?void 0:S.subTitle,footerLeftCustomElement:!S.quadrant||S.hideProbability?e(o,{}):Q<=1?e(E,{theme:"light",tagText:`Current probability sum: ${Q}`,type:"white"}):e(v,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e("div",{children:e(E,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${Q}`,type:"negative",LeadingIcon:P})})})),headerRightCustomElement:S.allowStaticCoupon||w?void 0:e(l,{options:z,width:"200px",placement:"bottom-start",size:"small",onSelect:t=>{K(t)}}),onClose:S.onClose,footerShadow:!0,primaryButton:w?{buttonType:"primary",onClick:()=>{f(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Add code",disabled:L,onClick:()=>{A.isStaticCoupon?S.onSaveClicked({quadrant:A.quadrant,couponCode:A.couponCode,description:A.description,isStaticCoupon:A.isStaticCoupon,probability:A.probability,title:A.title}):S.onSaveClicked(A),q({})}},secondaryButton:w?{buttonType:"tertiaryGray",onClick:()=>{f(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:S.onClose,buttonText:"Close"}},{children:[!w&&t(T,{children:[S.allowStaticCoupon&&!w&&t(g,Object.assign({selectedDiv:G?1:2},{children:[t("div",Object.assign({className:"coupon-type__container",onClick:()=>{M(!0),q({isStaticCoupon:!0,couponCode:A.couponCode,description:A.description,quadrant:A.quadrant})}},{children:[e(p,Object.assign({style:G?{color:m.colorsV2.content.brand}:{}},{children:"Static code"})),e(u,Object.assign({style:G?{color:m.colorsV2.content.brand}:{}},{children:"One static code for all customers"}))]})),t("div",Object.assign({className:"coupon-type__container",onClick:()=>{q(Object.assign(Object.assign({},A),{isStaticCoupon:!1})),M(!1)}},{children:[e(p,Object.assign({style:G?{}:{color:m.colorsV2.content.brand}},{children:"Dynamic code"})),e(u,Object.assign({style:G?{}:{color:m.colorsV2.content.brand}},{children:"New code generated for everyone"}))]}))]})),G&&!w&&e(h,{discountData:A,setDiscountData:q,hideProbability:S.hideProbability||!1,discountAdminUrl:S.discountAdminUrl}),!G&&!w&&e(j,{currency:S.currency,entitledProducts:Y,prerequisiteProducts:U,setEntitledProducts:H,setPrerequisiteProducts:X,discountData:A,productPickerOpen:w,setIsProductPickerOpen:f,setDiscountData:q,selectedCouponType:R,setSelectedCouponType:k,selectedMinimumRequirement:F,setSelectedMinimumRequirement:B,hideProbability:S.hideProbability||!1,hideExpiration:S.hideExpiration||!1,allowStaticCoupon:S.allowStaticCoupon,onChangeCouponType:K})]}),!!w&&e("div",Object.assign({style:{padding:"12px 0"}},{children:e(y,{show:!0,onSave:()=>{},products:null!==(_=S.products)&&void 0!==_?_:[],title:"Select Products",onClose:()=>{f(void 0)},selectedProducts:w===C.ENTITLED?Y:U,setSelectedProducts:w===C.ENTITLED?H:X,onSearchKeyChange:S.onProductSearch})}))]}))};export{S as DiscountModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import{useEffect as n}from"react";import{Button as s}from"../../button/Button.js";import{DISCOUNT_TYPES as a,MIN_PURCHASE_REQUIREMENT as o}from"../type.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as r}from"../../dropdown/Dropdown.js";import"../../zeroState/ZeroState.js";import{TitleRegular as l,BodySecondary as c,TitleMedium as d,BodyPrimary as u,TitleSmall as p}from"../../TypographyStyle.js";import{DEFAULT_THEME as m}from"../../../constants/Theme.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../checkBox/CheckBox.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../dropdown/OpenedDropdown/components/menu/SelectAllMenu.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import{Input as b}from"../../input/Input.js";import g from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import"../../modals/styledModal.js";import"../../../node_modules/lodash.debounce/index.js";import"../../bik-layout/CommonStyles.js";import"../../product-picker/ProductPicker.styled.js";import"../../../utils/DateUtils.js";import"../../tag/Tag.js";import"@tippyjs/react";import"../../tooltips/TooltipInternal.js";import{DynamicCouponContainer as v}from"../DiscountModal.styled.js";import{CouponExpiration as j}from"../CouponExpiration/CouponExpiration.js";import{RadioButton as D}from"../../radioButton/RadioButton.js";import h from"../../../assets/icons/cursor.svg.js";import y from"../../../assets/icons/plus.svg.js";var O;function T(){return null}!function(e){e.ENTITLED="entitled",e.PREREQUISITE="prerequisite"}(O||(O={}));const x=x=>{var E;n((()=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{isStaticCoupon:!1}))}),[]);const _=[{value:a.FIXED_AMOUNT,label:"Fixed Amount",selected:x.selectedCouponType===a.FIXED_AMOUNT},{value:a.PERCENTAGE,label:"Percentage",selected:x.selectedCouponType===a.PERCENTAGE},{value:a.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:x.selectedCouponType===a.BUY_X_GET_Y},{value:a.FREE_SHIPPING,label:"Free shipping",selected:x.selectedCouponType===a.FREE_SHIPPING}],C=[{selected:x.selectedMinimumRequirement===o.NA,label:"No minimum requirements",value:o.NA},{selected:x.selectedMinimumRequirement===o.AMOUNT,label:`Minimum purchase amount (${null!==(E=x.currency)&&void 0!==E?E:"₹"})`,value:o.AMOUNT},{selected:x.selectedMinimumRequirement===o.QUANTITY,label:"Minimum quantity of items",value:o.QUANTITY}],N=()=>{var i,n,s,a;return e("div",Object.assign({className:"input__rows"},{children:[e("div",Object.assign({className:"input__wrapper"},{children:[t(c,Object.assign({style:{marginBottom:10}},{children:"Min purchase requirements"})),t(r,{options:C,placement:"bottom-start",onSelect:e=>{const t=e.value;x.setSelectedMinimumRequirement(t),x.setDiscountData(Object.assign(Object.assign({},x.discountData),{minQuantity:void 0,minAmount:void 0}))}})]})),t("div",Object.assign({className:"input__wrapper"},{children:x.selectedMinimumRequirement!==o.NA&&t(b,{value:x.selectedMinimumRequirement===o.AMOUNT?null!==(n=null===(i=x.discountData.minAmount)||void 0===i?void 0:i.toString())&&void 0!==n?n:"":null!==(a=null===(s=x.discountData.minQuantity)||void 0===s?void 0:s.toString())&&void 0!==a?a:"",onChangeText:e=>{x.selectedMinimumRequirement===o.AMOUNT?x.setDiscountData(Object.assign(Object.assign({},x.discountData),{minAmount:parseInt(e)})):x.selectedMinimumRequirement===o.QUANTITY&&x.setDiscountData(Object.assign(Object.assign({},x.discountData),{minQuantity:parseInt(e)}))},labelText:x.selectedMinimumRequirement===o.AMOUNT?"Minimum purchase amount":"Minimum purchase quantity",type:"number",placeholder:x.selectedMinimumRequirement===o.AMOUNT?"1000.00":"2"})}))]}))},f=n=>{var a,o;const r=n===O.ENTITLED?x.entitledProducts:x.prerequisiteProducts;return e(i,{children:[t(l,{children:n===O.PREREQUISITE?"Customer spends":"Customer gets"}),e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:n===O.ENTITLED?null===(a=x.discountData.entitledQuantity)||void 0===a?void 0:a.toString():null===(o=x.discountData.prerequisiteQuantity)||void 0===o?void 0:o.toString(),type:"number",onChangeText:e=>{n===O.ENTITLED?x.setDiscountData(Object.assign(Object.assign({},x.discountData),{entitledQuantity:parseInt(e)})):x.setDiscountData(Object.assign(Object.assign({},x.discountData),{prerequisiteQuantity:parseInt(e)}))},labelText:"Add quantity",placeholder:"Add quantity"})})),t("div",{className:"input__wrapper"})]})),t("div",{children:t(s,{buttonText:"Add product",buttonType:"tertiary",LeadingIcon:y,onClick:()=>{x.setIsProductPickerOpen(n)}})}),r.map((i=>e("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${m.colorsV2.stroke.primary}`,display:"flex"}},{children:[e("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[t("img",{src:i.image,onError:e=>{e.target.onerror=null,e.target.src="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg"},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),t(p,{children:i.name})]})),t("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:t("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{const e=r.filter((e=>e.id!==i.id));n===O.ENTITLED?x.setEntitledProducts(e):x.setPrerequisiteProducts(e)}},{children:t(g,{width:14,color:m.colorsV2.content.primary})}))}))]}),i.id)))]})};return e(v,{children:[x.allowStaticCoupon&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(r,{options:_,width:"290px",placement:"bottom-start",onSelect:e=>{x.onChangeCouponType(e)}})})),t("div",{className:"input__wrapper"})]})),(x.selectedCouponType===a.PERCENTAGE||x.selectedCouponType===a.FIXED_AMOUNT)&&(()=>{var n,s,o,r;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:x.discountData.title,onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{title:e}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:null===(s=null===(n=x.discountData)||void 0===n?void 0:n.value)||void 0===s?void 0:s.toString(),labelText:"Discount code value",type:"number",onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:parseInt(e)}))},placeholder:x.selectedCouponType===a.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:x.selectedCouponType===a.FIXED_AMOUNT?null!==(o=x.currency)&&void 0!==o?o:"₹":void 0,suffixText:x.selectedCouponType===a.PERCENTAGE?"%":void 0})}))]})),N(),!x.hideProbability&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{type:"number",value:null===(r=x.discountData.probability)||void 0===r?void 0:r.toString(),onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{probability:e.startsWith(".")?parseFloat(`0${e}`):parseFloat(e)}))},labelText:"Probability",placeholder:"Enter probability in decimals eg: 0.2, 0.5, 0.75"})})),t("div",{className:"input__wrapper"})]}))]})})(),x.selectedCouponType===a.FREE_SHIPPING&&(()=>{var n;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:x.discountData.title,onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{title:e}))},labelText:"Code title",placeholder:"eg: Flat 50% Off",maxCharLimit:18})})),t("div",Object.assign({className:"input__wrapper"},{children:!x.hideProbability&&t(b,{value:null===(n=x.discountData.probability)||void 0===n?void 0:n.toString(),type:"number",onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{probability:e.startsWith(".")?parseFloat(`0${e}`):parseFloat(e)}))},labelText:"Probability",placeholder:"Enter probability in decimals eg: 0.2, 0.5, 0.75"})}))]})),N()]})})(),x.selectedCouponType===a.BUY_X_GET_Y&&(()=>{var i;return e(v,{children:[t("div",Object.assign({className:"input__rows"},{children:e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:20,flex:1}},{children:[t(b,{value:x.discountData.title,onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{title:e}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"}),!x.hideProbability&&t(b,{value:null===(i=x.discountData.probability)||void 0===i?void 0:i.toString(),type:"number",onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{probability:e.startsWith(".")?parseFloat(`0${e}`):parseFloat(e)}))},labelText:"Probability",placeholder:"Enter probability in decimals eg: 0.2, 0.5, 0.75"})]}))})),t(T,{}),f(O.PREREQUISITE),t(T,{}),f(O.ENTITLED),t(T,{}),t(l,{children:"At a discount value"}),e("div",Object.assign({style:{display:"flex",gap:18,alignItems:"center"}},{children:[t(D,{isActive:100!==x.discountData.value,onValueChange:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:void 0}))}}),t(c,{children:"Percentage"}),100!==x.discountData.value&&t(b,{variant:"small",onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Enter percentage eg: 10%",suffixText:"%",width:"238px"})]})),e("div",Object.assign({style:{display:"flex",gap:18}},{children:[t(D,{isActive:100===x.discountData.value,onValueChange:e=>{e?x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:100})):x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:void 0}))}}),t(c,{children:"Free"})]}))]})})(),x.selectedCouponType&&!x.hideExpiration&&e(i,{children:[t("div",{style:{height:6,borderTop:`1px solid ${m.colorsV2.stroke.primary}`,marginTop:12}}),t(j,{discountData:x.discountData,setDiscountData:x.setDiscountData})]}),!x.selectedCouponType&&e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:10,padding:"40px 0",justifyContent:"center",alignItems:"center"}},{children:[t("div",Object.assign({style:{height:52,width:52,backgroundColor:m.colorsV2.background.inverse,borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"}},{children:t(h,{width:32,color:m.colorsV2.content.primaryInverse})})),t(d,{children:"No discount has been selected"}),t(u,{children:"Please select a discount type"})]}))]})};export{O as DISCOUNT_PRODUCTS,x as default};
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import{useEffect as n}from"react";import{Button as s}from"../../button/Button.js";import{DISCOUNT_TYPES as a,MIN_PURCHASE_REQUIREMENT as o}from"../type.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as r}from"../../dropdown/Dropdown.js";import"../../zeroState/ZeroState.js";import{TitleRegular as l,BodySecondary as c,TitleMedium as d,BodyPrimary as u,TitleSmall as p}from"../../TypographyStyle.js";import{DEFAULT_THEME as m}from"../../../constants/Theme.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../checkBox/CheckBox.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import{Input as b}from"../../input/Input.js";import g from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import"../../modals/styledModal.js";import"../../../node_modules/lodash.debounce/index.js";import"../../bik-layout/CommonStyles.js";import"../../product-picker/ProductPicker.styled.js";import"../../../utils/DateUtils.js";import"../../tag/Tag.js";import"@tippyjs/react";import"../../tooltips/TooltipInternal.js";import{DynamicCouponContainer as v}from"../DiscountModal.styled.js";import{CouponExpiration as j}from"../CouponExpiration/CouponExpiration.js";import{RadioButton as D}from"../../radioButton/RadioButton.js";import h from"../../../assets/icons/cursor.svg.js";import y from"../../../assets/icons/plus.svg.js";var T;function O(){return null}!function(e){e.ENTITLED="entitled",e.PREREQUISITE="prerequisite"}(T||(T={}));const x=x=>{var E;n((()=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{isStaticCoupon:!1}))}),[]);const _=[{value:a.FIXED_AMOUNT,label:"Fixed Amount",selected:x.selectedCouponType===a.FIXED_AMOUNT},{value:a.PERCENTAGE,label:"Percentage",selected:x.selectedCouponType===a.PERCENTAGE},{value:a.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:x.selectedCouponType===a.BUY_X_GET_Y},{value:a.FREE_SHIPPING,label:"Free shipping",selected:x.selectedCouponType===a.FREE_SHIPPING}],C=[{selected:x.selectedMinimumRequirement===o.NA,label:"No minimum requirements",value:o.NA},{selected:x.selectedMinimumRequirement===o.AMOUNT,label:`Minimum purchase amount (${null!==(E=x.currency)&&void 0!==E?E:"₹"})`,value:o.AMOUNT},{selected:x.selectedMinimumRequirement===o.QUANTITY,label:"Minimum quantity of items",value:o.QUANTITY}],N=()=>{var i,n,s,a;return e("div",Object.assign({className:"input__rows"},{children:[e("div",Object.assign({className:"input__wrapper"},{children:[t(c,Object.assign({style:{marginBottom:10}},{children:"Min purchase requirements"})),t(r,{options:C,placement:"bottom-start",onSelect:e=>{const t=e.value;x.setSelectedMinimumRequirement(t),x.setDiscountData(Object.assign(Object.assign({},x.discountData),{minQuantity:void 0,minAmount:void 0}))}})]})),t("div",Object.assign({className:"input__wrapper"},{children:x.selectedMinimumRequirement!==o.NA&&t(b,{value:x.selectedMinimumRequirement===o.AMOUNT?null!==(n=null===(i=x.discountData.minAmount)||void 0===i?void 0:i.toString())&&void 0!==n?n:"":null!==(a=null===(s=x.discountData.minQuantity)||void 0===s?void 0:s.toString())&&void 0!==a?a:"",onChangeText:e=>{x.selectedMinimumRequirement===o.AMOUNT?x.setDiscountData(Object.assign(Object.assign({},x.discountData),{minAmount:parseInt(e)})):x.selectedMinimumRequirement===o.QUANTITY&&x.setDiscountData(Object.assign(Object.assign({},x.discountData),{minQuantity:parseInt(e)}))},labelText:x.selectedMinimumRequirement===o.AMOUNT?"Minimum purchase amount":"Minimum purchase quantity",type:"number",placeholder:x.selectedMinimumRequirement===o.AMOUNT?"1000.00":"2"})}))]}))},f=n=>{var a,o;const r=n===T.ENTITLED?x.entitledProducts:x.prerequisiteProducts;return e(i,{children:[t(l,{children:n===T.PREREQUISITE?"Customer spends":"Customer gets"}),e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:n===T.ENTITLED?null===(a=x.discountData.entitledQuantity)||void 0===a?void 0:a.toString():null===(o=x.discountData.prerequisiteQuantity)||void 0===o?void 0:o.toString(),type:"number",onChangeText:e=>{n===T.ENTITLED?x.setDiscountData(Object.assign(Object.assign({},x.discountData),{entitledQuantity:parseInt(e)})):x.setDiscountData(Object.assign(Object.assign({},x.discountData),{prerequisiteQuantity:parseInt(e)}))},labelText:"Add quantity",placeholder:"Add quantity"})})),t("div",{className:"input__wrapper"})]})),t("div",{children:t(s,{buttonText:"Add product",buttonType:"tertiary",LeadingIcon:y,onClick:()=>{x.setIsProductPickerOpen(n)}})}),r.map((i=>e("div",Object.assign({style:{padding:"20px 0 12px 0",borderBottom:`1px solid ${m.colorsV2.stroke.primary}`,display:"flex"}},{children:[e("div",Object.assign({style:{display:"flex",gap:16,alignItems:"center",flex:.8}},{children:[t("img",{src:i.image,onError:e=>{e.target.onerror=null,e.target.src="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg"},style:{height:40,width:40,objectFit:"cover",borderRadius:4}}),t(p,{children:i.name})]})),t("div",Object.assign({style:{flex:.2,display:"flex",justifyContent:"flex-end",alignItems:"center"}},{children:t("div",Object.assign({style:{cursor:"pointer"},onClick:()=>{const e=r.filter((e=>e.id!==i.id));n===T.ENTITLED?x.setEntitledProducts(e):x.setPrerequisiteProducts(e)}},{children:t(g,{width:14,color:m.colorsV2.content.primary})}))}))]}),i.id)))]})};return e(v,{children:[x.allowStaticCoupon&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(r,{options:_,width:"290px",placement:"bottom-start",onSelect:e=>{x.onChangeCouponType(e)}})})),t("div",{className:"input__wrapper"})]})),(x.selectedCouponType===a.PERCENTAGE||x.selectedCouponType===a.FIXED_AMOUNT)&&(()=>{var n,s,o,r;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:x.discountData.title,onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{title:e}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"})})),t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:null===(s=null===(n=x.discountData)||void 0===n?void 0:n.value)||void 0===s?void 0:s.toString(),labelText:"Discount code value",type:"number",onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:parseInt(e)}))},placeholder:x.selectedCouponType===a.FIXED_AMOUNT?"0.00":"Enter a value",prefixText:x.selectedCouponType===a.FIXED_AMOUNT?null!==(o=x.currency)&&void 0!==o?o:"₹":void 0,suffixText:x.selectedCouponType===a.PERCENTAGE?"%":void 0})}))]})),N(),!x.hideProbability&&e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{type:"number",value:null===(r=x.discountData.probability)||void 0===r?void 0:r.toString(),onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{probability:e.startsWith(".")?parseFloat(`0${e}`):parseFloat(e)}))},labelText:"Probability",placeholder:"Enter probability in decimals eg: 0.2, 0.5, 0.75"})})),t("div",{className:"input__wrapper"})]}))]})})(),x.selectedCouponType===a.FREE_SHIPPING&&(()=>{var n;return e(i,{children:[e("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(b,{value:x.discountData.title,onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{title:e}))},labelText:"Code title",placeholder:"eg: Flat 50% Off",maxCharLimit:18})})),t("div",Object.assign({className:"input__wrapper"},{children:!x.hideProbability&&t(b,{value:null===(n=x.discountData.probability)||void 0===n?void 0:n.toString(),type:"number",onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{probability:e.startsWith(".")?parseFloat(`0${e}`):parseFloat(e)}))},labelText:"Probability",placeholder:"Enter probability in decimals eg: 0.2, 0.5, 0.75"})}))]})),N()]})})(),x.selectedCouponType===a.BUY_X_GET_Y&&(()=>{var i;return e(v,{children:[t("div",Object.assign({className:"input__rows"},{children:e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:20,flex:1}},{children:[t(b,{value:x.discountData.title,onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{title:e}))},maxCharLimit:18,labelText:"Code title",placeholder:"eg: Flat 50% Off"}),!x.hideProbability&&t(b,{value:null===(i=x.discountData.probability)||void 0===i?void 0:i.toString(),type:"number",onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{probability:e.startsWith(".")?parseFloat(`0${e}`):parseFloat(e)}))},labelText:"Probability",placeholder:"Enter probability in decimals eg: 0.2, 0.5, 0.75"})]}))})),t(O,{}),f(T.PREREQUISITE),t(O,{}),f(T.ENTITLED),t(O,{}),t(l,{children:"At a discount value"}),e("div",Object.assign({style:{display:"flex",gap:18,alignItems:"center"}},{children:[t(D,{isActive:100!==x.discountData.value,onValueChange:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:void 0}))}}),t(c,{children:"Percentage"}),100!==x.discountData.value&&t(b,{variant:"small",onChangeText:e=>{x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Enter percentage eg: 10%",suffixText:"%",width:"238px"})]})),e("div",Object.assign({style:{display:"flex",gap:18}},{children:[t(D,{isActive:100===x.discountData.value,onValueChange:e=>{e?x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:100})):x.setDiscountData(Object.assign(Object.assign({},x.discountData),{value:void 0}))}}),t(c,{children:"Free"})]}))]})})(),x.selectedCouponType&&!x.hideExpiration&&e(i,{children:[t("div",{style:{height:6,borderTop:`1px solid ${m.colorsV2.stroke.primary}`,marginTop:12}}),t(j,{discountData:x.discountData,setDiscountData:x.setDiscountData})]}),!x.selectedCouponType&&e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:10,padding:"40px 0",justifyContent:"center",alignItems:"center"}},{children:[t("div",Object.assign({style:{height:52,width:52,backgroundColor:m.colorsV2.background.inverse,borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"}},{children:t(h,{width:32,color:m.colorsV2.content.primaryInverse})})),t(d,{children:"No discount has been selected"}),t(u,{children:"Please select a discount type"})]}))]})};export{T as DISCOUNT_PRODUCTS,x as default};
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OpenDropdownProps } from '../type';
|
|
3
|
-
export type DropdownProps = OpenDropdownProps & {
|
|
4
|
-
isLoading?: boolean;
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
onDropdownVisbilityChange?: (isOpen: boolean) => void;
|
|
8
|
-
};
|
|
9
3
|
export declare const DropdownPopover: React.ForwardRefExoticComponent<OpenDropdownProps & {
|
|
10
4
|
isLoading?: boolean | undefined;
|
|
11
5
|
children?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../../_virtual/_tslib.js";import{jsxs as o,Fragment as r,jsx as n}from"react/jsx-runtime";import
|
|
1
|
+
import{__rest as e}from"../../../_virtual/_tslib.js";import{jsxs as o,Fragment as r,jsx as n}from"react/jsx-runtime";import l,{useState as t,useImperativeHandle as i,useEffect as s}from"react";import{usePopper as p}from"react-popper";import d from"../../dropShadow/DropShadow.js";import{OverLapAbs as a,OpenDropdownContainer as c}from"../Common.styled.js";import{OpenedDropdown as m}from"../OpenedDropdown/components/OpennedDropdown.js";const u=l.forwardRef(((l,u)=>{var{children:v,onDropdownVisbilityChange:b,version:f="1.0"}=l,j=e(l,["children","onDropdownVisbilityChange","version"]);const w=u,[g,h]=t(!1),[y,D]=t(null),[O,S]=t(null),{styles:C,attributes:x}=p(y,O,{placement:j.placement,strategy:j.strategy});return i(w,(()=>({openDropdown:g})),[]),s((()=>{(null==w?void 0:w.current)&&(w.current.openDropdown=g)}),[g]),s((()=>{null==b||b(g)}),[g]),o(r,{children:[o("div",Object.assign({style:{position:"relative"},ref:D},{children:[n(a,{disabled:j.disabled,onClick:e=>{g?e.preventDefault():j.disabled||h(!0)}}),v]})),g&&n(c,Object.assign({ref:S,style:Object.assign(Object.assign({},C.popper),{zIndex:3})},x.popper,{children:n(d,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:n(m,Object.assign({},j,{onSelect:e=>{var o;"2.0"===f&&j.isMultiSelect||(null===(o=j.onSelect)||void 0===o||o.call(j,e),h(!1))},onClose:e=>{var o,r;"2.0"===f&&j.isMultiSelect&&e&&(null===(o=j.onSelect)||void 0===o||o.call(j,[...e])),h(!1),null===(r=null==j?void 0:j.onClose)||void 0===r||r.call(j)},version:f}))}))}))]})}));u.displayName="DropdownPopover";export{u as DropdownPopover};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import t from"../../../assets/icons/horizontal_dots.svg.js";import e from"../../../assets/icons/vertical_dots.svg.js";import n from"styled-components";import{DropdownPopover as r}from"../DropdownPopover/index.js";import"../Dropdown.js";import"react";import"../../zeroState/ZeroState.js";import"../../TypographyStyle.js";import{COLORS as s}from"../../../constants/Theme.js";import"../OpenedDropdown/components/description/Description.styled.js";import"../../checkBox/CheckBox.styled.js";import"../../list-item/ListItem.js";import"../OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../OpenedDropdown/components/menu/MenuItem.js";import"../OpenedDropdown/components/menu/MenuList.styled.js";import"../../button/Button.js";import"../OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../OpenedDropdown/components/OpennedDropdown.styled.js";import"../../input/Input.js";import{IconButton as p}from"../../icon-button/IconButton.js";const i=n.div`
|
|
2
2
|
:hover {
|
|
3
3
|
background: ${s.surface.subdued};
|
|
4
4
|
}
|
|
5
|
-
`,m=n=>o(i,{children:o(r,Object.assign({},n,{children:o("div",{children:o(p,{Icon:n.isHorizontal?e
|
|
5
|
+
`,m=n=>o(i,{children:o(r,Object.assign({},n,{children:o("div",{children:o(p,{Icon:n.isHorizontal?t:e,bordered:!(null==n?void 0:n.hideBorder)})})}))});m.displayName="MenuItemDropdown";export{m as MenuItemDropdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as r}from"react";import{ZeroState as i}from"../../../zeroState/ZeroState.js";import{useOutside as s}from"../../../../hooks/useOutside.js";import{useDropdown as l}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as p}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as g}from"./searchbox/SearchZeroState.js";const S=304,b=290,j=j=>{let{options:v,isSearchable:w,isMultiSelect:y,width:O,allowFreeForm:x,height:C,onClose:M,onSelect:D,onSearch:L,version:F,skipSorting:k}=j;const{dropdownOptions:A,search:H,searchedString:B,searchedOptions:Z,onApplyHandler:q,selectAllHandler:z,onMultiSelectClear:E,onFreeFormSelect:I,onMultiSelectApply:K,latestDropdownOptionsRef:N}=l(F,v,D,k,y,L),[P,R]=o(null!=O?O:b),[T,W]=o(null),G=n(null);s(G,(()=>{if(W(null),y&&"2.0"===F){const e=(e=>{const t=[];return e.forEach((e=>{if(e.options){const o=e.options.filter((e=>!0===e.selected));t.push(Object.assign(Object.assign({},e),{options:[...o]}))}else e.selected&&t.push(Object.assign({},e))})),t})(N.current);null==M||M(e)}else null==M||M(A)}));const J=null!=C?C:S,Q="number"==typeof J?w&&y?J-96:w&&!y||!w&&y?J-48:J:J;r((()=>{const e=null!=O?O:b;if(null===T)R(e);else if("number"==typeof e)R(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));R(t)}}),[T]);const U=[],V=(B&&L?Z:A).map((e=>{var t,o;if(B&&!L){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(B.toLowerCase()))&&(U.push(!B||e.label===B),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(B.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(B.toLowerCase()))?(U.push(!B||e.label===B),e):null}return e})).filter((e=>null!==e)),X=!!w&&B&&0===V.length;return e(h,Object.assign({version:F,ref:G,style:{width:P}},{children:[e("div",Object.assign({style:{width:T?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!w&&t(f,{onSearch:H,version:F}),V.length||B?e(m,Object.assign({minHeight:J,maxHeight:Q},{children:[!!y&&!X&&t(u,{version:F,options:B&&L?Z:A,onSelect:z}),!x&&X&&t(g,{height:Q,searchedString:B}),x&&(X||!!U.length&&U.every((e=>!1===e)))&&t(a,{version:F,isMultiSelect:y,onSelect:I,searchedString:B}),t(p,{version:F,onSelect:q,showDescription:function(e,t){W(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:V})]})):t("div",Object.assign({style:{height:J,display:"flex"}},{children:t(i,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!y&&!(!V.length&&!B)&&"2.0"!==F&&t(d,{onClear:E,onApply:K,list:B&&L?Z:A})]})),!!T&&t(c,{title:T.title,description:T.description,version:F})]}))};export{j as OpenedDropdown};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export declare const OpennedDropdownContainer: import("styled-components").StyledComponent<"div", any, {
|
|
1
|
+
export declare const OpennedDropdownContainer: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
version?: "1.0" | "2.0" | undefined;
|
|
3
|
+
}, never>;
|
|
2
4
|
export declare const ItemContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
5
|
export declare const MenuListContainer: import("styled-components").StyledComponent<"div", any, {
|
|
4
6
|
maxHeight: number | string;
|
|
@@ -1,39 +1,25 @@
|
|
|
1
|
-
import o from"styled-components";import{COLORS as
|
|
2
|
-
border-radius:
|
|
3
|
-
border:
|
|
1
|
+
import o from"styled-components";import{COLORS as e}from"../../../../constants/Theme.js";const r=o.div`
|
|
2
|
+
border-radius: ${o=>"2.0"===o.version?8:4}px;
|
|
3
|
+
border: ${o=>"2.0"===o.version?0:1}px solid
|
|
4
|
+
${e.stroke.primary};
|
|
4
5
|
max-height: 640px;
|
|
5
6
|
overflow: hidden;
|
|
6
7
|
display: flex;
|
|
7
8
|
flex-direction: row;
|
|
8
9
|
position: relative;
|
|
10
|
+
padding: ${o=>"2.0"===o.version?4:0}px;
|
|
11
|
+
background-color: ${e.surface.standard};
|
|
9
12
|
`;o.div`
|
|
10
13
|
padding: 14px 16px 14px 18px;
|
|
11
14
|
flex-direction: row;
|
|
12
15
|
align-items: center;
|
|
13
16
|
border-bottom-width: 1px;
|
|
14
17
|
border-bottom-style: solid;
|
|
15
|
-
border-bottom-color: ${
|
|
18
|
+
border-bottom-color: ${e.stroke.primary};
|
|
16
19
|
width: 100%;
|
|
17
20
|
height: 100%;
|
|
18
|
-
`;const
|
|
21
|
+
`;const i=o.div`
|
|
19
22
|
max-height: ${o=>"number"==typeof o.maxHeight?`${o.maxHeight}px`:o.maxHeight};
|
|
20
|
-
overflow-y:
|
|
23
|
+
overflow-y: auto;
|
|
21
24
|
position: relative;
|
|
22
|
-
|
|
23
|
-
overflow-y: scroll;
|
|
24
|
-
}
|
|
25
|
-
&::-webkit-scrollbar-thumb {
|
|
26
|
-
border-radius: 4px;
|
|
27
|
-
width: 6px;
|
|
28
|
-
}
|
|
29
|
-
&::-webkit-scrollbar {
|
|
30
|
-
width: 6px;
|
|
31
|
-
}
|
|
32
|
-
&::-webkit-scrollbar-track {
|
|
33
|
-
width: 6px;
|
|
34
|
-
}
|
|
35
|
-
&:hover::-webkit-scrollbar-thumb {
|
|
36
|
-
background-color: #777;
|
|
37
|
-
width: 6px;
|
|
38
|
-
}
|
|
39
|
-
`;export{e as MenuListContainer,t as OpennedDropdownContainer};
|
|
25
|
+
`;export{i as MenuListContainer,r as OpennedDropdownContainer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as
|
|
1
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{TitleRegular as r,BodySecondary as o}from"../../../../TypographyStyle.js";import{COLORS as i}from"../../../../../constants/Theme.js";import{DescriptionContainer as n}from"./Description.styled.js";const s=s=>{let{title:c,description:l,version:m}=s;return t(n,Object.assign({version:m},{children:e("div",Object.assign({style:{padding:"2.0"===m?12:24}},{children:[t(r,Object.assign({style:{color:i.content.primary,marginBottom:4}},{children:c})),t(o,Object.assign({style:{color:i.content.secondary}},{children:l}))]}))}))};export{s as Description};
|
package/dist/esm/components/dropdown/OpenedDropdown/components/description/Description.styled.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import o from"styled-components";import{COLORS as r}from"../../../../../constants/Theme.js";const t=o.div`
|
|
2
2
|
background: ${r.surface.standard};
|
|
3
|
-
border-left:
|
|
3
|
+
border-left: ${o=>"2.0"===o.version?.5:1}px solid
|
|
4
|
+
${r.stroke.primary};
|
|
4
5
|
width: 50%;
|
|
5
6
|
`;export{t as DescriptionContainer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t}from"react/jsx-runtime";import{useState as o}from"react";import{CheckBox as r}from"../../../../checkBox/CheckBox.js";import{ListItem as
|
|
1
|
+
import{jsx as e,Fragment as t}from"react/jsx-runtime";import{useState as o}from"react";import{CheckBox as r}from"../../../../checkBox/CheckBox.js";import{ListItem as i}from"../../../../list-item/ListItem.js";import{BodyCaption as n}from"../../../../TypographyStyle.js";import{COLORS as s}from"../../../../../constants/Theme.js";import{FreeFormContainer as c}from"./FreeFormMenu.styled.js";const m=m=>{let{searchedString:l,onSelect:a,isMultiSelect:p,version:f}=m;const[h,u]=o(!1);function d(){u(!h),a(!h)}return e(i,{version:f,onClick:e=>{e.preventDefault(),d()},listItem:{label:l,value:l},leadingIcon:p?e(r,{size:"2.0"===f?"SMALL":"DEFAULT",isChecked:h,onValueChange:d}):e(t,{}),trailingIcon:e(c,{children:e(n,Object.assign({style:{color:s.content.secondary}},{children:"Freeform"}))})})};export{m as FreeFormMenu};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t}from"react/jsx-runtime";import
|
|
2
|
-
padding: 14px 16px !important;
|
|
1
|
+
import{jsx as e,Fragment as t}from"react/jsx-runtime";import n from"styled-components";import{CheckBox as o}from"../../../../checkBox/CheckBox.js";import{ListItem as i}from"../../../../list-item/ListItem.js";import{BodyCaption as s}from"../../../../TypographyStyle.js";import{COLORS as r}from"../../../../../constants/Theme.js";import{FreeFormContainer as l}from"./FreeFormMenu.styled.js";const c=n(i)`
|
|
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
|
+
`,a=n=>{let{option:i,isMultiSelect:a,showDescription:d,onSelect:m,last:p,version:u}=n;var g;function b(e){i.disabled||m(Object.assign(Object.assign({},i),{selected:e}))}return e(c,{version:u,style:p?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),b(!i.selected)},onMouseOver:function(){i.description?d(i.label,i.description):d()},listItem:{value:i.value,label:i.label},subText:i.subText,leadingIcon:a?e("div",Object.assign({style:{width:18,display:"flex",alignContent:"center",justifyContent:"center"}},{children:e(o,{size:"2.0"===u?"SMALL":"DEFAULT",isDisabled:null!==(g=i.disabled)&&void 0!==g&&g,isChecked:!!i.selected,onValueChange:b})})):i.leadingIcon?e(t,{children:i.leadingIcon}):e(t,{}),customComponent:i.customComponent,trailingIcon:i.isFreeForm?e(l,{children:e(s,Object.assign({style:{color:r.content.secondary}},{children:"Freeform"}))}):i.trailingIcon?e(t,{children:i.trailingIcon}):e(t,{}),variant:i.disabled?"inactive":i.selected?"selected":"default"})};export{a as MenuItem};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,Fragment as e,jsxs as
|
|
1
|
+
import{jsx as t,Fragment as e,jsxs as i}from"react/jsx-runtime";import{MenuItem as o}from"./MenuItem.js";import{StyledGroupedLabel as n}from"./MenuList.styled.js";const s=s=>{let{options:r,isMultiSelect:l,showDescription:c,onSelect:p,version:m}=s;return t(e,{children:r.map(((e,s)=>{const a=s===r.length-1;if(e.options){const r=e;return i("div",Object.assign({style:{marginTop:"2.0"===m?2:0}},{children:[t(n,Object.assign({version:m},{children:r.label})),r.options.map(((e,i)=>t(o,{version:m,last:a,onSelect:p,showDescription:c,isMultiSelect:l,option:e},i)))]}),s)}return t(o,{version:m,last:a,onSelect:p,showDescription:c,isMultiSelect:l,option:e},s)}))})};export{s as MenuList};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import o from"styled-components";import{BodyCaption as r}from"../../../../TypographyStyle.js";import{COLORS as
|
|
2
|
-
padding: 8px
|
|
3
|
-
color: ${
|
|
4
|
-
background-color: ${
|
|
5
|
-
|
|
1
|
+
import o from"styled-components";import{BodyCaption as r}from"../../../../TypographyStyle.js";import{COLORS as n}from"../../../../../constants/Theme.js";const e=o(r)`
|
|
2
|
+
padding: 8px ${o=>"2.0"===o.version?12:16}px;
|
|
3
|
+
color: ${o=>"2.0"===o.version?n.content.placeholder:n.content.secondary};
|
|
4
|
+
background-color: ${o=>"2.0"===o.version?n.surface.standard:n.background.base};
|
|
5
|
+
font-size: ${o=>"2.0"===o.version?10:12}px;
|
|
6
|
+
`;export{e as StyledGroupedLabel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useState as t,useEffect as l}from"react";import
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useState as t,useEffect as l}from"react";import{CheckBox as o}from"../../../../checkBox/CheckBox.js";import{ListItem as i}from"../../../../list-item/ListItem.js";const c=c=>{let{options:n,onSelect:r,version:s}=c;const[a,d]=t("notSelected");function p(){"partiallySelected"===a&&r("notSelected"),"selectAll"===a&&r("notSelected"),"notSelected"===a&&r("selectAll")}return l((()=>{const e=[];n.filter((e=>!e.disabled)).forEach((t=>{t.options?t.options.filter((e=>!e.disabled)).forEach((t=>{e.push(t.selected||!1)})):e.push(t.selected||!1)})),e.every(Boolean)?d("selectAll"):e.filter(Boolean).length>0?d("partiallySelected"):d("notSelected")}),[n]),e(i,{version:s,onClick:e=>{e.preventDefault(),p()},listItem:{label:"Select All",value:"All"},leadingIcon:e("div",Object.assign({style:{width:18}},{children:e(o,{size:"2.0"===s?"SMALL":"DEFAULT",isChecked:"selectAll"===a||"partiallySelected"===a,isPartiallyChecked:"partiallySelected"===a,onValueChange:p})})),variant:"default"})};export{c as SelectAllMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{Button as o}from"../../../../button/Button.js";import{BodySecondary as r}from"../../../../TypographyStyle.js";import{COLORS as l}from"../../../../../constants/Theme.js";import{BottomBarContainer as n}from"./MultiSelectDropdownBottomBar.styled.js";const s=s=>{let{onApply:i,onClear:c,list:p}=s;const a=p.reduce(((t,e)=>{if(e.options){return t+e.options.filter((t=>!0===t.selected)).length}return e.selected?t+1:t}),0);return t(n,Object.assign({style:{justifyContent:"space-between"}},{children:[e(r,Object.assign({style:{flex:1,color:l.content.primary}},{children:a?`${a} selected`:""})),t("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[e(o,{size:"small",buttonType:"tertiaryGray",buttonText:"Clear",onClick:c}),e(o,{size:"small",buttonText:"Apply",onClick:i})]}))]}))};export{s as default};
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{Button as o}from"../../../../button/Button.js";import{BodySecondary as r}from"../../../../TypographyStyle.js";import{COLORS as l}from"../../../../../constants/Theme.js";import{BottomBarContainer as n}from"./MultiSelectDropdownBottomBar.styled.js";const s=s=>{let{onApply:i,onClear:c,list:p}=s;const a=p.reduce(((t,e)=>{if(e.options){return t+e.options.filter((t=>!0===t.selected)).length}return e.selected?t+1:t}),0);return t(n,Object.assign({style:{justifyContent:"space-between"}},{children:[e(r,Object.assign({style:{flex:1,color:l.content.primary}},{children:a?`${a} selected`:""})),t("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[e(o,{size:"small",buttonType:"tertiaryGray",buttonText:"Clear",onClick:c}),e(o,{size:"small",buttonText:"Apply",onClick:()=>{i()}})]}))]}))};export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,Fragment as r}from"react/jsx-runtime";import{useState as t}from"react";import{Input as e}from"../../../../input/Input.js";import{InputStyleContext as n}from"../../../../input/context/InputStyleProvider.js";import{COLORS as i}from"../../../../../constants/Theme.js";import s from"../../../../../assets/icons/cross.svg.js";import c from"../../../../../assets/icons/search.svg.js";const p=p=>{let{onSearch:a,version:m}=p;const[l,h]=t(""),[d,g]=t(!1);return o(n.Provider,Object.assign({value:{InputWrapper:{borderRadius:0,border:0,borderBottom:`${"2.0"===m?.5:1}px solid ${i.stroke.primary}`,padding:""+("2.0"===m?"6px 8px":"14px 16px"),marginBottom:4},IconHolder:{marginLeft:0},input:{marginLeft:4,minHeight:"100%"}}},{children:o(e,{noKeyDownChange:!0,skipFocus:!0,placeholder:"Search",variant:"2.0"===m?"small":"default",leftIcon:{icon:()=>o(c,{width:"2.0"===m?18:24,height:"2.0"===m?18:24,color:i.content.placeholder})},rightIcon:{icon:()=>l?o(s,{onClick:()=>{g(!0),a(""),h("")},width:24,height:24,color:i.content.placeholder}):o(r,{})},reset:d,onChangeText:o=>{g(!1),h(o),a(o)}})}))};export{p as SearchBox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{ZeroState as t}from"../../../../zeroState/ZeroState.js";const r=r=>{let{searchedString:i,height:o}=r;return e("div",Object.assign({style:{height:o,display:"flex",alignItems:"center"}},{children:e(t,{title:"No results found",subTitle:`Sorry we could not find any results for "${null!=i?i:""}"`})}))};export{r as SearchZeroState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function s(s,n,t){return s.map((s=>{if(s.options){const i=s.options.map((s=>!t||t(s)?Object.assign(Object.assign({},s),n):Object.assign({},s)));return Object.assign(Object.assign({},s),{options:[...i]})}return!t||t(s)?Object.assign(Object.assign({},s),n):Object.assign({},s)}))}export{s as iterateOnOptions};
|
|
1
|
+
function s(s,n,t){return s.map((s=>{if(s.options){const i=s.options.map((s=>!t||t(s)?Object.assign(Object.assign({},s),n):Object.assign({},s)));return Object.assign(Object.assign({},s),{options:[...i]})}return!t||t(s)?Object.assign(Object.assign({},s),n):Object.assign({},s)}))}function n(s,n){s.forEach((s=>{s.options?s.options.forEach(n):n(s)}))}export{s as iterateOnOptions,n as iterateOnOptionsRaw};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectAllCheckboxState } from '../OpenedDropdown/components/menu/SelectAllMenu';
|
|
3
|
+
import { DropdownOption, SingleOption } from '../type';
|
|
4
|
+
export declare const useDropdown: (version: string | undefined, options: DropdownOption[], onSelect: ((option: DropdownOption | DropdownOption[]) => void) | undefined, skipSorting?: boolean, isMultiSelect?: boolean, onSearch?: ((searchKey: string) => Promise<DropdownOption[]>) | undefined) => {
|
|
5
|
+
latestDropdownOptionsRef: import("react").MutableRefObject<DropdownOption[]>;
|
|
6
|
+
dropdownOptions: DropdownOption[];
|
|
7
|
+
search: (searchKey: string) => void;
|
|
8
|
+
searchedString: string;
|
|
9
|
+
searchedOptions: DropdownOption[];
|
|
10
|
+
onApplyHandler: (optionSelect: SingleOption, returnOnly?: boolean) => ({
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
description?: string | null | undefined;
|
|
14
|
+
selected?: boolean | undefined;
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
isFreeForm?: boolean | undefined;
|
|
17
|
+
subText?: string | undefined;
|
|
18
|
+
trailingIcon?: JSX.Element | undefined;
|
|
19
|
+
leadingIcon?: JSX.Element | undefined;
|
|
20
|
+
customComponent?: JSX.Element | undefined;
|
|
21
|
+
searchKey?: string | undefined;
|
|
22
|
+
} | {
|
|
23
|
+
label?: string | undefined;
|
|
24
|
+
value?: string | undefined;
|
|
25
|
+
description?: string | null | undefined;
|
|
26
|
+
selected?: boolean | undefined;
|
|
27
|
+
disabled?: boolean | undefined;
|
|
28
|
+
isFreeForm?: boolean | undefined;
|
|
29
|
+
subText?: string | undefined;
|
|
30
|
+
trailingIcon?: JSX.Element | undefined;
|
|
31
|
+
leadingIcon?: JSX.Element | undefined;
|
|
32
|
+
customComponent?: JSX.Element | undefined;
|
|
33
|
+
searchKey?: string | undefined;
|
|
34
|
+
options: SingleOption[];
|
|
35
|
+
})[] | undefined;
|
|
36
|
+
selectAllHandler: (newState: SelectAllCheckboxState) => void;
|
|
37
|
+
onMultiSelectClear: () => void;
|
|
38
|
+
onFreeFormSelect: (selected: boolean) => void;
|
|
39
|
+
onMultiSelectApply: (options?: DropdownOption[]) => void;
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as e,useRef as t,useEffect as s}from"react";import{iterateOnOptionsRaw as l,iterateOnOptions as n}from"../OpenedDropdown/utils/iterationOnOptions.js";const c=function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"1.0",o=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,u=arguments.length>4?arguments[4]:void 0,d=arguments.length>5?arguments[5]:void 0;const[r,v]=e(null!=o?o:[]),[p,f]=e([]),[g,b]=e(""),O=t(r);s((()=>{if(O.current=r,p.length&&g&&d){let e=[...p];const t=r.map((e=>e.options?e.options.map((e=>({value:e.value,selected:e.selected}))):{value:e.value,selected:e.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})),f([...e])}}),[r]),s((()=>{if(o){const e=[...o];v(u&&!a?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[o]);const h=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};function j(e,t){if(u)if(p.length&&g&&d)if(e.selected){let s=!1;const l=n(r,{selected:e.selected},(t=>t.value===e.value&&(s=!0,!0)));if(s||l.push(e),t)return[...l];v([...l]),"2.0"===c&&m(l)}else{let s=!1,l=n(r,{selected:e.selected},(t=>t.value===e.value&&(s=!0,!0)));if(s&&(l=l.filter((t=>t.value!==e.value))),t)return[...l];v([...l]),"2.0"===c&&m(l)}else{const s=n(r,{selected:e.selected},(t=>t.value===e.value));if(t)return[...s];v([...s]),"2.0"===c&&m(s)}else null==i||i(e)}function m(e){const t=h(null!=e?e:O.current);null==i||i([...t])}return{latestDropdownOptionsRef:O,dropdownOptions:r,search:function(e){if(b(e),f([]),e&&d){const t=[];l(r,(e=>{e.selected&&!t.includes(e.value)&&t.push(e.value)})),d(e).then((e=>{if(e){const s=e.map((e=>{if(e.options){const s=e;return Object.assign(Object.assign({},s),{options:s.options.map((e=>Object.assign(Object.assign({},e),{selected:t.includes(e.value)})))})}return Object.assign(Object.assign({},e),{selected:t.includes(e.value)})}));f([...s])}}))}},searchedString:g,searchedOptions:p,onApplyHandler:j,selectAllHandler:function(e){if(p.length&&g&&d)!function(e){let t=[...r];e?p.forEach((e=>{let s=!1;t=t.map((t=>{const l=e;return void 0!==l.value&&l.value===t.value?(s=!0,Object.assign(Object.assign({},t),{selected:!0})):t})),s||t.push(Object.assign(Object.assign({},e),{selected:!0}))})):p.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}))})),v([...t]),"2.0"===c&&m(t)}("selectAll"===e);else if("selectAll"===e){const e=n(r,{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}));v([...e]),"2.0"===c&&m(e)}else if("notSelected"===e){const e=n(r,{selected:!1},(e=>!e.disabled));v([...e]),"2.0"===c&&m(e)}},onMultiSelectClear:function(){const e=n(r,{selected:!1});v([...e]),"2.0"===c&&m(e)},onFreeFormSelect:function(e){if(!u)return void j({label:g,value:g,isFreeForm:!0,selected:!0});const t=r.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===g&&t.value===g?e:t.selected})));e&&(t.some((e=>e.label===g&&e.value===g))||t.unshift({label:g,value:g,isFreeForm:!0,selected:!0})),v([...t]),"2.0"===c&&m(t)},onMultiSelectApply:m}};export{c as useDropdown};
|