@bikdotai/bik-component-library 0.0.209 → 0.0.210
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/components/Connectors/Components/InTheLast.js +1 -1
- 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/bik-layout/MockMenus.d.ts +1 -0
- 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/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/type.d.ts +3 -1
- package/dist/cjs/components/dropdown-button/DropdownButton.d.ts +2 -2
- 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 +1 -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/stepper/WorkingStepper.d.ts +1 -0
- 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/components/Connectors/Components/InTheLast.js +1 -1
- 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/bik-layout/MockMenus.d.ts +1 -0
- 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/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/type.d.ts +3 -1
- package/dist/esm/components/dropdown-button/DropdownButton.d.ts +2 -2
- 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 +1 -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/stepper/WorkingStepper.d.ts +1 -0
- 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
|
@@ -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"../dropdown/Dropdown.js";import{DropdownPopover as p}from"../dropdown/DropdownPopover/index.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"../dropdown/Dropdown.js";import{DropdownPopover as m}from"../dropdown/DropdownPopover/index.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"../dropdown/Dropdown.js";import{DropdownPopover as m}from"../dropdown/DropdownPopover/index.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 as l}from"../dropdown/Dropdown.js";import"../dropdown/DropdownPopover/index.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 as l}from"../dropdown/Dropdown.js";import"../dropdown/DropdownPopover/index.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 as r}from"../../dropdown/Dropdown.js";import"../../dropdown/DropdownPopover/index.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 as r}from"../../dropdown/Dropdown.js";import"../../dropdown/DropdownPopover/index.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 DropdownPopoverProps = 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"../Dropdown.js";import{DropdownPopover as r}from"../DropdownPopover/index.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,useEffect as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as s,useRef as l}from"react";import{ZeroState as n}from"../../../zeroState/ZeroState.js";import{useOutside as i}from"../../../../hooks/useOutside.js";import{iterateOnOptions as r}from"../utils/iterationOnOptions.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as u}from"./menu/FreeFormMenu.js";import{MenuList as a}from"./menu/MenuList.js";import{SelectAllMenu as d}from"./menu/SelectAllMenu.js";import p from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as f,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as h}from"./searchbox/SearchBox.js";import{SearchZeroState as b}from"./searchbox/SearchZeroState.js";const v=304,g=290,j=j=>{let{options:S,isSearchable:w,isMultiSelect:y,width:O,allowFreeForm:x,height:C,onClose:L,onSelect:F,version:M,skipSorting:D}=j;const[k,A]=o(null!=S?S:[]);s((()=>{if(S){const e=[...S];A(y&&!D?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[S]);const[B,H]=o(null!=O?O:g),[Z,q]=o(""),[z,E]=o(null),I=l(null),K=l(k),N=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};s((()=>{K.current=k}),[k]),i(I,(()=>{if(E(null),y&&"2.0"===M){const e=N(K.current);null==L||L(e)}else null==L||L(k)}));const P=null!=C?C:v,T="number"==typeof P?w&&y?P-96:w&&!y||!w&&y?P-48:P:P;function W(e){if(y){const t=r(k,{selected:e.selected},(t=>t.value===e.value));A([...t]),"2.0"===M&&G(t)}else null==F||F(e)}function G(e){const t=N(null!=e?e:K.current);null==F||F([...t])}s((()=>{const e=null!=O?O:g;if(null===z)H(e);else if("number"==typeof e)H(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));H(t)}}),[z]);const J=[],Q=k.map((e=>{var t,o;if(Z){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(Z.toLowerCase()))&&(J.push(!Z||e.label===Z),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(Z.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(Z.toLowerCase()))?(J.push(!Z||e.label===Z),e):null}return e})).filter((e=>null!==e)),R=!!w&&Z&&0===Q.length;return e(f,Object.assign({version:M,ref:I,style:{width:B}},{children:[e("div",Object.assign({style:{width:z?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!w&&t(h,{onSearch:function(e){q(e)},version:M}),Q.length||Z?e(m,Object.assign({minHeight:P,maxHeight:T},{children:[!!y&&!R&&t(d,{version:M,options:k,onSelect:function(e){if("selectAll"===e){const e=r(k,{selected:!0},(e=>{var t;return Z?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(Z.toLowerCase()))&&!e.disabled:!e.disabled}));A([...e]),"2.0"===M&&G(e)}else if("notSelected"===e){const e=r(k,{selected:!1},(e=>!e.disabled));A([...e]),"2.0"===M&&G(e)}}}),!x&&R&&t(b,{height:T,searchedString:Z}),x&&(R||!!J.length&&J.every((e=>!1===e)))&&t(u,{version:M,isMultiSelect:y,onSelect:function(e){if(!y)return void W({label:Z,value:Z,isFreeForm:!0,selected:!0});const t=k.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===Z&&t.value===Z?e:t.selected})));e&&(t.some((e=>e.label===Z&&e.value===Z))||t.unshift({label:Z,value:Z,isFreeForm:!0,selected:!0})),A([...t]),"2.0"===M&&G(t)},searchedString:Z}),t(a,{version:M,onSelect:W,showDescription:function(e,t){E(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:Q})]})):t("div",Object.assign({style:{height:P,display:"flex"}},{children:t(n,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!y&&!(!Q.length&&!Z)&&"2.0"!==M&&t(p,{onClear:function(){const e=r(k,{selected:!1});A([...e]),"2.0"===M&&G(e)},onApply:G,list:k})]})),!!z&&t(c,{title:z.title,description:z.description,version:M})]}))};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 o from"styled-components";import{CheckBox as i}from"../../../../checkBox/CheckBox.js";import{ListItem as n}from"../../../../list-item/ListItem.js";import{BodyCaption as
|
|
2
|
-
padding: 14px 16px !important;
|
|
1
|
+
import{jsx as e,Fragment as t}from"react/jsx-runtime";import o from"styled-components";import{CheckBox as i}from"../../../../checkBox/CheckBox.js";import{ListItem as n}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=o(n)`
|
|
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=o=>{let{option:n,isMultiSelect:a,showDescription:d,onSelect:m,last:p,version:u}=o;var b;function g(e){n.disabled||m(Object.assign(Object.assign({},n),{selected:e}))}return e(c,{version:u,style:p?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),g(!n.selected)},onMouseOver:function(){n.description?d(n.label,n.description):d()},listItem:{value:n.value,label:n.label},subText:n.subText,leadingIcon:a?e("div",Object.assign({style:{width:18}},{children:e(i,{size:"2.0"===u?"SMALL":"DEFAULT",isDisabled:null!==(b=n.disabled)&&void 0!==b&&b,isChecked:!!n.selected,onValueChange:g})})):n.leadingIcon?e(t,{children:n.leadingIcon}):e(t,{}),customComponent:n.customComponent,trailingIcon:n.isFreeForm?e(l,{children:e(s,Object.assign({style:{color:r.content.secondary}},{children:"Freeform"}))}):n.trailingIcon?e(t,{children:n.trailingIcon}):e(t,{}),variant:n.disabled?"inactive":n.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{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 i}from"../../../../input/context/InputStyleProvider.js";import{COLORS as n}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,d]=t(""),[h,g]=t(!1);return o(i.Provider,Object.assign({value:{InputWrapper:{borderRadius:0,border:0,borderBottom:`${"2.0"===m?.5:1}px solid ${n.stroke.primary}`,padding:""+("2.0"===m?"6px 8px":"14px 16px"),marginBottom:4},IconHolder:{marginLeft:0},input:{marginLeft:4,minHeight:"100%"}}},{children:o(e,{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:n.content.placeholder})},rightIcon:{icon:()=>l?o(s,{onClick:()=>{g(!0),a(""),d("")},width:24,height:24,color:n.content.placeholder}):o(r,{})},reset:h,onChangeText:o=>{g(!1),d(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};
|
|
@@ -9,10 +9,12 @@ export interface OpenDropdownProps {
|
|
|
9
9
|
width?: string;
|
|
10
10
|
height?: number | string;
|
|
11
11
|
allowFreeForm?: boolean;
|
|
12
|
-
onClose?: () => void;
|
|
12
|
+
onClose?: (selectedData?: DropdownOption | DropdownOption[]) => void;
|
|
13
13
|
onSelect?: (option: DropdownOption | DropdownOption[]) => void;
|
|
14
14
|
placement?: Placement;
|
|
15
15
|
strategy?: PositioningStrategy;
|
|
16
|
+
version?: '1.0' | '2.0';
|
|
17
|
+
skipSorting?: boolean;
|
|
16
18
|
}
|
|
17
19
|
export type GroupedOption = {
|
|
18
20
|
label?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { DropdownProps } from "../dropdown";
|
|
2
3
|
import { ButtonProps } from '../button/model';
|
|
3
|
-
import { DropdownPopoverProps } from '../dropdown/DropdownPopover';
|
|
4
4
|
export interface DropdownButtonProps {
|
|
5
|
-
dropdownProps:
|
|
5
|
+
dropdownProps: DropdownProps;
|
|
6
6
|
buttonProps: ButtonProps;
|
|
7
7
|
iconProps: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as o,jsx as t}from"react/jsx-runtime";import"../dropdown/Dropdown.js";import{DropdownPopover as e}from"../dropdown/DropdownPopover/index.js";import"react";import"../zeroState/ZeroState.js";import"../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 o,jsx as t}from"react/jsx-runtime";import"../dropdown/Dropdown.js";import{DropdownPopover as e}from"../dropdown/DropdownPopover/index.js";import"react";import"../zeroState/ZeroState.js";import"../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 as r}from"../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{DropdownButtonStyle as p}from"./DropdownButton.style.js";const n=n=>o(p,Object.assign({type:n.buttonProps.buttonType,disabled:n.buttonProps.disabled},{children:[t(r,Object.assign({},n.buttonProps,{style:{borderRadius:"0px",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px"}})),t("div",{className:"divider"}),t(e,Object.assign({},n.dropdownProps,{children:t(r,Object.assign({},n.buttonProps,{buttonText:"",TrailingIcon:n.iconProps,style:{borderRadius:"0px",borderTopRightRadius:"4px",borderBottomRightRadius:"4px"}}))}))]}));export{n as DropdownButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{OpenedDropdown as o}from"../dropdown/OpenedDropdown/components/OpennedDropdown.js";import{FloatingActionButton as n}from"../floating-action-button/FloatingActionButton.js";import"../floating-action-button/FloatingActionButton.styles.js";const i=i=>{const{onSelect:e,menuOptions:d,buttonWidth:r,buttonHeight:l,buttonColor:p,buttonPosition:u,menuWidth:
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{OpenedDropdown as o}from"../dropdown/OpenedDropdown/components/OpennedDropdown.js";import{FloatingActionButton as n}from"../floating-action-button/FloatingActionButton.js";import"../floating-action-button/FloatingActionButton.styles.js";const i=i=>{const{onSelect:e,menuOptions:d,buttonWidth:r,buttonHeight:l,buttonColor:p,buttonPosition:u,menuWidth:s,menuHeight:c,buttonIcon:a,buttonPaddingHorizontal:m,buttonPaddingVertical:g,tooltipPlacement:h,tooltipText:b,zIndex:P,isRound:x,dropPosition:f,menuAligment:j,tooltipWidth:w}=i;return t("div",{children:t(n,Object.assign({icon:a,width:r,height:l,color:p,position:u,buttonPaddingHorizontal:m,buttonPaddingVertical:g,tooltipPlacement:h,tooltipText:b,zIndex:P,isRound:x,dropPosition:f,menuAligment:j,tootipWidth:w},{children:t(o,{options:d,height:c||90,width:`${s}px`,onSelect:e,version:i.version})}))})};export{i as FABMenu};
|