@bikdotai/bik-component-library 0.0.576-mldd-beta.0 → 0.0.577

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  2. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  3. package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  4. package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  5. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  6. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  7. package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  8. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +2 -2
  9. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +1 -1
  10. package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.js +1 -1
  11. package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +0 -4
  12. package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +0 -4
  13. package/dist/cjs/components/dropdown/type.d.ts +0 -2
  14. package/dist/cjs/components/input/Input.d.ts +2 -0
  15. package/dist/cjs/components/input/Input.js +1 -1
  16. package/dist/cjs/components/input/Input.styled.js +1 -1
  17. package/dist/cjs/components/list-item/ListItem.js +1 -1
  18. package/dist/cjs/components/searchBar/searchBar.d.ts +3 -0
  19. package/dist/cjs/components/searchBar/searchBar.js +1 -1
  20. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  21. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  22. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  23. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  24. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  25. package/dist/esm/components/dropdown/Dropdown.js +1 -1
  26. package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  27. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +2 -2
  28. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +1 -1
  29. package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.js +1 -1
  30. package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +0 -4
  31. package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +0 -4
  32. package/dist/esm/components/dropdown/type.d.ts +0 -2
  33. package/dist/esm/components/input/Input.d.ts +2 -0
  34. package/dist/esm/components/input/Input.js +1 -1
  35. package/dist/esm/components/input/Input.styled.js +1 -1
  36. package/dist/esm/components/list-item/ListItem.js +1 -1
  37. package/dist/esm/components/searchBar/searchBar.d.ts +3 -0
  38. package/dist/esm/components/searchBar/searchBar.js +1 -1
  39. package/package.json +1 -1
  40. package/dist/cjs/components/dropdown/MultilevelDropdownPopover/index.d.ts +0 -15
  41. package/dist/esm/components/dropdown/MultilevelDropdownPopover/index.d.ts +0 -15
@@ -1,5 +1,5 @@
1
- import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import n from"../../../../../assets/icons/chevronRight.svg.js";import o from"styled-components";import{CheckBox as l}from"../../../../checkBox/CheckBox.js";import{ListItem as r}from"../../../../list-item/ListItem.js";import{Tooltip as s}from"../../../../tooltips/Tooltip.js";import{BodyCaption as c}from"../../../../TypographyStyle.js";import{DEFAULT_THEME as a,COLORS as d}from"../../../../../constants/Theme.js";import{FreeFormContainer as p}from"./FreeFormMenu.styled.js";const m=o(r)`
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import i from"styled-components";import{CheckBox as o}from"../../../../checkBox/CheckBox.js";import{ListItem as s}from"../../../../list-item/ListItem.js";import{BodyCaption as r}from"../../../../TypographyStyle.js";import{COLORS as l}from"../../../../../constants/Theme.js";import{FreeFormContainer as c}from"./FreeFormMenu.styled.js";const a=i(s)`
2
2
  padding: ${e=>"2.0"===e.version?"8px 12px":"14px 16px"} !important;
3
3
  cursor: pointer;
4
4
  margin-top: ${e=>"2.0"===e.version?"2px":"0"};
5
- `,g=o=>{let{option:r,isMultiSelect:g,showDescription:h,onSelect:u,last:v,version:b,onDropdownItemClick:f}=o;var j;const x=(e,t)=>{if(!e.children)if(y(!e.selected),t){const i=Object.assign(Object.assign({},e),{parent:t});null==f||f(i)}else null==f||f(e)};function y(e){r.disabled||u(Object.assign(Object.assign({},r),{selected:e}))}return e(t,{children:e(s,Object.assign({body:"",tooltipContent:r.children?e("div",Object.assign({style:{minWidth:"148px",padding:"1.0"===b?0:"4px",border:`1px solid ${"1.0"===b?a.colorsV2.stroke.primary:"none"}`}},{children:r.children.map(((i,n)=>{var o,l;return e(t,{children:e(m,{version:b,style:n===(null!==(l=null===(o=r.children)||void 0===o?void 0:o.length)&&void 0!==l?l:0)-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),x(i,r)},listItem:{value:i.value,label:i.label},subText:i.subText,leadingIcon:i.leadingIcon||void 0,customComponent:i.customComponent,trailingIcon:i.trailingIcon||void 0,variant:r.disabled?"inactive":i.selected?"selected":"default"})})}))})):e(t,{}),placement:"right",hideArrow:!0,variant:"light"},{children:e(m,{version:b,style:v?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),x(r)},onMouseOver:function(){r.description?h(r.label,r.description):h()},listItem:{value:r.value,label:r.label},subText:r.subText,leadingIcon:g?i("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e(l,{size:"2.0"===b?"SMALL":"DEFAULT",isDisabled:null!==(j=r.disabled)&&void 0!==j&&j,isChecked:!!r.selected,onValueChange:y}),e("div",Object.assign({style:{marginRight:"-4px"}},{children:r.leadingIcon}))]})):r.leadingIcon?e(t,{children:r.leadingIcon}):e(t,{}),customComponent:r.customComponent,trailingIcon:r.isFreeForm?e(p,{children:e(c,Object.assign({style:{color:d.content.secondary}},{children:"Freeform"}))}):r.children?e(n,{width:12,height:12}):r.trailingIcon?e(t,{children:r.trailingIcon}):e(t,{}),variant:r.disabled?"inactive":r.selected?"selected":"default"})}))})};export{g as MenuItem};
5
+ `,d=i=>{let{option:s,isMultiSelect:d,showDescription:m,onSelect:p,last:g,version:u,onDropdownItemClick:b}=i;var f;function h(e){s.disabled||p(Object.assign(Object.assign({},s),{selected:e}))}return e(a,{version:u,style:g?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),h(!s.selected),null==b||b(s)},onMouseOver:function(){s.description?m(s.label,s.description):m()},listItem:{value:s.value,label:s.label},subText:s.subText,leadingIcon:d?t("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e(o,{size:"2.0"===u?"SMALL":"DEFAULT",isDisabled:null!==(f=s.disabled)&&void 0!==f&&f,isChecked:!!s.selected,onValueChange:h}),e("div",Object.assign({style:{marginRight:"-4px"}},{children:s.leadingIcon}))]})):s.leadingIcon?e(n,{children:s.leadingIcon}):e(n,{}),customComponent:s.customComponent,trailingIcon:s.isFreeForm?e(c,{children:e(r,Object.assign({style:{color:l.content.secondary}},{children:"Freeform"}))}):s.trailingIcon?e(n,{children:s.trailingIcon}):e(n,{}),variant:s.disabled?"inactive":s.selected?"selected":"default"})};export{d as MenuItem};
@@ -1 +1 @@
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
+ 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,height: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 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
+ 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")},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,7 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { DropdownOption, SingleOption } from '../../type';
3
3
  export declare function iterateOnOptions(options: DropdownOption[], newVal: Partial<SingleOption>, checkCB?: (optionForValidation: SingleOption) => boolean): ({
4
- children?: SingleOption[] | undefined;
5
4
  label: string;
6
5
  value: string;
7
6
  description?: string | null | undefined;
@@ -14,9 +13,7 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
14
13
  customComponent?: JSX.Element | undefined;
15
14
  searchKey?: string | undefined;
16
15
  selectedLabel?: string | undefined;
17
- parent?: SingleOption | undefined;
18
16
  } | {
19
- children?: SingleOption[] | undefined;
20
17
  label?: string | undefined;
21
18
  value?: string | undefined;
22
19
  description?: string | null | undefined;
@@ -29,7 +26,6 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
29
26
  customComponent?: JSX.Element | undefined;
30
27
  searchKey?: string | undefined;
31
28
  selectedLabel?: string | undefined;
32
- parent?: SingleOption | undefined;
33
29
  options: SingleOption[];
34
30
  })[];
35
31
  export declare function iterateOnOptionsRaw(options: DropdownOption[], cb: (option: SingleOption) => void): void;
@@ -8,7 +8,6 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
8
8
  searchedString: string;
9
9
  searchedOptions: DropdownOption[];
10
10
  onApplyHandler: (optionSelect: SingleOption, returnOnly?: boolean) => ({
11
- children?: SingleOption[] | undefined;
12
11
  label: string;
13
12
  value: string;
14
13
  description?: string | null | undefined;
@@ -21,9 +20,7 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
21
20
  customComponent?: JSX.Element | undefined;
22
21
  searchKey?: string | undefined;
23
22
  selectedLabel?: string | undefined;
24
- parent?: SingleOption | undefined;
25
23
  } | {
26
- children?: SingleOption[] | undefined;
27
24
  label?: string | undefined;
28
25
  value?: string | undefined;
29
26
  description?: string | null | undefined;
@@ -36,7 +33,6 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
36
33
  customComponent?: JSX.Element | undefined;
37
34
  searchKey?: string | undefined;
38
35
  selectedLabel?: string | undefined;
39
- parent?: SingleOption | undefined;
40
36
  options: SingleOption[];
41
37
  })[] | undefined;
42
38
  selectAllHandler: (newState: SelectAllCheckboxState) => void;
@@ -32,7 +32,6 @@ export type GroupedOption = {
32
32
  options: (SingleOption | MultiSelectOption)[];
33
33
  };
34
34
  export type SingleOption = {
35
- children?: SingleOption[];
36
35
  label: string;
37
36
  value: string;
38
37
  description?: string | null;
@@ -45,7 +44,6 @@ export type SingleOption = {
45
44
  customComponent?: JSX.Element;
46
45
  searchKey?: string;
47
46
  selectedLabel?: string;
48
- parent?: SingleOption;
49
47
  };
50
48
  export type MultiSelectOption = SingleOption;
51
49
  export type DropdownOption = MultiSelectOption | SingleOption | GroupedOption;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { ButtonProps } from '../button/model';
2
3
  export type InputVariant = 'default' | 'small';
3
4
  export type InputStateI = 'invalid' | 'active' | 'read-only' | 'disabled' | 'disabled-invalid' | 'none';
4
5
  export type InputTypeI = 'number' | 'email' | 'text' | 'multiline' | 'url' | 'zip' | 'phonenumber' | 'password';
@@ -33,6 +34,7 @@ export interface InputProps {
33
34
  button?: {
34
35
  text: string;
35
36
  onClick?: () => void;
37
+ buttonProps?: ButtonProps;
36
38
  };
37
39
  suffixText?: string;
38
40
  prefixText?: string;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n from"../../assets/icons/info.svg.js";import{forwardRef as l,useState as r,useContext as o,useRef as a,useEffect as s}from"react";import{Button as c}from"../button/Button.js";import{isFunction as u,validateInput as h}from"./Input-helper.js";import{Tooltip as d}from"../tooltips/Tooltip.js";import{TitleSmall as v,BodySecondary as p}from"../TypographyStyle.js";import{COLORS as g}from"../../constants/Theme.js";import m from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as f}from"./context/InputStyleProvider.js";import{RootContainer as x,InputFooter as b,MaxCharStyle as y,InputWrapper as j,IconHolder as O,PrefixHolder as C,InputContainer as T,InputContainerSmall as w,SuffixHolder as k,InputHeader as I}from"./Input.styled.js";const L=l(((l,L)=>{var B,H,M,E,z,A,D;const{placeholder:F,leftIcon:P,rightIcon:N,labelText:S,maxCharLimit:K,isRequired:R,hintText:G,type:_,state:q,validate:V,variant:W,button:$,suffixText:J,prefixText:Q,onChangeText:U,value:X,noErrorHint:Y,reset:Z,rangeValidation:ee,noKeyDownChange:te,version:ie,noMaxCharCheck:ne,labelElement:le,autoGrow:re,minHeight:oe,maxHeight:ae,labelTextBold:se,truncateText:ce,maxCharLimitPosition:ue}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP"},l),he=null==P?void 0:P.icon,de=null==N?void 0:N.icon,[ve,pe]=r(!1),[ge,me]=r(!1),[fe,xe]=r(),be="small"===W?"18px":"22px",ye=o(f),[je,Oe]=r(),Ce=a(null),Te=null!=L?L:Ce;s((()=>{Oe(X),!X&&re&&(Te.current.style.height=oe||"48px")}),[X]),s((()=>{var e;Te.current&&(null===(e=l.onReferenceInit)||void 0===e||e.call(l,Te.current))}),[Te]),s((()=>{const e=Te.current;if(e&&["phonenumber","zip","number"].includes(_))return e.addEventListener("wheel",Le,{passive:!1}),()=>{e.removeEventListener("wheel",Le)}}),[]),s((()=>{Z&&Oe("")}),[Z]),s((()=>{var e;me(!!l.isActive),l.isActive&&(null===(e=Te.current)||void 0===e||e.focus())}),[l.isActive]),s((()=>{xe(l.errorMessage)}),[l.errorMessage]),s((()=>{var e;pe(!1),("invalid"===l.state||fe||"disabled-invalid"===l.state)&&pe(!0),"active"===l.state&&(null===(e=Te.current)||void 0===e||e.focus())}),[l.state,fe]),s((()=>{pe(!!fe||"invalid"===l.state)}),[fe,l.state]);const we=function(e){if(u(e)){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];e(...i)}},ke=()=>"zip"===_?6:2e3,Ie=e=>{const t=0!==K?K:ke();if(te||U(X||"",e),ne)return;const i=e.target.value;![8].includes(e.which)&&t>0&&i.length>=t&&e.preventDefault()},Le=e=>{e.preventDefault()},Be=e=>{let t=e.target.value;const i=0!==K?K+1:ke();!ne&&i>0&&t.length>=i&&(t=t.substring(0,i-1)),U(t,e),l.textControl||Oe(t),re&&(Te.current.style.height=`${Te.current.scrollHeight}px`,t||(Te.current.style.height=oe||"48px"));const n=V||h;if(!n||!u(n))return;const[r,o]=n(t,_,ee);pe(!r),xe(l.errorMessage?l.errorMessage:o)},He=e=>{var t;l.skipFocus||me(!0),we(null===(t=l.onFocus)||void 0===t?void 0:t.call(l,e))},Me=e=>{var t;l.skipFocus||me(!1),we(null===(t=l.onBlur)||void 0===t?void 0:t.call(l,e))},Ee=()=>{var n;return e(i,{children:["multiline"!==_&&t("input",{className:ce?"truncate-class":"","data-test":l["data-test"],id:l.id,style:null!==(n=null==ye?void 0:ye.input)&&void 0!==n?n:{},ref:Te,type:["phonenumber","zip","number"].includes(_)?"number":_,value:je,onFocus:e=>He(e),onBlur:e=>Me(e),placeholder:F||"Enter here",onChange:Be,onClick:e=>we(l.onClick),onKeyDown:e=>Ie(e)}),"multiline"===_&&t("textarea",{"data-test":l["data-test"],value:je,ref:Te,onFocus:e=>He(e),onBlur:e=>Me(e),onClick:e=>we(l.onClick),placeholder:F||"Enter here",onChange:Be,onKeyDown:e=>Ie(e),maxLength:K>0?K:void 0})]})};return e(x,Object.assign({width:l.width,height:l.height,state:q,type:_,style:null!==(B=null==ye?void 0:ye.RootContainer)&&void 0!==B?B:{}},{children:[e("div",Object.assign({className:"flex-align-center"},{children:[!Y&&(!!G||!!fe)&&e(b,Object.assign({invalid:!!fe},{children:[!!fe&&t(m,{width:16,height:16}),fe||G]})),K>0&&"BOTTOM"===ue&&e(y,Object.assign({position:"BOTTOM"},{children:[null!==(M=null===(H=l.value)||void 0===H?void 0:H.length)&&void 0!==M?M:0,"/",K]}))]})),e(j,Object.assign({variant:W,state:q,width:l.width,isActive:"active"===q||ge,isInvalid:ve,style:null!==(E=null==ye?void 0:ye.InputWrapper)&&void 0!==E?E:{},version:ie,height:l.height},{children:[!!he&&t(O,Object.assign({variant:W,iconSize:be,onClick:()=>we(null==P?void 0:P.callback),isLeft:!0,style:null!==(z=null==ye?void 0:ye.IconHolder)&&void 0!==z?z:{}},{children:t(he,{})})),!!Q&&t(C,Object.assign({variant:W},{children:Q})),"default"===W&&t(T,Object.assign({height:l.height,type:l.type,minHeight:oe,maxHeight:ae,autoGrow:re},{children:Ee()})),"small"===W&&t(w,Object.assign({height:l.height,type:l.type},{children:Ee()})),!!de&&t(O,Object.assign({variant:W,iconSize:be,onClick:()=>we(null==N?void 0:N.callback),isLeft:!1},{children:t(de,{})})),!!J&&t(k,Object.assign({variant:W},{children:J})),$&&$.text&&t(c,{buttonText:$.text,onClick:()=>we(null==$?void 0:$.onClick)})]})),(!!S||!!K)&&e(I,Object.assign({invalid:ve},{children:[le&&le,e("div",Object.assign({className:"label__container"},{children:[e(se?v:p,{children:[S,R?t("span",{children:"*"}):""]}),l.tooltipText&&t(d,Object.assign({body:l.tooltipText,placement:"top"},{children:t("span",{children:t(n,{style:{marginTop:-3},width:18,height:18,color:ve?g.content.negative:g.content.primary})})}))]})),K>0&&"TOP"===ue&&e(y,{children:[null!==(D=null===(A=l.value)||void 0===A?void 0:A.length)&&void 0!==D?D:0,"/",K]})]}))]}))}));L.displayName="Input";export{L as Input};
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import i from"../../assets/icons/info.svg.js";import{forwardRef as l,useState as r,useContext as o,useRef as a,useEffect as s}from"react";import{Button as c}from"../button/Button.js";import{isFunction as u,validateInput as h}from"./Input-helper.js";import{Tooltip as d}from"../tooltips/Tooltip.js";import{TitleSmall as v,BodySecondary as p}from"../TypographyStyle.js";import{COLORS as g}from"../../constants/Theme.js";import m from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as b}from"./context/InputStyleProvider.js";import{RootContainer as f,InputFooter as x,MaxCharStyle as y,InputWrapper as j,IconHolder as O,PrefixHolder as C,InputContainer as T,InputContainerSmall as w,SuffixHolder as k,InputHeader as I}from"./Input.styled.js";const L=l(((l,L)=>{var B,H,M,P,E,S,z;const{placeholder:A,leftIcon:D,rightIcon:F,labelText:N,maxCharLimit:K,isRequired:R,hintText:G,type:_,state:q,validate:V,variant:W,button:$,suffixText:J,prefixText:Q,onChangeText:U,value:X,noErrorHint:Y,reset:Z,rangeValidation:ee,noKeyDownChange:te,version:ne,noMaxCharCheck:ie,labelElement:le,autoGrow:re,minHeight:oe,maxHeight:ae,labelTextBold:se,truncateText:ce,maxCharLimitPosition:ue}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP"},l),he=null==D?void 0:D.icon,de=null==F?void 0:F.icon,[ve,pe]=r(!1),[ge,me]=r(!1),[be,fe]=r(),xe="small"===W?"18px":"22px",ye=o(b),[je,Oe]=r(),Ce=a(null),Te=null!=L?L:Ce;s((()=>{Oe(X),!X&&re&&(Te.current.style.height=oe||"48px")}),[X]),s((()=>{var e;Te.current&&(null===(e=l.onReferenceInit)||void 0===e||e.call(l,Te.current))}),[Te]),s((()=>{const e=Te.current;if(e&&["phonenumber","zip","number"].includes(_))return e.addEventListener("wheel",Le,{passive:!1}),()=>{e.removeEventListener("wheel",Le)}}),[]),s((()=>{Z&&Oe("")}),[Z]),s((()=>{var e;me(!!l.isActive),l.isActive&&(null===(e=Te.current)||void 0===e||e.focus())}),[l.isActive]),s((()=>{fe(l.errorMessage)}),[l.errorMessage]),s((()=>{var e;pe(!1),("invalid"===l.state||be||"disabled-invalid"===l.state)&&pe(!0),"active"===l.state&&(null===(e=Te.current)||void 0===e||e.focus())}),[l.state,be]),s((()=>{pe(!!be||"invalid"===l.state)}),[be,l.state]);const we=function(e){if(u(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e(...n)}},ke=()=>"zip"===_?6:2e3,Ie=e=>{const t=0!==K?K:ke();if(te||U(X||"",e),ie)return;const n=e.target.value;![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},Le=e=>{e.preventDefault()},Be=e=>{let t=e.target.value;const n=0!==K?K+1:ke();!ie&&n>0&&t.length>=n&&(t=t.substring(0,n-1)),U(t,e),l.textControl||Oe(t),re&&(Te.current.style.height=`${Te.current.scrollHeight}px`,t||(Te.current.style.height=oe||"48px"));const i=V||h;if(!i||!u(i))return;const[r,o]=i(t,_,ee);pe(!r),fe(l.errorMessage?l.errorMessage:o)},He=e=>{var t;l.skipFocus||me(!0),we(null===(t=l.onFocus)||void 0===t?void 0:t.call(l,e))},Me=e=>{var t;l.skipFocus||me(!1),we(null===(t=l.onBlur)||void 0===t?void 0:t.call(l,e))},Pe=()=>{var i;return e(n,{children:["multiline"!==_&&t("input",{className:ce?"truncate-class":"","data-test":l["data-test"],id:l.id,style:null!==(i=null==ye?void 0:ye.input)&&void 0!==i?i:{},ref:Te,type:["phonenumber","zip","number"].includes(_)?"number":_,value:je,onFocus:e=>He(e),onBlur:e=>Me(e),placeholder:A||"Enter here",onChange:Be,onClick:e=>we(l.onClick),onKeyDown:e=>Ie(e)}),"multiline"===_&&t("textarea",{"data-test":l["data-test"],value:je,ref:Te,onFocus:e=>He(e),onBlur:e=>Me(e),onClick:e=>we(l.onClick),placeholder:A||"Enter here",onChange:Be,onKeyDown:e=>Ie(e),maxLength:K>0?K:void 0})]})};return e(f,Object.assign({width:l.width,height:l.height,state:q,type:_,style:null!==(B=null==ye?void 0:ye.RootContainer)&&void 0!==B?B:{}},{children:[e("div",Object.assign({className:"flex-align-center"},{children:[!Y&&(!!G||!!be)&&e(x,Object.assign({invalid:!!be},{children:[!!be&&t(m,{width:16,height:16}),be||G]})),K>0&&"BOTTOM"===ue&&e(y,Object.assign({position:"BOTTOM"},{children:[null!==(M=null===(H=(null!=X?X:"").toString())||void 0===H?void 0:H.length)&&void 0!==M?M:0,"/",K]}))]})),e(j,Object.assign({variant:W,state:q,width:l.width,isActive:"active"===q||ge,isInvalid:ve,style:null!==(P=null==ye?void 0:ye.InputWrapper)&&void 0!==P?P:{},version:ne,height:l.height},{children:[!!he&&t(O,Object.assign({variant:W,iconSize:xe,onClick:()=>we(null==D?void 0:D.callback),isLeft:!0,style:null!==(E=null==ye?void 0:ye.IconHolder)&&void 0!==E?E:{}},{children:t(he,{})})),!!Q&&t(C,Object.assign({variant:W},{children:Q})),"default"===W&&t(T,Object.assign({height:l.height,type:l.type,minHeight:oe,maxHeight:ae,autoGrow:re},{children:Pe()})),"small"===W&&t(w,Object.assign({height:l.height,type:l.type},{children:Pe()})),!!de&&t(O,Object.assign({variant:W,iconSize:xe,onClick:()=>we(null==F?void 0:F.callback),isLeft:!1},{children:t(de,{})})),!!J&&t(k,Object.assign({variant:W},{children:J})),$&&$.text&&t(c,{buttonText:$.text,onClick:()=>we(null==$?void 0:$.onClick)}),$&&$.buttonProps&&t(c,Object.assign({},$.buttonProps))]})),(!!N||!!K)&&e(I,Object.assign({invalid:ve},{children:[le&&le,e("div",Object.assign({className:"label__container"},{children:[e(se?v:p,{children:[N,R?t("span",{children:"*"}):""]}),l.tooltipText&&t(d,Object.assign({body:l.tooltipText,placement:"top"},{children:t("span",{children:t(i,{style:{marginTop:-3},width:18,height:18,color:ve?g.content.negative:g.content.primary})})}))]})),K>0&&"TOP"===ue&&e(y,{children:[null!==(z=null===(S=(null!=X?X:"").toString())||void 0===S?void 0:S.length)&&void 0!==z?z:0,"/",K]})]}))]}))}));L.displayName="Input";export{L as Input};